@redneckz/wildless-cms-uni-blocks 0.14.725 → 0.14.727
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +1802 -1817
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
- package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/bundle/components/CreditForm/formStateMap.d.ts +1 -1
- package/bundle/components/CreditForm/getCalcData.d.ts +1 -1
- package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/CreditForm/renderInfo.d.ts +1 -1
- package/bundle/components/CreditForm/renderInputs.d.ts +2 -2
- package/bundle/components/CreditForm/renderStep.d.ts +1 -1
- package/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/bundle/components/CreditForm/utils.d.ts +1 -1
- package/bundle/hooks/useLeadFormData.d.ts +2 -2
- package/bundle/hooks/useRetailFormStore.d.ts +10 -10
- package/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/bundle/services/retail/external/types.d.ts +10 -0
- package/bundle/services/retail/external/utils.d.ts +2 -0
- package/bundle/services/retail/inputs.d.ts +75 -0
- package/{dist/api/RetailAPI → bundle/services/retail}/model/LeadFormData.d.ts +1 -1
- package/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
- package/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
- package/bundle/{components/CreditCardForm → services/retail/utils}/calculateInputs.d.ts +2 -2
- package/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
- package/bundle/ui-kit/FormField/getField.d.ts +2 -1
- package/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
- package/bundle/ui-kit/FormField/validators.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/dist/components/ApplicationLeadForm/consents.js +0 -3
- package/dist/components/ApplicationLeadForm/consents.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/dist/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/{mobile/dist/components/ApplicationForm → dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
- package/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/dist/components/CreditCardForm/renderInputs.js +2 -1
- package/dist/components/CreditCardForm/renderInputs.js.map +1 -1
- package/dist/components/CreditCardForm/renderStep.d.ts +1 -1
- package/dist/components/CreditCardForm/renderStep.js +1 -1
- package/dist/components/CreditCardForm/renderStep.js.map +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/dist/components/CreditForm/formStateMap.d.ts +1 -1
- package/dist/components/CreditForm/getCalcData.d.ts +1 -1
- package/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/dist/components/CreditForm/renderInfo.d.ts +1 -1
- package/dist/components/CreditForm/renderInfo.js.map +1 -1
- package/dist/components/CreditForm/renderInputs.d.ts +2 -2
- package/dist/components/CreditForm/renderInputs.js +2 -1
- package/dist/components/CreditForm/renderInputs.js.map +1 -1
- package/dist/components/CreditForm/renderStep.d.ts +1 -1
- package/dist/components/CreditForm/renderStep.js +1 -1
- package/dist/components/CreditForm/renderStep.js.map +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/dist/components/CreditForm/useCreditFormAPI.js +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/dist/components/CreditForm/utils.d.ts +1 -1
- package/dist/hooks/useCreditFormStore.d.ts +0 -0
- package/dist/hooks/useCreditFormStore.js +1 -0
- package/dist/hooks/useCreditFormStore.js.map +1 -0
- package/dist/hooks/useLeadFormData.d.ts +2 -2
- package/dist/hooks/useLeadFormData.js.map +1 -1
- package/dist/hooks/useRetailFormStore.d.ts +10 -10
- package/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/dist/services/retail/external/types.d.ts +10 -0
- package/dist/services/retail/external/types.js +2 -0
- package/dist/services/retail/external/types.js.map +1 -0
- package/dist/services/retail/external/utils.d.ts +2 -0
- package/dist/services/retail/external/utils.js +7 -0
- package/dist/services/retail/external/utils.js.map +1 -0
- package/dist/services/retail/inputs.d.ts +75 -0
- package/dist/services/retail/inputs.js +137 -0
- package/dist/services/retail/inputs.js.map +1 -0
- package/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/{bundle/api/RetailAPI → dist/services/retail}/model/LeadFormData.d.ts +1 -1
- package/dist/services/retail/model/LeadFormData.js.map +1 -0
- package/{lib/components/ApplicationLeadForm → dist/services/retail/model}/LeadFormState.d.ts +18 -18
- package/dist/services/retail/model/LeadFormState.js.map +1 -0
- package/dist/services/retail/model/RetailFormContent.d.ts +63 -0
- package/dist/services/retail/model/RetailFormContent.js +4 -0
- package/dist/services/retail/model/RetailFormContent.js.map +1 -0
- package/{bundle/components/CreditForm → dist/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/dist/services/retail/utils/calculateInputs.js.map +1 -0
- package/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
- package/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/dist/ui-kit/DraftDialog/utils.js.map +1 -1
- package/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressField.js +1 -1
- package/dist/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/dist/ui-kit/FormField/SelectField.d.ts +2 -2
- package/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/dist/ui-kit/FormField/getField.d.ts +2 -1
- package/dist/ui-kit/FormField/getField.js +4 -131
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +70 -60
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/FormField/getPremium.d.ts +1 -1
- package/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/dist/ui-kit/FormField/validators.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/lib/components/ApplicationLeadForm/consents.js +0 -3
- package/lib/components/ApplicationLeadForm/consents.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
- package/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/lib/components/CreditCardForm/renderInputs.js +2 -1
- package/lib/components/CreditCardForm/renderInputs.js.map +1 -1
- package/lib/components/CreditCardForm/renderStep.d.ts +1 -1
- package/lib/components/CreditCardForm/renderStep.js +1 -1
- package/lib/components/CreditCardForm/renderStep.js.map +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/lib/components/CreditForm/formStateMap.d.ts +1 -1
- package/lib/components/CreditForm/getCalcData.d.ts +1 -1
- package/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/lib/components/CreditForm/renderInfo.d.ts +1 -1
- package/lib/components/CreditForm/renderInfo.js.map +1 -1
- package/lib/components/CreditForm/renderInputs.d.ts +2 -2
- package/lib/components/CreditForm/renderInputs.js +2 -1
- package/lib/components/CreditForm/renderInputs.js.map +1 -1
- package/lib/components/CreditForm/renderStep.d.ts +1 -1
- package/lib/components/CreditForm/renderStep.js +1 -1
- package/lib/components/CreditForm/renderStep.js.map +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/lib/components/CreditForm/useCreditFormAPI.js +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/lib/components/CreditForm/utils.d.ts +1 -1
- package/lib/hooks/useCreditFormStore.d.ts +0 -0
- package/lib/hooks/useCreditFormStore.js +1 -0
- package/lib/hooks/useCreditFormStore.js.map +1 -0
- package/lib/hooks/useLeadFormData.d.ts +2 -2
- package/lib/hooks/useLeadFormData.js.map +1 -1
- package/lib/hooks/useRetailFormStore.d.ts +10 -10
- package/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/lib/services/retail/external/types.d.ts +10 -0
- package/lib/services/retail/external/types.js +2 -0
- package/lib/services/retail/external/types.js.map +1 -0
- package/lib/services/retail/external/utils.d.ts +2 -0
- package/lib/services/retail/external/utils.js +3 -0
- package/lib/services/retail/external/utils.js.map +1 -0
- package/lib/services/retail/inputs.d.ts +75 -0
- package/lib/services/retail/inputs.js +135 -0
- package/lib/services/retail/inputs.js.map +1 -0
- package/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
- package/lib/services/retail/model/LeadFormData.js.map +1 -0
- package/{dist/components/ApplicationLeadForm → lib/services/retail/model}/LeadFormState.d.ts +18 -18
- package/lib/services/retail/model/LeadFormState.js.map +1 -0
- package/lib/services/retail/model/RetailFormContent.d.ts +63 -0
- package/lib/services/retail/model/RetailFormContent.js +4 -0
- package/lib/services/retail/model/RetailFormContent.js.map +1 -0
- package/{dist/components/CreditCardForm → lib/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/lib/services/retail/utils/calculateInputs.js.map +1 -0
- package/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/{mobile/lib/api/RetailAPI → lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
- package/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/lib/ui-kit/DraftDialog/utils.js.map +1 -1
- package/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressField.js +1 -1
- package/lib/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/lib/ui-kit/FormField/SelectField.d.ts +2 -2
- package/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/lib/ui-kit/FormField/getField.d.ts +2 -1
- package/lib/ui-kit/FormField/getField.js +4 -131
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +71 -61
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/FormField/getPremium.d.ts +1 -1
- package/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/lib/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/bundle/bundle.umd.js +1802 -1817
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/bundle/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/bundle/components/CreditForm/utils.d.ts +1 -1
- package/mobile/bundle/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/bundle/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/bundle/services/retail/external/types.d.ts +10 -0
- package/mobile/bundle/services/retail/external/utils.d.ts +2 -0
- package/mobile/bundle/services/retail/inputs.d.ts +75 -0
- package/mobile/bundle/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
- package/mobile/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
- package/mobile/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
- package/{dist/components/CreditForm → mobile/bundle/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/mobile/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/bundle/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/dist/components/ApplicationLeadForm/consents.js +0 -3
- package/mobile/dist/components/ApplicationLeadForm/consents.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
- package/{dist/components/ApplicationForm → mobile/dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
- package/mobile/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/dist/components/CreditCardForm/renderInputs.js +2 -1
- package/mobile/dist/components/CreditCardForm/renderInputs.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.js +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/dist/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderInfo.js.map +1 -1
- package/mobile/dist/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/dist/components/CreditForm/renderInputs.js +2 -1
- package/mobile/dist/components/CreditForm/renderInputs.js.map +1 -1
- package/mobile/dist/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderStep.js +1 -1
- package/mobile/dist/components/CreditForm/renderStep.js.map +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/utils.d.ts +1 -1
- package/mobile/dist/hooks/useCreditFormStore.d.ts +0 -0
- package/mobile/dist/hooks/useCreditFormStore.js +1 -0
- package/mobile/dist/hooks/useCreditFormStore.js.map +1 -0
- package/mobile/dist/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/dist/hooks/useLeadFormData.js.map +1 -1
- package/mobile/dist/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/dist/services/retail/external/types.d.ts +10 -0
- package/mobile/dist/services/retail/external/types.js +2 -0
- package/mobile/dist/services/retail/external/types.js.map +1 -0
- package/mobile/dist/services/retail/external/utils.d.ts +2 -0
- package/mobile/dist/services/retail/external/utils.js +7 -0
- package/mobile/dist/services/retail/external/utils.js.map +1 -0
- package/mobile/dist/services/retail/inputs.d.ts +75 -0
- package/mobile/dist/services/retail/inputs.js +137 -0
- package/mobile/dist/services/retail/inputs.js.map +1 -0
- package/mobile/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/mobile/dist/services/retail/model/LeadFormData.d.ts +7 -0
- package/mobile/dist/services/retail/model/LeadFormData.js.map +1 -0
- package/mobile/dist/services/retail/model/LeadFormState.d.ts +146 -0
- package/mobile/dist/services/retail/model/LeadFormState.js.map +1 -0
- package/mobile/dist/services/retail/model/RetailFormContent.d.ts +63 -0
- package/mobile/dist/services/retail/model/RetailFormContent.js +4 -0
- package/mobile/dist/services/retail/model/RetailFormContent.js.map +1 -0
- package/mobile/dist/services/retail/utils/calculateInputs.d.ts +5 -0
- package/mobile/dist/services/retail/utils/calculateInputs.js.map +1 -0
- package/mobile/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/mobile/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
- package/mobile/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/dist/ui-kit/DraftDialog/utils.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -131
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +70 -60
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/lib/components/ApplicationLeadForm/consents.js +0 -3
- package/mobile/lib/components/ApplicationLeadForm/consents.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
- package/mobile/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
- package/mobile/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/lib/components/CreditCardForm/renderInputs.js +2 -1
- package/mobile/lib/components/CreditCardForm/renderInputs.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.js +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/lib/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderInfo.js.map +1 -1
- package/mobile/lib/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/lib/components/CreditForm/renderInputs.js +2 -1
- package/mobile/lib/components/CreditForm/renderInputs.js.map +1 -1
- package/mobile/lib/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderStep.js +1 -1
- package/mobile/lib/components/CreditForm/renderStep.js.map +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/utils.d.ts +1 -1
- package/mobile/lib/hooks/useCreditFormStore.d.ts +0 -0
- package/mobile/lib/hooks/useCreditFormStore.js +1 -0
- package/mobile/lib/hooks/useCreditFormStore.js.map +1 -0
- package/mobile/lib/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/lib/hooks/useLeadFormData.js.map +1 -1
- package/mobile/lib/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/lib/services/retail/external/types.d.ts +10 -0
- package/mobile/lib/services/retail/external/types.js +2 -0
- package/mobile/lib/services/retail/external/types.js.map +1 -0
- package/mobile/lib/services/retail/external/utils.d.ts +2 -0
- package/mobile/lib/services/retail/external/utils.js +3 -0
- package/mobile/lib/services/retail/external/utils.js.map +1 -0
- package/mobile/lib/services/retail/inputs.d.ts +75 -0
- package/mobile/lib/services/retail/inputs.js +135 -0
- package/mobile/lib/services/retail/inputs.js.map +1 -0
- package/mobile/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/mobile/lib/services/retail/model/LeadFormData.d.ts +7 -0
- package/mobile/lib/services/retail/model/LeadFormData.js.map +1 -0
- package/mobile/lib/services/retail/model/LeadFormState.d.ts +146 -0
- package/mobile/lib/services/retail/model/LeadFormState.js.map +1 -0
- package/mobile/lib/services/retail/model/RetailFormContent.d.ts +63 -0
- package/mobile/lib/services/retail/model/RetailFormContent.js +4 -0
- package/mobile/lib/services/retail/model/RetailFormContent.js.map +1 -0
- package/mobile/lib/services/retail/utils/calculateInputs.d.ts +5 -0
- package/mobile/lib/services/retail/utils/calculateInputs.js.map +1 -0
- package/mobile/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/mobile/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/{lib/api/RetailAPI → mobile/lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
- package/mobile/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/lib/ui-kit/DraftDialog/utils.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -131
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +71 -61
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.d.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
- package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
- package/mobile/src/components/ApplicationLeadForm/consents.ts +2 -5
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
- package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
- package/mobile/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
- package/mobile/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
- package/mobile/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/mobile/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
- package/mobile/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
- package/mobile/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/CreditCardForm/renderInputs.tsx +4 -3
- package/mobile/src/components/CreditCardForm/renderStep.tsx +6 -2
- package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
- package/mobile/src/components/CreditForm/CreditFormStep.tsx +1 -1
- package/mobile/src/components/CreditForm/formStateMap.tsx +1 -1
- package/mobile/src/components/CreditForm/getCalcData.ts +1 -1
- package/mobile/src/components/CreditForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/CreditForm/renderInfo.tsx +1 -1
- package/mobile/src/components/CreditForm/renderInputs.tsx +4 -3
- package/mobile/src/components/CreditForm/renderStep.tsx +2 -2
- package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
- package/mobile/src/components/CreditForm/utils.ts +1 -1
- package/mobile/src/hooks/useCreditFormStore.tsx +0 -0
- package/mobile/src/hooks/useLeadFormData.ts +4 -4
- package/mobile/src/hooks/useRetailFormStore.tsx +5 -5
- package/mobile/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getCalculatorData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
- package/mobile/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
- package/mobile/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/mobile/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
- package/mobile/src/services/retail/external/types.ts +10 -0
- package/mobile/src/services/retail/external/utils.ts +2 -0
- package/mobile/src/services/retail/inputs.tsx +140 -0
- package/mobile/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
- package/mobile/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
- package/mobile/src/services/retail/model/RetailFormContent.ts +101 -0
- package/mobile/src/{components/CreditCardForm → services/retail/utils}/calculateInputs.ts +4 -4
- package/mobile/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
- package/mobile/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
- package/mobile/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
- package/mobile/src/ui-kit/DraftDialog/utils.ts +2 -2
- package/mobile/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
- package/mobile/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/AddressFactField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/AddressField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
- package/mobile/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +76 -63
- package/mobile/src/ui-kit/FormField/SelectField.tsx +3 -3
- package/mobile/src/ui-kit/FormField/getField.tsx +11 -135
- package/mobile/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +75 -62
- package/mobile/src/ui-kit/FormField/getPremium.tsx +1 -1
- package/mobile/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
- package/mobile/src/ui-kit/FormField/validators.ts +1 -1
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
- package/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
- package/src/components/ApplicationLeadForm/consents.ts +2 -5
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
- package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
- package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
- package/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
- package/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
- package/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
- package/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
- package/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
- package/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
- package/src/components/CreditCardForm/renderInputs.tsx +4 -3
- package/src/components/CreditCardForm/renderStep.tsx +6 -2
- package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
- package/src/components/CreditForm/CreditFormStep.tsx +1 -1
- package/src/components/CreditForm/formStateMap.tsx +1 -1
- package/src/components/CreditForm/getCalcData.ts +1 -1
- package/src/components/CreditForm/getInitialFormState.tsx +1 -1
- package/src/components/CreditForm/renderInfo.tsx +1 -1
- package/src/components/CreditForm/renderInputs.tsx +4 -3
- package/src/components/CreditForm/renderStep.tsx +2 -2
- package/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
- package/src/components/CreditForm/utils.ts +1 -1
- package/src/hooks/useCreditFormStore.tsx +0 -0
- package/src/hooks/useLeadFormData.ts +4 -4
- package/src/hooks/useRetailFormStore.tsx +5 -5
- package/src/icons/IconName.ts +4 -4
- package/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
- package/src/services/retail/adaptors/getCalculatorData.ts +1 -1
- package/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
- package/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
- package/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
- package/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
- package/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
- package/src/services/retail/external/types.ts +10 -0
- package/src/services/retail/external/utils.ts +2 -0
- package/src/services/retail/inputs.tsx +140 -0
- package/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
- package/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
- package/src/services/retail/model/RetailFormContent.ts +101 -0
- package/{mobile/src/components/CreditForm → src/services/retail/utils}/calculateInputs.ts +4 -4
- package/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
- package/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
- package/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
- package/src/ui-kit/DraftDialog/utils.ts +2 -2
- package/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
- package/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/AddressFactField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/AddressField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
- package/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +76 -63
- package/src/ui-kit/FormField/SelectField.tsx +3 -3
- package/src/ui-kit/FormField/getField.tsx +11 -135
- package/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +75 -62
- package/src/ui-kit/FormField/getPremium.tsx +1 -1
- package/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
- package/src/ui-kit/FormField/validators.ts +1 -1
- package/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/dist/components/ApplicationForm/renderInputs.js.map +0 -1
- package/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/dist/components/CreditForm/calculateInputs.js.map +0 -1
- package/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/lib/components/ApplicationForm/renderInputs.js.map +0 -1
- package/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/lib/components/CreditForm/calculateInputs.d.ts +0 -5
- package/lib/components/CreditForm/calculateInputs.js.map +0 -1
- package/mobile/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/bundle/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/bundle/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/mobile/dist/api/RetailAPI/model/LeadFormData.d.ts +0 -7
- package/mobile/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/mobile/dist/components/ApplicationForm/renderInputs.d.ts +0 -2
- package/mobile/dist/components/ApplicationForm/renderInputs.js.map +0 -1
- package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
- package/mobile/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/mobile/dist/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/components/CreditCardForm/calculateInputs.js +0 -31
- package/mobile/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/mobile/dist/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/components/CreditForm/calculateInputs.js +0 -31
- package/mobile/dist/components/CreditForm/calculateInputs.js.map +0 -1
- package/mobile/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/mobile/lib/api/RetailAPI/model/LeadFormData.d.ts +0 -7
- package/mobile/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/mobile/lib/components/ApplicationForm/renderInputs.d.ts +0 -2
- package/mobile/lib/components/ApplicationForm/renderInputs.js.map +0 -1
- package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
- package/mobile/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/mobile/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/lib/components/CreditCardForm/calculateInputs.js +0 -27
- package/mobile/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/mobile/lib/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/lib/components/CreditForm/calculateInputs.js +0 -27
- package/mobile/lib/components/CreditForm/calculateInputs.js.map +0 -1
- package/src/components/CreditCardForm/calculateInputs.ts +0 -51
- package/src/components/CreditForm/calculateInputs.ts +0 -51
- /package/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/dist/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
- /package/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/lib/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/mobile/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/{dist/components/CreditForm → mobile/dist/services/retail/utils}/calculateInputs.js +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/mobile/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/{lib/components/CreditForm → mobile/lib/services/retail/utils}/calculateInputs.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
- /package/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
package/bundle/bundle.umd.js
CHANGED
|
@@ -1572,7 +1572,6 @@
|
|
|
1572
1572
|
const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
|
|
1573
1573
|
const phoneValidate = (email) => /^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/.test(email);
|
|
1574
1574
|
const phoneValidator = (errorMsg) => validator(phoneValidate)(errorMsg);
|
|
1575
|
-
const phoneOptionalValidator = (errorMsg) => validator((_) => !_ || phoneValidate(_))(errorMsg);
|
|
1576
1575
|
const agreementValidator = validator((_) => typeof _ === 'boolean' && _)('Согласие обязательно');
|
|
1577
1576
|
const snilsValidate = (snils) => {
|
|
1578
1577
|
const snl = String(snils).replace(/[^0-9]+/g, '');
|
|
@@ -1611,74 +1610,62 @@
|
|
|
1611
1610
|
};
|
|
1612
1611
|
const limitedBirthdayValidator = () => validator(limitedBirthdayValidate)(AGE_ERROR_MESSAGE);
|
|
1613
1612
|
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1613
|
+
const validatorConsentsObj = {
|
|
1614
|
+
processPersonalDataFlg: agreementValidator,
|
|
1615
|
+
consentProviderFlg: agreementValidator,
|
|
1616
|
+
consentInformFlg: agreementValidator,
|
|
1617
|
+
consentPfrFlg: agreementValidator,
|
|
1618
|
+
consentOthersFlg: agreementValidator,
|
|
1619
|
+
};
|
|
1620
|
+
const validatorCreditCardObj = {
|
|
1621
|
+
addressCourier: addressDaDataValidator(),
|
|
1622
|
+
paymentSystem: defaultValidator('Укажите тип платежной системы'),
|
|
1623
|
+
currency: defaultValidator('Укажите валюту'),
|
|
1624
|
+
cardCategory: defaultValidator('Укажите категорию карты'),
|
|
1625
|
+
codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
|
|
1626
|
+
confirmationIncome: defaultSelectValidator(),
|
|
1627
|
+
methodObtain: defaultValidator(),
|
|
1628
|
+
deliveryDate: defaultValidator('Укажите дату доставки'),
|
|
1629
|
+
};
|
|
1630
|
+
const validatorRetailObj = {
|
|
1631
|
+
organization: defaultSelectValidator('Выберите тип организации'),
|
|
1632
|
+
organizationAddress: addressOrganizationValidator(),
|
|
1623
1633
|
organizationPhone: phoneValidator('Укажите номер телефона'),
|
|
1624
|
-
|
|
1634
|
+
organizationName: defaultValidator('Укажите наименование организации'),
|
|
1635
|
+
legalForm: defaultValidator('Укажите ОПФ'),
|
|
1636
|
+
generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
|
|
1637
|
+
lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
|
|
1638
|
+
experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
|
|
1639
|
+
jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
|
|
1640
|
+
beginDate: defaultValidator('Укажите дату заключения трудового договора'),
|
|
1641
|
+
addressFact: addressDaDataValidator(),
|
|
1642
|
+
addressRegistration: addressDaDataValidator(),
|
|
1643
|
+
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
1644
|
+
addressMatch: defaultValidator(),
|
|
1645
|
+
sex: defaultValidator('Укажите свой пол'),
|
|
1625
1646
|
limitedBirthday: limitedBirthdayValidator(),
|
|
1626
1647
|
birthPlace: defaultValidator('Укажите место рождения'),
|
|
1627
1648
|
education: defaultSelectValidator('Выберите ваше образование'),
|
|
1628
1649
|
housing: defaultSelectValidator('Выберите тип жилья'),
|
|
1629
|
-
employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
|
|
1630
|
-
organization: defaultSelectValidator('Выберите тип организации'),
|
|
1631
1650
|
amountWorkers: defaultSelectValidator('Выберите информацию о количестве сотрудников'),
|
|
1651
|
+
employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
|
|
1632
1652
|
employerActivities: defaultSelectValidator('Выберите вид деятельности организации'),
|
|
1633
1653
|
employerOrganization: defaultSelectValidator('Выберите вид организации'),
|
|
1634
1654
|
positionOrganization: defaultSelectValidator('Выберите вашу должность'),
|
|
1635
|
-
dulSerie: serieValidator('Укажите серию паспорта'),
|
|
1636
|
-
dulNumber: numberValidator('Укажите номер паспорта'),
|
|
1637
|
-
dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
|
|
1638
|
-
dulSubdivisionCode: numberValidator('Укажите код подразделения'),
|
|
1639
|
-
dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
|
|
1640
|
-
email: emailValidator('Укажите электронную почту'),
|
|
1641
|
-
fullName: defaultValidator(),
|
|
1642
|
-
inn: innValidator('Укажите ИНН'),
|
|
1643
|
-
legalForm: defaultValidator('Укажите ОПФ'),
|
|
1644
|
-
organizationName: defaultValidator('Укажите наименование организации'),
|
|
1645
|
-
generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
|
|
1646
|
-
lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
|
|
1647
|
-
experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
|
|
1648
|
-
jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
|
|
1649
|
-
beginDate: defaultValidator('Укажите дату заключения трудового договора'),
|
|
1650
|
-
addressFact: addressDaDataValidator(),
|
|
1651
|
-
partnerComments: defaultValidator(),
|
|
1652
|
-
collectionCount: defaultValidator(),
|
|
1653
|
-
comment: defaultValidator(),
|
|
1654
|
-
acquiringType: defaultSelectValidator(),
|
|
1655
|
-
feedbackMethod: defaultSelectValidator(),
|
|
1656
|
-
serviceType: defaultSelectValidator(),
|
|
1657
|
-
serviceDirection: defaultSelectValidator(),
|
|
1658
|
-
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1659
|
-
meetingDay: defaultValidator(),
|
|
1660
|
-
product: defaultValidator(),
|
|
1661
|
-
localities: defaultValidator(),
|
|
1662
|
-
consentDataProcessing: agreementValidator,
|
|
1663
|
-
annualRevenue: defaultValidator(),
|
|
1664
|
-
consentToReceiveMaterials: agreementValidator,
|
|
1665
|
-
processPersonalDataFlg: agreementValidator,
|
|
1666
|
-
consentProviderFlg: agreementValidator,
|
|
1667
|
-
consentPfrFlg: agreementValidator,
|
|
1668
|
-
consentOthersFlg: agreementValidator,
|
|
1669
|
-
consentInformFlg: agreementValidator,
|
|
1670
1655
|
familyStatus: defaultSelectValidator('Выберите семейное положение'),
|
|
1671
|
-
children: lengthStringValidator(2, 'Укажите количество детей'),
|
|
1672
1656
|
familyMembers: lengthStringValidator(2, 'Укажите количество членов семьи'),
|
|
1657
|
+
children: lengthStringValidator(2, 'Укажите количество детей'),
|
|
1673
1658
|
dependents: lengthStringValidator(2, 'Укажите количество иждивенцев'),
|
|
1674
1659
|
totalIncome: lengthStringValidator(19, 'Укажите среднемесячный доход от основной зарплаты'),
|
|
1675
1660
|
expenses: lengthStringValidator(10, 'Укажите сумму обязательных выплат'),
|
|
1676
1661
|
snils: snilsValidator('Некорректный номер СНИЛС'),
|
|
1677
1662
|
conscription: defaultValidator(),
|
|
1678
1663
|
armyIdFlg: agreementValidator,
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1664
|
+
dulSerie: serieValidator('Укажите серию паспорта'),
|
|
1665
|
+
dulNumber: numberValidator('Укажите номер паспорта'),
|
|
1666
|
+
dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
|
|
1667
|
+
dulSubdivisionCode: numberValidator('Укажите код подразделения'),
|
|
1668
|
+
dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
|
|
1682
1669
|
participantDateRegistration: defaultValidator('Укажите дату регистрации'),
|
|
1683
1670
|
retirementIncome: defaultValidator(),
|
|
1684
1671
|
otherIncome: defaultValidator(),
|
|
@@ -1690,15 +1677,37 @@
|
|
|
1690
1677
|
legalEntityName: defaultValidator(),
|
|
1691
1678
|
bankEmployeeCode: defaultValidator(),
|
|
1692
1679
|
partInBusiness: defaultValidator(),
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1680
|
+
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1681
|
+
};
|
|
1682
|
+
const validatorObj = {
|
|
1683
|
+
fullName: defaultValidator(),
|
|
1684
|
+
addressBranch: defaultSelectValidator(),
|
|
1685
|
+
desiredMeetingDate: defaultValidator(),
|
|
1686
|
+
product: defaultValidator(),
|
|
1687
|
+
localities: defaultValidator(),
|
|
1688
|
+
partnerComments: defaultValidator(),
|
|
1689
|
+
collectionCount: defaultValidator(),
|
|
1690
|
+
acquiringType: defaultSelectValidator(),
|
|
1691
|
+
serviceType: defaultSelectValidator(),
|
|
1692
|
+
annualRevenue: defaultValidator(),
|
|
1693
|
+
feedbackMethod: defaultSelectValidator(),
|
|
1694
|
+
serviceDirection: defaultSelectValidator(),
|
|
1695
|
+
secondaryPhone: phoneValidator('Укажите номер телефона'),
|
|
1696
|
+
region: defaultSelectValidator(),
|
|
1697
|
+
surname: nameValidator('Укажите свою фамилию'),
|
|
1698
|
+
name: nameValidator('Укажите своё имя'),
|
|
1699
|
+
middleName: nameValidator('Укажите своё отчество'),
|
|
1700
|
+
birthday: defaultValidator('Укажите дату рождения'),
|
|
1701
|
+
phone: phoneValidator('Укажите номер телефона'),
|
|
1702
|
+
email: emailValidator('Укажите электронную почту'),
|
|
1703
|
+
inn: innValidator('Укажите ИНН'),
|
|
1704
|
+
comment: defaultValidator(),
|
|
1705
|
+
typeForm: defaultValidator(),
|
|
1706
|
+
consentToReceiveMaterials: agreementValidator,
|
|
1707
|
+
consentDataProcessing: agreementValidator,
|
|
1708
|
+
...validatorConsentsObj,
|
|
1709
|
+
...validatorRetailObj,
|
|
1710
|
+
...validatorCreditCardObj,
|
|
1702
1711
|
};
|
|
1703
1712
|
const getObjectValidator = (inputs) => {
|
|
1704
1713
|
const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
|
|
@@ -1843,825 +1852,412 @@
|
|
|
1843
1852
|
})), ...getValidation(field('addressBranch'), validatorObj.addressBranch, input?.required), isSearch: true }));
|
|
1844
1853
|
});
|
|
1845
1854
|
|
|
1846
|
-
const
|
|
1847
|
-
const
|
|
1848
|
-
const
|
|
1849
|
-
const
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
1853
|
-
}
|
|
1854
|
-
}, [value, field('addressRegistration').value]);
|
|
1855
|
-
const onDaDataChange = useCallback((item) => {
|
|
1856
|
-
field?.(fieldName)?.onChange?.({
|
|
1857
|
-
apartment: item?.data?.flat,
|
|
1858
|
-
city: item?.data?.city,
|
|
1859
|
-
district: item?.data?.area_with_type,
|
|
1860
|
-
fullAddress: item?.value,
|
|
1861
|
-
fiasCode: item?.data?.fias_id,
|
|
1862
|
-
house: item?.data?.house,
|
|
1863
|
-
locality: item?.data?.settlement_with_type,
|
|
1864
|
-
okatoRegionCode: item?.data?.okato,
|
|
1865
|
-
postcode: item?.data?.postal_code,
|
|
1866
|
-
region: item?.data?.region,
|
|
1867
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
1868
|
-
street: item?.data?.house,
|
|
1869
|
-
qc: item?.data?.qc,
|
|
1870
|
-
qcComplete: item?.data?.qc_complete,
|
|
1871
|
-
qcHouse: item?.data?.qc_house,
|
|
1872
|
-
});
|
|
1873
|
-
}, []);
|
|
1874
|
-
const onChange = useCallback((val) => {
|
|
1875
|
-
field?.(fieldName)?.onChange?.({
|
|
1876
|
-
apartment: '',
|
|
1877
|
-
city: '',
|
|
1878
|
-
district: '',
|
|
1879
|
-
fullAddress: val,
|
|
1880
|
-
fiasCode: '',
|
|
1881
|
-
house: '',
|
|
1882
|
-
locality: '',
|
|
1883
|
-
okatoRegionCode: '',
|
|
1884
|
-
postcode: '',
|
|
1885
|
-
region: '',
|
|
1886
|
-
regionCode: '',
|
|
1887
|
-
street: '',
|
|
1888
|
-
qc: '',
|
|
1889
|
-
qcComplete: '',
|
|
1890
|
-
qcHouse: '',
|
|
1891
|
-
});
|
|
1855
|
+
const useNormalizedInput = (props, { normalize, format }) => {
|
|
1856
|
+
const { value, onFocus, onBlur, onChange } = props;
|
|
1857
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1858
|
+
const handleFocus = useCallback((ev) => {
|
|
1859
|
+
setIsFocused(true);
|
|
1860
|
+
onFocus && onFocus(ev);
|
|
1892
1861
|
}, []);
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1862
|
+
const handleBlur = useCallback(() => {
|
|
1863
|
+
setIsFocused(false);
|
|
1864
|
+
onChange && onChange(normalize(value));
|
|
1865
|
+
onBlur && onBlur();
|
|
1866
|
+
}, [onChange, value]);
|
|
1867
|
+
return {
|
|
1868
|
+
value: (isFocused || !format ? value : format(value)),
|
|
1869
|
+
onFocus: handleFocus,
|
|
1870
|
+
onBlur: handleBlur,
|
|
1871
|
+
};
|
|
1872
|
+
};
|
|
1898
1873
|
|
|
1899
|
-
const
|
|
1900
|
-
const fieldName = input?.name || 'addressRegistration';
|
|
1901
|
-
const fieldValue = field(fieldName).value;
|
|
1902
|
-
const onDaDataChange = useCallback((item) => {
|
|
1903
|
-
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
1904
|
-
}, []);
|
|
1905
|
-
const onChange = useCallback((value) => {
|
|
1906
|
-
field?.(fieldName)?.onChange?.({
|
|
1907
|
-
apartment: '',
|
|
1908
|
-
city: '',
|
|
1909
|
-
district: '',
|
|
1910
|
-
fullAddress: value,
|
|
1911
|
-
fiasCode: '',
|
|
1912
|
-
house: '',
|
|
1913
|
-
locality: '',
|
|
1914
|
-
okatoRegionCode: '',
|
|
1915
|
-
postcode: '',
|
|
1916
|
-
region: '',
|
|
1917
|
-
regionCode: '',
|
|
1918
|
-
street: '',
|
|
1919
|
-
qc: '',
|
|
1920
|
-
qcComplete: '',
|
|
1921
|
-
qcHouse: '',
|
|
1922
|
-
});
|
|
1923
|
-
}, []);
|
|
1924
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
1925
|
-
});
|
|
1926
|
-
const getAddressFromDaDataItem = (item) => ({
|
|
1927
|
-
apartment: item?.data?.flat,
|
|
1928
|
-
city: item?.data?.city,
|
|
1929
|
-
district: item?.data?.area_with_type,
|
|
1930
|
-
fullAddress: item?.unrestricted_value,
|
|
1931
|
-
fiasCode: item?.data?.fias_id,
|
|
1932
|
-
house: item?.data?.house,
|
|
1933
|
-
locality: item?.data?.settlement_with_type,
|
|
1934
|
-
okatoRegionCode: item?.data?.okato,
|
|
1935
|
-
postcode: item?.data?.postal_code,
|
|
1936
|
-
region: item?.data?.region,
|
|
1937
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
1938
|
-
street: item?.data?.street,
|
|
1939
|
-
qc: item?.data?.qc,
|
|
1940
|
-
qcComplete: item?.data?.qc_complete,
|
|
1941
|
-
qcHouse: item?.data?.qc_house,
|
|
1942
|
-
});
|
|
1874
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
1943
1875
|
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
});
|
|
1876
|
+
function parseDecimal(value) {
|
|
1877
|
+
const rawValue = (value || '').replace(/\D/g, '');
|
|
1878
|
+
const unsafeDecimal = parseInt(rawValue, 10);
|
|
1879
|
+
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
1880
|
+
}
|
|
1950
1881
|
|
|
1951
|
-
|
|
1882
|
+
function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
|
|
1883
|
+
const rangeValue = list.length ? list.indexOf(value) : value;
|
|
1884
|
+
const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
|
|
1885
|
+
const percentage = (rangeValueShift * 100) / (max - min);
|
|
1886
|
+
const inputStyle = {
|
|
1887
|
+
backgroundSize: `${percentage.toFixed(2)}% 100%`,
|
|
1888
|
+
};
|
|
1889
|
+
return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
|
|
1890
|
+
const rawValue = parseDecimal(ev.target?.value);
|
|
1891
|
+
const newValue = list.length ? list[rawValue] : rawValue;
|
|
1892
|
+
onChange && onChange(newValue || 0);
|
|
1893
|
+
}) }) })] }));
|
|
1894
|
+
}
|
|
1952
1895
|
|
|
1953
|
-
const
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
const handleChange = useCallback((
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
e.preventDefault();
|
|
1967
|
-
onChange && onChange(!value);
|
|
1968
|
-
}, [onChange, disabled, value]);
|
|
1969
|
-
const icon = isRadio ? (jsx("div", { className: "absolute left-1 w-3 h-3 rounded-full bg-primary-main" })) : (jsx(SVG, { paths: CHECK_PATHS, className: "absolute left-1 ml-px block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }));
|
|
1970
|
-
return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$2(text)] }) }));
|
|
1971
|
-
});
|
|
1972
|
-
const renderText$2 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
|
|
1973
|
-
const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
|
|
1974
|
-
const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
|
|
1975
|
-
const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
|
|
1976
|
-
|
|
1977
|
-
const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
|
|
1978
|
-
|
|
1979
|
-
const AddressMatchField = JSX(({ field, input }) => {
|
|
1980
|
-
return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
|
|
1896
|
+
const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
|
|
1897
|
+
const DEFAULT_MIN = 1;
|
|
1898
|
+
const DEFAULT_MAX = 100;
|
|
1899
|
+
const InputRange = JSX((props) => {
|
|
1900
|
+
const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
|
|
1901
|
+
const normalizedProps = useNormalizedInput(props, {
|
|
1902
|
+
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
1903
|
+
format: toLocalNumberFormat(),
|
|
1904
|
+
});
|
|
1905
|
+
const handleChange = useCallback((ev) => {
|
|
1906
|
+
onChange && onChange(parseDecimal(ev.target?.value));
|
|
1907
|
+
}, [onChange]);
|
|
1908
|
+
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
1981
1909
|
});
|
|
1910
|
+
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
1911
|
+
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
1982
1912
|
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
1988
|
-
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
1989
|
-
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
1990
|
-
if (isLoad || !points) {
|
|
1991
|
-
return;
|
|
1992
|
-
}
|
|
1993
|
-
map.geoObjects.removeAll();
|
|
1994
|
-
if (!points.length) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
1998
|
-
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
1999
|
-
if (points.length && points.every((_) => 'type' in _)) {
|
|
2000
|
-
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
2001
|
-
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
2002
|
-
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
2003
|
-
officeClusterer.add(officesGeoObjects);
|
|
2004
|
-
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
2005
|
-
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
2006
|
-
map.geoObjects.add(officeClusterer);
|
|
2007
|
-
}
|
|
2008
|
-
else {
|
|
2009
|
-
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
2010
|
-
officeClusterer.add(geoObjects);
|
|
2011
|
-
map.geoObjects.add(officeClusterer);
|
|
2012
|
-
}
|
|
2013
|
-
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
2014
|
-
if (map.getZoom() > 10) {
|
|
2015
|
-
map.setZoom(10);
|
|
2016
|
-
}
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
2019
|
-
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
2020
|
-
return new yandexMaps.Clusterer({
|
|
2021
|
-
clusterIcons: [
|
|
2022
|
-
{
|
|
2023
|
-
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2024
|
-
size: [78, 84],
|
|
2025
|
-
offset: [-35, -50],
|
|
2026
|
-
},
|
|
2027
|
-
],
|
|
2028
|
-
clusterIconContentLayout,
|
|
2029
|
-
clusterHideIconOnBalloonOpen: false,
|
|
2030
|
-
geoObjectHideIconOnBalloonOpen: false,
|
|
2031
|
-
});
|
|
2032
|
-
};
|
|
2033
|
-
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
2034
|
-
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
2035
|
-
balloonContentHeader: content?.header,
|
|
2036
|
-
balloonContentBody: content?.body,
|
|
2037
|
-
balloonContentFooter: content?.footer,
|
|
2038
|
-
hintContent: content?.hint,
|
|
2039
|
-
}, {
|
|
2040
|
-
iconLayout: 'default#image',
|
|
2041
|
-
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2042
|
-
iconImageSize: [78, 84],
|
|
2043
|
-
iconImageOffset: [-35, -50],
|
|
2044
|
-
}));
|
|
2045
|
-
};
|
|
1913
|
+
const MIN_CREDIT_AMOUNT = 1000;
|
|
1914
|
+
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
1915
|
+
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
1916
|
+
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
2046
1917
|
|
|
2047
|
-
const
|
|
2048
|
-
focus: 'focus:border-primary-text focus:border',
|
|
2049
|
-
hover: 'hover:bg-primary-hover',
|
|
2050
|
-
active: 'active:bg-primary-active',
|
|
2051
|
-
font: 'text-center font-sans',
|
|
2052
|
-
};
|
|
1918
|
+
const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
|
|
2053
1919
|
|
|
2054
|
-
const
|
|
2055
|
-
...defaultStyle,
|
|
2056
|
-
border: 'border border-transparent rounded-md',
|
|
2057
|
-
position: 'absolute flex items-center justify-center',
|
|
2058
|
-
};
|
|
2059
|
-
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
2060
|
-
const setUserGeoLocation = () => {
|
|
2061
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2062
|
-
// @ts-ignore
|
|
2063
|
-
yandexMaps.geolocation
|
|
2064
|
-
.get({
|
|
2065
|
-
provider: 'yandex',
|
|
2066
|
-
autoReverseGeocode: true,
|
|
2067
|
-
mapStateAutoApply: true,
|
|
2068
|
-
})
|
|
2069
|
-
.then(function (result) {
|
|
2070
|
-
map.current.geoObjects.add(result.geoObjects);
|
|
2071
|
-
});
|
|
2072
|
-
};
|
|
2073
|
-
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
2074
|
-
};
|
|
1920
|
+
const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
|
|
2075
1921
|
|
|
2076
|
-
const
|
|
2077
|
-
|
|
2078
|
-
const script = document.getElementById(url);
|
|
2079
|
-
if (script) {
|
|
2080
|
-
const ns = getNS(namespaceName);
|
|
2081
|
-
if (ns) {
|
|
2082
|
-
return Promise.resolve(ns);
|
|
2083
|
-
}
|
|
2084
|
-
else {
|
|
2085
|
-
return new Promise((resolve) => {
|
|
2086
|
-
script.addEventListener('load', () => {
|
|
2087
|
-
resolve(getNS(namespaceName));
|
|
2088
|
-
});
|
|
2089
|
-
});
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
else {
|
|
2093
|
-
return new Promise((resolve, reject) => {
|
|
2094
|
-
const newScript = document.createElement('script');
|
|
2095
|
-
newScript.src = url;
|
|
2096
|
-
newScript.async = true;
|
|
2097
|
-
newScript.id = url;
|
|
2098
|
-
newScript.addEventListener('load', () => {
|
|
2099
|
-
resolve(getNS(namespaceName));
|
|
2100
|
-
});
|
|
2101
|
-
newScript.addEventListener('error', (error) => {
|
|
2102
|
-
reject(error);
|
|
2103
|
-
});
|
|
2104
|
-
document.head.appendChild(newScript);
|
|
2105
|
-
});
|
|
2106
|
-
}
|
|
2107
|
-
};
|
|
2108
|
-
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
2109
|
-
const [externalNS, setExternalNS] = useState(undefined);
|
|
1922
|
+
const useElementSpace = (ref, heightEl) => {
|
|
1923
|
+
const [spaceAbove, setSpaceAbove] = useState(false);
|
|
2110
1924
|
useEffect(() => {
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
}
|
|
2117
|
-
})
|
|
2118
|
-
.catch((error) => {
|
|
2119
|
-
console.error(`Failed to initialize external namespace: ${error}`);
|
|
2120
|
-
});
|
|
2121
|
-
return () => {
|
|
2122
|
-
isMounted = false;
|
|
2123
|
-
if (unmountNS) {
|
|
2124
|
-
const script = document.getElementById(url);
|
|
2125
|
-
if (script) {
|
|
2126
|
-
document.head.removeChild(script);
|
|
2127
|
-
}
|
|
2128
|
-
setExternalNS(undefined);
|
|
1925
|
+
const handleResize = () => {
|
|
1926
|
+
if (ref?.current) {
|
|
1927
|
+
const { top } = ref.current.getBoundingClientRect();
|
|
1928
|
+
const hasSpaceAbove = top > heightEl;
|
|
1929
|
+
setSpaceAbove(hasSpaceAbove);
|
|
2129
1930
|
}
|
|
2130
1931
|
};
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
const useYandexMaps = () => {
|
|
2137
|
-
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
2138
|
-
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
1932
|
+
handleResize();
|
|
1933
|
+
window.addEventListener('resize', handleResize);
|
|
1934
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
1935
|
+
}, [ref]);
|
|
1936
|
+
return spaceAbove;
|
|
2139
1937
|
};
|
|
2140
1938
|
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
1939
|
+
const DAY_COUNT = 6;
|
|
1940
|
+
const WEEK_COUNT = 7;
|
|
1941
|
+
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
1942
|
+
const calendarCells = [];
|
|
1943
|
+
let dayCounter = 1;
|
|
1944
|
+
for (let i = 0; i < DAY_COUNT; i++) {
|
|
1945
|
+
const rowCells = [];
|
|
1946
|
+
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
1947
|
+
if (i === 0 && j < firstDayOfWeek) {
|
|
1948
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1949
|
+
}
|
|
1950
|
+
else if (dayCounter > totalDays) {
|
|
1951
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1952
|
+
}
|
|
1953
|
+
else {
|
|
1954
|
+
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
1955
|
+
const isToday = checkIsToday(currentDate, today);
|
|
1956
|
+
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
1957
|
+
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
1958
|
+
dayCounter++;
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
1962
|
+
}
|
|
1963
|
+
return calendarCells;
|
|
2145
1964
|
};
|
|
2146
|
-
|
|
2147
|
-
const
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
|
|
2152
|
-
yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
|
|
2153
|
-
};
|
|
2154
|
-
return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
|
|
2155
|
-
});
|
|
1965
|
+
const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
|
|
1966
|
+
const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
|
|
1967
|
+
const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
|
|
1968
|
+
'border-transparent hover:bg-gray': !isToday,
|
|
1969
|
+
}, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
|
|
2156
1970
|
|
|
2157
|
-
const
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
}
|
|
2177
|
-
map.current = new yandexMaps.Map(parentDiv.current, {
|
|
2178
|
-
center: getCenterPoint(points),
|
|
2179
|
-
zoom,
|
|
2180
|
-
controls: [],
|
|
2181
|
-
suppressMapOpenBlock: true,
|
|
2182
|
-
});
|
|
2183
|
-
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
2184
|
-
});
|
|
2185
|
-
}
|
|
2186
|
-
// zoom к выбранному отделению банка в рамках задачи по retail
|
|
2187
|
-
if (map.current && selectedAddress) {
|
|
2188
|
-
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
2189
|
-
const firstGeoObject = res.geoObjects.get(0);
|
|
2190
|
-
const coords = firstGeoObject.geometry.getCoordinates();
|
|
2191
|
-
map.current.setCenter(coords);
|
|
2192
|
-
map.current.setZoom(18);
|
|
2193
|
-
});
|
|
2194
|
-
}
|
|
2195
|
-
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
2196
|
-
if (!yandexMaps) {
|
|
2197
|
-
return null;
|
|
2198
|
-
}
|
|
2199
|
-
const zIndex = 'z-10';
|
|
2200
|
-
return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
1971
|
+
const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
|
|
1972
|
+
const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
|
|
1973
|
+
const handleDateClick = useCallback((date) => {
|
|
1974
|
+
onDateSelect(date);
|
|
1975
|
+
setValue(false);
|
|
1976
|
+
}, []);
|
|
1977
|
+
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
1978
|
+
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
1979
|
+
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
1980
|
+
}), [currentYear, currentMonth]);
|
|
1981
|
+
return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
|
|
1982
|
+
firstDayOfWeek,
|
|
1983
|
+
today,
|
|
1984
|
+
totalDays,
|
|
1985
|
+
currentYear,
|
|
1986
|
+
currentMonth,
|
|
1987
|
+
min,
|
|
1988
|
+
max,
|
|
1989
|
+
onDateClick: handleDateClick,
|
|
1990
|
+
}) })] }));
|
|
2201
1991
|
});
|
|
2202
|
-
const getCenterPoint = (points) => {
|
|
2203
|
-
const centerCoords = [
|
|
2204
|
-
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
2205
|
-
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
2206
|
-
];
|
|
2207
|
-
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
2208
|
-
};
|
|
2209
|
-
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
2210
|
-
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
2211
1992
|
|
|
2212
|
-
const
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
1993
|
+
const months = [
|
|
1994
|
+
'Январь',
|
|
1995
|
+
'Февраль',
|
|
1996
|
+
'Март',
|
|
1997
|
+
'Апрель',
|
|
1998
|
+
'Май',
|
|
1999
|
+
'Июнь',
|
|
2000
|
+
'Июль',
|
|
2001
|
+
'Август',
|
|
2002
|
+
'Сентябрь',
|
|
2003
|
+
'Октябрь',
|
|
2004
|
+
'Ноябрь',
|
|
2005
|
+
'Декабрь',
|
|
2006
|
+
];
|
|
2007
|
+
|
|
2008
|
+
function normalizeWithMask(value, pattern) {
|
|
2009
|
+
const valueNumbers = value.replace(/\D/g, '');
|
|
2010
|
+
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
2011
|
+
return value;
|
|
2220
2012
|
}
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
},
|
|
2229
|
-
credentials: 'include',
|
|
2230
|
-
body: body ? JSON.stringify(body) : null,
|
|
2231
|
-
});
|
|
2013
|
+
const patternInArr = [...pattern];
|
|
2014
|
+
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
2015
|
+
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
2016
|
+
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
2017
|
+
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
2018
|
+
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
2019
|
+
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2232
2020
|
}
|
|
2233
|
-
const
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
};
|
|
2237
|
-
|
|
2238
|
-
const fetchRegionOffices = async (regionKey) => {
|
|
2239
|
-
const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
|
|
2240
|
-
regionRfCd: {
|
|
2241
|
-
key: regionKey,
|
|
2242
|
-
},
|
|
2243
|
-
cashCardFlg: true,
|
|
2244
|
-
});
|
|
2245
|
-
return (response?.offices?.map((office) => ({
|
|
2246
|
-
...office,
|
|
2247
|
-
gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
|
|
2248
|
-
gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
|
|
2249
|
-
})) || []);
|
|
2250
|
-
};
|
|
2251
|
-
const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
|
|
2021
|
+
const isPlaceholder$1 = (_) => _ === '_';
|
|
2022
|
+
const isDigit$1 = (_) => /\d/.test(_);
|
|
2023
|
+
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2252
2024
|
|
|
2253
|
-
const
|
|
2254
|
-
|
|
2255
|
-
const onToggle = useCallback(() => {
|
|
2256
|
-
setIsUnfolded((_) => !_);
|
|
2257
|
-
}, []);
|
|
2258
|
-
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2259
|
-
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2260
|
-
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2261
|
-
});
|
|
2025
|
+
const START_YEAR = 1940;
|
|
2026
|
+
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2262
2027
|
|
|
2263
|
-
|
|
2028
|
+
const ICON_PROPS$1 = {
|
|
2029
|
+
name: 'CalendarIcon',
|
|
2030
|
+
iconVersion: 'black',
|
|
2031
|
+
width: '24',
|
|
2032
|
+
height: '24',
|
|
2033
|
+
};
|
|
2034
|
+
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2264
2035
|
const ref = useRef(null);
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2036
|
+
const [inputValue, setInputValue] = useState(value || '');
|
|
2037
|
+
const handleChange = (ev) => {
|
|
2038
|
+
const val = ev.target?.value;
|
|
2039
|
+
if (typeof val === 'string' && val?.length < 11) {
|
|
2040
|
+
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2269
2041
|
}
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
}, [callback, ...deps]);
|
|
2278
|
-
return ref;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2282
|
-
const containerRef = useRef(null);
|
|
2283
|
-
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2284
|
-
if (containerRef.current) {
|
|
2285
|
-
containerRef.current.style.maxHeight = isUnfolded
|
|
2286
|
-
? `${childrenWrapperEl.scrollHeight}px`
|
|
2287
|
-
: '';
|
|
2042
|
+
};
|
|
2043
|
+
const onBlur = () => {
|
|
2044
|
+
if (checkIsValidDate(inputValue)) {
|
|
2045
|
+
const [day, month, year] = inputValue.split('.');
|
|
2046
|
+
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2047
|
+
setSelectedMonth(Number(month) - 1);
|
|
2048
|
+
setSelectedYear(Number(year));
|
|
2288
2049
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2050
|
+
else {
|
|
2051
|
+
setInputValue(value || '');
|
|
2052
|
+
}
|
|
2053
|
+
};
|
|
2054
|
+
const onInputClick = () => {
|
|
2055
|
+
if (ref.current !== null) {
|
|
2056
|
+
ref.current.focus();
|
|
2057
|
+
}
|
|
2058
|
+
onClick?.();
|
|
2059
|
+
};
|
|
2060
|
+
useEffect(() => {
|
|
2061
|
+
setInputValue(value || '');
|
|
2062
|
+
}, [value]);
|
|
2063
|
+
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
2291
2064
|
});
|
|
2292
|
-
|
|
2293
|
-
const
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2065
|
+
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
2066
|
+
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
2067
|
+
const checkIsValidDate = (date) => {
|
|
2068
|
+
const [day, month, year] = date.split('.');
|
|
2069
|
+
if (isValidYear(year)) {
|
|
2070
|
+
if (isValidMonth(month)) {
|
|
2071
|
+
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2072
|
+
let maxDateOfMonth = 0;
|
|
2073
|
+
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2074
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
2075
|
+
maxDateOfMonth++;
|
|
2076
|
+
}
|
|
2077
|
+
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2078
|
+
return true;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2297
2081
|
}
|
|
2298
|
-
return
|
|
2299
|
-
}
|
|
2300
|
-
const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
|
|
2301
|
-
const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
|
|
2302
|
-
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
2082
|
+
return false;
|
|
2083
|
+
};
|
|
2303
2084
|
|
|
2304
|
-
const
|
|
2085
|
+
const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
|
|
2086
|
+
'hover:border-black active:border-black focus:border-black';
|
|
2087
|
+
const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
|
|
2305
2088
|
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
const
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2089
|
+
const MONTHS_COUNT = 11;
|
|
2090
|
+
const MONTHS_OPTIONS = months.map((key) => ({ key }));
|
|
2091
|
+
const YEARS_OPTIONS = getYears()
|
|
2092
|
+
.reverse()
|
|
2093
|
+
.map((key) => ({ key: String(key) }));
|
|
2094
|
+
const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
|
|
2095
|
+
const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
|
|
2096
|
+
const ref = useOutsideClick(close);
|
|
2097
|
+
const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
|
|
2098
|
+
const handleNextMonth = useCallback(() => {
|
|
2099
|
+
if (selectedMonth + 1 <= MONTHS_COUNT) {
|
|
2100
|
+
onMonthSelect(selectedMonth + 1);
|
|
2101
|
+
}
|
|
2102
|
+
else {
|
|
2103
|
+
onMonthSelect(0);
|
|
2104
|
+
onYearSelect(selectedYear + 1);
|
|
2105
|
+
}
|
|
2106
|
+
}, [selectedMonth]);
|
|
2107
|
+
const handlePrevMonth = useCallback(() => {
|
|
2108
|
+
if (selectedMonth - 1 >= 0) {
|
|
2109
|
+
onMonthSelect(selectedMonth - 1);
|
|
2110
|
+
}
|
|
2111
|
+
else {
|
|
2112
|
+
onMonthSelect(11);
|
|
2113
|
+
onYearSelect(selectedYear - 1);
|
|
2114
|
+
}
|
|
2115
|
+
}, [selectedMonth]);
|
|
2116
|
+
const handleSelectMonth = useCallback(({ key }) => {
|
|
2117
|
+
onMonthSelect(months.indexOf(key));
|
|
2118
|
+
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2119
|
+
handleChangeMonth({
|
|
2120
|
+
maxDateOfMonth,
|
|
2121
|
+
selectedYear,
|
|
2122
|
+
selectedMonth: months.indexOf(key),
|
|
2123
|
+
value,
|
|
2124
|
+
onChange,
|
|
2125
|
+
});
|
|
2126
|
+
}, [value]);
|
|
2127
|
+
const handleSelectYear = useCallback(({ key }) => {
|
|
2128
|
+
onYearSelect(Number(key));
|
|
2129
|
+
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
2130
|
+
}, [value]);
|
|
2131
|
+
return {
|
|
2132
|
+
handleChangeVisibleCalendar,
|
|
2133
|
+
handleNextMonth,
|
|
2134
|
+
handlePrevMonth,
|
|
2135
|
+
handleSelectMonth,
|
|
2136
|
+
handleSelectYear,
|
|
2137
|
+
monthsOptions: MONTHS_OPTIONS,
|
|
2138
|
+
yearsOptions: YEARS_OPTIONS,
|
|
2139
|
+
ref,
|
|
2140
|
+
};
|
|
2338
2141
|
};
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
['workingFriday', 'Пт', 'Пятница'],
|
|
2346
|
-
['workingSaturday', 'Сб', 'Суббота'],
|
|
2347
|
-
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2348
|
-
];
|
|
2349
|
-
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2350
|
-
key,
|
|
2351
|
-
title,
|
|
2352
|
-
short,
|
|
2353
|
-
status: Boolean(workSchedule?.[key]),
|
|
2354
|
-
get workTime() {
|
|
2355
|
-
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2356
|
-
},
|
|
2357
|
-
get lunchHour() {
|
|
2358
|
-
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2359
|
-
},
|
|
2360
|
-
get hasLunch() {
|
|
2361
|
-
return /\d+/.test(this.lunchHour ?? '');
|
|
2362
|
-
},
|
|
2363
|
-
}));
|
|
2364
|
-
|
|
2365
|
-
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2366
|
-
if (!scheduleDescription) {
|
|
2367
|
-
return null;
|
|
2142
|
+
const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
|
|
2143
|
+
const date = new Date(selectedYear, selectedMonth, 1);
|
|
2144
|
+
let maxDateOfMonth = 0;
|
|
2145
|
+
while (date.getMonth() === selectedMonth) {
|
|
2146
|
+
maxDateOfMonth++;
|
|
2147
|
+
date.setDate(date.getDate() + 1);
|
|
2368
2148
|
}
|
|
2369
|
-
|
|
2370
|
-
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
2149
|
+
return maxDateOfMonth;
|
|
2371
2150
|
};
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
|
|
2376
|
-
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2377
|
-
return weekDayMap;
|
|
2378
|
-
}
|
|
2379
|
-
return weekDayMap.map((_) => ({
|
|
2380
|
-
..._,
|
|
2381
|
-
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2382
|
-
}));
|
|
2151
|
+
const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
|
|
2152
|
+
value &&
|
|
2153
|
+
onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
|
|
2383
2154
|
};
|
|
2384
|
-
const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
|
|
2385
2155
|
|
|
2386
|
-
const
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2392
|
-
red: { border: 'border-error/30', text: 'text-error' },
|
|
2156
|
+
const ICON_PROPS = {
|
|
2157
|
+
name: 'ArrowUpIcon',
|
|
2158
|
+
iconVersion: 'black',
|
|
2159
|
+
width: '24',
|
|
2160
|
+
height: '24',
|
|
2393
2161
|
};
|
|
2394
|
-
const
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
2399
|
-
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
2400
|
-
if (!currentWeekDay) {
|
|
2401
|
-
return null;
|
|
2402
|
-
}
|
|
2403
|
-
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
2404
|
-
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
2162
|
+
const SELECT_PROPS = {
|
|
2163
|
+
className: 'min-w-32',
|
|
2164
|
+
iconVersion: 'black',
|
|
2165
|
+
isBorder: false,
|
|
2405
2166
|
};
|
|
2167
|
+
const DatePicker = JSX(
|
|
2168
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2169
|
+
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2170
|
+
const [showCalendar, { setValue }] = useBool(false);
|
|
2171
|
+
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2172
|
+
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2173
|
+
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2174
|
+
onYearSelect: setSelectedYear,
|
|
2175
|
+
onMonthSelect: setSelectedMonth,
|
|
2176
|
+
onShowCalendar: setValue,
|
|
2177
|
+
selectedYear,
|
|
2178
|
+
selectedMonth,
|
|
2179
|
+
showCalendar,
|
|
2180
|
+
onChange,
|
|
2181
|
+
value,
|
|
2182
|
+
});
|
|
2183
|
+
const spaceAbove = useElementSpace(ref, 370);
|
|
2184
|
+
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2185
|
+
handleChangeVisibleCalendar,
|
|
2186
|
+
value,
|
|
2187
|
+
valid,
|
|
2188
|
+
onChange,
|
|
2189
|
+
disabled,
|
|
2190
|
+
setSelectedMonth,
|
|
2191
|
+
setSelectedYear,
|
|
2192
|
+
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2193
|
+
'bottom-full': spaceAbove,
|
|
2194
|
+
}), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
|
|
2195
|
+
});
|
|
2406
2196
|
|
|
2407
|
-
const
|
|
2408
|
-
if (!status) {
|
|
2409
|
-
return 'Не работает';
|
|
2410
|
-
}
|
|
2411
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2412
|
-
};
|
|
2413
|
-
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
2197
|
+
const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
|
|
2414
2198
|
|
|
2415
|
-
const
|
|
2416
|
-
const labels = ['Подробнее', 'Скрыть'];
|
|
2417
|
-
const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
|
|
2199
|
+
const BirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthday'), validatorObj.birthday, input?.required) })));
|
|
2418
2200
|
|
|
2419
|
-
const
|
|
2420
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2421
|
-
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2422
|
-
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2423
|
-
if (!workSchedule) {
|
|
2424
|
-
return '';
|
|
2425
|
-
}
|
|
2426
|
-
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2427
|
-
return renderMatchingTimeOfWork(timeOfWork);
|
|
2428
|
-
}
|
|
2429
|
-
if (workSchedule.businessScheduleVisibleTag &&
|
|
2430
|
-
workSchedule.businessScheduleDescription === null) {
|
|
2431
|
-
return renderIndividualTimeOfWork(timeOfWork);
|
|
2432
|
-
}
|
|
2433
|
-
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2434
|
-
};
|
|
2435
|
-
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2436
|
-
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2437
|
-
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2201
|
+
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2438
2202
|
|
|
2439
|
-
const
|
|
2440
|
-
if (!workSchedule) {
|
|
2441
|
-
return null;
|
|
2442
|
-
}
|
|
2443
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2444
|
-
return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
|
|
2445
|
-
phone,
|
|
2446
|
-
fax,
|
|
2447
|
-
phoneBusiness,
|
|
2448
|
-
phoneNatural,
|
|
2449
|
-
phoneCallCentre,
|
|
2450
|
-
phoneCurrencyControl,
|
|
2451
|
-
workSchedule,
|
|
2452
|
-
exchangeRate,
|
|
2453
|
-
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2454
|
-
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2455
|
-
phone,
|
|
2456
|
-
fax,
|
|
2457
|
-
phoneBusiness,
|
|
2458
|
-
phoneNatural,
|
|
2459
|
-
phoneCallCentre,
|
|
2460
|
-
phoneCurrencyControl,
|
|
2461
|
-
workSchedule,
|
|
2462
|
-
exchangeRate,
|
|
2463
|
-
}) }));
|
|
2464
|
-
},
|
|
2465
|
-
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2466
|
-
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2467
|
-
};
|
|
2468
|
-
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2469
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2470
|
-
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2471
|
-
? 'Для физических лиц'
|
|
2472
|
-
: 'Для физических и юридических лиц';
|
|
2473
|
-
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
2474
|
-
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2475
|
-
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2476
|
-
};
|
|
2477
|
-
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2478
|
-
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2479
|
-
const header = capitalizedFirstLetter$1(name);
|
|
2480
|
-
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2481
|
-
return { header, body };
|
|
2482
|
-
};
|
|
2203
|
+
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
2483
2204
|
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
sellingCoins: false,
|
|
2491
|
-
buyingCoins: false,
|
|
2492
|
-
bullionOperations: false,
|
|
2493
|
-
preciousMetalsOperations: false,
|
|
2494
|
-
transferringDataToBiometricSystem: false,
|
|
2495
|
-
};
|
|
2496
|
-
const FILTRATION_LABELS = {
|
|
2497
|
-
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
2498
|
-
workingSaturday: 'Открыты по субботам',
|
|
2499
|
-
terminalTypeAtms: 'Банкоматы',
|
|
2500
|
-
terminalTypeTerm: 'Терминалы',
|
|
2501
|
-
workAllTime: 'Круглосуточно',
|
|
2502
|
-
billAcceptorEnable: 'Прием наличных',
|
|
2503
|
-
premiumService: 'Премиальное обслуживание',
|
|
2504
|
-
privateBanking: 'Услуга Private banking',
|
|
2505
|
-
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
2506
|
-
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
2507
|
-
bullionOperations: 'Операции со слитками',
|
|
2508
|
-
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
2509
|
-
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
2510
|
-
locationDisabledPeople: 'Для маломобильных',
|
|
2511
|
-
designDisabledPeople: 'Для слабовидящих',
|
|
2512
|
-
remoteWorkplace: 'Удаленное рабочее место',
|
|
2513
|
-
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
2514
|
-
};
|
|
2515
|
-
const FILTRATION_PREDICATES$1 = {
|
|
2516
|
-
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
2517
|
-
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
2518
|
-
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
2519
|
-
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
2520
|
-
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
2521
|
-
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
2522
|
-
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
2523
|
-
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
2524
|
-
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
2525
|
-
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
2526
|
-
};
|
|
2527
|
-
|
|
2528
|
-
const filterItems$1 = (data, filtrationState) => {
|
|
2529
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
2530
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
2531
|
-
};
|
|
2532
|
-
|
|
2533
|
-
const defaultEmptyFunction$1 = () => void 0;
|
|
2534
|
-
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
|
|
2535
|
-
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
2536
|
-
const _filteredItems = filterItems$1(data, filtrationState);
|
|
2537
|
-
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
2538
|
-
const _points = [
|
|
2539
|
-
..._filteredItems.map((_) => ({
|
|
2540
|
-
type: 'offices',
|
|
2541
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2542
|
-
content: getBalloon(_),
|
|
2543
|
-
})),
|
|
2544
|
-
..._filteredRemoteWorkplaces.map((_) => ({
|
|
2545
|
-
type: 'workplaces',
|
|
2546
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2547
|
-
content: getBalloonRemoteWorkplaces({
|
|
2548
|
-
address: _.address,
|
|
2549
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
2550
|
-
}),
|
|
2551
|
-
})),
|
|
2552
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
2553
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
2554
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
2555
|
-
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
2556
|
-
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
2557
|
-
};
|
|
2558
|
-
|
|
2559
|
-
const useLeadFormData = (typeField) => {
|
|
2560
|
-
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
2561
|
-
if (data && 'errorMessage' in data) {
|
|
2562
|
-
return { error };
|
|
2563
|
-
}
|
|
2564
|
-
return { data: data, error };
|
|
2565
|
-
};
|
|
2566
|
-
const fetchData = async (url) => {
|
|
2567
|
-
const result = await fetchJSON(url, { method: 'POST' });
|
|
2568
|
-
return result || [];
|
|
2569
|
-
};
|
|
2570
|
-
|
|
2571
|
-
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
2205
|
+
const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
|
|
2206
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill: pathFill, ...options }, i) => {
|
|
2207
|
+
const resultOptions = { ...commonOptions, ...options };
|
|
2208
|
+
return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
|
|
2209
|
+
}) }));
|
|
2210
|
+
});
|
|
2572
2211
|
|
|
2573
|
-
const
|
|
2574
|
-
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2212
|
+
const defaultCheckStyle = 'appearance-none w-5 h-5 border-solid flex-none';
|
|
2575
2213
|
|
|
2576
|
-
const
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
field?.('addressRetail')?.onChange?.('');
|
|
2214
|
+
const CHECK_PATHS = [
|
|
2215
|
+
{
|
|
2216
|
+
d: 'M10.207.793a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L3.5 6.086 8.793.793a1 1 0 0 1 1.414 0Z',
|
|
2217
|
+
fillRule: 'evenodd',
|
|
2218
|
+
clipRule: 'evenodd',
|
|
2219
|
+
fill: 'white',
|
|
2220
|
+
},
|
|
2221
|
+
];
|
|
2222
|
+
const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
|
|
2223
|
+
const handleChange = useCallback((e) => {
|
|
2224
|
+
if (disabled) {
|
|
2225
|
+
return;
|
|
2589
2226
|
}
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
});
|
|
2596
|
-
const isRegionSelected = Boolean(regionValue?.key);
|
|
2597
|
-
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
2598
|
-
key: id?.toString() || '',
|
|
2599
|
-
text: address,
|
|
2600
|
-
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
2227
|
+
e.preventDefault();
|
|
2228
|
+
onChange && onChange(!value);
|
|
2229
|
+
}, [onChange, disabled, value]);
|
|
2230
|
+
const icon = isRadio ? (jsx("div", { className: "absolute left-1 w-3 h-3 rounded-full bg-primary-main" })) : (jsx(SVG, { paths: CHECK_PATHS, className: "absolute left-1 ml-px block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }));
|
|
2231
|
+
return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$2(text)] }) }));
|
|
2601
2232
|
});
|
|
2233
|
+
const renderText$2 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
|
|
2234
|
+
const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
|
|
2235
|
+
const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
|
|
2236
|
+
const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
|
|
2602
2237
|
|
|
2603
|
-
const
|
|
2604
|
-
|
|
2605
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
2606
|
-
const handleFocus = useCallback((ev) => {
|
|
2607
|
-
setIsFocused(true);
|
|
2608
|
-
onFocus && onFocus(ev);
|
|
2609
|
-
}, []);
|
|
2610
|
-
const handleBlur = useCallback(() => {
|
|
2611
|
-
setIsFocused(false);
|
|
2612
|
-
onChange && onChange(normalize(value));
|
|
2613
|
-
onBlur && onBlur();
|
|
2614
|
-
}, [onChange, value]);
|
|
2615
|
-
return {
|
|
2616
|
-
value: (isFocused || !format ? value : format(value)),
|
|
2617
|
-
onFocus: handleFocus,
|
|
2618
|
-
onBlur: handleBlur,
|
|
2619
|
-
};
|
|
2620
|
-
};
|
|
2238
|
+
const FIELD_NAME$c = 'consentToReceiveMaterials';
|
|
2239
|
+
const ConsentToReceiveMaterialsField = JSX(({ field, input }) => (jsx(Checkbox, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u043D\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0445 \u0438 \u0430\u043D\u0430\u043B\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u043E\u0432 \u043F\u043E \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u0435", ...getValidation(field(FIELD_NAME$c), validatorObj[FIELD_NAME$c], input?.required) })));
|
|
2621
2240
|
|
|
2622
|
-
const
|
|
2241
|
+
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.desiredMeetingDate, input?.required) })));
|
|
2623
2242
|
|
|
2624
|
-
|
|
2625
|
-
const
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
}
|
|
2243
|
+
const EmailField = JSX(({ field, input }) => {
|
|
2244
|
+
const { required, ...rest } = input;
|
|
2245
|
+
return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
|
|
2246
|
+
});
|
|
2629
2247
|
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
}
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
const newValue = list.length ? list[rawValue] : rawValue;
|
|
2640
|
-
onChange && onChange(newValue || 0);
|
|
2641
|
-
}) }) })] }));
|
|
2642
|
-
}
|
|
2248
|
+
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
2249
|
+
const SERVICE_DIRECTIONS = [
|
|
2250
|
+
{ key: 'Физическое лицо' },
|
|
2251
|
+
{ key: 'Юридическое лицо / ИП' },
|
|
2252
|
+
];
|
|
2253
|
+
const FEEDBACK_METHOD = [
|
|
2254
|
+
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2255
|
+
{ key: 'email', text: 'Электронное сообщение' },
|
|
2256
|
+
];
|
|
2643
2257
|
|
|
2644
|
-
const
|
|
2645
|
-
const DEFAULT_MIN = 1;
|
|
2646
|
-
const DEFAULT_MAX = 100;
|
|
2647
|
-
const InputRange = JSX((props) => {
|
|
2648
|
-
const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
|
|
2649
|
-
const normalizedProps = useNormalizedInput(props, {
|
|
2650
|
-
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
2651
|
-
format: toLocalNumberFormat(),
|
|
2652
|
-
});
|
|
2653
|
-
const handleChange = useCallback((ev) => {
|
|
2654
|
-
onChange && onChange(parseDecimal(ev.target?.value));
|
|
2655
|
-
}, [onChange]);
|
|
2656
|
-
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
2657
|
-
});
|
|
2658
|
-
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
2659
|
-
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
2258
|
+
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
2660
2259
|
|
|
2661
|
-
const
|
|
2662
|
-
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
2663
|
-
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
2664
|
-
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
2260
|
+
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
2665
2261
|
|
|
2666
2262
|
function copy(source, target) {
|
|
2667
2263
|
for (const [k, v] of source.entries()) {
|
|
@@ -2811,320 +2407,1278 @@
|
|
|
2811
2407
|
return useLocalStore();
|
|
2812
2408
|
};
|
|
2813
2409
|
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
};
|
|
2855
|
-
handleResize();
|
|
2856
|
-
window.addEventListener('resize', handleResize);
|
|
2857
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
2858
|
-
}, [ref]);
|
|
2859
|
-
return spaceAbove;
|
|
2860
|
-
};
|
|
2861
|
-
|
|
2862
|
-
const DAY_COUNT = 6;
|
|
2863
|
-
const WEEK_COUNT = 7;
|
|
2864
|
-
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
2865
|
-
const calendarCells = [];
|
|
2866
|
-
let dayCounter = 1;
|
|
2867
|
-
for (let i = 0; i < DAY_COUNT; i++) {
|
|
2868
|
-
const rowCells = [];
|
|
2869
|
-
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
2870
|
-
if (i === 0 && j < firstDayOfWeek) {
|
|
2871
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2410
|
+
const getOrganizationActivityType = (options, okved) => {
|
|
2411
|
+
if (!okved) {
|
|
2412
|
+
return null;
|
|
2413
|
+
}
|
|
2414
|
+
const getOptionByKey = getOptionOp(options);
|
|
2415
|
+
const okvedType = +okved?.split('.')[0];
|
|
2416
|
+
const secondOkvedType = +okved?.split('.')[1];
|
|
2417
|
+
switch (okvedType) {
|
|
2418
|
+
case 1:
|
|
2419
|
+
return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
|
|
2420
|
+
case 35:
|
|
2421
|
+
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
2422
|
+
case 41:
|
|
2423
|
+
case 42:
|
|
2424
|
+
case 43:
|
|
2425
|
+
return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
|
|
2426
|
+
case 46:
|
|
2427
|
+
case 47:
|
|
2428
|
+
return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
|
|
2429
|
+
case 55:
|
|
2430
|
+
case 79:
|
|
2431
|
+
return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
|
|
2432
|
+
case 62:
|
|
2433
|
+
return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
|
|
2434
|
+
case 63:
|
|
2435
|
+
return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
|
|
2436
|
+
case 64:
|
|
2437
|
+
return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
|
|
2438
|
+
case 65:
|
|
2439
|
+
return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
|
|
2440
|
+
case 66:
|
|
2441
|
+
return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
|
|
2442
|
+
case 72:
|
|
2443
|
+
case 74:
|
|
2444
|
+
return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
|
|
2445
|
+
case 80:
|
|
2446
|
+
return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
|
|
2447
|
+
case 84: {
|
|
2448
|
+
if (secondOkvedType < 22) {
|
|
2449
|
+
return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
|
|
2872
2450
|
}
|
|
2873
|
-
|
|
2874
|
-
|
|
2451
|
+
if (secondOkvedType === 22) {
|
|
2452
|
+
return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
|
|
2875
2453
|
}
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2454
|
+
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
2455
|
+
}
|
|
2456
|
+
case 85:
|
|
2457
|
+
return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
|
|
2458
|
+
case 86:
|
|
2459
|
+
return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
|
|
2460
|
+
case 87:
|
|
2461
|
+
return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
|
|
2462
|
+
default: {
|
|
2463
|
+
if (okvedType >= 10 && okvedType <= 33) {
|
|
2464
|
+
return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
|
|
2465
|
+
}
|
|
2466
|
+
if (okvedType >= 5 && okvedType <= 9) {
|
|
2467
|
+
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
2468
|
+
}
|
|
2469
|
+
if (okvedType >= 49 && okvedType <= 53) {
|
|
2470
|
+
return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
|
|
2882
2471
|
}
|
|
2472
|
+
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
2883
2473
|
}
|
|
2884
|
-
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
2885
2474
|
}
|
|
2886
|
-
return calendarCells;
|
|
2887
2475
|
};
|
|
2888
|
-
const
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2476
|
+
const getEmployeesNumberOption = (options, count) => {
|
|
2477
|
+
if (!count) {
|
|
2478
|
+
return null;
|
|
2479
|
+
}
|
|
2480
|
+
const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
|
|
2481
|
+
key: _?.key ?? '',
|
|
2482
|
+
text: _?.value ?? '',
|
|
2483
|
+
}));
|
|
2484
|
+
return option;
|
|
2485
|
+
};
|
|
2486
|
+
const getOrganizationKind = (options, okopf) => {
|
|
2487
|
+
const getOptionByKey = getOptionOp(options);
|
|
2488
|
+
if ([40001, 40002, 71610].includes(okopf)) {
|
|
2489
|
+
return getOptionByKey('FOREIGN');
|
|
2490
|
+
}
|
|
2491
|
+
return getOptionByKey('RUSSIAN');
|
|
2492
|
+
};
|
|
2493
|
+
const getOrganizationType = (options, okopf, inn) => {
|
|
2494
|
+
const getOptionByKey = getOptionOp(options);
|
|
2495
|
+
if (inn === '7725114488') {
|
|
2496
|
+
return getOptionByKey('RSHB');
|
|
2497
|
+
}
|
|
2498
|
+
if (okopf === 50102) {
|
|
2499
|
+
return getOptionByKey('SOLE_TRADER');
|
|
2500
|
+
}
|
|
2501
|
+
if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
|
|
2502
|
+
return getOptionByKey('BUDGETARY');
|
|
2503
|
+
}
|
|
2504
|
+
return getOptionByKey('COMMERCIAL');
|
|
2505
|
+
};
|
|
2506
|
+
const getOptionOp = (options) => (key) => options
|
|
2507
|
+
.map((_) => ({ key: _.key, text: _.value }))
|
|
2508
|
+
.find((_) => _.key === key) ?? null;
|
|
2893
2509
|
|
|
2894
|
-
const
|
|
2895
|
-
const
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2510
|
+
const ESIA_FIELD_NAME = 'esiaAccountTypeCd';
|
|
2511
|
+
const isEsiaAuthorize = (field, name) => Boolean(field(ESIA_FIELD_NAME)?.value?.key) && field(name).value;
|
|
2512
|
+
|
|
2513
|
+
const AddressField = JSX(({ field, input }) => {
|
|
2514
|
+
const fieldName = input?.name || 'addressRegistration';
|
|
2515
|
+
const fieldValue = field(fieldName).value;
|
|
2516
|
+
const onDaDataChange = useCallback((item) => {
|
|
2517
|
+
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
2899
2518
|
}, []);
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2519
|
+
const onChange = useCallback((value) => {
|
|
2520
|
+
field?.(fieldName)?.onChange?.({
|
|
2521
|
+
apartment: '',
|
|
2522
|
+
city: '',
|
|
2523
|
+
district: '',
|
|
2524
|
+
fullAddress: value,
|
|
2525
|
+
fiasCode: '',
|
|
2526
|
+
house: '',
|
|
2527
|
+
locality: '',
|
|
2528
|
+
okatoRegionCode: '',
|
|
2529
|
+
postcode: '',
|
|
2530
|
+
region: '',
|
|
2531
|
+
regionCode: '',
|
|
2532
|
+
street: '',
|
|
2533
|
+
qc: '',
|
|
2534
|
+
qcComplete: '',
|
|
2535
|
+
qcHouse: '',
|
|
2536
|
+
});
|
|
2537
|
+
}, []);
|
|
2538
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue?.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
2539
|
+
});
|
|
2540
|
+
const getAddressFromDaDataItem = (item) => ({
|
|
2541
|
+
apartment: item?.data?.flat,
|
|
2542
|
+
city: item?.data?.city,
|
|
2543
|
+
district: item?.data?.area_with_type,
|
|
2544
|
+
fullAddress: item?.unrestricted_value,
|
|
2545
|
+
fiasCode: item?.data?.fias_id,
|
|
2546
|
+
house: item?.data?.house,
|
|
2547
|
+
locality: item?.data?.settlement_with_type,
|
|
2548
|
+
okatoRegionCode: item?.data?.okato,
|
|
2549
|
+
postcode: item?.data?.postal_code,
|
|
2550
|
+
region: item?.data?.region,
|
|
2551
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
2552
|
+
street: item?.data?.street,
|
|
2553
|
+
qc: item?.data?.qc,
|
|
2554
|
+
qcComplete: item?.data?.qc_complete,
|
|
2555
|
+
qcHouse: item?.data?.qc_house,
|
|
2914
2556
|
});
|
|
2915
2557
|
|
|
2916
|
-
const
|
|
2917
|
-
|
|
2918
|
-
'
|
|
2919
|
-
'
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
'Декабрь',
|
|
2929
|
-
];
|
|
2930
|
-
|
|
2931
|
-
function normalizeWithMask(value, pattern) {
|
|
2932
|
-
const valueNumbers = value.replace(/\D/g, '');
|
|
2933
|
-
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
2934
|
-
return value;
|
|
2558
|
+
const updateOrganizationFields = (store, field, item) => {
|
|
2559
|
+
const { okved, okopf, inn } = getOrganizationRequisites(item);
|
|
2560
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
2561
|
+
field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
|
|
2562
|
+
const organizationData = {
|
|
2563
|
+
amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
|
|
2564
|
+
employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
|
|
2565
|
+
organization: getOrganizationType(store?.organization ?? [], okopf, inn),
|
|
2566
|
+
employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
|
|
2567
|
+
};
|
|
2568
|
+
for (const fieldName in organizationData) {
|
|
2569
|
+
organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
|
|
2935
2570
|
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2943
|
-
}
|
|
2944
|
-
const isPlaceholder$1 = (_) => _ === '_';
|
|
2945
|
-
const isDigit$1 = (_) => /\d/.test(_);
|
|
2946
|
-
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2571
|
+
};
|
|
2572
|
+
const getOrganizationRequisites = (item) => ({
|
|
2573
|
+
inn: item.data?.inn ?? '',
|
|
2574
|
+
okopf: Number(item.data?.opf?.code),
|
|
2575
|
+
okved: item.data?.okved ?? '',
|
|
2576
|
+
});
|
|
2947
2577
|
|
|
2948
|
-
const
|
|
2949
|
-
|
|
2578
|
+
const InnField = JSX(({ field, input }) => {
|
|
2579
|
+
const store = useRetailFormStore();
|
|
2580
|
+
const onDaDataChange = useCallback((item) => {
|
|
2581
|
+
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
2582
|
+
updateOrganizationFields(store, field, item);
|
|
2583
|
+
}, []);
|
|
2584
|
+
return (jsx(InputControl, { label: "\u0418\u041D\u041D", isInteger: true, maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
2585
|
+
});
|
|
2950
2586
|
|
|
2951
|
-
const
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
const
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
};
|
|
2966
|
-
const
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
}
|
|
2973
|
-
else {
|
|
2974
|
-
setInputValue(value || '');
|
|
2587
|
+
const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
|
|
2588
|
+
|
|
2589
|
+
const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
|
|
2590
|
+
|
|
2591
|
+
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
2592
|
+
const EMPTY_REGIONS$1 = [];
|
|
2593
|
+
async function getOutServiceRegions() {
|
|
2594
|
+
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
2595
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
const LocalitiesField = JSX(({ field, input }) => {
|
|
2599
|
+
const fieldRegion = field('region');
|
|
2600
|
+
const regionKey = fieldRegion?.value?.key;
|
|
2601
|
+
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
2602
|
+
const localities = regions
|
|
2603
|
+
?.find((_) => _.code === regionKey)
|
|
2604
|
+
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
2605
|
+
useEffect(() => {
|
|
2606
|
+
if (regionKey !== '') {
|
|
2607
|
+
field?.('localities')?.onChange?.('');
|
|
2975
2608
|
}
|
|
2976
|
-
};
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2609
|
+
}, [regionKey]);
|
|
2610
|
+
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
2611
|
+
});
|
|
2612
|
+
|
|
2613
|
+
const FIELD_NAME$b = 'middleName';
|
|
2614
|
+
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$b), ...getValidation(field(FIELD_NAME$b), validatorObj.middleName, input?.required), ...input })));
|
|
2615
|
+
|
|
2616
|
+
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
2617
|
+
|
|
2618
|
+
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
2619
|
+
|
|
2620
|
+
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
2621
|
+
|
|
2622
|
+
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
2623
|
+
const { required, ...rest } = input;
|
|
2624
|
+
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
2625
|
+
});
|
|
2626
|
+
|
|
2627
|
+
const isPlaceholder = (_) => _ === '_';
|
|
2628
|
+
const isDigit = (_) => /\d/.test(_);
|
|
2629
|
+
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
2630
|
+
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
2631
|
+
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
2632
|
+
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
2633
|
+
function normalizePhone(phone) {
|
|
2634
|
+
const phoneNumbers = phone.replace(/\D/g, '');
|
|
2635
|
+
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
2636
|
+
const result = phonePattern.map(applyPlaceholder);
|
|
2637
|
+
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
2638
|
+
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
2642
|
+
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
2643
|
+
const handleBlur = useCallback((v) => {
|
|
2644
|
+
if (v === '+7 (') {
|
|
2645
|
+
onChange && onChange('');
|
|
2980
2646
|
}
|
|
2981
|
-
|
|
2982
|
-
};
|
|
2647
|
+
}, []);
|
|
2648
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
2649
|
+
});
|
|
2650
|
+
|
|
2651
|
+
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
2652
|
+
|
|
2653
|
+
const PhoneField = JSX(({ field, input }) => {
|
|
2654
|
+
const fieldName = input?.name || 'phone';
|
|
2655
|
+
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
2656
|
+
});
|
|
2657
|
+
|
|
2658
|
+
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
2659
|
+
|
|
2660
|
+
const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
2661
|
+
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
2662
|
+
|
|
2663
|
+
const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
|
|
2664
|
+
const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
|
|
2665
|
+
|
|
2666
|
+
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
2667
|
+
const EMPTY_REGIONS = [];
|
|
2668
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
2669
|
+
function useRegions(url = REGIONS_URL) {
|
|
2670
|
+
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
2671
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
const RegionField = JSX(({ field, input, params }) => {
|
|
2675
|
+
const url = getRegionUrl(params?.typeForm);
|
|
2676
|
+
const regions = useRegions(url);
|
|
2677
|
+
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2678
|
+
});
|
|
2679
|
+
|
|
2680
|
+
const RegionPremiumField = JSX(({ field, input }) => {
|
|
2681
|
+
const branchByRegions = useBranchesByRegions(true);
|
|
2682
|
+
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2683
|
+
key: region,
|
|
2684
|
+
text: region,
|
|
2685
|
+
})), [branchByRegions]);
|
|
2686
|
+
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2689
|
+
const SecondaryPhoneField = JSX(({ field }) => {
|
|
2690
|
+
const fieldPhone = field('secondaryPhone');
|
|
2691
|
+
return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
|
|
2692
|
+
? fieldPhone
|
|
2693
|
+
: withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
|
|
2694
|
+
});
|
|
2695
|
+
|
|
2696
|
+
const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
|
|
2697
|
+
|
|
2698
|
+
const FIELD_NAME$a = 'surname';
|
|
2699
|
+
const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$a), ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
|
|
2700
|
+
|
|
2701
|
+
const MIN_CREDIT_TERM = 1;
|
|
2702
|
+
const MAX_CREDIT_TERM = 180;
|
|
2703
|
+
const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
|
|
2704
|
+
const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
|
|
2705
|
+
|
|
2706
|
+
const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
|
|
2707
|
+
|
|
2708
|
+
const orientationStyleMap = {
|
|
2709
|
+
horizontal: '@lg:flex-row',
|
|
2710
|
+
vertical: '',
|
|
2711
|
+
};
|
|
2712
|
+
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
2713
|
+
|
|
2714
|
+
const VED_TYPES = [
|
|
2715
|
+
{ id: 'currencyControl', text: 'Валютный контроль' },
|
|
2716
|
+
{ id: 'documentOperations', text: 'Документарные операции' },
|
|
2717
|
+
{ id: 'conversionTransactions', text: 'Конверсионные операции' },
|
|
2718
|
+
{ id: 'otherIssues', text: 'Иные вопросы ВЭД' },
|
|
2719
|
+
];
|
|
2720
|
+
const VedField = JSX(({ field }) => {
|
|
2721
|
+
const { value, onChange } = field('vedTypes');
|
|
2983
2722
|
useEffect(() => {
|
|
2984
|
-
|
|
2723
|
+
if (value !== 'currencyControl') {
|
|
2724
|
+
field?.('inn')?.onChange?.('');
|
|
2725
|
+
field?.('region')?.onChange?.('');
|
|
2726
|
+
}
|
|
2985
2727
|
}, [value]);
|
|
2986
|
-
return (
|
|
2728
|
+
return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
|
|
2987
2729
|
});
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
const
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
}
|
|
3005
|
-
|
|
2730
|
+
|
|
2731
|
+
function isRenderField({ input, field, }) {
|
|
2732
|
+
const { condition } = input;
|
|
2733
|
+
const { value } = field(condition?.name || '');
|
|
2734
|
+
return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
const PRODUCT_REF = {
|
|
2738
|
+
$ref: '/wcms-resources/outservice-productlist.json',
|
|
2739
|
+
};
|
|
2740
|
+
const InputsMap = {
|
|
2741
|
+
fullName: (props) => jsx(FullNameField, { ...props }),
|
|
2742
|
+
addressBranch: (props) => jsx(AddressBranchField, { ...props }),
|
|
2743
|
+
desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
|
|
2744
|
+
product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
|
|
2745
|
+
localities: (props) => jsx(LocalitiesField, { ...props }),
|
|
2746
|
+
isClient: (props) => jsx(IsClientField, { ...props }),
|
|
2747
|
+
partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
|
|
2748
|
+
collectionCount: (props) => jsx(CollectionCountField, { ...props }),
|
|
2749
|
+
acquiringType: (props) => jsx(AcquiringField, { ...props }),
|
|
2750
|
+
onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
|
|
2751
|
+
posTerminal: (props) => jsx(PosTerminalField, { ...props }),
|
|
2752
|
+
serviceType: (props) => jsx(UltraPremiumField, { ...props }),
|
|
2753
|
+
term: (props) => jsx(TermField, { ...props }),
|
|
2754
|
+
amount: (props) => jsx(AmountField, { ...props }),
|
|
2755
|
+
annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
|
|
2756
|
+
vedTypes: (props) => jsx(VedField, { ...props }),
|
|
2757
|
+
feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
|
|
2758
|
+
serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
|
|
2759
|
+
bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
|
|
2760
|
+
secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
|
|
2761
|
+
applicationDate: (props) => (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...props })),
|
|
2762
|
+
region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
|
|
2763
|
+
consentToReceiveMaterials: (props) => (jsx(ConsentToReceiveMaterialsField, { ...props })),
|
|
2764
|
+
surname: (props) => jsx(SurnameField, { ...props }),
|
|
2765
|
+
name: (props) => jsx(NameField, { ...props }),
|
|
2766
|
+
middleName: (props) => jsx(MiddleNameField, { ...props }),
|
|
2767
|
+
birthday: (props) => jsx(BirthdayField, { ...props }),
|
|
2768
|
+
phone: (props) => jsx(PhoneField, { ...props }),
|
|
2769
|
+
email: (props) => jsx(EmailField, { ...props }),
|
|
2770
|
+
inn: (props) => jsx(InnField, { ...props }),
|
|
2771
|
+
comment: (props) => jsx(CommentField, { ...props }),
|
|
2772
|
+
};
|
|
2773
|
+
const getField = (field, params, externalInputs = {}) => (input, i) => {
|
|
2774
|
+
const resultInputsMap = {
|
|
2775
|
+
...InputsMap,
|
|
2776
|
+
...externalInputs,
|
|
2777
|
+
};
|
|
2778
|
+
return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
|
|
2779
|
+
};
|
|
2780
|
+
|
|
2781
|
+
const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
|
|
2782
|
+
|
|
2783
|
+
const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
|
|
2784
|
+
|
|
2785
|
+
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
2786
|
+
'backdrop-blur': blur,
|
|
2787
|
+
}), children: jsx("div", { className: style('inline-block ', 'animate-spin rounded-full', 'border-solid border-current', 'border-r-transparent', size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28', color), role: "status" }) })));
|
|
2788
|
+
|
|
2789
|
+
function useButton() {
|
|
2790
|
+
return (props) => ({
|
|
2791
|
+
...props,
|
|
2792
|
+
onClick: handlerDecorator(handleClick(props)),
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
function handleClick({ disabled, onClick }) {
|
|
2796
|
+
return (ev) => {
|
|
2797
|
+
!disabled && onClick && onClick(ev);
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
const buttonStyleMap = {
|
|
2802
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
2803
|
+
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
2804
|
+
};
|
|
2805
|
+
const secondaryButtonStyleMap = {
|
|
2806
|
+
primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2807
|
+
secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2808
|
+
};
|
|
2809
|
+
const Button = JSX(({ children, ...props }) => {
|
|
2810
|
+
const button = useButton();
|
|
2811
|
+
const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
2812
|
+
return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
|
|
2813
|
+
'text-white bg-primary-active': active,
|
|
2814
|
+
'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
|
|
2815
|
+
'rounded-md': rounded,
|
|
2816
|
+
}, !active && !disabled && !isLoading
|
|
2817
|
+
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
2818
|
+
: '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
|
|
2819
|
+
});
|
|
2820
|
+
|
|
2821
|
+
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
|
|
2822
|
+
|
|
2823
|
+
const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
|
|
2824
|
+
|
|
2825
|
+
const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
|
|
2826
|
+
const responseOK = responseType === 'OK';
|
|
2827
|
+
const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
|
|
2828
|
+
const responseOKDescription = typeForm === 'ANTIFRAUD'
|
|
2829
|
+
? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
|
|
2830
|
+
можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
|
|
2831
|
+
не звонят с использованием мессенджеров.`
|
|
2832
|
+
: 'Совсем скоро мы с вами свяжемся';
|
|
2833
|
+
return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
const objectValidator = (validatorsMap) => (o) => (o &&
|
|
2837
|
+
Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
|
|
2838
|
+
[];
|
|
2839
|
+
|
|
2840
|
+
const getPartnerComments = (data) => {
|
|
2841
|
+
const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
|
|
2842
|
+
if (acquiringType) {
|
|
2843
|
+
return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
|
|
2844
|
+
? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
|
|
2845
|
+
: '/Онлайн касса=false/POS-терминал=false'}`;
|
|
2846
|
+
}
|
|
2847
|
+
else {
|
|
2848
|
+
return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
|
|
2852
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2853
|
+
const getFormatData = (data) => {
|
|
2854
|
+
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
|
|
2855
|
+
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
2856
|
+
const formatData = {
|
|
2857
|
+
...usedData,
|
|
2858
|
+
...getVedTypes(vedTypes),
|
|
2859
|
+
...getRegion(region),
|
|
2860
|
+
...(partnerComments ? { partnerComments } : {}),
|
|
2861
|
+
...(serviceType ? { typeForm: serviceType } : {}),
|
|
2862
|
+
};
|
|
2863
|
+
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
2864
|
+
};
|
|
2865
|
+
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
2866
|
+
const getVedTypes = (vedTypes) => vedTypes
|
|
2867
|
+
? {
|
|
2868
|
+
vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
|
|
2869
|
+
}
|
|
2870
|
+
: {};
|
|
2871
|
+
|
|
2872
|
+
const initialFormState$1 = {
|
|
2873
|
+
typeForm: '',
|
|
2874
|
+
region: { key: '', text: '' },
|
|
2875
|
+
addressBranch: { key: '', text: '' },
|
|
2876
|
+
surname: '',
|
|
2877
|
+
name: '',
|
|
2878
|
+
phone: '',
|
|
2879
|
+
secondaryPhone: '',
|
|
2880
|
+
comment: '',
|
|
2881
|
+
product: '',
|
|
2882
|
+
partnerComments: '',
|
|
2883
|
+
annualRevenue: '',
|
|
2884
|
+
term: 12,
|
|
2885
|
+
amount: 100000,
|
|
2886
|
+
acquiringType: ACQUIRING_TYPES[0],
|
|
2887
|
+
serviceType: SERVICE_TYPES[0],
|
|
2888
|
+
feedbackMethod: FEEDBACK_METHOD[0],
|
|
2889
|
+
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
2890
|
+
vedTypes: VED_TYPES[0],
|
|
2891
|
+
birthday: undefined,
|
|
2892
|
+
isClient: false,
|
|
2893
|
+
onlineCheckout: false,
|
|
2894
|
+
posTerminal: false,
|
|
2895
|
+
consentToReceiveMaterials: false,
|
|
2896
|
+
consentDataProcessing: false,
|
|
2897
|
+
addressRetail: { key: '', text: '' },
|
|
2898
|
+
};
|
|
2899
|
+
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
2900
|
+
const formState = Object.fromEntries(inputs.map((_) => [
|
|
2901
|
+
_.name,
|
|
2902
|
+
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
|
|
2903
|
+
]));
|
|
2904
|
+
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
2905
|
+
};
|
|
2906
|
+
|
|
2907
|
+
const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
|
|
2908
|
+
|
|
2909
|
+
const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
2910
|
+
|
|
2911
|
+
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
2912
|
+
const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
|
|
2913
|
+
|
|
2914
|
+
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
2915
|
+
|
|
2916
|
+
const API = LeadServiceAPI();
|
|
2917
|
+
const ApplicationForm = JSX(
|
|
2918
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2919
|
+
({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
2920
|
+
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
2921
|
+
const initialFormState = getInitialFormState$3(inputs, typeForm);
|
|
2922
|
+
const [responseType, setResponseType] = useState('');
|
|
2923
|
+
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
2924
|
+
const handleSubmit = useCallback(async (formData, ev) => {
|
|
2925
|
+
const inputsFiltered = getFilteredInputs(inputs, formData);
|
|
2926
|
+
const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
|
|
2927
|
+
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
2928
|
+
return console.warn('validation fail');
|
|
2929
|
+
}
|
|
2930
|
+
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
2931
|
+
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
2932
|
+
setResponseType(status);
|
|
2933
|
+
if (status) {
|
|
2934
|
+
responseTypeDialog.open({ typeForm, responseType: status });
|
|
2935
|
+
}
|
|
2936
|
+
if (status === 'OK' && data) {
|
|
2937
|
+
const aspects = useAspects();
|
|
2938
|
+
handleAspects({ aspectsAttributes: data, aspects, ev });
|
|
2939
|
+
}
|
|
2940
|
+
return status;
|
|
2941
|
+
}, [typeForm]);
|
|
2942
|
+
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
2943
|
+
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
2944
|
+
useEffect(() => {
|
|
2945
|
+
if (responseType === 'OK') {
|
|
2946
|
+
setResponseType('');
|
|
2947
|
+
reset();
|
|
2948
|
+
}
|
|
2949
|
+
}, [responseType]);
|
|
2950
|
+
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] }));
|
|
2951
|
+
});
|
|
2952
|
+
const getFilteredInputs = (inputs, data) => inputs.filter((input) => !input?.condition ||
|
|
2953
|
+
input?.condition.values.find((_) => {
|
|
2954
|
+
const dataValue = data?.[input?.condition?.name ?? ''];
|
|
2955
|
+
return _ === (dataValue?.key ?? dataValue);
|
|
2956
|
+
}));
|
|
2957
|
+
|
|
2958
|
+
const applicationFormData = [
|
|
2959
|
+
{
|
|
2960
|
+
columns: 2,
|
|
2961
|
+
inputs: [
|
|
2962
|
+
{ fieldType: 'common', name: 'surname', required: true, dadata: true },
|
|
2963
|
+
{ fieldType: 'common', name: 'name', required: true, dadata: true },
|
|
2964
|
+
{ fieldType: 'common', name: 'middleName', dadata: true },
|
|
2965
|
+
{ fieldType: 'common', name: 'limitedBirthday', required: true },
|
|
2966
|
+
{ fieldType: 'common', name: 'phone', required: true },
|
|
2967
|
+
{ fieldType: 'common', name: 'email', required: true, dadata: true },
|
|
2968
|
+
],
|
|
2969
|
+
},
|
|
2970
|
+
{
|
|
2971
|
+
inputs: [
|
|
2972
|
+
{ fieldType: 'common', name: 'processPersonalDataFlg', required: true },
|
|
2973
|
+
{ fieldType: 'common', name: 'consentProviderFlg', required: true },
|
|
2974
|
+
{ fieldType: 'common', name: 'consentOthersFlg', required: true },
|
|
2975
|
+
{ fieldType: 'common', name: 'consentInformFlg' },
|
|
2976
|
+
{ fieldType: 'common', name: 'consentPfrFlg' },
|
|
2977
|
+
],
|
|
2978
|
+
},
|
|
2979
|
+
];
|
|
2980
|
+
|
|
2981
|
+
const AddressFactField = JSX(({ field, input }) => {
|
|
2982
|
+
const fieldName = 'addressFact';
|
|
2983
|
+
const fieldValue = field(fieldName).value;
|
|
2984
|
+
const { value } = field('addressMatch');
|
|
2985
|
+
useEffect(() => {
|
|
2986
|
+
if (value) {
|
|
2987
|
+
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
2988
|
+
}
|
|
2989
|
+
}, [value, field('addressRegistration').value]);
|
|
2990
|
+
const onDaDataChange = useCallback((item) => {
|
|
2991
|
+
field?.(fieldName)?.onChange?.({
|
|
2992
|
+
apartment: item?.data?.flat,
|
|
2993
|
+
city: item?.data?.city,
|
|
2994
|
+
district: item?.data?.area_with_type,
|
|
2995
|
+
fullAddress: item?.value,
|
|
2996
|
+
fiasCode: item?.data?.fias_id,
|
|
2997
|
+
house: item?.data?.house,
|
|
2998
|
+
locality: item?.data?.settlement_with_type,
|
|
2999
|
+
okatoRegionCode: item?.data?.okato,
|
|
3000
|
+
postcode: item?.data?.postal_code,
|
|
3001
|
+
region: item?.data?.region,
|
|
3002
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
3003
|
+
street: item?.data?.house,
|
|
3004
|
+
qc: item?.data?.qc,
|
|
3005
|
+
qcComplete: item?.data?.qc_complete,
|
|
3006
|
+
qcHouse: item?.data?.qc_house,
|
|
3007
|
+
});
|
|
3008
|
+
}, []);
|
|
3009
|
+
const onChange = useCallback((val) => {
|
|
3010
|
+
field?.(fieldName)?.onChange?.({
|
|
3011
|
+
apartment: '',
|
|
3012
|
+
city: '',
|
|
3013
|
+
district: '',
|
|
3014
|
+
fullAddress: val,
|
|
3015
|
+
fiasCode: '',
|
|
3016
|
+
house: '',
|
|
3017
|
+
locality: '',
|
|
3018
|
+
okatoRegionCode: '',
|
|
3019
|
+
postcode: '',
|
|
3020
|
+
region: '',
|
|
3021
|
+
regionCode: '',
|
|
3022
|
+
street: '',
|
|
3023
|
+
qc: '',
|
|
3024
|
+
qcComplete: '',
|
|
3025
|
+
qcHouse: '',
|
|
3026
|
+
});
|
|
3027
|
+
}, []);
|
|
3028
|
+
return (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", disabled: value, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue?.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
3029
|
+
});
|
|
3030
|
+
|
|
3031
|
+
const AddressMatchField = JSX(({ field, input }) => {
|
|
3032
|
+
return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
|
|
3033
|
+
});
|
|
3034
|
+
|
|
3035
|
+
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
3036
|
+
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
3037
|
+
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
3038
|
+
if (isLoad || !points) {
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3041
|
+
map.geoObjects.removeAll();
|
|
3042
|
+
if (!points.length) {
|
|
3043
|
+
return;
|
|
3044
|
+
}
|
|
3045
|
+
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
3046
|
+
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
3047
|
+
if (points.length && points.every((_) => 'type' in _)) {
|
|
3048
|
+
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
3049
|
+
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
3050
|
+
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
3051
|
+
officeClusterer.add(officesGeoObjects);
|
|
3052
|
+
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
3053
|
+
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
3054
|
+
map.geoObjects.add(officeClusterer);
|
|
3055
|
+
}
|
|
3056
|
+
else {
|
|
3057
|
+
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
3058
|
+
officeClusterer.add(geoObjects);
|
|
3059
|
+
map.geoObjects.add(officeClusterer);
|
|
3060
|
+
}
|
|
3061
|
+
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
3062
|
+
if (map.getZoom() > 10) {
|
|
3063
|
+
map.setZoom(10);
|
|
3064
|
+
}
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
3068
|
+
return new yandexMaps.Clusterer({
|
|
3069
|
+
clusterIcons: [
|
|
3070
|
+
{
|
|
3071
|
+
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
3072
|
+
size: [78, 84],
|
|
3073
|
+
offset: [-35, -50],
|
|
3074
|
+
},
|
|
3075
|
+
],
|
|
3076
|
+
clusterIconContentLayout,
|
|
3077
|
+
clusterHideIconOnBalloonOpen: false,
|
|
3078
|
+
geoObjectHideIconOnBalloonOpen: false,
|
|
3079
|
+
});
|
|
3080
|
+
};
|
|
3081
|
+
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
3082
|
+
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
3083
|
+
balloonContentHeader: content?.header,
|
|
3084
|
+
balloonContentBody: content?.body,
|
|
3085
|
+
balloonContentFooter: content?.footer,
|
|
3086
|
+
hintContent: content?.hint,
|
|
3087
|
+
}, {
|
|
3088
|
+
iconLayout: 'default#image',
|
|
3089
|
+
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
3090
|
+
iconImageSize: [78, 84],
|
|
3091
|
+
iconImageOffset: [-35, -50],
|
|
3092
|
+
}));
|
|
3093
|
+
};
|
|
3094
|
+
|
|
3095
|
+
const defaultStyle = {
|
|
3096
|
+
focus: 'focus:border-primary-text focus:border',
|
|
3097
|
+
hover: 'hover:bg-primary-hover',
|
|
3098
|
+
active: 'active:bg-primary-active',
|
|
3099
|
+
font: 'text-center font-sans',
|
|
3100
|
+
};
|
|
3101
|
+
|
|
3102
|
+
const styles$1 = {
|
|
3103
|
+
...defaultStyle,
|
|
3104
|
+
border: 'border border-transparent rounded-md',
|
|
3105
|
+
position: 'absolute flex items-center justify-center',
|
|
3106
|
+
};
|
|
3107
|
+
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
3108
|
+
const setUserGeoLocation = () => {
|
|
3109
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3110
|
+
// @ts-ignore
|
|
3111
|
+
yandexMaps.geolocation
|
|
3112
|
+
.get({
|
|
3113
|
+
provider: 'yandex',
|
|
3114
|
+
autoReverseGeocode: true,
|
|
3115
|
+
mapStateAutoApply: true,
|
|
3116
|
+
})
|
|
3117
|
+
.then(function (result) {
|
|
3118
|
+
map.current.geoObjects.add(result.geoObjects);
|
|
3119
|
+
});
|
|
3120
|
+
};
|
|
3121
|
+
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
3122
|
+
};
|
|
3123
|
+
|
|
3124
|
+
const getNS = (_) => globalThis[_];
|
|
3125
|
+
const initializeExternalNS = (namespaceName, url) => {
|
|
3126
|
+
const script = document.getElementById(url);
|
|
3127
|
+
if (script) {
|
|
3128
|
+
const ns = getNS(namespaceName);
|
|
3129
|
+
if (ns) {
|
|
3130
|
+
return Promise.resolve(ns);
|
|
3131
|
+
}
|
|
3132
|
+
else {
|
|
3133
|
+
return new Promise((resolve) => {
|
|
3134
|
+
script.addEventListener('load', () => {
|
|
3135
|
+
resolve(getNS(namespaceName));
|
|
3136
|
+
});
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
else {
|
|
3141
|
+
return new Promise((resolve, reject) => {
|
|
3142
|
+
const newScript = document.createElement('script');
|
|
3143
|
+
newScript.src = url;
|
|
3144
|
+
newScript.async = true;
|
|
3145
|
+
newScript.id = url;
|
|
3146
|
+
newScript.addEventListener('load', () => {
|
|
3147
|
+
resolve(getNS(namespaceName));
|
|
3148
|
+
});
|
|
3149
|
+
newScript.addEventListener('error', (error) => {
|
|
3150
|
+
reject(error);
|
|
3151
|
+
});
|
|
3152
|
+
document.head.appendChild(newScript);
|
|
3153
|
+
});
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
3157
|
+
const [externalNS, setExternalNS] = useState(undefined);
|
|
3158
|
+
useEffect(() => {
|
|
3159
|
+
let isMounted = true;
|
|
3160
|
+
initializeExternalNS(namespaceName, url)
|
|
3161
|
+
.then((ns) => {
|
|
3162
|
+
if (isMounted) {
|
|
3163
|
+
setExternalNS(ns);
|
|
3164
|
+
}
|
|
3165
|
+
})
|
|
3166
|
+
.catch((error) => {
|
|
3167
|
+
console.error(`Failed to initialize external namespace: ${error}`);
|
|
3168
|
+
});
|
|
3169
|
+
return () => {
|
|
3170
|
+
isMounted = false;
|
|
3171
|
+
if (unmountNS) {
|
|
3172
|
+
const script = document.getElementById(url);
|
|
3173
|
+
if (script) {
|
|
3174
|
+
document.head.removeChild(script);
|
|
3175
|
+
}
|
|
3176
|
+
setExternalNS(undefined);
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
}, [namespaceName, url, unmountNS]);
|
|
3180
|
+
return externalNS;
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3183
|
+
const YMAPS_NAMESPACE = 'ymaps';
|
|
3184
|
+
const useYandexMaps = () => {
|
|
3185
|
+
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
3186
|
+
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
3187
|
+
};
|
|
3188
|
+
|
|
3189
|
+
const styles = {
|
|
3190
|
+
...defaultStyle,
|
|
3191
|
+
border: 'border-b border-b-2 border-gray last:border-0',
|
|
3192
|
+
position: 'relative flex items-center justify-center',
|
|
3193
|
+
};
|
|
3194
|
+
// TODO: Добавить метод определения центральной точки
|
|
3195
|
+
const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
|
|
3196
|
+
const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
|
|
3197
|
+
const changeZoom = () => {
|
|
3198
|
+
const currentZoom = yandexMaps.current.getZoom();
|
|
3199
|
+
const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
|
|
3200
|
+
yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
|
|
3201
|
+
};
|
|
3202
|
+
return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
|
|
3203
|
+
});
|
|
3204
|
+
|
|
3205
|
+
const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
3206
|
+
// TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
|
|
3207
|
+
// Сейчас реализован поиск среди тестовых данных
|
|
3208
|
+
// TODO: Также выяснить что делать когда ничего не найдено
|
|
3209
|
+
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
3210
|
+
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
|
|
3211
|
+
const map = useRef(null);
|
|
3212
|
+
const parentDiv = useRef(null);
|
|
3213
|
+
const yandexMaps = useYandexMaps();
|
|
3214
|
+
useEffect(() => {
|
|
3215
|
+
if (map.current) {
|
|
3216
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3217
|
+
}
|
|
3218
|
+
else {
|
|
3219
|
+
yandexMaps?.ready(() => {
|
|
3220
|
+
// Ready function may be called few times, but must be called once
|
|
3221
|
+
if (map.current) {
|
|
3222
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3223
|
+
return;
|
|
3224
|
+
}
|
|
3225
|
+
map.current = new yandexMaps.Map(parentDiv.current, {
|
|
3226
|
+
center: getCenterPoint(points),
|
|
3227
|
+
zoom,
|
|
3228
|
+
controls: [],
|
|
3229
|
+
suppressMapOpenBlock: true,
|
|
3230
|
+
});
|
|
3231
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3232
|
+
});
|
|
3233
|
+
}
|
|
3234
|
+
// zoom к выбранному отделению банка в рамках задачи по retail
|
|
3235
|
+
if (map.current && selectedAddress) {
|
|
3236
|
+
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
3237
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
3238
|
+
const coords = firstGeoObject.geometry.getCoordinates();
|
|
3239
|
+
map.current.setCenter(coords);
|
|
3240
|
+
map.current.setZoom(18);
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
3244
|
+
if (!yandexMaps) {
|
|
3245
|
+
return null;
|
|
3246
|
+
}
|
|
3247
|
+
const zIndex = 'z-10';
|
|
3248
|
+
return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
3249
|
+
});
|
|
3250
|
+
const getCenterPoint = (points) => {
|
|
3251
|
+
const centerCoords = [
|
|
3252
|
+
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
3253
|
+
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
3254
|
+
];
|
|
3255
|
+
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
3256
|
+
};
|
|
3257
|
+
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
3258
|
+
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
3259
|
+
|
|
3260
|
+
const fetchRetailJSON = async (url, method, body) => {
|
|
3261
|
+
try {
|
|
3262
|
+
const response = await doRequest(url, method, body);
|
|
3263
|
+
return response.json();
|
|
3264
|
+
}
|
|
3265
|
+
catch (err) {
|
|
3266
|
+
console.error(err);
|
|
3267
|
+
return null;
|
|
3268
|
+
}
|
|
3269
|
+
};
|
|
3270
|
+
async function doRequest(url, method, body) {
|
|
3271
|
+
return globalThis?.fetch?.(`${API_BASE_URI}${url}`, {
|
|
3272
|
+
method,
|
|
3273
|
+
headers: {
|
|
3274
|
+
'Content-Type': 'application/json',
|
|
3275
|
+
...getAuthorizationHeaders(),
|
|
3276
|
+
},
|
|
3277
|
+
credentials: 'include',
|
|
3278
|
+
body: body ? JSON.stringify(body) : null,
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
const getAuthorizationHeaders = () => {
|
|
3282
|
+
const token = sessionStorage.getItem('accessToken');
|
|
3283
|
+
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
3284
|
+
};
|
|
3285
|
+
|
|
3286
|
+
const fetchRegionOffices = async (regionKey) => {
|
|
3287
|
+
const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
|
|
3288
|
+
regionRfCd: {
|
|
3289
|
+
key: regionKey,
|
|
3290
|
+
},
|
|
3291
|
+
cashCardFlg: true,
|
|
3292
|
+
});
|
|
3293
|
+
return (response?.offices?.map((office) => ({
|
|
3294
|
+
...office,
|
|
3295
|
+
gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
|
|
3296
|
+
gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
|
|
3297
|
+
})) || []);
|
|
3298
|
+
};
|
|
3299
|
+
const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
|
|
3300
|
+
|
|
3301
|
+
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
3302
|
+
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
3303
|
+
const onToggle = useCallback(() => {
|
|
3304
|
+
setIsUnfolded((_) => !_);
|
|
3305
|
+
}, []);
|
|
3306
|
+
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
3307
|
+
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
3308
|
+
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
3309
|
+
});
|
|
3310
|
+
|
|
3311
|
+
function useResizeObserver(callback, deps) {
|
|
3312
|
+
const ref = useRef(null);
|
|
3313
|
+
useEffect(() => {
|
|
3314
|
+
const element = ref?.current;
|
|
3315
|
+
if (!element) {
|
|
3316
|
+
return undefined;
|
|
3317
|
+
}
|
|
3318
|
+
const observer = new ResizeObserver((entries) => {
|
|
3319
|
+
callback(element, entries[0]);
|
|
3320
|
+
});
|
|
3321
|
+
observer.observe(element);
|
|
3322
|
+
return () => {
|
|
3323
|
+
observer.disconnect();
|
|
3324
|
+
};
|
|
3325
|
+
}, [callback, ...deps]);
|
|
3326
|
+
return ref;
|
|
3327
|
+
}
|
|
3328
|
+
|
|
3329
|
+
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
3330
|
+
const containerRef = useRef(null);
|
|
3331
|
+
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
3332
|
+
if (containerRef.current) {
|
|
3333
|
+
containerRef.current.style.maxHeight = isUnfolded
|
|
3334
|
+
? `${childrenWrapperEl.scrollHeight}px`
|
|
3335
|
+
: '';
|
|
3336
|
+
}
|
|
3337
|
+
}, [isUnfolded]);
|
|
3338
|
+
return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
|
|
3339
|
+
});
|
|
3340
|
+
|
|
3341
|
+
const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
|
|
3342
|
+
const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
|
|
3343
|
+
if ([textItems.length, children, subText].every((_) => !_)) {
|
|
3344
|
+
return null;
|
|
3345
|
+
}
|
|
3346
|
+
return renderCardCell({ textItems, subText, children, isPhone, ...props });
|
|
3347
|
+
});
|
|
3348
|
+
const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
|
|
3349
|
+
const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
|
|
3350
|
+
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
3351
|
+
|
|
3352
|
+
const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
|
|
3353
|
+
|
|
3354
|
+
const getScheduleDescription = (workScheduleWeek) => {
|
|
3355
|
+
const rows = getDateDescription(workScheduleWeek);
|
|
3356
|
+
return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
|
|
3357
|
+
};
|
|
3358
|
+
const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
|
|
3359
|
+
if (!workTime) {
|
|
3360
|
+
return '';
|
|
3361
|
+
}
|
|
3362
|
+
return [
|
|
3363
|
+
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
3364
|
+
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
3365
|
+
daysOff ? `не работает: ${daysOff}` : '',
|
|
3366
|
+
]
|
|
3367
|
+
.filter(Boolean)
|
|
3368
|
+
.join('; ');
|
|
3369
|
+
};
|
|
3370
|
+
const getDateDescription = (workScheduleWeek) => {
|
|
3371
|
+
const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
3372
|
+
const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
3373
|
+
const daysOff = workScheduleWeek
|
|
3374
|
+
.filter((_) => !_.status)
|
|
3375
|
+
.map((_) => _.short?.toLowerCase())
|
|
3376
|
+
.join(', ');
|
|
3377
|
+
const rows = [
|
|
3378
|
+
buildScheduleText({
|
|
3379
|
+
workTime: workingWeekday?.workTime,
|
|
3380
|
+
lunchHour: workingWeekday?.lunchHour,
|
|
3381
|
+
daysOff: workingSaturday ? '' : daysOff,
|
|
3382
|
+
}),
|
|
3383
|
+
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
3384
|
+
].filter(Boolean);
|
|
3385
|
+
return rows;
|
|
3386
|
+
};
|
|
3387
|
+
|
|
3388
|
+
const WEEKDAY_MAP = [
|
|
3389
|
+
['workingMonday', 'Пн', 'Понедельник'],
|
|
3390
|
+
['workingTuesday', 'Вт', 'Вторник'],
|
|
3391
|
+
['workingWednesday', 'Ср', 'Среда'],
|
|
3392
|
+
['workingThursday', 'Чт', 'Четверг'],
|
|
3393
|
+
['workingFriday', 'Пт', 'Пятница'],
|
|
3394
|
+
['workingSaturday', 'Сб', 'Суббота'],
|
|
3395
|
+
['workingSunday', 'Вс', 'Воскресенье'],
|
|
3396
|
+
];
|
|
3397
|
+
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
3398
|
+
key,
|
|
3399
|
+
title,
|
|
3400
|
+
short,
|
|
3401
|
+
status: Boolean(workSchedule?.[key]),
|
|
3402
|
+
get workTime() {
|
|
3403
|
+
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
3404
|
+
},
|
|
3405
|
+
get lunchHour() {
|
|
3406
|
+
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
3407
|
+
},
|
|
3408
|
+
get hasLunch() {
|
|
3409
|
+
return /\d+/.test(this.lunchHour ?? '');
|
|
3410
|
+
},
|
|
3411
|
+
}));
|
|
3412
|
+
|
|
3413
|
+
const renderBusinessSchedule = (scheduleDescription) => {
|
|
3414
|
+
if (!scheduleDescription) {
|
|
3415
|
+
return null;
|
|
3416
|
+
}
|
|
3417
|
+
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
3418
|
+
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
3419
|
+
};
|
|
3420
|
+
const getBusinessSchedule = (scheduleDescription) => {
|
|
3421
|
+
const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
|
|
3422
|
+
const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
|
|
3423
|
+
const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
|
|
3424
|
+
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
3425
|
+
return weekDayMap;
|
|
3426
|
+
}
|
|
3427
|
+
return weekDayMap.map((_) => ({
|
|
3428
|
+
..._,
|
|
3429
|
+
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
3430
|
+
}));
|
|
3431
|
+
};
|
|
3432
|
+
const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
|
|
3433
|
+
|
|
3434
|
+
const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
|
|
3435
|
+
|
|
3436
|
+
const colorStyle = {
|
|
3437
|
+
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
3438
|
+
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
3439
|
+
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
3440
|
+
red: { border: 'border-error/30', text: 'text-error' },
|
|
3441
|
+
};
|
|
3442
|
+
const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
|
|
3443
|
+
|
|
3444
|
+
const currentWeekDayIdx = new Date().getDay();
|
|
3445
|
+
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
3446
|
+
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
3447
|
+
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
3448
|
+
if (!currentWeekDay) {
|
|
3449
|
+
return null;
|
|
3450
|
+
}
|
|
3451
|
+
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
3452
|
+
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
3453
|
+
};
|
|
3454
|
+
|
|
3455
|
+
const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
|
|
3456
|
+
if (!status) {
|
|
3457
|
+
return 'Не работает';
|
|
3458
|
+
}
|
|
3459
|
+
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
3460
|
+
};
|
|
3461
|
+
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
3462
|
+
|
|
3463
|
+
const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
3464
|
+
const labels = ['Подробнее', 'Скрыть'];
|
|
3465
|
+
const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
|
|
3466
|
+
|
|
3467
|
+
const renderWorkSchedule = (workSchedule) => {
|
|
3468
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3469
|
+
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
3470
|
+
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
3471
|
+
if (!workSchedule) {
|
|
3472
|
+
return '';
|
|
3473
|
+
}
|
|
3474
|
+
if (!workSchedule.businessScheduleVisibleTag) {
|
|
3475
|
+
return renderMatchingTimeOfWork(timeOfWork);
|
|
3476
|
+
}
|
|
3477
|
+
if (workSchedule.businessScheduleVisibleTag &&
|
|
3478
|
+
workSchedule.businessScheduleDescription === null) {
|
|
3479
|
+
return renderIndividualTimeOfWork(timeOfWork);
|
|
3480
|
+
}
|
|
3481
|
+
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
3482
|
+
};
|
|
3483
|
+
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
3484
|
+
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
3485
|
+
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
3486
|
+
|
|
3487
|
+
const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
|
|
3488
|
+
if (!workSchedule) {
|
|
3489
|
+
return null;
|
|
3490
|
+
}
|
|
3491
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3492
|
+
return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
|
|
3493
|
+
phone,
|
|
3494
|
+
fax,
|
|
3495
|
+
phoneBusiness,
|
|
3496
|
+
phoneNatural,
|
|
3497
|
+
phoneCallCentre,
|
|
3498
|
+
phoneCurrencyControl,
|
|
3499
|
+
workSchedule,
|
|
3500
|
+
exchangeRate,
|
|
3501
|
+
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
3502
|
+
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
3503
|
+
phone,
|
|
3504
|
+
fax,
|
|
3505
|
+
phoneBusiness,
|
|
3506
|
+
phoneNatural,
|
|
3507
|
+
phoneCallCentre,
|
|
3508
|
+
phoneCurrencyControl,
|
|
3509
|
+
workSchedule,
|
|
3510
|
+
exchangeRate,
|
|
3511
|
+
}) }));
|
|
3512
|
+
},
|
|
3513
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
3514
|
+
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
3515
|
+
};
|
|
3516
|
+
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
3517
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3518
|
+
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
3519
|
+
? 'Для физических лиц'
|
|
3520
|
+
: 'Для физических и юридических лиц';
|
|
3521
|
+
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
3522
|
+
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
3523
|
+
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
3524
|
+
};
|
|
3525
|
+
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
3526
|
+
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
3527
|
+
const header = capitalizedFirstLetter$1(name);
|
|
3528
|
+
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
3529
|
+
return { header, body };
|
|
3006
3530
|
};
|
|
3007
3531
|
|
|
3008
|
-
const
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
const ref = useOutsideClick(close);
|
|
3020
|
-
const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
|
|
3021
|
-
const handleNextMonth = useCallback(() => {
|
|
3022
|
-
if (selectedMonth + 1 <= MONTHS_COUNT) {
|
|
3023
|
-
onMonthSelect(selectedMonth + 1);
|
|
3024
|
-
}
|
|
3025
|
-
else {
|
|
3026
|
-
onMonthSelect(0);
|
|
3027
|
-
onYearSelect(selectedYear + 1);
|
|
3028
|
-
}
|
|
3029
|
-
}, [selectedMonth]);
|
|
3030
|
-
const handlePrevMonth = useCallback(() => {
|
|
3031
|
-
if (selectedMonth - 1 >= 0) {
|
|
3032
|
-
onMonthSelect(selectedMonth - 1);
|
|
3033
|
-
}
|
|
3034
|
-
else {
|
|
3035
|
-
onMonthSelect(11);
|
|
3036
|
-
onYearSelect(selectedYear - 1);
|
|
3037
|
-
}
|
|
3038
|
-
}, [selectedMonth]);
|
|
3039
|
-
const handleSelectMonth = useCallback(({ key }) => {
|
|
3040
|
-
onMonthSelect(months.indexOf(key));
|
|
3041
|
-
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
3042
|
-
handleChangeMonth({
|
|
3043
|
-
maxDateOfMonth,
|
|
3044
|
-
selectedYear,
|
|
3045
|
-
selectedMonth: months.indexOf(key),
|
|
3046
|
-
value,
|
|
3047
|
-
onChange,
|
|
3048
|
-
});
|
|
3049
|
-
}, [value]);
|
|
3050
|
-
const handleSelectYear = useCallback(({ key }) => {
|
|
3051
|
-
onYearSelect(Number(key));
|
|
3052
|
-
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
3053
|
-
}, [value]);
|
|
3054
|
-
return {
|
|
3055
|
-
handleChangeVisibleCalendar,
|
|
3056
|
-
handleNextMonth,
|
|
3057
|
-
handlePrevMonth,
|
|
3058
|
-
handleSelectMonth,
|
|
3059
|
-
handleSelectYear,
|
|
3060
|
-
monthsOptions: MONTHS_OPTIONS,
|
|
3061
|
-
yearsOptions: YEARS_OPTIONS,
|
|
3062
|
-
ref,
|
|
3063
|
-
};
|
|
3532
|
+
const INITIAL_FILTRATION_STATE$1 = {
|
|
3533
|
+
workingSaturday: false,
|
|
3534
|
+
premiumService: false,
|
|
3535
|
+
privateBanking: false,
|
|
3536
|
+
remoteWorkplace: false,
|
|
3537
|
+
serviceDisabledPeople: false,
|
|
3538
|
+
sellingCoins: false,
|
|
3539
|
+
buyingCoins: false,
|
|
3540
|
+
bullionOperations: false,
|
|
3541
|
+
preciousMetalsOperations: false,
|
|
3542
|
+
transferringDataToBiometricSystem: false,
|
|
3064
3543
|
};
|
|
3065
|
-
const
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3544
|
+
const FILTRATION_LABELS = {
|
|
3545
|
+
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
3546
|
+
workingSaturday: 'Открыты по субботам',
|
|
3547
|
+
terminalTypeAtms: 'Банкоматы',
|
|
3548
|
+
terminalTypeTerm: 'Терминалы',
|
|
3549
|
+
workAllTime: 'Круглосуточно',
|
|
3550
|
+
billAcceptorEnable: 'Прием наличных',
|
|
3551
|
+
premiumService: 'Премиальное обслуживание',
|
|
3552
|
+
privateBanking: 'Услуга Private banking',
|
|
3553
|
+
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
3554
|
+
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
3555
|
+
bullionOperations: 'Операции со слитками',
|
|
3556
|
+
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
3557
|
+
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
3558
|
+
locationDisabledPeople: 'Для маломобильных',
|
|
3559
|
+
designDisabledPeople: 'Для слабовидящих',
|
|
3560
|
+
remoteWorkplace: 'Удаленное рабочее место',
|
|
3561
|
+
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
3073
3562
|
};
|
|
3074
|
-
const
|
|
3075
|
-
|
|
3076
|
-
|
|
3563
|
+
const FILTRATION_PREDICATES$1 = {
|
|
3564
|
+
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
3565
|
+
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
3566
|
+
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
3567
|
+
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
3568
|
+
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
3569
|
+
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
3570
|
+
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
3571
|
+
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
3572
|
+
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
3573
|
+
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
3077
3574
|
};
|
|
3078
3575
|
|
|
3079
|
-
const
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
width: '24',
|
|
3083
|
-
height: '24',
|
|
3576
|
+
const filterItems$1 = (data, filtrationState) => {
|
|
3577
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
3578
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
3084
3579
|
};
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3580
|
+
|
|
3581
|
+
const defaultEmptyFunction$1 = () => void 0;
|
|
3582
|
+
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
|
|
3583
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
3584
|
+
const _filteredItems = filterItems$1(data, filtrationState);
|
|
3585
|
+
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
3586
|
+
const _points = [
|
|
3587
|
+
..._filteredItems.map((_) => ({
|
|
3588
|
+
type: 'offices',
|
|
3589
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3590
|
+
content: getBalloon(_),
|
|
3591
|
+
})),
|
|
3592
|
+
..._filteredRemoteWorkplaces.map((_) => ({
|
|
3593
|
+
type: 'workplaces',
|
|
3594
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3595
|
+
content: getBalloonRemoteWorkplaces({
|
|
3596
|
+
address: _.address,
|
|
3597
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
3598
|
+
}),
|
|
3599
|
+
})),
|
|
3600
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
3601
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
3602
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
3603
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
3604
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
3089
3605
|
};
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3606
|
+
|
|
3607
|
+
const useLeadFormData = (typeField) => {
|
|
3608
|
+
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
3609
|
+
if (data && 'errorMessage' in data) {
|
|
3610
|
+
return { error };
|
|
3611
|
+
}
|
|
3612
|
+
return { data: data, error };
|
|
3613
|
+
};
|
|
3614
|
+
const fetchData = async (url) => {
|
|
3615
|
+
const result = await fetchJSON(url, { method: 'POST' });
|
|
3616
|
+
return result || [];
|
|
3617
|
+
};
|
|
3618
|
+
|
|
3619
|
+
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
3620
|
+
|
|
3621
|
+
const isClient = !isSSR();
|
|
3622
|
+
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
3623
|
+
|
|
3624
|
+
const AddressRetailField = JSX(({ field, input }) => {
|
|
3625
|
+
const [offices, setOffices] = useState([]);
|
|
3626
|
+
const { data } = useLeadFormData('REGION_RF');
|
|
3627
|
+
const regionValue = field('regionRetail')?.value || {};
|
|
3628
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3629
|
+
const fieldBranch = field('addressRetail');
|
|
3630
|
+
useEffect(() => {
|
|
3631
|
+
(async () => {
|
|
3632
|
+
const officesList = await fetchRegionOffices(regionValue?.key ?? '');
|
|
3633
|
+
setOffices(officesList);
|
|
3634
|
+
})();
|
|
3635
|
+
if (regionValue?.key) {
|
|
3636
|
+
field?.('addressRetail')?.onChange?.('');
|
|
3637
|
+
}
|
|
3638
|
+
}, [regionValue.key]);
|
|
3639
|
+
const { points } = useOfficesAtmsMapData({
|
|
3640
|
+
data: offices,
|
|
3641
|
+
filtrationState: {},
|
|
3642
|
+
getBalloon: getOfficePoint,
|
|
3105
3643
|
});
|
|
3106
|
-
const
|
|
3107
|
-
return (jsxs("div", {
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3644
|
+
const isRegionSelected = Boolean(regionValue?.key);
|
|
3645
|
+
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
3646
|
+
key: id?.toString() || '',
|
|
3647
|
+
text: address,
|
|
3648
|
+
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
3649
|
+
});
|
|
3650
|
+
|
|
3651
|
+
const SelectField = UniBlock(({ field, source, fieldName, input, placeholder = 'Выберите из списка',
|
|
3652
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3653
|
+
options, ...rest }) => {
|
|
3654
|
+
const leadOptions = source?.map((_) => ({
|
|
3655
|
+
key: _.key || '',
|
|
3656
|
+
text: _.value,
|
|
3657
|
+
})) || [];
|
|
3658
|
+
return (jsx(SelectControl, { placeholder: placeholder, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), ...rest }));
|
|
3659
|
+
});
|
|
3660
|
+
|
|
3661
|
+
const AmountWorkersField = JSX(({ field, input }) => {
|
|
3662
|
+
const { data } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
3663
|
+
const store = useRetailFormStore();
|
|
3664
|
+
useEffect(() => {
|
|
3665
|
+
if (data) {
|
|
3666
|
+
store.amountWorkers = data;
|
|
3667
|
+
}
|
|
3668
|
+
}, [data]);
|
|
3669
|
+
return (jsx(SelectField, { field: field, source: store.amountWorkers ?? [], label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
|
|
3118
3670
|
});
|
|
3119
3671
|
|
|
3120
|
-
const
|
|
3672
|
+
const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
|
|
3121
3673
|
|
|
3122
|
-
const
|
|
3674
|
+
const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", isInteger: true, ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
3123
3675
|
|
|
3124
|
-
const
|
|
3676
|
+
const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
|
|
3125
3677
|
|
|
3126
|
-
const
|
|
3127
|
-
|
|
3678
|
+
const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
|
|
3679
|
+
|
|
3680
|
+
const FIELD_NAME$9 = 'birthPlace';
|
|
3681
|
+
const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$9) })));
|
|
3128
3682
|
|
|
3129
3683
|
const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
|
|
3130
3684
|
const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
|
|
@@ -3180,10 +3734,6 @@
|
|
|
3180
3734
|
|
|
3181
3735
|
const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
|
|
3182
3736
|
|
|
3183
|
-
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
3184
|
-
|
|
3185
|
-
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
3186
|
-
|
|
3187
3737
|
const ConfirmationIncomeField = JSX(({ field, input }) => {
|
|
3188
3738
|
const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
|
|
3189
3739
|
return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
|
|
@@ -3215,9 +3765,6 @@
|
|
|
3215
3765
|
text: 'Согласие на запрос в ПФР',
|
|
3216
3766
|
docId: 3,
|
|
3217
3767
|
},
|
|
3218
|
-
consentToReceiveMaterials: {
|
|
3219
|
-
text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
|
|
3220
|
-
},
|
|
3221
3768
|
};
|
|
3222
3769
|
|
|
3223
3770
|
const feedbackById = async (id, convertToPng = false) => {
|
|
@@ -3225,42 +3772,6 @@
|
|
|
3225
3772
|
return response ? await response.blob() : new Blob();
|
|
3226
3773
|
};
|
|
3227
3774
|
|
|
3228
|
-
function useButton() {
|
|
3229
|
-
return (props) => ({
|
|
3230
|
-
...props,
|
|
3231
|
-
onClick: handlerDecorator(handleClick(props)),
|
|
3232
|
-
});
|
|
3233
|
-
}
|
|
3234
|
-
function handleClick({ disabled, onClick }) {
|
|
3235
|
-
return (ev) => {
|
|
3236
|
-
!disabled && onClick && onClick(ev);
|
|
3237
|
-
};
|
|
3238
|
-
}
|
|
3239
|
-
|
|
3240
|
-
const buttonStyleMap = {
|
|
3241
|
-
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
3242
|
-
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
3243
|
-
};
|
|
3244
|
-
const secondaryButtonStyleMap = {
|
|
3245
|
-
primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
3246
|
-
secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
3247
|
-
};
|
|
3248
|
-
const Button = JSX(({ children, ...props }) => {
|
|
3249
|
-
const button = useButton();
|
|
3250
|
-
const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
3251
|
-
return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
|
|
3252
|
-
'text-white bg-primary-active': active,
|
|
3253
|
-
'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
|
|
3254
|
-
'rounded-md': rounded,
|
|
3255
|
-
}, !active && !disabled && !isLoading
|
|
3256
|
-
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
3257
|
-
: '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
|
|
3258
|
-
});
|
|
3259
|
-
|
|
3260
|
-
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
|
|
3261
|
-
|
|
3262
|
-
const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
|
|
3263
|
-
|
|
3264
3775
|
// TODO Перенесено как есть из openDocument. Требует рефакторинга
|
|
3265
3776
|
const DocumentDialog = JSX(({ src, convertToPng, onClose, onDocumentRead }) => (jsxs(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", onClose: onClose, children: [convertToPng ? (jsx("img", { src: src })) : (jsx("iframe", { src: `${src}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })), jsx(Button, { className: "mx-auto mt-m", type: "button", onClick: () => {
|
|
3266
3777
|
onDocumentRead?.();
|
|
@@ -3343,12 +3854,6 @@
|
|
|
3343
3854
|
const renderMonthsInput = ({ min = 0, max = 0, availableMonths, ...rest }) => (jsx(InputRange, { items: [`От ${monthText(min)}`, `До ${monthText(max)}`], step: STEP_MONTHS, ...(availableMonths?.length ? { list: availableMonths } : { min, max }), ...rest }));
|
|
3344
3855
|
const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
|
|
3345
3856
|
|
|
3346
|
-
const orientationStyleMap = {
|
|
3347
|
-
horizontal: '@lg:flex-row',
|
|
3348
|
-
vertical: '',
|
|
3349
|
-
};
|
|
3350
|
-
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
3351
|
-
|
|
3352
3857
|
const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, onChange, ...rest }) => (jsxs("div", { className: "grid gap-s whitespace-nowrap", children: [title ? (jsx("div", { className: "hidden @5xl:block", role: "radiogroup", "aria-label": title, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (jsx("div", { className: "@5xl:hidden", role: "radiogroup", "aria-label": mobileTitle, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, jsx(RadioButtonGroup, { orientation: orientation, items: items, value: items[value ? 0 : 1].id, onChange: (_) => onChange && onChange(_ === items[0].id), ...rest })] }));
|
|
3353
3858
|
|
|
3354
3859
|
const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
|
|
@@ -3590,12 +4095,12 @@
|
|
|
3590
4095
|
};
|
|
3591
4096
|
const swap = (_) => Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
|
|
3592
4097
|
|
|
3593
|
-
const FIELD_NAME$
|
|
4098
|
+
const FIELD_NAME$8 = 'calculator';
|
|
3594
4099
|
const CreditCalcField = JSX(({ field, params }) => {
|
|
3595
4100
|
const handleChange = useCallback((_) => {
|
|
3596
|
-
field(FIELD_NAME$
|
|
4101
|
+
field(FIELD_NAME$8).onChange?.(_);
|
|
3597
4102
|
}, []);
|
|
3598
|
-
return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$
|
|
4103
|
+
return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$8).value), onChange: handleChange }));
|
|
3599
4104
|
});
|
|
3600
4105
|
|
|
3601
4106
|
const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
|
|
@@ -3620,34 +4125,32 @@
|
|
|
3620
4125
|
|
|
3621
4126
|
const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", isInteger: true, maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
3622
4127
|
|
|
3623
|
-
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
|
|
3624
|
-
|
|
3625
4128
|
const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
|
|
3626
4129
|
|
|
3627
|
-
const FIELD_NAME$
|
|
3628
|
-
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$
|
|
4130
|
+
const FIELD_NAME$7 = 'dulIssueDateField';
|
|
4131
|
+
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$7), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
|
|
3629
4132
|
|
|
3630
|
-
const FIELD_NAME$
|
|
4133
|
+
const FIELD_NAME$6 = 'dulIssuedBy';
|
|
3631
4134
|
const DulIssuedByField = JSX(({ field, input }) => {
|
|
3632
4135
|
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
3633
4136
|
const onDaDataChange = useCallback((item) => {
|
|
3634
4137
|
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
3635
4138
|
}, []);
|
|
3636
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4139
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
3637
4140
|
});
|
|
3638
4141
|
|
|
3639
|
-
const FIELD_NAME$
|
|
3640
|
-
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4142
|
+
const FIELD_NAME$5 = 'dulNumber';
|
|
4143
|
+
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
|
|
3641
4144
|
|
|
3642
|
-
const FIELD_NAME$
|
|
3643
|
-
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4145
|
+
const FIELD_NAME$4 = 'dulSerie';
|
|
4146
|
+
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
|
|
3644
4147
|
|
|
3645
|
-
const FIELD_NAME$
|
|
4148
|
+
const FIELD_NAME$3 = 'dulSubdivisionCode';
|
|
3646
4149
|
const DulSubdivisionCodeField = JSX(({ field, input }) => {
|
|
3647
4150
|
const onDaDataChange = useCallback((item) => {
|
|
3648
4151
|
field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
|
|
3649
4152
|
}, []);
|
|
3650
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4153
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", isInteger: true, maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$3), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
|
|
3651
4154
|
});
|
|
3652
4155
|
|
|
3653
4156
|
const EducationField = JSX(({ field, input }) => {
|
|
@@ -3655,217 +4158,67 @@
|
|
|
3655
4158
|
return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
|
|
3656
4159
|
});
|
|
3657
4160
|
|
|
3658
|
-
const
|
|
3659
|
-
const {
|
|
3660
|
-
return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
|
|
3661
|
-
});
|
|
3662
|
-
|
|
3663
|
-
const EmployerActivitiesField = JSX(({ field, input }) => {
|
|
3664
|
-
const { data } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
|
|
3665
|
-
const store = useRetailFormStore();
|
|
3666
|
-
useEffect(() => {
|
|
3667
|
-
if (data) {
|
|
3668
|
-
store.employerActivities = data;
|
|
3669
|
-
}
|
|
3670
|
-
}, [data]);
|
|
3671
|
-
return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
|
|
3672
|
-
});
|
|
3673
|
-
|
|
3674
|
-
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
3675
|
-
const { data } = useLeadFormData('ORGANIZATION_KIND');
|
|
3676
|
-
const store = useRetailFormStore();
|
|
3677
|
-
useEffect(() => {
|
|
3678
|
-
if (data) {
|
|
3679
|
-
store.employerOrganization = data;
|
|
3680
|
-
}
|
|
3681
|
-
}, [data]);
|
|
3682
|
-
return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
|
|
3683
|
-
});
|
|
3684
|
-
|
|
3685
|
-
const EmploymentField = JSX(({ field, input }) => {
|
|
3686
|
-
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
3687
|
-
return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
|
|
3688
|
-
});
|
|
3689
|
-
|
|
3690
|
-
const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
3691
|
-
|
|
3692
|
-
const FIELD_NAME$4 = 'experience5Years';
|
|
3693
|
-
const MAX_YEARS = 5;
|
|
3694
|
-
const MIN_YEARS = 0;
|
|
3695
|
-
const Experience5YearsField = JSX(({ field, input }) => {
|
|
3696
|
-
const onChange = useCallback((value) => field(FIELD_NAME$4)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
|
|
3697
|
-
return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$4), validatorObj[FIELD_NAME$4], input?.required), ...input, onChange: onChange }));
|
|
3698
|
-
});
|
|
3699
|
-
|
|
3700
|
-
const FamilyMembersField = JSX(({ field }) => {
|
|
3701
|
-
const { value, onChange } = field('familyMembers');
|
|
3702
|
-
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
3703
|
-
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
3704
|
-
const childrenCount = Number(field('children')?.value);
|
|
3705
|
-
const dependentsCount = Number(field('dependents')?.value);
|
|
3706
|
-
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
3707
|
-
useEffect(() => {
|
|
3708
|
-
field?.('familyMembers')?.onChange?.(totalCount);
|
|
3709
|
-
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
3710
|
-
return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
|
|
3711
|
-
});
|
|
3712
|
-
|
|
3713
|
-
const FamilyStatusField = JSX(({ field, input }) => {
|
|
3714
|
-
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
3715
|
-
return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
|
|
3716
|
-
});
|
|
3717
|
-
|
|
3718
|
-
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
3719
|
-
const SERVICE_DIRECTIONS = [
|
|
3720
|
-
{ key: 'Физическое лицо' },
|
|
3721
|
-
{ key: 'Юридическое лицо / ИП' },
|
|
3722
|
-
];
|
|
3723
|
-
const FEEDBACK_METHOD = [
|
|
3724
|
-
{ key: 'phone', text: 'Телефонный звонок' },
|
|
3725
|
-
{ key: 'email', text: 'Электронное сообщение' },
|
|
3726
|
-
];
|
|
3727
|
-
|
|
3728
|
-
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
3729
|
-
|
|
3730
|
-
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
3731
|
-
|
|
3732
|
-
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
3733
|
-
|
|
3734
|
-
const HousingField = JSX(({ field, input }) => {
|
|
3735
|
-
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
3736
|
-
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
3737
|
-
});
|
|
3738
|
-
|
|
3739
|
-
const getOrganizationActivityType = (options, okved) => {
|
|
3740
|
-
if (!okved) {
|
|
3741
|
-
return null;
|
|
3742
|
-
}
|
|
3743
|
-
const getOptionByKey = getOptionOp(options);
|
|
3744
|
-
const okvedType = +okved?.split('.')[0];
|
|
3745
|
-
const secondOkvedType = +okved?.split('.')[1];
|
|
3746
|
-
switch (okvedType) {
|
|
3747
|
-
case 1:
|
|
3748
|
-
return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
|
|
3749
|
-
case 35:
|
|
3750
|
-
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
3751
|
-
case 41:
|
|
3752
|
-
case 42:
|
|
3753
|
-
case 43:
|
|
3754
|
-
return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
|
|
3755
|
-
case 46:
|
|
3756
|
-
case 47:
|
|
3757
|
-
return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
|
|
3758
|
-
case 55:
|
|
3759
|
-
case 79:
|
|
3760
|
-
return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
|
|
3761
|
-
case 62:
|
|
3762
|
-
return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
|
|
3763
|
-
case 63:
|
|
3764
|
-
return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
|
|
3765
|
-
case 64:
|
|
3766
|
-
return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
|
|
3767
|
-
case 65:
|
|
3768
|
-
return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
|
|
3769
|
-
case 66:
|
|
3770
|
-
return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
|
|
3771
|
-
case 72:
|
|
3772
|
-
case 74:
|
|
3773
|
-
return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
|
|
3774
|
-
case 80:
|
|
3775
|
-
return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
|
|
3776
|
-
case 84: {
|
|
3777
|
-
if (secondOkvedType < 22) {
|
|
3778
|
-
return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
|
|
3779
|
-
}
|
|
3780
|
-
if (secondOkvedType === 22) {
|
|
3781
|
-
return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
|
|
3782
|
-
}
|
|
3783
|
-
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
3784
|
-
}
|
|
3785
|
-
case 85:
|
|
3786
|
-
return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
|
|
3787
|
-
case 86:
|
|
3788
|
-
return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
|
|
3789
|
-
case 87:
|
|
3790
|
-
return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
|
|
3791
|
-
default: {
|
|
3792
|
-
if (okvedType >= 10 && okvedType <= 33) {
|
|
3793
|
-
return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
|
|
3794
|
-
}
|
|
3795
|
-
if (okvedType >= 5 && okvedType <= 9) {
|
|
3796
|
-
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
3797
|
-
}
|
|
3798
|
-
if (okvedType >= 49 && okvedType <= 53) {
|
|
3799
|
-
return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
|
|
3800
|
-
}
|
|
3801
|
-
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3804
|
-
};
|
|
3805
|
-
const getEmployeesNumberOption = (options, count) => {
|
|
3806
|
-
if (!count) {
|
|
3807
|
-
return null;
|
|
3808
|
-
}
|
|
3809
|
-
const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
|
|
3810
|
-
key: _?.key ?? '',
|
|
3811
|
-
text: _?.value ?? '',
|
|
3812
|
-
}));
|
|
3813
|
-
return option;
|
|
3814
|
-
};
|
|
3815
|
-
const getOrganizationKind = (options, okopf) => {
|
|
3816
|
-
const getOptionByKey = getOptionOp(options);
|
|
3817
|
-
if ([40001, 40002, 71610].includes(okopf)) {
|
|
3818
|
-
return getOptionByKey('FOREIGN');
|
|
3819
|
-
}
|
|
3820
|
-
return getOptionByKey('RUSSIAN');
|
|
3821
|
-
};
|
|
3822
|
-
const getOrganizationType = (options, okopf, inn) => {
|
|
3823
|
-
const getOptionByKey = getOptionOp(options);
|
|
3824
|
-
if (inn === '7725114488') {
|
|
3825
|
-
return getOptionByKey('RSHB');
|
|
3826
|
-
}
|
|
3827
|
-
if (okopf === 50102) {
|
|
3828
|
-
return getOptionByKey('SOLE_TRADER');
|
|
3829
|
-
}
|
|
3830
|
-
if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
|
|
3831
|
-
return getOptionByKey('BUDGETARY');
|
|
3832
|
-
}
|
|
3833
|
-
return getOptionByKey('COMMERCIAL');
|
|
3834
|
-
};
|
|
3835
|
-
const getOptionOp = (options) => (key) => options
|
|
3836
|
-
.map((_) => ({ key: _.key, text: _.value }))
|
|
3837
|
-
.find((_) => _.key === key) ?? null;
|
|
3838
|
-
|
|
3839
|
-
const updateOrganizationFields = (store, field, item) => {
|
|
3840
|
-
const { okved, okopf, inn } = getOrganizationRequisites(item);
|
|
3841
|
-
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3842
|
-
field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
|
|
3843
|
-
const organizationData = {
|
|
3844
|
-
amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
|
|
3845
|
-
employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
|
|
3846
|
-
organization: getOrganizationType(store?.organization ?? [], okopf, inn),
|
|
3847
|
-
employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
|
|
3848
|
-
};
|
|
3849
|
-
for (const fieldName in organizationData) {
|
|
3850
|
-
organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
|
|
3851
|
-
}
|
|
3852
|
-
};
|
|
3853
|
-
const getOrganizationRequisites = (item) => ({
|
|
3854
|
-
inn: item.data?.inn ?? '',
|
|
3855
|
-
okopf: Number(item.data?.opf?.code),
|
|
3856
|
-
okved: item.data?.okved ?? '',
|
|
3857
|
-
});
|
|
3858
|
-
|
|
3859
|
-
const InnField = JSX(({ field, input }) => {
|
|
4161
|
+
const EmployerActivitiesField = JSX(({ field, input }) => {
|
|
4162
|
+
const { data } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
|
|
3860
4163
|
const store = useRetailFormStore();
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
4164
|
+
useEffect(() => {
|
|
4165
|
+
if (data) {
|
|
4166
|
+
store.employerActivities = data;
|
|
4167
|
+
}
|
|
4168
|
+
}, [data]);
|
|
4169
|
+
return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
|
|
3866
4170
|
});
|
|
3867
4171
|
|
|
3868
|
-
const
|
|
4172
|
+
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
4173
|
+
const { data } = useLeadFormData('ORGANIZATION_KIND');
|
|
4174
|
+
const store = useRetailFormStore();
|
|
4175
|
+
useEffect(() => {
|
|
4176
|
+
if (data) {
|
|
4177
|
+
store.employerOrganization = data;
|
|
4178
|
+
}
|
|
4179
|
+
}, [data]);
|
|
4180
|
+
return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
|
|
4181
|
+
});
|
|
4182
|
+
|
|
4183
|
+
const EmploymentField = JSX(({ field, input }) => {
|
|
4184
|
+
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
4185
|
+
return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
|
|
4186
|
+
});
|
|
4187
|
+
|
|
4188
|
+
const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
4189
|
+
|
|
4190
|
+
const FIELD_NAME$2 = 'experience5Years';
|
|
4191
|
+
const MAX_YEARS = 5;
|
|
4192
|
+
const MIN_YEARS = 0;
|
|
4193
|
+
const Experience5YearsField = JSX(({ field, input }) => {
|
|
4194
|
+
const onChange = useCallback((value) => field(FIELD_NAME$2)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
|
|
4195
|
+
return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$2), validatorObj[FIELD_NAME$2], input?.required), ...input, onChange: onChange }));
|
|
4196
|
+
});
|
|
4197
|
+
|
|
4198
|
+
const FamilyMembersField = JSX(({ field }) => {
|
|
4199
|
+
const { value, onChange } = field('familyMembers');
|
|
4200
|
+
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
4201
|
+
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
4202
|
+
const childrenCount = Number(field('children')?.value);
|
|
4203
|
+
const dependentsCount = Number(field('dependents')?.value);
|
|
4204
|
+
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
4205
|
+
useEffect(() => {
|
|
4206
|
+
field?.('familyMembers')?.onChange?.(totalCount);
|
|
4207
|
+
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
4208
|
+
return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
|
|
4209
|
+
});
|
|
4210
|
+
|
|
4211
|
+
const FamilyStatusField = JSX(({ field, input }) => {
|
|
4212
|
+
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
4213
|
+
return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
|
|
4214
|
+
});
|
|
4215
|
+
|
|
4216
|
+
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
4217
|
+
|
|
4218
|
+
const HousingField = JSX(({ field, input }) => {
|
|
4219
|
+
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
4220
|
+
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
4221
|
+
});
|
|
3869
4222
|
|
|
3870
4223
|
const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", isInteger: true, maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
3871
4224
|
|
|
@@ -3877,30 +4230,8 @@
|
|
|
3877
4230
|
|
|
3878
4231
|
const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
|
|
3879
4232
|
|
|
3880
|
-
const FIELD_NAME$
|
|
3881
|
-
const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$
|
|
3882
|
-
|
|
3883
|
-
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3884
|
-
const EMPTY_REGIONS$1 = [];
|
|
3885
|
-
async function getOutServiceRegions() {
|
|
3886
|
-
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3887
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
3888
|
-
}
|
|
3889
|
-
|
|
3890
|
-
const LocalitiesField = JSX(({ field, input }) => {
|
|
3891
|
-
const fieldRegion = field('region');
|
|
3892
|
-
const regionKey = fieldRegion?.value?.key;
|
|
3893
|
-
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
3894
|
-
const localities = regions
|
|
3895
|
-
?.find((_) => _.code === regionKey)
|
|
3896
|
-
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
3897
|
-
useEffect(() => {
|
|
3898
|
-
if (regionKey !== '') {
|
|
3899
|
-
field?.('localities')?.onChange?.('');
|
|
3900
|
-
}
|
|
3901
|
-
}, [regionKey]);
|
|
3902
|
-
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
3903
|
-
});
|
|
4233
|
+
const FIELD_NAME$1 = 'limitedBirthday';
|
|
4234
|
+
const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$1), validatorObj.limitedBirthday, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1) })));
|
|
3904
4235
|
|
|
3905
4236
|
const MandatoryPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
|
|
3906
4237
|
|
|
@@ -3910,15 +4241,6 @@
|
|
|
3910
4241
|
];
|
|
3911
4242
|
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
3912
4243
|
|
|
3913
|
-
const FIELD_NAME$2 = 'middleName';
|
|
3914
|
-
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), ...getValidation(field(FIELD_NAME$2), validatorObj.middleName, input?.required), ...input })));
|
|
3915
|
-
|
|
3916
|
-
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
3917
|
-
|
|
3918
|
-
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
3919
|
-
|
|
3920
|
-
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
3921
|
-
|
|
3922
4244
|
const OrganizationField = JSX(({ field, input }) => {
|
|
3923
4245
|
const { data } = useLeadFormData('ORGANIZATION_TYPE');
|
|
3924
4246
|
const store = useRetailFormStore();
|
|
@@ -3945,15 +4267,10 @@
|
|
|
3945
4267
|
|
|
3946
4268
|
const MAX_PART = 100;
|
|
3947
4269
|
const MIN_PART = 0;
|
|
3948
|
-
const FIELD_NAME
|
|
4270
|
+
const FIELD_NAME = 'partInBusiness';
|
|
3949
4271
|
const PartInBusinessField = JSX(({ field, input }) => {
|
|
3950
|
-
const onChange = useCallback((value) => field(FIELD_NAME
|
|
3951
|
-
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME
|
|
3952
|
-
});
|
|
3953
|
-
|
|
3954
|
-
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
3955
|
-
const { required, ...rest } = input;
|
|
3956
|
-
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
4272
|
+
const onChange = useCallback((value) => field(FIELD_NAME)?.onChange?.(String(clamp(Number(value), MIN_PART, MAX_PART))), []);
|
|
4273
|
+
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME), validatorObj.partInBusiness, input?.required), ...input, onChange: onChange }));
|
|
3957
4274
|
});
|
|
3958
4275
|
|
|
3959
4276
|
const getPaymentSystems = async (creditProgramId) => {
|
|
@@ -3984,73 +4301,11 @@
|
|
|
3984
4301
|
});
|
|
3985
4302
|
const formatPaymentSystems = (paymentSystems) => paymentSystems?.map((_) => ({ id: _.key, text: _.text })) ?? [];
|
|
3986
4303
|
|
|
3987
|
-
const isPlaceholder = (_) => _ === '_';
|
|
3988
|
-
const isDigit = (_) => /\d/.test(_);
|
|
3989
|
-
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
3990
|
-
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
3991
|
-
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
3992
|
-
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
3993
|
-
function normalizePhone(phone) {
|
|
3994
|
-
const phoneNumbers = phone.replace(/\D/g, '');
|
|
3995
|
-
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
3996
|
-
const result = phonePattern.map(applyPlaceholder);
|
|
3997
|
-
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
3998
|
-
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
3999
|
-
}
|
|
4000
|
-
|
|
4001
|
-
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
4002
|
-
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
4003
|
-
const handleBlur = useCallback((v) => {
|
|
4004
|
-
if (v === '+7 (') {
|
|
4005
|
-
onChange && onChange('');
|
|
4006
|
-
}
|
|
4007
|
-
}, []);
|
|
4008
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4009
|
-
});
|
|
4010
|
-
|
|
4011
|
-
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
4012
|
-
|
|
4013
|
-
const PhoneField = JSX(({ field, input }) => {
|
|
4014
|
-
const fieldName = input?.name || 'phone';
|
|
4015
|
-
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
4016
|
-
});
|
|
4017
|
-
|
|
4018
4304
|
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
4019
4305
|
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
4020
4306
|
return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
|
|
4021
4307
|
});
|
|
4022
4308
|
|
|
4023
|
-
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
4024
|
-
|
|
4025
|
-
const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
4026
|
-
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
4027
|
-
|
|
4028
|
-
const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
|
|
4029
|
-
const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
|
|
4030
|
-
|
|
4031
|
-
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
4032
|
-
const EMPTY_REGIONS = [];
|
|
4033
|
-
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
4034
|
-
function useRegions(url = REGIONS_URL) {
|
|
4035
|
-
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
4036
|
-
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
4037
|
-
}
|
|
4038
|
-
|
|
4039
|
-
const RegionField = JSX(({ field, input, params }) => {
|
|
4040
|
-
const url = getRegionUrl(params?.typeForm);
|
|
4041
|
-
const regions = useRegions(url);
|
|
4042
|
-
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
4043
|
-
});
|
|
4044
|
-
|
|
4045
|
-
const RegionPremiumField = JSX(({ field, input }) => {
|
|
4046
|
-
const branchByRegions = useBranchesByRegions(true);
|
|
4047
|
-
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
4048
|
-
key: region,
|
|
4049
|
-
text: region,
|
|
4050
|
-
})), [branchByRegions]);
|
|
4051
|
-
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
4052
|
-
});
|
|
4053
|
-
|
|
4054
4309
|
const RegionRetailField = JSX(({ field, input }) => {
|
|
4055
4310
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
4056
4311
|
const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
|
|
@@ -4059,15 +4314,6 @@
|
|
|
4059
4314
|
|
|
4060
4315
|
const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
|
|
4061
4316
|
|
|
4062
|
-
const SecondaryPhoneField = JSX(({ field }) => {
|
|
4063
|
-
const fieldPhone = field('secondaryPhone');
|
|
4064
|
-
return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
|
|
4065
|
-
? fieldPhone
|
|
4066
|
-
: withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
|
|
4067
|
-
});
|
|
4068
|
-
|
|
4069
|
-
const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
|
|
4070
|
-
|
|
4071
4317
|
const GENDERS = ['male', 'female'];
|
|
4072
4318
|
const getGenderFromName = async (name) => {
|
|
4073
4319
|
const res = await fetchRetailJSON('/suggestions/suggest/fio', 'POST', {
|
|
@@ -4097,129 +4343,68 @@
|
|
|
4097
4343
|
}
|
|
4098
4344
|
}, []);
|
|
4099
4345
|
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
|
|
4100
|
-
});
|
|
4101
|
-
|
|
4102
|
-
const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
|
|
4103
|
-
|
|
4104
|
-
const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
|
|
4105
|
-
const handleChange = useCallback((v) => maxLength
|
|
4106
|
-
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
4107
|
-
: onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
|
|
4108
|
-
const handleBlur = useCallback((v) => {
|
|
4109
|
-
if (v === '___-___-___ __') {
|
|
4110
|
-
onChange && onChange('');
|
|
4111
|
-
}
|
|
4112
|
-
}, []);
|
|
4113
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4114
|
-
});
|
|
4115
|
-
|
|
4116
|
-
const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
|
|
4117
|
-
|
|
4118
|
-
const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
|
|
4119
|
-
|
|
4120
|
-
const
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
const
|
|
4125
|
-
|
|
4126
|
-
const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
|
|
4127
|
-
|
|
4128
|
-
const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
|
|
4129
|
-
|
|
4130
|
-
const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
|
|
4131
|
-
|
|
4132
|
-
const VED_TYPES = [
|
|
4133
|
-
{ id: 'currencyControl', text: 'Валютный контроль' },
|
|
4134
|
-
{ id: 'documentOperations', text: 'Документарные операции' },
|
|
4135
|
-
{ id: 'conversionTransactions', text: 'Конверсионные операции' },
|
|
4136
|
-
{ id: 'otherIssues', text: 'Иные вопросы ВЭД' },
|
|
4137
|
-
];
|
|
4138
|
-
const VedField = JSX(({ field }) => {
|
|
4139
|
-
const { value, onChange } = field('vedTypes');
|
|
4140
|
-
useEffect(() => {
|
|
4141
|
-
if (value !== 'currencyControl') {
|
|
4142
|
-
field?.('inn')?.onChange?.('');
|
|
4143
|
-
field?.('region')?.onChange?.('');
|
|
4144
|
-
}
|
|
4145
|
-
}, [value]);
|
|
4146
|
-
return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
|
|
4147
|
-
});
|
|
4148
|
-
|
|
4149
|
-
const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
|
|
4150
|
-
|
|
4151
|
-
function isRenderField({ input, field, }) {
|
|
4152
|
-
const { condition } = input;
|
|
4153
|
-
const { value } = field(condition?.name || '');
|
|
4154
|
-
return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
|
|
4155
|
-
}
|
|
4156
|
-
|
|
4157
|
-
const PRODUCT_REF = {
|
|
4158
|
-
$ref: '/wcms-resources/outservice-productlist.json',
|
|
4159
|
-
};
|
|
4160
|
-
const InputsMap = {
|
|
4161
|
-
fullName: (props) => jsx(FullNameField, { ...props }),
|
|
4162
|
-
addressBranch: (props) => jsx(AddressBranchField, { ...props }),
|
|
4163
|
-
desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
|
|
4164
|
-
product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
|
|
4165
|
-
localities: (props) => jsx(LocalitiesField, { ...props }),
|
|
4166
|
-
isClient: (props) => jsx(IsClientField, { ...props }),
|
|
4167
|
-
partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
|
|
4168
|
-
collectionCount: (props) => jsx(CollectionCountField, { ...props }),
|
|
4169
|
-
acquiringType: (props) => jsx(AcquiringField, { ...props }),
|
|
4170
|
-
onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
|
|
4171
|
-
posTerminal: (props) => jsx(PosTerminalField, { ...props }),
|
|
4172
|
-
serviceType: (props) => jsx(UltraPremiumField, { ...props }),
|
|
4173
|
-
term: (props) => jsx(TermField, { ...props }),
|
|
4174
|
-
amount: (props) => jsx(AmountField, { ...props }),
|
|
4175
|
-
annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
|
|
4176
|
-
vedTypes: (props) => jsx(VedField, { ...props }),
|
|
4177
|
-
feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
|
|
4178
|
-
serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
|
|
4179
|
-
bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
|
|
4180
|
-
secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
|
|
4181
|
-
applicationDate: (props) => (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...props })),
|
|
4182
|
-
region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
|
|
4183
|
-
consentToReceiveMaterials: (props) => jsx(ConsentField, { ...props }),
|
|
4184
|
-
surname: (props) => jsx(SurnameField, { ...props }),
|
|
4185
|
-
name: (props) => jsx(NameField, { ...props }),
|
|
4186
|
-
middleName: (props) => jsx(MiddleNameField, { ...props }),
|
|
4187
|
-
birthday: (props) => jsx(BirthdayField, { ...props }),
|
|
4188
|
-
phone: (props) => jsx(PhoneField, { ...props }),
|
|
4189
|
-
email: (props) => jsx(EmailField, { ...props }),
|
|
4190
|
-
inn: (props) => jsx(InnField, { ...props }),
|
|
4191
|
-
comment: (props) => jsx(CommentField, { ...props }),
|
|
4346
|
+
});
|
|
4347
|
+
|
|
4348
|
+
const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
|
|
4349
|
+
|
|
4350
|
+
const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
|
|
4351
|
+
const handleChange = useCallback((v) => maxLength
|
|
4352
|
+
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
4353
|
+
: onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
|
|
4354
|
+
const handleBlur = useCallback((v) => {
|
|
4355
|
+
if (v === '___-___-___ __') {
|
|
4356
|
+
onChange && onChange('');
|
|
4357
|
+
}
|
|
4358
|
+
}, []);
|
|
4359
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4360
|
+
});
|
|
4361
|
+
|
|
4362
|
+
const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
|
|
4363
|
+
|
|
4364
|
+
const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
|
|
4365
|
+
|
|
4366
|
+
const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
|
|
4367
|
+
|
|
4368
|
+
const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
|
|
4369
|
+
|
|
4370
|
+
const InputsApplicationLeadMap = {
|
|
4371
|
+
limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
|
|
4192
4372
|
};
|
|
4193
|
-
const
|
|
4373
|
+
const InputsConsentsMap = {
|
|
4194
4374
|
processPersonalDataFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4195
4375
|
consentProviderFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4196
4376
|
consentOthersFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4197
4377
|
consentInformFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4198
4378
|
consentPfrFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4379
|
+
};
|
|
4380
|
+
const InputsRetailMap = {
|
|
4381
|
+
organization: (props) => jsx(OrganizationField, { ...props }),
|
|
4382
|
+
organizationAddress: (props) => jsx(AddressField, { ...props }),
|
|
4199
4383
|
organizationPhone: (props) => jsx(PhoneField, { ...props }),
|
|
4200
|
-
legalForm: (props) => jsx(LegalFormField, { ...props }),
|
|
4201
4384
|
organizationName: (props) => jsx(OrganizationNameField, { ...props }),
|
|
4385
|
+
legalForm: (props) => jsx(LegalFormField, { ...props }),
|
|
4202
4386
|
generalSeniority: (props) => jsx(GeneralSeniorityField, { ...props }),
|
|
4203
4387
|
lastJobExperience: (props) => jsx(LastJobExperienceField, { ...props }),
|
|
4204
4388
|
experience5Years: (props) => jsx(Experience5YearsField, { ...props }),
|
|
4205
4389
|
jobsNumber: (props) => jsx(JobsNumberField, { ...props }),
|
|
4206
4390
|
beginDate: (props) => jsx(BeginDateField, { ...props }),
|
|
4207
4391
|
addressFact: (props) => jsx(AddressFactField, { ...props }),
|
|
4208
|
-
|
|
4392
|
+
addressRegistration: (props) => jsx(AddressField, { ...props }),
|
|
4393
|
+
addressRetail: (props) => jsx(AddressRetailField, { ...props }),
|
|
4394
|
+
addressMatch: (props) => jsx(AddressMatchField, { ...props }),
|
|
4209
4395
|
sex: (props) => jsx(SexField, { ...props }),
|
|
4210
4396
|
limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
|
|
4211
4397
|
birthPlace: (props) => jsx(BirthPlaceField, { ...props }),
|
|
4212
4398
|
education: (props) => jsx(EducationField, { ...props }),
|
|
4213
4399
|
housing: (props) => jsx(HousingField, { ...props }),
|
|
4214
|
-
employment: (props) => jsx(EmploymentField, { ...props }),
|
|
4215
|
-
organization: (props) => jsx(OrganizationField, { ...props }),
|
|
4216
4400
|
amountWorkers: (props) => jsx(AmountWorkersField, { ...props }),
|
|
4401
|
+
employment: (props) => jsx(EmploymentField, { ...props }),
|
|
4217
4402
|
employerActivities: (props) => jsx(EmployerActivitiesField, { ...props }),
|
|
4218
4403
|
employerOrganization: (props) => jsx(EmployerOrganizationField, { ...props }),
|
|
4219
4404
|
positionOrganization: (props) => jsx(PositionOrganizationField, { ...props }),
|
|
4220
4405
|
familyStatus: (props) => jsx(FamilyStatusField, { ...props }),
|
|
4221
|
-
children: (props) => jsx(ChildrenField, { ...props }),
|
|
4222
4406
|
familyMembers: (props) => jsx(FamilyMembersField, { ...props }),
|
|
4407
|
+
children: (props) => jsx(ChildrenField, { ...props }),
|
|
4223
4408
|
dependents: (props) => jsx(DependentsField, { ...props }),
|
|
4224
4409
|
totalIncome: (props) => jsx(TotalIncomeField, { ...props }),
|
|
4225
4410
|
expenses: (props) => jsx(ExpensesField, { ...props }),
|
|
@@ -4231,8 +4416,6 @@
|
|
|
4231
4416
|
dulIssueDateField: (props) => jsx(DulIssueDateField, { ...props }),
|
|
4232
4417
|
dulSubdivisionCode: (props) => jsx(DulSubdivisionCodeField, { ...props }),
|
|
4233
4418
|
dulIssuedBy: (props) => jsx(DulIssuedByField, { ...props }),
|
|
4234
|
-
addressRegistration: (props) => jsx(AddressField, { ...props }),
|
|
4235
|
-
addressCourier: (props) => jsx(AddressField, { ...props }),
|
|
4236
4419
|
participantDateRegistration: (props) => (jsx(ParticipantDateRegistrationField, { ...props })),
|
|
4237
4420
|
retirementIncome: (props) => jsx(RetirementIncomeField, { ...props }),
|
|
4238
4421
|
otherIncome: (props) => jsx(OtherIncomeField, { ...props }),
|
|
@@ -4246,11 +4429,10 @@
|
|
|
4246
4429
|
bankEmployeeCode: (props) => jsx(BankEmpoleeCodeField, { ...props }),
|
|
4247
4430
|
partInBusiness: (props) => jsx(PartInBusinessField, { ...props }),
|
|
4248
4431
|
regionRetail: (props) => jsx(RegionRetailField, { ...props }),
|
|
4249
|
-
addressRetail: (props) => jsx(AddressRetailField, { ...props }),
|
|
4250
|
-
addressMatch: (props) => jsx(AddressMatchField, { ...props }),
|
|
4251
4432
|
calculator: (props) => jsx(CreditCalcField, { ...props }),
|
|
4252
4433
|
};
|
|
4253
4434
|
const InputRetailCardMap = {
|
|
4435
|
+
addressCourier: (props) => jsx(AddressField, { ...props }),
|
|
4254
4436
|
paymentSystem: (props) => jsx(PaymentSystemField, { ...props }),
|
|
4255
4437
|
currency: (props) => jsx(CurrencyField, { ...props }),
|
|
4256
4438
|
cardCategory: (props) => jsx(CardCategoryField, { ...props }),
|
|
@@ -4259,151 +4441,6 @@
|
|
|
4259
4441
|
methodObtain: (props) => jsx(MethodObtainField, { ...props }),
|
|
4260
4442
|
deliveryDate: (props) => jsx(DeliveryDateFiels, { ...props }),
|
|
4261
4443
|
};
|
|
4262
|
-
const getField = (field, params) => (input, i) => {
|
|
4263
|
-
const resultInputsMap = {
|
|
4264
|
-
...InputsMap,
|
|
4265
|
-
...InputsRetailMap,
|
|
4266
|
-
...InputRetailCardMap,
|
|
4267
|
-
};
|
|
4268
|
-
return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
|
|
4269
|
-
};
|
|
4270
|
-
|
|
4271
|
-
const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
|
|
4272
|
-
|
|
4273
|
-
const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
|
|
4274
|
-
|
|
4275
|
-
const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
|
|
4276
|
-
const responseOK = responseType === 'OK';
|
|
4277
|
-
const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
|
|
4278
|
-
const responseOKDescription = typeForm === 'ANTIFRAUD'
|
|
4279
|
-
? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
|
|
4280
|
-
можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
|
|
4281
|
-
не звонят с использованием мессенджеров.`
|
|
4282
|
-
: 'Совсем скоро мы с вами свяжемся';
|
|
4283
|
-
return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
|
|
4284
|
-
});
|
|
4285
|
-
|
|
4286
|
-
const objectValidator = (validatorsMap) => (o) => (o &&
|
|
4287
|
-
Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
|
|
4288
|
-
[];
|
|
4289
|
-
|
|
4290
|
-
const getPartnerComments = (data) => {
|
|
4291
|
-
const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
|
|
4292
|
-
if (acquiringType) {
|
|
4293
|
-
return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
|
|
4294
|
-
? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
|
|
4295
|
-
: '/Онлайн касса=false/POS-терминал=false'}`;
|
|
4296
|
-
}
|
|
4297
|
-
else {
|
|
4298
|
-
return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
|
|
4299
|
-
}
|
|
4300
|
-
};
|
|
4301
|
-
|
|
4302
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4303
|
-
const getFormatData = (data) => {
|
|
4304
|
-
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
|
|
4305
|
-
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
4306
|
-
const formatData = {
|
|
4307
|
-
...usedData,
|
|
4308
|
-
...getVedTypes(vedTypes),
|
|
4309
|
-
...getRegion(region),
|
|
4310
|
-
...(partnerComments ? { partnerComments } : {}),
|
|
4311
|
-
...(serviceType ? { typeForm: serviceType } : {}),
|
|
4312
|
-
};
|
|
4313
|
-
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
4314
|
-
};
|
|
4315
|
-
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
4316
|
-
const getVedTypes = (vedTypes) => vedTypes
|
|
4317
|
-
? {
|
|
4318
|
-
vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
|
|
4319
|
-
}
|
|
4320
|
-
: {};
|
|
4321
|
-
|
|
4322
|
-
const initialFormState$1 = {
|
|
4323
|
-
typeForm: '',
|
|
4324
|
-
region: { key: '', text: '' },
|
|
4325
|
-
addressBranch: { key: '', text: '' },
|
|
4326
|
-
surname: '',
|
|
4327
|
-
name: '',
|
|
4328
|
-
phone: '',
|
|
4329
|
-
secondaryPhone: '',
|
|
4330
|
-
comment: '',
|
|
4331
|
-
product: '',
|
|
4332
|
-
partnerComments: '',
|
|
4333
|
-
annualRevenue: '',
|
|
4334
|
-
term: 12,
|
|
4335
|
-
amount: 100000,
|
|
4336
|
-
acquiringType: ACQUIRING_TYPES[0],
|
|
4337
|
-
serviceType: SERVICE_TYPES[0],
|
|
4338
|
-
feedbackMethod: FEEDBACK_METHOD[0],
|
|
4339
|
-
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
4340
|
-
vedTypes: VED_TYPES[0],
|
|
4341
|
-
birthday: undefined,
|
|
4342
|
-
isClient: false,
|
|
4343
|
-
onlineCheckout: false,
|
|
4344
|
-
posTerminal: false,
|
|
4345
|
-
consentToReceiveMaterials: false,
|
|
4346
|
-
consentDataProcessing: false,
|
|
4347
|
-
addressRetail: { key: '', text: '' },
|
|
4348
|
-
};
|
|
4349
|
-
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
4350
|
-
const formState = Object.fromEntries(inputs.map((_) => [
|
|
4351
|
-
_.name,
|
|
4352
|
-
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
|
|
4353
|
-
]));
|
|
4354
|
-
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
4355
|
-
};
|
|
4356
|
-
|
|
4357
|
-
const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
|
|
4358
|
-
|
|
4359
|
-
const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
4360
|
-
|
|
4361
|
-
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
4362
|
-
const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
|
|
4363
|
-
|
|
4364
|
-
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
4365
|
-
|
|
4366
|
-
const API = LeadServiceAPI();
|
|
4367
|
-
const ApplicationForm = JSX(
|
|
4368
|
-
// eslint-disable-next-line max-lines-per-function
|
|
4369
|
-
({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
4370
|
-
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
4371
|
-
const initialFormState = getInitialFormState$3(inputs, typeForm);
|
|
4372
|
-
const [responseType, setResponseType] = useState('');
|
|
4373
|
-
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
4374
|
-
const handleSubmit = useCallback(async (formData, ev) => {
|
|
4375
|
-
const inputsFiltered = getFilteredInputs(inputs, formData);
|
|
4376
|
-
const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
|
|
4377
|
-
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
4378
|
-
return console.warn('validation fail');
|
|
4379
|
-
}
|
|
4380
|
-
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
4381
|
-
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
4382
|
-
setResponseType(status);
|
|
4383
|
-
if (status) {
|
|
4384
|
-
responseTypeDialog.open({ typeForm, responseType: status });
|
|
4385
|
-
}
|
|
4386
|
-
if (status === 'OK' && data) {
|
|
4387
|
-
const aspects = useAspects();
|
|
4388
|
-
handleAspects({ aspectsAttributes: data, aspects, ev });
|
|
4389
|
-
}
|
|
4390
|
-
return status;
|
|
4391
|
-
}, [typeForm]);
|
|
4392
|
-
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
4393
|
-
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
4394
|
-
useEffect(() => {
|
|
4395
|
-
if (responseType === 'OK') {
|
|
4396
|
-
setResponseType('');
|
|
4397
|
-
reset();
|
|
4398
|
-
}
|
|
4399
|
-
}, [responseType]);
|
|
4400
|
-
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] }));
|
|
4401
|
-
});
|
|
4402
|
-
const getFilteredInputs = (inputs, data) => inputs.filter((input) => !input?.condition ||
|
|
4403
|
-
input?.condition.values.find((_) => {
|
|
4404
|
-
const dataValue = data?.[input?.condition?.name ?? ''];
|
|
4405
|
-
return _ === (dataValue?.key ?? dataValue);
|
|
4406
|
-
}));
|
|
4407
4444
|
|
|
4408
4445
|
const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
|
|
4409
4446
|
const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
|
|
@@ -4418,42 +4455,19 @@
|
|
|
4418
4455
|
const hasValidationErrors = useMemo(() => inputs
|
|
4419
4456
|
?.filter((_) => _.required)
|
|
4420
4457
|
?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
|
|
4421
|
-
return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm })) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
|
|
4458
|
+
return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm }, InputsConsentsMap)) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
|
|
4422
4459
|
});
|
|
4423
4460
|
const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-start", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "px-m py-2xs", type: "button", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
|
|
4424
4461
|
|
|
4425
4462
|
const renderInputs$2 = ({ field, typeForm = '', inputs }) => {
|
|
4426
4463
|
const { consentInputs, restInputs } = splitInputs(inputs || []);
|
|
4427
|
-
return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm })));
|
|
4464
|
+
return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })));
|
|
4428
4465
|
};
|
|
4429
4466
|
const splitInputs = (inputs) => ({
|
|
4430
4467
|
consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
4431
4468
|
restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
4432
4469
|
});
|
|
4433
4470
|
|
|
4434
|
-
const applicationFormData = [
|
|
4435
|
-
{
|
|
4436
|
-
columns: 2,
|
|
4437
|
-
inputs: [
|
|
4438
|
-
{ fieldType: 'common', name: 'surname', required: true, dadata: true },
|
|
4439
|
-
{ fieldType: 'common', name: 'name', required: true, dadata: true },
|
|
4440
|
-
{ fieldType: 'common', name: 'middleName', dadata: true },
|
|
4441
|
-
{ fieldType: 'common', name: 'limitedBirthday', required: true },
|
|
4442
|
-
{ fieldType: 'common', name: 'phone', required: true },
|
|
4443
|
-
{ fieldType: 'common', name: 'email', required: true, dadata: true },
|
|
4444
|
-
],
|
|
4445
|
-
},
|
|
4446
|
-
{
|
|
4447
|
-
inputs: [
|
|
4448
|
-
{ fieldType: 'common', name: 'processPersonalDataFlg', required: true },
|
|
4449
|
-
{ fieldType: 'common', name: 'consentProviderFlg', required: true },
|
|
4450
|
-
{ fieldType: 'common', name: 'consentOthersFlg', required: true },
|
|
4451
|
-
{ fieldType: 'common', name: 'consentInformFlg' },
|
|
4452
|
-
{ fieldType: 'common', name: 'consentPfrFlg' },
|
|
4453
|
-
],
|
|
4454
|
-
},
|
|
4455
|
-
];
|
|
4456
|
-
|
|
4457
4471
|
const renderSubmitButton = (button, isSending) => (jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' }));
|
|
4458
4472
|
|
|
4459
4473
|
const createDraftTask = async (body) => {
|
|
@@ -4842,7 +4856,7 @@
|
|
|
4842
4856
|
}, []);
|
|
4843
4857
|
|
|
4844
4858
|
const getFamilyStatusAndIncomeData = (formData) => {
|
|
4845
|
-
const { familyStatus,
|
|
4859
|
+
const { familyStatus, familyMembers, dependents, children, confirmationIncome, wages, mandatoryPayments, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
|
|
4846
4860
|
return {
|
|
4847
4861
|
maritalStatusCd: familyStatus,
|
|
4848
4862
|
totalDependents: familyMembers,
|
|
@@ -5277,12 +5291,10 @@
|
|
|
5277
5291
|
feedbackMethod: FEEDBACK_METHOD[0],
|
|
5278
5292
|
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
5279
5293
|
vedTypes: VED_TYPES[0],
|
|
5280
|
-
birthday: undefined,
|
|
5281
5294
|
limitedBirthday: undefined,
|
|
5282
5295
|
isClient: false,
|
|
5283
5296
|
onlineCheckout: false,
|
|
5284
5297
|
posTerminal: false,
|
|
5285
|
-
consentToReceiveMaterials: false,
|
|
5286
5298
|
consentDataProcessing: false,
|
|
5287
5299
|
processPersonalDataFlg: false,
|
|
5288
5300
|
consentProviderFlg: false,
|
|
@@ -6962,32 +6974,32 @@
|
|
|
6962
6974
|
return statusesMap[status] || jsx(ReworkStatusContent$1, {});
|
|
6963
6975
|
};
|
|
6964
6976
|
|
|
6965
|
-
const calculateInputs
|
|
6977
|
+
const calculateInputs = (getValue) => (inputs, step) => inputs
|
|
6966
6978
|
.filter((_) => _)
|
|
6967
6979
|
.map((_) => {
|
|
6968
6980
|
if ([
|
|
6969
|
-
checkIsRetiree
|
|
6970
|
-
checkBusinessOwner
|
|
6971
|
-
checkConsentPfrFlg
|
|
6972
|
-
checkAddressFillFromESIA
|
|
6973
|
-
checkAddressFact
|
|
6974
|
-
checkCondition
|
|
6981
|
+
checkIsRetiree(step, getValue),
|
|
6982
|
+
checkBusinessOwner(_, getValue),
|
|
6983
|
+
checkConsentPfrFlg(_, getValue),
|
|
6984
|
+
checkAddressFillFromESIA(_, getValue),
|
|
6985
|
+
checkAddressFact(_, getValue),
|
|
6986
|
+
checkCondition(_, getValue),
|
|
6975
6987
|
].some(Boolean)) {
|
|
6976
6988
|
return { ..._, required: false };
|
|
6977
6989
|
}
|
|
6978
6990
|
return _;
|
|
6979
6991
|
});
|
|
6980
|
-
const checkIsRetiree
|
|
6981
|
-
const checkBusinessOwner
|
|
6982
|
-
const checkAddressFillFromESIA
|
|
6983
|
-
const checkAddressFact
|
|
6984
|
-
const checkCondition
|
|
6992
|
+
const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
|
|
6993
|
+
const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
|
|
6994
|
+
const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
|
|
6995
|
+
const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
|
|
6996
|
+
const checkCondition = ({ condition }, getValue) => condition?.name &&
|
|
6985
6997
|
condition?.values?.some((_) => {
|
|
6986
6998
|
const dataValue = getValue(condition?.name);
|
|
6987
6999
|
return _ !== (dataValue?.key ?? dataValue);
|
|
6988
7000
|
});
|
|
6989
|
-
const checkConsentPfrFlg
|
|
6990
|
-
const isSnilsRequired
|
|
7001
|
+
const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
|
|
7002
|
+
const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
|
|
6991
7003
|
|
|
6992
7004
|
const renderInfo$2 = (inputs = []) => {
|
|
6993
7005
|
const infoInputs = inputs.filter((_) => _.fieldType === 'info');
|
|
@@ -6996,11 +7008,11 @@
|
|
|
6996
7008
|
: null;
|
|
6997
7009
|
};
|
|
6998
7010
|
|
|
6999
|
-
const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params));
|
|
7011
|
+
const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap, ...InputRetailCardMap }));
|
|
7000
7012
|
|
|
7001
7013
|
const renderStep$2 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
|
|
7002
|
-
const inputs = calculateInputs
|
|
7003
|
-
const filteredInputs = inputs.filter((_) => !checkCondition
|
|
7014
|
+
const inputs = calculateInputs(getValue$3(field))(origInputs, step);
|
|
7015
|
+
const filteredInputs = inputs.filter((_) => !checkCondition(_, getValue$3(field)));
|
|
7004
7016
|
return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs, params })] }, `section-${i}`));
|
|
7005
7017
|
});
|
|
7006
7018
|
const getValue$3 = (field) => (name) => field(name)?.value;
|
|
@@ -7228,8 +7240,8 @@
|
|
|
7228
7240
|
},
|
|
7229
7241
|
{
|
|
7230
7242
|
familyStatus: { key: '', text: '' },
|
|
7231
|
-
dependents: undefined,
|
|
7232
7243
|
familyMembers: undefined,
|
|
7244
|
+
dependents: undefined,
|
|
7233
7245
|
confirmationIncome: { key: '', text: '' },
|
|
7234
7246
|
wages: undefined,
|
|
7235
7247
|
mandatoryPayments: undefined,
|
|
@@ -7293,7 +7305,7 @@
|
|
|
7293
7305
|
}
|
|
7294
7306
|
}, [isFinalStep, initialState]);
|
|
7295
7307
|
const handleSubmit = useCallback(async (formData) => {
|
|
7296
|
-
const feedbackValidator = objectValidator(getObjectValidator(calculateInputs
|
|
7308
|
+
const feedbackValidator = objectValidator(getObjectValidator(calculateInputs(getValue$2(formData))(inputs, step)));
|
|
7297
7309
|
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
7298
7310
|
return;
|
|
7299
7311
|
}
|
|
@@ -7892,33 +7904,6 @@
|
|
|
7892
7904
|
return statusesMap[status] || jsx(ReworkStatusContent, {});
|
|
7893
7905
|
};
|
|
7894
7906
|
|
|
7895
|
-
const calculateInputs = (getValue) => (inputs, step) => inputs
|
|
7896
|
-
.filter((_) => _)
|
|
7897
|
-
.map((_) => {
|
|
7898
|
-
if ([
|
|
7899
|
-
checkIsRetiree(step, getValue),
|
|
7900
|
-
checkBusinessOwner(_, getValue),
|
|
7901
|
-
checkConsentPfrFlg(_, getValue),
|
|
7902
|
-
checkAddressFillFromESIA(_, getValue),
|
|
7903
|
-
checkAddressFact(_, getValue),
|
|
7904
|
-
checkCondition(_, getValue),
|
|
7905
|
-
].some(Boolean)) {
|
|
7906
|
-
return { ..._, required: false };
|
|
7907
|
-
}
|
|
7908
|
-
return _;
|
|
7909
|
-
});
|
|
7910
|
-
const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
|
|
7911
|
-
const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
|
|
7912
|
-
const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
|
|
7913
|
-
const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
|
|
7914
|
-
const checkCondition = ({ condition }, getValue) => condition?.name &&
|
|
7915
|
-
condition?.values?.some((_) => {
|
|
7916
|
-
const dataValue = getValue(condition?.name);
|
|
7917
|
-
return _ !== (dataValue?.key ?? dataValue);
|
|
7918
|
-
});
|
|
7919
|
-
const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
|
|
7920
|
-
const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
|
|
7921
|
-
|
|
7922
7907
|
const renderInfo$1 = (inputs = []) => {
|
|
7923
7908
|
const infoInputs = inputs.filter((_) => _.fieldType === 'info');
|
|
7924
7909
|
return infoInputs.length
|
|
@@ -7926,7 +7911,7 @@
|
|
|
7926
7911
|
: null;
|
|
7927
7912
|
};
|
|
7928
7913
|
|
|
7929
|
-
const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params));
|
|
7914
|
+
const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap }));
|
|
7930
7915
|
|
|
7931
7916
|
const renderStep$1 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
|
|
7932
7917
|
const inputs = calculateInputs(getValue$1(field))(origInputs, step);
|
|
@@ -10493,7 +10478,7 @@
|
|
|
10493
10478
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
10494
10479
|
});
|
|
10495
10480
|
|
|
10496
|
-
const packageVersion = "0.14.
|
|
10481
|
+
const packageVersion = "0.14.726";
|
|
10497
10482
|
|
|
10498
10483
|
exports.Blocks = Blocks;
|
|
10499
10484
|
exports.ContentPage = ContentPage;
|