@pagamio/frontend-commons-lib 0.8.175 → 0.8.183
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/lib/api/client.d.ts +88 -0
- package/lib/api/client.js +339 -0
- package/lib/api/context.d.ts +112 -0
- package/lib/api/context.js +105 -0
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.js +4 -0
- package/lib/api/swr.d.ts +46 -0
- package/lib/api/swr.js +124 -0
- package/lib/api/types.d.ts +145 -0
- package/lib/api/types.js +10 -0
- package/lib/auth/authenticators/AuthenticatorFactory.d.ts +25 -0
- package/lib/auth/authenticators/AuthenticatorFactory.js +32 -0
- package/lib/auth/authenticators/index.d.ts +7 -0
- package/lib/auth/authenticators/index.js +7 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.d.ts +21 -0
- package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.js +26 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.d.ts +74 -0
- package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.js +99 -0
- package/lib/auth/authenticators/types.d.ts +26 -0
- package/lib/auth/authenticators/types.js +9 -0
- package/lib/auth/components/AppBanner.d.ts +7 -0
- package/lib/auth/components/AppBanner.js +9 -0
- package/lib/auth/components/AuthCard.d.ts +8 -0
- package/lib/auth/components/AuthCard.js +14 -0
- package/lib/auth/components/AuthFormUtils.d.ts +58 -0
- package/lib/auth/components/AuthFormUtils.js +52 -0
- package/lib/auth/components/AuthPageLayout.d.ts +45 -0
- package/lib/auth/components/AuthPageLayout.js +12 -0
- package/lib/auth/components/ChangePasswordPage.d.ts +12 -0
- package/lib/auth/components/ChangePasswordPage.js +59 -0
- package/lib/auth/components/CustomerRegistrationPage.d.ts +50 -0
- package/lib/auth/components/CustomerRegistrationPage.js +140 -0
- package/lib/auth/components/ForgotPasswordPage.d.ts +38 -0
- package/lib/auth/components/ForgotPasswordPage.js +76 -0
- package/lib/auth/components/LoginPage.d.ts +73 -0
- package/lib/auth/components/LoginPage.js +115 -0
- package/lib/auth/components/LogoutButton.d.ts +30 -0
- package/lib/auth/components/LogoutButton.js +47 -0
- package/lib/auth/components/ResetPasswordPage.d.ts +42 -0
- package/lib/auth/components/ResetPasswordPage.js +88 -0
- package/lib/auth/components/hooks/useChangeUserPassword.d.ts +26 -0
- package/lib/auth/components/hooks/useChangeUserPassword.js +63 -0
- package/lib/auth/components/index.d.ts +8 -0
- package/lib/auth/components/index.js +7 -0
- package/lib/auth/context/AuthContext.d.ts +65 -0
- package/lib/auth/context/AuthContext.js +150 -0
- package/lib/auth/context/index.d.ts +1 -0
- package/lib/auth/context/index.js +1 -0
- package/lib/auth/index.d.ts +7 -0
- package/lib/auth/index.js +7 -0
- package/lib/auth/services/AuthService.d.ts +230 -0
- package/lib/auth/services/AuthService.js +475 -0
- package/lib/auth/services/LogoutService.d.ts +27 -0
- package/lib/auth/services/LogoutService.js +98 -0
- package/lib/auth/services/index.d.ts +2 -0
- package/lib/auth/services/index.js +2 -0
- package/lib/auth/shared/index.d.ts +1 -0
- package/lib/auth/shared/index.js +1 -0
- package/lib/auth/shared/layout/AuthPageLayout.d.ts +10 -0
- package/lib/auth/shared/layout/AuthPageLayout.js +16 -0
- package/lib/auth/shared/layout/index.d.ts +1 -0
- package/lib/auth/shared/layout/index.js +1 -0
- package/lib/auth/types/auth.types.d.ts +234 -0
- package/lib/auth/types/auth.types.js +14 -0
- package/lib/auth/types/index.d.ts +1 -0
- package/lib/auth/types/index.js +1 -0
- package/lib/auth/utils/TokenManager.d.ts +43 -0
- package/lib/auth/utils/TokenManager.js +171 -0
- package/lib/auth/utils/Transformers.d.ts +158 -0
- package/lib/auth/utils/Transformers.js +263 -0
- package/lib/auth/utils/errorDetection.d.ts +22 -0
- package/lib/auth/utils/errorDetection.js +190 -0
- package/lib/auth/utils/index.d.ts +3 -0
- package/lib/auth/utils/index.js +3 -0
- package/lib/components/charts/LineGraph.d.ts +15 -0
- package/lib/components/charts/LineGraph.js +131 -0
- package/lib/components/icons/Icon.d.ts +8 -0
- package/lib/components/icons/Icon.js +13 -0
- package/lib/components/icons/index.d.ts +2 -0
- package/lib/components/icons/index.js +2 -0
- package/lib/components/icons/types.d.ts +26 -0
- package/lib/components/icons/types.js +33 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +3 -0
- package/lib/components/layout/AppLayout.d.ts +34 -0
- package/lib/components/layout/AppLayout.js +19 -0
- package/lib/components/layout/AuthPageLayout.d.ts +13 -0
- package/lib/components/layout/AuthPageLayout.js +15 -0
- package/lib/components/layout/BreadcrumbNav.d.ts +2 -0
- package/lib/components/layout/BreadcrumbNav.js +10 -0
- package/lib/components/layout/LayoutContent.d.ts +6 -0
- package/lib/components/layout/LayoutContent.js +10 -0
- package/lib/components/layout/Navbar.d.ts +106 -0
- package/lib/components/layout/Navbar.js +66 -0
- package/lib/components/layout/PageHeader.d.ts +8 -0
- package/lib/components/layout/PageHeader.js +7 -0
- package/lib/components/layout/SessionExpiryModal.d.ts +10 -0
- package/lib/components/layout/SessionExpiryModal.js +9 -0
- package/lib/components/layout/Sidebar.d.ts +6 -0
- package/lib/components/layout/Sidebar.js +87 -0
- package/lib/components/layout/VerticalTabsLayout.d.ts +12 -0
- package/lib/components/layout/VerticalTabsLayout.js +14 -0
- package/lib/components/layout/index.d.ts +9 -0
- package/lib/components/layout/index.js +9 -0
- package/lib/components/ui/Avatar.d.ts +6 -0
- package/lib/components/ui/Avatar.js +11 -0
- package/lib/components/ui/AvatarIcon.d.ts +4 -0
- package/lib/components/ui/AvatarIcon.js +6 -0
- package/lib/components/ui/Button.d.ts +14 -0
- package/lib/components/ui/Button.js +30 -0
- package/lib/components/ui/Calendar.d.ts +9 -0
- package/lib/components/ui/Calendar.js +35 -0
- package/lib/components/ui/Card.d.ts +16 -0
- package/lib/components/ui/Card.js +6 -0
- package/lib/components/ui/Chart.d.ts +2 -0
- package/lib/components/ui/Chart.js +16 -0
- package/lib/components/ui/Checkbox.d.ts +4 -0
- package/lib/components/ui/Checkbox.js +8 -0
- package/lib/components/ui/Command.d.ts +80 -0
- package/lib/components/ui/Command.js +28 -0
- package/lib/components/ui/ContainedTab.d.ts +21 -0
- package/lib/components/ui/ContainedTab.js +37 -0
- package/lib/components/ui/DateFormat.d.ts +6 -0
- package/lib/components/ui/DateFormat.js +8 -0
- package/lib/components/ui/DatePicker.d.ts +14 -0
- package/lib/components/ui/DatePicker.js +91 -0
- package/lib/components/ui/DateRangeModal.d.ts +38 -0
- package/lib/components/ui/DateRangeModal.js +89 -0
- package/lib/components/ui/DetailsCard.d.ts +16 -0
- package/lib/components/ui/DetailsCard.js +14 -0
- package/lib/components/ui/DetailsPage.d.ts +36 -0
- package/lib/components/ui/DetailsPage.js +50 -0
- package/lib/components/ui/Dialog.d.ts +19 -0
- package/lib/components/ui/Dialog.js +22 -0
- package/lib/components/ui/EmptyState.d.ts +6 -0
- package/lib/components/ui/EmptyState.js +6 -0
- package/lib/components/ui/FilterComponent.d.ts +30 -0
- package/lib/components/ui/FilterComponent.js +80 -0
- package/lib/components/ui/FilterList.d.ts +52 -0
- package/lib/components/ui/FilterList.js +62 -0
- package/lib/components/ui/FilterSection.d.ts +31 -0
- package/lib/components/ui/FilterSection.js +21 -0
- package/lib/components/ui/FilterWrapper.d.ts +6 -0
- package/lib/components/ui/FilterWrapper.js +7 -0
- package/lib/components/ui/Form.d.ts +23 -0
- package/lib/components/ui/Form.js +62 -0
- package/lib/components/ui/HoverableValue.d.ts +7 -0
- package/lib/components/ui/HoverableValue.js +8 -0
- package/lib/components/ui/IconButton.d.ts +10 -0
- package/lib/components/ui/IconButton.js +10 -0
- package/lib/components/ui/ImageComponent.d.ts +8 -0
- package/lib/components/ui/ImageComponent.js +5 -0
- package/lib/components/ui/ImageUploader.d.ts +17 -0
- package/lib/components/ui/ImageUploader.js +144 -0
- package/lib/components/ui/Input.d.ts +4 -0
- package/lib/components/ui/Input.js +8 -0
- package/lib/components/ui/Label.d.ts +5 -0
- package/lib/components/ui/Label.js +9 -0
- package/lib/components/ui/Loader.d.ts +10 -0
- package/lib/components/ui/Loader.js +7 -0
- package/lib/components/ui/Modal.d.ts +72 -0
- package/lib/components/ui/Modal.js +31 -0
- package/lib/components/ui/MultiSelect.d.ts +16 -0
- package/lib/components/ui/MultiSelect.js +59 -0
- package/lib/components/ui/NotificationModal.d.ts +18 -0
- package/lib/components/ui/NotificationModal.js +40 -0
- package/lib/components/ui/PhoneInput.d.ts +12 -0
- package/lib/components/ui/PhoneInput.js +58 -0
- package/lib/components/ui/Popover.d.ts +7 -0
- package/lib/components/ui/Popover.js +10 -0
- package/lib/components/ui/Progress.d.ts +7 -0
- package/lib/components/ui/Progress.js +7 -0
- package/lib/components/ui/Radio.d.ts +5 -0
- package/lib/components/ui/Radio.js +14 -0
- package/lib/components/ui/RangeDatePicker.d.ts +78 -0
- package/lib/components/ui/RangeDatePicker.js +68 -0
- package/lib/components/ui/Select.d.ts +13 -0
- package/lib/components/ui/Select.js +57 -0
- package/lib/components/ui/Separator.d.ts +4 -0
- package/lib/components/ui/Separator.js +7 -0
- package/lib/components/ui/Sheet.d.ts +26 -0
- package/lib/components/ui/Sheet.js +37 -0
- package/lib/components/ui/StatusCell.d.ts +9 -0
- package/lib/components/ui/StatusCell.js +6 -0
- package/lib/components/ui/Switch.d.ts +10 -0
- package/lib/components/ui/Switch.js +22 -0
- package/lib/components/ui/Tab.d.ts +15 -0
- package/lib/components/ui/Tab.js +13 -0
- package/lib/components/ui/TableDownload.d.ts +11 -0
- package/lib/components/ui/TableDownload.js +82 -0
- package/lib/components/ui/TailwindIndicator.d.ts +1 -0
- package/lib/components/ui/TailwindIndicator.js +6 -0
- package/lib/components/ui/TextField.d.ts +60 -0
- package/lib/components/ui/TextField.js +42 -0
- package/lib/components/ui/Textarea.d.ts +5 -0
- package/lib/components/ui/Textarea.js +8 -0
- package/lib/components/ui/Toast.d.ts +12 -0
- package/lib/components/ui/Toast.js +25 -0
- package/lib/components/ui/UploadField.d.ts +15 -0
- package/lib/components/ui/UploadField.js +45 -0
- package/lib/components/ui/VerticalTab.d.ts +16 -0
- package/lib/components/ui/VerticalTab.js +13 -0
- package/lib/components/ui/index.d.ts +49 -0
- package/lib/components/ui/index.js +47 -0
- package/lib/context/BreadcrumbContext.d.ts +28 -0
- package/lib/context/BreadcrumbContext.js +238 -0
- package/lib/context/FormEngineDrawerProvider.d.ts +21 -0
- package/lib/context/FormEngineDrawerProvider.js +38 -0
- package/lib/context/MultiFormEngineDrawerProvider.d.ts +25 -0
- package/lib/context/MultiFormEngineDrawerProvider.js +89 -0
- package/lib/context/SidebarContext.d.ts +65 -0
- package/lib/context/SidebarContext.js +47 -0
- package/lib/context/ToastContext.d.ts +17 -0
- package/lib/context/ToastContext.js +29 -0
- package/lib/context/index.d.ts +5 -0
- package/lib/context/index.js +5 -0
- package/lib/dashboard-visuals/components/BaseChart.d.ts +55 -0
- package/lib/dashboard-visuals/components/BaseChart.js +201 -0
- package/lib/dashboard-visuals/components/CardWrapper.d.ts +10 -0
- package/lib/dashboard-visuals/components/CardWrapper.js +13 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.d.ts +57 -0
- package/lib/dashboard-visuals/components/ChartDetailsModal.js +27 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.d.ts +29 -0
- package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.js +4 -0
- package/lib/dashboard-visuals/components/ChartFormatter.d.ts +22 -0
- package/lib/dashboard-visuals/components/ChartFormatter.js +46 -0
- package/lib/dashboard-visuals/components/ChartWrapper.d.ts +11 -0
- package/lib/dashboard-visuals/components/ChartWrapper.js +14 -0
- package/lib/dashboard-visuals/components/DashboardFilter.d.ts +8 -0
- package/lib/dashboard-visuals/components/DashboardFilter.js +17 -0
- package/lib/dashboard-visuals/components/DataTable.d.ts +3 -0
- package/lib/dashboard-visuals/components/DataTable.js +57 -0
- package/lib/dashboard-visuals/components/EmptyState.d.ts +6 -0
- package/lib/dashboard-visuals/components/EmptyState.js +6 -0
- package/lib/dashboard-visuals/components/ErrorState.d.ts +7 -0
- package/lib/dashboard-visuals/components/ErrorState.js +5 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.d.ts +3 -0
- package/lib/dashboard-visuals/components/FilterComponentSkeleton.js +11 -0
- package/lib/dashboard-visuals/components/Pagination.d.ts +10 -0
- package/lib/dashboard-visuals/components/Pagination.js +7 -0
- package/lib/dashboard-visuals/components/Switch.d.ts +8 -0
- package/lib/dashboard-visuals/components/Switch.js +10 -0
- package/lib/dashboard-visuals/components/TileSkeleton.d.ts +2 -0
- package/lib/dashboard-visuals/components/TileSkeleton.js +5 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.d.ts +11 -0
- package/lib/dashboard-visuals/components/molecules/Analytics.js +9 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.d.ts +15 -0
- package/lib/dashboard-visuals/components/molecules/DataGrid.js +124 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.d.ts +6 -0
- package/lib/dashboard-visuals/components/molecules/NoChartData.js +6 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.d.ts +16 -0
- package/lib/dashboard-visuals/components/molecules/VisualChart.js +8 -0
- package/lib/dashboard-visuals/components/types.d.ts +62 -0
- package/lib/dashboard-visuals/components/types.js +1 -0
- package/lib/dashboard-visuals/hooks/useChartData.d.ts +15 -0
- package/lib/dashboard-visuals/hooks/useChartData.js +82 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.d.ts +13 -0
- package/lib/dashboard-visuals/hooks/useTooltipFormatter.js +10 -0
- package/lib/dashboard-visuals/index.d.ts +39 -0
- package/lib/dashboard-visuals/index.js +168 -0
- package/lib/dashboard-visuals/types/index.d.ts +83 -0
- package/lib/dashboard-visuals/types/index.js +1 -0
- package/lib/dashboard-visuals/types/metricDetailData.d.ts +25 -0
- package/lib/dashboard-visuals/types/metricDetailData.js +1 -0
- package/lib/dashboard-visuals/utils/api.d.ts +5 -0
- package/lib/dashboard-visuals/utils/api.js +6 -0
- package/lib/dashboard-visuals/utils/chartOptions.d.ts +481 -0
- package/lib/dashboard-visuals/utils/chartOptions.js +393 -0
- package/lib/dashboard-visuals/utils/chunkArray.d.ts +1 -0
- package/lib/dashboard-visuals/utils/chunkArray.js +7 -0
- package/lib/dashboard-visuals/utils/defaultColors.d.ts +1 -0
- package/lib/dashboard-visuals/utils/defaultColors.js +1 -0
- package/lib/dashboard-visuals/utils/formatUtil.d.ts +203 -0
- package/lib/dashboard-visuals/utils/formatUtil.js +472 -0
- package/lib/dashboard-visuals/utils/gridUtil.d.ts +11 -0
- package/lib/dashboard-visuals/utils/gridUtil.js +32 -0
- package/lib/dashboard-visuals/utils/index.d.ts +6 -0
- package/lib/dashboard-visuals/utils/index.js +6 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.d.ts +11 -0
- package/lib/dashboard-visuals/utils/tooltipUtils.js +180 -0
- package/lib/dashboard-visuals/visualRegistry.d.ts +4 -0
- package/lib/dashboard-visuals/visualRegistry.js +41 -0
- package/lib/dashboard-visuals/visuals/BarChart.d.ts +58 -0
- package/lib/dashboard-visuals/visuals/BarChart.js +95 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.d.ts +33 -0
- package/lib/dashboard-visuals/visuals/BarLineHybridChart.js +60 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/BubbleChart.js +101 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.d.ts +11 -0
- package/lib/dashboard-visuals/visuals/DistributionChart.js +48 -0
- package/lib/dashboard-visuals/visuals/DonutChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/DonutChart.js +105 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.d.ts +32 -0
- package/lib/dashboard-visuals/visuals/GaugeChart.js +53 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.d.ts +47 -0
- package/lib/dashboard-visuals/visuals/GroupedBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.d.ts +79 -0
- package/lib/dashboard-visuals/visuals/HeatmapChart.js +146 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/HorizontalBarChart.js +131 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.d.ts +30 -0
- package/lib/dashboard-visuals/visuals/ItemPerformanceCard.js +31 -0
- package/lib/dashboard-visuals/visuals/LineChart.d.ts +56 -0
- package/lib/dashboard-visuals/visuals/LineChart.js +80 -0
- package/lib/dashboard-visuals/visuals/LineGraph.d.ts +50 -0
- package/lib/dashboard-visuals/visuals/LineGraph.js +189 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/MetricSummaryCard.js +8 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.d.ts +39 -0
- package/lib/dashboard-visuals/visuals/MultiGaugeChart.js +119 -0
- package/lib/dashboard-visuals/visuals/PieChart.d.ts +59 -0
- package/lib/dashboard-visuals/visuals/PieChart.js +194 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.d.ts +14 -0
- package/lib/dashboard-visuals/visuals/SelectedEventTile.js +35 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.d.ts +53 -0
- package/lib/dashboard-visuals/visuals/SpeedometerChart.js +94 -0
- package/lib/dashboard-visuals/visuals/Table.d.ts +26 -0
- package/lib/dashboard-visuals/visuals/Table.js +113 -0
- package/lib/dashboard-visuals/visuals/Tile.d.ts +16 -0
- package/lib/dashboard-visuals/visuals/Tile.js +16 -0
- package/lib/dashboard-visuals/visuals/TreeMap.d.ts +25 -0
- package/lib/dashboard-visuals/visuals/TreeMap.js +45 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.d.ts +52 -0
- package/lib/dashboard-visuals/visuals/WaterfallChart.js +266 -0
- package/lib/form-engine/Form.d.ts +4 -0
- package/lib/form-engine/Form.js +14 -0
- package/lib/form-engine/FormEngine.d.ts +3 -0
- package/lib/form-engine/FormEngine.js +121 -0
- package/lib/form-engine/components/FieldWrapper.d.ts +18 -0
- package/lib/form-engine/components/FieldWrapper.js +63 -0
- package/lib/form-engine/components/index.d.ts +2 -0
- package/lib/form-engine/components/index.js +2 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.d.ts +16 -0
- package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.js +48 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.js +5 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.js +82 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/date-input/DateInput.js +7 -0
- package/lib/form-engine/components/inputs/date-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/date-input/index.js +1 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/email-input/EmailInput.js +5 -0
- package/lib/form-engine/components/inputs/email-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/email-input/index.js +1 -0
- package/lib/form-engine/components/inputs/index.d.ts +13 -0
- package/lib/form-engine/components/inputs/index.js +13 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/label-input/LabelInput.js +7 -0
- package/lib/form-engine/components/inputs/label-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/label-input/index.js +1 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/number-input/NumberInput.js +5 -0
- package/lib/form-engine/components/inputs/number-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/number-input/index.js +1 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/password-input/PasswordInput.js +9 -0
- package/lib/form-engine/components/inputs/password-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/password-input/index.js +1 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/radio-button/RadioInput.js +6 -0
- package/lib/form-engine/components/inputs/radio-button/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/radio-button/index.js +1 -0
- package/lib/form-engine/components/inputs/select/SelectInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/select/SelectInput.js +6 -0
- package/lib/form-engine/components/inputs/select/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/select/index.js +1 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/textarea-input/TextareaInput.js +5 -0
- package/lib/form-engine/components/inputs/textarea-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/textarea-input/index.js +1 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/time-input/TimeInput.js +5 -0
- package/lib/form-engine/components/inputs/time-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/time-input/index.js +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.d.ts +4 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.js +7 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/toggle-switch-input/index.js +1 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.d.ts +4 -0
- package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.js +59 -0
- package/lib/form-engine/components/inputs/upload-field/index.d.ts +1 -0
- package/lib/form-engine/components/inputs/upload-field/index.js +1 -0
- package/lib/form-engine/hooks/useFormPersistence.d.ts +11 -0
- package/lib/form-engine/hooks/useFormPersistence.js +46 -0
- package/lib/form-engine/index.d.ts +5 -0
- package/lib/form-engine/index.js +5 -0
- package/lib/form-engine/registry/RegisterComponents.d.ts +1 -0
- package/lib/form-engine/registry/RegisterComponents.js +35 -0
- package/lib/form-engine/registry/Registry.d.ts +5 -0
- package/lib/form-engine/registry/Registry.js +13 -0
- package/lib/form-engine/registry/index.d.ts +2 -0
- package/lib/form-engine/registry/index.js +2 -0
- package/lib/form-engine/types/index.d.ts +311 -0
- package/lib/form-engine/types/index.js +1 -0
- package/lib/helpers/index.d.ts +2 -0
- package/lib/helpers/index.js +2 -0
- package/lib/helpers/utils.d.ts +37 -0
- package/lib/helpers/utils.js +77 -0
- package/lib/helpers/validations.d.ts +80 -0
- package/lib/helpers/validations.js +39 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +30 -0
- package/lib/mocks/mockApiRequestsConfig.d.ts +2 -0
- package/lib/mocks/mockApiRequestsConfig.js +343 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.d.ts +14 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.js +40 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.d.ts +11 -0
- package/lib/pagamio-drawer/TopUpWalletDrawer/index.js +7 -0
- package/lib/pagamio-drawer/components/BaseDrawer.d.ts +11 -0
- package/lib/pagamio-drawer/components/BaseDrawer.js +10 -0
- package/lib/pagamio-drawer/components/DrawerContent.d.ts +27 -0
- package/lib/pagamio-drawer/components/DrawerContent.js +237 -0
- package/lib/pagamio-drawer/index.d.ts +22 -0
- package/lib/pagamio-drawer/index.js +133 -0
- package/lib/pagamio-table/data-table/ExportButton.d.ts +57 -0
- package/lib/pagamio-table/data-table/ExportButton.js +96 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.d.ts +44 -0
- package/lib/pagamio-table/data-table/MantineCoreTable.js +129 -0
- package/lib/pagamio-table/data-table/Pagination.d.ts +10 -0
- package/lib/pagamio-table/data-table/Pagination.js +5 -0
- package/lib/pagamio-table/data-table/TableDownload.d.ts +8 -0
- package/lib/pagamio-table/data-table/TableDownload.js +81 -0
- package/lib/pagamio-table/data-table/TableToolbar.d.ts +3 -0
- package/lib/pagamio-table/data-table/TableToolbar.js +16 -0
- package/lib/pagamio-table/data-table/exportUtils.d.ts +42 -0
- package/lib/pagamio-table/data-table/exportUtils.js +782 -0
- package/lib/pagamio-table/data-table/index.d.ts +5 -0
- package/lib/pagamio-table/data-table/index.js +11 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.d.ts +111 -0
- package/lib/pagamio-table/data-table/pdfExportUtils.js +113 -0
- package/lib/pagamio-table/data-table/types.d.ts +169 -0
- package/lib/pagamio-table/data-table/types.js +1 -0
- package/lib/pagamio-table/index.d.ts +4 -0
- package/lib/pagamio-table/index.js +4 -0
- package/lib/pagamio-table/utils/functionHelper.d.ts +12 -0
- package/lib/pagamio-table/utils/functionHelper.js +24 -0
- package/lib/pagamio-table/utils/index.d.ts +1 -0
- package/lib/pagamio-table/utils/index.js +1 -0
- package/lib/rbac/hooks.d.ts +39 -0
- package/lib/rbac/hooks.js +51 -0
- package/lib/rbac/index.d.ts +8 -0
- package/lib/rbac/index.js +11 -0
- package/lib/rbac/store.d.ts +24 -0
- package/lib/rbac/store.js +37 -0
- package/lib/rbac/types.d.ts +39 -0
- package/lib/rbac/types.js +4 -0
- package/lib/rbac/utils.d.ts +44 -0
- package/lib/rbac/utils.js +117 -0
- package/lib/shared/constants/index.d.ts +2 -0
- package/lib/shared/constants/index.js +2 -0
- package/lib/shared/hooks/index.d.ts +4 -0
- package/lib/shared/hooks/index.js +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.d.ts +4 -0
- package/lib/shared/hooks/useAnyDrawerOpen.js +18 -0
- package/lib/shared/hooks/useContainerWidth.d.ts +2 -0
- package/lib/shared/hooks/useContainerWidth.js +18 -0
- package/lib/shared/hooks/useImageUpload.d.ts +15 -0
- package/lib/shared/hooks/useImageUpload.js +66 -0
- package/lib/shared/hooks/useMediaQueries.d.ts +5 -0
- package/lib/shared/hooks/useMediaQueries.js +35 -0
- package/lib/shared/hooks/usePagamioTable.d.ts +158 -0
- package/lib/shared/hooks/usePagamioTable.js +475 -0
- package/lib/shared/hooks/useSessionTimer.d.ts +33 -0
- package/lib/shared/hooks/useSessionTimer.js +96 -0
- package/lib/shared/index.d.ts +4 -0
- package/lib/shared/index.js +4 -0
- package/lib/shared/types/index.d.ts +1 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/shared/url/index.d.ts +9 -0
- package/lib/shared/url/index.js +20 -0
- package/lib/shared/utils/filterUtils.d.ts +5 -0
- package/lib/shared/utils/filterUtils.js +31 -0
- package/lib/shared/utils/functionHelper.d.ts +27 -0
- package/lib/shared/utils/functionHelper.js +124 -0
- package/lib/shared/utils/index.d.ts +2 -0
- package/lib/shared/utils/index.js +2 -0
- package/lib/shared/utils/localStorage.d.ts +53 -0
- package/lib/shared/utils/localStorage.js +139 -0
- package/lib/styles.css +6247 -0
- package/lib/translations/components/LocaleSwitcher.d.ts +7 -0
- package/lib/translations/components/LocaleSwitcher.js +18 -0
- package/lib/translations/components/index.d.ts +1 -0
- package/lib/translations/components/index.js +1 -0
- package/lib/translations/context/TranslationContext.d.ts +5 -0
- package/lib/translations/context/TranslationContext.js +151 -0
- package/lib/translations/context/index.d.ts +1 -0
- package/lib/translations/context/index.js +1 -0
- package/lib/translations/hooks/index.d.ts +2 -0
- package/lib/translations/hooks/index.js +2 -0
- package/lib/translations/hooks/useLibTranslations.d.ts +7 -0
- package/lib/translations/hooks/useLibTranslations.js +46 -0
- package/lib/translations/hooks/useTranslation.d.ts +7 -0
- package/lib/translations/hooks/useTranslation.js +11 -0
- package/lib/translations/index.d.ts +91 -0
- package/lib/translations/index.js +11 -0
- package/lib/translations/locales/en.json +21 -0
- package/lib/translations/locales/es.json +21 -0
- package/lib/translations/locales/fr.json +21 -0
- package/lib/translations/locales/pt.json +21 -0
- package/lib/translations/types/index.d.ts +24 -0
- package/lib/translations/types/index.js +1 -0
- package/lib/translations/utils/index.d.ts +6 -0
- package/lib/translations/utils/index.js +25 -0
- package/package.json +9 -1
package/lib/api/swr.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview SWR integration for the API client
|
|
3
|
+
*/
|
|
4
|
+
import useSWR, { mutate } from 'swr';
|
|
5
|
+
import { useApi } from './context';
|
|
6
|
+
// Default SWR configuration
|
|
7
|
+
const DEFAULT_SWR_CONFIG = {
|
|
8
|
+
revalidateOnFocus: false,
|
|
9
|
+
revalidateOnReconnect: false,
|
|
10
|
+
shouldRetryOnError: true,
|
|
11
|
+
errorRetryInterval: 10000,
|
|
12
|
+
// Increase to prevent new requests on same resources
|
|
13
|
+
dedupingInterval: 300000, // 5 minutes
|
|
14
|
+
revalidateIfStale: false,
|
|
15
|
+
revalidateOnMount: true,
|
|
16
|
+
// Prevent automatic polling
|
|
17
|
+
refreshInterval: 0,
|
|
18
|
+
refreshWhenHidden: false,
|
|
19
|
+
refreshWhenOffline: false,
|
|
20
|
+
// Use stale data by default to reduce server load
|
|
21
|
+
keepPreviousData: true,
|
|
22
|
+
focusThrottleInterval: 60000,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Creates a fetcher function using the existing ApiClient
|
|
26
|
+
* @template ResponseData - Expected response type
|
|
27
|
+
*/
|
|
28
|
+
const createApiFetcher = () => {
|
|
29
|
+
const api = useApi();
|
|
30
|
+
return async (key, config) => {
|
|
31
|
+
const url = Array.isArray(key) ? key[0] : key;
|
|
32
|
+
if (typeof url !== 'string') {
|
|
33
|
+
throw new Error('Only string keys are supported');
|
|
34
|
+
}
|
|
35
|
+
// Handle different HTTP methods
|
|
36
|
+
switch (config?.method) {
|
|
37
|
+
case 'POST':
|
|
38
|
+
return api.post(url, config.body ? JSON.parse(config.body.toString()) : undefined, { ...config });
|
|
39
|
+
case 'PUT':
|
|
40
|
+
return api.put(url, config.body ? JSON.parse(config.body.toString()) : undefined, { ...config });
|
|
41
|
+
case 'PATCH':
|
|
42
|
+
return api.patch(url, config.body ? JSON.parse(config.body.toString()) : undefined, {
|
|
43
|
+
...config,
|
|
44
|
+
});
|
|
45
|
+
case 'DELETE':
|
|
46
|
+
return api.delete(url, { ...config });
|
|
47
|
+
default:
|
|
48
|
+
return api.get(url, { ...config });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Main SWR hook that automatically inherits auth config
|
|
54
|
+
* @template ResponseData - Type of the expected response data
|
|
55
|
+
* @template ErrorData - Type of the error response (defaults to ApiErrorResponse)
|
|
56
|
+
*/
|
|
57
|
+
export function useApiSWR(endpoint, config) {
|
|
58
|
+
const fetcher = createApiFetcher();
|
|
59
|
+
const { params, skipAuth, skipRetry, skipRefresh, isProtected,
|
|
60
|
+
// Extract SWR-specific config
|
|
61
|
+
...swrConfig } = config || {};
|
|
62
|
+
const requestConfig = {
|
|
63
|
+
params,
|
|
64
|
+
skipAuth,
|
|
65
|
+
skipRetry,
|
|
66
|
+
skipRefresh,
|
|
67
|
+
isProtected,
|
|
68
|
+
};
|
|
69
|
+
const mergedConfig = {
|
|
70
|
+
...DEFAULT_SWR_CONFIG,
|
|
71
|
+
...swrConfig,
|
|
72
|
+
};
|
|
73
|
+
return useSWR(endpoint, (url) => fetcher(url, { ...requestConfig, ...config }), mergedConfig);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Paginated SWR hook that inherits auth config
|
|
77
|
+
* @template ItemType - Type of items in the paginated response
|
|
78
|
+
* @template ResponseType - Type of the full response (defaults to SpringBootResponse)
|
|
79
|
+
*/
|
|
80
|
+
export function usePaginatedApiSWR(endpoint, config) {
|
|
81
|
+
return useApiSWR(endpoint, config);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Mutation hook that inherits auth config
|
|
85
|
+
* @template ResponseData - Type of the expected response data
|
|
86
|
+
*/
|
|
87
|
+
export function useApiMutation() {
|
|
88
|
+
const api = useApi();
|
|
89
|
+
return {
|
|
90
|
+
post: async (endpoint, data, config) => {
|
|
91
|
+
const response = await api.post(endpoint, data, config);
|
|
92
|
+
await mutate(endpoint, response, false);
|
|
93
|
+
return response;
|
|
94
|
+
},
|
|
95
|
+
put: async (endpoint, data, config) => {
|
|
96
|
+
const response = await api.put(endpoint, data, config);
|
|
97
|
+
await mutate(endpoint, response, false);
|
|
98
|
+
return response;
|
|
99
|
+
},
|
|
100
|
+
patch: async (endpoint, data, config) => {
|
|
101
|
+
const response = await api.patch(endpoint, data, config);
|
|
102
|
+
await mutate(endpoint, response, false);
|
|
103
|
+
return response;
|
|
104
|
+
},
|
|
105
|
+
delete: async (endpoint, config) => {
|
|
106
|
+
const response = await api.delete(endpoint, config);
|
|
107
|
+
await mutate(endpoint, null, false);
|
|
108
|
+
return response;
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Combined SWR and mutation hook
|
|
114
|
+
* @template ResponseData - Type of the expected response data
|
|
115
|
+
*/
|
|
116
|
+
export function useApiSWRWithMutation(endpoint, config) {
|
|
117
|
+
const swr = useApiSWR(endpoint, config);
|
|
118
|
+
const mutation = useApiMutation();
|
|
119
|
+
return {
|
|
120
|
+
...swr,
|
|
121
|
+
mutate: mutation,
|
|
122
|
+
refresh: () => mutate(endpoint),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { CustomAuthConfig, TokenManager } from '../auth';
|
|
2
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
|
+
export interface ApiErrorResponse {
|
|
4
|
+
error?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
status?: number;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare class ApiError extends Error {
|
|
10
|
+
status: number;
|
|
11
|
+
data?: unknown;
|
|
12
|
+
constructor(message: string, status: number, data?: unknown);
|
|
13
|
+
}
|
|
14
|
+
export interface ApiClientConfig<T extends CustomAuthConfig> {
|
|
15
|
+
baseURL: string;
|
|
16
|
+
tokenManager?: TokenManager<T>;
|
|
17
|
+
defaultHeaders?: HeadersInit;
|
|
18
|
+
timeout?: number;
|
|
19
|
+
retries?: number;
|
|
20
|
+
retryDelay?: number;
|
|
21
|
+
onRequest?: (config: RequestInit) => Promise<RequestInit> | RequestInit;
|
|
22
|
+
onResponse?: <T>(response: Response, data: T) => Promise<T> | T;
|
|
23
|
+
onError?: (error: ApiError) => Promise<void> | void;
|
|
24
|
+
onUnauthorized?: () => Promise<void> | void;
|
|
25
|
+
}
|
|
26
|
+
export interface RequestConfig extends RequestInit {
|
|
27
|
+
params?: Record<string, string>;
|
|
28
|
+
timeout?: number;
|
|
29
|
+
retries?: number;
|
|
30
|
+
skipAuth?: boolean;
|
|
31
|
+
skipRetry?: boolean;
|
|
32
|
+
skipRefresh?: boolean;
|
|
33
|
+
isProtected?: boolean;
|
|
34
|
+
signal?: AbortSignal | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Spring Boot style paginated response interface
|
|
38
|
+
*/
|
|
39
|
+
export interface SpringBootResponse<T> {
|
|
40
|
+
content: T[];
|
|
41
|
+
pageable: {
|
|
42
|
+
sort: {
|
|
43
|
+
empty: boolean;
|
|
44
|
+
sorted: boolean;
|
|
45
|
+
unsorted: boolean;
|
|
46
|
+
};
|
|
47
|
+
offset: number;
|
|
48
|
+
pageNumber: number;
|
|
49
|
+
pageSize: number;
|
|
50
|
+
paged: boolean;
|
|
51
|
+
unpaged: boolean;
|
|
52
|
+
};
|
|
53
|
+
totalElements: number;
|
|
54
|
+
totalPages: number;
|
|
55
|
+
last: boolean;
|
|
56
|
+
size: number;
|
|
57
|
+
number: number;
|
|
58
|
+
sort: {
|
|
59
|
+
empty: boolean;
|
|
60
|
+
sorted: boolean;
|
|
61
|
+
unsorted: boolean;
|
|
62
|
+
};
|
|
63
|
+
first: boolean;
|
|
64
|
+
numberOfElements: number;
|
|
65
|
+
empty: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Configuration for mapping API response structure
|
|
69
|
+
*/
|
|
70
|
+
export interface ResponseMapping {
|
|
71
|
+
/** Path to data array in response (e.g., 'content' or 'data.items') */
|
|
72
|
+
data?: string;
|
|
73
|
+
/** Path to total count (e.g., 'totalElements' or 'meta.total') */
|
|
74
|
+
total?: string;
|
|
75
|
+
/** Path to current page number */
|
|
76
|
+
page?: string;
|
|
77
|
+
/** Path to page size */
|
|
78
|
+
pageSize?: string;
|
|
79
|
+
/** Default values when paths are not found */
|
|
80
|
+
defaultValues?: {
|
|
81
|
+
data: any[];
|
|
82
|
+
total: number;
|
|
83
|
+
page: number;
|
|
84
|
+
pageSize: number;
|
|
85
|
+
};
|
|
86
|
+
/** Type of response structure */
|
|
87
|
+
responseType?: 'default' | 'spring-boot';
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for query parameter formatting
|
|
91
|
+
*/
|
|
92
|
+
export interface QueryParamConfig {
|
|
93
|
+
pagination?: {
|
|
94
|
+
/** Parameter name for page number (default: 'page') */
|
|
95
|
+
pageParam?: string;
|
|
96
|
+
/** Parameter name for page size (default: 'size') */
|
|
97
|
+
sizeParam?: string;
|
|
98
|
+
/** Custom transform function for pagination parameters */
|
|
99
|
+
transform?: (page: number, size: number) => Record<string, string>;
|
|
100
|
+
};
|
|
101
|
+
sorting?: {
|
|
102
|
+
/** Parameter name for sort field (default: 'sortBy') */
|
|
103
|
+
sortByParam?: string;
|
|
104
|
+
/** Parameter name for sort direction (default: 'sortDir') */
|
|
105
|
+
sortDirParam?: string;
|
|
106
|
+
/** Custom transform function for sorting parameters */
|
|
107
|
+
transform?: (sortBy: string, sortDir: string) => Record<string, string>;
|
|
108
|
+
};
|
|
109
|
+
filtering?: {
|
|
110
|
+
/** Parameter name for search query (default: 'searchQuery') */
|
|
111
|
+
searchParam?: string;
|
|
112
|
+
/** Format for filter parameters */
|
|
113
|
+
filterFormat?: 'bracket' | 'flat' | 'prefix' | 'custom';
|
|
114
|
+
/** Prefix for filter parameters when using 'prefix' format */
|
|
115
|
+
filterPrefix?: string;
|
|
116
|
+
/** Custom transform function for filter parameters */
|
|
117
|
+
transform?: (filters: Record<string, string>) => Record<string, string>;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents a single mock configuration for an API request.
|
|
122
|
+
*/
|
|
123
|
+
export interface MockConfig {
|
|
124
|
+
/**
|
|
125
|
+
* The path of the API endpoint (e.g., "/dashboard/metrics").
|
|
126
|
+
*/
|
|
127
|
+
path: string;
|
|
128
|
+
/**
|
|
129
|
+
* The HTTP method (e.g., "GET", "POST", "PUT", "DELETE").
|
|
130
|
+
*/
|
|
131
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
132
|
+
/**
|
|
133
|
+
* The query parameters or payload expected in the request.
|
|
134
|
+
* If undefined, the mock will match any request to the path and method.
|
|
135
|
+
*/
|
|
136
|
+
params?: Record<string, any> | any[];
|
|
137
|
+
/**
|
|
138
|
+
* The mock response to return when the request matches.
|
|
139
|
+
*/
|
|
140
|
+
response: any;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Type for the `mockConfig` prop, which is an array of `MockConfig` objects.
|
|
144
|
+
*/
|
|
145
|
+
export type MockConfigArray = MockConfig[];
|
package/lib/api/types.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Factory for creating authenticator processors
|
|
3
|
+
* Provides a central registry for different authentication processors
|
|
4
|
+
*/
|
|
5
|
+
import type { CustomAuthConfig } from '../types';
|
|
6
|
+
import { type AuthenticatorProcessor, AuthenticatorType } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Factory class for creating authenticator processors
|
|
9
|
+
* Maintains a registry of processor implementations and creates instances on demand
|
|
10
|
+
*/
|
|
11
|
+
export declare class AuthenticatorFactory {
|
|
12
|
+
private static processors;
|
|
13
|
+
/**
|
|
14
|
+
* Gets an authenticator processor by type
|
|
15
|
+
* @param type - The type of authenticator to get
|
|
16
|
+
* @returns An authenticator processor instance
|
|
17
|
+
*/
|
|
18
|
+
static getProcessor<T extends CustomAuthConfig>(type?: AuthenticatorType | string): AuthenticatorProcessor<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a new authenticator processor
|
|
21
|
+
* @param type - The type identifier for this processor
|
|
22
|
+
* @param processorClass - The processor class constructor
|
|
23
|
+
*/
|
|
24
|
+
static registerProcessor(type: string, processorClass: new <T extends CustomAuthConfig>() => AuthenticatorProcessor<T>): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DefaultAuthenticatorProcessor } from './processors/DefaultAuthenticatorProcessor';
|
|
2
|
+
import { StrapiAuthenticatorProcessor } from './processors/StrapiAuthenticatorProcessor';
|
|
3
|
+
import { AuthenticatorType } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Factory class for creating authenticator processors
|
|
6
|
+
* Maintains a registry of processor implementations and creates instances on demand
|
|
7
|
+
*/
|
|
8
|
+
export class AuthenticatorFactory {
|
|
9
|
+
// Registry of authenticator processor constructors
|
|
10
|
+
static processors = {
|
|
11
|
+
[AuthenticatorType.DEFAULT]: DefaultAuthenticatorProcessor,
|
|
12
|
+
[AuthenticatorType.STRAPI]: StrapiAuthenticatorProcessor,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Gets an authenticator processor by type
|
|
16
|
+
* @param type - The type of authenticator to get
|
|
17
|
+
* @returns An authenticator processor instance
|
|
18
|
+
*/
|
|
19
|
+
static getProcessor(type) {
|
|
20
|
+
// If no type specified or type not found, return the default processor
|
|
21
|
+
const ProcessorClass = type && this.processors[type] ? this.processors[type] : this.processors[AuthenticatorType.DEFAULT];
|
|
22
|
+
return new ProcessorClass();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Registers a new authenticator processor
|
|
26
|
+
* @param type - The type identifier for this processor
|
|
27
|
+
* @param processorClass - The processor class constructor
|
|
28
|
+
*/
|
|
29
|
+
static registerProcessor(type, processorClass) {
|
|
30
|
+
this.processors[type] = processorClass;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Default authenticator processor implementation
|
|
3
|
+
* Handles standard authentication flows without special transformations
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthResponse, CustomAuthConfig } from '../../types';
|
|
6
|
+
import type { AuthenticatorProcessor } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Default authenticator processor
|
|
9
|
+
* Handles the standard authentication process with basic validation
|
|
10
|
+
* @template T - Type extending CustomAuthConfig
|
|
11
|
+
*/
|
|
12
|
+
export declare class DefaultAuthenticatorProcessor<T extends CustomAuthConfig> implements AuthenticatorProcessor<T> {
|
|
13
|
+
/**
|
|
14
|
+
* Process login credentials using the standard authentication flow
|
|
15
|
+
* @param credentials - User login credentials
|
|
16
|
+
* @param rememberMe - Whether to remember the user session
|
|
17
|
+
* @param login - The login function from auth context
|
|
18
|
+
* @returns Promise resolving to authentication response
|
|
19
|
+
*/
|
|
20
|
+
processLogin(credentials: Record<string, unknown>, rememberMe: boolean, login: (credentials: T['Credentials'], rememberMe: boolean) => Promise<AuthResponse<T>>): Promise<AuthResponse<T>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default authenticator processor
|
|
3
|
+
* Handles the standard authentication process with basic validation
|
|
4
|
+
* @template T - Type extending CustomAuthConfig
|
|
5
|
+
*/
|
|
6
|
+
export class DefaultAuthenticatorProcessor {
|
|
7
|
+
/**
|
|
8
|
+
* Process login credentials using the standard authentication flow
|
|
9
|
+
* @param credentials - User login credentials
|
|
10
|
+
* @param rememberMe - Whether to remember the user session
|
|
11
|
+
* @param login - The login function from auth context
|
|
12
|
+
* @returns Promise resolving to authentication response
|
|
13
|
+
*/
|
|
14
|
+
async processLogin(credentials, rememberMe, login) {
|
|
15
|
+
// Validate the credentials to ensure required fields are present
|
|
16
|
+
if (!credentials || typeof credentials !== 'object') {
|
|
17
|
+
throw new Error('Invalid login data: Credentials must be an object');
|
|
18
|
+
}
|
|
19
|
+
const requiredKeys = Object.keys(credentials);
|
|
20
|
+
if (requiredKeys.length === 0) {
|
|
21
|
+
throw new Error('Invalid login data: No credentials provided');
|
|
22
|
+
}
|
|
23
|
+
// Use type assertion to satisfy the login function parameter type
|
|
24
|
+
return login(credentials, rememberMe);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Strapi authenticator processor implementation
|
|
3
|
+
* Handles Strapi-specific authentication flows
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthResponse, CustomAuthConfig } from '../../types';
|
|
6
|
+
import type { AuthenticatorProcessor } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Strapi user structure
|
|
9
|
+
*/
|
|
10
|
+
export interface StrapiUser {
|
|
11
|
+
id: number;
|
|
12
|
+
documentId: string;
|
|
13
|
+
username: string;
|
|
14
|
+
email: string;
|
|
15
|
+
provider: string;
|
|
16
|
+
confirmed: boolean;
|
|
17
|
+
blocked: boolean;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
publishedAt: string;
|
|
21
|
+
firstName: string;
|
|
22
|
+
lastName: string;
|
|
23
|
+
company: string;
|
|
24
|
+
isFirstTimeLogin: boolean;
|
|
25
|
+
hasCompletedOnboarding: boolean;
|
|
26
|
+
hasSkippedOnboarding: boolean;
|
|
27
|
+
onBoardingReminderTime: string;
|
|
28
|
+
loginCount: number;
|
|
29
|
+
lastLoginAt: string;
|
|
30
|
+
role: {
|
|
31
|
+
id: number;
|
|
32
|
+
documentId: string;
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
type: string;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
publishedAt: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Strapi authentication response structure
|
|
43
|
+
*/
|
|
44
|
+
export interface StrapiAuthResponse {
|
|
45
|
+
jwt: string;
|
|
46
|
+
user: StrapiUser;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Transforms a valid Strapi response into our application's auth response format
|
|
50
|
+
* @param strapiResponse - Validated Strapi auth response
|
|
51
|
+
* @returns Transformed auth response
|
|
52
|
+
*/
|
|
53
|
+
export declare function transformStrapiResponse<T extends CustomAuthConfig>(strapiResponse: StrapiAuthResponse): AuthResponse<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Validates if the response is a valid Strapi authentication response
|
|
56
|
+
* @param response - API response to validate
|
|
57
|
+
* @returns Boolean indicating if response is a valid Strapi auth response
|
|
58
|
+
*/
|
|
59
|
+
export declare function isStrapiAuthResponse(response: unknown): response is StrapiAuthResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Strapi authenticator processor
|
|
62
|
+
* Handles authentication process specific to Strapi backend
|
|
63
|
+
* @template T - Type extending CustomAuthConfig
|
|
64
|
+
*/
|
|
65
|
+
export declare class StrapiAuthenticatorProcessor<T extends CustomAuthConfig> implements AuthenticatorProcessor<T> {
|
|
66
|
+
/**
|
|
67
|
+
* Process login credentials using the Strapi authentication flow
|
|
68
|
+
* @param credentials - User login credentials
|
|
69
|
+
* @param rememberMe - Whether to remember the user session
|
|
70
|
+
* @param login - The login function from auth context
|
|
71
|
+
* @returns Promise resolving to authentication response
|
|
72
|
+
*/
|
|
73
|
+
processLogin(credentials: Record<string, unknown>, rememberMe: boolean, login: (credentials: T['Credentials'], rememberMe: boolean) => Promise<AuthResponse<T>>): Promise<AuthResponse<T>>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transforms a valid Strapi response into our application's auth response format
|
|
3
|
+
* @param strapiResponse - Validated Strapi auth response
|
|
4
|
+
* @returns Transformed auth response
|
|
5
|
+
*/
|
|
6
|
+
export function transformStrapiResponse(strapiResponse) {
|
|
7
|
+
// Create a new user object that conforms to T['UserInfo']
|
|
8
|
+
// This approach avoids direct type assertion of the entire object
|
|
9
|
+
const userInfo = {
|
|
10
|
+
id: strapiResponse.user.id,
|
|
11
|
+
userName: strapiResponse.user.username,
|
|
12
|
+
firstName: strapiResponse.user.firstName,
|
|
13
|
+
lastName: strapiResponse.user.lastName,
|
|
14
|
+
email: strapiResponse.user.email,
|
|
15
|
+
blocked: strapiResponse.user.blocked,
|
|
16
|
+
company: strapiResponse.user.company,
|
|
17
|
+
isFirstTimeLogin: strapiResponse.user.isFirstTimeLogin,
|
|
18
|
+
hasCompletedOnboarding: strapiResponse.user.hasCompletedOnboarding,
|
|
19
|
+
hasSkippedOnboarding: strapiResponse.user.hasSkippedOnboarding,
|
|
20
|
+
onBoardingReminderTime: strapiResponse.user.onBoardingReminderTime,
|
|
21
|
+
loginCount: strapiResponse.user.loginCount,
|
|
22
|
+
roleName: strapiResponse.user.role.name,
|
|
23
|
+
roleCode: strapiResponse.user.role.type,
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
user: userInfo,
|
|
27
|
+
auth: {
|
|
28
|
+
accessToken: {
|
|
29
|
+
token: strapiResponse.jwt,
|
|
30
|
+
expiresIn: 36000000, // Default to 10 hours if not provided
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates if the response is a valid Strapi authentication response
|
|
37
|
+
* @param response - API response to validate
|
|
38
|
+
* @returns Boolean indicating if response is a valid Strapi auth response
|
|
39
|
+
*/
|
|
40
|
+
export function isStrapiAuthResponse(response) {
|
|
41
|
+
if (!response || typeof response !== 'object') {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const potentialStrapiResponse = response;
|
|
45
|
+
// Check if jwt exists and is a non-empty string
|
|
46
|
+
if (typeof potentialStrapiResponse.jwt !== 'string' || potentialStrapiResponse.jwt.trim() === '') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
// Check if user exists and is an object
|
|
50
|
+
if (!potentialStrapiResponse.user || typeof potentialStrapiResponse.user !== 'object') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// Optional: Add additional validation for critical user properties
|
|
54
|
+
// For example, check if required user fields are present
|
|
55
|
+
const user = potentialStrapiResponse.user;
|
|
56
|
+
if (typeof user.id !== 'number' || typeof user.email !== 'string' || user.email?.trim() === '') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Strapi authenticator processor
|
|
63
|
+
* Handles authentication process specific to Strapi backend
|
|
64
|
+
* @template T - Type extending CustomAuthConfig
|
|
65
|
+
*/
|
|
66
|
+
export class StrapiAuthenticatorProcessor {
|
|
67
|
+
/**
|
|
68
|
+
* Process login credentials using the Strapi authentication flow
|
|
69
|
+
* @param credentials - User login credentials
|
|
70
|
+
* @param rememberMe - Whether to remember the user session
|
|
71
|
+
* @param login - The login function from auth context
|
|
72
|
+
* @returns Promise resolving to authentication response
|
|
73
|
+
*/
|
|
74
|
+
async processLogin(credentials, rememberMe, login) {
|
|
75
|
+
// Strapi typically expects credentials in identifier/password format
|
|
76
|
+
// Adapt the credentials if needed for Strapi API
|
|
77
|
+
const strapiCredentials = {};
|
|
78
|
+
// If username is provided, map it to identifier
|
|
79
|
+
if ('username' in credentials) {
|
|
80
|
+
strapiCredentials.identifier = credentials.username;
|
|
81
|
+
}
|
|
82
|
+
// Copy the password
|
|
83
|
+
if ('password' in credentials) {
|
|
84
|
+
strapiCredentials.password = credentials.password;
|
|
85
|
+
}
|
|
86
|
+
// Copy any additional fields
|
|
87
|
+
Object.entries(credentials).forEach(([key, value]) => {
|
|
88
|
+
if (key !== 'username' && !strapiCredentials[key]) {
|
|
89
|
+
strapiCredentials[key] = value;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// Validate the credentials
|
|
93
|
+
if (!strapiCredentials.identifier || !strapiCredentials.password) {
|
|
94
|
+
throw new Error('Invalid Strapi login data: identifier and password are required');
|
|
95
|
+
}
|
|
96
|
+
// Use type assertion to satisfy the login function parameter type
|
|
97
|
+
return login(strapiCredentials, rememberMe);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Defines interfaces for authentication processors
|
|
3
|
+
* Provides type definitions for the authenticator factory pattern
|
|
4
|
+
*/
|
|
5
|
+
import type { AuthResponse, CustomAuthConfig } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Interface for authentication processor
|
|
8
|
+
* Defines the contract that all authentication processors must implement
|
|
9
|
+
*/
|
|
10
|
+
export interface AuthenticatorProcessor<T extends CustomAuthConfig> {
|
|
11
|
+
/**
|
|
12
|
+
* Process login credentials and authenticate with the appropriate service
|
|
13
|
+
* @param credentials - User login credentials
|
|
14
|
+
* @param rememberMe - Whether to remember the user session
|
|
15
|
+
* @param login - The login function from auth context
|
|
16
|
+
* @returns Promise resolving to authentication response
|
|
17
|
+
*/
|
|
18
|
+
processLogin(credentials: Record<string, unknown>, rememberMe: boolean, login: (credentials: T['Credentials'], rememberMe: boolean) => Promise<AuthResponse<T>>): Promise<AuthResponse<T>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Types of authenticators supported by the system
|
|
22
|
+
*/
|
|
23
|
+
export declare enum AuthenticatorType {
|
|
24
|
+
DEFAULT = "default",
|
|
25
|
+
STRAPI = "strapi"
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of authenticators supported by the system
|
|
3
|
+
*/
|
|
4
|
+
export var AuthenticatorType;
|
|
5
|
+
(function (AuthenticatorType) {
|
|
6
|
+
AuthenticatorType["DEFAULT"] = "default";
|
|
7
|
+
AuthenticatorType["STRAPI"] = "strapi";
|
|
8
|
+
// Add more authenticator types as needed
|
|
9
|
+
})(AuthenticatorType || (AuthenticatorType = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const AppBanner = ({ text = 'EVENTS!', backgroundColor = '#b45dae' }) => {
|
|
3
|
+
return (_jsx("div", { className: "flex w-full justify-end mr-[29%] mt-[-7%]", children: _jsx("div", { className: "inline-block px-6 py-2 text-white font-bold uppercase text-[15px] relative bg-primary-500", style: {
|
|
4
|
+
// backgroundColor: backgroundColor,
|
|
5
|
+
// This clip-path creates the right arrow shape
|
|
6
|
+
clipPath: 'polygon(14% 18%, 85% 18%, 97% 51%, 85% 85%, 14% 85%)',
|
|
7
|
+
}, children: text }) }));
|
|
8
|
+
};
|
|
9
|
+
export default AppBanner;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
interface AuthCardProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
horizontal?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function AuthCard({ children, className, horizontal }: Readonly<AuthCardProps>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from 'flowbite-react';
|
|
3
|
+
export function AuthCard({ children, className = '', horizontal = true }) {
|
|
4
|
+
return (_jsx(Card, { horizontal: horizontal, className: `w-full ${className}`, theme: {
|
|
5
|
+
root: {
|
|
6
|
+
children: 'my-auto w-full gap-0 space-y-6 p-4 sm:p-6 lg:p-8',
|
|
7
|
+
},
|
|
8
|
+
img: {
|
|
9
|
+
horizontal: {
|
|
10
|
+
on: 'hidden w-2/3 rounded-l-lg md:w-96 md:p-0 lg:block',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
}, children: children }));
|
|
14
|
+
}
|