@tap-payments/auth-jsconnect 2.8.24-test → 2.8.25-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.
- package/build/features/app/bank/bankStore.js +31 -25
- package/build/features/app/brand/brandStore.js +34 -28
- package/build/features/app/entity/entityStore.js +27 -25
- package/build/features/app/individual/individualStore.js +85 -75
- package/build/features/app/tax/taxStore.js +28 -22
- package/package.json +1 -1
|
@@ -55,10 +55,10 @@ import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, s
|
|
|
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, bankData, _b, config, country_code, step_name, bank_account_id, wallet_id, boardId, publicKey,
|
|
59
|
-
var _c, _d, _e, _f, _g;
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, bankData, _b, config, country_code, step_name, bank_account_id, wallet_id, boardId, publicKey, data_1;
|
|
59
|
+
var _c, _d, _e, _f, _g, _h;
|
|
60
|
+
return __generator(this, function (_j) {
|
|
61
|
+
switch (_j.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
64
64
|
notification: {
|
|
@@ -67,15 +67,14 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
67
67
|
}));
|
|
68
68
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
69
69
|
case 1:
|
|
70
|
-
data = (
|
|
70
|
+
data = (_j.sent()).data;
|
|
71
71
|
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
72
72
|
throw new Error(data.errors[0].description);
|
|
73
73
|
bankData = undefined;
|
|
74
74
|
_b = data || {}, config = _b.config, country_code = _b.country_code, step_name = _b.step_name, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id, boardId = _b.id;
|
|
75
75
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
76
|
+
if (country_code)
|
|
77
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
79
78
|
if (publicKey)
|
|
80
79
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
81
80
|
if (isInternally)
|
|
@@ -85,11 +84,13 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
85
84
|
return [3, 7];
|
|
86
85
|
case 2:
|
|
87
86
|
if (!(step_name === BANK_STEP_NAMES.BANK_INFO)) return [3, 7];
|
|
88
|
-
if (
|
|
87
|
+
if (!(!wallet_id || !country_code)) return [3, 4];
|
|
89
88
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
90
89
|
case 3:
|
|
91
|
-
data_1 =
|
|
92
|
-
if (!
|
|
90
|
+
data_1 = _j.sent();
|
|
91
|
+
if (!country_code && ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country))
|
|
92
|
+
thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
|
|
93
|
+
if (!((_h = (_g = (_f = (_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.business) === null || _e === void 0 ? void 0 : _e.entity) === null || _f === void 0 ? void 0 : _f.merchant) === null || _g === void 0 ? void 0 : _g.wallet) === null || _h === void 0 ? void 0 : _h.id))
|
|
93
94
|
throw new Error('wallet_id_missing');
|
|
94
95
|
if (data_1 === null || data_1 === void 0 ? void 0 : data_1.bank_account)
|
|
95
96
|
bankData = data_1.bank_account;
|
|
@@ -98,11 +99,11 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
98
99
|
if (!bank_account_id) return [3, 6];
|
|
99
100
|
return [4, API.entityService.retrieveBankAccount(bank_account_id)];
|
|
100
101
|
case 5:
|
|
101
|
-
bankData =
|
|
102
|
-
|
|
102
|
+
bankData = _j.sent();
|
|
103
|
+
_j.label = 6;
|
|
103
104
|
case 6:
|
|
104
105
|
thunkApi.dispatch(handleNextScreenStep());
|
|
105
|
-
|
|
106
|
+
_j.label = 7;
|
|
106
107
|
case 7: return [2, {
|
|
107
108
|
data: data,
|
|
108
109
|
bankData: bankData,
|
|
@@ -130,10 +131,10 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
|
|
|
130
131
|
});
|
|
131
132
|
}); });
|
|
132
133
|
export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
-
var _a, bank, settings, responseBody, payload, data, publicKey, _b, bank_account_id, wallet_id, boardId, bankData, data_2;
|
|
134
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
135
|
-
return __generator(this, function (
|
|
136
|
-
switch (
|
|
134
|
+
var _a, bank, settings, responseBody, payload, data, countryIso2, publicKey, _b, bank_account_id, wallet_id, boardId, bankData, data_2;
|
|
135
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
136
|
+
return __generator(this, function (_o) {
|
|
137
|
+
switch (_o.label) {
|
|
137
138
|
case 0:
|
|
138
139
|
_a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
|
|
139
140
|
responseBody = bank.data.verify.responseBody;
|
|
@@ -146,19 +147,24 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
146
147
|
};
|
|
147
148
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
148
149
|
case 1:
|
|
149
|
-
data = (
|
|
150
|
+
data = (_o.sent()).data;
|
|
150
151
|
if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
151
152
|
throw new Error(data.errors[0].description);
|
|
153
|
+
countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
|
|
152
154
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
155
|
+
if (countryIso2)
|
|
156
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
153
157
|
if (publicKey)
|
|
154
158
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
155
159
|
_b = data || {}, bank_account_id = _b.bank_account_id, wallet_id = _b.wallet_id, boardId = _b.id;
|
|
156
160
|
bankData = undefined;
|
|
157
|
-
if (
|
|
161
|
+
if (!(!wallet_id || !countryIso2)) return [3, 3];
|
|
158
162
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
159
163
|
case 2:
|
|
160
|
-
data_2 =
|
|
161
|
-
if (!
|
|
164
|
+
data_2 = _o.sent();
|
|
165
|
+
if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
|
|
166
|
+
thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
|
|
167
|
+
if (!((_k = (_j = (_h = (_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.business) === null || _g === void 0 ? void 0 : _g.entity) === null || _h === void 0 ? void 0 : _h.merchant) === null || _j === void 0 ? void 0 : _j.wallet) === null || _k === void 0 ? void 0 : _k.id))
|
|
162
168
|
throw new Error('wallet_id_missing');
|
|
163
169
|
if (data_2 === null || data_2 === void 0 ? void 0 : data_2.bank_account)
|
|
164
170
|
bankData = data_2.bank_account;
|
|
@@ -167,10 +173,10 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
167
173
|
if (!bank_account_id) return [3, 5];
|
|
168
174
|
return [4, API.entityService.retrieveBankAccount(bank_account_id)];
|
|
169
175
|
case 4:
|
|
170
|
-
bankData =
|
|
171
|
-
|
|
176
|
+
bankData = _o.sent();
|
|
177
|
+
_o.label = 5;
|
|
172
178
|
case 5:
|
|
173
|
-
(
|
|
179
|
+
(_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
|
|
174
180
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
175
181
|
return [2, {
|
|
176
182
|
data: data,
|
|
@@ -66,10 +66,10 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retr
|
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', 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,
|
|
70
|
-
var _c, _d;
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
69
|
+
var payload, data, _b, config, brand_id, entity_id, board_id, country_code, publicKey, salesChannels, brandData, data_1;
|
|
70
|
+
var _c, _d, _e;
|
|
71
|
+
return __generator(this, function (_f) {
|
|
72
|
+
switch (_f.label) {
|
|
73
73
|
case 0:
|
|
74
74
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
75
75
|
notification: {
|
|
@@ -78,37 +78,38 @@ export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function
|
|
|
78
78
|
}));
|
|
79
79
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
80
80
|
case 1:
|
|
81
|
-
data = (
|
|
81
|
+
data = (_f.sent()).data;
|
|
82
82
|
if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
83
83
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
84
|
-
|
|
85
|
-
if (countryIso2)
|
|
86
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
|
-
_b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id;
|
|
84
|
+
_b = data || {}, config = _b.config, brand_id = _b.brand_id, entity_id = _b.entity_id, board_id = _b.id, country_code = _b.country_code;
|
|
88
85
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
86
|
+
if (country_code)
|
|
87
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
89
88
|
if (publicKey)
|
|
90
89
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
91
90
|
brandData = undefined;
|
|
92
91
|
if (isInternally)
|
|
93
92
|
data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
|
|
94
93
|
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
|
|
95
|
-
if (
|
|
94
|
+
if (!(!brand_id || !country_code)) return [3, 3];
|
|
96
95
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
97
96
|
case 2:
|
|
98
|
-
data_1 =
|
|
99
|
-
if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.
|
|
97
|
+
data_1 = _f.sent();
|
|
98
|
+
if (!country_code && ((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.country))
|
|
99
|
+
thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
|
|
100
|
+
if (!((_e = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand) === null || _e === void 0 ? void 0 : _e.id))
|
|
100
101
|
throw new Error('brand_id_missing');
|
|
101
102
|
brandData = data_1 === null || data_1 === void 0 ? void 0 : data_1.brand;
|
|
102
103
|
return [3, 5];
|
|
103
104
|
case 3: return [4, API.brandService.retrieveBrand(brand_id)];
|
|
104
105
|
case 4:
|
|
105
|
-
brandData =
|
|
106
|
-
|
|
106
|
+
brandData = _f.sent();
|
|
107
|
+
_f.label = 5;
|
|
107
108
|
case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
108
109
|
case 6:
|
|
109
|
-
salesChannels =
|
|
110
|
+
salesChannels = _f.sent();
|
|
110
111
|
thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
|
|
111
|
-
|
|
112
|
+
_f.label = 7;
|
|
112
113
|
case 7: return [2, {
|
|
113
114
|
data: data,
|
|
114
115
|
brandData: brandData === null || brandData === void 0 ? void 0 : brandData.brand,
|
|
@@ -138,10 +139,10 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
138
139
|
});
|
|
139
140
|
}); });
|
|
140
141
|
export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
-
var _a, brand, settings, responseBody, payload, data, publicKey, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
|
|
142
|
-
var _c, _d, _e, _f, _g, _h;
|
|
143
|
-
return __generator(this, function (
|
|
144
|
-
switch (
|
|
142
|
+
var _a, brand, settings, responseBody, payload, data, publicKey, countryIso2, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
|
|
143
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
144
|
+
return __generator(this, function (_k) {
|
|
145
|
+
switch (_k.label) {
|
|
145
146
|
case 0:
|
|
146
147
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
147
148
|
responseBody = brand.data.verify.responseBody;
|
|
@@ -154,30 +155,35 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
|
|
|
154
155
|
};
|
|
155
156
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
156
157
|
case 1:
|
|
157
|
-
data = (
|
|
158
|
+
data = (_k.sent()).data;
|
|
158
159
|
if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
159
160
|
throw new Error(data.errors[0].description);
|
|
160
161
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
162
|
+
countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
|
|
161
163
|
if (publicKey)
|
|
162
164
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
165
|
+
if (countryIso2)
|
|
166
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
163
167
|
_b = data || {}, brand_id = _b.brand_id, entity_id = _b.entity_id, boardId = _b.id;
|
|
164
168
|
brandData = undefined;
|
|
165
|
-
if (
|
|
169
|
+
if (!(!brand_id || !countryIso2)) return [3, 3];
|
|
166
170
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
167
171
|
case 2:
|
|
168
|
-
data_2 =
|
|
169
|
-
if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.
|
|
172
|
+
data_2 = _k.sent();
|
|
173
|
+
if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
|
|
174
|
+
thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
|
|
175
|
+
if (!((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _g === void 0 ? void 0 : _g.id))
|
|
170
176
|
throw new Error('brand_id_missing');
|
|
171
177
|
brandData = data_2;
|
|
172
178
|
return [3, 5];
|
|
173
179
|
case 3: return [4, API.brandService.retrieveBrand(brand_id)];
|
|
174
180
|
case 4:
|
|
175
|
-
brandData =
|
|
176
|
-
|
|
181
|
+
brandData = _k.sent();
|
|
182
|
+
_k.label = 5;
|
|
177
183
|
case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
178
184
|
case 6:
|
|
179
|
-
salesChannels =
|
|
180
|
-
(
|
|
185
|
+
salesChannels = _k.sent();
|
|
186
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
|
|
181
187
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
182
188
|
return [2, {
|
|
183
189
|
data: data,
|
|
@@ -67,8 +67,8 @@ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedVal
|
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
-
var payload, data, entityData, entityTypes,
|
|
71
|
-
var
|
|
70
|
+
var payload, data, entityData, entityTypes, _b, country_code, config, publicKey, _c, entity_id, boardId, data_1;
|
|
71
|
+
var _d, _e, _f;
|
|
72
72
|
return __generator(this, function (_g) {
|
|
73
73
|
switch (_g.label) {
|
|
74
74
|
case 0:
|
|
@@ -80,19 +80,19 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
80
80
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
81
81
|
case 1:
|
|
82
82
|
data = (_g.sent()).data;
|
|
83
|
-
|
|
84
|
-
if (((
|
|
83
|
+
entityTypes = undefined;
|
|
84
|
+
if (((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
85
85
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
86
86
|
if (isInternally)
|
|
87
87
|
data.step_name = ENTITY_STEP_NAMES.ENTITY_INFO;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
_b = data || {}, country_code = _b.country_code, config = _b.config;
|
|
89
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
90
|
+
if (country_code)
|
|
91
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
92
92
|
if (publicKey)
|
|
93
93
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
94
94
|
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 7];
|
|
95
|
-
|
|
95
|
+
_c = data || {}, entity_id = _c.entity_id, boardId = _c.id;
|
|
96
96
|
if (!!entity_id) return [3, 3];
|
|
97
97
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
98
98
|
case 2:
|
|
@@ -106,11 +106,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
106
106
|
entityData = _g.sent();
|
|
107
107
|
_g.label = 5;
|
|
108
108
|
case 5:
|
|
109
|
-
if (!
|
|
110
|
-
|
|
111
|
-
if (countryIso2)
|
|
112
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
113
|
-
}
|
|
109
|
+
if (!country_code && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
|
|
110
|
+
thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
|
|
114
111
|
return [4, API.entityService.retrieveEntityType()];
|
|
115
112
|
case 6:
|
|
116
113
|
entityTypes = _g.sent();
|
|
@@ -144,10 +141,10 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
144
141
|
});
|
|
145
142
|
}); });
|
|
146
143
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
-
var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, entityData, publicKey, data_2, entityTypes;
|
|
148
|
-
var _c, _d, _e, _f, _g;
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
144
|
+
var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, country_code, entityData, publicKey, countryIso2, data_2, entityTypes;
|
|
145
|
+
var _c, _d, _e, _f, _g, _h;
|
|
146
|
+
return __generator(this, function (_j) {
|
|
147
|
+
switch (_j.label) {
|
|
151
148
|
case 0:
|
|
152
149
|
_a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
|
|
153
150
|
responseBody = entity.data.verify.responseBody;
|
|
@@ -160,31 +157,36 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
160
157
|
};
|
|
161
158
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
162
159
|
case 1:
|
|
163
|
-
data = (
|
|
160
|
+
data = (_j.sent()).data;
|
|
164
161
|
if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
165
162
|
throw new Error(data.errors[0].description);
|
|
166
|
-
_b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id;
|
|
163
|
+
_b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id, country_code = _b.country_code;
|
|
167
164
|
entityData = undefined;
|
|
168
165
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
166
|
+
countryIso2 = country_code || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
|
|
169
167
|
if (publicKey)
|
|
170
168
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
169
|
+
if (countryIso2)
|
|
170
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
171
171
|
if (!!entity_id) return [3, 3];
|
|
172
172
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
173
173
|
case 2:
|
|
174
|
-
data_2 =
|
|
174
|
+
data_2 = _j.sent();
|
|
175
175
|
if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
|
|
176
176
|
throw new Error('entity_id_missing');
|
|
177
177
|
entityData = data_2;
|
|
178
178
|
return [3, 5];
|
|
179
179
|
case 3: return [4, API.entityService.retrieveEntity(entity_id)];
|
|
180
180
|
case 4:
|
|
181
|
-
entityData =
|
|
182
|
-
|
|
181
|
+
entityData = _j.sent();
|
|
182
|
+
_j.label = 5;
|
|
183
183
|
case 5:
|
|
184
|
-
(
|
|
184
|
+
if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
|
|
185
|
+
thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
|
|
186
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
185
187
|
return [4, API.entityService.retrieveEntityType()];
|
|
186
188
|
case 6:
|
|
187
|
-
entityTypes =
|
|
189
|
+
entityTypes = _j.sent();
|
|
188
190
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
|
|
189
191
|
return [2, {
|
|
190
192
|
data: data,
|
|
@@ -75,10 +75,10 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
|
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
-
var settings, payload, data, userList, recipientData, countries, countryCode, publicKey,
|
|
79
|
-
var
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
switch (
|
|
78
|
+
var settings, payload, data, userList, recipientData, countries, _b, country_code, config, boardId, countryCode, publicKey, data_1, _c, business_id, recipient, board_id, board_info_id, notification, _d, id_1, type, individualData, birthCountry;
|
|
79
|
+
var _e, _f, _g, _h;
|
|
80
|
+
return __generator(this, function (_j) {
|
|
81
|
+
switch (_j.label) {
|
|
82
82
|
case 0:
|
|
83
83
|
settings = thunkApi.getState().settings;
|
|
84
84
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
@@ -88,77 +88,87 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
88
88
|
}));
|
|
89
89
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
90
90
|
case 1:
|
|
91
|
-
data = (
|
|
91
|
+
data = (_j.sent()).data;
|
|
92
92
|
recipientData = undefined;
|
|
93
93
|
countries = settings.data.countries;
|
|
94
|
-
if (((
|
|
94
|
+
if (((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
95
95
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
96
96
|
if (isInternally)
|
|
97
97
|
data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
_b = data || {}, country_code = _b.country_code, config = _b.config, boardId = _b.id;
|
|
99
|
+
countryCode = country_code;
|
|
100
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
101
|
+
if (country_code)
|
|
102
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
102
103
|
if (publicKey)
|
|
103
104
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
return [3, 16];
|
|
105
|
+
if (!!country_code) return [3, 3];
|
|
106
|
+
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
107
107
|
case 2:
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
data_1 = _j.sent();
|
|
109
|
+
countryCode = (_f = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
110
|
+
if (countryCode)
|
|
111
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
112
|
+
_j.label = 3;
|
|
113
|
+
case 3:
|
|
114
|
+
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 4];
|
|
115
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
116
|
+
return [3, 18];
|
|
117
|
+
case 4:
|
|
118
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 17];
|
|
119
|
+
_c = data || {}, business_id = _c.business_id, recipient = _c.recipient, board_id = _c.id, board_info_id = _c.board_info_id;
|
|
110
120
|
recipientData = recipient;
|
|
111
|
-
if (!!((
|
|
112
|
-
if (!(board_id && board_info_id)) return [3,
|
|
121
|
+
if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 6];
|
|
122
|
+
if (!(board_id && board_info_id)) return [3, 6];
|
|
113
123
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
114
|
-
case
|
|
115
|
-
notification = (
|
|
124
|
+
case 5:
|
|
125
|
+
notification = (_j.sent()).notification;
|
|
116
126
|
recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
|
|
117
127
|
if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
|
|
118
128
|
throw new Error('individual_id_missing');
|
|
119
|
-
|
|
120
|
-
case 4:
|
|
121
|
-
_c = recipientData || {}, id_1 = _c.id, type = _c.type;
|
|
122
|
-
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
|
|
123
|
-
case 5:
|
|
124
|
-
individualData = (_h.sent()).data;
|
|
125
|
-
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 8];
|
|
126
|
-
if (!business_id) return [3, 7];
|
|
127
|
-
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
129
|
+
_j.label = 6;
|
|
128
130
|
case 6:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
_d = recipientData || {}, id_1 = _d.id, type = _d.type;
|
|
132
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
|
|
131
133
|
case 7:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return [3,
|
|
135
|
-
case 8:
|
|
136
|
-
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
137
|
-
if (!business_id) return [3, 10];
|
|
134
|
+
individualData = (_j.sent()).data;
|
|
135
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
|
|
136
|
+
if (!business_id) return [3, 9];
|
|
138
137
|
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
138
|
+
case 8:
|
|
139
|
+
userList = _j.sent();
|
|
140
|
+
_j.label = 9;
|
|
139
141
|
case 9:
|
|
140
|
-
userList =
|
|
141
|
-
_h.label = 10;
|
|
142
|
-
case 10:
|
|
142
|
+
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
|
|
143
143
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
144
|
-
return [3,
|
|
144
|
+
return [3, 16];
|
|
145
|
+
case 10:
|
|
146
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 13];
|
|
147
|
+
if (!business_id) return [3, 12];
|
|
148
|
+
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
145
149
|
case 11:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
150
|
+
userList = _j.sent();
|
|
151
|
+
_j.label = 12;
|
|
149
152
|
case 12:
|
|
150
|
-
|
|
151
|
-
|
|
153
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
154
|
+
return [3, 16];
|
|
152
155
|
case 13:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
|
|
157
|
+
if (!birthCountry) return [3, 15];
|
|
158
|
+
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
159
|
+
case 14:
|
|
160
|
+
_j.sent();
|
|
161
|
+
_j.label = 15;
|
|
156
162
|
case 15:
|
|
163
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
164
|
+
_j.label = 16;
|
|
165
|
+
case 16: return [3, 18];
|
|
166
|
+
case 17:
|
|
157
167
|
if (isUpdatePhoneInfo) {
|
|
158
168
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
159
169
|
}
|
|
160
|
-
|
|
161
|
-
case
|
|
170
|
+
_j.label = 18;
|
|
171
|
+
case 18: return [2, {
|
|
162
172
|
data: data,
|
|
163
173
|
countries: countries,
|
|
164
174
|
countryCode: countryCode,
|
|
@@ -225,7 +235,7 @@ export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', func
|
|
|
225
235
|
});
|
|
226
236
|
}); });
|
|
227
237
|
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
228
|
-
var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody,
|
|
238
|
+
var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_2, user_1, payload, data;
|
|
229
239
|
var _c;
|
|
230
240
|
return __generator(this, function (_d) {
|
|
231
241
|
switch (_d.label) {
|
|
@@ -255,8 +265,8 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
255
265
|
};
|
|
256
266
|
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
257
267
|
case 1:
|
|
258
|
-
|
|
259
|
-
user_1 = (sortUserList(mapUserList(
|
|
268
|
+
data_2 = _d.sent();
|
|
269
|
+
user_1 = (sortUserList(mapUserList(data_2 === null || data_2 === void 0 ? void 0 : data_2.individuals)) || [])[0];
|
|
260
270
|
individualData = user_1;
|
|
261
271
|
_d.label = 2;
|
|
262
272
|
case 2:
|
|
@@ -399,7 +409,7 @@ export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatu
|
|
|
399
409
|
export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (_a, thunkApi) {
|
|
400
410
|
var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
|
|
401
411
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
402
|
-
var _b, individual, settings, individualData, _c, user, data,
|
|
412
|
+
var _b, individual, settings, individualData, _c, user, data, data_3, data_state;
|
|
403
413
|
var _d, _e, _f;
|
|
404
414
|
return __generator(this, function (_g) {
|
|
405
415
|
switch (_g.label) {
|
|
@@ -416,8 +426,8 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
416
426
|
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && id && type)) return [3, 4];
|
|
417
427
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: settings.data.businessCountry.iso2 })).unwrap()];
|
|
418
428
|
case 3:
|
|
419
|
-
|
|
420
|
-
individualData =
|
|
429
|
+
data_3 = (_g.sent()).data;
|
|
430
|
+
individualData = data_3;
|
|
421
431
|
_g.label = 4;
|
|
422
432
|
case 4:
|
|
423
433
|
data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && (data === null || data === void 0 ? void 0 : data.individuals) ? data === null || data === void 0 ? void 0 : data.individuals : individualData) || {}).data_state;
|
|
@@ -432,9 +442,9 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
432
442
|
});
|
|
433
443
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
434
444
|
var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
|
|
435
|
-
var _d, _e, _f, _g, _h, _j, _k;
|
|
436
|
-
return __generator(this, function (
|
|
437
|
-
switch (
|
|
445
|
+
var _d, _e, _f, _g, _h, _j, _k, _l;
|
|
446
|
+
return __generator(this, function (_m) {
|
|
447
|
+
switch (_m.label) {
|
|
438
448
|
case 0:
|
|
439
449
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
440
450
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -448,38 +458,38 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
448
458
|
};
|
|
449
459
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
450
460
|
case 1:
|
|
451
|
-
data = (
|
|
461
|
+
data = (_m.sent()).data;
|
|
452
462
|
recipientData = undefined;
|
|
453
463
|
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
454
464
|
throw new Error(data.errors[0].description);
|
|
455
465
|
publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
|
|
466
|
+
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
456
467
|
if (publicKey)
|
|
457
468
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
458
|
-
|
|
459
|
-
if (countryCode)
|
|
469
|
+
if (!((_g = settings.data.businessCountry) === null || _g === void 0 ? void 0 : _g.iso2) && countryCode)
|
|
460
470
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
461
471
|
_b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
462
472
|
recipientData = recipient;
|
|
463
|
-
if (!!((
|
|
473
|
+
if (!!((_h = data === null || data === void 0 ? void 0 : data.recipient) === null || _h === void 0 ? void 0 : _h.id)) return [3, 3];
|
|
464
474
|
if (!(board_id && board_info_id)) return [3, 3];
|
|
465
475
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
466
476
|
case 2:
|
|
467
|
-
notification = (
|
|
477
|
+
notification = (_m.sent()).notification;
|
|
468
478
|
recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
|
|
469
479
|
if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
|
|
470
480
|
throw new Error('individual_id_missing');
|
|
471
|
-
|
|
481
|
+
_m.label = 3;
|
|
472
482
|
case 3:
|
|
473
483
|
_c = recipientData || {}, id = _c.id, type = _c.type;
|
|
474
484
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
475
485
|
case 4:
|
|
476
|
-
individualData = (
|
|
486
|
+
individualData = (_m.sent()).data;
|
|
477
487
|
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
|
|
478
488
|
if (!business_id) return [3, 6];
|
|
479
489
|
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
480
490
|
case 5:
|
|
481
|
-
userList =
|
|
482
|
-
|
|
491
|
+
userList = _m.sent();
|
|
492
|
+
_m.label = 6;
|
|
483
493
|
case 6:
|
|
484
494
|
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
|
|
485
495
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
@@ -489,23 +499,23 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
489
499
|
if (!business_id) return [3, 9];
|
|
490
500
|
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
491
501
|
case 8:
|
|
492
|
-
userList =
|
|
493
|
-
|
|
502
|
+
userList = _m.sent();
|
|
503
|
+
_m.label = 9;
|
|
494
504
|
case 9:
|
|
495
505
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
496
506
|
return [3, 13];
|
|
497
507
|
case 10:
|
|
498
|
-
birthCountry = ((
|
|
508
|
+
birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
|
|
499
509
|
if (!birthCountry) return [3, 12];
|
|
500
510
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
501
511
|
case 11:
|
|
502
|
-
|
|
503
|
-
|
|
512
|
+
_m.sent();
|
|
513
|
+
_m.label = 12;
|
|
504
514
|
case 12:
|
|
505
515
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
506
|
-
|
|
516
|
+
_m.label = 13;
|
|
507
517
|
case 13:
|
|
508
|
-
(
|
|
518
|
+
(_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
|
|
509
519
|
return [2, {
|
|
510
520
|
data: data,
|
|
511
521
|
countries: countries,
|
|
@@ -55,10 +55,10 @@ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividu
|
|
|
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, entityData, _b, config, country_code, entity_id, boardId, publicKey,
|
|
59
|
-
var _c, _d;
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, entityData, _b, config, country_code, entity_id, boardId, publicKey, data_1;
|
|
59
|
+
var _c, _d, _e;
|
|
60
|
+
return __generator(this, function (_f) {
|
|
61
|
+
switch (_f.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
64
64
|
notification: {
|
|
@@ -67,7 +67,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
67
67
|
}));
|
|
68
68
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
69
69
|
case 1:
|
|
70
|
-
data = (
|
|
70
|
+
data = (_f.sent()).data;
|
|
71
71
|
entityData = undefined;
|
|
72
72
|
if (((_c = data === null || data === void 0 ? void 0 : data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
73
73
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
@@ -77,9 +77,8 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
77
77
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
78
78
|
if (publicKey)
|
|
79
79
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
80
|
+
if (country_code)
|
|
81
|
+
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
83
82
|
if (!(data.step_name === TAX_STEP_NAMES.PHONE_AUTH)) return [3, 2];
|
|
84
83
|
thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
|
|
85
84
|
return [3, 7];
|
|
@@ -88,18 +87,20 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
88
87
|
if (!!entity_id) return [3, 4];
|
|
89
88
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
90
89
|
case 3:
|
|
91
|
-
data_1 =
|
|
90
|
+
data_1 = _f.sent();
|
|
92
91
|
if (!((_d = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _d === void 0 ? void 0 : _d.id))
|
|
93
92
|
throw new Error('entity_id_missing');
|
|
94
93
|
entityData = data_1;
|
|
95
94
|
return [3, 6];
|
|
96
95
|
case 4: return [4, API.entityService.retrieveEntity(entity_id)];
|
|
97
96
|
case 5:
|
|
98
|
-
entityData =
|
|
99
|
-
|
|
97
|
+
entityData = _f.sent();
|
|
98
|
+
_f.label = 6;
|
|
100
99
|
case 6:
|
|
100
|
+
if (!country_code && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
|
|
101
|
+
thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
|
|
101
102
|
thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
|
|
102
|
-
|
|
103
|
+
_f.label = 7;
|
|
103
104
|
case 7: return [2, {
|
|
104
105
|
data: data,
|
|
105
106
|
entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
@@ -173,10 +174,10 @@ export var retrieveBoardDetails = createAsyncThunk('tax/retrieveBrandInfo', func
|
|
|
173
174
|
});
|
|
174
175
|
});
|
|
175
176
|
export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, boardId, entityData, publicKey, data_2;
|
|
177
|
-
var _c, _d, _e, _f, _g;
|
|
178
|
-
return __generator(this, function (
|
|
179
|
-
switch (
|
|
177
|
+
var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, boardId, country_code, entityData, publicKey, countryIso2, data_2;
|
|
178
|
+
var _c, _d, _e, _f, _g, _h;
|
|
179
|
+
return __generator(this, function (_j) {
|
|
180
|
+
switch (_j.label) {
|
|
180
181
|
case 0:
|
|
181
182
|
_a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
|
|
182
183
|
responseBody = tax.data.verify.responseBody;
|
|
@@ -189,28 +190,33 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
189
190
|
};
|
|
190
191
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
191
192
|
case 1:
|
|
192
|
-
data = (
|
|
193
|
+
data = (_j.sent()).data;
|
|
193
194
|
if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
194
195
|
throw new Error(data.errors[0].description);
|
|
195
|
-
_b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id;
|
|
196
|
+
_b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id, country_code = _b.country_code;
|
|
196
197
|
entityData = undefined;
|
|
197
198
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
199
|
+
countryIso2 = country_code || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
|
|
198
200
|
if (publicKey)
|
|
199
201
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
202
|
+
if (countryIso2)
|
|
203
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
200
204
|
if (!!entity_id) return [3, 3];
|
|
201
205
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
202
206
|
case 2:
|
|
203
|
-
data_2 =
|
|
207
|
+
data_2 = _j.sent();
|
|
204
208
|
if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
|
|
205
209
|
throw new Error('entity_id_missing');
|
|
206
210
|
entityData = data_2;
|
|
207
211
|
return [3, 5];
|
|
208
212
|
case 3: return [4, API.entityService.retrieveEntity(entity_id)];
|
|
209
213
|
case 4:
|
|
210
|
-
entityData =
|
|
211
|
-
|
|
214
|
+
entityData = _j.sent();
|
|
215
|
+
_j.label = 5;
|
|
212
216
|
case 5:
|
|
213
|
-
(
|
|
217
|
+
if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
|
|
218
|
+
thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
|
|
219
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
214
220
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
|
|
215
221
|
return [2, { data: data, entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity, formData: params }];
|
|
216
222
|
}
|