@tap-payments/auth-jsconnect 2.1.63-test → 2.1.66-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/@types/app.d.ts +4 -1
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +0 -2
- package/build/app/store.d.ts +0 -2
- package/build/constants/app.d.ts +0 -1
- package/build/constants/app.js +0 -14
- package/build/features/app/connectExpress/connectExpressStore.d.ts +5 -0
- package/build/features/app/connectExpress/connectExpressStore.js +24 -26
- package/build/features/bank/Bank.d.ts +1 -1
- package/build/features/bank/Bank.js +7 -4
- package/build/features/brand/Brand.d.ts +1 -1
- package/build/features/brand/Brand.js +8 -6
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +7 -4
- package/build/features/connect/Connect.d.ts +1 -2
- package/build/features/connect/Connect.js +11 -20
- package/build/features/connectExpress/ConnectExpress.d.ts +1 -1
- package/build/features/connectExpress/ConnectExpress.js +7 -4
- package/build/features/entity/Entity.d.ts +1 -1
- package/build/features/entity/Entity.js +7 -4
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +0 -12
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +7 -4
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +7 -4
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +7 -4
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +7 -4
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/index.d.ts +12 -13
- package/build/index.js +12 -15
- package/build/utils/html.d.ts +0 -1
- package/build/utils/html.js +2 -10
- package/package.json +129 -130
- package/build/features/app/auth/authStore.d.ts +0 -46
- package/build/features/app/auth/authStore.js +0 -256
- package/build/features/auth/Auth.d.ts +0 -11
- package/build/features/auth/Auth.js +0 -79
- package/build/features/auth/index.d.ts +0 -1
- package/build/features/auth/index.js +0 -1
- package/build/features/auth/screens/NID/DOB.d.ts +0 -7
- package/build/features/auth/screens/NID/DOB.js +0 -47
- package/build/features/auth/screens/NID/IDNumber.d.ts +0 -3
- package/build/features/auth/screens/NID/IDNumber.js +0 -64
- package/build/features/auth/screens/NID/NID.d.ts +0 -5
- package/build/features/auth/screens/NID/NID.js +0 -68
- package/build/features/auth/screens/NID/TAC.d.ts +0 -3
- package/build/features/auth/screens/NID/TAC.js +0 -85
- package/build/features/auth/screens/NID/index.d.ts +0 -3
- package/build/features/auth/screens/NID/index.js +0 -2
- package/build/features/auth/screens/NID/validation.d.ts +0 -27
- package/build/features/auth/screens/NID/validation.js +0 -19
- package/build/features/auth/screens/OTP/OTP.d.ts +0 -5
- package/build/features/auth/screens/OTP/OTP.js +0 -76
- package/build/features/auth/screens/OTP/OTPInput.d.ts +0 -5
- package/build/features/auth/screens/OTP/OTPInput.js +0 -51
- package/build/features/auth/screens/OTP/index.d.ts +0 -3
- package/build/features/auth/screens/OTP/index.js +0 -2
- package/build/features/auth/screens/OTP/validation.d.ts +0 -8
- package/build/features/auth/screens/OTP/validation.js +0 -4
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var _a;
|
|
38
|
-
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
39
|
-
import { handleNextScreenStep, handleOpen } from '../../../app/settings';
|
|
40
|
-
import API from '../../../api';
|
|
41
|
-
import { getEighteenYearsAgo } from '../../../utils';
|
|
42
|
-
import { IDENTIFICATION_TYPE } from '../../../constants';
|
|
43
|
-
export var retrieveLead = createAsyncThunk('retrieveLeadAuthKit', function (leadId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
-
var data;
|
|
45
|
-
return __generator(this, function (_a) {
|
|
46
|
-
switch (_a.label) {
|
|
47
|
-
case 0: return [4, API.leadService.retrieveLeadIdentity(leadId)];
|
|
48
|
-
case 1:
|
|
49
|
-
data = _a.sent();
|
|
50
|
-
return [2, data];
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}); });
|
|
54
|
-
export var verifyAuthOTP = createAsyncThunk('verifyAuthOTPKit', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var _a, settings, auth, _b, postUrl, verifyToken, device_token, leadId, service_name, payload, data;
|
|
56
|
-
var _c, _d, _e, _f;
|
|
57
|
-
return __generator(this, function (_g) {
|
|
58
|
-
switch (_g.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
61
|
-
_b = auth.data, postUrl = _b.postUrl, verifyToken = _b.verifyToken, device_token = _b.device_token, leadId = _b.leadId, service_name = _b.service_name;
|
|
62
|
-
payload = {
|
|
63
|
-
auth_token: verifyToken,
|
|
64
|
-
lead_id: leadId,
|
|
65
|
-
data: params.otp,
|
|
66
|
-
post_url: postUrl,
|
|
67
|
-
auth_type: 2,
|
|
68
|
-
device_token: device_token || '',
|
|
69
|
-
service_name: service_name || 'ABSHER',
|
|
70
|
-
sign_in: false,
|
|
71
|
-
terms: auth.data.termAndConditionChecked ? ['general'] : [],
|
|
72
|
-
encryption_contract: ['data']
|
|
73
|
-
};
|
|
74
|
-
return [4, API.authService.verifyExpressAuth(payload)];
|
|
75
|
-
case 1:
|
|
76
|
-
data = _g.sent();
|
|
77
|
-
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
78
|
-
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data);
|
|
79
|
-
thunkApi.dispatch(handleOpen(false));
|
|
80
|
-
return [2, { response: data, formData: params }];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}); });
|
|
84
|
-
export var createAuth = createAsyncThunk('authCreateAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
|
-
var _a, auth, settings, _b, responseBody, leadId, nid, dob, identification_id_type, requestBody, data;
|
|
86
|
-
var _c;
|
|
87
|
-
return __generator(this, function (_d) {
|
|
88
|
-
switch (_d.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
_a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
|
|
91
|
-
_b = auth.data, responseBody = _b.responseBody, leadId = _b.leadId;
|
|
92
|
-
nid = params.nid, dob = params.dob;
|
|
93
|
-
identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
|
|
94
|
-
? undefined
|
|
95
|
-
: params.nid.startsWith('1')
|
|
96
|
-
? IDENTIFICATION_TYPE.NID
|
|
97
|
-
: IDENTIFICATION_TYPE.IQAMA;
|
|
98
|
-
requestBody = {
|
|
99
|
-
country: settings.data.businessCountry.iso2,
|
|
100
|
-
scope: settings.data.appConfig.scope,
|
|
101
|
-
lang: settings.data.language,
|
|
102
|
-
lead_id: leadId,
|
|
103
|
-
user_credentail: {
|
|
104
|
-
identification_id: nid,
|
|
105
|
-
identification_id_type: identification_id_type,
|
|
106
|
-
date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
|
|
107
|
-
},
|
|
108
|
-
sign_in: false,
|
|
109
|
-
is_lead: false,
|
|
110
|
-
encryption_contract: ['user_credentail.identification_id', 'user_credentail.identification_id_type', 'user_credentail.date_of_birth']
|
|
111
|
-
};
|
|
112
|
-
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
113
|
-
case 1:
|
|
114
|
-
data = _d.sent();
|
|
115
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
116
|
-
return [2, { data: data, formData: params }];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}); });
|
|
120
|
-
export var resendOTP = createAsyncThunk('authResendOTP', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
121
|
-
var _a, auth, settings, _b, nid, dob, responseBody, leadId, identification_id_type, requestBody, data;
|
|
122
|
-
var _c;
|
|
123
|
-
return __generator(this, function (_d) {
|
|
124
|
-
switch (_d.label) {
|
|
125
|
-
case 0:
|
|
126
|
-
_a = thunkApi.getState(), auth = _a.auth, settings = _a.settings;
|
|
127
|
-
_b = auth.data, nid = _b.nid, dob = _b.dob, responseBody = _b.responseBody, leadId = _b.leadId;
|
|
128
|
-
identification_id_type = ((_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _c === void 0 ? void 0 : _c.id)
|
|
129
|
-
? undefined
|
|
130
|
-
: nid.startsWith('1')
|
|
131
|
-
? IDENTIFICATION_TYPE.NID
|
|
132
|
-
: IDENTIFICATION_TYPE.IQAMA;
|
|
133
|
-
requestBody = {
|
|
134
|
-
country: settings.data.businessCountry.iso2,
|
|
135
|
-
scope: settings.data.appConfig.scope,
|
|
136
|
-
lang: settings.data.language,
|
|
137
|
-
lead_id: leadId,
|
|
138
|
-
user_credentail: {
|
|
139
|
-
identification_id: nid,
|
|
140
|
-
identification_id_type: identification_id_type,
|
|
141
|
-
date_of_birth: !(responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth) ? dob : undefined
|
|
142
|
-
},
|
|
143
|
-
sign_in: false,
|
|
144
|
-
is_lead: false,
|
|
145
|
-
encryption_contract: ['user_credentail.identification_id', 'user_credentail.identification_id_type', 'user_credentail.date_of_birth']
|
|
146
|
-
};
|
|
147
|
-
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
148
|
-
case 1:
|
|
149
|
-
data = _d.sent();
|
|
150
|
-
return [2, data];
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}); });
|
|
154
|
-
var initialState = {
|
|
155
|
-
error: null,
|
|
156
|
-
loading: false,
|
|
157
|
-
customLoading: false,
|
|
158
|
-
data: {
|
|
159
|
-
verifyToken: undefined,
|
|
160
|
-
leadId: '',
|
|
161
|
-
postUrl: '',
|
|
162
|
-
otp: '',
|
|
163
|
-
nid: '',
|
|
164
|
-
termAndConditionChecked: false,
|
|
165
|
-
dob: getEighteenYearsAgo(),
|
|
166
|
-
countryISOCode: ''
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
export var authSlice = createSlice({
|
|
170
|
-
name: 'auth/store',
|
|
171
|
-
initialState: initialState,
|
|
172
|
-
reducers: {
|
|
173
|
-
clearError: function (state) {
|
|
174
|
-
state.error = null;
|
|
175
|
-
},
|
|
176
|
-
stopLoader: function (state) {
|
|
177
|
-
state.loading = false;
|
|
178
|
-
},
|
|
179
|
-
resetOTPScreen: function (state) {
|
|
180
|
-
state.data.otp = '';
|
|
181
|
-
},
|
|
182
|
-
storeLeadId: function (state, action) {
|
|
183
|
-
var leadId = action.payload.leadId;
|
|
184
|
-
state.data.leadId = leadId;
|
|
185
|
-
},
|
|
186
|
-
storePostUrl: function (state, action) {
|
|
187
|
-
var postUrl = action.payload.postUrl;
|
|
188
|
-
state.data.postUrl = postUrl;
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
extraReducers: function (builder) {
|
|
192
|
-
builder
|
|
193
|
-
.addCase(retrieveLead.pending, function (state) {
|
|
194
|
-
state.customLoading = true;
|
|
195
|
-
state.error = null;
|
|
196
|
-
})
|
|
197
|
-
.addCase(retrieveLead.fulfilled, function (state, action) {
|
|
198
|
-
var _a;
|
|
199
|
-
state.customLoading = false;
|
|
200
|
-
state.error = null;
|
|
201
|
-
var data = action.payload;
|
|
202
|
-
state.data.nid = (_a = data === null || data === void 0 ? void 0 : data.identification) === null || _a === void 0 ? void 0 : _a.id;
|
|
203
|
-
state.data.countryISOCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
204
|
-
state.data.responseBody = data;
|
|
205
|
-
})
|
|
206
|
-
.addCase(retrieveLead.rejected, function (state, action) {
|
|
207
|
-
state.loading = false;
|
|
208
|
-
state.error = action.error.message;
|
|
209
|
-
})
|
|
210
|
-
.addCase(createAuth.pending, function (state) {
|
|
211
|
-
state.loading = true;
|
|
212
|
-
state.error = null;
|
|
213
|
-
})
|
|
214
|
-
.addCase(createAuth.fulfilled, function (state, action) {
|
|
215
|
-
state.loading = false;
|
|
216
|
-
state.error = null;
|
|
217
|
-
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
218
|
-
state.data.verifyToken = data === null || data === void 0 ? void 0 : data.auth_token;
|
|
219
|
-
state.data.dob = formData.dob;
|
|
220
|
-
state.data.nid = formData.nid;
|
|
221
|
-
state.data.termAndConditionChecked = formData.termAndConditionChecked;
|
|
222
|
-
state.data.device_token = data === null || data === void 0 ? void 0 : data.device_token;
|
|
223
|
-
state.data.service_name = data === null || data === void 0 ? void 0 : data.service_name;
|
|
224
|
-
})
|
|
225
|
-
.addCase(createAuth.rejected, function (state, action) {
|
|
226
|
-
state.loading = false;
|
|
227
|
-
state.error = action.error.message;
|
|
228
|
-
})
|
|
229
|
-
.addCase(verifyAuthOTP.pending, function (state) {
|
|
230
|
-
state.loading = true;
|
|
231
|
-
state.error = null;
|
|
232
|
-
})
|
|
233
|
-
.addCase(verifyAuthOTP.fulfilled, function (state) {
|
|
234
|
-
state.loading = false;
|
|
235
|
-
state.error = null;
|
|
236
|
-
})
|
|
237
|
-
.addCase(verifyAuthOTP.rejected, function (state, action) {
|
|
238
|
-
state.loading = false;
|
|
239
|
-
state.error = action.error.message;
|
|
240
|
-
})
|
|
241
|
-
.addCase(resendOTP.pending, function (state) {
|
|
242
|
-
state.error = null;
|
|
243
|
-
})
|
|
244
|
-
.addCase(resendOTP.fulfilled, function (state, action) {
|
|
245
|
-
state.error = null;
|
|
246
|
-
var data = action.payload;
|
|
247
|
-
state.data.verifyToken = data === null || data === void 0 ? void 0 : data.auth_token;
|
|
248
|
-
})
|
|
249
|
-
.addCase(resendOTP.rejected, function (state, action) {
|
|
250
|
-
state.error = action.error.message;
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
export var clearError = (_a = authSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeLeadId = _a.storeLeadId, storePostUrl = _a.storePostUrl;
|
|
255
|
-
export default authSlice.reducer;
|
|
256
|
-
export var authSelector = function (state) { return state.auth; };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { LibConfig } from '../../@types';
|
|
3
|
-
export interface AuthLibProps extends LibConfig {
|
|
4
|
-
postURL: string;
|
|
5
|
-
leadId: string;
|
|
6
|
-
onClose?: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function AuthLib(props: AuthLibProps): JSX.Element;
|
|
9
|
-
export declare function renderAuthLib(config: AuthLibProps, elementId: string): {
|
|
10
|
-
unmount: () => void;
|
|
11
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
-
import { memo, useEffect } from 'react';
|
|
25
|
-
import { FeatureContainer } from '../shared/Containers';
|
|
26
|
-
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
|
|
27
|
-
import { settingsSelector, handleOpen } from '../../app/settings';
|
|
28
|
-
import AnimationFlow from '../../components/AnimationFlow';
|
|
29
|
-
import { store } from '../../app/store';
|
|
30
|
-
import { authSelector, retrieveLead, storeLeadId, storePostUrl } from '../app/auth/authStore';
|
|
31
|
-
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
32
|
-
import Collapse from '../../components/Collapse';
|
|
33
|
-
import { reactElement } from '../../utils';
|
|
34
|
-
import { AUTH_SCREENS_NAVIGATION } from '../../constants';
|
|
35
|
-
import { authFeatureScreens } from '../featuresScreens';
|
|
36
|
-
import Background from '../shared/Background';
|
|
37
|
-
var Auth = memo(function (_a) {
|
|
38
|
-
var onClose = _a.onClose, props = __rest(_a, ["onClose"]);
|
|
39
|
-
var theme = useAppTheme().theme;
|
|
40
|
-
var dispatch = useAppDispatch();
|
|
41
|
-
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
42
|
-
var _c = useAppSelector(authSelector), authError = _c.error, customLoading = _c.customLoading, loading = _c.loading;
|
|
43
|
-
useAppConfig(__assign({ navigation: AUTH_SCREENS_NAVIGATION, disableCountries: true, disableLocale: true }, props));
|
|
44
|
-
useErrorListener(authError || error);
|
|
45
|
-
useStepStartedListener();
|
|
46
|
-
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
if (!props.leadId)
|
|
49
|
-
throw new Error('leadId is required');
|
|
50
|
-
var _a = props || {}, leadId = _a.leadId, postURL = _a.postURL;
|
|
51
|
-
var data = {
|
|
52
|
-
postUrl: postURL
|
|
53
|
-
};
|
|
54
|
-
if (!props.open)
|
|
55
|
-
return;
|
|
56
|
-
dispatch(storePostUrl(data));
|
|
57
|
-
dispatch(storeLeadId({ leadId: leadId }));
|
|
58
|
-
}, []);
|
|
59
|
-
useEffect(function () {
|
|
60
|
-
if (data.isValidOperator && props.open)
|
|
61
|
-
dispatch(retrieveLead(props.leadId));
|
|
62
|
-
}, [data.isValidOperator]);
|
|
63
|
-
var handleDialogClose = function () {
|
|
64
|
-
dispatch(handleOpen(false));
|
|
65
|
-
};
|
|
66
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(_Fragment, {}), screenId: activeScreen.name, animationType: 'collapse' }, { children: _jsx(FeatureContainer, { children: authFeatureScreens.map(function (_a, index) {
|
|
67
|
-
var Element = _a.element, name = _a.name;
|
|
68
|
-
var isActive = activeScreen.name === name;
|
|
69
|
-
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
70
|
-
}) }) })) })) })));
|
|
71
|
-
});
|
|
72
|
-
export function AuthLib(props) {
|
|
73
|
-
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Auth, __assign({}, props)) })));
|
|
74
|
-
}
|
|
75
|
-
export function renderAuthLib(config, elementId) {
|
|
76
|
-
var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
|
|
77
|
-
render(_jsx(AuthLib, __assign({}, config)));
|
|
78
|
-
return { unmount: unmount };
|
|
79
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Auth';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Auth';
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
18
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
19
|
-
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
20
|
-
import Text from '../../../../components/Text';
|
|
21
|
-
import Collapse from '../../../../components/Collapse';
|
|
22
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
23
|
-
var theme = _a.theme;
|
|
24
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
25
|
-
});
|
|
26
|
-
var DOB = function (_a) {
|
|
27
|
-
var show = _a.show, onDateClicked = _a.onDateClicked;
|
|
28
|
-
var t = useTranslation().t;
|
|
29
|
-
var control = useFormContext().control;
|
|
30
|
-
var dispatch = useAppDispatch();
|
|
31
|
-
var dobControl = useController({ control: control, name: 'dob' });
|
|
32
|
-
var error = useAppSelector(authSelector).error;
|
|
33
|
-
var handleBirthDateChange = function (data) {
|
|
34
|
-
dobControl.field.onChange(data);
|
|
35
|
-
handleClearError();
|
|
36
|
-
};
|
|
37
|
-
var handleClearError = function () {
|
|
38
|
-
if (error)
|
|
39
|
-
dispatch(clearError());
|
|
40
|
-
};
|
|
41
|
-
var dateValue = dobControl.field.value;
|
|
42
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
|
-
var spacing = _a.spacing;
|
|
44
|
-
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }) })));
|
|
46
|
-
};
|
|
47
|
-
export default DOB;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { useAppSelector } from '../../../../hooks';
|
|
15
|
-
import Box from '@mui/material/Box';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
18
|
-
import { styled, alpha } from '@mui/material/styles';
|
|
19
|
-
import Text from '../../../../components/Text';
|
|
20
|
-
import Input from '../../../shared/Input';
|
|
21
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
22
|
-
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
|
-
import { ID_NUMBER_LENGTH } from '../../../../constants';
|
|
24
|
-
import { authSelector } from '../../../app/auth/authStore';
|
|
25
|
-
import ClearIcon from '../../../shared/ClearIcon';
|
|
26
|
-
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
27
|
-
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
28
|
-
var theme = _a.theme;
|
|
29
|
-
return ({
|
|
30
|
-
display: 'flex',
|
|
31
|
-
justifyContent: 'space-between',
|
|
32
|
-
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
36
|
-
var theme = _a.theme;
|
|
37
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
38
|
-
});
|
|
39
|
-
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
40
|
-
var _b, _c;
|
|
41
|
-
var t = useTranslation().t;
|
|
42
|
-
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
43
|
-
var nidControl = useController({ control: control, name: 'nid' });
|
|
44
|
-
var data = useAppSelector(authSelector).data;
|
|
45
|
-
var responseBody = data.responseBody;
|
|
46
|
-
var defaultNid = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _b === void 0 ? void 0 : _b.id;
|
|
47
|
-
React.useEffect(function () {
|
|
48
|
-
if (nidControl.field.value)
|
|
49
|
-
setValue('nid', nidControl.field.value, { shouldValidate: true });
|
|
50
|
-
}, []);
|
|
51
|
-
var handleIdChange = function (_a) {
|
|
52
|
-
var target = _a.target;
|
|
53
|
-
var value = removeAllCharsFromNumber(target.value);
|
|
54
|
-
nidControl.field.onChange(value);
|
|
55
|
-
};
|
|
56
|
-
var clearIdNumber = function () {
|
|
57
|
-
nidControl.field.onChange('');
|
|
58
|
-
};
|
|
59
|
-
var nidValue = nidControl.field.value;
|
|
60
|
-
var error = (_c = nidControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
61
|
-
var readOnly = !!defaultNid;
|
|
62
|
-
return (_jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', readOnly: readOnly, inputProps: { maxLength: ID_NUMBER_LENGTH }, value: nidValue, onChange: handleIdChange, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : readOnly ? _jsx(_Fragment, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })));
|
|
63
|
-
});
|
|
64
|
-
export default React.memo(IDNumber);
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { styled } from '@mui/material/styles';
|
|
16
|
-
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
-
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import { NIDValidationSchema, NIDDOBValidationSchema } from './validation';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
|
-
import { settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, authSelector, createAuth } from '../../../app/auth/authStore';
|
|
22
|
-
import Form from '../../../../components/Form';
|
|
23
|
-
import Button from '../../../shared/Button';
|
|
24
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
-
import Collapse from '../../../../components/Collapse';
|
|
26
|
-
import IDNumber from './IDNumber';
|
|
27
|
-
import TAC from './TAC';
|
|
28
|
-
import DOB from './DOB';
|
|
29
|
-
var FormStyled = styled(Form)(function () { return ({
|
|
30
|
-
display: 'flex',
|
|
31
|
-
flexDirection: 'column'
|
|
32
|
-
}); });
|
|
33
|
-
var NID = function (_a) {
|
|
34
|
-
var isAr = useLanguage().isAr;
|
|
35
|
-
var dispatch = useAppDispatch();
|
|
36
|
-
var t = useTranslation().t;
|
|
37
|
-
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
38
|
-
var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
39
|
-
var settingsStore = useAppSelector(settingsSelector);
|
|
40
|
-
var nid = data.nid, dob = data.dob, termAndConditionChecked = data.termAndConditionChecked, responseBody = data.responseBody;
|
|
41
|
-
var isDobAvailable = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
|
|
42
|
-
var methods = useForm({
|
|
43
|
-
resolver: yupResolver(!isDobAvailable ? NIDDOBValidationSchema : NIDValidationSchema),
|
|
44
|
-
defaultValues: {
|
|
45
|
-
nid: nid,
|
|
46
|
-
dob: dob,
|
|
47
|
-
termAndConditionChecked: termAndConditionChecked
|
|
48
|
-
},
|
|
49
|
-
mode: 'onChange'
|
|
50
|
-
});
|
|
51
|
-
useSetFromDefaultValues(methods, { nid: nid, dob: dob, termAndConditionChecked: termAndConditionChecked });
|
|
52
|
-
React.useEffect(function () {
|
|
53
|
-
handleClearError();
|
|
54
|
-
}, [methods.formState.isValid]);
|
|
55
|
-
var onSubmit = function (data) {
|
|
56
|
-
dispatch(createAuth(data));
|
|
57
|
-
};
|
|
58
|
-
var handleCollapseOpenClose = function (flag) {
|
|
59
|
-
setCollapse(flag);
|
|
60
|
-
};
|
|
61
|
-
var handleClearError = function () {
|
|
62
|
-
if (error)
|
|
63
|
-
dispatch(clearError());
|
|
64
|
-
};
|
|
65
|
-
var disabled = !methods.formState.isValid || !!error;
|
|
66
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, {}) })), _jsx(DOB, { show: !isDobAvailable, onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, {}), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
|
|
67
|
-
};
|
|
68
|
-
export default React.memo(NID);
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import Box from '@mui/material/Box';
|
|
17
|
-
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
-
import Link from '@mui/material/Link';
|
|
19
|
-
import CheckBox from '../../../../components/CheckBox';
|
|
20
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
-
import Text from '../../../../components/Text';
|
|
22
|
-
import Warning from '../../../../components/Warning';
|
|
23
|
-
import { useLanguage } from '../../../../hooks';
|
|
24
|
-
import Collapse from '../../../../components/Collapse';
|
|
25
|
-
import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
26
|
-
import { settingsSelector } from '../../../../app/settings';
|
|
27
|
-
import { useAppSelector } from '../../../../hooks';
|
|
28
|
-
import { authSelector } from '../../../../features/app/auth/authStore';
|
|
29
|
-
var TACContainerStyled = styled(Box)(function (_a) {
|
|
30
|
-
var theme = _a.theme;
|
|
31
|
-
return ({
|
|
32
|
-
display: 'flex',
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
paddingInlineStart: theme.spacing(2.5)
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
var TextStyled = styled(Text)(function (_a) {
|
|
39
|
-
var theme = _a.theme;
|
|
40
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
|
|
41
|
-
});
|
|
42
|
-
var LinkStyled = styled(Link)(function (_a) {
|
|
43
|
-
var theme = _a.theme;
|
|
44
|
-
return ({
|
|
45
|
-
color: theme.palette.primary.main,
|
|
46
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
47
|
-
letterSpacing: theme.spacing(0)
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
51
|
-
var theme = _a.theme;
|
|
52
|
-
return ({
|
|
53
|
-
margin: theme.spacing(0),
|
|
54
|
-
padding: theme.spacing(0),
|
|
55
|
-
marginInlineEnd: theme.spacing(1.5),
|
|
56
|
-
color: theme.palette.primary.main,
|
|
57
|
-
'& .MuiSvgIcon-root': {
|
|
58
|
-
fontSize: theme.spacing(3.75)
|
|
59
|
-
},
|
|
60
|
-
'&.Mui-checked': {
|
|
61
|
-
color: theme.palette.text.primary,
|
|
62
|
-
borderRadius: theme.spacing(2.5)
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
67
|
-
width: '100%'
|
|
68
|
-
}); });
|
|
69
|
-
var TAC = function () {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
var t = useTranslation().t;
|
|
72
|
-
var isAr = useLanguage().isAr;
|
|
73
|
-
var control = useFormContext().control;
|
|
74
|
-
var settingsData = useAppSelector(settingsSelector).data;
|
|
75
|
-
var data = useAppSelector(authSelector).data;
|
|
76
|
-
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
77
|
-
var tacChecked = tacControl.field.value;
|
|
78
|
-
var warningMessage = (_a = tacControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
79
|
-
var countryCode = ((_b = data.countryISOCode) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || settingsData.businessCountry.iso2.toLowerCase();
|
|
80
|
-
var handleTACCheckedChange = function (event, checked) {
|
|
81
|
-
tacControl.field.onChange(checked);
|
|
82
|
-
};
|
|
83
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 3, mb: 1.625 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
|
|
84
|
-
};
|
|
85
|
-
export default React.memo(TAC);
|