@redneckz/wildless-cms-uni-blocks 0.14.1040 → 0.14.1041

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 (57) hide show
  1. package/bundle/bundle.umd.js +49 -91
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/retail/api/getTaskById.d.ts +1 -1
  4. package/bundle/retail/utils/productTypeToTaskType.d.ts +3 -0
  5. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +16 -19
  6. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  7. package/dist/retail/api/getTaskById.d.ts +1 -1
  8. package/dist/retail/api/getTaskById.js +4 -1
  9. package/dist/retail/api/getTaskById.js.map +1 -1
  10. package/dist/retail/components/DraftDialog/utils.js +20 -18
  11. package/dist/retail/components/DraftDialog/utils.js.map +1 -1
  12. package/dist/retail/utils/productTypeToTaskType.d.ts +3 -0
  13. package/dist/retail/utils/productTypeToTaskType.js +13 -0
  14. package/dist/retail/utils/productTypeToTaskType.js.map +1 -0
  15. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +16 -19
  16. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  17. package/lib/retail/api/getTaskById.d.ts +1 -1
  18. package/lib/retail/api/getTaskById.js +4 -1
  19. package/lib/retail/api/getTaskById.js.map +1 -1
  20. package/lib/retail/components/DraftDialog/utils.js +20 -18
  21. package/lib/retail/components/DraftDialog/utils.js.map +1 -1
  22. package/lib/retail/utils/productTypeToTaskType.d.ts +3 -0
  23. package/lib/retail/utils/productTypeToTaskType.js +10 -0
  24. package/lib/retail/utils/productTypeToTaskType.js.map +1 -0
  25. package/mobile/bundle/bundle.umd.js +49 -91
  26. package/mobile/bundle/bundle.umd.min.js +1 -1
  27. package/mobile/bundle/retail/api/getTaskById.d.ts +1 -1
  28. package/mobile/bundle/retail/utils/productTypeToTaskType.d.ts +3 -0
  29. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +16 -19
  30. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  31. package/mobile/dist/retail/api/getTaskById.d.ts +1 -1
  32. package/mobile/dist/retail/api/getTaskById.js +4 -1
  33. package/mobile/dist/retail/api/getTaskById.js.map +1 -1
  34. package/mobile/dist/retail/components/DraftDialog/utils.js +20 -18
  35. package/mobile/dist/retail/components/DraftDialog/utils.js.map +1 -1
  36. package/mobile/dist/retail/utils/productTypeToTaskType.d.ts +3 -0
  37. package/mobile/dist/retail/utils/productTypeToTaskType.js +13 -0
  38. package/mobile/dist/retail/utils/productTypeToTaskType.js.map +1 -0
  39. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +16 -19
  40. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  41. package/mobile/lib/retail/api/getTaskById.d.ts +1 -1
  42. package/mobile/lib/retail/api/getTaskById.js +4 -1
  43. package/mobile/lib/retail/api/getTaskById.js.map +1 -1
  44. package/mobile/lib/retail/components/DraftDialog/utils.js +20 -18
  45. package/mobile/lib/retail/components/DraftDialog/utils.js.map +1 -1
  46. package/mobile/lib/retail/utils/productTypeToTaskType.d.ts +3 -0
  47. package/mobile/lib/retail/utils/productTypeToTaskType.js +10 -0
  48. package/mobile/lib/retail/utils/productTypeToTaskType.js.map +1 -0
  49. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +15 -24
  50. package/mobile/src/retail/api/getTaskById.ts +7 -2
  51. package/mobile/src/retail/components/DraftDialog/utils.ts +20 -18
  52. package/mobile/src/retail/utils/productTypeToTaskType.ts +13 -0
  53. package/package.json +1 -1
  54. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +15 -24
  55. package/src/retail/api/getTaskById.ts +7 -2
  56. package/src/retail/components/DraftDialog/utils.ts +20 -18
  57. package/src/retail/utils/productTypeToTaskType.ts +13 -0
@@ -130,23 +130,25 @@ export const getSelectValue = (
130
130
  };
131
131
 
132
132
  export const getProductData = (taskType?: DraftTaskType) => {
133
- if (taskType === 'debit') {
134
- return {
135
- nextStepLink: '/debit-card-lead',
136
- newTaskLink: '/natural/debetcards',
137
- description: 'На дебетовую карту',
138
- };
139
- } else if (taskType === 'credit') {
140
- return {
141
- nextStepLink: '/credit-lead',
142
- newTaskLink: '/natural/loans/all-goals',
143
- description: 'На получение кредита',
144
- };
133
+ switch (taskType) {
134
+ case 'debit':
135
+ return {
136
+ nextStepLink: '/debit-card-lead',
137
+ newTaskLink: '/natural/debetcards',
138
+ description: 'На дебетовую карту',
139
+ };
140
+ case 'credit':
141
+ return {
142
+ nextStepLink: '/credit-lead',
143
+ newTaskLink: '/natural/loans/all-goals',
144
+ description: 'На получение кредита',
145
+ };
146
+ case 'card':
147
+ default:
148
+ return {
149
+ nextStepLink: '/credit-card-lead',
150
+ newTaskLink: '/natural/creditcards/svoya',
151
+ description: 'На получение кредитной карты',
152
+ };
145
153
  }
146
-
147
- return {
148
- nextStepLink: '/credit-card-lead',
149
- newTaskLink: '/natural/creditcards/svoya',
150
- description: 'На получение кредитной карты',
151
- };
152
154
  };
@@ -0,0 +1,13 @@
1
+ import { type ProductType } from '../model/ApplicationLeadFormTypes';
2
+ import { type DraftTaskType } from '../model/DraftTaskType';
3
+
4
+ export const productTypeToTaskType = (productType: ProductType): DraftTaskType => {
5
+ if (productType === 'debitCard') {
6
+ return 'debit';
7
+ }
8
+ if (productType === 'creditCard') {
9
+ return 'card';
10
+ }
11
+
12
+ return 'credit';
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1040",
3
+ "version": "0.14.1041",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -8,7 +8,6 @@ import { createDraftTask } from '../../retail/api/createDraftTask';
8
8
  import { createParticipant } from '../../retail/api/createParticipant';
9
9
  import { createUserProfile } from '../../retail/api/createUserProfile';
10
10
  import { createUserTaskDebit } from '../../retail/api/createUserTaskDebit';
11
- import { type Task } from '../../retail/api/draftTasksKZO';
12
11
  import { getClaimChannel } from '../../retail/api/getClaimChannel';
13
12
  import { getLastTaskStatus } from '../../retail/api/getLastTaskStatus';
14
13
  import { getTaskById } from '../../retail/api/getTaskById';
@@ -18,7 +17,6 @@ import { updateUserTask } from '../../retail/api/updateUserTask';
18
17
  import { useConsentBkiDialog } from '../../retail/components/ConsentBkiDialog/useConsentBkiDialog';
19
18
  import { useDraftDialog } from '../../retail/components/DraftDialog/useDraftDialog';
20
19
  import { VerifyPhoneDialog } from '../../retail/components/VerifyPhoneDialog/VerifyPhoneDialog';
21
- import { useDraftSearch } from '../../retail/hooks/useDraftSearch';
22
20
  import {
23
21
  type CommonLeadProps,
24
22
  type ProductType,
@@ -26,9 +24,9 @@ import {
26
24
  type UpdateUserDataNewMicroserviceProps,
27
25
  type UpdateUserDataProps,
28
26
  } from '../../retail/model/ApplicationLeadFormTypes';
29
- import { type DraftTaskType } from '../../retail/model/DraftTaskType';
30
27
  import { type FormRetailConsents, type LeadFormState } from '../../retail/model/LeadFormState';
31
28
  import { getUpdateUserProfileData } from '../../retail/utils/getUpdateUserProfile';
29
+ import { productTypeToTaskType } from '../../retail/utils/productTypeToTaskType';
32
30
  import { useDialog } from '../../ui-kit/DialogManager/useDialog';
33
31
  import { formatPhone } from '../../utils/formatPhone';
34
32
  import { productTypeToConsentsMap } from './consents';
@@ -70,7 +68,6 @@ export const useApplicationLeadApi = ({
70
68
  const consentBkiDialog = useConsentBkiDialog(goToNextStep);
71
69
  const verifyPhoneDialog = useDialog(VerifyPhoneDialog);
72
70
  const draftDialog = useDraftDialog();
73
- const { searchDrafts } = useDraftSearch();
74
71
 
75
72
  const handleFailSendForm = () => {
76
73
  verifyPhoneDialog.close();
@@ -124,7 +121,7 @@ export const useApplicationLeadApi = ({
124
121
  draftDialog.open({
125
122
  task,
126
123
  isFromLead: true,
127
- taskType: productType === 'debitCard' ? 'debit' : 'credit',
124
+ taskType: productTypeToTaskType(productType),
128
125
  sendAspects,
129
126
  onClose: sendCurrentTask,
130
127
  });
@@ -199,7 +196,6 @@ export const useApplicationLeadApi = ({
199
196
  common,
200
197
  draftDialog,
201
198
  sendCurrentTask,
202
- searchDrafts,
203
199
  });
204
200
 
205
201
  const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
@@ -263,35 +259,30 @@ const createHandleSuccessVerifyNew =
263
259
  common,
264
260
  draftDialog,
265
261
  sendCurrentTask,
266
- searchDrafts,
267
262
  }: {
268
263
  common: CommonLeadProps;
269
264
  draftDialog: any;
270
265
  sendCurrentTask: () => Promise<void>;
271
- searchDrafts: () => Promise<{ draft: Task | null; taskType: DraftTaskType | undefined }>;
272
266
  }) =>
273
267
  async () => {
274
- const { verifyPhoneDialog, sendAspects, handleFailSendForm } = common;
268
+ const { verifyPhoneDialog, sendAspects, handleFailSendForm, userId, programId, productType } =
269
+ common;
275
270
  try {
276
- const { draft, taskType } = await searchDrafts();
277
-
278
- verifyPhoneDialog.close();
271
+ const lastTaskId = await getLastTaskStatus({ userId, programId });
279
272
 
280
- if (!draft) {
273
+ if (lastTaskId) {
274
+ const task = await getTaskById({ taskId: lastTaskId });
275
+ verifyPhoneDialog.close();
281
276
  draftDialog.open({
282
- task: undefined,
283
- taskType: null,
277
+ task,
278
+ isFromLead: true,
279
+ taskType: productTypeToTaskType(productType),
280
+ sendAspects,
281
+ onClose: sendCurrentTask,
284
282
  });
285
-
286
- return;
283
+ } else {
284
+ await sendCurrentTask();
287
285
  }
288
- draftDialog.open({
289
- task: draft,
290
- taskType,
291
- isFromLead: true,
292
- sendAspects,
293
- onClose: sendCurrentTask,
294
- });
295
286
  } catch {
296
287
  handleFailSendForm();
297
288
  }
@@ -1,12 +1,17 @@
1
+ import { checkNewMicroservice } from '../utils/checkNewMicroservice';
1
2
  import { fetchRetailJSON } from './doRequest';
2
3
  import { type Task } from './draftTasksKZO';
3
4
 
4
5
  type GetTaskByIdBody = {
5
- taskId: number;
6
+ taskId: string | number;
6
7
  };
7
8
 
8
9
  export const getTaskById = async (body: GetTaskByIdBody): Promise<Task | undefined> => {
9
- const res = await fetchRetailJSON<Task>('/user-data/getTaskById', 'POST', body);
10
+ const isNewMicroservice = checkNewMicroservice();
11
+
12
+ const endpoint = isNewMicroservice ? '/public-data/getTaskById' : '/user-data/getTaskById';
13
+
14
+ const res = await fetchRetailJSON<Task>(endpoint, 'POST', body);
10
15
 
11
16
  return res || undefined;
12
17
  };
@@ -130,23 +130,25 @@ export const getSelectValue = (
130
130
  };
131
131
 
132
132
  export const getProductData = (taskType?: DraftTaskType) => {
133
- if (taskType === 'debit') {
134
- return {
135
- nextStepLink: '/debit-card-lead',
136
- newTaskLink: '/natural/debetcards',
137
- description: 'На дебетовую карту',
138
- };
139
- } else if (taskType === 'credit') {
140
- return {
141
- nextStepLink: '/credit-lead',
142
- newTaskLink: '/natural/loans/all-goals',
143
- description: 'На получение кредита',
144
- };
133
+ switch (taskType) {
134
+ case 'debit':
135
+ return {
136
+ nextStepLink: '/debit-card-lead',
137
+ newTaskLink: '/natural/debetcards',
138
+ description: 'На дебетовую карту',
139
+ };
140
+ case 'credit':
141
+ return {
142
+ nextStepLink: '/credit-lead',
143
+ newTaskLink: '/natural/loans/all-goals',
144
+ description: 'На получение кредита',
145
+ };
146
+ case 'card':
147
+ default:
148
+ return {
149
+ nextStepLink: '/credit-card-lead',
150
+ newTaskLink: '/natural/creditcards/svoya',
151
+ description: 'На получение кредитной карты',
152
+ };
145
153
  }
146
-
147
- return {
148
- nextStepLink: '/credit-card-lead',
149
- newTaskLink: '/natural/creditcards/svoya',
150
- description: 'На получение кредитной карты',
151
- };
152
154
  };
@@ -0,0 +1,13 @@
1
+ import { type ProductType } from '../model/ApplicationLeadFormTypes';
2
+ import { type DraftTaskType } from '../model/DraftTaskType';
3
+
4
+ export const productTypeToTaskType = (productType: ProductType): DraftTaskType => {
5
+ if (productType === 'debitCard') {
6
+ return 'debit';
7
+ }
8
+ if (productType === 'creditCard') {
9
+ return 'card';
10
+ }
11
+
12
+ return 'credit';
13
+ };