@redneckz/wildless-cms-uni-blocks 0.14.1070 → 0.14.1072

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 (49) hide show
  1. package/bundle/bundle.umd.js +47 -24
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  4. package/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  5. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  6. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  7. package/dist/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  8. package/dist/components/Header/HeaderQuickActionsMenu.js +11 -0
  9. package/dist/components/Header/HeaderQuickActionsMenu.js.map +1 -1
  10. package/dist/retail/api/createParticipant.js +1 -1
  11. package/dist/retail/api/createParticipant.js.map +1 -1
  12. package/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  13. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  14. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  15. package/lib/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  16. package/lib/components/Header/HeaderQuickActionsMenu.js +11 -0
  17. package/lib/components/Header/HeaderQuickActionsMenu.js.map +1 -1
  18. package/lib/retail/api/createParticipant.js +1 -1
  19. package/lib/retail/api/createParticipant.js.map +1 -1
  20. package/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  21. package/mobile/bundle/bundle.umd.js +47 -24
  22. package/mobile/bundle/bundle.umd.min.js +1 -1
  23. package/mobile/bundle/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  24. package/mobile/bundle/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  25. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  26. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  27. package/mobile/dist/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  28. package/mobile/dist/components/Header/HeaderQuickActionsMenu.js +11 -0
  29. package/mobile/dist/components/Header/HeaderQuickActionsMenu.js.map +1 -1
  30. package/mobile/dist/retail/api/createParticipant.js +1 -1
  31. package/mobile/dist/retail/api/createParticipant.js.map +1 -1
  32. package/mobile/dist/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  33. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +34 -22
  34. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  35. package/mobile/lib/components/Header/HeaderQuickActionsMenu.d.ts +1 -0
  36. package/mobile/lib/components/Header/HeaderQuickActionsMenu.js +11 -0
  37. package/mobile/lib/components/Header/HeaderQuickActionsMenu.js.map +1 -1
  38. package/mobile/lib/retail/api/createParticipant.js +1 -1
  39. package/mobile/lib/retail/api/createParticipant.js.map +1 -1
  40. package/mobile/lib/retail/model/ApplicationLeadFormTypes.d.ts +1 -1
  41. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
  42. package/mobile/src/components/Header/HeaderQuickActionsMenu.tsx +12 -0
  43. package/mobile/src/retail/api/createParticipant.ts +1 -1
  44. package/mobile/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
  45. package/package.json +1 -1
  46. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +47 -28
  47. package/src/components/Header/HeaderQuickActionsMenu.tsx +12 -0
  48. package/src/retail/api/createParticipant.ts +1 -1
  49. package/src/retail/model/ApplicationLeadFormTypes.ts +1 -1
@@ -29,7 +29,7 @@ export interface CommonLeadProps {
29
29
  }
30
30
 
31
31
  export interface TaskDataProps {
32
- participantId: string | number;
32
+ participantId?: string | number;
33
33
  formData: LeadFormState;
34
34
  referalData: ReferalData | null;
35
35
  marketingInfo: MarketingInfo | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1070",
3
+ "version": "0.14.1072",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -152,26 +152,11 @@ export const useApplicationLeadApi = ({
152
152
  try {
153
153
  startSending();
154
154
  const transformedFormData = transformFormData(formData);
155
- const participantData = await createParticipant({
156
- phone: formatPhone(transformedFormData.phone as string),
157
- email: transformedFormData.email as string,
158
- });
159
-
160
155
  const referalData = leadFormStore.referalData;
161
156
  const marketingInfo = sessionStore.marketingInfo;
162
157
 
163
- if (!participantData) {
164
- throw new Error();
165
- }
166
-
167
- const { participantId, userId } = participantData;
168
-
169
- if (!participantId) {
170
- throw new Error();
171
- }
172
158
  const common: CommonLeadProps = {
173
159
  programId,
174
- userId,
175
160
  productType,
176
161
  sendAspects,
177
162
  verifyPhoneDialog,
@@ -179,23 +164,17 @@ export const useApplicationLeadApi = ({
179
164
  };
180
165
 
181
166
  const taskData: TaskDataProps = {
182
- participantId,
183
167
  formData: transformedFormData,
184
168
  referalData,
185
169
  marketingInfo,
186
170
  saveUserData,
187
171
  };
188
172
 
189
- const sendCurrentTask = createSendCurrentTaskNew({
190
- common,
191
- taskData,
192
- consentBkiDialog,
193
- });
194
-
195
173
  const handleSuccessVerify = createHandleSuccessVerifyNew({
196
174
  common,
175
+ taskData,
197
176
  draftDialog,
198
- sendCurrentTask,
177
+ consentBkiDialog,
199
178
  });
200
179
 
201
180
  const acceptedConsents = getAcceptedConsents(transformedFormData, productType);
@@ -233,6 +212,11 @@ const createSendCurrentTaskNew =
233
212
  const { programId, userId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } =
234
213
  common;
235
214
  const { participantId, formData, referalData, marketingInfo, saveUserData } = taskData;
215
+
216
+ if (!participantId) {
217
+ throw new Error();
218
+ }
219
+
236
220
  const taskId = await updateUserDataNewMicroservice({
237
221
  programId,
238
222
  participantId,
@@ -257,17 +241,51 @@ const createSendCurrentTaskNew =
257
241
  const createHandleSuccessVerifyNew =
258
242
  ({
259
243
  common,
244
+ taskData,
260
245
  draftDialog,
261
- sendCurrentTask,
246
+ consentBkiDialog,
262
247
  }: {
263
248
  common: CommonLeadProps;
249
+ taskData: TaskDataProps;
264
250
  draftDialog: any;
265
- sendCurrentTask: () => Promise<void>;
251
+ consentBkiDialog: ReturnType<typeof useConsentBkiDialog>;
266
252
  }) =>
267
253
  async () => {
268
- const { verifyPhoneDialog, sendAspects, handleFailSendForm, userId, programId, productType } =
269
- common;
254
+ const { programId, productType, sendAspects, verifyPhoneDialog, handleFailSendForm } = common;
255
+ const { formData } = taskData;
256
+
270
257
  try {
258
+ const participantData = await createParticipant({
259
+ phone: formatPhone(formData.phone as string),
260
+ email: formData.email as string,
261
+ });
262
+
263
+ if (!participantData) {
264
+ throw new Error();
265
+ }
266
+
267
+ const { participantId, userId } = participantData;
268
+
269
+ if (!participantId) {
270
+ throw new Error();
271
+ }
272
+
273
+ const updatedCommon: CommonLeadProps = {
274
+ ...common,
275
+ userId,
276
+ };
277
+
278
+ const updatedTaskData: TaskDataProps = {
279
+ ...taskData,
280
+ participantId,
281
+ };
282
+
283
+ const sendCurrentTask = createSendCurrentTaskNew({
284
+ common: updatedCommon,
285
+ taskData: updatedTaskData,
286
+ consentBkiDialog,
287
+ });
288
+
271
289
  const lastTaskId = await getLastTaskStatus({ userId, programId });
272
290
 
273
291
  if (lastTaskId) {
@@ -283,7 +301,8 @@ const createHandleSuccessVerifyNew =
283
301
  } else {
284
302
  await sendCurrentTask();
285
303
  }
286
- } catch {
304
+ } catch (error) {
305
+ console.error('Error in handleSuccessVerify:', error);
287
306
  handleFailSendForm();
288
307
  }
289
308
  };
@@ -96,6 +96,13 @@ const renderQuickActionsDropdown = ({
96
96
  },
97
97
  text: 'Написать в чат',
98
98
  },
99
+ phone: {
100
+ handler: (ev: PreventableEventWithTarget) => {
101
+ handlers?.phone(ev);
102
+ closeDropdown();
103
+ },
104
+ text: 'Позвонить в Банк',
105
+ },
99
106
  };
100
107
 
101
108
  return (
@@ -127,8 +134,13 @@ export const useHandlers = () => {
127
134
  }
128
135
  }, []);
129
136
 
137
+ const handlePhoneClick = useCallback(() => {
138
+ globalThis.location.href = 'tel:88001007870';
139
+ }, []);
140
+
130
141
  return {
131
142
  call: handleCallClick,
132
143
  chat: handleChatClick,
144
+ phone: handlePhoneClick,
133
145
  };
134
146
  };
@@ -12,7 +12,7 @@ interface CreateParticipantResponseType {
12
12
 
13
13
  export const createParticipant = (body: CreateParticipantType) =>
14
14
  fetchRetailJSON<CreateParticipantResponseType>(
15
- '/external/public-data/createParticipant',
15
+ '/internal/entities/createParticipant',
16
16
  'POST',
17
17
  body,
18
18
  ).then((res) => res || null);
@@ -29,7 +29,7 @@ export interface CommonLeadProps {
29
29
  }
30
30
 
31
31
  export interface TaskDataProps {
32
- participantId: string | number;
32
+ participantId?: string | number;
33
33
  formData: LeadFormState;
34
34
  referalData: ReferalData | null;
35
35
  marketingInfo: MarketingInfo | null;