@tap-payments/auth-jsconnect 2.0.71-test → 2.0.72-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,8 +90,11 @@ export interface License {
90
90
  type: string;
91
91
  }
92
92
  export interface Activity {
93
- ar: string;
94
- en: string;
93
+ id: string;
94
+ name: {
95
+ ar: string;
96
+ en: string;
97
+ };
95
98
  }
96
99
  export interface SalesChannel {
97
100
  id: string;
@@ -32,6 +32,10 @@ export declare type BrandFormValues = {
32
32
  website: string;
33
33
  twitter: string;
34
34
  instagram: string;
35
+ apple_store: string;
36
+ play_store: string;
37
+ call_center: string;
38
+ physical_store: string;
35
39
  };
36
40
  termAndConditionChecked: boolean;
37
41
  selectedBrandItem: BrandInfo;
@@ -43,7 +47,6 @@ export declare type BusinessTypeFormValues = {
43
47
  };
44
48
  export declare type ActivitiesFormValues = {
45
49
  activities: Array<Activity> | undefined;
46
- salesChannels: Array<SalesChannel>;
47
50
  operationStartDate: string;
48
51
  };
49
52
  export declare type CustomersFormValues = {
@@ -1,7 +1,8 @@
1
- import { BrandListBody, UpdateBrandBody } from '../api/individual';
1
+ import { BrandListBody, UpdateBrandBody, UpdateSalesChannels } from '../api/individual';
2
2
  declare const brandService: {
3
3
  retrieveBrand: (id: string) => Promise<any>;
4
4
  getBrandList: (data: BrandListBody) => Promise<any>;
5
5
  updateBrandInfo: ({ id, ...data }: UpdateBrandBody) => Promise<any>;
6
+ updateBrandSales: ({ id, ...data }: UpdateSalesChannels) => void;
6
7
  };
7
8
  export { brandService };
@@ -32,9 +32,18 @@ var updateBrandInfo = function (_a) {
32
32
  data: data
33
33
  });
34
34
  };
35
+ var updateBrandSales = function (_a) {
36
+ var id = _a.id, data = __rest(_a, ["id"]);
37
+ httpClient({
38
+ method: 'put',
39
+ url: "".concat(ENDPOINT_PATHS.BRAND_SALES_CHANNELS, "/").concat(id),
40
+ data: data
41
+ });
42
+ };
35
43
  var brandService = {
36
44
  retrieveBrand: retrieveBrand,
37
45
  getBrandList: getBrandList,
38
- updateBrandInfo: updateBrandInfo
46
+ updateBrandInfo: updateBrandInfo,
47
+ updateBrandSales: updateBrandSales
39
48
  };
40
49
  export { brandService };
@@ -1,3 +1,4 @@
1
+ import { AxiosRequestConfig } from 'axios';
1
2
  declare type GetOccupationBody = {
2
3
  page: number;
3
4
  };
@@ -32,5 +33,6 @@ declare const dataService: {
32
33
  getSourceOfIncome: (data: GetSourceOfIncomeBody) => Promise<any>;
33
34
  getMonthlyIncome: (data: GetMonthlyIncomeBody) => Promise<any>;
34
35
  getOccupation: (data: GetOccupationBody) => Promise<any>;
36
+ getActivities: (config?: AxiosRequestConfig) => Promise<any>;
35
37
  };
36
38
  export { dataService };
package/build/api/data.js CHANGED
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { httpClient } from './axios';
2
13
  import { ENDPOINT_PATHS } from '../constants';
3
14
  var getChannelsOfServices = function (data) {
@@ -49,6 +60,9 @@ var getOccupation = function (data) {
49
60
  data: data
50
61
  });
51
62
  };
63
+ var getActivities = function (config) {
64
+ return httpClient(__assign({ method: 'post', url: "".concat(ENDPOINT_PATHS.RETRIEVE_ACTIVITIES_LIST_PATH) }, config));
65
+ };
52
66
  var dataService = {
53
67
  getChannelsOfServices: getChannelsOfServices,
54
68
  getCustomerBases: getCustomerBases,
@@ -56,6 +70,7 @@ var dataService = {
56
70
  getExpectedCustomerSales: getExpectedCustomerSales,
57
71
  getSourceOfIncome: getSourceOfIncome,
58
72
  getMonthlyIncome: getMonthlyIncome,
59
- getOccupation: getOccupation
73
+ getOccupation: getOccupation,
74
+ getActivities: getActivities
60
75
  };
61
76
  export { dataService };
@@ -2,7 +2,9 @@ import { AxiosRequestConfig } from 'axios';
2
2
  export declare type EntityInfoBody = {
3
3
  id: string;
4
4
  lead_id?: string;
5
- activities?: Array<string>;
5
+ activities?: Array<{
6
+ id: string;
7
+ }>;
6
8
  license_name?: string;
7
9
  license_number?: string;
8
10
  business_operation_start_at?: string;
@@ -77,6 +77,7 @@ declare const API: {
77
77
  getOccupation: (data: {
78
78
  page: number;
79
79
  }) => Promise<any>;
80
+ getActivities: (config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<any>;
80
81
  };
81
82
  individualService: {
82
83
  retrieveIndividualInfo: (id: string) => Promise<any>;
@@ -95,6 +96,7 @@ declare const API: {
95
96
  retrieveBrand: (id: string) => Promise<any>;
96
97
  getBrandList: (data: BrandListBody) => Promise<any>;
97
98
  updateBrandInfo: ({ id, ...data }: UpdateBrandBody) => Promise<any>;
99
+ updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
98
100
  };
99
101
  };
100
102
  export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody };
@@ -3,29 +3,58 @@ export declare type BrandListBody = {
3
3
  };
4
4
  export declare type UpdateBrandBody = {
5
5
  id: string;
6
- brand: {
7
- activities?: Array<string>;
8
- business_operation_start_at?: string;
9
- channel_services?: Array<string>;
10
- physical_store_available?: boolean;
11
- monthly_sales_range?: string;
12
- customers_served_monthly?: string;
13
- customers_base?: Array<string>;
14
- vat_id?: string;
15
- agree_chargeback?: boolean;
16
- agree_refund?: boolean;
17
- employer_name?: string;
18
- employer_country?: string | null;
19
- source_income?: Array<string | undefined>;
20
- actual_income?: string;
21
- is_relative_PEP?: boolean | null;
22
- is_influencer?: boolean | null;
23
- is_vat_acknowledged?: boolean;
24
- occupation?: string;
6
+ name?: {
7
+ en: string;
8
+ ar: string;
9
+ };
10
+ sectors?: Array<{
11
+ id: string;
12
+ }>;
13
+ website?: string;
14
+ social?: Array<string>;
15
+ logo?: string;
16
+ content?: {
17
+ tag_line?: {
18
+ en: string;
19
+ ar: string;
20
+ zh: string;
21
+ };
22
+ about?: {
23
+ en: string;
24
+ ar: string;
25
+ zh: string;
26
+ };
27
+ };
28
+ activities?: Array<{
29
+ id: string;
30
+ }>;
31
+ channel_services?: Array<{
32
+ id: string;
33
+ address: string;
34
+ }>;
35
+ operations?: {
36
+ start_date?: string;
37
+ sales?: {
38
+ id: string;
39
+ period: string;
40
+ currency: string;
41
+ };
42
+ customer_base?: {
43
+ id: string;
44
+ period: string;
45
+ locations: Array<string>;
46
+ };
25
47
  };
26
48
  step_name: string;
27
49
  encryption_contract?: Array<string>;
28
50
  };
51
+ export declare type UpdateSalesChannels = {
52
+ id?: string;
53
+ channel_services: Array<{
54
+ id: string;
55
+ address: string;
56
+ }>;
57
+ };
29
58
  declare const individualService: {
30
59
  retrieveIndividualInfo: (id: string) => Promise<any>;
31
60
  };
@@ -31,5 +31,7 @@ export declare const ENDPOINT_PATHS: {
31
31
  BOARD: string;
32
32
  TOKEN_VERIFY: string;
33
33
  BRAND: string;
34
+ BRAND_SALES_CHANNELS: string;
34
35
  VERIFY_AUTH_OTP: string;
36
+ RETRIEVE_ACTIVITIES_LIST_PATH: string;
35
37
  };
@@ -8,6 +8,7 @@ var OPERATOR_PATH = '/operator';
8
8
  var AUTH_PATH = '/auth';
9
9
  var LEAD_PATH = '/lead';
10
10
  var RETRIEVE_ENTITY_LIST_PATH = '/lead/entity/list';
11
+ var RETRIEVE_ACTIVITIES_LIST_PATH = '/entity/activities/list';
11
12
  var ENTITY_PATH = '/entity';
12
13
  var INDIVIDUAL_PATH = '/individual';
13
14
  var BANK_PATH = '/bankaccount';
@@ -25,6 +26,7 @@ var MONTHLY_INCOME_PATH = '/v2/monthlyIncome';
25
26
  var OCCUPATION_PATH = '/v2/occupation';
26
27
  var BRAND_PATH = '/brand';
27
28
  var BRAND_LIST_PATH = "".concat(BRAND_PATH, "/list");
29
+ var BRAND_SALES_CHANNELS = "".concat(BRAND_PATH, "/channel/services");
28
30
  var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/locale.json';
29
31
  var FILES = '/files';
30
32
  var TOKEN_VERIFY_PATH = '/token/verify';
@@ -65,5 +67,7 @@ export var ENDPOINT_PATHS = {
65
67
  BOARD: BOARD_PATH,
66
68
  TOKEN_VERIFY: TOKEN_VERIFY_PATH,
67
69
  BRAND: BRAND_PATH,
68
- VERIFY_AUTH_OTP: VERIFY_AUTH_OTP_PATH
70
+ BRAND_SALES_CHANNELS: BRAND_SALES_CHANNELS,
71
+ VERIFY_AUTH_OTP: VERIFY_AUTH_OTP_PATH,
72
+ RETRIEVE_ACTIVITIES_LIST_PATH: RETRIEVE_ACTIVITIES_LIST_PATH
69
73
  };
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, SalesChannel, CivilFormValues } from '../../../@types';
2
+ import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes, Activity, CivilFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
5
  leadData: any;
@@ -53,7 +53,6 @@ export declare const updateActivitiesInfo: import("@reduxjs/toolkit").AsyncThunk
53
53
  data: any;
54
54
  formData: {
55
55
  activities: Activity[] | undefined;
56
- salesChannels: SalesChannel[];
57
56
  operationStartDate: string;
58
57
  };
59
58
  }, ActivitiesFormValues, {}>;
@@ -63,7 +63,7 @@ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_
63
63
  import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
66
+ var payload, data, leadResponse, brandInfo, boardResponse, entity_activities, data_1, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
67
  var _a, _b, _c, _d, _e, _f, _g;
68
68
  return __generator(this, function (_h) {
69
69
  switch (_h.label) {
@@ -78,75 +78,84 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
78
78
  leadResponse = undefined;
79
79
  brandInfo = undefined;
80
80
  boardResponse = undefined;
81
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 17];
81
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 19];
82
82
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
83
83
  case 2:
84
84
  leadResponse = _h.sent();
85
+ entity_activities = leadResponse.data.entity_activities;
86
+ if (!entity_activities) return [3, 4];
87
+ return [4, API.dataService.getActivities()];
88
+ case 3:
89
+ data_1 = _h.sent();
90
+ console.log(data_1);
91
+ leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_1.list });
92
+ _h.label = 4;
93
+ case 4:
85
94
  countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
86
95
  board_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_id;
87
96
  board_info_id = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.board_info_id;
88
- if (!(!!board_id && !!board_info_id)) return [3, 4];
97
+ if (!(!!board_id && !!board_info_id)) return [3, 6];
89
98
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
90
- case 3:
99
+ case 5:
91
100
  boardResponse = _h.sent();
92
- _h.label = 4;
93
- case 4:
101
+ _h.label = 6;
102
+ case 6:
94
103
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
95
104
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
96
105
  }
97
106
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
98
107
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
99
108
  }
100
- if (!(data.step_name === 'business_info')) return [3, 17];
109
+ if (!(data.step_name === 'business_info')) return [3, 19];
101
110
  steps = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.steps;
102
111
  brandID = (_f = (_e = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _e === void 0 ? void 0 : _e.brand) === null || _f === void 0 ? void 0 : _f.id;
103
112
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
104
113
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
105
114
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
106
115
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
107
- if (!hasBusinessCompleted) return [3, 6];
116
+ if (!hasBusinessCompleted) return [3, 8];
108
117
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
109
- case 5:
118
+ case 7:
110
119
  _h.sent();
111
120
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
112
- return [3, 17];
113
- case 6:
114
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
121
+ return [3, 19];
122
+ case 8:
123
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
115
124
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
116
- return [3, 17];
117
- case 7:
118
- if (!hasBusinessCustomersCompleted) return [3, 8];
125
+ return [3, 19];
126
+ case 9:
127
+ if (!hasBusinessCustomersCompleted) return [3, 10];
119
128
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
120
- return [3, 17];
121
- case 8:
122
- if (!hasBusinessCRActivitiesCompleted) return [3, 12];
129
+ return [3, 19];
130
+ case 10:
131
+ if (!hasBusinessCRActivitiesCompleted) return [3, 14];
123
132
  return [4, thunkApi.dispatch(retrieveChannels())];
124
- case 9:
133
+ case 11:
125
134
  _h.sent();
126
135
  return [4, thunkApi.dispatch(retrieveDataList())];
127
- case 10:
136
+ case 12:
128
137
  _h.sent();
129
138
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
130
139
  return [4, API.brandService.retrieveBrand(brandID)];
131
- case 11:
140
+ case 13:
132
141
  brandInfo = _h.sent();
133
- return [3, 17];
134
- case 12:
135
- if (!hasBusinessCRInfoCompleted) return [3, 15];
142
+ return [3, 19];
143
+ case 14:
144
+ if (!hasBusinessCRInfoCompleted) return [3, 17];
136
145
  return [4, thunkApi.dispatch(retrieveChannels())];
137
- case 13:
146
+ case 15:
138
147
  _h.sent();
139
148
  return [4, API.brandService.retrieveBrand(brandID)];
140
- case 14:
149
+ case 16:
141
150
  brandInfo = _h.sent();
142
151
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
143
- return [3, 17];
144
- case 15: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
145
- case 16:
152
+ return [3, 19];
153
+ case 17: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
154
+ case 18:
146
155
  _h.sent();
147
156
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
148
- _h.label = 17;
149
- case 17: return [2, {
157
+ _h.label = 19;
158
+ case 19: return [2, {
150
159
  data: data,
151
160
  leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: BUSINESS_FLOW_SUCCESS.concat(boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) }),
152
161
  token: token,
@@ -424,7 +433,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
424
433
  });
425
434
  }); });
426
435
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
427
- var _a, settings, business, payload, data, accountBody, accountData;
436
+ var _a, settings, business, payload, data, entity_activities, list, accountBody, accountData;
428
437
  var _b, _c, _d, _e, _f, _g;
429
438
  return __generator(this, function (_h) {
430
439
  switch (_h.label) {
@@ -442,6 +451,14 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
442
451
  return [4, API.leadService.updateLead(payload)];
443
452
  case 1:
444
453
  data = _h.sent();
454
+ entity_activities = data.entity_activities;
455
+ if (!entity_activities) return [3, 3];
456
+ return [4, API.dataService.getActivities()];
457
+ case 2:
458
+ list = (_h.sent()).list;
459
+ data.entity_activities = list;
460
+ _h.label = 3;
461
+ case 3:
445
462
  accountBody = {
446
463
  lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.id,
447
464
  notify: {
@@ -453,10 +470,10 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
453
470
  step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
454
471
  };
455
472
  return [4, API.accountService.createAccount(accountBody)];
456
- case 2:
473
+ case 4:
457
474
  accountData = _h.sent();
458
475
  return [4, thunkApi.dispatch(retrieveChannels())];
459
- case 3:
476
+ case 5:
460
477
  _h.sent();
461
478
  thunkApi.dispatch(handleNextScreenStep());
462
479
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
@@ -465,31 +482,26 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
465
482
  });
466
483
  }); });
467
484
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
468
- var _a, settings, business, channel, activities, stepName, id, requestBody, data;
485
+ var _a, settings, business, activities, stepName, id, requestBody, data;
469
486
  var _b, _c, _d, _e, _f;
470
487
  return __generator(this, function (_g) {
471
488
  switch (_g.label) {
472
489
  case 0:
473
490
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
474
- channel = params.salesChannels.map(function (_a) {
475
- var id = _a.id;
476
- return id;
477
- });
478
491
  activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
479
- var en = _a.en;
480
- return en;
492
+ var id = _a.id;
493
+ return ({ id: id });
481
494
  });
482
495
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
483
496
  id = (_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
484
497
  requestBody = {
485
498
  id: id,
486
- brand: {
487
- activities: activities,
488
- channel_services: channel,
489
- business_operation_start_at: params.operationStartDate
499
+ activities: activities,
500
+ operations: {
501
+ start_date: params.operationStartDate
490
502
  },
491
503
  step_name: stepName,
492
- encryption_contract: ['brand.business_operation_start_at']
504
+ encryption_contract: ['operations.start_date']
493
505
  };
494
506
  return [4, API.brandService.updateBrandInfo(requestBody)];
495
507
  case 1:
@@ -645,7 +657,6 @@ var initialState = {
645
657
  },
646
658
  activitiesData: {
647
659
  activities: [],
648
- salesChannels: [],
649
660
  operationStartDate: new Date().toString()
650
661
  },
651
662
  customersData: {
@@ -678,10 +689,10 @@ export var businessSlice = createSlice({
678
689
  state.customLoading = true;
679
690
  })
680
691
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
681
- var _a, _b, _c, _d, _e, _f;
692
+ var _a, _b, _c, _d;
682
693
  state.error = null;
683
694
  state.customLoading = false;
684
- var _g = action.payload, data = _g.data, token = _g.token, leadData = _g.leadData, brandInfo = _g.brandInfo, boardId = _g.boardId;
695
+ var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
685
696
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
686
697
  if (description) {
687
698
  state.error = description;
@@ -690,7 +701,7 @@ export var businessSlice = createSlice({
690
701
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
691
702
  state.data.verify.token = token;
692
703
  state.data.otpData.isNID = false;
693
- var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
704
+ var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
694
705
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
695
706
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
696
707
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -698,42 +709,21 @@ export var businessSlice = createSlice({
698
709
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
699
710
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
700
711
  }
701
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
702
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
703
- var _j = brand || {}, website = _j.website, social = _j.social;
704
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
705
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
706
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
707
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
708
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
709
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
710
- selectedChannels = [websiteData, socialData];
711
- else if (isHasTwitter || isHasInstagram)
712
- selectedChannels = [socialData];
713
- else if (isHasWebsite)
714
- selectedChannels = [websiteData];
715
- if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
716
- selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
717
- var _a;
718
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.id === storedChannel; });
719
- });
720
- }
721
- state.data.activitiesData.salesChannels = selectedChannels;
722
712
  var activities = entity_activities || [];
723
713
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
724
714
  var _a;
725
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
715
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return activity.id === value.id; });
726
716
  });
727
717
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
728
718
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
729
719
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
730
- var licenseNumber_1 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
731
- var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
720
+ var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
721
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
732
722
  var licenseList = (responseBody || {}).licenseList;
733
723
  var selectedLicenseData = selectedLicense;
734
724
  if (!!licenseNumber_1) {
735
725
  selectedLicenseData =
736
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
726
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
737
727
  var license = _a.license;
738
728
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
739
729
  })) ||
@@ -770,10 +760,10 @@ export var businessSlice = createSlice({
770
760
  state.error = null;
771
761
  })
772
762
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
773
- var _a, _b, _c, _d, _e, _f;
763
+ var _a, _b, _c, _d;
774
764
  state.loading = false;
775
765
  state.error = null;
776
- var _g = action.payload, data = _g.data, formData = _g.formData, brandInfo = _g.brandInfo;
766
+ var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo;
777
767
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
778
768
  if (description) {
779
769
  state.error = description;
@@ -781,7 +771,7 @@ export var businessSlice = createSlice({
781
771
  }
782
772
  state.data.otpData = formData;
783
773
  state.data.otpData.responseBody = data;
784
- var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_type = _h.business_type, brand = _h.brand;
774
+ var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
785
775
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
786
776
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
787
777
  : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
@@ -789,42 +779,21 @@ export var businessSlice = createSlice({
789
779
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
790
780
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
791
781
  }
792
- var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
793
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
794
- var _j = brand || {}, website = _j.website, social = _j.social;
795
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
796
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
797
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
798
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
799
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
800
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
801
- selectedChannels = [websiteData, socialData];
802
- else if (isHasTwitter || isHasInstagram)
803
- selectedChannels = [socialData];
804
- else if (isHasWebsite)
805
- selectedChannels = [websiteData];
806
- if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
807
- selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
808
- var _a;
809
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name.en.toLowerCase() === storedChannel.toLowerCase(); });
810
- });
811
- }
812
- state.data.activitiesData.salesChannels = selectedChannels;
813
782
  var activities = entity_activities || [];
814
783
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
815
784
  var _a;
816
- return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { var _a; return ((_a = activity.en) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === value.toLowerCase(); });
785
+ return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
817
786
  });
818
787
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
819
788
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
820
789
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
821
- var licenseNumber_2 = (_e = entity === null || entity === void 0 ? void 0 : entity.license) === null || _e === void 0 ? void 0 : _e.number;
822
- var _k = state.data.businessTypeData || {}, responseBody = _k.responseBody, selectedLicense = _k.selectedLicense;
790
+ var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
791
+ var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
823
792
  var licenseList = (responseBody || {}).licenseList;
824
793
  var selectedLicenseData = selectedLicense;
825
794
  if (!!licenseNumber_2) {
826
795
  selectedLicenseData =
827
- ((_f = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _f === void 0 ? void 0 : _f.call(licenseList, function (_a) {
796
+ ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
828
797
  var license = _a.license;
829
798
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
830
799
  })) ||
@@ -984,21 +953,6 @@ export var businessSlice = createSlice({
984
953
  }
985
954
  var channels = data.list || [];
986
955
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
987
- var brand = (state.data.verify.responseBody || {}).brand;
988
- var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
989
- var _b = brand || {}, website = _b.website, social = _b.social;
990
- var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
991
- var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
992
- var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
993
- var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
994
- var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
995
- if (isHasWebsite && (isHasTwitter || isHasInstagram))
996
- selectedChannels = [websiteData, socialData];
997
- else if (isHasTwitter || isHasInstagram)
998
- selectedChannels = [socialData];
999
- else if (isHasWebsite)
1000
- selectedChannels = [websiteData];
1001
- state.data.activitiesData.salesChannels = selectedChannels;
1002
956
  })
1003
957
  .addCase(retrieveChannels.rejected, function (state, action) {
1004
958
  state.error = action.error.message;