@tap-payments/auth-jsconnect 1.0.27 → 1.0.28

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.
Files changed (41) hide show
  1. package/build/api/axios.d.ts +0 -2
  2. package/build/api/axios.js +2 -5
  3. package/build/api/index.d.ts +4 -2
  4. package/build/api/lead.d.ts +8 -2
  5. package/build/api/lead.js +9 -1
  6. package/build/app/rootReducer.d.ts +1 -0
  7. package/build/app/rootReducer.js +3 -1
  8. package/build/app/store.d.ts +2 -0
  9. package/build/assets/locales/ar.json +4 -3
  10. package/build/assets/locales/en.json +2 -1
  11. package/build/constants/api.d.ts +1 -0
  12. package/build/constants/api.js +2 -0
  13. package/build/constants/app.d.ts +3 -6
  14. package/build/constants/app.js +4 -7
  15. package/build/features/app/business/businessStore.d.ts +27 -0
  16. package/build/features/app/business/businessStore.js +135 -0
  17. package/build/features/app/connect/connectStore.d.ts +1 -0
  18. package/build/features/app/connect/connectStore.js +44 -26
  19. package/build/features/bank/screens/Success/Success.js +1 -3
  20. package/build/features/business/Business.d.ts +2 -1
  21. package/build/features/business/Business.js +13 -4
  22. package/build/features/business/screens/Success/Success.js +1 -3
  23. package/build/features/business/screens/Verify/OTPInput.d.ts +5 -0
  24. package/build/features/business/screens/Verify/OTPInput.js +39 -0
  25. package/build/features/business/screens/Verify/Verify.d.ts +13 -0
  26. package/build/features/business/screens/Verify/Verify.js +76 -0
  27. package/build/features/business/screens/Verify/index.d.ts +3 -0
  28. package/build/features/business/screens/Verify/index.js +2 -0
  29. package/build/features/business/screens/Verify/validation.d.ts +8 -0
  30. package/build/features/business/screens/Verify/validation.js +4 -0
  31. package/build/features/connect/screens/Individual/Individual.js +12 -0
  32. package/build/features/connect/screens/ThankYou/ThankYou.js +1 -3
  33. package/build/features/featuresScreens.js +3 -3
  34. package/build/features/individual/screens/Success/Success.js +1 -3
  35. package/build/features/password/screens/Success/Success.js +1 -3
  36. package/build/features/shared/SuccessScreen/SuccessScreen.js +9 -15
  37. package/build/features/tax/screens/Success/Success.js +1 -3
  38. package/build/hooks/useAppDispatch.d.ts +1 -0
  39. package/build/utils/string.d.ts +2 -0
  40. package/build/utils/string.js +12 -0
  41. package/package.json +1 -1
@@ -1,4 +1,2 @@
1
- export declare const ENCRYPTION_FLAG: string;
2
- export declare const BACKEND_ENCRYPTION_FLAG: string;
3
1
  declare const instance: import("axios").AxiosInstance;
4
2
  export default instance;
@@ -1,9 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { get, set } from 'lodash-es';
3
- import { ENDPOINT_PATHS } from '../constants';
3
+ import { ENCRYPTION_FLAG, ENDPOINT_PATHS } from '../constants';
4
4
  import { encryptString } from '../utils';
5
- export var ENCRYPTION_FLAG = 'encryption_contract';
6
- export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
7
5
  var instance = axios.create({
8
6
  baseURL: ENDPOINT_PATHS.BASE_URL,
9
7
  headers: {
@@ -27,11 +25,10 @@ var encryptionContractTransformer = function (config) {
27
25
  value = value.toString();
28
26
  }
29
27
  if (value)
30
- set(data, key, _encrypt(value));
28
+ set(data, key, encryptString(value));
31
29
  });
32
30
  config.data = data;
33
31
  }
34
32
  return config;
35
33
  };
36
- var _encrypt = function (value) { return encryptString(value); };
37
34
  export default instance;
@@ -1,6 +1,6 @@
1
1
  import { ValidateOperatorBody } from './operator';
2
2
  import { CreateAuthBody, VerifyAuthBody } from './auth';
3
- import { UpdateLeadBody } from './lead';
3
+ import { UpdateLeadBody, LeadVerifyBody } from './lead';
4
4
  import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
5
5
  declare const API: {
6
6
  ipService: {
@@ -19,11 +19,13 @@ declare const API: {
19
19
  };
20
20
  leadService: {
21
21
  updateLead: (data: UpdateLeadBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
22
+ retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
23
+ verifyLeadToken: (data: LeadVerifyBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
22
24
  };
23
25
  availabilityServices: {
24
26
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
25
27
  checkBrand: (data: CheckBrandBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
26
28
  };
27
29
  };
28
- export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, UpdateLeadBody, CheckEmailBody, CheckBrandBody };
30
+ export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, UpdateLeadBody, LeadVerifyBody, CheckEmailBody, CheckBrandBody };
29
31
  export default API;
@@ -34,8 +34,8 @@ declare type BrandInfo = {
34
34
  content?: BrandContent;
35
35
  };
36
36
  export declare type UpdateLeadBody = {
37
- step_name: string;
38
- encryption_contract: Array<string>;
37
+ step_name?: string;
38
+ encryption_contract?: Array<string>;
39
39
  name?: Name;
40
40
  contact?: Contact;
41
41
  send_invite?: boolean;
@@ -57,7 +57,13 @@ export declare type UpdateLeadBody = {
57
57
  terms_conditions_accepted?: boolean;
58
58
  email_url?: string;
59
59
  };
60
+ export declare type LeadVerifyBody = {
61
+ verify_token: string;
62
+ service_name: string;
63
+ };
60
64
  declare const leadService: {
61
65
  updateLead: (data: UpdateLeadBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
66
+ retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
67
+ verifyLeadToken: (data: LeadVerifyBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
62
68
  };
63
69
  export { leadService };
package/build/api/lead.js CHANGED
@@ -3,7 +3,15 @@ import { ENDPOINT_PATHS } from '../constants';
3
3
  var updateLead = function (data, config) {
4
4
  return instance.put("".concat(ENDPOINT_PATHS.LEAD), data, config);
5
5
  };
6
+ var retrieveLead = function (leadId) {
7
+ return instance.get("".concat(ENDPOINT_PATHS.LEAD, "/").concat(leadId));
8
+ };
9
+ var verifyLeadToken = function (data, config) {
10
+ return instance.put("".concat(ENDPOINT_PATHS.LEAD_IDENTITY_VERIFY), data, config);
11
+ };
6
12
  var leadService = {
7
- updateLead: updateLead
13
+ updateLead: updateLead,
14
+ retrieveLead: retrieveLead,
15
+ verifyLeadToken: verifyLeadToken
8
16
  };
9
17
  export { leadService };
@@ -1,5 +1,6 @@
1
1
  declare const rootReducer: {
2
2
  settings: import("redux").Reducer<import("./settings").SettingsState, import("redux").AnyAction>;
3
3
  connect: import("redux").Reducer<import("../features/app/connect/connectStore").ConnectState, import("redux").AnyAction>;
4
+ business: import("redux").Reducer<import("../features/app/business/businessStore").BusinessState, import("redux").AnyAction>;
4
5
  };
5
6
  export default rootReducer;
@@ -1,7 +1,9 @@
1
1
  import settings from './settings';
2
2
  import connect from '../features/app/connect/connectStore';
3
+ import business from '../features/app/business/businessStore';
3
4
  var rootReducer = {
4
5
  settings: settings,
5
- connect: connect
6
+ connect: connect,
7
+ business: business
6
8
  };
7
9
  export default rootReducer;
@@ -2,9 +2,11 @@ import { ThunkAction, Action } from '@reduxjs/toolkit';
2
2
  export declare const store: import("@reduxjs/toolkit").EnhancedStore<{
3
3
  settings: import("./settings").SettingsState;
4
4
  connect: import("../features/app/connect/connectStore").ConnectState;
5
+ business: import("../features/app/business/businessStore").BusinessState;
5
6
  }, import("redux").AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("redux-thunk").ThunkMiddleware<{
6
7
  settings: import("./settings").SettingsState;
7
8
  connect: import("../features/app/connect/connectStore").ConnectState;
9
+ business: import("../features/app/business/businessStore").BusinessState;
8
10
  }, import("redux").AnyAction, undefined>]>>;
9
11
  export declare type AppDispatch = typeof store.dispatch;
10
12
  export declare type RootState = ReturnType<typeof store.getState>;
@@ -208,7 +208,8 @@
208
208
  "fl_required": "رقم رخصة العمل الحر مطلوب",
209
209
  "fl_max_length": "طول رخصة العمل الحر يجب ان يكون{{length}}",
210
210
  "absher_button_label": "المتابعة عن طريق أبشر",
211
- "mobile_button_label": "المتابعة عن طريق رقم الجوال",
212
- "or": " أو",
213
- "next": "التالي"
211
+ "or": "أو",
212
+ "next": "التالي",
213
+ "open_mail_box": "Open Mailbox",
214
+ "mobile_button_label": "المتابعة عن طريق رقم الجوال"
214
215
  }
@@ -224,5 +224,6 @@
224
224
  "absher_button_label": "Continue with Absher",
225
225
  "mobile_button_label": "Continue with Mobile Number",
226
226
  "or": "Or",
227
- "next": "next"
227
+ "next": "next",
228
+ "open_mail_box": "Open Mailbox"
228
229
  }
@@ -6,6 +6,7 @@ export declare const ENDPOINT_PATHS: {
6
6
  OPERATOR: string;
7
7
  AUTH: string;
8
8
  LEAD: string;
9
+ LEAD_IDENTITY_VERIFY: string;
9
10
  CHECK_EMAIL: string;
10
11
  CHECK_BRAND: string;
11
12
  };
@@ -5,6 +5,7 @@ var IP_PATH = '/ip';
5
5
  var OPERATOR_PATH = '/operator';
6
6
  var AUTH_PATH = '/auth';
7
7
  var LEAD_PATH = '/lead';
8
+ var LEAD_IDENTITY_VERIFY_PATH = 'lead/identity/verify';
8
9
  var CHECK_EMAIL = '/lead/identity/emailcheck';
9
10
  var CHECK_BRAND = 'lead/profile/profile_name';
10
11
  export var ENDPOINT_PATHS = {
@@ -15,6 +16,7 @@ export var ENDPOINT_PATHS = {
15
16
  OPERATOR: OPERATOR_PATH,
16
17
  AUTH: AUTH_PATH,
17
18
  LEAD: LEAD_PATH,
19
+ LEAD_IDENTITY_VERIFY: LEAD_IDENTITY_VERIFY_PATH,
18
20
  CHECK_EMAIL: CHECK_EMAIL,
19
21
  CHECK_BRAND: CHECK_BRAND
20
22
  };
@@ -78,10 +78,7 @@ export declare const CONNECT_STEP_NAMES: {
78
78
  VERIFY_AUTH_PASSWORD: string;
79
79
  CONNECT_SUCCESS: string;
80
80
  };
81
- export declare const BUSINESS_STEP_NAMES: {
82
- VERIFY_AUTH_MOBILE: string;
83
- UPDATE_LEAD_IDENTITY: string;
84
- VERIFY_LEAD_IDENTITY: string;
85
- UPDATE_LEAD_BUSINESS_TYPE: string;
86
- };
81
+ export declare const BUSINESS_STEP_NAMES: {};
87
82
  export declare const RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
83
+ export declare const ENCRYPTION_FLAG = "encryption_contract";
84
+ export declare const BACKEND_ENCRYPTION_FLAG = "backend_encryption_contract";
@@ -57,7 +57,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
57
57
  ];
58
58
  export var BUSINESS_SCREENS_NAVIGATION = [
59
59
  {
60
- name: 'BUSINESS_VERIFY_NUMBER_STEP',
60
+ name: 'BUSINESS_VERIFY_STEP',
61
61
  next: ['BUSINESS_IDBOD_STEP', 'BUSINESS_BUSINESS_TYPE_STEP'],
62
62
  prev: '',
63
63
  order: 1
@@ -227,10 +227,7 @@ export var CONNECT_STEP_NAMES = {
227
227
  VERIFY_AUTH_PASSWORD: 'connect_verify_auth_password',
228
228
  CONNECT_SUCCESS: 'connect_completed'
229
229
  };
230
- export var BUSINESS_STEP_NAMES = {
231
- VERIFY_AUTH_MOBILE: 'business_verify_auth_mobile',
232
- UPDATE_LEAD_IDENTITY: 'business_update_lead_identity',
233
- VERIFY_LEAD_IDENTITY: 'business_verify_lead_identity',
234
- UPDATE_LEAD_BUSINESS_TYPE: 'business_update_lead_business_type'
235
- };
230
+ export var BUSINESS_STEP_NAMES = {};
236
231
  export var RSA_FRONTEND_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgC9kH1SQvjbXAUXd0PbrDUG8P\nLhRig9pJNBmdQBZjihuaxfkzYu6ToMbIMAfmYgVgQw338/y7aQ8X3m03CXNIlkxo\nOwxKCA8ymKsZQptXJn9IxlPO7yjoFgTFBrpmTgvcC4XO1uoUYTAPq3szK8kj4zgT\nucWG1hSKsOdRU7sl/wIDAQAB\n-----END PUBLIC KEY-----";
232
+ export var ENCRYPTION_FLAG = 'encryption_contract';
233
+ export var BACKEND_ENCRYPTION_FLAG = 'backend_encryption_contract';
@@ -0,0 +1,27 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { CountryCode, ResponseData, SharedState } from '../../../@types';
3
+ export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
+ businessCountry: any;
5
+ countries: any;
6
+ }, void, {}>;
7
+ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
8
+ data: any;
9
+ token: string;
10
+ }, string, {}>;
11
+ export interface BusinessData {
12
+ verify: ResponseData & {
13
+ token: string;
14
+ };
15
+ businessCountry: CountryCode;
16
+ countries: CountryCode[];
17
+ }
18
+ export interface BusinessState extends SharedState<BusinessData> {
19
+ }
20
+ export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
21
+ clearError: (state: BusinessState) => void;
22
+ stopLoader: (state: BusinessState) => void;
23
+ }, "business/store">;
24
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
25
+ declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
26
+ export default _default;
27
+ export declare const businessSelector: (state: RootState) => BusinessState;
@@ -0,0 +1,135 @@
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 API from '../../../api';
40
+ import { defaultCountry } from '../../../constants';
41
+ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
42
+ var settings, countriesBody, list, businessCountry;
43
+ return __generator(this, function (_a) {
44
+ switch (_a.label) {
45
+ case 0:
46
+ settings = thunkApi.getState().settings;
47
+ return [4, API.countryService.getAllCountries()];
48
+ case 1:
49
+ countriesBody = (_a.sent()).data;
50
+ list = countriesBody.list;
51
+ businessCountry = list.find(function (item) {
52
+ return [item.iso2, item.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
53
+ });
54
+ return [2, { businessCountry: businessCountry, countries: list || [] }];
55
+ }
56
+ });
57
+ }); });
58
+ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
59
+ var payload, data;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0:
63
+ payload = {
64
+ service_name: 'tap_email',
65
+ verify_token: token
66
+ };
67
+ return [4, API.leadService.verifyLeadToken(payload)];
68
+ case 1:
69
+ data = (_a.sent()).data;
70
+ return [2, { data: data, token: token }];
71
+ }
72
+ });
73
+ }); });
74
+ var initialState = {
75
+ error: null,
76
+ loading: false,
77
+ data: {
78
+ businessCountry: defaultCountry,
79
+ countries: [],
80
+ verify: {
81
+ token: ''
82
+ }
83
+ }
84
+ };
85
+ export var businessSlice = createSlice({
86
+ name: 'business/store',
87
+ initialState: initialState,
88
+ reducers: {
89
+ clearError: function (state) {
90
+ state.error = null;
91
+ },
92
+ stopLoader: function (state) {
93
+ state.loading = false;
94
+ }
95
+ },
96
+ extraReducers: function (builder) {
97
+ builder
98
+ .addCase(getCountries.fulfilled, function (state, action) {
99
+ state.error = null;
100
+ var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
101
+ state.data.countries = countries;
102
+ state.data.businessCountry = businessCountry || defaultCountry;
103
+ })
104
+ .addCase(getCountries.pending, function (state) {
105
+ state.error = null;
106
+ })
107
+ .addCase(getCountries.rejected, function (state, action) {
108
+ state.error = action.error.message;
109
+ })
110
+ .addCase(verifyLeadToken.pending, function (state) {
111
+ state.loading = true;
112
+ state.error = null;
113
+ })
114
+ .addCase(verifyLeadToken.fulfilled, function (state, action) {
115
+ var _a;
116
+ state.loading = false;
117
+ state.error = null;
118
+ var _b = action.payload, data = _b.data, token = _b.token;
119
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
120
+ if (description) {
121
+ state.error = description;
122
+ return;
123
+ }
124
+ state.data.verify.responseBody = action.payload.data;
125
+ state.data.verify.token = token;
126
+ })
127
+ .addCase(verifyLeadToken.rejected, function (state, action) {
128
+ state.loading = false;
129
+ state.error = action.error.message;
130
+ });
131
+ }
132
+ });
133
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
134
+ export default businessSlice.reducer;
135
+ export var businessSelector = function (state) { return state.business; };
@@ -25,6 +25,7 @@ export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
25
25
  }, {}>;
26
26
  export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
27
27
  response: any;
28
+ leadResponse: any;
28
29
  formData: OTPFormValues;
29
30
  }, OTPFormValues, {}>;
30
31
  export declare const verifyAuthPassword: import("@reduxjs/toolkit").AsyncThunk<{
@@ -50,8 +50,8 @@ 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, CLIENT_ORIGIN } from '../../../constants';
54
- import { getIndividualName } from '../../../utils';
53
+ import { defaultCountry } from '../../../constants';
54
+ import { getIndividualName, getClientEmailUrl } from '../../../utils';
55
55
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var settings, countriesBody, list, businessCountry;
57
57
  return __generator(this, function (_a) {
@@ -65,11 +65,7 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
65
65
  businessCountry = list.find(function (item) {
66
66
  return [item.iso2, item.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
67
67
  });
68
- console.log('businessCountry', businessCountry);
69
- return [2, {
70
- businessCountry: businessCountry,
71
- countries: list || []
72
- }];
68
+ return [2, { businessCountry: businessCountry, countries: list || [] }];
73
69
  }
74
70
  });
75
71
  }); });
@@ -138,7 +134,7 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
138
134
  });
139
135
  }); });
140
136
  export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
141
- var _a, connect, settings, isAbsher, responseBody, payload, data;
137
+ var _a, connect, settings, isAbsher, responseBody, payload, data, leadData;
142
138
  var _b, _c;
143
139
  return __generator(this, function (_d) {
144
140
  switch (_d.label) {
@@ -162,16 +158,23 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
162
158
  return [4, API.authService.verifyAuth(payload)];
163
159
  case 1:
164
160
  data = (_d.sent()).data;
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 });
167
- if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
168
- thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
169
- }
170
- else {
171
- thunkApi.dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
172
- }
161
+ leadData = undefined;
162
+ if (!!data.errors) return [3, 4];
163
+ if (!(data === null || data === void 0 ? void 0 : data.lead_id)) return [3, 3];
164
+ return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.lead_id)];
165
+ case 2:
166
+ leadData = _d.sent();
167
+ _d.label = 3;
168
+ case 3:
169
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
170
+ if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
171
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
173
172
  }
174
- return [2, { response: data, formData: params }];
173
+ else {
174
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_PASSWORD_STEP'));
175
+ }
176
+ _d.label = 4;
177
+ case 4: return [2, { response: data, leadResponse: leadData === null || leadData === void 0 ? void 0 : leadData.data, formData: params }];
175
178
  }
176
179
  });
177
180
  }); });
@@ -347,7 +350,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
347
350
  };
348
351
  payload = {
349
352
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
350
- email_url: CLIENT_ORIGIN + '/auth/business?token=',
353
+ email_url: getClientEmailUrl(),
351
354
  encryption_contract: []
352
355
  };
353
356
  return [4, API.leadService.updateLead(payload, { headers: headers })];
@@ -430,7 +433,7 @@ export var connectSlice = createSlice({
430
433
  state.loading = false;
431
434
  state.error = null;
432
435
  var _b = action.payload, formData = _b.formData, response = _b.response;
433
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
436
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
434
437
  if (description) {
435
438
  state.error = description;
436
439
  return;
@@ -452,7 +455,7 @@ export var connectSlice = createSlice({
452
455
  state.loading = false;
453
456
  state.error = null;
454
457
  var _b = action.payload, formData = _b.formData, response = _b.response;
455
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
458
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
456
459
  if (description) {
457
460
  state.error = description;
458
461
  return;
@@ -473,12 +476,27 @@ export var connectSlice = createSlice({
473
476
  var _a;
474
477
  state.loading = false;
475
478
  state.error = null;
476
- var _b = action.payload, formData = _b.formData, response = _b.response;
477
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
479
+ var _b = action.payload, formData = _b.formData, response = _b.response, leadResponse = _b.leadResponse;
480
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
478
481
  if (description) {
479
482
  state.error = description;
480
483
  return;
481
484
  }
485
+ var leadError = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.errors;
486
+ if (!!leadResponse && !leadError) {
487
+ var name_1 = leadResponse.name, contact = leadResponse.contact;
488
+ var email = contact.email, phone_1 = contact.phone;
489
+ if (!!name_1)
490
+ state.data.individualData.name = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.last);
491
+ if (!!email)
492
+ state.data.individualData.email = email;
493
+ if (!!phone_1) {
494
+ state.data.individualData.mobile = phone_1 === null || phone_1 === void 0 ? void 0 : phone_1.number;
495
+ state.data.individualData.countryCode =
496
+ (state.data.countries || []).find(function (country) { return (country === null || country === void 0 ? void 0 : country.idd_prefix) === (phone_1 === null || phone_1 === void 0 ? void 0 : phone_1.country_code); }) ||
497
+ state.data.individualData.countryCode;
498
+ }
499
+ }
482
500
  state.data.otpData.otp = formData.otp;
483
501
  state.data.otpData.responseBody = response;
484
502
  })
@@ -495,7 +513,7 @@ export var connectSlice = createSlice({
495
513
  state.loading = false;
496
514
  state.error = null;
497
515
  var _b = action.payload, formData = _b.formData, response = _b.response;
498
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
516
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
499
517
  if (description) {
500
518
  state.error = description;
501
519
  return;
@@ -516,7 +534,7 @@ export var connectSlice = createSlice({
516
534
  state.loading = false;
517
535
  state.error = null;
518
536
  var _b = action.payload, formData = _b.formData, response = _b.response;
519
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
537
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
520
538
  if (description) {
521
539
  state.error = description;
522
540
  return;
@@ -537,7 +555,7 @@ export var connectSlice = createSlice({
537
555
  state.loading = false;
538
556
  state.error = null;
539
557
  var _b = action.payload, formData = _b.formData, response = _b.response;
540
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
558
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
541
559
  if (description) {
542
560
  state.error = description;
543
561
  return;
@@ -586,7 +604,7 @@ export var connectSlice = createSlice({
586
604
  state.loading = false;
587
605
  state.error = null;
588
606
  var response = action.payload.response;
589
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || []).description;
607
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
590
608
  if (description) {
591
609
  state.error = description;
592
610
  return;
@@ -5,9 +5,7 @@ import SuccessScreen from '../../../shared/SuccessScreen';
5
5
  var Success = function (_a) {
6
6
  var t = useTranslation().t;
7
7
  var onSuccess = function () {
8
- console.log('success');
9
- alert('Account created successfully, please check your email');
10
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
8
+ window.open('mailto:');
11
9
  };
12
10
  return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
13
11
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- export interface BusinessLibProps {
2
+ import { LibConfig } from '../../@types';
3
+ export interface BusinessLibProps extends LibConfig {
3
4
  }
4
5
  export declare function BusinessLib(props: BusinessLibProps): JSX.Element;
5
6
  export declare function renderBusinessLib(config: BusinessLibProps, elementId: string): void;
@@ -13,13 +13,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import React, { memo, useEffect } from 'react';
14
14
  import { styled } from '@mui/material/styles';
15
15
  import Box from '@mui/material/Box';
16
- import { useAppTheme, useAppDispatch, useAppSelector } from '../../hooks';
17
- import { handleActiveFlowScreens, settingsSelector } from '../../app/settings';
16
+ import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
17
+ import { settingsSelector } from '../../app/settings';
18
+ import { verifyLeadToken } from '../app/business/businessStore';
18
19
  import AnimationFlow from '../../components/AnimationFlow';
19
20
  import { store } from '../../app/store';
20
21
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
21
22
  import Collapse from '../../components/Collapse';
22
- import { reactElement } from '../../utils';
23
+ import { getParameterByName, reactElement } from '../../utils';
23
24
  import { BUSINESS_SCREENS_NAVIGATION } from '../../constants';
24
25
  import { businessFeatureScreens } from '../featuresScreens';
25
26
  import CustomFooter from '../shared/Footer';
@@ -40,9 +41,17 @@ var Business = memo(function (props) {
40
41
  var theme = useAppTheme().theme;
41
42
  var dispatch = useAppDispatch();
42
43
  var data = useAppSelector(settingsSelector).data;
44
+ useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props));
45
+ useErrorListener();
43
46
  var activeScreen = data.activeScreen;
47
+ var verifyToken = function () {
48
+ var token = getParameterByName('token');
49
+ if (!token)
50
+ throw new Error('Auth token is not found!');
51
+ dispatch(verifyLeadToken(token));
52
+ };
44
53
  useEffect(function () {
45
- dispatch(handleActiveFlowScreens(BUSINESS_SCREENS_NAVIGATION));
54
+ verifyToken();
46
55
  }, []);
47
56
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(Container, { children: businessFeatureScreens.map(function (_a, index) {
48
57
  var Element = _a.element, name = _a.name;
@@ -5,9 +5,7 @@ import SuccessScreen from '../../../shared/SuccessScreen';
5
5
  var Success = function (_a) {
6
6
  var t = useTranslation().t;
7
7
  var onSuccess = function () {
8
- console.log('success');
9
- alert('Account created successfully, please check your email');
10
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
8
+ window.open('mailto:');
11
9
  };
12
10
  return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
13
11
  };
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface OTPProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: OTPProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,39 @@
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 } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import Box from '@mui/material/Box/Box';
15
+ import { styled } from '@mui/material/styles';
16
+ import OTPField from '../../../../features/shared/OTP';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import { useTranslation } from 'react-i18next';
19
+ import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
+ var BoxStyled = styled(Box)(function (_a) {
21
+ var theme = _a.theme;
22
+ return ({
23
+ display: 'flex',
24
+ flexDirection: 'column',
25
+ fontFamily: theme.typography.fontFamily,
26
+ marginBottom: theme.spacing(5)
27
+ });
28
+ });
29
+ var OTPInput = function (_a) {
30
+ var control = useFormContext().control;
31
+ var t = useTranslation().t;
32
+ var otpControl = useController({ name: 'otp', control: control });
33
+ var handleOnOTPChange = function (otp) {
34
+ otpControl.field.onChange(otp);
35
+ };
36
+ var otpValue = otpControl.field.value;
37
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: function () { }, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
38
+ };
39
+ export default React.memo(OTPInput);
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export interface OTPProps {
3
+ phone?: string;
4
+ code?: string;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<{
7
+ ({ phone, code }: OTPProps): JSX.Element;
8
+ defaultProps: {
9
+ phone: string;
10
+ code: string;
11
+ };
12
+ }>;
13
+ export default _default;
@@ -0,0 +1,76 @@
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 { useAppDispatch } from '../../../../hooks';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useForm, FormProvider } from 'react-hook-form';
17
+ import { yupResolver } from '@hookform/resolvers/yup';
18
+ import Box from '@mui/material/Box/Box';
19
+ import { styled } from '@mui/material/styles';
20
+ import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
21
+ import { useLanguage } from '../../../../hooks';
22
+ import Form from '../../../../components/Form';
23
+ import Text from '../../../../components/Text';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Button from '../../../shared/Button';
26
+ import { maskPhone } from '../../../../utils';
27
+ import { OTPValidation } from './validation';
28
+ import OTPInput from './OTPInput';
29
+ var OTPTitleContainerStyled = styled(Box)(function (_a) {
30
+ var theme = _a.theme;
31
+ return ({
32
+ background: theme.palette.common.white,
33
+ border: '1px solid',
34
+ borderColor: theme.palette.divider,
35
+ direction: theme.direction,
36
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
37
+ marginBottom: theme.spacing(5.75)
38
+ });
39
+ });
40
+ var OTPTitleStyled = styled(Text)(function (_a) {
41
+ var theme = _a.theme;
42
+ return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.75 }));
43
+ });
44
+ var FormStyled = styled(Form)(function () { return ({
45
+ display: 'flex',
46
+ flexDirection: 'column'
47
+ }); });
48
+ var VerifyNumber = function (_a) {
49
+ var phone = _a.phone, code = _a.code;
50
+ var dispatch = useAppDispatch();
51
+ var methods = useForm({
52
+ resolver: yupResolver(OTPValidation),
53
+ defaultValues: {
54
+ otp: ''
55
+ },
56
+ mode: 'onChange'
57
+ });
58
+ var t = useTranslation().t;
59
+ var isAr = useLanguage().isAr;
60
+ var onSubmit = function (data) {
61
+ console.log('data', data);
62
+ if (data.otp === '123456')
63
+ return dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
64
+ dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
65
+ };
66
+ var onBack = function () {
67
+ dispatch(handlePrevScreenStep());
68
+ };
69
+ var loading = false;
70
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, type: 'submit', isAr: isAr, loading: loading }, { children: t('next') }))] })) })) }));
71
+ };
72
+ VerifyNumber.defaultProps = {
73
+ phone: '564656085',
74
+ code: '+996'
75
+ };
76
+ export default React.memo(VerifyNumber);
@@ -0,0 +1,3 @@
1
+ import OTP, { OTPProps } from './Verify';
2
+ export type { OTPProps };
3
+ export default OTP;
@@ -0,0 +1,2 @@
1
+ import OTP from './Verify';
2
+ export default OTP;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ }>>>;
@@ -0,0 +1,4 @@
1
+ import * as yup from 'yup';
2
+ export var OTPValidation = yup.object().shape({
3
+ otp: yup.string().min(6, 'otp_min_length').required('otp_required')
4
+ });
@@ -42,6 +42,7 @@ var Individual = function (_a) {
42
42
  var t = useTranslation().t;
43
43
  var isAr = useLanguage().isAr;
44
44
  var isAbsher = (_c = data.otpData) === null || _c === void 0 ? void 0 : _c.isAbsher;
45
+ var individualData = data.individualData;
45
46
  var methods = useForm({
46
47
  resolver: yupResolver(isAbsher ? IndividualMobileValidation(mobileLength) : IndividualValidation()),
47
48
  defaultValues: data.individualData,
@@ -57,6 +58,17 @@ var Individual = function (_a) {
57
58
  if (error)
58
59
  dispatch(clearError());
59
60
  }, [methods.formState.isValid]);
61
+ React.useEffect(function () {
62
+ var name = individualData.name, email = individualData.email, mobile = individualData.mobile, countryCode = individualData.countryCode;
63
+ if (!!name)
64
+ methods.setValue('name', name, { shouldValidate: true });
65
+ if (!!email)
66
+ methods.setValue('email', email, { shouldValidate: true });
67
+ if (!!mobile)
68
+ methods.setValue('mobile', mobile, { shouldValidate: true });
69
+ if (!!countryCode)
70
+ methods.setValue('countryCode', countryCode, { shouldValidate: true });
71
+ }, [individualData.name, individualData.email, individualData.mobile, individualData.countryCode]);
60
72
  var handleMenuListClick = function () {
61
73
  listActive ? setListActive(false) : setListActive(true);
62
74
  };
@@ -11,9 +11,7 @@ var ThankYou = function (_a) {
11
11
  dispatch(updateLeadSuccess());
12
12
  }, []);
13
13
  var onSuccess = function () {
14
- console.log('success');
15
- alert('Account created successfully, please check your email');
16
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
14
+ window.open('mailto:');
17
15
  };
18
16
  return _jsx(SuccessScreen, { title: t('ide_successfully_verified_message'), onSuccess: onSuccess });
19
17
  };
@@ -7,7 +7,7 @@ import ThankYouScreen from './connect/screens/ThankYou';
7
7
  import PasswordScreen from './connect/screens/Password';
8
8
  import CustomersPage from './business/screens/Customers';
9
9
  import IDBODPage from './business/screens/IDBOD';
10
- import VerifyNumberPage from './business/screens/VerifyNumber';
10
+ import BusinessVerifyPage from '../features/business/screens/Verify';
11
11
  import BusinessOTPPage from '../features/business/screens/OTP';
12
12
  import BusinessTypePage from './business/screens/BusinessType';
13
13
  import ActivitiesPage from './business/screens/Activities';
@@ -54,8 +54,8 @@ export var connectFeatureScreens = [
54
54
  ];
55
55
  export var businessFeatureScreens = [
56
56
  {
57
- name: 'BUSINESS_VERIFY_NUMBER_STEP',
58
- element: VerifyNumberPage
57
+ name: 'BUSINESS_VERIFY_STEP',
58
+ element: BusinessVerifyPage
59
59
  },
60
60
  {
61
61
  name: 'BUSINESS_IDBOD_STEP',
@@ -5,9 +5,7 @@ import SuccessScreen from '../../../shared/SuccessScreen';
5
5
  var Success = function (_a) {
6
6
  var t = useTranslation().t;
7
7
  var onSuccess = function () {
8
- console.log('success');
9
- alert('Account created successfully, please check your email');
10
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
8
+ window.open('mailto:');
11
9
  };
12
10
  return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
13
11
  };
@@ -5,9 +5,7 @@ import SuccessScreen from '../../../shared/SuccessScreen';
5
5
  var Success = function (_a) {
6
6
  var t = useTranslation().t;
7
7
  var onSuccess = function () {
8
- console.log('success');
9
- alert('Account created successfully, please check your email');
10
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
8
+ window.open('mailto:');
11
9
  };
12
10
  return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
13
11
  };
@@ -13,22 +13,14 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
13
  import Box from '@mui/material/Box/Box';
14
14
  import { styled } from '@mui/material/styles';
15
15
  import * as React from 'react';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useLanguage } from '../../../hooks';
16
18
  import Text from '../../../components/Text';
17
- import Button from '../../../components/Button';
18
19
  import Container from '../Containers/ScreenContainer';
19
- import { ICONS_NAMES } from '../../../constants';
20
- var ButtonStyled = styled(Button)(function (_a) {
21
- var theme = _a.theme;
22
- return ({
23
- width: theme.spacing(5),
24
- height: theme.spacing(5),
25
- minHeight: theme.spacing(5),
26
- minWidth: theme.spacing(5),
27
- background: theme.palette.primary.main,
28
- margin: theme.spacing(2.5),
29
- borderRadius: theme.spacing(5)
30
- });
31
- });
20
+ import { AbsherButton } from '../../shared/Button';
21
+ var MailBoxStyled = styled(Box)(function () { return ({
22
+ width: '100%'
23
+ }); });
32
24
  var TextContainerStyled = styled(Box)(function (_a) {
33
25
  var _b;
34
26
  var theme = _a.theme;
@@ -58,6 +50,8 @@ var ContainerStyled = styled(Container)(function (_a) {
58
50
  });
59
51
  var ThankYou = function (_a) {
60
52
  var onSuccess = _a.onSuccess, title = _a.title;
61
- return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(ButtonStyled, __assign({ onClick: onSuccess }, { children: _jsx("img", { src: ICONS_NAMES.SUCCESS, alt: 'success Icon' }) }))] }));
53
+ var t = useTranslation().t;
54
+ var isAr = useLanguage().isAr;
55
+ return (_jsxs(ContainerStyled, { children: [title && (_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [title, " "] }) })), _jsx(MailBoxStyled, { children: _jsx(AbsherButton, __assign({ startIcon: null, isAr: isAr, onClick: onSuccess }, { children: t('open_mail_box') })) })] }));
62
56
  };
63
57
  export default React.memo(ThankYou);
@@ -5,9 +5,7 @@ import SuccessScreen from '../../../shared/SuccessScreen';
5
5
  var Success = function (_a) {
6
6
  var t = useTranslation().t;
7
7
  var onSuccess = function () {
8
- console.log('success');
9
- alert('Account created successfully, please check your email');
10
- alert("It's a fake message, plz wait us to integrate with the backend. <A.Sharkawy>");
8
+ window.open('mailto:');
11
9
  };
12
10
  return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess });
13
11
  };
@@ -1,4 +1,5 @@
1
1
  export declare const useAppDispatch: () => import("redux-thunk").ThunkDispatch<{
2
2
  settings: import("../app/settings").SettingsState;
3
3
  connect: import("../features/app/connect/connectStore").ConnectState;
4
+ business: import("../features/app/business/businessStore").BusinessState;
4
5
  }, undefined, import("redux").AnyAction> & import("redux").Dispatch<import("redux").AnyAction>;
@@ -7,3 +7,5 @@ export declare const getIndividualName: (name: string) => {
7
7
  last: string;
8
8
  } | undefined;
9
9
  export declare const convertNumbers2English: (str: string) => string;
10
+ export declare const getParameterByName: (name: string) => string | null;
11
+ export declare const getClientEmailUrl: () => string;
@@ -40,3 +40,15 @@ export var getIndividualName = function (name) {
40
40
  export var convertNumbers2English = function (str) {
41
41
  return str.replace(/[٠-٩]/g, function (d) { return '٠١٢٣٤٥٦٧٨٩'.indexOf(d); });
42
42
  };
43
+ export var getParameterByName = function (name) {
44
+ var params = new URLSearchParams(window.location.search);
45
+ return params.get(name);
46
+ };
47
+ export var getClientEmailUrl = function () {
48
+ var origin = window.location.origin;
49
+ var pathname = window.location.pathname;
50
+ if (origin.includes('localhost')) {
51
+ return origin + pathname + '/business?token=';
52
+ }
53
+ return origin + pathname + '/auth/business?token=';
54
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",