@redneckz/wildless-cms-uni-blocks 0.14.654 → 0.14.656

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 (119) hide show
  1. package/bundle/bundle.umd.js +99 -66
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/CreditCardForm/formStateMap.d.ts +10 -10
  4. package/bundle/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  5. package/bundle/components/CreditCardForm/renderInfo.d.ts +2 -1
  6. package/bundle/components/CreditCardForm/renderStep.d.ts +3 -4
  7. package/dist/api/RetailAPI/updateRefreshToken.js +12 -5
  8. package/dist/api/RetailAPI/updateRefreshToken.js.map +1 -1
  9. package/dist/components/CreditCardForm/CreditCardFormStep.js +2 -4
  10. package/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  11. package/dist/components/CreditCardForm/creditCardFormStepsData.js +61 -34
  12. package/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  13. package/dist/components/CreditCardForm/formStateMap.d.ts +10 -10
  14. package/dist/components/CreditCardForm/formStateMap.js +3 -7
  15. package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  16. package/dist/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  17. package/dist/components/CreditCardForm/getFilteredInputs.js +11 -0
  18. package/dist/components/CreditCardForm/getFilteredInputs.js.map +1 -0
  19. package/dist/components/CreditCardForm/getInitialFormState.js +3 -0
  20. package/dist/components/CreditCardForm/getInitialFormState.js.map +1 -1
  21. package/dist/components/CreditCardForm/renderInfo.d.ts +2 -1
  22. package/dist/components/CreditCardForm/renderInfo.js +5 -3
  23. package/dist/components/CreditCardForm/renderInfo.js.map +1 -1
  24. package/dist/components/CreditCardForm/renderStep.d.ts +3 -4
  25. package/dist/components/CreditCardForm/renderStep.js +1 -9
  26. package/dist/components/CreditCardForm/renderStep.js.map +1 -1
  27. package/dist/components/CreditCardForm/useCreditCardFormAPI.js +3 -1
  28. package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  29. package/lib/api/RetailAPI/updateRefreshToken.js +12 -5
  30. package/lib/api/RetailAPI/updateRefreshToken.js.map +1 -1
  31. package/lib/components/CreditCardForm/CreditCardFormStep.js +2 -4
  32. package/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  33. package/lib/components/CreditCardForm/creditCardFormStepsData.js +61 -34
  34. package/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  35. package/lib/components/CreditCardForm/formStateMap.d.ts +10 -10
  36. package/lib/components/CreditCardForm/formStateMap.js +3 -7
  37. package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  38. package/lib/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  39. package/lib/components/CreditCardForm/getFilteredInputs.js +8 -0
  40. package/lib/components/CreditCardForm/getFilteredInputs.js.map +1 -0
  41. package/lib/components/CreditCardForm/getInitialFormState.js +3 -0
  42. package/lib/components/CreditCardForm/getInitialFormState.js.map +1 -1
  43. package/lib/components/CreditCardForm/renderInfo.d.ts +2 -1
  44. package/lib/components/CreditCardForm/renderInfo.js +5 -3
  45. package/lib/components/CreditCardForm/renderInfo.js.map +1 -1
  46. package/lib/components/CreditCardForm/renderStep.d.ts +3 -4
  47. package/lib/components/CreditCardForm/renderStep.js +1 -9
  48. package/lib/components/CreditCardForm/renderStep.js.map +1 -1
  49. package/lib/components/CreditCardForm/useCreditCardFormAPI.js +3 -1
  50. package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  51. package/mobile/bundle/bundle.umd.js +99 -66
  52. package/mobile/bundle/bundle.umd.min.js +1 -1
  53. package/mobile/bundle/components/CreditCardForm/formStateMap.d.ts +10 -10
  54. package/mobile/bundle/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  55. package/mobile/bundle/components/CreditCardForm/renderInfo.d.ts +2 -1
  56. package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +3 -4
  57. package/mobile/dist/api/RetailAPI/updateRefreshToken.js +12 -5
  58. package/mobile/dist/api/RetailAPI/updateRefreshToken.js.map +1 -1
  59. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js +2 -4
  60. package/mobile/dist/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  61. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js +61 -34
  62. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  63. package/mobile/dist/components/CreditCardForm/formStateMap.d.ts +10 -10
  64. package/mobile/dist/components/CreditCardForm/formStateMap.js +3 -7
  65. package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  66. package/mobile/dist/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  67. package/mobile/dist/components/CreditCardForm/getFilteredInputs.js +11 -0
  68. package/mobile/dist/components/CreditCardForm/getFilteredInputs.js.map +1 -0
  69. package/mobile/dist/components/CreditCardForm/getInitialFormState.js +3 -0
  70. package/mobile/dist/components/CreditCardForm/getInitialFormState.js.map +1 -1
  71. package/mobile/dist/components/CreditCardForm/renderInfo.d.ts +2 -1
  72. package/mobile/dist/components/CreditCardForm/renderInfo.js +5 -3
  73. package/mobile/dist/components/CreditCardForm/renderInfo.js.map +1 -1
  74. package/mobile/dist/components/CreditCardForm/renderStep.d.ts +3 -4
  75. package/mobile/dist/components/CreditCardForm/renderStep.js +1 -9
  76. package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
  77. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +3 -1
  78. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  79. package/mobile/lib/api/RetailAPI/updateRefreshToken.js +12 -5
  80. package/mobile/lib/api/RetailAPI/updateRefreshToken.js.map +1 -1
  81. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js +2 -4
  82. package/mobile/lib/components/CreditCardForm/CreditCardFormStep.js.map +1 -1
  83. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js +61 -34
  84. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  85. package/mobile/lib/components/CreditCardForm/formStateMap.d.ts +10 -10
  86. package/mobile/lib/components/CreditCardForm/formStateMap.js +3 -7
  87. package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  88. package/mobile/lib/components/CreditCardForm/getFilteredInputs.d.ts +3 -0
  89. package/mobile/lib/components/CreditCardForm/getFilteredInputs.js +8 -0
  90. package/mobile/lib/components/CreditCardForm/getFilteredInputs.js.map +1 -0
  91. package/mobile/lib/components/CreditCardForm/getInitialFormState.js +3 -0
  92. package/mobile/lib/components/CreditCardForm/getInitialFormState.js.map +1 -1
  93. package/mobile/lib/components/CreditCardForm/renderInfo.d.ts +2 -1
  94. package/mobile/lib/components/CreditCardForm/renderInfo.js +5 -3
  95. package/mobile/lib/components/CreditCardForm/renderInfo.js.map +1 -1
  96. package/mobile/lib/components/CreditCardForm/renderStep.d.ts +3 -4
  97. package/mobile/lib/components/CreditCardForm/renderStep.js +1 -9
  98. package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
  99. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +3 -1
  100. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  101. package/mobile/src/api/RetailAPI/updateRefreshToken.ts +15 -5
  102. package/mobile/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -6
  103. package/mobile/src/components/CreditCardForm/creditCardFormStepsData.tsx +61 -34
  104. package/mobile/src/components/CreditCardForm/formStateMap.tsx +14 -17
  105. package/mobile/src/components/CreditCardForm/getFilteredInputs.tsx +18 -0
  106. package/mobile/src/components/CreditCardForm/getInitialFormState.tsx +3 -0
  107. package/mobile/src/components/CreditCardForm/renderInfo.tsx +9 -3
  108. package/mobile/src/components/CreditCardForm/renderStep.tsx +5 -22
  109. package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +3 -1
  110. package/package.json +1 -1
  111. package/src/api/RetailAPI/updateRefreshToken.ts +15 -5
  112. package/src/components/CreditCardForm/CreditCardFormStep.tsx +3 -6
  113. package/src/components/CreditCardForm/creditCardFormStepsData.tsx +61 -34
  114. package/src/components/CreditCardForm/formStateMap.tsx +14 -17
  115. package/src/components/CreditCardForm/getFilteredInputs.tsx +18 -0
  116. package/src/components/CreditCardForm/getInitialFormState.tsx +3 -0
  117. package/src/components/CreditCardForm/renderInfo.tsx +9 -3
  118. package/src/components/CreditCardForm/renderStep.tsx +5 -22
  119. package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +3 -1
@@ -3553,7 +3553,7 @@
3553
3553
  const [responseType, setResponseType] = useState('');
3554
3554
  const responseTypeDialog = useResponseTypeDialog({ typeForm });
3555
3555
  const handleSubmit = useCallback(async (formData, ev) => {
3556
- const inputsFiltered = getFilteredInputs(inputs, formData);
3556
+ const inputsFiltered = getFilteredInputs$1(inputs, formData);
3557
3557
  const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
3558
3558
  if (!isValidationSuccess(feedbackValidator(formData))) {
3559
3559
  return console.warn('validation fail');
@@ -3580,7 +3580,7 @@
3580
3580
  }, [responseType]);
3581
3581
  return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
3582
3582
  });
3583
- const getFilteredInputs = (inputs, data) => inputs
3583
+ const getFilteredInputs$1 = (inputs, data) => inputs
3584
3584
  .filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
3585
3585
  .filter((input) => !input?.condition ||
3586
3586
  input?.condition.values.find((_) => {
@@ -6123,11 +6123,6 @@
6123
6123
  fiasCode: '',
6124
6124
  },
6125
6125
  housing: '',
6126
- methodObtain: 'office',
6127
- addressCourier: {
6128
- fullAddress: '',
6129
- fiasCode: '',
6130
- },
6131
6126
  },
6132
6127
  2: {
6133
6128
  amountWorkers: { key: '', text: '' },
@@ -6154,6 +6149,7 @@
6154
6149
  familyStatus: { key: '', text: '' },
6155
6150
  dependents: undefined,
6156
6151
  familyMembers: undefined,
6152
+ confirmationIncome: { key: '', text: '' },
6157
6153
  mandatoryIncome: undefined,
6158
6154
  otherPayments: undefined,
6159
6155
  snils: '',
@@ -6172,11 +6168,11 @@
6172
6168
  fullAddress: '',
6173
6169
  fiasCode: '',
6174
6170
  },
6175
- bankEmployeeCode: '',
6176
- addressCoutier: {
6171
+ addressCourier: {
6177
6172
  fullAddress: '',
6178
6173
  fiasCode: '',
6179
6174
  },
6175
+ bankEmployeeCode: '',
6180
6176
  methodObtain: 'office',
6181
6177
  deliveryDate: undefined,
6182
6178
  },
@@ -6198,6 +6194,9 @@
6198
6194
  localStorageData.beginDate = localStorageData?.beginDate
6199
6195
  ? new Date(localStorageData.beginDate)
6200
6196
  : undefined;
6197
+ localStorageData.deliveryDate = localStorageData?.deliveryDate
6198
+ ? new Date(localStorageData.deliveryDate)
6199
+ : undefined;
6201
6200
  }
6202
6201
  return {
6203
6202
  ...formStateMap$1[step],
@@ -6205,24 +6204,25 @@
6205
6204
  };
6206
6205
  };
6207
6206
 
6208
- const renderInfo$2 = (inputs = []) => {
6207
+ const getFilteredInputs = (inputs, data) => inputs
6208
+ .filter((_) => _)
6209
+ .filter((input) => !input?.condition ||
6210
+ input?.condition.values.find((_) => {
6211
+ const dataValue = data?.[input?.condition?.name ?? ''];
6212
+ return _ === (dataValue?.key ?? dataValue);
6213
+ }));
6214
+
6215
+ const renderInfo$2 = (state, inputs = []) => {
6209
6216
  const infoInputs = inputs.filter((_) => _.fieldType === 'info');
6210
- return infoInputs.length
6211
- ? infoInputs.map(({ text, name }, i) => jsx(InfoCard, { __html: text }, `${name}_${i}`))
6217
+ const filteredInputs = getFilteredInputs(infoInputs, state);
6218
+ return filteredInputs.length
6219
+ ? filteredInputs.map(({ text, name }, i) => jsx(InfoCard, { __html: text }, `${name}_${i}`))
6212
6220
  : null;
6213
6221
  };
6214
6222
 
6215
6223
  const renderInputs$1 = ({ field, inputs }) => (inputs || [])?.map(getField(field, ''));
6216
6224
 
6217
- const renderLastStep = ({ sections, field, methodObtain }) => sections
6218
- ?.filter(({ type }) => type === methodObtain || !type)
6219
- .map(({ inputs, columns, title }, i) => (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(inputs), renderTitle(title), renderInputs$1({ field, inputs })] }, `section-${i}`)));
6220
- const renderStep$1 = ({ sections, field, isLastStep, methodObtain }) => {
6221
- if (isLastStep) {
6222
- return renderLastStep({ sections, field, methodObtain });
6223
- }
6224
- return sections?.map(({ inputs, columns, title }, i) => (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(inputs), renderTitle(title), renderInputs$1({ field, inputs })] }, `section-${i}`)));
6225
- };
6225
+ const renderStep$1 = ({ sections, field, userInputParams }) => sections?.map(({ inputs, columns, title }, i) => (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(userInputParams, inputs), renderTitle(title), renderInputs$1({ field, inputs })] }, `section-${i}`)));
6226
6226
 
6227
6227
  const StepsNavigationButtons$1 = JSX(({ step, onPrevStep }) => {
6228
6228
  const isFirstStep = step === 0;
@@ -6367,7 +6367,8 @@
6367
6367
  const [profileId] = useLocalStorage('profileId');
6368
6368
  const [participantId] = useLocalStorage('participantId');
6369
6369
  const handleSubmit = useCallback(async (formData) => {
6370
- const feedbackValidator = objectValidator(getObjectValidator(calculateInputs$1(formData, inputs, step)));
6370
+ const inputsFiltered = getFilteredInputs(inputs, formData);
6371
+ const feedbackValidator = objectValidator(getObjectValidator(calculateInputs$1(formData, inputsFiltered, step)));
6371
6372
  if (!isValidationSuccess(feedbackValidator(formData))) {
6372
6373
  return console.warn('validation fail');
6373
6374
  }
@@ -6412,18 +6413,16 @@
6412
6413
  saveStep,
6413
6414
  finishForm,
6414
6415
  });
6415
- const [state, { field, onSubmit }] = useForm(initialState, {
6416
+ const [userInputParams, { field, onSubmit }] = useForm(initialState, {
6416
6417
  onSubmit: (formData, ev) => {
6417
6418
  handleSubmit({ ...formData, ...customSubmit.current?.(ev) });
6418
6419
  },
6419
6420
  });
6420
- const methodObtain = 'methodObtain' in state ? state.methodObtain : undefined;
6421
6421
  return isFormFinished ? (jsx(CreditCardFormStatusTracker, {})) : (jsxs("form", { onSubmit: onSubmit, className: "space-y-m", children: [renderStep$1({
6422
6422
  sections,
6423
6423
  field,
6424
6424
  registerSubmit,
6425
- methodObtain,
6426
- isLastStep: step === 5,
6425
+ userInputParams: userInputParams,
6427
6426
  }), jsx(StepsNavigationButtons$1, { step: step, onPrevStep: onPrevStep })] }));
6428
6427
  });
6429
6428
 
@@ -6682,56 +6681,83 @@
6682
6681
  inputs: [{ fieldType: 'common', name: 'methodObtain' }],
6683
6682
  },
6684
6683
  {
6685
- type: 'courier',
6686
6684
  title: 'Адрес',
6687
6685
  columns: 1,
6688
6686
  inputs: [],
6689
6687
  },
6690
6688
  {
6691
- type: 'courier',
6692
- inputs: [{ fieldType: 'common', name: 'addressCourier', dadata: true }],
6693
- },
6694
- {
6695
- type: 'courier',
6696
- inputs: [{ fieldType: 'common', name: 'deliveryDate' }],
6697
- },
6698
- {
6699
- type: 'courier',
6700
- inputs: [{ fieldType: 'common', name: 'comment' }],
6701
- },
6702
- {
6703
- type: 'office',
6704
- title: 'Отделение Банка',
6705
- columns: 1,
6706
- inputs: [],
6707
- },
6708
- {
6709
- type: 'office',
6710
- inputs: [{ fieldType: 'common', name: 'regionRetail', required: true }],
6711
- },
6712
- {
6713
- type: 'office',
6714
- inputs: [{ fieldType: 'common', name: 'addressRetail', required: true }],
6689
+ inputs: [
6690
+ {
6691
+ fieldType: 'common',
6692
+ name: 'addressCourier',
6693
+ dadata: true,
6694
+ condition: {
6695
+ name: 'methodObtain',
6696
+ values: ['courier'],
6697
+ },
6698
+ required: true,
6699
+ },
6700
+ {
6701
+ fieldType: 'common',
6702
+ name: 'deliveryDate',
6703
+ condition: {
6704
+ name: 'methodObtain',
6705
+ values: ['courier'],
6706
+ },
6707
+ required: true,
6708
+ },
6709
+ {
6710
+ fieldType: 'common',
6711
+ name: 'comment',
6712
+ condition: {
6713
+ name: 'methodObtain',
6714
+ values: ['courier'],
6715
+ },
6716
+ },
6717
+ ],
6715
6718
  },
6716
6719
  {
6717
- type: 'office',
6718
- title: 'Код представителя Банка',
6719
- columns: 1,
6720
- inputs: [],
6720
+ inputs: [
6721
+ {
6722
+ fieldType: 'common',
6723
+ name: 'regionRetail',
6724
+ required: true,
6725
+ condition: {
6726
+ name: 'methodObtain',
6727
+ values: ['office'],
6728
+ },
6729
+ },
6730
+ {
6731
+ fieldType: 'common',
6732
+ name: 'addressRetail',
6733
+ required: true,
6734
+ condition: {
6735
+ name: 'methodObtain',
6736
+ values: ['office'],
6737
+ },
6738
+ },
6739
+ ],
6721
6740
  },
6722
6741
  {
6723
- type: 'office',
6724
6742
  inputs: [
6725
6743
  {
6726
6744
  fieldType: 'info',
6727
6745
  text: 'Если представитель Банка помогал Вам в заведении заявки, введите здесь его код',
6746
+ condition: {
6747
+ name: 'methodObtain',
6748
+ values: ['office'],
6749
+ },
6750
+ },
6751
+ {
6752
+ fieldType: 'common',
6753
+ name: 'bankEmployeeCode',
6754
+ condition: {
6755
+ name: 'methodObtain',
6756
+ values: ['office'],
6757
+ },
6728
6758
  },
6729
6759
  ],
6730
6760
  },
6731
- {
6732
- type: 'office',
6733
- inputs: [{ fieldType: 'common', name: 'bankEmployeeCode' }],
6734
- },
6735
6761
  ],
6736
6762
  ];
6737
6763
 
@@ -6769,7 +6795,7 @@
6769
6795
  globalThis.location.href = PORTAL_NATURAL_URL;
6770
6796
  return () => null;
6771
6797
  }
6772
- const timer = setInterval(async () => {
6798
+ const updateTokenRequest = async () => {
6773
6799
  const res = await doRequest('/auth/refresh', 'POST', {
6774
6800
  // eslint-disable-next-line camelcase
6775
6801
  refresh_token: refreshToken,
@@ -6777,14 +6803,21 @@
6777
6803
  access_token: accessToken,
6778
6804
  });
6779
6805
  if (res instanceof Response) {
6780
- globalThis.location.href = PORTAL_NATURAL_URL;
6806
+ handleStatus(res.status);
6781
6807
  return;
6782
6808
  }
6783
- sessionStorage.setItem('refreshToken', res.refresh_token);
6784
- sessionStorage.setItem('accessToken', res.access_token);
6785
- }, UPDATING_INTERVAL);
6809
+ globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
6810
+ globalThis.sessionStorage.setItem('accessToken', res.access_token);
6811
+ };
6812
+ updateTokenRequest();
6813
+ const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6786
6814
  return () => clearInterval(timer);
6787
6815
  };
6816
+ const handleStatus = (status) => {
6817
+ if (status == 401) {
6818
+ globalThis.location.href = PORTAL_NATURAL_URL;
6819
+ }
6820
+ };
6788
6821
 
6789
6822
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
6790
6823
  const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
@@ -9434,7 +9467,7 @@
9434
9467
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9435
9468
  });
9436
9469
 
9437
- const packageVersion = "0.14.653";
9470
+ const packageVersion = "0.14.655";
9438
9471
 
9439
9472
  exports.Blocks = Blocks;
9440
9473
  exports.ContentPage = ContentPage;