@redneckz/wildless-cms-uni-blocks 0.14.1042 → 0.14.1044

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 (87) hide show
  1. package/bundle/bundle.umd.js +25 -9
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/model/FormTypeFieldDef.d.ts +1 -1
  4. package/bundle/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  5. package/bundle/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  6. package/bundle/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  7. package/dist/model/FormTypeFieldDef.d.ts +1 -1
  8. package/dist/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  9. package/dist/retail/components/DraftDialog/DraftDialog.js +3 -8
  10. package/dist/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  11. package/dist/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  12. package/dist/retail/components/DraftDialog/DraftDialogContent.js +11 -0
  13. package/dist/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  14. package/dist/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  15. package/dist/retail/components/DraftDialog/creditProgramCodes.js +17 -1
  16. package/dist/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  17. package/dist/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  18. package/dist/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  19. package/dist/ui-kit/Input/Input.js +2 -2
  20. package/dist/ui-kit/Input/Input.js.map +1 -1
  21. package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +2 -0
  22. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  23. package/lib/model/FormTypeFieldDef.d.ts +1 -1
  24. package/lib/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  25. package/lib/retail/components/DraftDialog/DraftDialog.js +5 -10
  26. package/lib/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  27. package/lib/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  28. package/lib/retail/components/DraftDialog/DraftDialogContent.js +9 -0
  29. package/lib/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  30. package/lib/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  31. package/lib/retail/components/DraftDialog/creditProgramCodes.js +15 -0
  32. package/lib/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  33. package/lib/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  34. package/lib/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  35. package/lib/ui-kit/Input/Input.js +2 -2
  36. package/lib/ui-kit/Input/Input.js.map +1 -1
  37. package/mobile/bundle/bundle.umd.js +25 -9
  38. package/mobile/bundle/bundle.umd.min.js +1 -1
  39. package/mobile/bundle/model/FormTypeFieldDef.d.ts +1 -1
  40. package/mobile/bundle/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  41. package/mobile/bundle/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  42. package/mobile/bundle/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  43. package/mobile/dist/model/FormTypeFieldDef.d.ts +1 -1
  44. package/mobile/dist/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  45. package/mobile/dist/retail/components/DraftDialog/DraftDialog.js +3 -8
  46. package/mobile/dist/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  47. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  48. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.js +11 -0
  49. package/mobile/dist/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  50. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  51. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.js +17 -1
  52. package/mobile/dist/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  53. package/mobile/dist/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  54. package/mobile/dist/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  55. package/mobile/dist/ui-kit/Input/Input.js +2 -2
  56. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  57. package/mobile/lib/model/FormTypeFieldDef.d.ts +1 -1
  58. package/mobile/lib/retail/components/DraftDialog/DraftDialog.d.ts +1 -1
  59. package/mobile/lib/retail/components/DraftDialog/DraftDialog.js +5 -10
  60. package/mobile/lib/retail/components/DraftDialog/DraftDialog.js.map +1 -1
  61. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.d.ts +10 -0
  62. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.js +9 -0
  63. package/mobile/lib/retail/components/DraftDialog/DraftDialogContent.js.map +1 -0
  64. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.d.ts +2 -0
  65. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.js +15 -0
  66. package/mobile/lib/retail/components/DraftDialog/creditProgramCodes.js.map +1 -1
  67. package/mobile/lib/ui-kit/DatePicker/renderDatePickerForm.js +1 -1
  68. package/mobile/lib/ui-kit/DatePicker/renderDatePickerForm.js.map +1 -1
  69. package/mobile/lib/ui-kit/Input/Input.js +2 -2
  70. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  71. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +50 -0
  72. package/mobile/src/model/FormTypeFieldDef.ts +2 -1
  73. package/mobile/src/retail/components/DraftDialog/DraftDialog.tsx +14 -39
  74. package/mobile/src/retail/components/DraftDialog/DraftDialogContent.tsx +49 -0
  75. package/mobile/src/retail/components/DraftDialog/creditProgramCodes.ts +24 -0
  76. package/mobile/src/ui-kit/DatePicker/renderDatePickerForm.tsx +1 -1
  77. package/mobile/src/ui-kit/Input/Input.tsx +2 -0
  78. package/package.json +1 -1
  79. package/src/components/ApplicationForm/ApplicationForm.example.json +50 -0
  80. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +53 -0
  81. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +55 -0
  82. package/src/model/FormTypeFieldDef.ts +2 -1
  83. package/src/retail/components/DraftDialog/DraftDialog.tsx +14 -39
  84. package/src/retail/components/DraftDialog/DraftDialogContent.tsx +49 -0
  85. package/src/retail/components/DraftDialog/creditProgramCodes.ts +24 -0
  86. package/src/ui-kit/DatePicker/renderDatePickerForm.tsx +1 -1
  87. package/src/ui-kit/Input/Input.tsx +2 -0
@@ -1919,7 +1919,7 @@
1919
1919
 
1920
1920
  const Input = JSX(
1921
1921
  // eslint-disable-next-line max-lines-per-function
1922
- ({ key, className, id, name, type = 'text', label, placeholder, value = '', valid = true, pattern, autoFocus = false, isTextarea = false, disabled = false, children, onChange, onFocus, onBlur, }) => {
1922
+ ({ key, className, id, name, type = 'text', maxLength, label, placeholder, value = '', valid = true, pattern, autoFocus = false, isTextarea = false, disabled = false, children, onChange, onFocus, onBlur, }) => {
1923
1923
  const inputRef = useRef(null);
1924
1924
  const handleChange = useCallback((e) => {
1925
1925
  const valueWithoutSpace = (e.target?.value ?? '').trimStart();
@@ -1933,7 +1933,7 @@
1933
1933
  const paddingStyle = children ? 'pr-3xl' : '';
1934
1934
  const validStyle = getValidStyle(valid);
1935
1935
  const ariaLabel = label ?? name ?? id;
1936
- return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { className: "space-y-xs", children: [renderLabel$1(label), isTextarea ? (jsx("textarea", { className: style('block resize-y min-h-24', defaultStyle$1, validStyle), id: style('textarea', id), value: value, name: name || id, placeholder: placeholder, disabled: disabled, "aria-label": ariaLabel, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }, key)) : (jsx("input", { ref: inputRef, className: style('h-14', defaultStyle$1, paddingStyle, validStyle), id: id, type: type, value: value, name: name || id, placeholder: placeholder, pattern: pattern, disabled: disabled, "aria-label": ariaLabel, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, "data-test-id": name }, key))] }), children] }));
1936
+ return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { className: "space-y-xs", children: [renderLabel$1(label), isTextarea ? (jsx("textarea", { className: style('block resize-y min-h-24', defaultStyle$1, validStyle), id: style('textarea', id), value: value, name: name || id, placeholder: placeholder, disabled: disabled, "aria-label": ariaLabel, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, maxlength: maxLength }, key)) : (jsx("input", { ref: inputRef, className: style('h-14', defaultStyle$1, paddingStyle, validStyle), id: id, type: type, value: value, name: name || id, placeholder: placeholder, pattern: pattern, disabled: disabled, "aria-label": ariaLabel, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, "data-test-id": name }, key))] }), children] }));
1937
1937
  });
1938
1938
 
1939
1939
  const renderErrorText = (error) => (jsx("div", { className: "min-h-6", children: error ? (jsx(Text, { size: "text-xs", font: "font-light", color: "text-error", children: error })) : null }));
@@ -2905,7 +2905,7 @@
2905
2905
  }
2906
2906
  };
2907
2907
 
2908
- const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2908
+ const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer overflow-hidden ' +
2909
2909
  'hover:border-black active:border-black focus:border-black';
2910
2910
  const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, name, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error'), name: name }));
2911
2911
 
@@ -7231,9 +7231,28 @@
7231
7231
  ...cardCodesToProgrammIdMap,
7232
7232
  ...debitCardCodesToProgrammIdMap,
7233
7233
  };
7234
+ const getCreditProgramTaskType = (creditProgramCode, isDebit) => {
7235
+ if (isDebit || (creditProgramCode && creditProgramCode in debitCardCodesToProgrammIdMap)) {
7236
+ return 'debit';
7237
+ }
7238
+ if (!creditProgramCode) {
7239
+ return undefined;
7240
+ }
7241
+ if (creditProgramCode in creditCodesToProgrammIdMap) {
7242
+ return 'credit';
7243
+ }
7244
+ if (creditProgramCode in cardCodesToProgrammIdMap) {
7245
+ return 'card';
7246
+ }
7247
+ return undefined;
7248
+ };
7234
7249
 
7235
7250
  const DraftActionButton = JSX(({ title, icon, description, name, onClick = noop }) => (jsxs("button", { className: "flex gap-lg items-center border border-gray/30 rounded-xl cursor-pointer p-4 hover:border-green", type: "button", onClick: onClick, "data-test-id": name, children: [jsx(Img, { image: { icon, iconVersion: 'normal' }, width: "78", height: "78" }), jsxs("div", { className: "flex flex-col items-start gap-xs md:w-72 md:mr-lg", children: [title ? (jsx(Text, { font: "font-medium", size: "text-s", children: title })) : null, description ? (jsx(Text, { color: "text-secondary-text", size: "text-xs", children: description })) : null] })] })));
7236
7251
 
7252
+ const DraftDialogContent = JSX(function ({ createdDate, productData, isFromLead, handleGoToDraft, handleGoToNewTask, onClose, }) {
7253
+ return (jsxs("div", { className: "flex flex-col gap-lg items-center mt-xs mx-6xl", children: [jsx(Heading, { className: "whitespace-pre-wrap text-center", title: "\u041D\u0430\u0448\u043B\u0438 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A \u0432\u0430\u0448\u0435\u0439 \u0437\u0430\u044F\u0432\u043A\u0438", headingType: "h5" }), jsxs("div", { className: "flex flex-col gap-m max-w-lg", children: [jsx(DraftActionButton, { title: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0430", icon: "BankColorIcon", description: createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : '', onClick: handleGoToDraft, name: "go-to-draft-button" }), jsx(DraftActionButton, { title: isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку', icon: "NewLoanIcon", description: productData.description, onClick: isFromLead ? onClose : handleGoToNewTask, name: "go-to-current-task-button" })] })] }));
7254
+ });
7255
+
7237
7256
  const fieldsNamesToContactKeysMap = {
7238
7257
  email: 'EMAIL',
7239
7258
  phone: 'MAIN_PHONE',
@@ -7476,16 +7495,13 @@
7476
7495
  };
7477
7496
  };
7478
7497
 
7479
- const getTaskTypeOrDebit = (taskType, isDebit) => {
7480
- return taskType || (isDebit ? 'debit' : undefined);
7481
- };
7482
7498
  const DraftDialog = JSX(function ({ task, taskType, isDebit, isFromLead = false, sendAspects = noop, onClose = noop, }) {
7483
7499
  const retailFormStore = useRetailFormStore();
7484
7500
  const navigator = locationNavigator();
7485
7501
  const isNewMicroservice = checkNewMicroservice();
7486
7502
  const { participants, participant, creditProgram, createdDate = '', id: taskId } = task;
7487
7503
  const programmId = creditProgramCodeToProductIdMap[creditProgram.code];
7488
- const productData = getProductData(getTaskTypeOrDebit(taskType, isDebit));
7504
+ const productData = getProductData(taskType ?? getCreditProgramTaskType(task.creditProgram.code, isDebit));
7489
7505
  const currentParticipant = participant || participants?.[0];
7490
7506
  const { id: participantId, profile } = currentParticipant || {};
7491
7507
  const handleGoToDraft = useCallback(() => {
@@ -7515,7 +7531,7 @@
7515
7531
  }
7516
7532
  navigator.assign(productData.newTaskLink);
7517
7533
  }, [task.id, productData.newTaskLink, isNewMicroservice]);
7518
- return (jsx(Dialog, { onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center mt-xs mx-6xl", children: [jsx(Heading, { className: "whitespace-pre-wrap text-center", title: "\u041D\u0430\u0448\u043B\u0438 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A \u0432\u0430\u0448\u0435\u0439 \u0437\u0430\u044F\u0432\u043A\u0438", headingType: "h5" }), jsxs("div", { className: "flex flex-col gap-m max-w-lg", children: [jsx(DraftActionButton, { title: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C \u0437\u0430\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435 \u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0430", icon: "BankColorIcon", description: createdDate ? `Черновик от ${formatDate(new Date(createdDate))}` : '', onClick: handleGoToDraft, name: "go-to-draft-button" }), jsx(DraftActionButton, { title: isFromLead ? 'Продолжить заполнение текущей заявки' : 'Создать новую заявку', icon: "NewLoanIcon", description: productData.description, onClick: isFromLead ? onClose : handleGoToNewTask, name: "go-to-current-task-button" })] })] }) }));
7534
+ return (jsx(Dialog, { onClose: onClose, children: jsx(DraftDialogContent, { createdDate: createdDate, productData: productData, isFromLead: isFromLead, handleGoToDraft: handleGoToDraft, handleGoToNewTask: handleGoToNewTask, onClose: onClose }) }));
7519
7535
  });
7520
7536
 
7521
7537
  const EmptyDraftDialog = JSX(function ({ taskType, isDebit, onClose = noop, }) {
@@ -14734,7 +14750,7 @@
14734
14750
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
14735
14751
  });
14736
14752
 
14737
- const packageVersion = "0.14.1041";
14753
+ const packageVersion = "0.14.1043";
14738
14754
 
14739
14755
  exports.Blocks = Blocks;
14740
14756
  exports.ContentPage = ContentPage;