@tap-payments/auth-jsconnect 2.3.78-test → 2.3.83-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.
Files changed (29) hide show
  1. package/build/@types/app.d.ts +8 -0
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/api/index.d.ts +1 -0
  4. package/build/api/individual.d.ts +1 -0
  5. package/build/api/individual.js +15 -1
  6. package/build/api/lead.d.ts +1 -0
  7. package/build/assets/locales/ar.json +5 -1
  8. package/build/assets/locales/en.json +5 -1
  9. package/build/constants/dummy.d.ts +8 -0
  10. package/build/constants/dummy.js +8 -0
  11. package/build/features/app/brand/brandStore.d.ts +3 -3
  12. package/build/features/app/brand/brandStore.js +133 -114
  13. package/build/features/app/connect/connectStore.js +66 -35
  14. package/build/features/app/entity/entityStore.d.ts +3 -3
  15. package/build/features/app/entity/entityStore.js +130 -120
  16. package/build/features/app/tax/taxStore.d.ts +2 -2
  17. package/build/features/app/tax/taxStore.js +59 -55
  18. package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -2
  19. package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +3 -11
  20. package/build/features/brand/screens/BrandInfo/BrandInfo.js +7 -6
  21. package/build/features/connect/screens/Merchant/BusinessList.d.ts +10 -0
  22. package/build/features/connect/screens/Merchant/BusinessList.js +82 -0
  23. package/build/features/connect/screens/Merchant/Merchant.js +11 -6
  24. package/build/features/connect/screens/Merchant/validation.d.ts +7 -1
  25. package/build/features/connect/screens/Merchant/validation.js +6 -2
  26. package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -2
  27. package/build/features/entity/screens/EntityName/EntityName.js +3 -2
  28. package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -3
  29. package/package.json +1 -1
@@ -271,6 +271,14 @@ export declare type BrandInfo = {
271
271
  };
272
272
  channel_services: SaleChannel[];
273
273
  };
274
+ export declare type BusinessInfo = {
275
+ id: string;
276
+ segment: string;
277
+ name: {
278
+ ar: string;
279
+ en: string;
280
+ };
281
+ };
274
282
  export declare enum FlowsTypes {
275
283
  CONNECT_EXPRESS = "connect_express",
276
284
  CONNECT = "connect",
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense, BusinessInfo } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string;
4
4
  countryCode: CountryCode;
@@ -36,6 +36,7 @@ export declare type BrandFormValues = {
36
36
  salesChannels: Array<SaleChannel>;
37
37
  termAndConditionChecked?: boolean;
38
38
  selectedBrandItem: BrandInfo;
39
+ business?: BusinessInfo | undefined;
39
40
  };
40
41
  export declare type BrandActivitiesFormValues = {
41
42
  activities: Array<Activity>;
@@ -113,6 +113,7 @@ declare const API: {
113
113
  retrieveIndividual: (id: string, type: string) => Promise<any>;
114
114
  updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
115
115
  getIndividualList: (data: GetIndividualListBody) => Promise<any>;
116
+ getBusinessList: (id: string) => Promise<any>;
116
117
  };
117
118
  boardService: {
118
119
  retrieveBoard: (id: string) => Promise<any>;
@@ -141,5 +141,6 @@ declare const individualService: {
141
141
  retrieveIndividual: (id: string, type: string) => Promise<any>;
142
142
  updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
143
143
  getIndividualList: (data: GetIndividualListBody) => Promise<any>;
144
+ getBusinessList: (id: string) => Promise<any>;
144
145
  };
145
146
  export { individualService };
@@ -38,10 +38,24 @@ var getIndividualList = function (data) {
38
38
  data: data
39
39
  });
40
40
  };
41
+ var getBusinessList = function (id) {
42
+ return httpClient({
43
+ method: 'post',
44
+ url: "".concat(ENDPOINT_PATHS.BUSINESS, "/list"),
45
+ data: {
46
+ individual_id: id,
47
+ list: {
48
+ limit: 10,
49
+ page: 1
50
+ }
51
+ }
52
+ });
53
+ };
41
54
  var individualService = {
42
55
  retrieveIndividualInfo: retrieveIndividualInfo,
43
56
  retrieveIndividual: retrieveIndividual,
44
57
  updateIndividual: updateIndividual,
45
- getIndividualList: getIndividualList
58
+ getIndividualList: getIndividualList,
59
+ getBusinessList: getBusinessList
46
60
  };
47
61
  export { individualService };
@@ -38,6 +38,7 @@ declare type BrandInfo = {
38
38
  export declare type UpdateLeadBody = {
39
39
  step_name?: string;
40
40
  id: string;
41
+ business_id?: string;
41
42
  encryption_contract?: Array<string>;
42
43
  entity?: {
43
44
  id: string;
@@ -396,5 +396,9 @@
396
396
  "powered_by": "بواسطة",
397
397
  "add_other": "أخرى",
398
398
  "choose_entity_license": "اختر ترخيص المنشأة",
399
- "choose_license_entity": "- الرجاء الاختيار -"
399
+ "choose_license_entity": "- الرجاء الاختيار -",
400
+ "select_business_label": "اختر الشركة",
401
+ "Choose_business": "الرجاء تحديد شركة",
402
+ "alert_choose_business": "يُرجى اختيار الشركة",
403
+ "other": "اخرى"
400
404
  }
@@ -426,5 +426,9 @@
426
426
  "powered_by": "Powered by",
427
427
  "add_other": "Other",
428
428
  "choose_entity_license": "Choose Entity License",
429
- "choose_license_entity": "- Please select -"
429
+ "choose_license_entity": "- Please select -",
430
+ "select_business_label": "Business",
431
+ "choose_business": "Please select a business",
432
+ "alert_choose_business": "Please select business",
433
+ "other": "other"
430
434
  }
@@ -6,6 +6,14 @@ export declare const OTHER_BRAND: {
6
6
  en: string;
7
7
  };
8
8
  };
9
+ export declare const OTHER_BUSINESS: {
10
+ id: string;
11
+ segment: string;
12
+ name: {
13
+ ar: string;
14
+ en: string;
15
+ };
16
+ };
9
17
  export declare const defaultCountry: {
10
18
  created: number;
11
19
  updated: number;
@@ -6,6 +6,14 @@ export var OTHER_BRAND = {
6
6
  en: 'other'
7
7
  }
8
8
  };
9
+ export var OTHER_BUSINESS = {
10
+ id: 'other',
11
+ segment: 'other',
12
+ name: {
13
+ ar: 'other',
14
+ en: 'other'
15
+ }
16
+ };
9
17
  export var defaultCountry = {
10
18
  created: 1577690965000,
11
19
  updated: 1577691209000,
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, AsyncThunkParams, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  interface VerifyLeadTokenProps {
5
5
  token: string;
@@ -63,14 +63,14 @@ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").Asyn
63
63
  export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
64
64
  data: any;
65
65
  formData: Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">;
66
- }, Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">, {}>;
66
+ }, AsyncThunkParams<Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">>, {}>;
67
67
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
68
68
  leadId: string;
69
69
  }, {}>;
70
70
  export declare const updateBrandActivities: import("@reduxjs/toolkit").AsyncThunk<{
71
71
  data: any;
72
72
  formData: BrandActivitiesFormValues;
73
- }, BrandActivitiesFormValues, {}>;
73
+ }, AsyncThunkParams<BrandActivitiesFormValues>, {}>;
74
74
  export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
75
75
  customerBases: any;
76
76
  expectedSales: any;
@@ -263,70 +263,73 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
263
263
  });
264
264
  });
265
265
  });
266
- export var updateBrand = createAsyncThunk('brandUpdateBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
267
- var _a, settings, brand, _b, id, data_status, isNameNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, requestBody, brandData, activities, activityList;
268
- var _c, _d, _e, _f;
269
- return __generator(this, function (_g) {
270
- switch (_g.label) {
271
- case 0:
272
- _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
273
- _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, id = _b.id, data_status = _b.data_status;
274
- isNameNonEditable = hasNoneEditableValue(data_status, 'name');
275
- isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
276
- isSegmentTypeNonEditable = hasNoneEditableValue(data_status, 'segment.type');
277
- isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
278
- salesChannels = params.salesChannels, brandName = params.brandName, segment = params.segment, teamSize = params.teamSize, brandLogoId = params.brandLogoId;
279
- segmentId = isSegmentTypeNonEditable ? undefined : segment && { id: segment.id };
280
- teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
281
- getAddress = function (value, isTwitter, isWeb) {
282
- if (isTwitter)
283
- return '@' + value.replaceAll('@', '');
284
- if (isWeb)
285
- return 'https://www.' + value.replaceAll('https://www.', '');
286
- return value;
287
- };
288
- channel_services = isChannelServicesNonEditable
289
- ? undefined
290
- : salesChannels.map(function (channel) {
291
- var _a;
292
- return {
293
- id: channel.id,
294
- address: getAddress(channel.address || '', isTwitter(channel.code), isWebsite(channel.code)),
295
- sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
296
- return { id: sub.id, address: getAddress(sub.address || '', isTwitter(sub.code), isWebsite(sub.code)) };
297
- })
298
- };
299
- });
300
- requestBody = {
301
- id: id,
302
- name: isNameNonEditable || !brandName ? undefined : { en: brandName, ar: brandName },
303
- logo: brandLogoId,
304
- segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId },
305
- channel_services: channel_services
306
- };
307
- return [4, API.brandService.updateBrandInfo(requestBody)];
308
- case 1:
309
- brandData = (_g.sent()).brand;
310
- activities = (((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}).activities;
311
- return [4, thunkApi.dispatch(retrieveDataList())];
312
- case 2:
313
- _g.sent();
314
- if (activities) {
315
- brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
316
- }
317
- if (!!activities) return [3, 4];
318
- return [4, API.dataService.getActivities()];
319
- case 3:
320
- activityList = (_g.sent()).list;
321
- brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
322
- _g.label = 4;
323
- case 4:
324
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
325
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
326
- return [2, { data: __assign({}, brandData), formData: params }];
327
- }
266
+ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
267
+ var formData = _a.formData, originalFormData = _a.originalFormData;
268
+ return __awaiter(void 0, void 0, void 0, function () {
269
+ var _b, settings, brand, _c, id, data_status, isNameNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, requestBody, brandData, activities, activityList;
270
+ var _d, _e, _f, _g;
271
+ return __generator(this, function (_h) {
272
+ switch (_h.label) {
273
+ case 0:
274
+ _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;
276
+ isNameNonEditable = hasNoneEditableValue(data_status, 'name');
277
+ isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
278
+ isSegmentTypeNonEditable = hasNoneEditableValue(data_status, 'segment.type');
279
+ isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
280
+ salesChannels = formData.salesChannels, brandName = formData.brandName, segment = formData.segment, teamSize = formData.teamSize, brandLogoId = formData.brandLogoId;
281
+ segmentId = isSegmentTypeNonEditable ? undefined : segment && { id: segment.id };
282
+ teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
283
+ getAddress = function (value, isTwitter, isWeb) {
284
+ if (isTwitter)
285
+ return '@' + value.replaceAll('@', '');
286
+ if (isWeb)
287
+ return 'https://www.' + value.replaceAll('https://www.', '');
288
+ return value;
289
+ };
290
+ channel_services = isChannelServicesNonEditable
291
+ ? undefined
292
+ : salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.map(function (channel) {
293
+ var _a;
294
+ return {
295
+ id: channel.id,
296
+ address: getAddress(channel.address || '', isTwitter(channel.code), isWebsite(channel.code)),
297
+ sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
298
+ return { id: sub.id, address: getAddress(sub.address || '', isTwitter(sub.code), isWebsite(sub.code)) };
299
+ })
300
+ };
301
+ });
302
+ requestBody = {
303
+ id: id,
304
+ name: isNameNonEditable || !brandName ? undefined : { en: brandName, ar: brandName },
305
+ logo: brandLogoId,
306
+ segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId },
307
+ channel_services: channel_services
308
+ };
309
+ return [4, API.brandService.updateBrandInfo(requestBody)];
310
+ case 1:
311
+ brandData = (_h.sent()).brand;
312
+ activities = (((_e = brand.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.entity) || {}).activities;
313
+ return [4, thunkApi.dispatch(retrieveDataList())];
314
+ case 2:
315
+ _h.sent();
316
+ if (activities) {
317
+ brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
318
+ }
319
+ if (!!activities) return [3, 4];
320
+ return [4, API.dataService.getActivities()];
321
+ case 3:
322
+ activityList = (_h.sent()).list;
323
+ brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
324
+ _h.label = 4;
325
+ case 4:
326
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
327
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
328
+ return [2, { data: __assign({}, brandData), formData: originalFormData }];
329
+ }
330
+ });
328
331
  });
329
- }); });
332
+ });
330
333
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
331
334
  var data;
332
335
  return __generator(this, function (_a) {
@@ -338,57 +341,62 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
338
341
  }
339
342
  });
340
343
  }); });
341
- export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
342
- var _a, settings, brand, _b, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
343
- var _c, _d, _e;
344
- return __generator(this, function (_f) {
345
- switch (_f.label) {
346
- case 0:
347
- _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
348
- _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, data_status = _b.data_status, id = _b.id, brandActivities = _b.activities;
349
- isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
350
- isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
351
- isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
352
- isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
353
- isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
354
- activities = params.activities, customerLocations = params.customerLocations, expectedCustomer = params.expectedCustomer, expectedSale = params.expectedSale;
355
- removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
356
- if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
357
- payload = {
358
- id: id,
359
- activities: removedActivities
360
- };
361
- return [4, API.brandService.removeBrandActivity(payload)];
362
- case 1:
363
- _f.sent();
364
- _f.label = 2;
365
- case 2:
366
- requestBody = {
367
- id: id,
368
- activities: isActivitiesNonEditable ? undefined : activities,
369
- term: isTermsNonEditable ? undefined : ['general', 'refund', 'chargeback'],
370
- step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
371
- };
372
- customerLocation = customerLocations.map(function (location) { return ({
373
- id: location.id
374
- }); });
375
- customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
376
- salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
377
- customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
378
- if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
379
- requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
380
- if (salesId && !isSalesRangeNonEditable) {
381
- requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
382
- }
383
- return [4, API.brandService.updateBrandInfo(requestBody)];
384
- case 3:
385
- brandData = (_f.sent()).data;
386
- thunkApi.dispatch(handleNextScreenStep());
387
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
388
- return [2, { data: __assign({}, brandData), formData: params }];
389
- }
344
+ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (_a, thunkApi) {
345
+ var formData = _a.formData, originalFormData = _a.originalFormData;
346
+ return __awaiter(void 0, void 0, void 0, function () {
347
+ var _b, settings, brand, _c, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
348
+ var _d, _e, _f;
349
+ return __generator(this, function (_g) {
350
+ switch (_g.label) {
351
+ case 0:
352
+ _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
353
+ _c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, data_status = _c.data_status, id = _c.id, brandActivities = _c.activities;
354
+ isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
355
+ isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
356
+ isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
357
+ isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
358
+ isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
359
+ activities = formData.activities, customerLocations = formData.customerLocations, expectedCustomer = formData.expectedCustomer, expectedSale = formData.expectedSale, termAndConditionChecked = formData.termAndConditionChecked, refundPolicy = formData.refundPolicy, transactionPolicy = formData.transactionPolicy;
360
+ isTermsUndefined = termAndConditionChecked === undefined && refundPolicy === undefined && transactionPolicy === undefined;
361
+ removedActivities = (activities === null || activities === void 0 ? void 0 : activities.length) > 0 &&
362
+ (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
363
+ if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
364
+ payload = {
365
+ id: id,
366
+ activities: removedActivities
367
+ };
368
+ return [4, API.brandService.removeBrandActivity(payload)];
369
+ case 1:
370
+ _g.sent();
371
+ _g.label = 2;
372
+ case 2:
373
+ requestBody = {
374
+ id: id,
375
+ activities: isActivitiesNonEditable ? undefined : activities,
376
+ term: isTermsNonEditable || isTermsUndefined ? undefined : ['general', 'refund', 'chargeback'],
377
+ step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
378
+ };
379
+ customerLocation = (customerLocations || []).map(function (location) { return ({
380
+ id: location.id
381
+ }); });
382
+ customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
383
+ salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
384
+ customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
385
+ if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
386
+ requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
387
+ if (salesId && !isSalesRangeNonEditable) {
388
+ requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
389
+ }
390
+ return [4, API.brandService.updateBrandInfo(requestBody)];
391
+ case 3:
392
+ brandData = (_g.sent()).data;
393
+ thunkApi.dispatch(handleNextScreenStep());
394
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
395
+ return [2, { data: __assign({}, brandData), formData: originalFormData }];
396
+ }
397
+ });
390
398
  });
391
- }); });
399
+ });
392
400
  export var retrieveDataList = createAsyncThunk('brandRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
401
  var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
394
402
  return __generator(this, function (_b) {
@@ -617,7 +625,7 @@ export var brandSlice = createSlice({
617
625
  state.loading = false;
618
626
  state.error = null;
619
627
  var _a = action.payload, data = _a.data, formData = _a.formData;
620
- var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations;
628
+ var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations, terms = data.terms;
621
629
  var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
622
630
  return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
623
631
  });
@@ -631,6 +639,17 @@ export var brandSlice = createSlice({
631
639
  state.data.brandActivities.expectedSale = sales;
632
640
  if (!!customerBase)
633
641
  state.data.brandActivities.expectedCustomer = customerBase;
642
+ terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
643
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
644
+ state.data.brandActivities.termAndConditionChecked = element.agree;
645
+ }
646
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'chargeback') {
647
+ state.data.brandActivities.transactionPolicy = element.agree;
648
+ }
649
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'refund') {
650
+ state.data.brandActivities.refundPolicy = element.agree;
651
+ }
652
+ });
634
653
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities });
635
654
  })
636
655
  .addCase(updateBrandActivities.rejected, function (state, action) {