@tap-payments/auth-jsconnect 1.0.62 → 1.0.66

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.
@@ -56,7 +56,10 @@ export declare type UpdateLeadBody = {
56
56
  license_type?: string;
57
57
  is_acknowledged?: boolean;
58
58
  terms_conditions_accepted?: boolean;
59
- email_url?: string;
59
+ flows?: {
60
+ name: string;
61
+ url: string;
62
+ }[];
60
63
  };
61
64
  export declare type LeadVerifyBody = {
62
65
  verify_token: string;
@@ -232,5 +232,7 @@
232
232
  "individual_flow_pending": "Individual",
233
233
  "bank_flow_pending": "Bank",
234
234
  "password_flow_pending": "Password",
235
+ "business_flow_pending": "Business",
236
+ "business_flow_completed": "Business",
235
237
  "continue": "Continue"
236
238
  }
@@ -239,12 +239,14 @@
239
239
  "cr_number": "CR Number",
240
240
  "fl_number": "FL Number",
241
241
  "tax_flow_completed": "Tax",
242
- "individual_flow_completed": "Individual",
242
+ "individual_flow_completed": "Individual {{individual_name}}",
243
243
  "bank_flow_completed": "Bank",
244
244
  "password_flow_completed": "Password",
245
245
  "tax_flow_pending": "Tax",
246
- "individual_flow_pending": "Individual",
246
+ "individual_flow_pending": "Individual {{individual_name}}",
247
247
  "bank_flow_pending": "Bank",
248
248
  "password_flow_pending": "Password",
249
+ "business_flow_pending": "Business",
250
+ "business_flow_completed": "Business",
249
251
  "continue": "Continue"
250
252
  }
@@ -35,11 +35,22 @@ export declare const ICONS_NAMES: {
35
35
  ABSHER_LOGO: string;
36
36
  EMAIL_ICON: string;
37
37
  MOBILE_ICON: string;
38
- GMAIL_ICON: string;
39
- OUTLOOK_ICON: string;
40
- APPLE_MAIL_ICON: string;
41
- TAX_ICON: string;
42
- BANK_ICON: string;
43
- INDIVIDUAL_ICON: string;
44
- PASSWORD_ICON: string;
38
+ GMAIL_Filled_ICON: string;
39
+ GMAIL_White_ICON: string;
40
+ outlook_Filled_ICON: string;
41
+ outlook_White_ICON: string;
42
+ Apple_Filled_ICON: string;
43
+ apple_white_icon: string;
44
+ tax_filled_icon: string;
45
+ tax_white_icon: string;
46
+ bank_filled_icon: string;
47
+ bank_white_icon: string;
48
+ individual_filled_icon: string;
49
+ individual_white_icon: string;
50
+ password_filled_icon: string;
51
+ password_white_icon: string;
52
+ business_filled_icon: string;
53
+ business_white_icon: string;
54
+ Arrow_filled_right_icon: string;
55
+ Arrow_white_right_icon: string;
45
56
  };
@@ -35,11 +35,22 @@ export var ICONS_NAMES = {
35
35
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
36
36
  EMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/email.png',
37
37
  MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
38
- GMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/gmail-icon.svg',
39
- OUTLOOK_ICON: 'https://dash.b-cdn.net/icons/menu/outlook-icon.svg',
40
- APPLE_MAIL_ICON: 'https://dash.b-cdn.net/icons/menu/apple-icon.svg',
41
- TAX_ICON: 'https://email-templates.b-cdn.net/file.png',
42
- BANK_ICON: 'https://email-templates.b-cdn.net/dollar_square.png',
43
- INDIVIDUAL_ICON: 'https://email-templates.b-cdn.net/user.png',
44
- PASSWORD_ICON: 'https://email-templates.b-cdn.net/lock_square.png'
38
+ GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
39
+ GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
40
+ outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
41
+ outlook_White_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-white.svg',
42
+ Apple_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Apple-filled.svg',
43
+ apple_white_icon: 'https://dash.b-cdn.net/icons/menu/Apple-white.svg',
44
+ tax_filled_icon: 'https://dash.b-cdn.net/icons/menu/tax-filled.svg',
45
+ tax_white_icon: 'https://dash.b-cdn.net/icons/menu/tax-white.svg',
46
+ bank_filled_icon: 'https://dash.b-cdn.net/icons/menu/bank-filled.svg',
47
+ bank_white_icon: 'https://dash.b-cdn.net/icons/menu/bank-white.svg',
48
+ individual_filled_icon: 'https://dash.b-cdn.net/icons/menu/user-filled.svg',
49
+ individual_white_icon: 'https://dash.b-cdn.net/icons/menu/user-white.svg',
50
+ password_filled_icon: 'https://dash.b-cdn.net/icons/menu/password-filled.svg',
51
+ password_white_icon: 'https://dash.b-cdn.net/icons/menu/password-white.svg',
52
+ business_filled_icon: 'https://dash.b-cdn.net/icons/menu/business-filled.svg',
53
+ business_white_icon: 'https://dash.b-cdn.net/icons/menu/business-white.svg',
54
+ Arrow_filled_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-filled.svg',
55
+ Arrow_white_right_icon: 'https://dash.b-cdn.net/icons/menu/right-arrow-white.svg'
45
56
  };
@@ -29,7 +29,11 @@ export declare const updateLeadIdentity: import("@reduxjs/toolkit").AsyncThunk<{
29
29
  }, {}>;
30
30
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<{
31
31
  data: any;
32
- }, string, {}>;
32
+ licenseNumber: string;
33
+ }, {
34
+ leadId: string;
35
+ licenseNumber: string;
36
+ }, {}>;
33
37
  export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThunk<{
34
38
  data: any;
35
39
  formData: BusinessTypeFormValues;
@@ -58,7 +62,10 @@ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<
58
62
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
59
63
  response: any;
60
64
  formData: void;
61
- }, void, {}>;
65
+ } | undefined, void, {}>;
66
+ export declare const updateStepName: import("@reduxjs/toolkit").AsyncThunk<{
67
+ response: any;
68
+ }, string, {}>;
62
69
  declare type VerifyData = {
63
70
  token: string;
64
71
  };
@@ -60,7 +60,7 @@ import moment from 'moment';
60
60
  import API from '../../../api';
61
61
  import { BusinessType } from '../../../@types';
62
62
  import { BUSINESS_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
- import { convertNumbers2English, getClientEmailUrl, removeRequestHeaders } from '../../../utils';
63
+ import { convertNumbers2English, getFlowUrl, removeRequestHeaders } from '../../../utils';
64
64
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
65
65
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var settings, countriesBody, businessCountry;
@@ -79,9 +79,10 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
79
79
  });
80
80
  }); });
81
81
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
82
- var payload, data, leadResponse;
83
- return __generator(this, function (_a) {
84
- switch (_a.label) {
82
+ var payload, data, leadResponse, number;
83
+ var _a;
84
+ return __generator(this, function (_b) {
85
+ switch (_b.label) {
85
86
  case 0:
86
87
  payload = {
87
88
  service_name: 'tap_email',
@@ -89,28 +90,29 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
89
90
  };
90
91
  return [4, API.leadService.verifyLeadToken(payload)];
91
92
  case 1:
92
- data = (_a.sent()).data;
93
+ data = (_b.sent()).data;
93
94
  leadResponse = undefined;
94
95
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 4];
95
96
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
96
97
  case 2:
97
- leadResponse = _a.sent();
98
- return [4, thunkApi.dispatch(retrieveEntityList(data === null || data === void 0 ? void 0 : data.id))];
98
+ leadResponse = _b.sent();
99
+ number = (((_a = leadResponse.data.entity) === null || _a === void 0 ? void 0 : _a.license) || {}).number;
100
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id, licenseNumber: number }))];
99
101
  case 3:
100
- _a.sent();
102
+ _b.sent();
101
103
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
102
104
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
103
105
  }
104
106
  if (data.step_name === 'business_info') {
105
107
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
106
108
  }
107
- _a.label = 4;
109
+ _b.label = 4;
108
110
  case 4: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
109
111
  }
110
112
  });
111
113
  }); });
112
114
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
- var _a, business, settings, isNID, responseBody, payload, data, steps, hasBusinessCompleted;
115
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, steps, hasBusinessCompleted;
114
116
  var _b, _c, _d;
115
117
  return __generator(this, function (_e) {
116
118
  switch (_e.label) {
@@ -118,17 +120,19 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
118
120
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
119
121
  isNID = business.data.otpData.isNID;
120
122
  responseBody = (isNID ? business.data.nidData : business.data.verify).responseBody;
123
+ stepName = isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH;
121
124
  payload = {
122
125
  data: params.otp,
123
126
  service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
124
127
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
125
- step_name: isNID ? BUSINESS_STEP_NAMES.IDENTITY_VERIFY_AUTH : BUSINESS_STEP_NAMES.PHONE_AUTH,
128
+ step_name: stepName,
126
129
  encryption_contract: ['data']
127
130
  };
128
131
  return [4, API.leadService.verifyLeadOTP(payload)];
129
132
  case 1:
130
133
  data = (_e.sent()).data;
131
134
  if (!data.errors) {
135
+ thunkApi.dispatch(updateStepName(stepName));
132
136
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
133
137
  steps = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps) || [];
134
138
  hasBusinessCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
@@ -152,13 +156,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
152
156
  });
153
157
  }); });
154
158
  export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
155
- var _a, settings, business, identification_id_type, headers, requestBody, data;
159
+ var _a, settings, business, identification_id_type, stepName, headers, requestBody, data;
156
160
  var _b, _c, _d, _e, _f;
157
161
  return __generator(this, function (_g) {
158
162
  switch (_g.label) {
159
163
  case 0:
160
164
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
161
165
  identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
166
+ stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
162
167
  headers = {
163
168
  lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
164
169
  device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
@@ -168,13 +173,14 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
168
173
  identification_id_type: identification_id_type,
169
174
  date_of_birth: params.dob,
170
175
  country_code: business.data.businessCountry.iso2,
171
- step_name: BUSINESS_STEP_NAMES.IDENTITY_AUTH,
176
+ step_name: stepName,
172
177
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
173
178
  };
174
179
  return [4, API.leadService.updateLeadIdentity(requestBody, { headers: headers })];
175
180
  case 1:
176
181
  data = (_g.sent()).data;
177
182
  if (!data.errors && !params.isResend) {
183
+ thunkApi.dispatch(updateStepName(stepName));
178
184
  thunkApi.dispatch(handleNextScreenStep());
179
185
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
180
186
  }
@@ -182,14 +188,14 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
182
188
  }
183
189
  });
184
190
  }); });
185
- export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
191
+ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
186
192
  var data;
187
193
  return __generator(this, function (_a) {
188
194
  switch (_a.label) {
189
- case 0: return [4, API.leadService.retrieveEntityList(leadId)];
195
+ case 0: return [4, API.leadService.retrieveEntityList(params.leadId)];
190
196
  case 1:
191
197
  data = (_a.sent()).data;
192
- return [2, { data: data }];
198
+ return [2, { data: data, licenseNumber: params.licenseNumber }];
193
199
  }
194
200
  });
195
201
  }); });
@@ -254,7 +260,7 @@ export var createAccount = createAsyncThunk('createAccount', function (params, t
254
260
  });
255
261
  }); });
256
262
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
257
- var _a, settings, business, channel, activities, requestBody, headers, data;
263
+ var _a, settings, business, channel, activities, stepName, id, requestBody, headers, data;
258
264
  var _b, _c, _d, _e;
259
265
  return __generator(this, function (_f) {
260
266
  switch (_f.label) {
@@ -268,17 +274,20 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
268
274
  var en = _a.en;
269
275
  return en;
270
276
  });
277
+ stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
278
+ id = (_c = business.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.entity_id;
271
279
  requestBody = {
272
280
  activities: activities,
273
281
  channel_services: channel,
274
282
  business_operation_start_at: params.operationStartDate,
275
- step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES
283
+ step_name: stepName
276
284
  };
277
- headers = { entity_id: (_c = business.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.entity_id };
285
+ headers = { entity_id: id };
278
286
  return [4, API.entityService.createEntityInfo(requestBody, { headers: headers })];
279
287
  case 1:
280
288
  data = (_f.sent()).data;
281
289
  if (!!data.errors) return [3, 3];
290
+ thunkApi.dispatch(updateStepName(stepName));
282
291
  return [4, thunkApi.dispatch(retrieveDataList())];
283
292
  case 2:
284
293
  _f.sent();
@@ -309,7 +318,7 @@ export var retrieveDataList = createAsyncThunk('retrieveDataList', function () {
309
318
  });
310
319
  }); });
311
320
  export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
312
- var _a, settings, business, customerBase, requestBody, data;
321
+ var _a, settings, business, customerBase, stepName, requestBody, data;
313
322
  var _b, _c, _d, _e, _f;
314
323
  return __generator(this, function (_g) {
315
324
  switch (_g.label) {
@@ -319,6 +328,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
319
328
  var title = _a.title;
320
329
  return title;
321
330
  });
331
+ stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
322
332
  requestBody = {
323
333
  customers_base: customerBase,
324
334
  id: (_b = business.data.businessTypeData.responseBody) === null || _b === void 0 ? void 0 : _b.entity_id,
@@ -326,12 +336,13 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
326
336
  yearly_sales_range: ((_d = params.expectedSalesRange) === null || _d === void 0 ? void 0 : _d.title) || '',
327
337
  agree_refund: params.refundPolicy,
328
338
  agree_chargeback: params.transactionPolicy,
329
- step_name: BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS
339
+ step_name: stepName
330
340
  };
331
341
  return [4, API.entityService.updateEntityInfo(requestBody)];
332
342
  case 1:
333
343
  data = (_g.sent()).data;
334
344
  if (!data.errors) {
345
+ thunkApi.dispatch(updateStepName(stepName));
335
346
  thunkApi.dispatch(handleNextScreenStep());
336
347
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
337
348
  }
@@ -340,27 +351,64 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
340
351
  });
341
352
  }); });
342
353
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
343
- var _a, settings, business, response, payload;
344
- var _b, _c, _d, _e, _f, _g;
345
- return __generator(this, function (_h) {
346
- switch (_h.label) {
354
+ var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
355
+ var _c, _d, _e, _f;
356
+ return __generator(this, function (_g) {
357
+ switch (_g.label) {
347
358
  case 0:
348
359
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
349
- response = undefined;
350
- if (!!!((_b = business.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id)) return [3, 2];
360
+ _b = business.data.verify.responseBody || {}, steps = _b.steps, id = _b.id;
361
+ flowCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
362
+ if (flowCompleted)
363
+ return [2];
351
364
  payload = {
352
365
  step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
353
- id: ((_c = business.data.otpData.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
354
- email_url: getClientEmailUrl(),
366
+ id: id,
367
+ flows: [
368
+ {
369
+ name: 'tax',
370
+ url: getFlowUrl('/tax')
371
+ },
372
+ {
373
+ name: 'bank',
374
+ url: getFlowUrl('/bank')
375
+ },
376
+ {
377
+ name: 'individual',
378
+ url: getFlowUrl('/individual')
379
+ },
380
+ {
381
+ name: 'password',
382
+ url: getFlowUrl('/password')
383
+ }
384
+ ],
355
385
  encryption_contract: []
356
386
  };
357
387
  return [4, API.leadService.updateLead(payload)];
358
388
  case 1:
359
- response = _h.sent();
360
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
361
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
362
- _h.label = 2;
363
- case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
389
+ data = (_g.sent()).data;
390
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
391
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
392
+ return [2, { response: data, formData: params }];
393
+ }
394
+ });
395
+ }); });
396
+ export var updateStepName = createAsyncThunk('updateStepName', function (stepName, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
397
+ var business, payload, data;
398
+ var _a;
399
+ return __generator(this, function (_b) {
400
+ switch (_b.label) {
401
+ case 0:
402
+ business = thunkApi.getState().business;
403
+ payload = {
404
+ step_name: stepName,
405
+ id: ((_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id) || '',
406
+ encryption_contract: []
407
+ };
408
+ return [4, API.leadService.updateLead(payload)];
409
+ case 1:
410
+ data = (_b.sent()).data;
411
+ return [2, { response: data }];
364
412
  }
365
413
  });
366
414
  }); });
@@ -508,10 +556,10 @@ export var businessSlice = createSlice({
508
556
  state.customLoading = true;
509
557
  })
510
558
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
511
- var _a, _b;
559
+ var _a, _b, _c, _d, _e;
512
560
  state.error = null;
513
561
  state.customLoading = false;
514
- var data = action.payload.data;
562
+ var _f = action.payload, data = _f.data, licenseNumber = _f.licenseNumber;
515
563
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
516
564
  var licenseList = [];
517
565
  if (!description) {
@@ -530,9 +578,11 @@ export var businessSlice = createSlice({
530
578
  }
531
579
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
532
580
  state.data.businessTypeData.responseBody = { licenseList: licenseList };
533
- var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
581
+ var selectedLicense = ((_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (item) { var _a; return ((_a = item.license) === null || _a === void 0 ? void 0 : _a.number) === licenseNumber; })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
534
582
  state.data.businessTypeData.selectedLicense = selectedLicense;
535
- state.data.businessTypeData.licenseNumber = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number;
583
+ var isOtherLicense = ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_fl' || ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) === 'other_cr';
584
+ if (!isOtherLicense)
585
+ state.data.businessTypeData.licenseNumber = (_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number;
536
586
  })
537
587
  .addCase(retrieveEntityList.rejected, function (state, action) {
538
588
  state.error = action.error.message;
@@ -585,9 +635,9 @@ export var businessSlice = createSlice({
585
635
  state.error = 'signup_user_exists_error';
586
636
  return;
587
637
  }
588
- var licenseList = (state.data.businessTypeData.responseBody || { licenseList: [] }).licenseList;
589
- state.data.businessTypeData.responseBody = __assign(__assign({ licenseList: licenseList }, data), { channelList: channelsData || [] });
590
- var selectedChannel = channelsData === null || channelsData === void 0 ? void 0 : channelsData[0];
638
+ var channels = channelsData || [];
639
+ state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { channelList: channels });
640
+ var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
591
641
  if (!!selectedChannel)
592
642
  state.data.activitiesData.salesChannels = [selectedChannel];
593
643
  })
@@ -665,12 +715,13 @@ export var businessSlice = createSlice({
665
715
  var _a;
666
716
  state.loading = false;
667
717
  state.error = null;
668
- var response = action.payload.response;
718
+ var response = (action.payload || {}).response;
669
719
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
670
720
  if (description) {
671
721
  state.error = description;
672
722
  return;
673
723
  }
724
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: response.flows });
674
725
  removeRequestHeaders();
675
726
  })
676
727
  .addCase(updateLeadSuccess.pending, function (state) {
@@ -60,7 +60,7 @@ import { handleNextScreenStep } from '../../../app/settings';
60
60
  import API from '../../../api';
61
61
  import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
62
62
  import { defaultCountry } from '../../../constants';
63
- import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
63
+ import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
64
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var settings, countriesBody, businessCountry;
66
66
  return __generator(this, function (_a) {
@@ -284,7 +284,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
284
284
  id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
285
285
  terms_conditions_accepted: params.termAndConditionChecked,
286
286
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
287
- encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'social[0]', 'social[1]']
287
+ encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
288
288
  };
289
289
  return [4, API.leadService.updateLead(payload)];
290
290
  case 1:
@@ -352,7 +352,12 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
352
352
  isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
353
353
  payload = {
354
354
  step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
355
- email_url: getClientEmailUrl(),
355
+ flows: [
356
+ {
357
+ name: 'business',
358
+ url: getFlowUrl('/business')
359
+ }
360
+ ],
356
361
  id: (isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
357
362
  encryption_contract: []
358
363
  };
@@ -96,7 +96,7 @@ var LicenseList = function (_a) {
96
96
  var _a, _b;
97
97
  if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
98
98
  return t('future_work');
99
- return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
99
+ return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
100
100
  };
101
101
  var isOtherLicense = function (item) {
102
102
  var _a, _b;
@@ -114,15 +114,15 @@ var LicenseList = function (_a) {
114
114
  };
115
115
  var getLicenseFullName = function (item) {
116
116
  if (isAr)
117
- return (_jsxs(_Fragment, { children: [_jsx("span", { children: getLicenseName(item) }), _jsx("span", { children: ' - ' }), _jsx("span", { children: getLicenseNumber(item) })] }));
118
- return (_jsxs(_Fragment, { children: [_jsx("span", { children: getLicenseNumber(item) }), _jsx("span", { children: ' - ' }), _jsx("span", { children: getLicenseName(item) })] }));
117
+ return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
118
+ return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
119
119
  };
120
120
  var showLicenseNumber = !anchorEl;
121
121
  var selected = selectedLicenseControl.field.value;
122
122
  var licenseReadonly = !isOtherLicense(selected);
123
123
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
124
124
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
125
- return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? getLicenseName(selected) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
125
+ return (_jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
126
126
  return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
127
127
  } }) })), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: licenseReadonly })] }));
128
128
  };
@@ -41,6 +41,6 @@ var LicenseNumber = function (_a) {
41
41
  var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
42
  var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
43
43
  var label = isCR ? 'cr_number' : 'fl_number';
44
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? '01f3c5x78n' : '1a3c5b78', warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
44
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length ? (_jsx(CheckIcon, {})) : (licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber })), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: length }) }) }) })));
45
45
  };
46
46
  export default React.memo(LicenseNumber);
@@ -1,11 +1,11 @@
1
1
  import * as yup from 'yup';
2
2
  export declare const LicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  selectedLicense: any;
4
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
4
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
5
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
6
  selectedLicense: any;
7
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
8
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
9
  selectedLicense: any;
10
- licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
@@ -13,13 +13,20 @@ var objectElements = {
13
13
  };
14
14
  export var LicenseValidationSchema = yup.object().shape({
15
15
  selectedLicense: yup.object().shape(objectElements).required(''),
16
- licenseNumber: yup.string().when('selectedLicense', function (selectedLicenseValue) {
17
- var _a, _b;
18
- if (((_b = (_a = selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.license) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === BusinessType.CR) {
19
- return yup.string().min(CR_NUMBER_LENGTH, "cr_max_length").required('cr_required');
20
- }
21
- else {
22
- return yup.string().min(FL_NUMBER_LENGTH, "fl_max_length").required('fl_required');
16
+ licenseNumber: yup
17
+ .string()
18
+ .test({
19
+ test: function (value) {
20
+ var selectedLicense = this.parent.selectedLicense;
21
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
22
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
23
+ if (length === 0)
24
+ return true;
25
+ if (isCR) {
26
+ return length === CR_NUMBER_LENGTH ? true : this.createError({ message: 'cr_max_length' });
27
+ }
28
+ return length === FL_NUMBER_LENGTH ? true : this.createError({ message: 'fl_max_length' });
23
29
  }
24
30
  })
31
+ .required('')
25
32
  });
@@ -67,11 +67,6 @@ var ExpectedSalesRange = function (_a) {
67
67
  setExpectedSalesRangeList(response === null || response === void 0 ? void 0 : response.expectedSales);
68
68
  }
69
69
  }, [response === null || response === void 0 ? void 0 : response.expectedSales]);
70
- var checkRemainingCondition = function (item) {
71
- return !!expectedSalesRangeValue.find(function (expectedSale) {
72
- return expectedSale.id === item.id;
73
- });
74
- };
75
70
  var onSelectItem = function (expectedSalesRange) {
76
71
  onCloseList();
77
72
  expectedSalesRangeControl.field.onChange(expectedSalesRange);
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo } from 'react';
13
+ import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
16
  import Box from '@mui/material/Box';
@@ -18,20 +18,18 @@ import Text from '../../../../components/Text';
18
18
  import Container from '../../../shared/Containers/ScreenContainer';
19
19
  import { FlowsButtons } from '../../../shared/Button';
20
20
  import { ICONS_NAMES } from '../../../../constants';
21
+ import { useAppSelector } from '../../../../hooks';
22
+ import { businessSelector } from '../../../app/business/businessStore';
21
23
  var TextContainerStyled = styled(Box)(function (_a) {
22
- var _b;
23
24
  var theme = _a.theme;
24
- return (_b = {
25
- background: theme.palette.common.white,
26
- border: '1px solid',
27
- width: '100%',
28
- borderColor: theme.palette.divider,
29
- borderRadius: theme.spacing(0, 0, 1.25, 1.25)
30
- },
31
- _b[theme.breakpoints.up('sm')] = {
32
- marginBottom: theme.spacing(7.5)
33
- },
34
- _b);
25
+ return ({
26
+ background: theme.palette.common.white,
27
+ border: '1px solid',
28
+ width: '100%',
29
+ borderColor: theme.palette.divider,
30
+ borderRadius: theme.spacing(0, 0, 1.25, 1.25),
31
+ marginBottom: theme.spacing(7.5)
32
+ });
35
33
  });
36
34
  var TitleStyled = styled(Text)(function (_a) {
37
35
  var theme = _a.theme;
@@ -53,27 +51,34 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
53
51
  });
54
52
  var SuccessWithFlowButtons = function () {
55
53
  var t = useTranslation().t;
56
- return (_jsxs(ContainerStyled, { children: [_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [t('ide_successfully_verified_message'), " "] }) }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: [
57
- {
58
- title: t('tax_flow_pending'),
59
- href: '#',
60
- src: ICONS_NAMES.TAX_ICON
61
- },
62
- {
63
- title: t('individual_flow_pending'),
64
- href: '#',
65
- src: ICONS_NAMES.INDIVIDUAL_ICON
66
- },
67
- {
68
- title: t('bank_flow_pending'),
69
- href: '#',
70
- src: ICONS_NAMES.BANK_ICON
71
- },
72
- {
73
- title: t('password_flow_pending'),
74
- href: '#',
75
- src: ICONS_NAMES.PASSWORD_ICON
76
- }
77
- ] }) })] }));
54
+ var data = useAppSelector(businessSelector).data;
55
+ var _a = data.verify.responseBody || {}, flows = _a.flows, nameObj = _a.name;
56
+ var _b = useState([]), buttons = _b[0], setButtons = _b[1];
57
+ var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
58
+ var reMapFlowData = function (flows) {
59
+ if (flows === void 0) { flows = []; }
60
+ var images = ICONS_NAMES;
61
+ var mappedFlows = flows.map(function (_a) {
62
+ var name = _a.name, url = _a.url, status = _a.status;
63
+ var type = status === 'initiated' ? 'pending' : 'completed';
64
+ var title = t("".concat(name, "_flow_").concat(type), { individual_name: username });
65
+ var src = "".concat(name, "_filled_icon");
66
+ var hoverSrc = "".concat(name, "_white_icon");
67
+ var isCompleted = status === 'completed' && name !== 'password';
68
+ return {
69
+ title: title,
70
+ href: url,
71
+ src: images[src],
72
+ hoverSrc: images[hoverSrc],
73
+ isCompleted: isCompleted
74
+ };
75
+ });
76
+ setButtons(mappedFlows);
77
+ };
78
+ useEffect(function () {
79
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
80
+ reMapFlowData(flows);
81
+ }, [flows]);
82
+ return (_jsxs(ContainerStyled, { children: [_jsx(TextContainerStyled, { children: _jsxs(TitleStyled, { children: [t('ide_successfully_verified_message'), " "] }) }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
78
83
  };
79
84
  export default memo(SuccessWithFlowButtons);
@@ -21,18 +21,17 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
+ import React from 'react';
24
25
  import Button from '../../../components/Button';
25
26
  import Icon from '../../../components/Icon';
26
27
  import { alpha, styled } from '@mui/material/styles';
27
28
  import Box from '@mui/material/Box';
28
29
  import { ICONS_NAMES } from '../../../constants';
29
- var IconStyled = styled(Icon)(function (_a) {
30
- var theme = _a.theme;
31
- return ({
32
- width: theme.spacing(3),
33
- height: theme.spacing(3),
34
- marginInlineStart: theme.spacing(0.75)
35
- });
30
+ var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'disabled'; } })(function (_a) {
31
+ var theme = _a.theme, disabled = _a.disabled;
32
+ return (__assign({ width: theme.spacing(3), height: theme.spacing(3), marginInlineStart: theme.spacing(0.75) }, (disabled && {
33
+ opacity: 0.3
34
+ })));
36
35
  });
37
36
  var ButtonBoxStyled = styled(Box)(function (_a) {
38
37
  var theme = _a.theme;
@@ -40,31 +39,35 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
40
39
  margin: theme.spacing(0, 2.5, 2.5, 2.5)
41
40
  });
42
41
  });
43
- var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'hideIcon'; } })(function (_a) {
44
- var theme = _a.theme, hideIcon = _a.hideIcon;
42
+ var ButtonStyled = styled(Button, {
43
+ shouldForwardProp: function (prop) { return prop !== 'hideIcon' && prop !== 'touched'; }
44
+ })(function (_a) {
45
+ var theme = _a.theme, hideIcon = _a.hideIcon, touched = _a.touched;
45
46
  return ({
46
47
  paddingInlineStart: theme.spacing(0.75),
47
48
  textTransform: 'none',
48
- backgroundColor: theme.palette.common.white,
49
+ backgroundColor: touched ? theme.palette.primary.light : theme.palette.common.white,
49
50
  border: "1px solid ".concat(hideIcon ? theme.palette.primary.main : theme.palette.primary.light),
50
- color: hideIcon ? theme.palette.primary.main : theme.palette.primary.light,
51
+ color: hideIcon ? theme.palette.primary.main : touched ? theme.palette.common.white : theme.palette.primary.light,
51
52
  '&:hover': {
52
- backgroundColor: hideIcon ? theme.palette.primary.main : theme.palette.primary.light,
53
- color: theme.palette.common.white,
53
+ backgroundColor: touched ? theme.palette.primary.light : theme.palette.common.white,
54
+ color: hideIcon ? theme.palette.primary.main : touched ? theme.palette.common.white : theme.palette.primary.light,
54
55
  img: {
55
- filter: 'brightness(0) invert(1)'
56
+ filter: touched ? 'brightness(0) invert(1)' : ''
56
57
  }
57
58
  },
58
- '&:active': {
59
- backgroundColor: theme.palette.common.white
60
- },
61
59
  '&:disabled': {
62
60
  backgroundColor: theme.palette.common.white,
63
- color: hideIcon ? alpha(theme.palette.primary.main, 0.3) : theme.palette.primary.light
61
+ color: alpha(hideIcon ? theme.palette.primary.main : theme.palette.primary.light, 0.3),
62
+ border: "1px solid ".concat(alpha(hideIcon ? theme.palette.primary.main : theme.palette.primary.light, 0.3))
64
63
  }
65
64
  });
66
65
  });
67
66
  export default function AbsherButton(_a) {
68
67
  var children = _a.children, isAr = _a.isAr, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
69
- return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ hideIcon: hideIcon, disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { src: ICONS_NAMES.ABSHER_LOGO }) }, props, { children: children })) }));
68
+ var _b = React.useState(false), touched = _b[0], setTouched = _b[1];
69
+ var handleTouch = function () {
70
+ setTouched(true);
71
+ };
72
+ return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ onTouchStart: handleTouch, touched: touched, hideIcon: hideIcon, disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.ABSHER_LOGO }) }, props, { children: children })) }));
70
73
  }
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
13
14
  import Button from '../../../components/Button';
14
15
  import { alpha, styled } from '@mui/material/styles';
15
16
  import Box from '@mui/material/Box';
@@ -91,5 +92,6 @@ var AppleButtonStyled = styled(Button)(function (_a) {
91
92
  });
92
93
  export default function EmailProvidersButtons(_a) {
93
94
  var gmail = _a.gmail, outlook = _a.outlook, apple = _a.apple;
94
- return (_jsxs(ButtonBoxStyled, { children: [_jsx(Link, __assign({ href: gmail.href, underline: 'none', target: '_blank' }, { children: _jsx(GMailButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.GMAIL_ICON, alt: gmail.title }), type: 'button' }, { children: gmail.title })) })), _jsx(Link, __assign({ href: apple.href, underline: 'none', target: '_blank' }, { children: _jsx(AppleButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.APPLE_MAIL_ICON, alt: apple.title }), type: 'button' }, { children: apple.title })) })), _jsx(Link, __assign({ href: outlook.href, underline: 'none', target: '_blank' }, { children: _jsx(OutlookButtonStyled, __assign({ startIcon: _jsx(Image, { src: ICONS_NAMES.OUTLOOK_ICON, alt: outlook.title }), type: 'button' }, { children: outlook.title })) }))] }));
95
+ var _b = React.useState(), index = _b[0], setIndex = _b[1];
96
+ return (_jsxs(ButtonBoxStyled, { children: [_jsx(Link, __assign({ href: gmail.href, underline: 'none', target: '_blank', onMouseEnter: function () { return setIndex(0); }, onMouseLeave: function () { return setIndex(undefined); } }, { children: _jsx(GMailButtonStyled, __assign({ startIcon: _jsx(Image, { src: index === 0 ? ICONS_NAMES.GMAIL_White_ICON : ICONS_NAMES.GMAIL_Filled_ICON, alt: gmail.title }), type: 'button' }, { children: gmail.title })) })), _jsx(Link, __assign({ href: apple.href, underline: 'none', target: '_blank', onMouseEnter: function () { return setIndex(1); }, onMouseLeave: function () { return setIndex(undefined); } }, { children: _jsx(AppleButtonStyled, __assign({ startIcon: _jsx(Image, { src: index === 1 ? ICONS_NAMES.apple_white_icon : ICONS_NAMES.Apple_Filled_ICON, alt: apple.title }), type: 'button' }, { children: apple.title })) })), _jsx(Link, __assign({ href: outlook.href, underline: 'none', target: '_blank', onMouseEnter: function () { return setIndex(2); }, onMouseLeave: function () { return setIndex(undefined); } }, { children: _jsx(OutlookButtonStyled, __assign({ startIcon: _jsx(Image, { src: index === 2 ? ICONS_NAMES.outlook_White_ICON : ICONS_NAMES.outlook_Filled_ICON, alt: outlook.title }), type: 'button' }, { children: outlook.title })) }))] }));
95
97
  }
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { ButtonProps } from '../../../components/Button';
3
- declare type buttonProps = {
3
+ export declare type ButtonItemProps = {
4
4
  title: string;
5
5
  href: string;
6
6
  src: string;
7
+ hoverSrc: string;
8
+ isCompleted: boolean;
7
9
  };
8
10
  export interface EmailProvidersButtonsProps extends ButtonProps {
9
- buttons: buttonProps[];
11
+ buttons: ButtonItemProps[];
10
12
  }
11
13
  export default function FlowsButtons({ buttons }: EmailProvidersButtonsProps): JSX.Element;
12
- export {};
@@ -10,20 +10,22 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { createElement as _createElement } from "react";
13
14
  import React from 'react';
14
15
  import Button from '../../../components/Button';
15
16
  import { alpha, styled } from '@mui/material/styles';
16
17
  import Box from '@mui/material/Box';
17
18
  import Link from '@mui/material/Link';
18
19
  import { ICONS_NAMES } from '../../../constants';
20
+ import CheckIcon from '@mui/icons-material/Check';
19
21
  var Image = styled('img', { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
20
- var theme = _a.theme, isAr = _a.isAr;
22
+ var theme = _a.theme;
21
23
  return ({
22
24
  width: theme.spacing(3),
23
25
  height: theme.spacing(3),
24
26
  fontSize: theme.spacing(3),
25
27
  marginInlineStart: theme.spacing(1),
26
- transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
28
+ transform: theme.direction === 'rtl' ? 'scaleX(-1)' : 'scaleX(1)'
27
29
  });
28
30
  });
29
31
  var ButtonBoxStyled = styled(Box)(function (_a) {
@@ -32,31 +34,41 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
32
34
  margin: theme.spacing(0, 2.5, 2.5, 2.5)
33
35
  });
34
36
  });
35
- var ButtonStyled = styled(Button)(function (_a) {
36
- var theme = _a.theme;
37
- return ({
38
- width: '100%',
39
- textTransform: 'none',
40
- paddingInlineStart: theme.spacing(0.75),
41
- backgroundColor: theme.palette.common.white,
42
- border: "1px solid ".concat(theme.palette.primary.main),
43
- color: theme.palette.primary.main,
44
- '&:hover': {
45
- backgroundColor: theme.palette.primary.main,
46
- color: theme.palette.common.white
47
- },
48
- '&:disabled': {
37
+ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'isCompleted'; } })(function (_a) {
38
+ var theme = _a.theme, isCompleted = _a.isCompleted;
39
+ return (__assign(__assign({ width: '100%', textTransform: 'none', paddingInlineStart: theme.spacing(0.75), backgroundColor: theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), color: theme.palette.primary.main }, (isCompleted && {
40
+ paddingInlineEnd: '13px',
41
+ color: theme.palette.success.main,
42
+ border: "1px solid ".concat(theme.palette.success.main)
43
+ })), { '&:hover': __assign({ backgroundColor: theme.palette.primary.main, color: theme.palette.common.white }, (isCompleted && {
44
+ backgroundColor: theme.palette.common.white,
45
+ border: "1px solid ".concat(theme.palette.success.main),
46
+ color: theme.palette.success.main,
47
+ cursor: 'initial'
48
+ })), '&:disabled': {
49
49
  backgroundColor: theme.palette.common.white,
50
50
  color: alpha(theme.palette.primary.main, 0.3)
51
- }
51
+ } }));
52
+ });
53
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
54
+ var theme = _a.theme;
55
+ return ({
56
+ width: theme.spacing(2.5),
57
+ height: theme.spacing(2.5),
58
+ color: theme.palette.success.main
52
59
  });
53
60
  });
54
61
  export default function FlowsButtons(_a) {
55
62
  var buttons = _a.buttons;
56
63
  var _b = React.useState(), index = _b[0], setIndex = _b[1];
57
64
  return (_jsx(ButtonBoxStyled, { children: buttons.map(function (_a, idx) {
58
- var title = _a.title, href = _a.href, src = _a.src;
65
+ var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted;
59
66
  var isLast = idx === buttons.length - 1;
60
- return (_jsx(Link, __assign({ underline: 'none' }, { children: _jsx(ButtonStyled, __assign({ onMouseEnter: function () { return setIndex(idx); }, onMouseLeave: function () { return setIndex(undefined); }, sx: { mb: isLast ? 0 : 1.8 }, endIcon: _jsx(Image, { src: index === idx ? ICONS_NAMES.WHITE_ARROW : ICONS_NAMES.BLACK_ARROW }), startIcon: _jsx(Image, { src: src, alt: title }), type: 'button' }, { children: title })) }), idx));
67
+ var linkProps = {
68
+ href: href,
69
+ target: '_blank'
70
+ };
71
+ return (_createElement(Link, __assign({}, (!isCompleted && linkProps), { underline: 'none', key: idx, onMouseEnter: function () { return !isCompleted && setIndex(idx); }, onMouseLeave: function () { return setIndex(undefined); } }),
72
+ _jsx(ButtonStyled, __assign({ isCompleted: isCompleted, sx: { mb: isLast ? 0 : 1.8 }, endIcon: isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15 }, src: index === idx ? ICONS_NAMES.Arrow_white_right_icon : ICONS_NAMES.Arrow_filled_right_icon })), startIcon: _jsx(Image, { src: index === idx ? hoverSrc : src, alt: title }), type: 'button' }, { children: title }))));
61
73
  }) }));
62
74
  }
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
+ import React from 'react';
24
25
  import Button from '../../../components/Button';
25
26
  import Icon from '../../../components/Icon';
26
27
  import { alpha, styled } from '@mui/material/styles';
@@ -38,24 +39,21 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
38
39
  margin: theme.spacing(0, 2.5, 2.5, 2.5)
39
40
  });
40
41
  });
41
- var ButtonStyled = styled(Button)(function (_a) {
42
- var theme = _a.theme;
42
+ var ButtonStyled = styled(Button, { shouldForwardProp: function (prop) { return prop !== 'touched'; } })(function (_a) {
43
+ var theme = _a.theme, touched = _a.touched;
43
44
  return ({
44
45
  paddingInlineStart: theme.spacing(0.75),
45
46
  textTransform: 'none',
46
- backgroundColor: theme.palette.common.white,
47
+ backgroundColor: touched ? theme.palette.primary.main : theme.palette.common.white,
47
48
  border: "1px solid ".concat(theme.palette.primary.main),
48
- color: theme.palette.primary.main,
49
+ color: touched ? theme.palette.common.white : theme.palette.primary.main,
49
50
  '&:hover': {
50
- backgroundColor: theme.palette.primary.main,
51
- color: theme.palette.common.white,
51
+ backgroundColor: touched ? theme.palette.primary.main : theme.palette.common.white,
52
+ color: touched ? theme.palette.common.white : theme.palette.primary.main,
52
53
  img: {
53
- filter: 'brightness(0) invert(1)'
54
+ filter: touched ? 'brightness(0) invert(1)' : ''
54
55
  }
55
56
  },
56
- '&:active': {
57
- backgroundColor: theme.palette.common.white
58
- },
59
57
  '&:disabled': {
60
58
  backgroundColor: theme.palette.common.white,
61
59
  color: alpha(theme.palette.primary.main, 0.3)
@@ -64,5 +62,9 @@ var ButtonStyled = styled(Button)(function (_a) {
64
62
  });
65
63
  export default function MobileButton(_a) {
66
64
  var children = _a.children, isAr = _a.isAr, hideIcon = _a.hideIcon, disabled = _a.disabled, props = __rest(_a, ["children", "isAr", "hideIcon", "disabled"]);
67
- return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.MOBILE_ICON }) }, props, { children: children })) }));
65
+ var _b = React.useState(false), touched = _b[0], setTouched = _b[1];
66
+ var handleTouch = function () {
67
+ setTouched(true);
68
+ };
69
+ return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ onTouchStart: handleTouch, touched: touched, disabled: disabled, type: 'button', startIcon: !hideIcon && _jsx(IconStyled, { disabled: disabled, src: ICONS_NAMES.MOBILE_ICON }) }, props, { children: children })) }));
68
70
  }
@@ -9,6 +9,7 @@ export declare const getIndividualName: (name: string) => {
9
9
  export declare const convertNumbers2English: (str: string) => string;
10
10
  export declare const getParameterByName: (name: string) => string | null;
11
11
  export declare const getClientEmailUrl: () => string;
12
+ export declare const getFlowUrl: (path: string) => string;
12
13
  export declare const capitalizeTheFirstLetterOfEachWord: (words: string) => string;
13
14
  export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
14
15
  al: string;
@@ -49,6 +49,10 @@ export var getClientEmailUrl = function () {
49
49
  var origin = window.location.origin;
50
50
  return origin + '/?token=';
51
51
  };
52
+ export var getFlowUrl = function (path) {
53
+ var origin = window.location.origin;
54
+ return origin + path + '?token=';
55
+ };
52
56
  export var capitalizeTheFirstLetterOfEachWord = function (words) {
53
57
  var separateWord = words.toLowerCase().split(' ');
54
58
  for (var i = 0; i < separateWord.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.62",
3
+ "version": "1.0.66",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",