@tap-payments/auth-jsconnect 1.0.71 → 1.0.76
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.
- package/build/@types/app.d.ts +16 -7
- package/build/@types/form.d.ts +3 -3
- package/build/api/auth.d.ts +7 -0
- package/build/api/auth.js +5 -1
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +5 -1
- package/build/api/entity.d.ts +1 -0
- package/build/api/entity.js +5 -1
- package/build/api/index.d.ts +9 -2
- package/build/api/index.js +3 -1
- package/build/api/individual.d.ts +8 -0
- package/build/api/individual.js +9 -0
- package/build/assets/locales/ar.json +9 -5
- package/build/assets/locales/en.json +14 -4
- package/build/components/SimpleList/SimpleList.js +4 -4
- package/build/constants/api.d.ts +3 -0
- package/build/constants/api.js +11 -5
- package/build/constants/app.js +18 -6
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/features/app/bank/bankStore.d.ts +3 -0
- package/build/features/app/bank/bankStore.js +45 -9
- package/build/features/app/business/businessStore.d.ts +4 -5
- package/build/features/app/business/businessStore.js +106 -66
- package/build/features/app/connect/connectStore.d.ts +1 -0
- package/build/features/app/connect/connectStore.js +19 -10
- package/build/features/app/individual/individualStore.d.ts +7 -1
- package/build/features/app/individual/individualStore.js +79 -30
- package/build/features/app/password/passwordStore.d.ts +4 -0
- package/build/features/app/password/passwordStore.js +71 -15
- package/build/features/bank/screens/Success/Success.js +5 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/Activities/validation.d.ts +24 -24
- package/build/features/business/screens/Activities/validation.js +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +2 -2
- package/build/features/business/screens/Customers/Customers.js +4 -4
- package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -1
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +60 -33
- package/build/features/business/screens/Customers/validation.js +2 -2
- package/build/features/business/screens/Success/Success.js +1 -1
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -20
- package/build/features/connect/screens/Individual/MobileNumber.js +11 -2
- package/build/features/connect/screens/Merchant/Merchant.js +9 -2
- package/build/features/connect/screens/Mobile/MobileNumber.js +11 -2
- package/build/features/connect/screens/ThankYou/ThankYou.js +1 -1
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +5 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +62 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +3 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -9
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -11
- package/build/features/individual/screens/Success/Success.js +5 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -10
- package/build/features/password/screens/Success/Success.js +7 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +2 -0
- package/build/features/shared/Button/FlowsButtons.js +2 -2
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Search/Search.d.ts +1 -1
- package/build/features/shared/Search/Search.js +2 -14
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +9 -20
- package/build/features/tax/screens/Success/Success.js +1 -1
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +6 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +7 -0
- package/package.json +1 -1
|
@@ -79,10 +79,9 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
79
79
|
});
|
|
80
80
|
}); });
|
|
81
81
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
-
var payload, data, leadResponse
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
switch (_b.label) {
|
|
82
|
+
var payload, data, leadResponse;
|
|
83
|
+
return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
86
85
|
case 0:
|
|
87
86
|
payload = {
|
|
88
87
|
service_name: 'tap_email',
|
|
@@ -90,32 +89,28 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
90
89
|
};
|
|
91
90
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
92
91
|
case 1:
|
|
93
|
-
data = (
|
|
92
|
+
data = (_a.sent()).data;
|
|
94
93
|
leadResponse = undefined;
|
|
95
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
94
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 3];
|
|
96
95
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
97
96
|
case 2:
|
|
98
|
-
leadResponse =
|
|
99
|
-
number = (((_a = leadResponse.data.entity) === null || _a === void 0 ? void 0 : _a.license) || {}).number;
|
|
100
|
-
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id, licenseNumber: number }))];
|
|
101
|
-
case 3:
|
|
102
|
-
_b.sent();
|
|
97
|
+
leadResponse = _a.sent();
|
|
103
98
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
|
|
104
99
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
105
100
|
}
|
|
106
101
|
if (data.step_name === 'business_info') {
|
|
107
102
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
108
103
|
}
|
|
109
|
-
|
|
110
|
-
case
|
|
104
|
+
_a.label = 3;
|
|
105
|
+
case 3: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
|
|
111
106
|
}
|
|
112
107
|
});
|
|
113
108
|
}); });
|
|
114
109
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
110
|
var _a, business, settings, isNID, responseBody, stepName, payload, data, steps, hasBusinessCompleted;
|
|
116
|
-
var _b, _c, _d;
|
|
117
|
-
return __generator(this, function (
|
|
118
|
-
switch (
|
|
111
|
+
var _b, _c, _d, _e, _f;
|
|
112
|
+
return __generator(this, function (_g) {
|
|
113
|
+
switch (_g.label) {
|
|
119
114
|
case 0:
|
|
120
115
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
121
116
|
isNID = business.data.otpData.isNID;
|
|
@@ -130,28 +125,34 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
130
125
|
};
|
|
131
126
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
132
127
|
case 1:
|
|
133
|
-
data = (
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
data = (_g.sent()).data;
|
|
129
|
+
if (!!data.errors) return [3, 4];
|
|
130
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
131
|
+
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
132
|
+
case 2:
|
|
133
|
+
_g.sent();
|
|
134
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
|
|
135
|
+
case 3:
|
|
136
|
+
_g.sent();
|
|
137
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
138
|
+
steps = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps) || [];
|
|
139
|
+
hasBusinessCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
|
|
140
|
+
if (isNID) {
|
|
141
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
if (hasBusinessCompleted) {
|
|
145
|
+
thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
146
|
+
}
|
|
147
|
+
else if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
|
|
148
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
141
149
|
}
|
|
142
150
|
else {
|
|
143
|
-
|
|
144
|
-
thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
145
|
-
}
|
|
146
|
-
else if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
|
|
147
|
-
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
151
|
-
}
|
|
151
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
_g.label = 4;
|
|
155
|
+
case 4: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
|
|
155
156
|
}
|
|
156
157
|
});
|
|
157
158
|
}); });
|
|
@@ -188,14 +189,25 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
188
189
|
}
|
|
189
190
|
});
|
|
190
191
|
}); });
|
|
191
|
-
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params
|
|
192
|
+
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
193
|
var data;
|
|
193
194
|
return __generator(this, function (_a) {
|
|
194
195
|
switch (_a.label) {
|
|
195
196
|
case 0: return [4, API.leadService.retrieveEntityList(params.leadId)];
|
|
196
197
|
case 1:
|
|
197
198
|
data = (_a.sent()).data;
|
|
198
|
-
return [2,
|
|
199
|
+
return [2, data];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}); });
|
|
203
|
+
export var retrieveEntityInfo = createAsyncThunk('retrieveEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
+
var data;
|
|
205
|
+
return __generator(this, function (_a) {
|
|
206
|
+
switch (_a.label) {
|
|
207
|
+
case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
|
|
208
|
+
case 1:
|
|
209
|
+
data = (_a.sent()).data;
|
|
210
|
+
return [2, { data: data }];
|
|
199
211
|
}
|
|
200
212
|
});
|
|
201
213
|
}); });
|
|
@@ -267,8 +279,8 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
267
279
|
case 0:
|
|
268
280
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
269
281
|
channel = params.salesChannels.map(function (_a) {
|
|
270
|
-
var
|
|
271
|
-
return
|
|
282
|
+
var id = _a.id;
|
|
283
|
+
return id;
|
|
272
284
|
});
|
|
273
285
|
activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
274
286
|
var en = _a.en;
|
|
@@ -326,15 +338,15 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
326
338
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
327
339
|
id = (_b = business.data.businessTypeData.responseBody) === null || _b === void 0 ? void 0 : _b.entity_id;
|
|
328
340
|
customerBase = params.customerLocations.map(function (_a) {
|
|
329
|
-
var
|
|
330
|
-
return
|
|
341
|
+
var id = _a.id;
|
|
342
|
+
return id;
|
|
331
343
|
});
|
|
332
344
|
stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
|
|
333
345
|
requestBody = {
|
|
334
346
|
customers_base: customerBase,
|
|
335
347
|
id: id,
|
|
336
348
|
customers_served_monthly: parseInt(((_c = params.expectedCustomer) === null || _c === void 0 ? void 0 : _c.id) || '0'),
|
|
337
|
-
yearly_sales_range: ((_d = params.
|
|
349
|
+
yearly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
338
350
|
agree_refund: params.refundPolicy,
|
|
339
351
|
agree_chargeback: params.transactionPolicy,
|
|
340
352
|
step_name: stepName
|
|
@@ -443,7 +455,7 @@ var initialState = {
|
|
|
443
455
|
customersData: {
|
|
444
456
|
customerLocations: [],
|
|
445
457
|
expectedCustomer: undefined,
|
|
446
|
-
|
|
458
|
+
expectedSale: undefined,
|
|
447
459
|
refundPolicy: false,
|
|
448
460
|
transactionPolicy: false
|
|
449
461
|
}
|
|
@@ -556,13 +568,13 @@ export var businessSlice = createSlice({
|
|
|
556
568
|
})
|
|
557
569
|
.addCase(retrieveEntityList.pending, function (state) {
|
|
558
570
|
state.error = null;
|
|
559
|
-
state.
|
|
571
|
+
state.loading = true;
|
|
560
572
|
})
|
|
561
573
|
.addCase(retrieveEntityList.fulfilled, function (state, action) {
|
|
562
|
-
var _a, _b, _c, _d, _e;
|
|
574
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
563
575
|
state.error = null;
|
|
564
|
-
state.
|
|
565
|
-
var
|
|
576
|
+
state.loading = false;
|
|
577
|
+
var data = action.payload;
|
|
566
578
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
567
579
|
var licenseList = [];
|
|
568
580
|
if (!description) {
|
|
@@ -581,25 +593,49 @@ export var businessSlice = createSlice({
|
|
|
581
593
|
}
|
|
582
594
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
583
595
|
state.data.businessTypeData.responseBody = { licenseList: licenseList };
|
|
584
|
-
var
|
|
596
|
+
var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
|
|
597
|
+
var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
|
|
598
|
+
var license = _a.license;
|
|
599
|
+
return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber;
|
|
600
|
+
})) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
|
|
585
601
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
586
|
-
var isOtherLicense = ((
|
|
602
|
+
var isOtherLicense = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) === 'other_fl' || ((_f = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _f === void 0 ? void 0 : _f.number) === 'other_cr';
|
|
587
603
|
if (!isOtherLicense)
|
|
588
|
-
state.data.businessTypeData.licenseNumber = (
|
|
604
|
+
state.data.businessTypeData.licenseNumber = ((_g = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _g === void 0 ? void 0 : _g.number) || '';
|
|
589
605
|
})
|
|
590
606
|
.addCase(retrieveEntityList.rejected, function (state, action) {
|
|
591
607
|
state.error = action.error.message;
|
|
592
|
-
state.
|
|
608
|
+
state.loading = false;
|
|
609
|
+
})
|
|
610
|
+
.addCase(retrieveEntityInfo.pending, function (state) {
|
|
611
|
+
state.error = null;
|
|
612
|
+
state.loading = true;
|
|
613
|
+
})
|
|
614
|
+
.addCase(retrieveEntityInfo.fulfilled, function (state, action) {
|
|
615
|
+
var _a;
|
|
616
|
+
state.error = null;
|
|
617
|
+
state.loading = false;
|
|
618
|
+
var data = (action.payload || {}).data;
|
|
619
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
620
|
+
if (description) {
|
|
621
|
+
state.error = description;
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
|
|
625
|
+
})
|
|
626
|
+
.addCase(retrieveEntityInfo.rejected, function (state, action) {
|
|
627
|
+
state.error = action.error.message;
|
|
628
|
+
state.loading = false;
|
|
593
629
|
})
|
|
594
630
|
.addCase(updateLeadBusinessType.pending, function (state) {
|
|
595
631
|
state.loading = true;
|
|
596
632
|
state.error = null;
|
|
597
633
|
})
|
|
598
634
|
.addCase(updateLeadBusinessType.fulfilled, function (state, action) {
|
|
599
|
-
var _a, _b
|
|
635
|
+
var _a, _b;
|
|
600
636
|
state.loading = false;
|
|
601
637
|
state.error = null;
|
|
602
|
-
var
|
|
638
|
+
var _c = action.payload, data = _c.data, formData = _c.formData;
|
|
603
639
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
604
640
|
if (description) {
|
|
605
641
|
state.error = description;
|
|
@@ -607,8 +643,10 @@ export var businessSlice = createSlice({
|
|
|
607
643
|
}
|
|
608
644
|
state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
|
|
609
645
|
var entity = data.entity, entity_activities = data.entity_activities;
|
|
610
|
-
|
|
611
|
-
|
|
646
|
+
var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
647
|
+
if (!!issuingDate) {
|
|
648
|
+
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
649
|
+
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
612
650
|
}
|
|
613
651
|
var activities = entity_activities || [];
|
|
614
652
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
|
|
@@ -676,18 +714,20 @@ export var businessSlice = createSlice({
|
|
|
676
714
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
677
715
|
state.loading = false;
|
|
678
716
|
state.error = null;
|
|
679
|
-
var
|
|
680
|
-
var
|
|
681
|
-
|
|
682
|
-
var
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
var
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
if (!!
|
|
690
|
-
state.data.customersData.
|
|
717
|
+
var payload = action.payload;
|
|
718
|
+
var customerBases = payload.customerBases || [];
|
|
719
|
+
var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[0];
|
|
720
|
+
var expectedSales = payload.expectedSales || [];
|
|
721
|
+
var expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[expectedSales.length - 1];
|
|
722
|
+
var expectedCustomerSales = payload.expectedCustomerSales || [];
|
|
723
|
+
var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[expectedCustomerSales.length - 1];
|
|
724
|
+
state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
|
|
725
|
+
if (!!customerBase)
|
|
726
|
+
state.data.customersData.customerLocations = [customerBase];
|
|
727
|
+
if (!!expectedSale)
|
|
728
|
+
state.data.customersData.expectedSale = expectedSale;
|
|
729
|
+
if (!!expectedCustomerSale)
|
|
730
|
+
state.data.customersData.expectedCustomer = expectedCustomerSale;
|
|
691
731
|
})
|
|
692
732
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
693
733
|
state.loading = false;
|
|
@@ -40,6 +40,7 @@ export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
40
40
|
}, {}>;
|
|
41
41
|
export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
42
42
|
response: any;
|
|
43
|
+
brandResponse: any;
|
|
43
44
|
formData: {
|
|
44
45
|
individualId: string;
|
|
45
46
|
stepName: string;
|
|
@@ -58,7 +58,7 @@ var _a;
|
|
|
58
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
59
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
60
60
|
import API from '../../../api';
|
|
61
|
-
import {
|
|
61
|
+
import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
|
|
62
62
|
import { defaultCountry } from '../../../constants';
|
|
63
63
|
import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
|
|
64
64
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -199,9 +199,9 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
|
|
|
199
199
|
});
|
|
200
200
|
}); });
|
|
201
201
|
export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
202
|
-
var connect, businessCountry, payload, data;
|
|
203
|
-
return __generator(this, function (
|
|
204
|
-
switch (
|
|
202
|
+
var connect, businessCountry, payload, brandPayload, _a, brandResponse, data;
|
|
203
|
+
return __generator(this, function (_b) {
|
|
204
|
+
switch (_b.label) {
|
|
205
205
|
case 0:
|
|
206
206
|
connect = thunkApi.getState().connect;
|
|
207
207
|
businessCountry = connect.data.businessCountry;
|
|
@@ -209,11 +209,17 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
|
|
|
209
209
|
individual_id: params.individualId,
|
|
210
210
|
country_code: businessCountry.iso2
|
|
211
211
|
};
|
|
212
|
-
|
|
212
|
+
brandPayload = {
|
|
213
|
+
individual_id: params.individualId
|
|
214
|
+
};
|
|
215
|
+
return [4, Promise.all([
|
|
216
|
+
API.individualService.getBrandList(brandPayload),
|
|
217
|
+
API.leadService.createLead(payload)
|
|
218
|
+
])];
|
|
213
219
|
case 1:
|
|
214
|
-
|
|
220
|
+
_a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
|
|
215
221
|
thunkApi.dispatch(handleNextScreenStep(params.stepName));
|
|
216
|
-
return [2, { response: data, formData: params }];
|
|
222
|
+
return [2, { response: data, brandResponse: brandResponse, formData: params }];
|
|
217
223
|
}
|
|
218
224
|
});
|
|
219
225
|
}); });
|
|
@@ -558,11 +564,14 @@ export var connectSlice = createSlice({
|
|
|
558
564
|
var _a;
|
|
559
565
|
state.loading = false;
|
|
560
566
|
state.error = null;
|
|
561
|
-
var
|
|
567
|
+
var _b = action.payload, response = _b.response, brandResponse = _b.brandResponse;
|
|
562
568
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
563
569
|
if (!!response && !description) {
|
|
564
|
-
|
|
565
|
-
state.data.brandData.responseBody = __assign({ brands: __spreadArray(__spreadArray([],
|
|
570
|
+
var brandList = Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands : [];
|
|
571
|
+
state.data.brandData.responseBody = __assign({ brands: __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false) }, response);
|
|
572
|
+
var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
|
|
573
|
+
if (!!brand)
|
|
574
|
+
state.data.brandData.selectedBrandItem = brand;
|
|
566
575
|
}
|
|
567
576
|
})
|
|
568
577
|
.addCase(createLead.pending, function (state) {
|
|
@@ -9,7 +9,13 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
9
9
|
leadData: any;
|
|
10
10
|
token: string;
|
|
11
11
|
}, string, {}>;
|
|
12
|
-
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<
|
|
12
|
+
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
13
|
+
sourceIncome: any;
|
|
14
|
+
monthlyIncome: any;
|
|
15
|
+
}, void, {}>;
|
|
16
|
+
export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
|
+
data: any;
|
|
18
|
+
}, string, {}>;
|
|
13
19
|
export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
14
20
|
data: any;
|
|
15
21
|
formData: {
|
|
@@ -92,22 +92,43 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
}); });
|
|
95
|
-
export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
-
var sourceIncome;
|
|
95
|
+
export var retrieveDataList = createAsyncThunk('retrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
+
var individual, code, _a, sourceIncome, monthlyIncome;
|
|
97
|
+
var _b, _c;
|
|
98
|
+
return __generator(this, function (_d) {
|
|
99
|
+
switch (_d.label) {
|
|
100
|
+
case 0:
|
|
101
|
+
individual = thunkApi.getState().individual;
|
|
102
|
+
code = (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.country;
|
|
103
|
+
return [4, Promise.all([
|
|
104
|
+
API.dataService.getSourceOfIncome(),
|
|
105
|
+
API.dataService.getMonthlyIncome(code)
|
|
106
|
+
])];
|
|
107
|
+
case 1:
|
|
108
|
+
_a = _d.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
|
|
109
|
+
return [2, {
|
|
110
|
+
sourceIncome: sourceIncome,
|
|
111
|
+
monthlyIncome: monthlyIncome
|
|
112
|
+
}];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}); });
|
|
116
|
+
export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
|
+
var data;
|
|
97
118
|
return __generator(this, function (_a) {
|
|
98
119
|
switch (_a.label) {
|
|
99
|
-
case 0: return [4, API.
|
|
120
|
+
case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
|
|
100
121
|
case 1:
|
|
101
|
-
|
|
102
|
-
return [2,
|
|
122
|
+
data = (_a.sent()).data;
|
|
123
|
+
return [2, { data: data }];
|
|
103
124
|
}
|
|
104
125
|
});
|
|
105
126
|
}); });
|
|
106
127
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
128
|
var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
|
|
108
|
-
var _b, _c, _d, _e;
|
|
109
|
-
return __generator(this, function (
|
|
110
|
-
switch (
|
|
129
|
+
var _b, _c, _d, _e, _f, _g;
|
|
130
|
+
return __generator(this, function (_h) {
|
|
131
|
+
switch (_h.label) {
|
|
111
132
|
case 0:
|
|
112
133
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
113
134
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -120,28 +141,31 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
120
141
|
};
|
|
121
142
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
122
143
|
case 1:
|
|
123
|
-
data = (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
144
|
+
data = (_h.sent()).data;
|
|
145
|
+
return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
|
|
146
|
+
case 2:
|
|
147
|
+
_h.sent();
|
|
148
|
+
if (!!data.errors) return [3, 5];
|
|
149
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
150
|
+
steps = (_g = individual.data.verify.responseBody) === null || _g === void 0 ? void 0 : _g.steps;
|
|
127
151
|
hasIndividualCompleted = Object.keys(steps).find(function (key) { return key === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS; });
|
|
128
|
-
if (!hasIndividualCompleted) return [3,
|
|
129
|
-
thunkApi.dispatch(handleNextScreenStep('
|
|
130
|
-
return [3,
|
|
131
|
-
case
|
|
132
|
-
case
|
|
133
|
-
|
|
152
|
+
if (!hasIndividualCompleted) return [3, 3];
|
|
153
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
154
|
+
return [3, 5];
|
|
155
|
+
case 3: return [4, thunkApi.dispatch(retrieveDataList())];
|
|
156
|
+
case 4:
|
|
157
|
+
_h.sent();
|
|
134
158
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
135
|
-
|
|
136
|
-
case
|
|
159
|
+
_h.label = 5;
|
|
160
|
+
case 5: return [2, { data: data, formData: __assign({}, params) }];
|
|
137
161
|
}
|
|
138
162
|
});
|
|
139
163
|
}); });
|
|
140
164
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
165
|
var _a, settings, individual, requestBody, data;
|
|
142
|
-
var _b, _c, _d, _e, _f, _g;
|
|
143
|
-
return __generator(this, function (
|
|
144
|
-
switch (
|
|
166
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
167
|
+
return __generator(this, function (_j) {
|
|
168
|
+
switch (_j.label) {
|
|
145
169
|
case 0:
|
|
146
170
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
147
171
|
requestBody = {
|
|
@@ -149,7 +173,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
149
173
|
employer_name: params.employerName,
|
|
150
174
|
employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
|
|
151
175
|
source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
|
|
152
|
-
actual_income: params.monthlyIncome,
|
|
176
|
+
actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
|
|
153
177
|
is_relative_PEP: params.isPEP,
|
|
154
178
|
is_influencer: params.isInfluencer,
|
|
155
179
|
encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'is_relative_PEP', 'is_influencer'],
|
|
@@ -157,10 +181,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
157
181
|
};
|
|
158
182
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
159
183
|
case 1:
|
|
160
|
-
data = (
|
|
184
|
+
data = (_j.sent()).data;
|
|
161
185
|
if (!data.errors) {
|
|
162
186
|
thunkApi.dispatch(handleNextScreenStep());
|
|
163
|
-
(
|
|
187
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
|
|
164
188
|
}
|
|
165
189
|
return [2, { data: data, formData: params }];
|
|
166
190
|
}
|
|
@@ -186,7 +210,9 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
186
210
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
|
|
187
211
|
(_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
|
|
188
212
|
_h.label = 2;
|
|
189
|
-
case 2:
|
|
213
|
+
case 2:
|
|
214
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
215
|
+
return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
|
|
190
216
|
}
|
|
191
217
|
});
|
|
192
218
|
}); });
|
|
@@ -204,7 +230,7 @@ var initialState = {
|
|
|
204
230
|
},
|
|
205
231
|
individualData: {
|
|
206
232
|
sourceIncome: undefined,
|
|
207
|
-
monthlyIncome:
|
|
233
|
+
monthlyIncome: undefined,
|
|
208
234
|
employerName: '',
|
|
209
235
|
employerLocation: undefined,
|
|
210
236
|
isPEP: null,
|
|
@@ -295,12 +321,15 @@ export var individualSlice = createSlice({
|
|
|
295
321
|
var _a, _b;
|
|
296
322
|
state.loading = false;
|
|
297
323
|
state.error = null;
|
|
298
|
-
var
|
|
324
|
+
var _c = action.payload, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome;
|
|
299
325
|
var data = state.data.individualData.responseBody;
|
|
300
|
-
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [] });
|
|
326
|
+
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
|
|
301
327
|
var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
|
|
302
328
|
if (!!selectedSourceIncome)
|
|
303
329
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
330
|
+
var selectedMonthlyIncome = monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome[0];
|
|
331
|
+
if (!!selectedMonthlyIncome)
|
|
332
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
304
333
|
var location = (_b = (_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.country;
|
|
305
334
|
if (!!location) {
|
|
306
335
|
state.data.individualData.employerLocation = state.data.countries.find(function (country) { return country.iso2 === location; });
|
|
@@ -330,6 +359,26 @@ export var individualSlice = createSlice({
|
|
|
330
359
|
.addCase(updateIndividualInfo.rejected, function (state, action) {
|
|
331
360
|
state.loading = false;
|
|
332
361
|
state.error = action.error.message;
|
|
362
|
+
})
|
|
363
|
+
.addCase(retrieveEntityInfo.pending, function (state) {
|
|
364
|
+
state.error = null;
|
|
365
|
+
state.loading = true;
|
|
366
|
+
})
|
|
367
|
+
.addCase(retrieveEntityInfo.fulfilled, function (state, action) {
|
|
368
|
+
var _a;
|
|
369
|
+
state.error = null;
|
|
370
|
+
state.loading = false;
|
|
371
|
+
var data = (action.payload || {}).data;
|
|
372
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
373
|
+
if (description) {
|
|
374
|
+
state.error = description;
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
|
|
378
|
+
})
|
|
379
|
+
.addCase(retrieveEntityInfo.rejected, function (state, action) {
|
|
380
|
+
state.error = action.error.message;
|
|
381
|
+
state.loading = false;
|
|
333
382
|
})
|
|
334
383
|
.addCase(updateLeadSuccess.fulfilled, function (state, action) {
|
|
335
384
|
var _a;
|
|
@@ -11,6 +11,10 @@ export declare const verifyPasswordLeadOTP: import("@reduxjs/toolkit").AsyncThun
|
|
|
11
11
|
otp: string;
|
|
12
12
|
};
|
|
13
13
|
}, OTPFormValues, {}>;
|
|
14
|
+
export declare const createPassword: import("@reduxjs/toolkit").AsyncThunk<{
|
|
15
|
+
data: any;
|
|
16
|
+
formData: PasswordCreateFormValues;
|
|
17
|
+
}, PasswordCreateFormValues, {}>;
|
|
14
18
|
export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
15
19
|
response: any;
|
|
16
20
|
formData: void;
|