@tap-payments/auth-jsconnect 2.5.16-test → 2.5.18-test
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/build/features/app/connect/connectStore.js +0 -6
- package/build/features/connect/screens/BrandSegment/BrandSegment.js +2 -2
- package/build/features/connect/screens/CivilID/CivilID.js +2 -2
- package/build/features/connect/screens/Individual/Individual.js +1 -4
- package/build/features/connect/screens/Individual/MobileNumber.js +4 -0
- package/build/features/connect/screens/Merchant/Merchant.js +2 -3
- package/build/features/connect/screens/Mobile/Mobile.js +1 -5
- package/build/features/connect/screens/Mobile/MobileNumber.js +4 -2
- package/build/features/connect/screens/NID/NID.js +5 -1
- package/build/features/connect/screens/OTP/OTP.js +3 -7
- package/build/features/connect/screens/OTP/OTPInput.js +0 -4
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +4 -0
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +4 -0
- package/build/features/individual/screens/IndividualList/MobileNumber.js +4 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +4 -0
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +4 -0
- package/build/features/signIn/screens/Mobile/MobileNumber.js +4 -0
- package/build/hooks/useSetFromDefaultValues.js +3 -24
- package/package.json +1 -1
|
@@ -78,7 +78,6 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
78
78
|
return __generator(this, function (_c) {
|
|
79
79
|
switch (_c.label) {
|
|
80
80
|
case 0:
|
|
81
|
-
console.log('createMobileAuth backend call started');
|
|
82
81
|
settings = thunkApi.getState().settings;
|
|
83
82
|
requestBody = {
|
|
84
83
|
country: settings.data.businessCountry.iso2,
|
|
@@ -96,7 +95,6 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
96
95
|
return [4, API.authService.createAuth(requestBody)];
|
|
97
96
|
case 1:
|
|
98
97
|
data = _c.sent();
|
|
99
|
-
console.log('createMobileAuth backend call done');
|
|
100
98
|
thunkApi.dispatch(handleNextScreenStep());
|
|
101
99
|
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
102
100
|
return [2, { response: data, formData: params }];
|
|
@@ -781,11 +779,7 @@ export var connectSlice = createSlice({
|
|
|
781
779
|
state.loading = false;
|
|
782
780
|
state.error = null;
|
|
783
781
|
var _a = action.payload, formData = _a.formData, response = _a.response;
|
|
784
|
-
console.log('createMobileAuth fulfilled before store form data');
|
|
785
|
-
debugger;
|
|
786
782
|
state.data.mobileData = formData;
|
|
787
|
-
debugger;
|
|
788
|
-
console.log('createMobileAuth fulfilled after store form data');
|
|
789
783
|
state.data.mobileData.responseBody = response;
|
|
790
784
|
state.data.otpData.authFor = AuthForType.MOBILE;
|
|
791
785
|
})
|
|
@@ -50,12 +50,12 @@ var BrandSegment = function (_a) {
|
|
|
50
50
|
}, []);
|
|
51
51
|
var methods = useForm({
|
|
52
52
|
resolver: yupResolver(BrandSegmentValidationSchema()),
|
|
53
|
-
defaultValues: {
|
|
53
|
+
defaultValues: __assign({
|
|
54
54
|
segmentLocation: segmentLocation,
|
|
55
55
|
segmentProfit: segmentProfit,
|
|
56
56
|
segmentTech: segmentTech,
|
|
57
57
|
teamSize: teamSize
|
|
58
|
-
},
|
|
58
|
+
}),
|
|
59
59
|
mode: 'onChange'
|
|
60
60
|
});
|
|
61
61
|
var t = useTranslation().t;
|
|
@@ -64,10 +64,10 @@ var CivilID = function (_a) {
|
|
|
64
64
|
var _c = data.civilIdData, civilId = _c.civilId, termAndConditionChecked = _c.termAndConditionChecked;
|
|
65
65
|
var methods = useForm({
|
|
66
66
|
resolver: yupResolver(civilIDValidationSchema),
|
|
67
|
-
defaultValues: {
|
|
67
|
+
defaultValues: __assign({
|
|
68
68
|
civilId: civilId,
|
|
69
69
|
termAndConditionChecked: termAndConditionChecked
|
|
70
|
-
},
|
|
70
|
+
}),
|
|
71
71
|
mode: 'onChange'
|
|
72
72
|
});
|
|
73
73
|
useSetFromDefaultValues(methods, data.civilIdData);
|
|
@@ -61,7 +61,6 @@ var Individual = function (_a) {
|
|
|
61
61
|
var contact = (otpData.responseBody || {}).contact;
|
|
62
62
|
var responseBody = individualData.responseBody, defaultValues = __rest(individualData, ["responseBody"]);
|
|
63
63
|
var is_available = (responseBody || {}).is_available;
|
|
64
|
-
console.log('Individual start');
|
|
65
64
|
var methods = useForm({
|
|
66
65
|
resolver: yupResolver(isMobile ? IndividualValidation : IndividualMobileValidation),
|
|
67
66
|
defaultValues: individualData,
|
|
@@ -76,10 +75,8 @@ var Individual = function (_a) {
|
|
|
76
75
|
});
|
|
77
76
|
}, []);
|
|
78
77
|
React.useEffect(function () {
|
|
79
|
-
if (defaultValues.countryCode.iso2 !== methods.getValues('countryCode.iso2'))
|
|
80
|
-
console.log('individual country setValue');
|
|
78
|
+
if (defaultValues.countryCode.iso2 !== methods.getValues('countryCode.iso2'))
|
|
81
79
|
methods.setValue('countryCode', defaultValues.countryCode);
|
|
82
|
-
}
|
|
83
80
|
}, [defaultValues.countryCode]);
|
|
84
81
|
var onSubmit = function (formData) {
|
|
85
82
|
dispatch(updateLeadIndividual(formData));
|
|
@@ -100,6 +100,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
100
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
101
101
|
var _k = ((_f = (_e = data.otpData.responseBody) === null || _e === void 0 ? void 0 : _e.contact) === null || _f === void 0 ? void 0 : _f.phone) || {}, number = _k.number, country_code = _k.country_code;
|
|
102
102
|
var readOnly = number && country_code && !error;
|
|
103
|
+
React.useEffect(function () {
|
|
104
|
+
if (mobileValue)
|
|
105
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
106
|
+
}, []);
|
|
103
107
|
var onPhoneNumberChange = function (_a) {
|
|
104
108
|
var target = _a.target;
|
|
105
109
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -41,7 +41,6 @@ var Merchant = function (_a) {
|
|
|
41
41
|
var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels;
|
|
42
42
|
var brandList = (responseBody || {}).brand_list;
|
|
43
43
|
var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
|
|
44
|
-
console.log('Merchant start');
|
|
45
44
|
React.useEffect(function () {
|
|
46
45
|
sendCustomEventToGTM({
|
|
47
46
|
event: 'Send Event',
|
|
@@ -51,12 +50,12 @@ var Merchant = function (_a) {
|
|
|
51
50
|
}, []);
|
|
52
51
|
var methods = useForm({
|
|
53
52
|
resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
|
|
54
|
-
defaultValues: {
|
|
53
|
+
defaultValues: __assign({
|
|
55
54
|
brandName: brandName || ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.name) === null || _b === void 0 ? void 0 : _b.en),
|
|
56
55
|
selectedBrandItem: selectedBrandItem,
|
|
57
56
|
termAndConditionChecked: termAndConditionChecked,
|
|
58
57
|
salesChannels: salesChannels
|
|
59
|
-
},
|
|
58
|
+
}),
|
|
60
59
|
mode: 'onChange'
|
|
61
60
|
});
|
|
62
61
|
var t = useTranslation().t;
|
|
@@ -103,13 +103,9 @@ var Mobile = function (_a) {
|
|
|
103
103
|
dispatch(clearError());
|
|
104
104
|
}, [methods.formState.isValid]);
|
|
105
105
|
var onSubmit = function (formData) {
|
|
106
|
-
|
|
107
|
-
dispatch(createMobileAuth(__assign({}, formData)));
|
|
108
|
-
console.log('createMobileAuth done');
|
|
106
|
+
dispatch(createMobileAuth(formData));
|
|
109
107
|
dispatch(resetNIDScreen());
|
|
110
|
-
console.log('resetNIDScreen done');
|
|
111
108
|
dispatch(resetCivilScreen());
|
|
112
|
-
debugger;
|
|
113
109
|
};
|
|
114
110
|
var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
|
|
115
111
|
var onBack = function () {
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
99
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -128,9 +132,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
128
132
|
};
|
|
129
133
|
var onSelectItem = function (country) {
|
|
130
134
|
onCloseCountryList();
|
|
131
|
-
debugger;
|
|
132
135
|
setValue('mobile', '');
|
|
133
|
-
debugger;
|
|
134
136
|
var prevCountry = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2;
|
|
135
137
|
sendCustomEventToGTM({
|
|
136
138
|
event: 'Send Event',
|
|
@@ -63,10 +63,14 @@ var NID = function (_a) {
|
|
|
63
63
|
var dispatch = useAppDispatch();
|
|
64
64
|
var t = useTranslation().t;
|
|
65
65
|
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
66
|
+
var _d = data.nidData, dob = _d.dob, nid = _d.nid;
|
|
66
67
|
var settingsStore = useAppSelector(settingsSelector);
|
|
67
68
|
var methods = useForm({
|
|
68
69
|
resolver: yupResolver(NIDValidationSchema),
|
|
69
|
-
defaultValues:
|
|
70
|
+
defaultValues: {
|
|
71
|
+
dob: dob,
|
|
72
|
+
nid: nid
|
|
73
|
+
},
|
|
70
74
|
mode: 'onChange'
|
|
71
75
|
});
|
|
72
76
|
React.useEffect(function () {
|
|
@@ -54,16 +54,12 @@ var OTP = function () {
|
|
|
54
54
|
var otp = data.otpData.otp;
|
|
55
55
|
var methods = useForm({
|
|
56
56
|
resolver: yupResolver(OTPValidation),
|
|
57
|
-
defaultValues:
|
|
57
|
+
defaultValues: {
|
|
58
58
|
otp: otp
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
60
|
mode: 'onChange'
|
|
61
61
|
});
|
|
62
|
-
console.log('OTP start');
|
|
63
|
-
debugger;
|
|
64
62
|
useSetFromDefaultValues(methods, data.otpData);
|
|
65
|
-
debugger;
|
|
66
|
-
console.log('OTP end');
|
|
67
63
|
var t = useTranslation().t;
|
|
68
64
|
var isAr = useLanguage().isAr;
|
|
69
65
|
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
@@ -82,7 +78,7 @@ var OTP = function () {
|
|
|
82
78
|
};
|
|
83
79
|
}, [methods.formState.isValid]);
|
|
84
80
|
var onSubmit = function (formData) {
|
|
85
|
-
dispatch(verifyAuth(
|
|
81
|
+
dispatch(verifyAuth(formData));
|
|
86
82
|
};
|
|
87
83
|
var onBack = function () {
|
|
88
84
|
dispatch(handlePrevScreenStep(startWithNID ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
|
|
@@ -49,18 +49,14 @@ var OTPInput = function (_a) {
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
var handleOnResendOTP = function () {
|
|
52
|
-
debugger;
|
|
53
52
|
if (otpControl.field.value)
|
|
54
53
|
setValue('otp', '', { shouldValidate: true });
|
|
55
|
-
debugger;
|
|
56
54
|
sendEventAskAnotherOTP();
|
|
57
55
|
dispatch(resendOTPMobile());
|
|
58
56
|
};
|
|
59
57
|
var handleOnResendAbsherOTP = function () {
|
|
60
|
-
debugger;
|
|
61
58
|
if (otpControl.field.value)
|
|
62
59
|
setValue('otp', '', { shouldValidate: true });
|
|
63
|
-
debugger;
|
|
64
60
|
sendEventAskAnotherOTP();
|
|
65
61
|
dispatch(resendOTPNID());
|
|
66
62
|
};
|
|
@@ -96,6 +96,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
96
96
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
97
97
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
98
98
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
99
|
+
React.useEffect(function () {
|
|
100
|
+
if (mobileValue)
|
|
101
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
102
|
+
}, []);
|
|
99
103
|
var onPhoneNumberChange = function (_a) {
|
|
100
104
|
var target = _a.target;
|
|
101
105
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
99
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
99
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
100
100
|
var verify = data.verify;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
99
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
99
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
100
100
|
var verify = data.verify;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -98,6 +98,10 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
99
99
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
100
100
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
101
|
+
React.useEffect(function () {
|
|
102
|
+
if (mobileValue)
|
|
103
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
104
|
+
}, []);
|
|
101
105
|
var onPhoneNumberChange = function (_a) {
|
|
102
106
|
var target = _a.target;
|
|
103
107
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { useEffect } from 'react';
|
|
13
2
|
var isValidValue = function (value) {
|
|
14
3
|
if (Array.isArray(value))
|
|
@@ -19,27 +8,17 @@ var isValidValue = function (value) {
|
|
|
19
8
|
};
|
|
20
9
|
export var useSetFromDefaultValues = function (method, defaultValues, shouldValidate) {
|
|
21
10
|
if (shouldValidate === void 0) { shouldValidate = false; }
|
|
22
|
-
var values = __assign({}, defaultValues);
|
|
23
|
-
console.log('useSetFromDefaultValues start');
|
|
24
|
-
console.log('defaultValues', values);
|
|
25
11
|
var setFromDefaultValues = function () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
console.log('key', key);
|
|
29
|
-
console.log('values[key]', values[key]);
|
|
30
|
-
if (Object.prototype.hasOwnProperty.call(values, key)) {
|
|
12
|
+
for (var key in defaultValues) {
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(defaultValues, key)) {
|
|
31
14
|
if (key === 'responseBody')
|
|
32
15
|
continue;
|
|
33
|
-
var value =
|
|
16
|
+
var value = defaultValues[key];
|
|
34
17
|
if (!isValidValue(method.getValues(key)) && isValidValue(value)) {
|
|
35
|
-
console.log('useSetFromDefaultValues setValue');
|
|
36
|
-
debugger;
|
|
37
18
|
method.setValue(key, value, { shouldValidate: shouldValidate });
|
|
38
|
-
debugger;
|
|
39
19
|
}
|
|
40
20
|
}
|
|
41
21
|
}
|
|
42
|
-
console.log('useSetFromDefaultValues end');
|
|
43
22
|
};
|
|
44
23
|
useEffect(function () {
|
|
45
24
|
setFromDefaultValues();
|