@tap-payments/auth-jsconnect 2.4.10-test → 2.4.12-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.
@@ -32,6 +32,7 @@ export declare type EntityInfoBody = {
32
32
  };
33
33
  step_name: string;
34
34
  encryption_contract?: Array<string>;
35
+ vat_acknowledged_by?: string;
35
36
  };
36
37
  export declare type BankDocumentInfo = {
37
38
  type?: string;
@@ -43,6 +44,7 @@ export declare type BankDocumentInfo = {
43
44
  };
44
45
  export declare type EntityBankUpdateBody = {
45
46
  wallet_id: string;
47
+ acknowledged_by: string;
46
48
  bank_account: {
47
49
  bank_name?: string;
48
50
  beneficiary_name?: string;
@@ -63,6 +63,7 @@ export declare type UpdateBrandBody = {
63
63
  term?: Array<string>;
64
64
  step_name?: string;
65
65
  encryption_contract?: Array<string>;
66
+ term_by?: string;
66
67
  };
67
68
  export declare type UpdateSalesChannels = {
68
69
  id?: string;
@@ -17,6 +17,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
17
  contact: any;
18
18
  business: any;
19
19
  individuals: any;
20
+ notification: any;
20
21
  };
21
22
  token: string;
22
23
  }, VerifyLeadTokenProps, {}>;
@@ -55,10 +55,10 @@ import { hasNoneEditableValue, isStringHasOneAsterisk, sleep } from '../../../ut
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, boardData, board_id, countryIso2;
59
- var _b, _c, _d;
60
- return __generator(this, function (_e) {
61
- switch (_e.label) {
58
+ var payload, data, boardData, boardInfoData, _b, board_id, board_info_id, countryIso2;
59
+ var _c, _d, _e, _f;
60
+ return __generator(this, function (_g) {
61
+ switch (_g.label) {
62
62
  case 0:
63
63
  payload = {
64
64
  service_name: 'tap_email',
@@ -66,17 +66,23 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
66
66
  };
67
67
  return [4, API.leadService.verifyLeadToken(payload)];
68
68
  case 1:
69
- data = (_e.sent()).data;
70
- boardData = undefined;
71
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 4];
72
- board_id = data === null || data === void 0 ? void 0 : data.id;
73
- if (!board_id) return [3, 3];
74
- return [4, API.boardService.retrieveBoardDetails(board_id)];
69
+ data = (_g.sent()).data;
70
+ boardInfoData = undefined;
71
+ if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
72
+ throw new Error(data.errors[0].description);
73
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
74
+ if (!board_id) return [3, 5];
75
+ if (!board_info_id) return [3, 3];
76
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
75
77
  case 2:
76
- boardData = _e.sent();
77
- _e.label = 3;
78
- case 3:
79
- countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
78
+ boardInfoData = _g.sent();
79
+ _g.label = 3;
80
+ case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
81
+ case 4:
82
+ boardData = _g.sent();
83
+ _g.label = 5;
84
+ case 5:
85
+ countryIso2 = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
80
86
  if (countryIso2)
81
87
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
82
88
  if (isInternally)
@@ -87,22 +93,22 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
87
93
  else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
88
94
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
89
95
  }
90
- _e.label = 4;
91
- case 4: return [2, {
92
- data: data,
93
- boardResponse: {
94
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
95
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
96
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
97
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
98
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
99
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
100
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
101
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
102
- individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals
103
- },
104
- token: token
105
- }];
96
+ return [2, {
97
+ data: data,
98
+ boardResponse: {
99
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
100
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
101
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
102
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
103
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
104
+ name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names,
105
+ contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact,
106
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
107
+ individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
108
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
109
+ },
110
+ token: token
111
+ }];
106
112
  }
107
113
  });
108
114
  });
@@ -182,14 +188,15 @@ export var retrieveBoardDetails = createAsyncThunk('bank/retrieveBoardDetails',
182
188
  export var createBankAccount = createAsyncThunk('createBankAccount', function (_a, thunkApi) {
183
189
  var formData = _a.formData, originalFormData = _a.originalFormData;
184
190
  return __awaiter(void 0, void 0, void 0, function () {
185
- var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
186
- var _d, _e, _f, _g, _h, _j, _k, _l, _m;
187
- return __generator(this, function (_o) {
188
- switch (_o.label) {
191
+ var _b, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, _c, bank_account, notification, _d, data_status, document, isIBANMasked, isIBANNonEditable, isBeneficiaryNameNonEditable, isBankNameNonEditable, isBankStatementIdNonEditable, isConfirmPolicyNonEditable, documentResponse, hasDocument, documentId, requestBody, data, documentBody;
192
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o;
193
+ return __generator(this, function (_p) {
194
+ switch (_p.label) {
189
195
  case 0:
190
196
  _b = thunkApi.getState(), settings = _b.settings, bank = _b.bank;
191
197
  iban = formData.iban, beneficiaryName = formData.beneficiaryName, bankName = formData.bankName, bankStatementId = formData.bankStatementId, confirmPolicy = formData.confirmPolicy;
192
- _c = ((_d = bank.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.bank_account) || {}, data_status = _c.data_status, document = _c.document;
198
+ _c = bank.data.verify.responseBody || {}, bank_account = _c.bank_account, notification = _c.notification;
199
+ _d = bank_account || {}, data_status = _d.data_status, document = _d.document;
193
200
  isIBANMasked = isStringHasOneAsterisk(iban);
194
201
  isIBANNonEditable = hasNoneEditableValue(data_status, 'iban');
195
202
  isBeneficiaryNameNonEditable = hasNoneEditableValue(data_status, 'beneficiary_name');
@@ -201,6 +208,7 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
201
208
  documentId = document === null || document === void 0 ? void 0 : document.id;
202
209
  requestBody = {
203
210
  wallet_id: (_j = (_h = (_g = (_f = (_e = bank.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.business) === null || _f === void 0 ? void 0 : _f.entity) === null || _g === void 0 ? void 0 : _g.merchant) === null || _h === void 0 ? void 0 : _h.wallet) === null || _j === void 0 ? void 0 : _j.id,
211
+ acknowledged_by: (_k = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _k === void 0 ? void 0 : _k.id,
204
212
  bank_account: __assign({ iban: isIBANNonEditable || isIBANMasked ? undefined : iban, beneficiary_name: isBeneficiaryNameNonEditable ? undefined : beneficiaryName, bank_name: isBankNameNonEditable ? undefined : bankName, is_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy }, (!(isBankStatementIdNonEditable || documentId || !hasDocument) && {
205
213
  document: {
206
214
  type: DocumentPurpose.BANK_STATEMENT,
@@ -212,8 +220,8 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
212
220
  };
213
221
  return [4, API.entityService.createBankAccount(requestBody)];
214
222
  case 1:
215
- data = (_o.sent()).data;
216
- if ((_k = data.errors) === null || _k === void 0 ? void 0 : _k.length)
223
+ data = (_p.sent()).data;
224
+ if ((_l = data.errors) === null || _l === void 0 ? void 0 : _l.length)
217
225
  throw new Error(data.errors[0].description);
218
226
  if (!(!isBankStatementIdNonEditable && documentId && hasDocument)) return [3, 3];
219
227
  documentBody = {
@@ -222,12 +230,12 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
222
230
  };
223
231
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
224
232
  case 2:
225
- documentResponse = _o.sent();
226
- _o.label = 3;
233
+ documentResponse = _p.sent();
234
+ _p.label = 3;
227
235
  case 3:
228
236
  data.documentData = documentResponse;
229
237
  thunkApi.dispatch(handleNextScreenStep());
230
- (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, requestBody);
238
+ (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, requestBody);
231
239
  return [2, { data: data, formData: originalFormData }];
232
240
  }
233
241
  });
@@ -17,6 +17,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
17
  contact: any;
18
18
  individuals: any;
19
19
  business: any;
20
+ notification: any;
20
21
  };
21
22
  salesChannels: any;
22
23
  segmentsList: any;
@@ -38,6 +39,7 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
38
39
  contact: any;
39
40
  individuals: any;
40
41
  business: any;
42
+ notification: any;
41
43
  };
42
44
  salesChannels: any;
43
45
  segmentsList: any;
@@ -66,10 +66,10 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, slee
66
66
  export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
69
- var payload, data, countryIso2, board_id, segmentsList, salesChannels, teamSizeList, boardData;
70
- var _b, _c, _d;
71
- return __generator(this, function (_e) {
72
- switch (_e.label) {
69
+ var payload, data, countryIso2, _b, board_id, board_info_id, segmentsList, salesChannels, teamSizeList, boardData, boardInfoData;
70
+ var _c, _d, _e;
71
+ return __generator(this, function (_f) {
72
+ switch (_f.label) {
73
73
  case 0:
74
74
  payload = {
75
75
  service_name: 'tap_email',
@@ -77,41 +77,46 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
77
77
  };
78
78
  return [4, API.leadService.verifyLeadToken(payload)];
79
79
  case 1:
80
- data = (_e.sent()).data;
80
+ data = (_f.sent()).data;
81
81
  if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
82
82
  throw new Error(data.errors[0].description);
83
83
  }
84
84
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
85
85
  if (countryIso2)
86
86
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
87
- board_id = data === null || data === void 0 ? void 0 : data.id;
87
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
88
88
  if (!board_id) {
89
89
  throw new Error('Internal server error');
90
90
  }
91
- boardData = undefined;
91
+ boardInfoData = undefined;
92
92
  if (isInternally)
93
93
  data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
94
- if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 6];
95
- return [4, API.boardService.retrieveBoardDetails(board_id)];
94
+ if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 8];
95
+ if (!board_info_id) return [3, 3];
96
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
96
97
  case 2:
97
- boardData = _e.sent();
98
+ boardInfoData = _f.sent();
99
+ _f.label = 3;
100
+ case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
101
+ case 4:
102
+ boardData = _f.sent();
98
103
  if (!countryIso2) {
99
- countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
104
+ countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
100
105
  if (countryIso2)
101
106
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
102
107
  }
103
108
  return [4, API.dataService.getSegments({ page: 0 })];
104
- case 3:
105
- segmentsList = _e.sent();
109
+ case 5:
110
+ segmentsList = _f.sent();
106
111
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
107
- case 4:
108
- salesChannels = _e.sent();
112
+ case 6:
113
+ salesChannels = _f.sent();
109
114
  return [4, API.dataService.getTeamSize({ page: 0 })];
110
- case 5:
111
- teamSizeList = _e.sent();
115
+ case 7:
116
+ teamSizeList = _f.sent();
112
117
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
113
- _e.label = 6;
114
- case 6: return [2, {
118
+ _f.label = 8;
119
+ case 8: return [2, {
115
120
  data: data,
116
121
  boardResponse: {
117
122
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
@@ -119,10 +124,11 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
119
124
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
120
125
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
121
126
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
122
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
123
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
127
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
128
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
124
129
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
125
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business
130
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
131
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
126
132
  },
127
133
  salesChannels: salesChannels,
128
134
  segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
@@ -151,42 +157,48 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
151
157
  });
152
158
  }); });
153
159
  export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
154
- var _a, brand, settings, responseBody, payload, data, board_id, boardData, segmentsList, salesChannels, teamSizeList;
155
- var _b, _c, _d, _e, _f, _g;
156
- return __generator(this, function (_h) {
157
- switch (_h.label) {
160
+ var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, boardData, segmentsList, salesChannels, teamSizeList;
161
+ var _c, _d, _e, _f, _g, _h;
162
+ return __generator(this, function (_j) {
163
+ switch (_j.label) {
158
164
  case 0:
159
165
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
160
166
  responseBody = brand.data.verify.responseBody;
161
167
  payload = {
162
168
  data: params.otp,
163
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
169
+ service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
164
170
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
165
171
  step_name: BRAND_STEP_NAMES.PHONE_AUTH,
166
172
  encryption_contract: ['data']
167
173
  };
168
174
  return [4, API.leadService.verifyLeadOTP(payload)];
169
175
  case 1:
170
- data = (_h.sent()).data;
171
- if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
176
+ data = (_j.sent()).data;
177
+ if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
172
178
  throw new Error(data.errors[0].description);
173
- board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
179
+ _b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
174
180
  if (!board_id) {
175
181
  throw new Error('Internal server error');
176
182
  }
177
- return [4, API.boardService.retrieveBoardDetails(board_id)];
183
+ boardInfoData = undefined;
184
+ if (!board_info_id) return [3, 3];
185
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
178
186
  case 2:
179
- boardData = _h.sent();
180
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
187
+ boardInfoData = _j.sent();
188
+ _j.label = 3;
189
+ case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
190
+ case 4:
191
+ boardData = _j.sent();
192
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
181
193
  return [4, API.dataService.getSegments({ page: 0 })];
182
- case 3:
183
- segmentsList = _h.sent();
194
+ case 5:
195
+ segmentsList = _j.sent();
184
196
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
185
- case 4:
186
- salesChannels = _h.sent();
197
+ case 6:
198
+ salesChannels = _j.sent();
187
199
  return [4, API.dataService.getTeamSize({ page: 0 })];
188
- case 5:
189
- teamSizeList = _h.sent();
200
+ case 7:
201
+ teamSizeList = _j.sent();
190
202
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
191
203
  return [2, {
192
204
  data: data,
@@ -196,10 +208,11 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
196
208
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
197
209
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
198
210
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
199
- name: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.names,
200
- contact: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.contact,
211
+ name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
212
+ contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
201
213
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
202
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business
214
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
215
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
203
216
  },
204
217
  salesChannels: salesChannels,
205
218
  segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
@@ -266,13 +279,14 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
266
279
  export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
267
280
  var formData = _a.formData, originalFormData = _a.originalFormData;
268
281
  return __awaiter(void 0, void 0, void 0, function () {
269
- var _b, settings, brand, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, activities, activityList;
270
- var _d, _e, _f, _g;
271
- return __generator(this, function (_h) {
272
- switch (_h.label) {
282
+ var _b, settings, brand, _c, brandRes, notification, _d, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, activities, activityList;
283
+ var _e, _f, _g, _h;
284
+ return __generator(this, function (_j) {
285
+ switch (_j.label) {
273
286
  case 0:
274
287
  _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
275
- _c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, id = _c.id, data_status = _c.data_status;
288
+ _c = brand.data.verify.responseBody || {}, brandRes = _c.brand, notification = _c.notification;
289
+ _d = brandRes || {}, id = _d.id, data_status = _d.data_status;
276
290
  isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
277
291
  isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
278
292
  isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
@@ -306,26 +320,26 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
306
320
  en: !isNameENNonEditable ? brandName : undefined,
307
321
  ar: !isNameARNonEditable ? brandName : undefined
308
322
  }
309
- })), { logo: brandLogoId, segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId }, channel_services: channel_services });
323
+ })), { logo: brandLogoId, term_by: (_e = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _e === void 0 ? void 0 : _e.id, segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId }, channel_services: channel_services });
310
324
  return [4, API.brandService.updateBrandInfo(requestBody)];
311
325
  case 1:
312
- brandData = (_h.sent()).brand;
313
- activities = (((_e = brand.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.entity) || {}).activities;
326
+ brandData = (_j.sent()).brand;
327
+ activities = (((_f = brand.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.entity) || {}).activities;
314
328
  return [4, thunkApi.dispatch(retrieveDataList())];
315
329
  case 2:
316
- _h.sent();
330
+ _j.sent();
317
331
  if (activities) {
318
332
  brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
319
333
  }
320
334
  if (!!activities) return [3, 4];
321
335
  return [4, API.dataService.getActivities()];
322
336
  case 3:
323
- activityList = (_h.sent()).list;
337
+ activityList = (_j.sent()).list;
324
338
  brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
325
- _h.label = 4;
339
+ _j.label = 4;
326
340
  case 4:
327
341
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
328
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
342
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
329
343
  return [2, { data: __assign({}, brandData), formData: originalFormData }];
330
344
  }
331
345
  });
@@ -55,7 +55,7 @@ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, sleep } from '..
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, boardData, countryIso2;
58
+ var payload, data, boardData, boardInfoData, countryIso2;
59
59
  var _b, _c, _d;
60
60
  return __generator(this, function (_e) {
61
61
  switch (_e.label) {
@@ -67,17 +67,22 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
67
67
  return [4, API.leadService.verifyLeadToken(payload)];
68
68
  case 1:
69
69
  data = (_e.sent()).data;
70
- boardData = undefined;
70
+ boardInfoData = undefined;
71
71
  if (((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
72
72
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
73
  if (isInternally)
74
74
  data.step_name = TAX_STEP_NAMES.TAX_INFO;
75
- if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 3];
76
- return [4, API.boardService.retrieveBoardDetails(data.id)];
75
+ if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 5];
76
+ if (!data.board_info_id) return [3, 3];
77
+ return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
77
78
  case 2:
78
- boardData = _e.sent();
79
+ boardInfoData = _e.sent();
79
80
  _e.label = 3;
80
- case 3:
81
+ case 3: return [4, API.boardService.retrieveBoardDetails(data.id)];
82
+ case 4:
83
+ boardData = _e.sent();
84
+ _e.label = 5;
85
+ case 5:
81
86
  countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
82
87
  if (countryIso2)
83
88
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
@@ -89,7 +94,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
89
94
  }
90
95
  return [2, {
91
96
  data: data,
92
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
97
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
93
98
  token: token
94
99
  }];
95
100
  }
@@ -168,13 +173,14 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
168
173
  export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunkApi) {
169
174
  var formData = _a.formData, originalFormData = _a.originalFormData;
170
175
  return __awaiter(void 0, void 0, void 0, function () {
171
- var _b, settings, tax, _c, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody, _d, documentBody, _e;
172
- var _f, _g, _h, _j;
173
- return __generator(this, function (_k) {
174
- switch (_k.label) {
176
+ var _b, settings, tax, _c, entity, notification, _d, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, vatId, confirmPolicy, documentId, requestBody, data, documentBody, _e, documentBody, _f;
177
+ var _g, _h, _j, _k;
178
+ return __generator(this, function (_l) {
179
+ switch (_l.label) {
175
180
  case 0:
176
181
  _b = thunkApi.getState(), settings = _b.settings, tax = _b.tax;
177
- _c = ((_f = tax.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.entity) || {}, id = _c.id, data_status = _c.data_status, documents = _c.documents;
182
+ _c = tax.data.verify.responseBody || {}, entity = _c.entity, notification = _c.notification;
183
+ _d = entity || {}, id = _d.id, data_status = _d.data_status, documents = _d.documents;
178
184
  isTaxNumberNonEditable = hasNoneEditableValue(data_status, 'tax_number');
179
185
  isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_vat_acknowledged');
180
186
  isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
@@ -183,13 +189,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
183
189
  requestBody = {
184
190
  id: id,
185
191
  vat_id: isTaxNumberNonEditable ? undefined : vatId,
192
+ vat_acknowledged_by: (_g = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _g === void 0 ? void 0 : _g.id,
186
193
  step_name: TAX_STEP_NAMES.TAX_INFO,
187
194
  is_vat_acknowledged: isConfirmPolicyNonEditable ? undefined : confirmPolicy
188
195
  };
189
196
  return [4, API.entityService.updateEntityInfo(requestBody)];
190
197
  case 1:
191
- data = (_k.sent()).data;
192
- if ((_g = data.errors) === null || _g === void 0 ? void 0 : _g.length)
198
+ data = (_l.sent()).data;
199
+ if ((_h = data.errors) === null || _h === void 0 ? void 0 : _h.length)
193
200
  throw new Error(data.errors[0].description);
194
201
  if (!(!isDocumentsNonEditable && (documentId || []).length > 0)) return [3, 5];
195
202
  if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
@@ -197,10 +204,10 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
197
204
  id: document === null || document === void 0 ? void 0 : document.id,
198
205
  images: documentId
199
206
  };
200
- _d = data;
207
+ _e = data;
201
208
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
202
209
  case 2:
203
- _d.documentData = _k.sent();
210
+ _e.documentData = _l.sent();
204
211
  return [3, 5];
205
212
  case 3:
206
213
  documentBody = {
@@ -212,14 +219,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
212
219
  }
213
220
  ]
214
221
  };
215
- _e = data;
222
+ _f = data;
216
223
  return [4, API.documentService.updateDocumentInfo(documentBody)];
217
224
  case 4:
218
- _e.documentData = _k.sent();
219
- _k.label = 5;
225
+ _f.documentData = _l.sent();
226
+ _l.label = 5;
220
227
  case 5:
221
228
  thunkApi.dispatch(handleNextScreenStep());
222
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
229
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
223
230
  return [2, { data: data, formData: originalFormData }];
224
231
  }
225
232
  });
@@ -35,11 +35,11 @@ var FormStyled = styled(Form)(function () { return ({
35
35
  flexDirection: 'column'
36
36
  }); });
37
37
  var BrandActivities = function (_a) {
38
- var _b;
39
- var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
38
+ var _b, _c, _d, _e, _f;
39
+ var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
40
40
  var dispatch = useAppDispatch();
41
- var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error;
42
- var _e = data.brandActivities, activities = _e.activities, customerLocations = _e.customerLocations, expectedCustomer = _e.expectedCustomer, expectedSale = _e.expectedSale, termAndConditionChecked = _e.termAndConditionChecked, refundPolicy = _e.refundPolicy, transactionPolicy = _e.transactionPolicy;
41
+ var _h = useAppSelector(brandSelector), data = _h.data, loading = _h.loading, error = _h.error;
42
+ var _j = data.brandActivities, activities = _j.activities, customerLocations = _j.customerLocations, expectedCustomer = _j.expectedCustomer, expectedSale = _j.expectedSale, termAndConditionChecked = _j.termAndConditionChecked, refundPolicy = _j.refundPolicy, transactionPolicy = _j.transactionPolicy;
43
43
  var ListType;
44
44
  (function (ListType) {
45
45
  ListType["ActivitiesList"] = "ActivitiesList";
@@ -61,7 +61,7 @@ var BrandActivities = function (_a) {
61
61
  mode: 'onChange'
62
62
  });
63
63
  useSetFromDefaultValues(methods, data.brandActivities, true);
64
- var _f = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, data_status = _f.data_status, data_verification = _f.data_verification;
64
+ var _k = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations;
65
65
  var originalReadOnly = useFormReadOnly(methods);
66
66
  var noneEditable = useDataNoneEditable(data_status, [
67
67
  'activities',
@@ -77,6 +77,22 @@ var BrandActivities = function (_a) {
77
77
  'operations.sales_range'
78
78
  ]);
79
79
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
80
+ var locations = methods.watch('customerLocations');
81
+ var isCustomerLocationsHasVerifiedValue = React.useMemo(function () {
82
+ var _a, _b;
83
+ var locationIds = locations === null || locations === void 0 ? void 0 : locations.map(function (_a) {
84
+ var id = _a.id;
85
+ return id;
86
+ });
87
+ var Ids = (_b = (_a = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _a === void 0 ? void 0 : _a.locations) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
88
+ var id = _a.id;
89
+ return id;
90
+ });
91
+ return (locationIds === null || locationIds === void 0 ? void 0 : locationIds.length) === (Ids === null || Ids === void 0 ? void 0 : Ids.length) && locationIds.every(function (locationId) { return Ids.includes(locationId); });
92
+ }, [locations, operations]);
93
+ var isCustomerLocationsVerified = dataVerified['operations.customer_base_location'] && isCustomerLocationsHasVerifiedValue;
94
+ var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_c = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _c === void 0 ? void 0 : _c.id) === ((_d = methods.watch('expectedSale')) === null || _d === void 0 ? void 0 : _d.id);
95
+ var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_e = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _e === void 0 ? void 0 : _e.id) === ((_f = methods.watch('expectedCustomer')) === null || _f === void 0 ? void 0 : _f.id);
80
96
  var onSubmit = function (data) {
81
97
  dispatch(updateBrandActivities(getFelids(data)));
82
98
  };
@@ -93,6 +109,6 @@ var BrandActivities = function (_a) {
93
109
  var isCustomerBaseListActive = listActive === ListType.CustomerBaseList;
94
110
  var isExpectedCustomerListActive = listActive === ListType.ExpectedCustomerList;
95
111
  var isExpectedSalesListActive = listActive === ListType.ExpectedSalesList;
96
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { readOnly: readOnly['activities'] || noneEditable['activities'], show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { readOnly: readOnly['customerLocations'] || noneEditable['operations.customer_base_location'], show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['operations.customer_base_location'] }), _jsx(ExpectedCustomers, { readOnly: readOnly['expectedCustomer'] || noneEditable['operations.customer_base'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomerList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['operations.customer_base'] }), _jsx(ExpectedSalesRange, { readOnly: readOnly['expectedSale'] || noneEditable['operations.sales_range'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedCustomerListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['operations.sales_range'] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(TAC, { readOnly: readOnly['termAndConditionChecked'] || noneEditable['terms'] }), _jsx(RefundPolicy, { readOnly: readOnly['refundPolicy'] || noneEditable['terms'] }), _jsx(TransactionPolicy, { readOnly: readOnly['transactionPolicy'] || noneEditable['terms'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
112
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { readOnly: readOnly['activities'] || noneEditable['activities'], show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { readOnly: readOnly['customerLocations'] || noneEditable['operations.customer_base_location'], show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isCustomerLocationsVerified }), _jsx(ExpectedCustomers, { readOnly: readOnly['expectedCustomer'] || noneEditable['operations.customer_base'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomerList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedCustomersVerified }), _jsx(ExpectedSalesRange, { readOnly: readOnly['expectedSale'] || noneEditable['operations.sales_range'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedCustomerListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedSalesRangeVerified }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(TAC, { readOnly: readOnly['termAndConditionChecked'] || noneEditable['terms'] }), _jsx(RefundPolicy, { readOnly: readOnly['refundPolicy'] || noneEditable['terms'] }), _jsx(TransactionPolicy, { readOnly: readOnly['transactionPolicy'] || noneEditable['terms'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
97
113
  };
98
114
  export default BrandActivities;
@@ -39,15 +39,16 @@ var ListType;
39
39
  ListType["TeamSizeList"] = "TeamSizeList";
40
40
  })(ListType || (ListType = {}));
41
41
  var BrandInfo = function (_a) {
42
- var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
43
- var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
42
+ var _b, _c, _d, _e;
43
+ var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
44
+ var _g = React.useState(false), brandNameChecking = _g[0], setBrandNameChecking = _g[1];
44
45
  var dispatch = useAppDispatch();
45
46
  var t = useTranslation().t;
46
47
  var isAr = useLanguage().isAr;
47
- var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error, uploadingBrandLogo = _d.uploadingBrandLogo;
48
- var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, brandLogoId = _e.brandLogoId, responseBody = _e.responseBody;
49
- var _f = data.verify.responseBody || {}, brand = _f.brand, flows = _f.flows;
50
- var _g = brand || {}, logo_details = _g.logo_details, data_status = _g.data_status, data_verification = _g.data_verification;
48
+ var _h = useAppSelector(brandSelector), data = _h.data, loading = _h.loading, error = _h.error, uploadingBrandLogo = _h.uploadingBrandLogo;
49
+ var _j = data.brandData, brandName = _j.brandName, segment = _j.segment, teamSize = _j.teamSize, salesChannels = _j.salesChannels, brandLogoId = _j.brandLogoId, responseBody = _j.responseBody;
50
+ var _k = data.verify.responseBody || {}, brand = _k.brand, flows = _k.flows;
51
+ var _l = brand || {}, logo_details = _l.logo_details, data_status = _l.data_status, data_verification = _l.data_verification, name = _l.name, resSegment = _l.segment;
51
52
  var methods = useForm({
52
53
  resolver: yupResolver(BrandValidationSchema()),
53
54
  defaultValues: {
@@ -59,6 +60,7 @@ var BrandInfo = function (_a) {
59
60
  },
60
61
  mode: 'onChange'
61
62
  });
63
+ var watch = methods.watch;
62
64
  useSetFromDefaultValues(methods, data.brandData, true);
63
65
  var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
64
66
  var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
@@ -66,6 +68,9 @@ var BrandInfo = function (_a) {
66
68
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
67
69
  var dataVerified = useDataVerified(data_verification, ['logo', 'name.en', 'name.ar', 'segment.teams', 'segment.type']);
68
70
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
71
+ var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
72
+ var isSegmentVerified = dataVerified['segment.type'] && ((_b = resSegment === null || resSegment === void 0 ? void 0 : resSegment.type) === null || _b === void 0 ? void 0 : _b.id) === ((_c = watch('segment')) === null || _c === void 0 ? void 0 : _c.id);
73
+ var isTeamSizeVerified = dataVerified['segment.teams'] && ((_d = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _d === void 0 ? void 0 : _d.id) === ((_e = watch('teamSize')) === null || _e === void 0 ? void 0 : _e.id);
69
74
  var onSubmit = function (data) {
70
75
  dispatch(updateBrand(getFelids(data)));
71
76
  };
@@ -95,6 +100,6 @@ var BrandInfo = function (_a) {
95
100
  };
96
101
  var isSegmentsListActive = listActive === ListType.SegmentsList;
97
102
  var isTeamSizeListActive = listActive === ListType.TeamSizeList;
98
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: dataVerified['name.en'] && dataVerified['name.ar'] }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive, isVerified: dataVerified['logo'] }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['segment.type'] }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: dataVerified['segment.teams'] }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
103
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: isBrandNameVerified }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive, isVerified: dataVerified['logo'] }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentVerified }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isTeamSizeVerified }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
99
104
  };
100
105
  export default BrandInfo;
@@ -35,6 +35,7 @@ var BrandLogo = function (_a) {
35
35
  var dispatch = useAppDispatch();
36
36
  var _c = useAppSelector(brandSelector), data = _c.data, error = _c.error, loading = _c.loading;
37
37
  var logo_details = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}).logo_details;
38
+ var id = brandLogoIdControl.field.value;
38
39
  var handleBrandLogoChange = function (id) {
39
40
  if (error)
40
41
  dispatch(clearError());
@@ -47,6 +48,6 @@ var BrandLogo = function (_a) {
47
48
  dispatch(clearBrandLogo());
48
49
  brandLogoIdControl.field.onChange(undefined);
49
50
  };
50
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified }) }) })));
51
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified && !id }) }) })));
51
52
  };
52
53
  export default BrandLogo;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { useController, useFormContext } from 'react-hook-form';
4
4
  import { useAppSelector, useAppDispatch } from '../../../../hooks';
5
- import { hasVerifiedValue, mapSalesChannel } from '../../../../utils';
5
+ import { hasVerifiedValue, isTwitter, isWebsite, mapSalesChannel } from '../../../../utils';
6
6
  import { brandSelector, clearError } from '../../../app/brand/brandStore';
7
7
  import SalesChannel from '../../../shared/SalesChannels';
8
8
  var SalesChannels = function (_a) {
@@ -13,16 +13,24 @@ var SalesChannels = function (_a) {
13
13
  var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
14
14
  var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
15
15
  var brand = (data.verify.responseBody || {}).brand;
16
- var isChannelVerified = function (id) {
17
- return hasVerifiedValue(brand === null || brand === void 0 ? void 0 : brand.data_verification, "channel_services.".concat(id));
18
- };
19
16
  var channelList = (data.verify.responseBody || {}).channel_list;
17
+ var isChannelVerified = function (id, selected) {
18
+ var _a, _b;
19
+ var initial = (_b = (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, function (sale) { return (sale === null || sale === void 0 ? void 0 : sale.id) === id; });
20
+ var _c = initial || {}, address = _c.address, code = _c.code;
21
+ var initialAddress = isTwitter(code || '')
22
+ ? address === null || address === void 0 ? void 0 : address.replaceAll('@', '')
23
+ : isWebsite(code || '')
24
+ ? address === null || address === void 0 ? void 0 : address.replaceAll('https://www.', '')
25
+ : address;
26
+ return hasVerifiedValue(brand === null || brand === void 0 ? void 0 : brand.data_verification, "channel_services.".concat(id)) && initialAddress === (selected === null || selected === void 0 ? void 0 : selected.address);
27
+ };
20
28
  var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
21
29
  var onChange = function (channels) {
22
30
  if (error)
23
31
  dispatch(clearError());
24
32
  field.onChange(channels);
25
33
  };
26
- return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id) { return isChannelVerified(id); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
34
+ return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id, selected) { return isChannelVerified(id, selected); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
27
35
  };
28
36
  export default SalesChannels;
@@ -8,7 +8,7 @@ interface SalesChannelProps {
8
8
  selectFirstIconListener?: string | number | boolean;
9
9
  disabled?: boolean;
10
10
  readOnly?: boolean;
11
- isChannelVerified?: (id: string) => boolean;
11
+ isChannelVerified?: (id: string, selected?: SaleChannel) => boolean;
12
12
  }
13
13
  declare const _default: React.MemoExoticComponent<({ list, onChange, error, disabled, readOnly, defaultValue, selectFirstIconListener, isChannelVerified }: SalesChannelProps) => JSX.Element>;
14
14
  export default _default;
@@ -142,9 +142,13 @@ var SalesChannel = function (_a) {
142
142
  selectFirstIcon(defaultValue);
143
143
  }
144
144
  }, [selectFirstIconListener]);
145
+ var selectedChannel = React.useMemo(function () { return selectedSalas.find(function (_a) {
146
+ var id = _a.id;
147
+ return id === activeSaleIconId;
148
+ }); }, [selectedSalas, activeSaleIconId]);
145
149
  return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: { mb: 3 } }, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), list.map(function (channel, index) {
146
150
  var _a, _b;
147
151
  return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disabled: disabled || readOnly, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onSelectSalesChannel(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, "".concat(channel.id, "-indx").concat(index)));
148
- }), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { readOnly: readOnly, error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas, isVerified: isChannelVerified === null || isChannelVerified === void 0 ? void 0 : isChannelVerified(activeSaleIconId) }, 'saleChannelIconsInput')] }));
152
+ }), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { readOnly: readOnly, error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas, isVerified: isChannelVerified === null || isChannelVerified === void 0 ? void 0 : isChannelVerified(activeSaleIconId, selectedChannel) }, 'saleChannelIconsInput')] }));
149
153
  };
150
154
  export default React.memo(SalesChannel);
@@ -170,7 +170,7 @@ var UploadMultipleFile = function (_a) {
170
170
  };
171
171
  var fileExists = fileInfoArray.length > 0;
172
172
  return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
173
- return (_jsx(UploadFile, { readOnly: readOnly, required: required, purpose: purpose, fileType: fileType, title: fileTitle, isVerified: isVerified, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
173
+ return (_jsx(UploadFile, { readOnly: readOnly, required: required, purpose: purpose, fileType: fileType, title: fileTitle, isVerified: isVerified && (defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles.length) === uploadedFileCount, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
174
174
  borderBottom: index === fileArray.length - 1 ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : ''
175
175
  }, onSuccess: handleSuccess, onDelete: handleDelete, onUpdate: handleUpdate }, index));
176
176
  }) })), _jsx(Collapse, __assign({ in: !readOnly }, { children: _jsx(InputContainerStyled, __assign({ sx: { mt: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })) }))] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.10-test",
3
+ "version": "2.4.12-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",