@turnit-ou/shared 0.0.0-stage → 2.18.0
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/@types/@mui/index.d.ts +125 -0
- package/@types/axios/index.d.ts +7 -0
- package/@types/openapi-client-axios/index.d.ts +5 -0
- package/@types/openapi-typescript/index.d.ts +71 -0
- package/@types/react-final-form-arrays/index.d.ts +75 -0
- package/@types/react-table/index.d.ts +292 -0
- package/components/Alert/AlertTemplate.d.ts +3 -0
- package/components/Alert/AlertTemplate.js +66 -0
- package/components/Alert/index.d.ts +4 -0
- package/components/Alert/index.js +17 -0
- package/components/ConfirmButton.d.ts +15 -0
- package/components/ConfirmButton.js +47 -0
- package/components/Drawer.d.ts +4 -0
- package/components/Drawer.js +24 -0
- package/components/DrawerForm/DrawerFormCardActions.d.ts +5 -0
- package/components/DrawerForm/DrawerFormCardActions.js +21 -0
- package/components/DrawerForm/DrawerFormCloseButton.d.ts +3 -0
- package/components/DrawerForm/DrawerFormCloseButton.js +5 -0
- package/components/DrawerForm/DrawerFormContext.d.ts +7 -0
- package/components/DrawerForm/DrawerFormContext.js +4 -0
- package/components/DrawerForm.d.ts +10 -0
- package/components/DrawerForm.js +84 -0
- package/components/Editor/Editor.d.ts +9 -0
- package/components/Editor/Editor.js +36 -0
- package/components/Editor/Toolbar.d.ts +7 -0
- package/components/Editor/Toolbar.js +31 -0
- package/components/Editor/buttons/FormatLinkButton.d.ts +5 -0
- package/components/Editor/buttons/FormatLinkButton.js +64 -0
- package/components/Editor/buttons/InsertImageButton.d.ts +5 -0
- package/components/Editor/buttons/InsertImageButton.js +59 -0
- package/components/Editor/buttons.d.ts +15 -0
- package/components/Editor/buttons.js +70 -0
- package/components/Editor/createButton.d.ts +28 -0
- package/components/Editor/createButton.js +68 -0
- package/components/Editor/editor.scss +45 -0
- package/components/Ellipsis.d.ts +9 -0
- package/components/Ellipsis.js +22 -0
- package/components/EllipsisText.d.ts +8 -0
- package/components/EllipsisText.js +25 -0
- package/components/EnvironmentBanner.d.ts +8 -0
- package/components/EnvironmentBanner.js +25 -0
- package/components/Header/AccessibilityModal.d.ts +5 -0
- package/components/Header/AccessibilityModal.js +28 -0
- package/components/Header/AllowedBusinessEntityModal.d.ts +9 -0
- package/components/Header/AllowedBusinessEntityModal.js +24 -0
- package/components/Header/LanguageSelect.d.ts +2 -0
- package/components/Header/LanguageSelect.js +80 -0
- package/components/Header/MenuItems.d.ts +9 -0
- package/components/Header/MenuItems.js +55 -0
- package/components/Header/ModuleIcon.d.ts +7 -0
- package/components/Header/ModuleIcon.js +119 -0
- package/components/Header/index.d.ts +44 -0
- package/components/Header/index.js +89 -0
- package/components/Layout/LayoutCol.d.ts +8 -0
- package/components/Layout/LayoutCol.js +26 -0
- package/components/Layout/index.d.ts +32 -0
- package/components/Layout/index.js +56 -0
- package/components/Loadable.d.ts +11 -0
- package/components/Loadable.js +3 -0
- package/components/SearchCard.d.ts +8 -0
- package/components/SearchCard.js +81 -0
- package/components/SearchForm.d.ts +14 -0
- package/components/SearchForm.js +51 -0
- package/components/SearchFormTable.d.ts +8 -0
- package/components/SearchFormTable.js +32 -0
- package/components/SearchResult.d.ts +13 -0
- package/components/SearchResult.js +67 -0
- package/components/Table/TableCaption.d.ts +6 -0
- package/components/Table/TableCaption.js +25 -0
- package/components/Table/TableCell.d.ts +17 -0
- package/components/Table/TableCell.js +45 -0
- package/components/Table/TableCellEditable.d.ts +28 -0
- package/components/Table/TableCellEditable.js +151 -0
- package/components/Table/TableCellEditableAction.d.ts +13 -0
- package/components/Table/TableCellEditableAction.js +70 -0
- package/components/Table/TableCellEditableField.d.ts +17 -0
- package/components/Table/TableCellEditableField.js +1 -0
- package/components/Table/TableCellEditableTimeDuration.d.ts +13 -0
- package/components/Table/TableCellEditableTimeDuration.js +12 -0
- package/components/Table/TableContext.d.ts +11 -0
- package/components/Table/TableContext.js +4 -0
- package/components/Table/TablePagination.d.ts +5 -0
- package/components/Table/TablePagination.js +84 -0
- package/components/Table.d.ts +53 -0
- package/components/Table.js +389 -0
- package/components/Version.d.ts +5 -0
- package/components/Version.js +23 -0
- package/dto/businessEntity.d.ts +15 -0
- package/dto/businessEntity.js +1 -0
- package/dto/classification.d.ts +9 -0
- package/dto/classification.js +1 -0
- package/dto/classifier.d.ts +13 -0
- package/dto/classifier.js +4 -0
- package/dto/common.d.ts +5 -0
- package/dto/common.js +1 -0
- package/dto/fare.d.ts +11 -0
- package/dto/fare.js +1 -0
- package/dto/line-network.d.ts +23 -0
- package/dto/line-network.js +1 -0
- package/dto/option.d.ts +7 -0
- package/dto/option.js +1 -0
- package/dto/pagination.d.ts +10 -0
- package/dto/pagination.js +1 -0
- package/fields/FormCheckbox.d.ts +11 -0
- package/fields/FormCheckbox.js +5 -0
- package/fields/FormCheckboxGroup.d.ts +6 -0
- package/fields/FormCheckboxGroup.js +20 -0
- package/fields/FormController.d.ts +7 -0
- package/fields/FormController.js +16 -0
- package/fields/FormDatepicker.d.ts +8 -0
- package/fields/FormDatepicker.js +7 -0
- package/fields/FormInput.d.ts +8 -0
- package/fields/FormInput.js +4 -0
- package/fields/FormRadioGroup.d.ts +10 -0
- package/fields/FormRadioGroup.js +6 -0
- package/fields/FormSelect.d.ts +11 -0
- package/fields/FormSelect.js +9 -0
- package/fields/FormSwitch.d.ts +11 -0
- package/fields/FormSwitch.js +5 -0
- package/fields/FormTimeZoneSelect.d.ts +4 -0
- package/fields/FormTimeZoneSelect.js +8 -0
- package/fields/index.d.ts +9 -0
- package/fields/index.js +9 -0
- package/form/ArrayField.d.ts +27 -0
- package/form/ArrayField.js +69 -0
- package/form/CheckboxField.d.ts +8 -0
- package/form/CheckboxField.js +14 -0
- package/form/CheckboxGroupField.d.ts +6 -0
- package/form/CheckboxGroupField.js +15 -0
- package/form/ConditionField.d.ts +7 -0
- package/form/ConditionField.js +20 -0
- package/form/ContentField.d.ts +7 -0
- package/form/ContentField.js +15 -0
- package/form/CounterField.d.ts +5 -0
- package/form/CounterField.js +7 -0
- package/form/DateField.d.ts +8 -0
- package/form/DateField.js +52 -0
- package/form/DatesArrayField.d.ts +8 -0
- package/form/DatesArrayField.js +79 -0
- package/form/DependSelectField.d.ts +8 -0
- package/form/DependSelectField.js +12 -0
- package/form/EditorField.d.ts +5 -0
- package/form/EditorField.js +7 -0
- package/form/FileField.d.ts +12 -0
- package/form/FileField.js +9 -0
- package/form/FormField.d.ts +15 -0
- package/form/FormField.js +22 -0
- package/form/ModalFieldArray.d.ts +13 -0
- package/form/ModalFieldArray.js +62 -0
- package/form/PeriodField.d.ts +24 -0
- package/form/PeriodField.js +111 -0
- package/form/RadioGroupField.d.ts +10 -0
- package/form/RadioGroupField.js +21 -0
- package/form/SearchField.d.ts +19 -0
- package/form/SearchField.js +51 -0
- package/form/SelectField.d.ts +8 -0
- package/form/SelectField.js +13 -0
- package/form/SelectOwnerField.d.ts +11 -0
- package/form/SelectOwnerField.js +11 -0
- package/form/StopsSelect/StopSelectWithSearch.d.ts +28 -0
- package/form/StopsSelect/StopSelectWithSearch.js +181 -0
- package/form/StopsSelect/StopsSelect.d.ts +19 -0
- package/form/StopsSelect/StopsSelect.js +65 -0
- package/form/StopsSelect/StopsSelectModal.d.ts +26 -0
- package/form/StopsSelect/StopsSelectModal.js +280 -0
- package/form/StopsSelect/StopsSelectSearchForm.d.ts +22 -0
- package/form/StopsSelect/StopsSelectSearchForm.js +43 -0
- package/form/SwitchField.d.ts +9 -0
- package/form/SwitchField.js +16 -0
- package/form/TextField.d.ts +6 -0
- package/form/TextField.js +21 -0
- package/form/TimeDurationField.d.ts +6 -0
- package/form/TimeDurationField.js +54 -0
- package/form/TimeZoneField.d.ts +6 -0
- package/form/TimeZoneField.js +8 -0
- package/form/ToggleButtonGroupField.d.ts +12 -0
- package/form/ToggleButtonGroupField.js +16 -0
- package/form/hooks/addLazyFieldMetaState.d.ts +3 -0
- package/form/hooks/addLazyFieldMetaState.js +55 -0
- package/form/hooks/getValue.d.ts +3 -0
- package/form/hooks/getValue.js +60 -0
- package/form/hooks/useConstant.d.ts +13 -0
- package/form/hooks/useConstant.js +20 -0
- package/form/hooks/useConstantCallback.d.ts +7 -0
- package/form/hooks/useConstantCallback.js +14 -0
- package/form/hooks/useField.d.ts +3 -0
- package/form/hooks/useField.js +175 -0
- package/form/hooks/useFieldArray.d.ts +6 -0
- package/form/hooks/useFieldArray.js +87 -0
- package/form/hooks/useLatest.d.ts +3 -0
- package/form/hooks/useLatest.js +8 -0
- package/form/hooks/useModalTableSelectedRows.d.ts +12 -0
- package/form/hooks/useModalTableSelectedRows.js +66 -0
- package/form/hooks/useWatch.d.ts +12 -0
- package/form/hooks/useWatch.js +16 -0
- package/form/index.d.ts +45 -0
- package/form/index.js +58 -0
- package/form/mutators/change.d.ts +2 -0
- package/form/mutators/change.js +9 -0
- package/form/validate.d.ts +14 -0
- package/form/validate.js +39 -0
- package/helpers/capitalize.d.ts +1 -0
- package/helpers/capitalize.js +1 -0
- package/helpers/filter.d.ts +4 -0
- package/helpers/filter.js +21 -0
- package/helpers/formSubmit.d.ts +5 -0
- package/helpers/formSubmit.js +21 -0
- package/helpers/index.d.ts +7 -0
- package/helpers/index.js +7 -0
- package/helpers/makeClassificationOptions.d.ts +30 -0
- package/helpers/makeClassificationOptions.js +29 -0
- package/helpers/map.d.ts +1 -0
- package/helpers/map.js +1 -0
- package/helpers/openapi.d.ts +10 -0
- package/helpers/openapi.js +10 -0
- package/helpers/renderRangeError.d.ts +1 -0
- package/helpers/renderRangeError.js +20 -0
- package/helpers/sentry/assertEnvVariable.d.ts +1 -0
- package/helpers/sentry/assertEnvVariable.js +7 -0
- package/helpers/sentry/sentryConfig.d.ts +2 -0
- package/helpers/sentry/sentryConfig.js +18 -0
- package/helpers/serializeErrors.d.ts +2 -0
- package/helpers/serializeErrors.js +13 -0
- package/hooks/index.d.ts +26 -0
- package/hooks/index.js +26 -0
- package/hooks/useAllowedBusinessEntities.d.ts +4 -0
- package/hooks/useAllowedBusinessEntities.js +9 -0
- package/hooks/useBusinessEntitiesByType.d.ts +8 -0
- package/hooks/useBusinessEntitiesByType.js +17 -0
- package/hooks/useChangePassword.d.ts +14 -0
- package/hooks/useChangePassword.js +48 -0
- package/hooks/useClassification.d.ts +9 -0
- package/hooks/useClassification.js +16 -0
- package/hooks/useDraggable.d.ts +5 -0
- package/hooks/useDraggable.js +11 -0
- package/hooks/useEllipsis.d.ts +10 -0
- package/hooks/useEllipsis.js +79 -0
- package/hooks/useFavicon.d.ts +1 -0
- package/hooks/useFavicon.js +13 -0
- package/hooks/useFormTable.d.ts +24 -0
- package/hooks/useFormTable.js +105 -0
- package/hooks/useFormTableControls.d.ts +31 -0
- package/hooks/useFormTableControls.js +34 -0
- package/hooks/useInertBackground.d.ts +20 -0
- package/hooks/useInertBackground.js +57 -0
- package/hooks/useIsMounted.d.ts +2 -0
- package/hooks/useIsMounted.js +11 -0
- package/hooks/useLanguage.d.ts +1 -0
- package/hooks/useLanguage.js +2 -0
- package/hooks/useLoaded.d.ts +1 -0
- package/hooks/useLoaded.js +19 -0
- package/hooks/useLocale.d.ts +1 -0
- package/hooks/useLocale.js +7 -0
- package/hooks/useModal.d.ts +307 -0
- package/hooks/useModal.js +12 -0
- package/hooks/useOptions.d.ts +13 -0
- package/hooks/useOptions.js +24 -0
- package/hooks/usePrevious.d.ts +1 -0
- package/hooks/usePrevious.js +12 -0
- package/hooks/usePrompt.d.ts +8 -0
- package/hooks/usePrompt.js +17 -0
- package/hooks/useRowActive.d.ts +6 -0
- package/hooks/useRowActive.js +104 -0
- package/hooks/useRowEditActions.d.ts +5 -0
- package/hooks/useRowEditActions.js +12 -0
- package/hooks/useRowExpandToggle.d.ts +5 -0
- package/hooks/useRowExpandToggle.js +13 -0
- package/hooks/useRowHidden.d.ts +4 -0
- package/hooks/useRowHidden.js +6 -0
- package/hooks/useRowSelectCheckbox.d.ts +27 -0
- package/hooks/useRowSelectCheckbox.js +48 -0
- package/hooks/useTable.d.ts +4 -0
- package/hooks/useTable.js +38 -0
- package/hooks/useTableRowHighlight.d.ts +4 -0
- package/hooks/useTableRowHighlight.js +16 -0
- package/hooks/useTranslation.d.ts +3 -0
- package/hooks/useTranslation.js +3 -0
- package/hooks/useWeekdayOptions.d.ts +40 -0
- package/hooks/useWeekdayOptions.js +66 -0
- package/i18n/index.d.ts +13 -0
- package/i18n/index.js +82 -0
- package/i18n/resources/de.json +115 -0
- package/i18n/resources/el.json +116 -0
- package/i18n/resources/en-AE.json +115 -0
- package/i18n/resources/en.json +118 -0
- package/i18n/resources/es.json +115 -0
- package/i18n/resources/fr.json +115 -0
- package/i18n/resources/index.d.ts +1295 -0
- package/i18n/resources/index.js +24 -0
- package/i18n/resources/it.json +115 -0
- package/i18n/resources/lt.json +115 -0
- package/i18n/resources/pt.json +115 -0
- package/i18n/resources/sk.json +115 -0
- package/i18n/resources/sv.json +116 -0
- package/i18n/trans/alert.d.ts +8 -0
- package/i18n/trans/alert.js +10 -0
- package/i18n/trans/button.d.ts +24 -0
- package/i18n/trans/button.js +26 -0
- package/i18n/trans/error.d.ts +10 -0
- package/i18n/trans/error.js +12 -0
- package/i18n/trans/field.d.ts +19 -0
- package/i18n/trans/field.js +21 -0
- package/i18n/trans/index.d.ts +13 -0
- package/i18n/trans/index.js +20 -0
- package/i18n/trans/label.d.ts +18 -0
- package/i18n/trans/label.js +20 -0
- package/i18n/trans/option.d.ts +6 -0
- package/i18n/trans/option.js +8 -0
- package/i18n/trans/qty.d.ts +5 -0
- package/i18n/trans/qty.js +7 -0
- package/i18n/trans/table.d.ts +8 -0
- package/i18n/trans/table.js +10 -0
- package/i18n/trans/title.d.ts +6 -0
- package/i18n/trans/title.js +8 -0
- package/i18n/trans/tooltip.d.ts +8 -0
- package/i18n/trans/tooltip.js +10 -0
- package/icons/1-class.svg +4 -0
- package/icons/2-class-calm.svg +5 -0
- package/icons/2-class-crossed.svg +5 -0
- package/icons/2-class.svg +4 -0
- package/icons/3-class.svg +4 -0
- package/icons/4-class.svg +4 -0
- package/icons/ac-crossed.svg +6 -0
- package/icons/ac.svg +9 -0
- package/icons/accessibility.svg +5 -0
- package/icons/add-journey-segment.svg +9 -0
- package/icons/add-person.svg +6 -0
- package/icons/add.svg +4 -0
- package/icons/air-condition.svg +11 -0
- package/icons/airport.svg +4 -0
- package/icons/alert-circle.svg +5 -0
- package/icons/arrow-down.svg +4 -0
- package/icons/arrow-left-circle.svg +5 -0
- package/icons/arrow-left.svg +4 -0
- package/icons/arrow-right.svg +4 -0
- package/icons/arrow-up.svg +4 -0
- package/icons/baby-care.svg +7 -0
- package/icons/bar.svg +6 -0
- package/icons/bed.svg +3 -0
- package/icons/bicycle-crossed.svg +6 -0
- package/icons/bicycle.svg +8 -0
- package/icons/bin.svg +6 -0
- package/icons/break.svg +5 -0
- package/icons/breakfast-1-class.svg +5 -0
- package/icons/breakfast-2-class.svg +5 -0
- package/icons/breakfast.svg +3 -0
- package/icons/bus.svg +7 -0
- package/icons/business-area.svg +6 -0
- package/icons/by-aisle.svg +8 -0
- package/icons/by-window.svg +6 -0
- package/icons/cafe-1-class.svg +5 -0
- package/icons/calendar.svg +6 -0
- package/icons/cancel.svg +5 -0
- package/icons/cargo.svg +4 -0
- package/icons/carriage-bot.svg +6 -0
- package/icons/carriage-mid.svg +4 -0
- package/icons/carriage-top.svg +12 -0
- package/icons/carriage.svg +3 -0
- package/icons/cart.svg +3 -0
- package/icons/cd.svg +4 -0
- package/icons/check-circle.svg +4 -0
- package/icons/check.svg +3 -0
- package/icons/checkbox-checked.svg +4 -0
- package/icons/checkbox-indeterminate.svg +5 -0
- package/icons/checkbox-mark.svg +3 -0
- package/icons/checkbox.svg +3 -0
- package/icons/chevron-down.svg +3 -0
- package/icons/chevron-left.svg +3 -0
- package/icons/chevron-right.svg +3 -0
- package/icons/chevron-up.svg +3 -0
- package/icons/circle.svg +3 -0
- package/icons/clock.svg +5 -0
- package/icons/clone.svg +4 -0
- package/icons/close-bold.svg +4 -0
- package/icons/close.svg +4 -0
- package/icons/coffee-machine-crossed.svg +6 -0
- package/icons/coffee-machine.svg +7 -0
- package/icons/coin.svg +4 -0
- package/icons/comment.svg +3 -0
- package/icons/compartment.svg +6 -0
- package/icons/couchette.svg +6 -0
- package/icons/cube.svg +1 -0
- package/icons/currency.svg +4 -0
- package/icons/deactivate.svg +4 -0
- package/icons/delete.svg +4 -0
- package/icons/dining.svg +7 -0
- package/icons/direction-bottom.svg +4 -0
- package/icons/direction-forward-v.svg +4 -0
- package/icons/direction-forward.svg +4 -0
- package/icons/direction-left.svg +4 -0
- package/icons/direction-reverse-v.svg +4 -0
- package/icons/direction-reverse.svg +4 -0
- package/icons/direction-right.svg +4 -0
- package/icons/direction-top.svg +4 -0
- package/icons/dots.svg +5 -0
- package/icons/download.svg +5 -0
- package/icons/drag-n-drop.svg +3 -0
- package/icons/draggable.svg +5 -0
- package/icons/duplicate.svg +4 -0
- package/icons/dvd.svg +5 -0
- package/icons/edit.svg +3 -0
- package/icons/empty-search.svg +9 -0
- package/icons/empty-state.svg +13 -0
- package/icons/empty.svg +9 -0
- package/icons/empty_search_purple.svg +6 -0
- package/icons/error-circle.svg +4 -0
- package/icons/eu-law.svg +5 -0
- package/icons/external_link.svg +5 -0
- package/icons/family-area.svg +7 -0
- package/icons/file-settings.svg +3 -0
- package/icons/file.svg +11 -0
- package/icons/filter.svg +3 -0
- package/icons/flip.svg +11 -0
- package/icons/food-1-class.svg +5 -0
- package/icons/food-plus.svg +5 -0
- package/icons/food.svg +7 -0
- package/icons/grid-cell.svg +1 -0
- package/icons/grid.svg +6 -0
- package/icons/headphones.svg +5 -0
- package/icons/helping-hand-crossed.svg +12 -0
- package/icons/helping-hand.svg +3 -0
- package/icons/hide.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/index.json +228 -0
- package/icons/info-circle.svg +5 -0
- package/icons/insurance.svg +6 -0
- package/icons/journey-changeover.svg +5 -0
- package/icons/journey-light.svg +5 -0
- package/icons/journey.svg +5 -0
- package/icons/key.svg +4 -0
- package/icons/language.svg +3 -0
- package/icons/link.svg +4 -0
- package/icons/list.svg +8 -0
- package/icons/locker.svg +8 -0
- package/icons/logout.svg +5 -0
- package/icons/luggage.svg +9 -0
- package/icons/mail.svg +4 -0
- package/icons/meeting-lounge.svg +10 -0
- package/icons/metro.svg +3 -0
- package/icons/middle-seat.svg +7 -0
- package/icons/minus.svg +3 -0
- package/icons/minus24.svg +3 -0
- package/icons/mobile-crossed.svg +7 -0
- package/icons/mobile.svg +6 -0
- package/icons/movingo.svg +3 -0
- package/icons/multimedia.svg +9 -0
- package/icons/near-bicycle.svg +5 -0
- package/icons/near-pet.svg +5 -0
- package/icons/near-wheelchair.svg +8 -0
- package/icons/night-train.svg +4 -0
- package/icons/nonstop.svg +3 -0
- package/icons/occupancy-seat-hover.svg +11 -0
- package/icons/occupancy-seat-selected.svg +11 -0
- package/icons/occupancy-seat.svg +4 -0
- package/icons/oneway.svg +4 -0
- package/icons/pet-crossed.svg +5 -0
- package/icons/pet.svg +7 -0
- package/icons/pic.svg +5 -0
- package/icons/playground.svg +7 -0
- package/icons/plus.svg +4 -0
- package/icons/plus24.svg +4 -0
- package/icons/popup-controls.svg +15 -0
- package/icons/power-socket.svg +6 -0
- package/icons/preview.svg +3 -0
- package/icons/print.svg +5 -0
- package/icons/priority-seat-elderly.svg +6 -0
- package/icons/priority-seat-pregnant.svg +5 -0
- package/icons/profile.svg +4 -0
- package/icons/question.svg +5 -0
- package/icons/radio-filled.svg +4 -0
- package/icons/radio.svg +3 -0
- package/icons/reclining-seat.svg +9 -0
- package/icons/refresh.svg +6 -0
- package/icons/reload.svg +4 -0
- package/icons/remove-circle.svg +3 -0
- package/icons/replace.svg +6 -0
- package/icons/reservation-crossed.svg +4 -0
- package/icons/reservation-mandatory.svg +4 -0
- package/icons/reservation-optional.svg +5 -0
- package/icons/resplus-horizontal.svg +1 -0
- package/icons/resplus.svg +3 -0
- package/icons/restaurant.svg +3 -0
- package/icons/roundtrip.svg +6 -0
- package/icons/save.svg +5 -0
- package/icons/search.svg +4 -0
- package/icons/seat-compartment.svg +8 -0
- package/icons/seat-selected.svg +3 -0
- package/icons/seat.svg +5 -0
- package/icons/sent.svg +34 -0
- package/icons/service-dog.svg +4 -0
- package/icons/settings.svg +4 -0
- package/icons/shift.svg +3 -0
- package/icons/ship.svg +3 -0
- package/icons/show.svg +4 -0
- package/icons/shower.svg +9 -0
- package/icons/silence.svg +6 -0
- package/icons/sink.svg +5 -0
- package/icons/skis.svg +8 -0
- package/icons/sleeper-car-bedding.svg +6 -0
- package/icons/sleeper-car.svg +5 -0
- package/icons/smoking-crossed.svg +6 -0
- package/icons/sort.svg +6 -0
- package/icons/stairs-down.svg +5 -0
- package/icons/stairs-up.svg +5 -0
- package/icons/star-filled.svg +3 -0
- package/icons/star.svg +3 -0
- package/icons/stroller.svg +6 -0
- package/icons/sw-law.svg +5 -0
- package/icons/switch.svg +3 -0
- package/icons/table.svg +6 -0
- package/icons/tag.svg +4 -0
- package/icons/taxi.svg +3 -0
- package/icons/tick.svg +3 -0
- package/icons/ticket-cancel.svg +8 -0
- package/icons/ticket-change.svg +3 -0
- package/icons/ticket-manage.svg +7 -0
- package/icons/ticket-refund.svg +8 -0
- package/icons/ticket-travel-pass.svg +4 -0
- package/icons/ticket.svg +6 -0
- package/icons/tickets.svg +4 -0
- package/icons/train.svg +3 -0
- package/icons/transfer.svg +3 -0
- package/icons/trash.svg +6 -0
- package/icons/triange.svg +17 -0
- package/icons/tv.svg +5 -0
- package/icons/unaccompanied-minor.svg +8 -0
- package/icons/upload.svg +5 -0
- package/icons/usb.svg +9 -0
- package/icons/visibility-off.svg +4 -0
- package/icons/visibility-on.svg +4 -0
- package/icons/voucher.svg +5 -0
- package/icons/wardrobe.svg +4 -0
- package/icons/warning.svg +3 -0
- package/icons/water.svg +5 -0
- package/icons/wc.svg +4 -0
- package/icons/wheelchair-lift-reservation.svg +8 -0
- package/icons/wheelchair-lift.svg +6 -0
- package/icons/wheelchair-ramp.svg +8 -0
- package/icons/wheelchair-space-reservation.svg +13 -0
- package/icons/wheelchair-space.svg +4 -0
- package/icons/wheelchair.svg +5 -0
- package/icons/wifi-crossed.svg +9 -0
- package/icons/wifi.svg +6 -0
- package/index.css +327 -0
- package/index.d.ts +31 -0
- package/index.js +32 -0
- package/mui/Accordion.d.ts +17 -0
- package/mui/Accordion.js +46 -0
- package/mui/Button/index.d.ts +16 -0
- package/mui/Button/index.js +35 -0
- package/mui/Card/CardHeader.d.ts +7 -0
- package/mui/Card/CardHeader.js +43 -0
- package/mui/Card/index.d.ts +4 -0
- package/mui/Card/index.js +4 -0
- package/mui/Checkbox/CheckboxGroup.d.ts +26 -0
- package/mui/Checkbox/CheckboxGroup.js +81 -0
- package/mui/Checkbox/index.d.ts +18 -0
- package/mui/Checkbox/index.js +40 -0
- package/mui/Chip/ChipSecondarySmall.d.ts +10 -0
- package/mui/Chip/ChipSecondarySmall.js +40 -0
- package/mui/CircularProgress/index.d.ts +3 -0
- package/mui/CircularProgress/index.js +36 -0
- package/mui/Collapsible/index.d.ts +9 -0
- package/mui/Collapsible/index.js +66 -0
- package/mui/Counter/index.d.ts +9 -0
- package/mui/Counter/index.js +37 -0
- package/mui/DatePicker/DatePicker.scss +276 -0
- package/mui/DatePicker/DatePickerContext.d.ts +8 -0
- package/mui/DatePicker/DatePickerContext.js +2 -0
- package/mui/DatePicker/DatePickerHeader.d.ts +3 -0
- package/mui/DatePicker/DatePickerHeader.js +63 -0
- package/mui/DatePicker/DatePickerHeaderSelect.d.ts +10 -0
- package/mui/DatePicker/DatePickerHeaderSelect.js +72 -0
- package/mui/DatePicker/DatePickerInput.d.ts +6 -0
- package/mui/DatePicker/DatePickerInput.js +28 -0
- package/mui/DatePicker/TimeInput.d.ts +10 -0
- package/mui/DatePicker/TimeInput.js +63 -0
- package/mui/DatePicker/index.d.ts +52 -0
- package/mui/DatePicker/index.js +187 -0
- package/mui/Dropdown/index.d.ts +22 -0
- package/mui/Dropdown/index.js +90 -0
- package/mui/EditableLabel/index.d.ts +7 -0
- package/mui/EditableLabel/index.js +81 -0
- package/mui/ExternalLink/index.d.ts +8 -0
- package/mui/ExternalLink/index.js +11 -0
- package/mui/FileInput/index.d.ts +27 -0
- package/mui/FileInput/index.js +66 -0
- package/mui/FormControl/index.d.ts +23 -0
- package/mui/FormControl/index.js +36 -0
- package/mui/FormField/index.d.ts +8 -0
- package/mui/FormField/index.js +12 -0
- package/mui/Icon/index.d.ts +21 -0
- package/mui/Icon/index.js +47 -0
- package/mui/Input/index.d.ts +28 -0
- package/mui/Input/index.js +102 -0
- package/mui/Loader/index.d.ts +9 -0
- package/mui/Loader/index.js +47 -0
- package/mui/Modal/index.d.ts +16 -0
- package/mui/Modal/index.js +64 -0
- package/mui/Pagination/index.d.ts +6 -0
- package/mui/Pagination/index.js +23 -0
- package/mui/Paper/index.d.ts +4 -0
- package/mui/Paper/index.js +3 -0
- package/mui/Popper/index.d.ts +13 -0
- package/mui/Popper/index.js +139 -0
- package/mui/RadioGroup/index.d.ts +26 -0
- package/mui/RadioGroup/index.js +41 -0
- package/mui/ReadOnlyField/index.d.ts +8 -0
- package/mui/ReadOnlyField/index.js +35 -0
- package/mui/Select/index.d.ts +47 -0
- package/mui/Select/index.js +164 -0
- package/mui/Stepper/StepIconComponent.d.ts +6 -0
- package/mui/Stepper/StepIconComponent.js +93 -0
- package/mui/Stepper/index.d.ts +6 -0
- package/mui/Stepper/index.js +13 -0
- package/mui/Switch/index.d.ts +3 -0
- package/mui/Switch/index.js +2 -0
- package/mui/Tab/index.d.ts +60 -0
- package/mui/Tab/index.js +12 -0
- package/mui/Tabs/index.d.ts +22 -0
- package/mui/Tabs/index.js +70 -0
- package/mui/TimeDurationLabel/index.d.ts +7 -0
- package/mui/TimeDurationLabel/index.js +13 -0
- package/mui/ToggleButton/index.d.ts +4 -0
- package/mui/ToggleButton/index.js +57 -0
- package/mui/ToggleButtonGroup/index.d.ts +25 -0
- package/mui/ToggleButtonGroup/index.js +61 -0
- package/mui/ToggleList/index.d.ts +11 -0
- package/mui/ToggleList/index.js +54 -0
- package/mui/Tooltip/index.d.ts +11 -0
- package/mui/Tooltip/index.js +36 -0
- package/mui/index.d.ts +36 -0
- package/mui/index.js +36 -0
- package/mui/provider.d.ts +9 -0
- package/mui/provider.js +22 -0
- package/mui/theme.d.ts +17 -0
- package/mui/theme.js +1228 -0
- package/package.json +197 -4
- package/services/api.d.ts +28 -0
- package/services/api.js +141 -0
- package/services/index.d.ts +2 -0
- package/services/index.js +2 -0
- package/services/openapi.d.ts +6 -0
- package/services/openapi.js +112 -0
- package/store/index.d.ts +6 -0
- package/store/index.js +1 -0
- package/store/useClassificationOptions.d.ts +3 -0
- package/store/useClassificationOptions.js +2 -0
- package/types.d.ts +2423 -0
- package/utils/array.d.ts +2 -0
- package/utils/array.js +21 -0
- package/utils/auth.d.ts +2 -0
- package/utils/auth.js +31 -0
- package/utils/color.d.ts +29 -0
- package/utils/color.js +132 -0
- package/utils/date.d.ts +40 -0
- package/utils/date.js +51 -0
- package/utils/filter.d.ts +3 -0
- package/utils/filter.js +11 -0
- package/utils/getScrollbarSize.d.ts +1 -0
- package/utils/getScrollbarSize.js +8 -0
- package/utils/index.d.ts +12 -0
- package/utils/index.js +12 -0
- package/utils/input.d.ts +2 -0
- package/utils/input.js +2 -0
- package/utils/knowledge-owl-script.d.ts +64 -0
- package/utils/knowledge-owl-script.js +226 -0
- package/utils/locales.d.ts +3 -0
- package/utils/locales.js +24 -0
- package/utils/noop.d.ts +1 -0
- package/utils/noop.js +1 -0
- package/utils/percentage.d.ts +6 -0
- package/utils/percentage.js +43 -0
- package/utils/redirect.d.ts +1 -0
- package/utils/redirect.js +6 -0
- package/utils/sort.d.ts +21 -0
- package/utils/sort.js +32 -0
- package/utils/storage.d.ts +2 -0
- package/utils/storage.js +2 -0
- package/utils/timeDuration.d.ts +26 -0
- package/utils/timeDuration.js +78 -0
- package/utils/wallClock.d.ts +17 -0
- package/utils/wallClock.js +178 -0
- package/wrappers/ApiInitializer.d.ts +9 -0
- package/wrappers/ApiInitializer.js +21 -0
- package/wrappers/AuthWrapper.d.ts +6 -0
- package/wrappers/AuthWrapper.js +38 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.d.ts +2 -0
- package/wrappers/AxiosErrorsInterceptorWrapper.js +30 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,199 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turnit-ou/shared",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.18.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "vite --force",
|
|
7
|
+
"link": "cd lib && yarn link",
|
|
8
|
+
"unlink": "cd lib && yarn unlink",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"lint": "NODE_PATH=. eslint src src/",
|
|
11
|
+
"icons": "ts-node icons.ts",
|
|
12
|
+
"prebundle": "rm -rf ./lib && yarn run icons",
|
|
13
|
+
"bundle": "ttsc -p tsconfig.prod.json",
|
|
14
|
+
"postbundle": "rollup -c",
|
|
15
|
+
"release": "release-it --ci",
|
|
16
|
+
"prepare": "husky",
|
|
17
|
+
"test": "jest --coverage",
|
|
18
|
+
"i18n:generate": "i18next \"src/**/*.{ts,tsx}\" --output \"src/i18n/resources/en.json\"",
|
|
19
|
+
"i18n:sort": "npx prettier --write src/i18n/resources/en.json --plugin=prettier-plugin-sort-json --json-recursive-sort",
|
|
20
|
+
"i18n:extract": "yarn run i18n:generate && yarn run i18n:sort"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"registry": "https://registry.npmjs.org/"
|
|
25
|
+
},
|
|
26
|
+
"main": "index.js",
|
|
27
|
+
"types": "types.d.ts",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@emotion/react": "^11.9.0",
|
|
30
|
+
"@emotion/styled": "^11.8.1",
|
|
31
|
+
"@mui/icons-material": "^5.8.4",
|
|
32
|
+
"@mui/lab": "^5.0.0-alpha.83",
|
|
33
|
+
"@mui/material": "^5.8.1",
|
|
34
|
+
"@mui/styles": "^5.8.0",
|
|
35
|
+
"@popperjs/core": "^2.11.5",
|
|
36
|
+
"@remirror/pm": "1.0.16",
|
|
37
|
+
"@remirror/react": "1.0.35",
|
|
38
|
+
"@sentry/react": "^7.118.0",
|
|
39
|
+
"@vvo/tzdb": "^6.125.0",
|
|
40
|
+
"axios": "^1.6.8",
|
|
41
|
+
"classnames": "^2.3.1",
|
|
42
|
+
"final-form": "^4.20.7",
|
|
43
|
+
"final-form-arrays": "^3.0.2",
|
|
44
|
+
"i18next": "^22.5.0",
|
|
45
|
+
"i18next-browser-languagedetector": "^7.0.1",
|
|
46
|
+
"i18next-intervalplural-postprocessor": "^3.0.0",
|
|
47
|
+
"is-empty": "^1.2.0",
|
|
48
|
+
"lodash": "^4.17.21",
|
|
49
|
+
"nest-deep": "^1.3.4",
|
|
50
|
+
"oidc-client-ts": "3.0.1",
|
|
51
|
+
"openapi-client-axios": "^7.5.5",
|
|
52
|
+
"react": "17.0.2",
|
|
53
|
+
"react-alert": "^7.0.3",
|
|
54
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
55
|
+
"react-contenteditable": "^3.3.5",
|
|
56
|
+
"react-datepicker": "^4.8.0",
|
|
57
|
+
"react-dom": "17.0.2",
|
|
58
|
+
"react-dropzone": "^14.2.2",
|
|
59
|
+
"react-final-form": "^6.5.9",
|
|
60
|
+
"react-final-form-arrays": "^3.1.3",
|
|
61
|
+
"react-final-form-hooks": "^2.0.2",
|
|
62
|
+
"react-hook-form": "^7.30.0",
|
|
63
|
+
"react-i18next": "^12.3.1",
|
|
64
|
+
"react-input-mask": "^3.0.0-alpha.2",
|
|
65
|
+
"react-oidc-context": "3.0.0",
|
|
66
|
+
"react-popper": "^2.2.5",
|
|
67
|
+
"react-router-dom": "5.2.0",
|
|
68
|
+
"react-table": "^7.7.0",
|
|
69
|
+
"remirror": "1.0.76",
|
|
70
|
+
"sanitize-html": "^2.5.2"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@jest/globals": "^29.7.0",
|
|
74
|
+
"@release-it/conventional-changelog": "^11.0.1",
|
|
75
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
76
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
77
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
78
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
79
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
80
|
+
"@sentry/types": "^7.118.0",
|
|
81
|
+
"@svgr/core": "^8.1.0",
|
|
82
|
+
"@svgr/plugin-jsx": "^8.1.0",
|
|
83
|
+
"@types/is-empty": "^1.2.1",
|
|
84
|
+
"@types/lodash": "^4.14.171",
|
|
85
|
+
"@types/node": "^20.14.2",
|
|
86
|
+
"@types/react": "^17.0.14",
|
|
87
|
+
"@types/react-alert": "^5.2.1",
|
|
88
|
+
"@types/react-beautiful-dnd": "^13.1.2",
|
|
89
|
+
"@types/react-datepicker": "^4.4.0",
|
|
90
|
+
"@types/react-dom": "^17.0.9",
|
|
91
|
+
"@types/react-input-mask": "3.0.1",
|
|
92
|
+
"@types/react-router-dom": "5.1.8",
|
|
93
|
+
"@types/react-table": "^7.7.11",
|
|
94
|
+
"@types/sanitize-html": "^2.3.2",
|
|
95
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
96
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
97
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
98
|
+
"@zerollup/ts-transform-paths": "^1.7.18",
|
|
99
|
+
"eslint": "^7.32.0",
|
|
100
|
+
"eslint-config-prettier": "^8.10.0",
|
|
101
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
102
|
+
"husky": "^9.1.7",
|
|
103
|
+
"i18next-parser": "^7.7.0",
|
|
104
|
+
"jest": "^29.7.0",
|
|
105
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
106
|
+
"openapi-client-axios": "^7.5.5",
|
|
107
|
+
"prettier": "3.4.1",
|
|
108
|
+
"prettier-plugin-sort-json": "^4.0.0",
|
|
109
|
+
"react-redux": "^7.2.1",
|
|
110
|
+
"react-scripts": "5.0.1",
|
|
111
|
+
"release-it": "^20.2.1",
|
|
112
|
+
"rollup": "^2.73.0",
|
|
113
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
114
|
+
"rollup-plugin-dts": "^4.2.3",
|
|
115
|
+
"rollup-plugin-scss": "^3.0.0",
|
|
116
|
+
"sass": "^1.50.0",
|
|
117
|
+
"ts-jest": "^29.1.1",
|
|
118
|
+
"ts-node": "^10.9.1",
|
|
119
|
+
"ttypescript": "^1.5.15",
|
|
120
|
+
"typescript": "4.7.4",
|
|
121
|
+
"vite": "^5.2.13",
|
|
122
|
+
"vite-plugin-checker": "^0.7.2",
|
|
123
|
+
"vite-plugin-env-compatible": "^2.0.1",
|
|
124
|
+
"vite-plugin-relay": "^2.1.0",
|
|
125
|
+
"vite-plugin-svg-icons": "^2.0.1",
|
|
126
|
+
"vite-plugin-svgr": "^4.2.0",
|
|
127
|
+
"vite-tsconfig-paths": "^4.3.2"
|
|
128
|
+
},
|
|
129
|
+
"peerDependencies": {
|
|
130
|
+
"@emotion/react": "^11.9.0",
|
|
131
|
+
"@emotion/styled": "^11.8.1",
|
|
132
|
+
"@mui/icons-material": "^5.8.4",
|
|
133
|
+
"@mui/lab": "^5.0.0-alpha.83",
|
|
134
|
+
"@mui/material": "^5.8.1",
|
|
135
|
+
"@mui/styles": "^5.8.0",
|
|
136
|
+
"@popperjs/core": "^2.1.0",
|
|
137
|
+
"classnames": "^2.3.1",
|
|
138
|
+
"date-fns": "^2.22.1",
|
|
139
|
+
"final-form": "^4.20.7",
|
|
140
|
+
"final-form-arrays": "^3.0.2",
|
|
141
|
+
"i18next-intervalplural-postprocessor": "^3.0.0",
|
|
142
|
+
"openapi-client-axios": "^7.5.5",
|
|
143
|
+
"react": "^17.0.0",
|
|
144
|
+
"react-alert": "^7.0.3",
|
|
145
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
146
|
+
"react-contenteditable": "^3.3.5",
|
|
147
|
+
"react-datepicker": "^4.7.0",
|
|
148
|
+
"react-dom": "^17.0.0",
|
|
149
|
+
"react-final-form": "^6.5.9",
|
|
150
|
+
"react-final-form-arrays": "^3.1.3",
|
|
151
|
+
"react-final-form-hooks": "^2.0.2",
|
|
152
|
+
"react-hook-form": "^7.0.0",
|
|
153
|
+
"react-popper": "^2.0.0",
|
|
154
|
+
"react-router-dom": "5.2.0",
|
|
155
|
+
"react-table": "^7.7.0"
|
|
156
|
+
},
|
|
157
|
+
"peerDependenciesMeta": {
|
|
158
|
+
"@types/react": {
|
|
159
|
+
"optional": true
|
|
160
|
+
},
|
|
161
|
+
"@emotion/react": {
|
|
162
|
+
"optional": true
|
|
163
|
+
},
|
|
164
|
+
"@emotion/styled": {
|
|
165
|
+
"optional": true
|
|
166
|
+
},
|
|
167
|
+
"@mui/icons-material": {
|
|
168
|
+
"optional": true
|
|
169
|
+
},
|
|
170
|
+
"@mui/lab": {
|
|
171
|
+
"optional": true
|
|
172
|
+
},
|
|
173
|
+
"@mui/material": {
|
|
174
|
+
"optional": true
|
|
175
|
+
},
|
|
176
|
+
"@mui/styles": {
|
|
177
|
+
"optional": true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"eslintConfig": {
|
|
181
|
+
"parser": "babel-eslint",
|
|
182
|
+
"extends": [
|
|
183
|
+
"react-app",
|
|
184
|
+
"react-app/jest"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"browserslist": {
|
|
188
|
+
"production": [
|
|
189
|
+
">0.2%",
|
|
190
|
+
"not dead",
|
|
191
|
+
"not op_mini all"
|
|
192
|
+
],
|
|
193
|
+
"development": [
|
|
194
|
+
"last 1 chrome version",
|
|
195
|
+
"last 1 firefox version",
|
|
196
|
+
"last 1 safari version"
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
import { AlertManager } from 'react-alert';
|
|
3
|
+
export declare enum PermissionKey {
|
|
4
|
+
IS_CPP_PAYOUT_REFUND_ALLOWED = "retailer/refunds/is-cpp-payout-refund-allowed",
|
|
5
|
+
IS_CPP_BOOKING_REFUND_ALLOWED = "retailer/refunds/is-cpp-booking-refund-allowed",
|
|
6
|
+
ADD_TRAVEL_VOUCHER = "retailer/vouchers/add-travel-voucher",
|
|
7
|
+
CAN_SEARCH_DEPARTED_TRIPS = "retailer/offers/can-search-departed-trips",
|
|
8
|
+
CAN_BOOK_DEPARTED_TRIPS = "retailer/offers/can-book-departed-trips"
|
|
9
|
+
}
|
|
10
|
+
declare type Error = {
|
|
11
|
+
code?: string;
|
|
12
|
+
field?: string;
|
|
13
|
+
message: string;
|
|
14
|
+
};
|
|
15
|
+
export interface ErrorResponse extends AxiosError<{
|
|
16
|
+
title?: string;
|
|
17
|
+
errors?: Array<Error>;
|
|
18
|
+
business_errors: Array<Error>;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
export declare const isSigningOut: () => boolean;
|
|
22
|
+
export declare const setSigningOut: (value: boolean) => void;
|
|
23
|
+
export declare const getAuthStorage: () => any;
|
|
24
|
+
export declare const getToken: () => any;
|
|
25
|
+
export declare const hasTokenPermission: (permissionKey: PermissionKey | string) => any;
|
|
26
|
+
export declare const getErrHandler: (alert: AlertManager, onAuthError: () => Promise<void>) => (error: ErrorResponse) => Promise<void>;
|
|
27
|
+
declare const api: import("axios").AxiosInstance;
|
|
28
|
+
export { api };
|
package/services/api.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { getLanguage } from "../i18n";
|
|
4
|
+
import { renderToString } from 'react-dom/server';
|
|
5
|
+
import isEmpty from 'lodash/isEmpty';
|
|
6
|
+
import isArray from 'lodash/isArray';
|
|
7
|
+
import { TransAlert } from "../i18n/trans/alert";
|
|
8
|
+
import { getPayloadFromFilter, getQueryFromFilter } from "../utils";
|
|
9
|
+
export var PermissionKey;
|
|
10
|
+
(function (PermissionKey) {
|
|
11
|
+
PermissionKey["IS_CPP_PAYOUT_REFUND_ALLOWED"] = "retailer/refunds/is-cpp-payout-refund-allowed";
|
|
12
|
+
PermissionKey["IS_CPP_BOOKING_REFUND_ALLOWED"] = "retailer/refunds/is-cpp-booking-refund-allowed";
|
|
13
|
+
PermissionKey["ADD_TRAVEL_VOUCHER"] = "retailer/vouchers/add-travel-voucher";
|
|
14
|
+
PermissionKey["CAN_SEARCH_DEPARTED_TRIPS"] = "retailer/offers/can-search-departed-trips";
|
|
15
|
+
PermissionKey["CAN_BOOK_DEPARTED_TRIPS"] = "retailer/offers/can-book-departed-trips";
|
|
16
|
+
})(PermissionKey || (PermissionKey = {}));
|
|
17
|
+
let _isSigningOut = false;
|
|
18
|
+
export const isSigningOut = () => _isSigningOut;
|
|
19
|
+
export const setSigningOut = (value) => {
|
|
20
|
+
_isSigningOut = value;
|
|
21
|
+
};
|
|
22
|
+
export const getAuthStorage = () => {
|
|
23
|
+
const storageKey = [
|
|
24
|
+
'oidc.user',
|
|
25
|
+
process.env.REACT_APP_AUTH_URL || import.meta.env?.VITE_APP_AUTH_URL,
|
|
26
|
+
process.env.REACT_APP_IDENTITY_CLIENT_ID ||
|
|
27
|
+
import.meta.env?.VITE_APP_IDENTITY_CLIENT_ID,
|
|
28
|
+
].join(':');
|
|
29
|
+
return JSON.parse(sessionStorage.getItem(storageKey) ?? '{}');
|
|
30
|
+
};
|
|
31
|
+
export const getToken = () => {
|
|
32
|
+
return getAuthStorage()?.access_token;
|
|
33
|
+
};
|
|
34
|
+
export const hasTokenPermission = (permissionKey) => {
|
|
35
|
+
const token = getToken();
|
|
36
|
+
return token
|
|
37
|
+
? (getAuthStorage()?.profile?.permission ?? []).includes(permissionKey)
|
|
38
|
+
: false;
|
|
39
|
+
};
|
|
40
|
+
const getErrMessage = (status, statusText) => {
|
|
41
|
+
if (statusText) {
|
|
42
|
+
return `${status} ${statusText}`;
|
|
43
|
+
}
|
|
44
|
+
if (status === 403) {
|
|
45
|
+
return `${status} ${renderToString(_jsx(TransAlert, { i18nKey: "noAccess" }))}`;
|
|
46
|
+
}
|
|
47
|
+
return `${status} ${renderToString(_jsx(TransAlert, { i18nKey: "unknownError" }))}`;
|
|
48
|
+
};
|
|
49
|
+
export const getErrHandler = (alert, onAuthError) => async (error) => {
|
|
50
|
+
if (!error.response)
|
|
51
|
+
return;
|
|
52
|
+
const { data, status, statusText } = error.response;
|
|
53
|
+
let preparedData;
|
|
54
|
+
try {
|
|
55
|
+
if (error.request.responseType === 'blob') {
|
|
56
|
+
preparedData = JSON.parse(await data?.text());
|
|
57
|
+
}
|
|
58
|
+
else if (error.request.responseType === 'arraybuffer') {
|
|
59
|
+
preparedData = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(data)));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
preparedData = data;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
preparedData = data;
|
|
67
|
+
}
|
|
68
|
+
if (status === 401 && getAuthStorage() && !isSigningOut()) {
|
|
69
|
+
sessionStorage.clear();
|
|
70
|
+
return onAuthError();
|
|
71
|
+
}
|
|
72
|
+
if (!isEmpty(preparedData)) {
|
|
73
|
+
const { errors = [], business_errors = [], title } = preparedData;
|
|
74
|
+
const errorList = [
|
|
75
|
+
...(isArray(errors) ? errors : []),
|
|
76
|
+
...business_errors,
|
|
77
|
+
];
|
|
78
|
+
if (title) {
|
|
79
|
+
alert.show(title, {
|
|
80
|
+
type: 'error',
|
|
81
|
+
timeout: 5000,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else if (errorList.length) {
|
|
85
|
+
errorList.forEach(({ message }) => {
|
|
86
|
+
const preparedErrorMessage = message
|
|
87
|
+
? message === 'Forbidden'
|
|
88
|
+
? renderToString(_jsx(TransAlert, { i18nKey: "generalPermissionsError" }))
|
|
89
|
+
: message
|
|
90
|
+
: renderToString(_jsx(TransAlert, { i18nKey: "generalError" }));
|
|
91
|
+
alert.show(preparedErrorMessage, {
|
|
92
|
+
type: 'error',
|
|
93
|
+
timeout: 5000,
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
alert.show(getErrMessage(status, statusText), {
|
|
100
|
+
type: 'error',
|
|
101
|
+
timeout: 5000,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return Promise.reject(error);
|
|
105
|
+
};
|
|
106
|
+
const api = axios.create({
|
|
107
|
+
headers: {
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
api.interceptors.response.use(({ data, ...res }) => ({
|
|
112
|
+
...res,
|
|
113
|
+
data: data?.success ?? data,
|
|
114
|
+
}));
|
|
115
|
+
api.interceptors.request.use(({ shouldRelocatePaginationAndSortingParamsFromPayloadToQueryString, ...config }) => {
|
|
116
|
+
const accessToken = getToken();
|
|
117
|
+
const prefix = config.baseURL ??
|
|
118
|
+
(process.env.REACT_APP_API_TARGET ||
|
|
119
|
+
import.meta.env?.VITE_APP_API_TARGET);
|
|
120
|
+
const isUrlWithLanguageInHeader = [
|
|
121
|
+
process.env.REACT_APP_AUTH_URL || import.meta.env?.VITE_APP_AUTH_URL,
|
|
122
|
+
process.env.REACT_APP_IDENTITY_API_URL ||
|
|
123
|
+
import.meta.env?.VITE_APP_IDENTITY_API_URL,
|
|
124
|
+
].includes(prefix);
|
|
125
|
+
const language = getLanguage();
|
|
126
|
+
const baseURL = isUrlWithLanguageInHeader
|
|
127
|
+
? prefix
|
|
128
|
+
: `${prefix}/${language}`;
|
|
129
|
+
if (shouldRelocatePaginationAndSortingParamsFromPayloadToQueryString) {
|
|
130
|
+
config.params = getQueryFromFilter(config.data);
|
|
131
|
+
config.data = getPayloadFromFilter(config.data);
|
|
132
|
+
}
|
|
133
|
+
if (accessToken) {
|
|
134
|
+
config.baseURL = baseURL;
|
|
135
|
+
config.headers['Authorization'] = `Bearer ${accessToken}`;
|
|
136
|
+
if (isUrlWithLanguageInHeader)
|
|
137
|
+
config.headers['Accept-Language'] = language;
|
|
138
|
+
}
|
|
139
|
+
return config;
|
|
140
|
+
});
|
|
141
|
+
export { api };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ErrorResponse } from "./api";
|
|
2
|
+
import { OpenAPIClient } from 'openapi-client-axios';
|
|
3
|
+
import { AlertManager } from 'react-alert';
|
|
4
|
+
import { AuthContextProps } from 'react-oidc-context';
|
|
5
|
+
export declare const createErrorMiddleware: (alert: AlertManager, auth: AuthContextProps) => (error: ErrorResponse) => Promise<void>;
|
|
6
|
+
export declare const configureMiddleware: (client: OpenAPIClient<unknown, unknown>, alert: AlertManager, auth: AuthContextProps) => void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getToken, getAuthStorage, isSigningOut } from "./api";
|
|
3
|
+
import { getPayloadFromFilter, getQueryFromFilter } from "../utils";
|
|
4
|
+
import { getLanguage } from "../i18n";
|
|
5
|
+
import _isEmpty from 'lodash/isEmpty';
|
|
6
|
+
import _isArray from 'lodash/isArray';
|
|
7
|
+
import { renderToString } from 'react-dom/server';
|
|
8
|
+
import { TransAlert } from "../i18n/trans/alert";
|
|
9
|
+
const authorizationMiddleware = (config) => {
|
|
10
|
+
const accessToken = getToken();
|
|
11
|
+
if (accessToken) {
|
|
12
|
+
config.headers['Authorization'] = `Bearer ${accessToken}`;
|
|
13
|
+
}
|
|
14
|
+
return config;
|
|
15
|
+
};
|
|
16
|
+
const dataExtractMiddleware = ({ data, ...response }) => ({
|
|
17
|
+
...response,
|
|
18
|
+
data: data.success ?? data,
|
|
19
|
+
});
|
|
20
|
+
const paramsRelocatorMiddleware = (config) => {
|
|
21
|
+
if (config.shouldRelocatePaginationAndSortingParamsFromPayloadToQueryString) {
|
|
22
|
+
config.params = getQueryFromFilter(config.data);
|
|
23
|
+
config.data = getPayloadFromFilter(config.data);
|
|
24
|
+
}
|
|
25
|
+
return config;
|
|
26
|
+
};
|
|
27
|
+
const languageMiddleware = (config) => {
|
|
28
|
+
const requestBaseURL = config.baseURL || import.meta.env.VITE_APP_API_TARGET;
|
|
29
|
+
const authUrls = [
|
|
30
|
+
import.meta.env.VITE_APP_AUTH_URL,
|
|
31
|
+
import.meta.env.VITE_APP_IDENTITY_API_URL,
|
|
32
|
+
];
|
|
33
|
+
const isRequestTowardsAuthServer = authUrls.includes(requestBaseURL);
|
|
34
|
+
if (!isRequestTowardsAuthServer) {
|
|
35
|
+
config.baseURL = `${requestBaseURL}/${getLanguage()}`;
|
|
36
|
+
}
|
|
37
|
+
return config;
|
|
38
|
+
};
|
|
39
|
+
const getErrMessage = (status, statusText) => {
|
|
40
|
+
if (statusText) {
|
|
41
|
+
return `${status} ${statusText}`;
|
|
42
|
+
}
|
|
43
|
+
if (status === 403) {
|
|
44
|
+
return `${status} ${renderToString(_jsx(TransAlert, { i18nKey: "noAccess" }))}`;
|
|
45
|
+
}
|
|
46
|
+
return `${status} ${renderToString(_jsx(TransAlert, { i18nKey: "unknownError" }))}`;
|
|
47
|
+
};
|
|
48
|
+
export const createErrorMiddleware = (alert, auth) => async (error) => {
|
|
49
|
+
if (!error.response)
|
|
50
|
+
return Promise.reject(error);
|
|
51
|
+
const { data, status, statusText, request } = error.response;
|
|
52
|
+
let preparedData;
|
|
53
|
+
try {
|
|
54
|
+
if (request.responseType === 'blob') {
|
|
55
|
+
preparedData = JSON.parse(await data.text());
|
|
56
|
+
}
|
|
57
|
+
else if (request.responseType === 'arraybuffer') {
|
|
58
|
+
preparedData = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(data)));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
preparedData = data;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
preparedData = data;
|
|
66
|
+
}
|
|
67
|
+
// 401 → clear storage & emit authError
|
|
68
|
+
if (status === 401 && getAuthStorage() && !isSigningOut()) {
|
|
69
|
+
sessionStorage.clear();
|
|
70
|
+
return new Promise(() => {
|
|
71
|
+
sessionStorage.setItem('REDIRECT_URI', window.location.href);
|
|
72
|
+
auth.signinRedirect();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (!_isEmpty(preparedData)) {
|
|
76
|
+
const { errors = [], business_errors = [], title } = preparedData;
|
|
77
|
+
const errorList = [
|
|
78
|
+
...(_isArray(errors) ? errors : []),
|
|
79
|
+
...business_errors,
|
|
80
|
+
];
|
|
81
|
+
if (title) {
|
|
82
|
+
alert.show(title, {
|
|
83
|
+
type: 'error',
|
|
84
|
+
timeout: 5000,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else if (errorList.length) {
|
|
88
|
+
errorList.forEach(({ message }) => {
|
|
89
|
+
const preparedErrorMessage = message
|
|
90
|
+
? message === 'Forbidden'
|
|
91
|
+
? renderToString(_jsx(TransAlert, { i18nKey: "generalPermissionsError" }))
|
|
92
|
+
: message
|
|
93
|
+
: renderToString(_jsx(TransAlert, { i18nKey: "generalError" }));
|
|
94
|
+
alert.error(preparedErrorMessage, {
|
|
95
|
+
timeout: 5000,
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
alert.error(getErrMessage(status, statusText), {
|
|
102
|
+
timeout: 5000,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return Promise.reject(error);
|
|
106
|
+
};
|
|
107
|
+
export const configureMiddleware = (client, alert, auth) => {
|
|
108
|
+
client.interceptors.request.use(authorizationMiddleware);
|
|
109
|
+
client.interceptors.request.use(paramsRelocatorMiddleware);
|
|
110
|
+
client.interceptors.request.use(languageMiddleware);
|
|
111
|
+
client.interceptors.response.use(dataExtractMiddleware, createErrorMiddleware(alert, auth));
|
|
112
|
+
};
|
package/store/index.d.ts
ADDED
package/store/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|