@tap-payments/auth-jsconnect 1.0.22 → 1.0.25
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 +16 -9
- package/build/api/axios.js +20 -1
- package/build/api/lead.d.ts +1 -0
- package/build/app/settings.d.ts +4 -2
- package/build/app/settings.js +30 -2
- package/build/components/Button/Button.js +1 -0
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +1 -0
- package/build/constants/dummy.d.ts +1 -0
- package/build/constants/dummy.js +1 -0
- package/build/features/app/connect/connectStore.d.ts +1 -2
- package/build/features/app/connect/connectStore.js +75 -58
- package/build/features/bank/screens/BankDetails/BankName.js +6 -1
- package/build/features/business/screens/Activities/Activities.js +6 -2
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +3 -3
- package/build/features/business/screens/Customers/Customers.js +19 -1
- package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +1 -0
- package/build/features/business/screens/Customers/ExpectedCustomers.js +3 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -0
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
- package/build/features/business/screens/VerifyNumber/VerifyNumber.js +1 -1
- package/build/features/connect/Connect.d.ts +2 -4
- package/build/features/connect/Connect.js +4 -4
- package/build/features/connect/screens/Individual/Email.js +9 -7
- package/build/features/connect/screens/Individual/Individual.js +12 -11
- package/build/features/connect/screens/Merchant/BrandName.js +7 -4
- package/build/features/connect/screens/Merchant/Merchant.js +5 -4
- package/build/features/connect/screens/Mobile/BusinessCountry.d.ts +0 -5
- package/build/features/connect/screens/Mobile/BusinessCountry.js +3 -24
- package/build/features/connect/screens/Mobile/Mobile.js +15 -5
- package/build/features/connect/screens/NID/DOB.js +12 -2
- package/build/features/connect/screens/NID/NID.js +5 -2
- package/build/features/connect/screens/NID/validation.js +1 -2
- package/build/features/connect/screens/ThankYou/ThankYou.js +6 -1
- package/build/features/shared/Button/Button.js +24 -24
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.d.ts +3 -5
- package/build/hooks/useAppConfig.js +29 -2
- package/build/hooks/useErrorListener.d.ts +1 -0
- package/build/hooks/useErrorListener.js +19 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/rsa.d.ts +2 -0
- package/build/utils/rsa.js +19 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +3 -0
- package/package.json +4 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { LanguageMode } from './theme';
|
|
2
3
|
export interface CountryCode {
|
|
3
4
|
created: number;
|
|
4
5
|
updated: number;
|
|
@@ -107,16 +108,22 @@ export interface SourceOfIncome {
|
|
|
107
108
|
nameEn: string;
|
|
108
109
|
}
|
|
109
110
|
export interface AppInfo {
|
|
110
|
-
identifier: string;
|
|
111
111
|
name: string;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
identifier?: string;
|
|
113
|
+
version?: string;
|
|
114
|
+
}
|
|
115
|
+
interface LibCallbacks {
|
|
116
|
+
onFlowCompleted: (res: object) => void;
|
|
117
|
+
onError: (err: any) => void;
|
|
118
|
+
onStepCompleted?: (name: string, info: any) => void;
|
|
119
|
+
onReady?: () => void;
|
|
120
|
+
}
|
|
121
|
+
export interface LibConfig extends LibCallbacks {
|
|
122
|
+
publicKey: string;
|
|
123
|
+
language: LanguageMode;
|
|
124
|
+
appInfo: AppInfo;
|
|
125
|
+
businessCountryCode: string;
|
|
126
|
+
scope?: string[];
|
|
120
127
|
}
|
|
121
128
|
export interface OSDetails {
|
|
122
129
|
name: string;
|
package/build/api/axios.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import { get, set } from 'lodash-es';
|
|
2
3
|
import { ENDPOINT_PATHS } from '../constants';
|
|
4
|
+
import { encryptString } from '../utils';
|
|
3
5
|
export var ENCRYPTION_FLAG = 'encryption_contract';
|
|
4
6
|
export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
|
|
5
7
|
var instance = axios.create({
|
|
@@ -10,9 +12,26 @@ var instance = axios.create({
|
|
|
10
12
|
}
|
|
11
13
|
});
|
|
12
14
|
instance.interceptors.request.use(function (config) {
|
|
13
|
-
return config;
|
|
15
|
+
return encryptionContractTransformer(config);
|
|
14
16
|
}, function (error) { return Promise.reject(error); });
|
|
15
17
|
instance.interceptors.response.use(function (response) { return response; }, function (error) {
|
|
16
18
|
return Promise.reject(error);
|
|
17
19
|
});
|
|
20
|
+
var encryptionContractTransformer = function (config) {
|
|
21
|
+
var _a;
|
|
22
|
+
var data = config.data;
|
|
23
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[ENCRYPTION_FLAG]) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24
|
+
data[ENCRYPTION_FLAG].forEach(function (key) {
|
|
25
|
+
var value = get(data, key);
|
|
26
|
+
if (value && typeof value !== 'string') {
|
|
27
|
+
value = value.toString();
|
|
28
|
+
}
|
|
29
|
+
if (value)
|
|
30
|
+
set(data, key, _encrypt(value));
|
|
31
|
+
});
|
|
32
|
+
config.data = data;
|
|
33
|
+
}
|
|
34
|
+
return config;
|
|
35
|
+
};
|
|
36
|
+
var _encrypt = function (value) { return encryptString(value); };
|
|
18
37
|
export default instance;
|
package/build/api/lead.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export declare type UpdateLeadBody = {
|
|
|
55
55
|
cr_number?: string;
|
|
56
56
|
is_acknowledged?: boolean;
|
|
57
57
|
terms_conditions_accepted?: boolean;
|
|
58
|
+
email_url?: string;
|
|
58
59
|
};
|
|
59
60
|
declare const leadService: {
|
|
60
61
|
updateLead: (data: UpdateLeadBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
package/build/app/settings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from './store';
|
|
2
|
-
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, AppInfo } from '../@types';
|
|
2
|
+
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, AppInfo, LibConfig } from '../@types';
|
|
3
3
|
import { ValidateOperatorBody } from '../api';
|
|
4
4
|
export declare const getClientIp: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
5
5
|
export declare const getBrowserFingerPrint: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -16,6 +16,7 @@ export interface SettingsData {
|
|
|
16
16
|
activeScreen: ScreenStepNavigation;
|
|
17
17
|
featureScreensNavigation: Array<ScreenStepNavigation>;
|
|
18
18
|
deviceInfo: DeviceInfo;
|
|
19
|
+
appConfig: LibConfig;
|
|
19
20
|
}
|
|
20
21
|
export interface SettingsState extends SharedState<SettingsData> {
|
|
21
22
|
}
|
|
@@ -26,8 +27,9 @@ export declare const settingsSlice: import("@reduxjs/toolkit").Slice<SettingsSta
|
|
|
26
27
|
handleCurrentActiveScreen: (state: SettingsState, action: ActionState<string>) => void;
|
|
27
28
|
handlePrevScreenStep: (state: SettingsState, action: ActionState<string | undefined>) => void;
|
|
28
29
|
handleActiveFlowScreens: (state: SettingsState, action: ActionState<Array<ScreenStepNavigation>>) => void;
|
|
30
|
+
handleSetAppConfig: (state: SettingsState, action: ActionState<LibConfig>) => void;
|
|
29
31
|
}, "settings">;
|
|
30
|
-
export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>;
|
|
32
|
+
export declare const handleSkin: import("@reduxjs/toolkit").ActionCreatorWithPayload<ThemeMode, string>, handleLanguage: import("@reduxjs/toolkit").ActionCreatorWithPayload<LanguageMode, string>, handleActiveFlowScreens: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScreenStepNavigation[], string>, handleNextScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handlePrevScreenStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, string>, handleCurrentActiveScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, handleSetAppConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<LibConfig, string>;
|
|
31
33
|
declare const _default: import("redux").Reducer<SettingsState, import("redux").AnyAction>;
|
|
32
34
|
export default _default;
|
|
33
35
|
export declare const settingsSelector: (state: RootState) => SettingsState;
|
package/build/app/settings.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
13
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
14
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -83,7 +94,8 @@ var initialState = {
|
|
|
83
94
|
language: getStoredData(LOCAL_STORAGE_KEYS.languageMode) || 'en',
|
|
84
95
|
featureScreensNavigation: [],
|
|
85
96
|
activeScreen: {},
|
|
86
|
-
deviceInfo: DefaultDeviceInfo
|
|
97
|
+
deviceInfo: DefaultDeviceInfo,
|
|
98
|
+
appConfig: {}
|
|
87
99
|
}
|
|
88
100
|
};
|
|
89
101
|
export var settingsSlice = createSlice({
|
|
@@ -142,6 +154,22 @@ export var settingsSlice = createSlice({
|
|
|
142
154
|
handleActiveFlowScreens: function (state, action) {
|
|
143
155
|
state.data.featureScreensNavigation = action.payload;
|
|
144
156
|
state.data.activeScreen = action.payload[0];
|
|
157
|
+
},
|
|
158
|
+
handleSetAppConfig: function (state, action) {
|
|
159
|
+
var _a = action.payload, appInfo = _a.appInfo, businessCountryCode = _a.businessCountryCode, language = _a.language, onError = _a.onError, onFlowCompleted = _a.onFlowCompleted, publicKey = _a.publicKey;
|
|
160
|
+
if (!appInfo.name)
|
|
161
|
+
throw new Error('App name is required');
|
|
162
|
+
if (!businessCountryCode)
|
|
163
|
+
throw new Error('Business country is required');
|
|
164
|
+
if (!language)
|
|
165
|
+
throw new Error('Language is required');
|
|
166
|
+
if (!publicKey)
|
|
167
|
+
throw new Error('Public key is required');
|
|
168
|
+
if (!onError)
|
|
169
|
+
throw new Error('On error function is required');
|
|
170
|
+
if (!onFlowCompleted)
|
|
171
|
+
throw new Error('On flow completed function is required');
|
|
172
|
+
state.data.appConfig = __assign(__assign({}, action.payload), { appInfo: __assign(__assign({}, appInfo), { identifier: 'auth-js-connect', version: '1.0.22' }) });
|
|
145
173
|
}
|
|
146
174
|
},
|
|
147
175
|
extraReducers: function (builder) {
|
|
@@ -193,6 +221,6 @@ export var settingsSlice = createSlice({
|
|
|
193
221
|
});
|
|
194
222
|
}
|
|
195
223
|
});
|
|
196
|
-
export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen;
|
|
224
|
+
export var handleSkin = (_a = settingsSlice.actions, _a.handleSkin), handleLanguage = _a.handleLanguage, handleActiveFlowScreens = _a.handleActiveFlowScreens, handleNextScreenStep = _a.handleNextScreenStep, handlePrevScreenStep = _a.handlePrevScreenStep, handleCurrentActiveScreen = _a.handleCurrentActiveScreen, handleSetAppConfig = _a.handleSetAppConfig;
|
|
197
225
|
export default settingsSlice.reducer;
|
|
198
226
|
export var settingsSelector = function (state) { return state.settings; };
|
package/build/constants/app.d.ts
CHANGED
|
@@ -83,3 +83,4 @@ export declare const BUSINESS_STEP_NAMES: {
|
|
|
83
83
|
VERIFY_LEAD_IDENTITY: string;
|
|
84
84
|
UPDATE_LEAD_BUSINESS_TYPE: string;
|
|
85
85
|
};
|
|
86
|
+
export declare const RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
|
package/build/constants/app.js
CHANGED
|
@@ -232,3 +232,4 @@ export var BUSINESS_STEP_NAMES = {
|
|
|
232
232
|
VERIFY_LEAD_IDENTITY: 'business_verify_lead_identity',
|
|
233
233
|
UPDATE_LEAD_BUSINESS_TYPE: 'business_update_lead_business_type'
|
|
234
234
|
};
|
|
235
|
+
export var RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
|
package/build/constants/dummy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, PasswordFormValues } from '../../../@types';
|
|
3
3
|
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
|
|
4
|
+
businessCountry: any;
|
|
5
5
|
countries: any;
|
|
6
6
|
}, void, {}>;
|
|
7
7
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -53,7 +53,6 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
53
53
|
}, void, {}>;
|
|
54
54
|
export interface ConnectData {
|
|
55
55
|
countries: Array<CountryCode>;
|
|
56
|
-
businessCountries: Array<CountryCode>;
|
|
57
56
|
mobileData: MobileFormValues & ResponseData;
|
|
58
57
|
nidData: NIDFormValues & ResponseData & {
|
|
59
58
|
type: string;
|
|
@@ -50,25 +50,24 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
50
50
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
51
51
|
import API from '../../../api';
|
|
52
52
|
import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
|
|
53
|
-
import { defaultCountry } from '../../../constants/dummy';
|
|
53
|
+
import { defaultCountry, EMAIL_PATH } from '../../../constants/dummy';
|
|
54
54
|
import { getIndividualName } from '../../../utils';
|
|
55
|
-
export var getCountries = createAsyncThunk('getCountries', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var
|
|
55
|
+
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
var settings, countriesBody, list, businessCountry;
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
59
|
+
case 0:
|
|
60
|
+
settings = thunkApi.getState().settings;
|
|
61
|
+
return [4, API.countryService.getAllCountries()];
|
|
60
62
|
case 1:
|
|
61
63
|
countriesBody = (_a.sent()).data;
|
|
62
|
-
return [4, API.countryService.getBusinessCountries()];
|
|
63
|
-
case 2:
|
|
64
|
-
BusinessCountries = (_a.sent()).data;
|
|
65
64
|
list = countriesBody.list;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return (countries || []).some(function (obj) { return obj.code === item.iso2; });
|
|
65
|
+
businessCountry = list.find(function (item) {
|
|
66
|
+
return [item.iso2, item.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
|
|
69
67
|
});
|
|
68
|
+
console.log('businessCountry', businessCountry);
|
|
70
69
|
return [2, {
|
|
71
|
-
|
|
70
|
+
businessCountry: businessCountry,
|
|
72
71
|
countries: list || []
|
|
73
72
|
}];
|
|
74
73
|
}
|
|
@@ -76,8 +75,9 @@ export var getCountries = createAsyncThunk('getCountries', function () { return
|
|
|
76
75
|
}); });
|
|
77
76
|
export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
78
77
|
var settings, requestBody, data;
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
var _a, _b;
|
|
79
|
+
return __generator(this, function (_c) {
|
|
80
|
+
switch (_c.label) {
|
|
81
81
|
case 0:
|
|
82
82
|
settings = thunkApi.getState().settings;
|
|
83
83
|
requestBody = {
|
|
@@ -88,21 +88,24 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
88
88
|
device_info: settings.data.deviceInfo,
|
|
89
89
|
sign_in: false,
|
|
90
90
|
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
|
|
91
|
-
encryption_contract: []
|
|
91
|
+
encryption_contract: ['user_credentail.phone', 'user_credentail.code']
|
|
92
92
|
};
|
|
93
93
|
return [4, API.authService.createAuth(requestBody)];
|
|
94
94
|
case 1:
|
|
95
|
-
data = (
|
|
96
|
-
if (!data.errors && !params.isResend)
|
|
95
|
+
data = (_c.sent()).data;
|
|
96
|
+
if (!data.errors && !params.isResend) {
|
|
97
97
|
thunkApi.dispatch(handleNextScreenStep());
|
|
98
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
99
|
+
}
|
|
98
100
|
return [2, { response: data, formData: params }];
|
|
99
101
|
}
|
|
100
102
|
});
|
|
101
103
|
}); });
|
|
102
104
|
export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
105
|
var _a, settings, connect, identification_id_type, requestBody, data;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
var _b, _c;
|
|
107
|
+
return __generator(this, function (_d) {
|
|
108
|
+
switch (_d.label) {
|
|
106
109
|
case 0:
|
|
107
110
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
108
111
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
@@ -116,23 +119,31 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
116
119
|
device_info: settings.data.deviceInfo,
|
|
117
120
|
sign_in: false,
|
|
118
121
|
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
119
|
-
encryption_contract: [
|
|
122
|
+
encryption_contract: [
|
|
123
|
+
'user_credentail.country_code',
|
|
124
|
+
'user_credentail.identification_id',
|
|
125
|
+
'user_credentail.identification_id_type',
|
|
126
|
+
'user_credentail.date_of_birth'
|
|
127
|
+
]
|
|
120
128
|
};
|
|
121
129
|
return [4, API.authService.createAuth(requestBody)];
|
|
122
130
|
case 1:
|
|
123
|
-
data = (
|
|
124
|
-
if (!data.errors && !params.isResend)
|
|
131
|
+
data = (_d.sent()).data;
|
|
132
|
+
if (!data.errors && !params.isResend) {
|
|
125
133
|
thunkApi.dispatch(handleNextScreenStep());
|
|
134
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
135
|
+
}
|
|
126
136
|
return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
127
137
|
}
|
|
128
138
|
});
|
|
129
139
|
}); });
|
|
130
140
|
export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
-
var connect, isAbsher, responseBody, payload, data;
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
var _a, connect, settings, isAbsher, responseBody, payload, data;
|
|
142
|
+
var _b, _c;
|
|
143
|
+
return __generator(this, function (_d) {
|
|
144
|
+
switch (_d.label) {
|
|
134
145
|
case 0:
|
|
135
|
-
|
|
146
|
+
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
136
147
|
isAbsher = connect.data.otpData.isAbsher;
|
|
137
148
|
responseBody = (isAbsher ? connect.data.nidData : connect.data.mobileData).responseBody;
|
|
138
149
|
payload = {
|
|
@@ -146,12 +157,13 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
146
157
|
remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
|
|
147
158
|
scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
|
|
148
159
|
step_name: isAbsher ? CONNECT_STEP_NAMES.VERIFY_AUTH_NID : CONNECT_STEP_NAMES.VERIFY_AUTH_MOBILE,
|
|
149
|
-
encryption_contract: []
|
|
160
|
+
encryption_contract: ['data']
|
|
150
161
|
};
|
|
151
162
|
return [4, API.authService.verifyAuth(payload)];
|
|
152
163
|
case 1:
|
|
153
|
-
data = (
|
|
164
|
+
data = (_d.sent()).data;
|
|
154
165
|
if (!data.errors) {
|
|
166
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
|
|
155
167
|
if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
|
|
156
168
|
thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
157
169
|
}
|
|
@@ -164,11 +176,12 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
164
176
|
});
|
|
165
177
|
}); });
|
|
166
178
|
export var verifyAuthPassword = createAsyncThunk('verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
167
|
-
var connect, isAbsher, responseBody, payload, data;
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
var _a, connect, settings, isAbsher, responseBody, payload, data;
|
|
180
|
+
var _b, _c;
|
|
181
|
+
return __generator(this, function (_d) {
|
|
182
|
+
switch (_d.label) {
|
|
170
183
|
case 0:
|
|
171
|
-
|
|
184
|
+
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
172
185
|
isAbsher = connect.data.otpData.isAbsher;
|
|
173
186
|
responseBody = (isAbsher ? connect.data.nidData : connect.data.mobileData).responseBody;
|
|
174
187
|
payload = {
|
|
@@ -182,22 +195,24 @@ export var verifyAuthPassword = createAsyncThunk('verifyAuthPassword', function
|
|
|
182
195
|
remember_me: responseBody === null || responseBody === void 0 ? void 0 : responseBody.remember_me,
|
|
183
196
|
scopes: responseBody === null || responseBody === void 0 ? void 0 : responseBody.scopes,
|
|
184
197
|
step_name: CONNECT_STEP_NAMES.VERIFY_AUTH_PASSWORD,
|
|
185
|
-
encryption_contract: []
|
|
198
|
+
encryption_contract: ['data']
|
|
186
199
|
};
|
|
187
200
|
return [4, API.authService.verifyAuth(payload)];
|
|
188
201
|
case 1:
|
|
189
|
-
data = (
|
|
190
|
-
if (!data.errors)
|
|
202
|
+
data = (_d.sent()).data;
|
|
203
|
+
if (!data.errors) {
|
|
191
204
|
thunkApi.dispatch(handleNextScreenStep());
|
|
205
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { password: params.password });
|
|
206
|
+
}
|
|
192
207
|
return [2, { response: data, formData: params }];
|
|
193
208
|
}
|
|
194
209
|
});
|
|
195
210
|
}); });
|
|
196
211
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
212
|
var _a, settings, connect, isAbsher, headers, payload, data;
|
|
198
|
-
var _b, _c, _d;
|
|
199
|
-
return __generator(this, function (
|
|
200
|
-
switch (
|
|
213
|
+
var _b, _c, _d, _e, _f;
|
|
214
|
+
return __generator(this, function (_g) {
|
|
215
|
+
switch (_g.label) {
|
|
201
216
|
case 0:
|
|
202
217
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
203
218
|
isAbsher = connect.data.otpData.isAbsher;
|
|
@@ -217,22 +232,24 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
217
232
|
: undefined
|
|
218
233
|
},
|
|
219
234
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
|
|
220
|
-
encryption_contract: []
|
|
235
|
+
encryption_contract: ['name', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
|
|
221
236
|
};
|
|
222
237
|
return [4, API.leadService.updateLead(payload, { headers: headers })];
|
|
223
238
|
case 1:
|
|
224
|
-
data = (
|
|
225
|
-
if (!data.errors)
|
|
239
|
+
data = (_g.sent()).data;
|
|
240
|
+
if (!data.errors) {
|
|
226
241
|
thunkApi.dispatch(handleNextScreenStep());
|
|
242
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
243
|
+
}
|
|
227
244
|
return [2, { response: data, formData: params }];
|
|
228
245
|
}
|
|
229
246
|
});
|
|
230
247
|
}); });
|
|
231
248
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
232
249
|
var _a, settings, connect, headers, payload, data;
|
|
233
|
-
var _b, _c, _d, _e, _f, _g;
|
|
234
|
-
return __generator(this, function (
|
|
235
|
-
switch (
|
|
250
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
251
|
+
return __generator(this, function (_k) {
|
|
252
|
+
switch (_k.label) {
|
|
236
253
|
case 0:
|
|
237
254
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
238
255
|
headers = {
|
|
@@ -251,13 +268,15 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
251
268
|
},
|
|
252
269
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
253
270
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
254
|
-
encryption_contract: []
|
|
271
|
+
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
|
|
255
272
|
};
|
|
256
273
|
return [4, API.leadService.updateLead(payload, { headers: headers })];
|
|
257
274
|
case 1:
|
|
258
|
-
data = (
|
|
259
|
-
if (!data.errors)
|
|
275
|
+
data = (_k.sent()).data;
|
|
276
|
+
if (!data.errors) {
|
|
260
277
|
thunkApi.dispatch(handleNextScreenStep());
|
|
278
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, params);
|
|
279
|
+
}
|
|
261
280
|
return [2, { response: data, formData: params }];
|
|
262
281
|
}
|
|
263
282
|
});
|
|
@@ -310,9 +329,9 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
310
329
|
}); });
|
|
311
330
|
export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
312
331
|
var _a, settings, connect, headers, payload, data;
|
|
313
|
-
var _b, _c, _d;
|
|
314
|
-
return __generator(this, function (
|
|
315
|
-
switch (
|
|
332
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
333
|
+
return __generator(this, function (_j) {
|
|
334
|
+
switch (_j.label) {
|
|
316
335
|
case 0:
|
|
317
336
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
318
337
|
headers = {
|
|
@@ -321,16 +340,14 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
321
340
|
};
|
|
322
341
|
payload = {
|
|
323
342
|
step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
|
|
343
|
+
email_url: EMAIL_PATH,
|
|
324
344
|
encryption_contract: []
|
|
325
345
|
};
|
|
326
346
|
return [4, API.leadService.updateLead(payload, { headers: headers })];
|
|
327
347
|
case 1:
|
|
328
|
-
data = (
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
alert('Account created successfully, please check your email');
|
|
332
|
-
alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
|
|
333
|
-
}
|
|
348
|
+
data = (_j.sent()).data;
|
|
349
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
350
|
+
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
|
|
334
351
|
return [2, { response: data, formData: params }];
|
|
335
352
|
}
|
|
336
353
|
});
|
|
@@ -341,7 +358,6 @@ var initialState = {
|
|
|
341
358
|
searchActive: false,
|
|
342
359
|
data: {
|
|
343
360
|
countries: [],
|
|
344
|
-
businessCountries: [],
|
|
345
361
|
mobileData: {
|
|
346
362
|
countryCode: defaultCountry,
|
|
347
363
|
businessCountry: defaultCountry,
|
|
@@ -391,9 +407,10 @@ export var connectSlice = createSlice({
|
|
|
391
407
|
builder
|
|
392
408
|
.addCase(getCountries.fulfilled, function (state, action) {
|
|
393
409
|
state.error = null;
|
|
394
|
-
var _a = action.payload,
|
|
395
|
-
state.data.businessCountries = businessCountries;
|
|
410
|
+
var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
|
|
396
411
|
state.data.countries = countries;
|
|
412
|
+
state.data.mobileData.businessCountry = businessCountry || defaultCountry;
|
|
413
|
+
state.data.mobileData.countryCode = businessCountry || defaultCountry;
|
|
397
414
|
})
|
|
398
415
|
.addCase(getCountries.pending, function (state) {
|
|
399
416
|
state.error = null;
|
|
@@ -12,6 +12,11 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
12
12
|
marginBlockEnd: theme.spacing(3)
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
16
|
+
'& .MuiInputBase-input': {
|
|
17
|
+
cursor: 'default'
|
|
18
|
+
}
|
|
19
|
+
}); });
|
|
15
20
|
var BankName = function () {
|
|
16
21
|
var _a;
|
|
17
22
|
var t = useTranslation().t;
|
|
@@ -22,6 +27,6 @@ var BankName = function () {
|
|
|
22
27
|
var clearValue = function () {
|
|
23
28
|
bankNameControl.field.onChange('');
|
|
24
29
|
};
|
|
25
|
-
return (_jsx(FeatureStyled, { children: _jsx(
|
|
30
|
+
return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), value: bankNameValue, required: true, readOnly: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
|
|
26
31
|
};
|
|
27
32
|
export default BankName;
|
|
@@ -31,7 +31,8 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
31
31
|
flexDirection: 'column'
|
|
32
32
|
}); });
|
|
33
33
|
var Activities = function () {
|
|
34
|
-
var _a = React.useState(false),
|
|
34
|
+
var _a = React.useState(false), anchorEl = _a[0], setAnchorEl = _a[1];
|
|
35
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
35
36
|
var dispatch = useAppDispatch();
|
|
36
37
|
var isAr = useLanguage().isAr;
|
|
37
38
|
var t = useTranslation().t;
|
|
@@ -55,6 +56,9 @@ var Activities = function () {
|
|
|
55
56
|
var onBack = function () {
|
|
56
57
|
dispatch(handlePrevScreenStep());
|
|
57
58
|
};
|
|
58
|
-
|
|
59
|
+
var handleMenuClick = function () {
|
|
60
|
+
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
61
|
+
};
|
|
62
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!ACTIVITIES && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
|
|
59
63
|
};
|
|
60
64
|
export default Activities;
|
|
@@ -20,7 +20,7 @@ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick
|
|
|
20
20
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
21
|
children?: React.ReactNode;
|
|
22
22
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
23
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
23
|
+
color?: "inherit" | "disabled" | "error" | "primary" | "secondary" | "action" | "info" | "success" | "warning" | undefined;
|
|
24
24
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
25
25
|
htmlColor?: string | undefined;
|
|
26
26
|
inheritViewBox?: boolean | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const NameContainer: import("@emotion/styled").StyledComponent<im
|
|
|
35
35
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
36
36
|
children?: React.ReactNode;
|
|
37
37
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
38
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
38
|
+
color?: "inherit" | "disabled" | "error" | "primary" | "secondary" | "action" | "info" | "success" | "warning" | undefined;
|
|
39
39
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
40
40
|
htmlColor?: string | undefined;
|
|
41
41
|
inheritViewBox?: boolean | undefined;
|
|
@@ -49,7 +49,7 @@ export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<
|
|
|
49
49
|
export declare const RemainingCheck: import("@emotion/styled").StyledComponent<{
|
|
50
50
|
children?: React.ReactNode;
|
|
51
51
|
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
52
|
-
color?: "inherit" | "disabled" | "error" | "
|
|
52
|
+
color?: "inherit" | "disabled" | "error" | "primary" | "secondary" | "action" | "info" | "success" | "warning" | undefined;
|
|
53
53
|
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
54
54
|
htmlColor?: string | undefined;
|
|
55
55
|
inheritViewBox?: boolean | undefined;
|
|
@@ -61,6 +61,7 @@ export declare const RemainingCheck: import("@emotion/styled").StyledComponent<{
|
|
|
61
61
|
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
62
62
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
63
63
|
interface CustomerLocationsProps {
|
|
64
|
+
show: boolean;
|
|
64
65
|
onListOpen?: () => void;
|
|
65
66
|
onListClose?: () => void;
|
|
66
67
|
}
|
|
@@ -101,8 +101,8 @@ var customerLocations = function (_a) {
|
|
|
101
101
|
};
|
|
102
102
|
var customerLocationsValue = customerLocationsControl.field.value;
|
|
103
103
|
var customerLocationSelected = customerLocationsValue[customerLocationsValue.length - 1];
|
|
104
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('select_customer_base') }), _jsx(InputStyled, { readOnly: true, value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.nameAR : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('select_customer_base') }), _jsx(InputStyled, { readOnly: true, value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.nameAR : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
|
|
105
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.nameAR : item.name })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIconStyled, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(RemainingCheck, {})] }));
|
|
106
|
+
} }) }))] }) })));
|
|
107
107
|
};
|
|
108
108
|
export default React.memo(customerLocations);
|