@liorian/sdk 0.28.0-alpha.56010ca
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/README.md +483 -0
- package/package.json +94 -0
- package/schemas/module.schema.json +818 -0
- package/src/application/index.ts +3 -0
- package/src/application/module-instance.ts +36 -0
- package/src/application/service/auth-api-service.ts +291 -0
- package/src/application/service/auth-user.service.ts +108 -0
- package/src/application/service/index.ts +12 -0
- package/src/application/service/module-activation-api.service.ts +105 -0
- package/src/application/service/notifications-api-service.ts +38 -0
- package/src/application/service/notifications-push.service.ts +299 -0
- package/src/application/service/notifications-socket-service.ts +76 -0
- package/src/application/service/organizations-api-service.ts +104 -0
- package/src/application/service/otp-api-service.ts +11 -0
- package/src/application/service/storage-api-service.ts +77 -0
- package/src/application/service/storefront-api.service.ts +72 -0
- package/src/application/service/user-preferences-api.service.ts +57 -0
- package/src/domain/config/app.config.ts +35 -0
- package/src/domain/config/auth.config.ts +30 -0
- package/src/domain/config/index.ts +4 -0
- package/src/domain/config/logo.config.ts +17 -0
- package/src/domain/entities/activities.interface.ts +18 -0
- package/src/domain/entities/catalog.interface.ts +96 -0
- package/src/domain/entities/index.ts +13 -0
- package/src/domain/entities/media.ts +22 -0
- package/src/domain/entities/module-activation.interface.ts +173 -0
- package/src/domain/entities/module.interface.ts +101 -0
- package/src/domain/entities/notification.interface.ts +23 -0
- package/src/domain/entities/objectable.type.ts +3 -0
- package/src/domain/entities/organization.interface.ts +81 -0
- package/src/domain/entities/user-auth.interface.ts +17 -0
- package/src/domain/entities/user-phone.interface.ts +11 -0
- package/src/domain/entities/user-profile.interface.ts +23 -0
- package/src/domain/entities/user.interface.ts +79 -0
- package/src/domain/enums/coloring.enum.ts +6 -0
- package/src/domain/enums/domains.enum.ts +282 -0
- package/src/domain/enums/index.ts +8 -0
- package/src/domain/enums/module-category.enum.ts +57 -0
- package/src/domain/enums/module.enum.ts +97 -0
- package/src/domain/enums/routine.enum.ts +12 -0
- package/src/domain/enums/user-profile.enum.ts +25 -0
- package/src/domain/enums/user-status.enum.ts +7 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/typing/auth-caches.ts +12 -0
- package/src/domain/typing/auth-oauth.types.ts +172 -0
- package/src/domain/typing/devise.ts +2 -0
- package/src/domain/typing/index.ts +10 -0
- package/src/domain/typing/response.ts +30 -0
- package/src/domain/typing/routine.types.ts +113 -0
- package/src/domain/typing/session.interface.ts +28 -0
- package/src/domain/typing/statisticals.ts +11 -0
- package/src/domain/typing/user-media-upload.ts +9 -0
- package/src/domain/typing/values.ts +6 -0
- package/src/index.tsx +168 -0
- package/src/infrastructure/capabilities/cache-storage/capability.ts +129 -0
- package/src/infrastructure/capabilities/cache-storage/enum.ts +5 -0
- package/src/infrastructure/capabilities/cache-storage/index.ts +4 -0
- package/src/infrastructure/capabilities/cache-storage/types.ts +13 -0
- package/src/infrastructure/capabilities/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/capability.ts +55 -0
- package/src/infrastructure/capabilities/stackable/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/types.ts +24 -0
- package/src/infrastructure/common-classname.constant.ts +4 -0
- package/src/infrastructure/data/countries.ts +208 -0
- package/src/infrastructure/data/gender.ts +5 -0
- package/src/infrastructure/data/index.ts +3 -0
- package/src/infrastructure/dataset/index.ts +3 -0
- package/src/infrastructure/dataset/sign-in.dataset.ts +21 -0
- package/src/infrastructure/dataset/sign-up.dataset.ts +64 -0
- package/src/infrastructure/hooks/index.ts +10 -0
- package/src/infrastructure/hooks/use-activity-lock-draft.ts +69 -0
- package/src/infrastructure/hooks/use-auth.ts +24 -0
- package/src/infrastructure/hooks/use-elastic-interaction.ts +180 -0
- package/src/infrastructure/hooks/use-is-desktop.ts +25 -0
- package/src/infrastructure/hooks/use-is-tauri.ts +17 -0
- package/src/infrastructure/hooks/use-mobile.ts +19 -0
- package/src/infrastructure/hooks/use-notifications.ts +128 -0
- package/src/infrastructure/hooks/use-recent-colors.ts +113 -0
- package/src/infrastructure/hooks/use-recent-modules.ts +76 -0
- package/src/infrastructure/index.tsx +11 -0
- package/src/infrastructure/library/design-system.ts +95 -0
- package/src/infrastructure/library/index.tsx +5 -0
- package/src/infrastructure/library/motion-utils.ts +77 -0
- package/src/infrastructure/library/motion.tsx +31 -0
- package/src/infrastructure/library/scroll-progress.tsx +93 -0
- package/src/infrastructure/providers/auth-guard.provider.tsx +47 -0
- package/src/infrastructure/providers/auth.provider.tsx +168 -0
- package/src/infrastructure/providers/index.tsx +8 -0
- package/src/infrastructure/providers/module-usage.provider.tsx +95 -0
- package/src/infrastructure/providers/modules-guard.provider.tsx +64 -0
- package/src/infrastructure/providers/modules-routines.provider.tsx +33 -0
- package/src/infrastructure/providers/modules-switcher.provider.tsx +25 -0
- package/src/infrastructure/providers/query.provider.tsx +27 -0
- package/src/infrastructure/routines/__tests__/routine.test.ts +368 -0
- package/src/infrastructure/routines/index.tsx +3 -0
- package/src/infrastructure/routines/routine.hook.ts +121 -0
- package/src/infrastructure/routines/routine.ts +283 -0
- package/src/infrastructure/routines/routine.tsx +283 -0
- package/src/infrastructure/stores/activity-lock.store.ts +22 -0
- package/src/infrastructure/stores/auth-user-connected.store.ts +24 -0
- package/src/infrastructure/stores/dataset.store.ts +106 -0
- package/src/infrastructure/stores/index.ts +6 -0
- package/src/infrastructure/stores/module.store.ts +266 -0
- package/src/infrastructure/stores/upload.store.ts +198 -0
- package/src/infrastructure/utilities/access-label.util.ts +158 -0
- package/src/infrastructure/utilities/activities.util.tsx +54 -0
- package/src/infrastructure/utilities/activity-lock.service.ts +263 -0
- package/src/infrastructure/utilities/activity-tracker.service.ts +205 -0
- package/src/infrastructure/utilities/api-service.ts +237 -0
- package/src/infrastructure/utilities/auth-logout.util.ts +23 -0
- package/src/infrastructure/utilities/classname.util.ts +7 -0
- package/src/infrastructure/utilities/encryption.service.ts +125 -0
- package/src/infrastructure/utilities/form-snapshot.service.ts +304 -0
- package/src/infrastructure/utilities/format.util.ts +40 -0
- package/src/infrastructure/utilities/index.tsx +23 -0
- package/src/infrastructure/utilities/media-label.service.ts +47 -0
- package/src/infrastructure/utilities/modules.ts +11 -0
- package/src/infrastructure/utilities/permission.util.ts +22 -0
- package/src/infrastructure/utilities/push-permission.util.ts +43 -0
- package/src/infrastructure/utilities/route-access.ts +38 -0
- package/src/infrastructure/utilities/socket-service.ts +123 -0
- package/src/infrastructure/utilities/sso-auth.util.ts +188 -0
- package/src/infrastructure/utilities/stringable.util.ts +16 -0
- package/src/infrastructure/utilities/strings.util.ts +18 -0
- package/src/infrastructure/utilities/tauri.util.ts +15 -0
- package/src/infrastructure/utilities/utils.ts +6 -0
- package/src/infrastructure/utilities/values.ts +5 -0
- package/src/presentation/8starlabs-ui/button.tsx +94 -0
- package/src/presentation/8starlabs-ui/flip-clock.tsx +368 -0
- package/src/presentation/8starlabs-ui/heatmap.tsx +430 -0
- package/src/presentation/8starlabs-ui/hooks/index.tsx +2 -0
- package/src/presentation/8starlabs-ui/hooks/use-mobile.ts +21 -0
- package/src/presentation/8starlabs-ui/index.tsx +20 -0
- package/src/presentation/8starlabs-ui/json-viewer.tsx +972 -0
- package/src/presentation/8starlabs-ui/marquee.tsx +134 -0
- package/src/presentation/8starlabs-ui/partition-bar.tsx +198 -0
- package/src/presentation/8starlabs-ui/scroll-fade.tsx +158 -0
- package/src/presentation/8starlabs-ui/status-indicator.tsx +86 -0
- package/src/presentation/8starlabs-ui/system-banner.tsx +50 -0
- package/src/presentation/8starlabs-ui/timeline.tsx +576 -0
- package/src/presentation/8starlabs-ui/transport-badge.tsx +249 -0
- package/src/presentation/8starlabs-ui/ui/copy-button.tsx +60 -0
- package/src/presentation/8starlabs-ui/ui/index.tsx +2 -0
- package/src/presentation/analytics-section.tsx +85 -0
- package/src/presentation/app-sidebar.tsx +234 -0
- package/src/presentation/charts/area-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/area-widget.chart.tsx +128 -0
- package/src/presentation/charts/chart-widgets.types.ts +81 -0
- package/src/presentation/charts/index.tsx +16 -0
- package/src/presentation/charts/line-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/line-widget.chart.tsx +105 -0
- package/src/presentation/charts/pie-widget.chart-skeleton.tsx +56 -0
- package/src/presentation/charts/pie-widget.chart.tsx +168 -0
- package/src/presentation/charts/radar-widget.chart-skeleton.tsx +67 -0
- package/src/presentation/charts/radar-widget.chart.tsx +80 -0
- package/src/presentation/charts/radial-stacked-widget.chart-skeleton.tsx +66 -0
- package/src/presentation/charts/radial-stacked-widget.chart.tsx +120 -0
- package/src/presentation/charts/radial-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/radial-widget.chart.tsx +87 -0
- package/src/presentation/charts/tooltip-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/tooltip-widget.chart.tsx +89 -0
- package/src/presentation/components/activity-actions.tsx +20 -0
- package/src/presentation/components/activity-container.tsx +55 -0
- package/src/presentation/components/activity-content.tsx +20 -0
- package/src/presentation/components/activity-descriptor-parser.tsx +37 -0
- package/src/presentation/components/activity-header.tsx +20 -0
- package/src/presentation/components/activity-loader.tsx +19 -0
- package/src/presentation/components/activity-title.tsx +32 -0
- package/src/presentation/components/activity.tsx +22 -0
- package/src/presentation/components/auth/index.tsx +4 -0
- package/src/presentation/components/auth/sso-callback.view.tsx +44 -0
- package/src/presentation/components/auth/sso-disconnect.view.tsx +41 -0
- package/src/presentation/components/auth/sso-sign-in.view.tsx +29 -0
- package/src/presentation/components/auth-lock-screen.tsx +309 -0
- package/src/presentation/components/auth-session.view.tsx +17 -0
- package/src/presentation/components/data-table.tsx +814 -0
- package/src/presentation/components/dynamic-icon.tsx +16 -0
- package/src/presentation/components/floating-upload.tsx +291 -0
- package/src/presentation/components/index.tsx +40 -0
- package/src/presentation/components/local-time.tsx +170 -0
- package/src/presentation/components/markdown-parser.tsx +201 -0
- package/src/presentation/components/message-scroller.tsx +131 -0
- package/src/presentation/components/module-first-access-config.view.tsx +181 -0
- package/src/presentation/components/module-first-access-pending.view.tsx +38 -0
- package/src/presentation/components/module-guard.tsx +34 -0
- package/src/presentation/components/modules-first-access.guard.tsx +88 -0
- package/src/presentation/components/modules-guard-forbidden.tsx +46 -0
- package/src/presentation/components/notification-details.modal.tsx +145 -0
- package/src/presentation/components/notification-item.tsx +127 -0
- package/src/presentation/components/notifications-popover.tsx +128 -0
- package/src/presentation/components/push-notifications.provider.tsx +65 -0
- package/src/presentation/components/upload-progress-dialog.tsx +140 -0
- package/src/presentation/components/waiting-bar.tsx +22 -0
- package/src/presentation/components/waiting-section.tsx +15 -0
- package/src/presentation/components/waiting.tsx +14 -0
- package/src/presentation/data-grid/data-grid-empty.tsx +24 -0
- package/src/presentation/data-grid/data-grid-search-engine.tsx +32 -0
- package/src/presentation/data-grid/data-grid.tsx +892 -0
- package/src/presentation/data-grid/index.tsx +4 -0
- package/src/presentation/form-screen.tsx +95 -0
- package/src/presentation/icons/custom.tsx +20 -0
- package/src/presentation/icons/glyphIcons.tsx +53 -0
- package/src/presentation/icons/icons.enum.ts +4 -0
- package/src/presentation/icons/icons.util.ts +6 -0
- package/src/presentation/icons/index.tsx +8 -0
- package/src/presentation/icons/lucide.tsx +17 -0
- package/src/presentation/icons/remix.tsx +33 -0
- package/src/presentation/icons/types.ts +27 -0
- package/src/presentation/index.tsx +45 -0
- package/src/presentation/modals/components/ModalBox.tsx +74 -0
- package/src/presentation/modals/components/ModalPortal.tsx +31 -0
- package/src/presentation/modals/components/ModalStepper.tsx +319 -0
- package/src/presentation/modals/components/ModalWrapper.tsx +65 -0
- package/src/presentation/modals/components/index.tsx +5 -0
- package/src/presentation/modals/hooks/index.ts +2 -0
- package/src/presentation/modals/hooks/useModal.ts +38 -0
- package/src/presentation/modals/index.tsx +5 -0
- package/src/presentation/modals/stores/index.ts +2 -0
- package/src/presentation/modals/stores/useModalStore.ts +90 -0
- package/src/presentation/modals/types/index.ts +2 -0
- package/src/presentation/modals/types/modal.type.ts +33 -0
- package/src/presentation/module-menubar.tsx +300 -0
- package/src/presentation/module-widget.tsx +233 -0
- package/src/presentation/nav-documents.tsx +89 -0
- package/src/presentation/nav-main.tsx +62 -0
- package/src/presentation/nav-secondary.tsx +41 -0
- package/src/presentation/nav-user.tsx +109 -0
- package/src/presentation/permission-action-badge.tsx +35 -0
- package/src/presentation/reui/index.tsx +3 -0
- package/src/presentation/reui/stepper.tsx +508 -0
- package/src/presentation/reui/timeline.tsx +226 -0
- package/src/presentation/sheets/index.tsx +2 -0
- package/src/presentation/sheets/legacy-sheet-header.tsx +0 -0
- package/src/presentation/sheets/legacy-sheet.tsx +37 -0
- package/src/presentation/size.enum.ts +19 -0
- package/src/presentation/system/index.tsx +3 -0
- package/src/presentation/system/logo.theme.tsx +21 -0
- package/src/presentation/system/types.ts +10 -0
- package/src/presentation/theme/index.tsx +6 -0
- package/src/presentation/theme/prefer-color-scheme.tsx +50 -0
- package/src/presentation/theme/switch-color-scheme.tsx +16 -0
- package/src/presentation/theme/theme-switcher-button.tsx +20 -0
- package/src/presentation/theme/theme.enum.ts +4 -0
- package/src/presentation/theme/theme.store.ts +87 -0
- package/src/presentation/themes/index.tsx +2 -0
- package/src/presentation/themes/katon/dashboard-layout.tsx +1080 -0
- package/src/presentation/themes/katon/edge-section.tsx +19 -0
- package/src/presentation/themes/katon/header-menubar.tsx +270 -0
- package/src/presentation/themes/katon/header-modules-available.tsx +44 -0
- package/src/presentation/themes/katon/header-modules-recents.tsx +52 -0
- package/src/presentation/themes/katon/header-modules-store.tsx +25 -0
- package/src/presentation/themes/katon/header-options.tsx +13 -0
- package/src/presentation/themes/katon/header-organization-select.tsx +146 -0
- package/src/presentation/themes/katon/header-routines.tsx +74 -0
- package/src/presentation/themes/katon/header-tasks-connected-user.tsx +150 -0
- package/src/presentation/themes/katon/index.tsx +16 -0
- package/src/presentation/themes/katon/main-wrapper.tsx +34 -0
- package/src/presentation/themes/katon/module-item-link.tsx +32 -0
- package/src/presentation/themes/katon/view-frame.tsx +25 -0
- package/src/presentation/themes/katon/view-helmet.tsx +53 -0
- package/src/presentation/themes/katon/view-status.tsx +32 -0
- package/src/presentation/themes/katon/view-wrapper.tsx +15 -0
- package/src/presentation/themes/katon/view.tsx +42 -0
- package/src/presentation/ui/accordion-multiselect.tsx +206 -0
- package/src/presentation/ui/accordion.tsx +81 -0
- package/src/presentation/ui/alert-dialog.tsx +199 -0
- package/src/presentation/ui/alert.tsx +76 -0
- package/src/presentation/ui/aspect-ratio.tsx +11 -0
- package/src/presentation/ui/attachment.tsx +204 -0
- package/src/presentation/ui/avatar.tsx +112 -0
- package/src/presentation/ui/badge.tsx +49 -0
- package/src/presentation/ui/breadcrumb.tsx +122 -0
- package/src/presentation/ui/bubble.tsx +125 -0
- package/src/presentation/ui/button-group.tsx +83 -0
- package/src/presentation/ui/button.tsx +87 -0
- package/src/presentation/ui/calendar.tsx +222 -0
- package/src/presentation/ui/card.tsx +106 -0
- package/src/presentation/ui/carousel.tsx +242 -0
- package/src/presentation/ui/chart.tsx +373 -0
- package/src/presentation/ui/checkbox.tsx +33 -0
- package/src/presentation/ui/clickable.tsx +58 -0
- package/src/presentation/ui/collapsible.tsx +33 -0
- package/src/presentation/ui/color-swatch-selector.tsx +81 -0
- package/src/presentation/ui/combobox.tsx +299 -0
- package/src/presentation/ui/command.tsx +195 -0
- package/src/presentation/ui/context-menu.tsx +263 -0
- package/src/presentation/ui/dialog.tsx +168 -0
- package/src/presentation/ui/direction.tsx +22 -0
- package/src/presentation/ui/drawer.tsx +134 -0
- package/src/presentation/ui/dropdown-menu.tsx +269 -0
- package/src/presentation/ui/empty.tsx +104 -0
- package/src/presentation/ui/field.tsx +238 -0
- package/src/presentation/ui/granularity-selector.tsx +58 -0
- package/src/presentation/ui/hover-card.tsx +44 -0
- package/src/presentation/ui/index.tsx +74 -0
- package/src/presentation/ui/input-group.tsx +156 -0
- package/src/presentation/ui/input-otp.tsx +87 -0
- package/src/presentation/ui/input.tsx +19 -0
- package/src/presentation/ui/item.tsx +196 -0
- package/src/presentation/ui/kpi-card.tsx +203 -0
- package/src/presentation/ui/label-selector.tsx +100 -0
- package/src/presentation/ui/label.tsx +24 -0
- package/src/presentation/ui/legacy-birth-date-input.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/index.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.content.tsx +37 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.context.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.hex-input.tsx +97 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.picker.tsx +266 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.presets.ts +22 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.quick-list.tsx +49 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.recent.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.swatches.tsx +111 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.trigger.tsx +128 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.tsx +110 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.types.ts +1 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.utils.ts +114 -0
- package/src/presentation/ui/legacy-country-input.tsx +171 -0
- package/src/presentation/ui/legacy-gender-input.tsx +22 -0
- package/src/presentation/ui/legacy-input.tsx +106 -0
- package/src/presentation/ui/legacy-phone-input.tsx +213 -0
- package/src/presentation/ui/legacy-select-input.tsx +114 -0
- package/src/presentation/ui/legacy-text-area.tsx +111 -0
- package/src/presentation/ui/list-items.tsx +59 -0
- package/src/presentation/ui/marker.tsx +69 -0
- package/src/presentation/ui/media-player/index.tsx +12 -0
- package/src/presentation/ui/media-player/media-player.context.tsx +36 -0
- package/src/presentation/ui/media-player/media-player.tsx +167 -0
- package/src/presentation/ui/media-player/player-controls.tsx +207 -0
- package/src/presentation/ui/media-player/players/audio-player.tsx +78 -0
- package/src/presentation/ui/media-player/players/index.tsx +4 -0
- package/src/presentation/ui/media-player/players/video-player.tsx +193 -0
- package/src/presentation/ui/media-player/players/voice-note-player.tsx +108 -0
- package/src/presentation/ui/media-player/use-media-player.hook.ts +263 -0
- package/src/presentation/ui/menubar.tsx +281 -0
- package/src/presentation/ui/message.tsx +92 -0
- package/src/presentation/ui/navigation-menu.tsx +172 -0
- package/src/presentation/ui/pagination.tsx +129 -0
- package/src/presentation/ui/popover.tsx +89 -0
- package/src/presentation/ui/progress.tsx +31 -0
- package/src/presentation/ui/resizable.tsx +50 -0
- package/src/presentation/ui/select.tsx +192 -0
- package/src/presentation/ui/separator.tsx +28 -0
- package/src/presentation/ui/sheet.tsx +147 -0
- package/src/presentation/ui/sidebar.tsx +702 -0
- package/src/presentation/ui/skeleton.tsx +13 -0
- package/src/presentation/ui/slide-to-confirm.tsx +129 -0
- package/src/presentation/ui/slider.tsx +59 -0
- package/src/presentation/ui/sonner.tsx +58 -0
- package/src/presentation/ui/switch.tsx +33 -0
- package/src/presentation/ui/table.tsx +116 -0
- package/src/presentation/ui/tabs.tsx +90 -0
- package/src/presentation/ui/text-gradient.tsx +84 -0
- package/src/presentation/ui/textarea.tsx +18 -0
- package/src/presentation/ui/timeline-steps.tsx +235 -0
- package/src/presentation/ui/toggle-group.tsx +89 -0
- package/src/presentation/ui/toggle.tsx +47 -0
- package/src/presentation/ui/tooltip.tsx +57 -0
- package/src/presentation/uploading/index.tsx +3 -0
- package/src/presentation/uploading/media-upload-field.tsx +152 -0
- package/src/presentation/uploading/storage-media.tsx +210 -0
- package/src/styles.css +403 -0
- package/src/themes.css +1038 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contrats de l'authentification OAuth / MFA du backend `liorian-api-core`.
|
|
3
|
+
*
|
|
4
|
+
* Ces types reflètent le payload renvoyé dans `RaitonResponses(message, data, status)`
|
|
5
|
+
* (le champ `data` de l'enveloppe) pour les endpoints `/mfa/*`, `/otp/*` et `/oauth/*`.
|
|
6
|
+
* Ils sont partagés par le service `AuthApiService` du SDK.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Facteur d'authentification multi-facteurs. */
|
|
10
|
+
export type AuthFactorType =
|
|
11
|
+
| 'password'
|
|
12
|
+
| 'totp'
|
|
13
|
+
| 'webauthn'
|
|
14
|
+
| 'otp_email'
|
|
15
|
+
| 'otp_sms'
|
|
16
|
+
| 'recovery_code';
|
|
17
|
+
|
|
18
|
+
export interface AuthFactor {
|
|
19
|
+
id: string;
|
|
20
|
+
type: AuthFactorType;
|
|
21
|
+
label: string;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
verifiedAt?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface MfaChallengeResponse {
|
|
27
|
+
mfaRequired: boolean;
|
|
28
|
+
challenge?: string;
|
|
29
|
+
factors?: AuthFactor[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MfaVerifyResponse {
|
|
33
|
+
mfaVerified: boolean;
|
|
34
|
+
mfaToken?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface EnrollTotpResponse {
|
|
38
|
+
authenticatorId: string;
|
|
39
|
+
otpauthUrl: string;
|
|
40
|
+
secret: string;
|
|
41
|
+
qrcode?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RecoveryCodesResponse {
|
|
45
|
+
codes: string[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface WebAuthnOptions {
|
|
49
|
+
challenge: string | ArrayBuffer;
|
|
50
|
+
rp?: {id: string; name: string};
|
|
51
|
+
user?: {id: string | ArrayBuffer | Uint8Array; name: string; displayName: string};
|
|
52
|
+
timeout?: number;
|
|
53
|
+
attestation?: string;
|
|
54
|
+
authenticatorSelection?: Record<string, unknown>;
|
|
55
|
+
pubKeyCredParams?: Array<{type: string; alg: number}>;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AuthMethod {
|
|
60
|
+
id: string;
|
|
61
|
+
type: AuthFactorType;
|
|
62
|
+
label: string;
|
|
63
|
+
verifiedAt?: string;
|
|
64
|
+
canRemove: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface AuthorizeClient {
|
|
68
|
+
clientId: string;
|
|
69
|
+
name: string;
|
|
70
|
+
logoUrl?: string;
|
|
71
|
+
policyUrl?: string;
|
|
72
|
+
termsUrl?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ScopeDescriptor {
|
|
76
|
+
name: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
alreadyGranted: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface ConsentResolution {
|
|
83
|
+
redirectUri: string;
|
|
84
|
+
mfaRequired?: boolean;
|
|
85
|
+
code?: string;
|
|
86
|
+
error?: string;
|
|
87
|
+
errorDescription?: string;
|
|
88
|
+
state?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface AuthorizePasskeyOptions {
|
|
92
|
+
passkeyEnabled: boolean;
|
|
93
|
+
otpEnabled: boolean;
|
|
94
|
+
hasPasskey: boolean;
|
|
95
|
+
challenge?: string | ArrayBuffer;
|
|
96
|
+
rpId?: string;
|
|
97
|
+
userVerification?: string;
|
|
98
|
+
timeout?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface AuthorizedApplication {
|
|
102
|
+
consentId: string;
|
|
103
|
+
clientId: string;
|
|
104
|
+
name: string;
|
|
105
|
+
logoUrl?: string;
|
|
106
|
+
domain?: string;
|
|
107
|
+
scopes: string[];
|
|
108
|
+
grantedAt: string;
|
|
109
|
+
lastUsedAt?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface UserInfo {
|
|
113
|
+
sub: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
preferredUsername?: string;
|
|
116
|
+
email?: string;
|
|
117
|
+
organizations?: Array<{id: string; slug?: string; name?: string}>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface OtpCreateResponse {
|
|
121
|
+
id: string;
|
|
122
|
+
channel: 'EMAIL' | 'SMS';
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type OtpChannel = 'email' | 'sms';
|
|
126
|
+
|
|
127
|
+
/** Paramètres d'une demande d'autorisation OAuth (PKCE). */
|
|
128
|
+
export interface AuthorizeParams {
|
|
129
|
+
clientId: string;
|
|
130
|
+
redirectUri: string;
|
|
131
|
+
scope?: string;
|
|
132
|
+
state?: string;
|
|
133
|
+
codeChallenge?: string;
|
|
134
|
+
codeChallengeMethod?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Scope pré-enregistré dans le catalogue `OAuthScope`. */
|
|
138
|
+
export interface OAuthScope {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
label?: string;
|
|
142
|
+
description?: string;
|
|
143
|
+
isDefault: boolean;
|
|
144
|
+
status: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type OAuthClientStatusValue = 'PENDING' | 'APPROVED' | 'REJECTED' | 'DISABLED' | 'EXPIRED';
|
|
148
|
+
|
|
149
|
+
/** Application pré-enregistrée autorisée à utiliser liorian-auth. */
|
|
150
|
+
export interface OAuthClient {
|
|
151
|
+
id: string;
|
|
152
|
+
clientId: string;
|
|
153
|
+
name: string;
|
|
154
|
+
description?: string;
|
|
155
|
+
logoUri?: string;
|
|
156
|
+
bannerUri?: string;
|
|
157
|
+
domain?: string;
|
|
158
|
+
scopes: string[];
|
|
159
|
+
redirectUris: string[];
|
|
160
|
+
status?: OAuthClientStatusValue;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface CreateOAuthClientInput {
|
|
164
|
+
clientId: string;
|
|
165
|
+
name: string;
|
|
166
|
+
description?: string;
|
|
167
|
+
logoUri?: string;
|
|
168
|
+
bannerUri?: string;
|
|
169
|
+
domain?: string;
|
|
170
|
+
redirectUris?: string[];
|
|
171
|
+
scopes?: string[];
|
|
172
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @liorian/sdk/domain/typing — shared typing utilities & contracts.
|
|
2
|
+
export * from "./auth-caches";
|
|
3
|
+
export * from "./auth-oauth.types";
|
|
4
|
+
export * from "./devise";
|
|
5
|
+
export * from "./response";
|
|
6
|
+
export * from "./routine.types";
|
|
7
|
+
export * from "./session.interface";
|
|
8
|
+
export * from "./statisticals";
|
|
9
|
+
export * from "./user-media-upload";
|
|
10
|
+
export * from "./values";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface FetchResponseInterface<T> {
|
|
2
|
+
data: T;
|
|
3
|
+
error?: boolean;
|
|
4
|
+
message?: string;
|
|
5
|
+
statusCode?: number;
|
|
6
|
+
errorCode?: number | string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface FetchResponseMetaProps {
|
|
10
|
+
total?: number;
|
|
11
|
+
page?: number;
|
|
12
|
+
limit?: number;
|
|
13
|
+
totalPages?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface FetchResponseWithMetaInterface<T> extends FetchResponseInterface<T> {
|
|
17
|
+
meta?: FetchResponseMetaProps
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PaginationOptions {
|
|
21
|
+
page?: number;
|
|
22
|
+
limit?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface SearchOptions {
|
|
26
|
+
search?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface PaginationWithSearchOptions extends PaginationOptions, SearchOptions {
|
|
30
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {DatasetInstanceType} from "../../infrastructure/stores/dataset.store";
|
|
2
|
+
import {RoutineInstanceStatusEnum, RoutineStatusEnum} from "../enums/routine.enum";
|
|
3
|
+
import {IconKey} from "../../presentation/icons/types";
|
|
4
|
+
import {FC} from "react";
|
|
5
|
+
|
|
6
|
+
export interface RoutineFindOptionsInterface {
|
|
7
|
+
id: string;
|
|
8
|
+
status: RoutineStatusEnum;
|
|
9
|
+
persist: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface RoutineProps<T extends Object> extends Omit<RoutineInterface<T>, 'dataset' | 'status'> {
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface RoutineInterfaceOptions {
|
|
17
|
+
status?: RoutineStatusEnum;
|
|
18
|
+
persist?: boolean;
|
|
19
|
+
icon?: IconKey;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface RoutineLifeCircle {
|
|
24
|
+
onJob?(): void;
|
|
25
|
+
|
|
26
|
+
onStart?(): void;
|
|
27
|
+
|
|
28
|
+
onPause?(): void;
|
|
29
|
+
|
|
30
|
+
onStop?(): void;
|
|
31
|
+
|
|
32
|
+
onResume?(): void;
|
|
33
|
+
|
|
34
|
+
onJobEnd?(): void;
|
|
35
|
+
|
|
36
|
+
onJobStart?(): void;
|
|
37
|
+
|
|
38
|
+
onRemove?(): void;
|
|
39
|
+
|
|
40
|
+
onFail?(error: Error): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface RoutineUiInterface {
|
|
44
|
+
icon?: IconKey;
|
|
45
|
+
name: string | undefined;
|
|
46
|
+
|
|
47
|
+
setIcon(icon: IconKey): this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface RoutineInterface<T extends Object> extends RoutineLifeCircle, RoutineUiInterface {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
|
|
53
|
+
readonly dataset: DatasetInstanceType<T>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
Fonctionnalité optionnelle : composant de popover affiché dans le header
|
|
57
|
+
global au clic (rendu par <HeaderRoutines/> tant que la routine est
|
|
58
|
+
enregistrée). À surcharger dans une routine concrète ; l'accès paresseux
|
|
59
|
+
(méthode) évite les problèmes d'ordre d'évaluation des modules.
|
|
60
|
+
|
|
61
|
+
Rôles : le SYSTÈME fournit l'icône déclencheur (PopoverTrigger, construit
|
|
62
|
+
autour de `icon`) et le conteneur <PopoverContent> ; la routine fournit
|
|
63
|
+
uniquement le CONTENU rendu dans ce conteneur.
|
|
64
|
+
*/
|
|
65
|
+
popover?(): FC<T>
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
Fonctionnalité optionnelle : valeur numérique affichée en badge sur
|
|
69
|
+
l'icône déclencheur du popover (recalculée à chaque cycle de routine).
|
|
70
|
+
*/
|
|
71
|
+
badge?(): number
|
|
72
|
+
|
|
73
|
+
status: RoutineStatusEnum;
|
|
74
|
+
|
|
75
|
+
persist: boolean;
|
|
76
|
+
|
|
77
|
+
setOption<K extends keyof RoutineInterfaceOptions>(key: K, value: RoutineInterfaceOptions[K]): this;
|
|
78
|
+
|
|
79
|
+
getOption<K extends keyof RoutineInterfaceOptions>(key: K): RoutineInterfaceOptions[K] | undefined;
|
|
80
|
+
|
|
81
|
+
job(): Promise<T | undefined>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface RoutineInstanceInterface {
|
|
85
|
+
readonly entries: Set<RoutineInterface<any>>;
|
|
86
|
+
|
|
87
|
+
status: RoutineInstanceStatusEnum;
|
|
88
|
+
|
|
89
|
+
timeout: number;
|
|
90
|
+
|
|
91
|
+
find(options: Partial<RoutineFindOptionsInterface>): RoutineInterface<any>[]
|
|
92
|
+
|
|
93
|
+
enqueue<T extends Object>(routine: RoutineInterface<T>): this;
|
|
94
|
+
|
|
95
|
+
exists<T extends Object>(id: string): RoutineInterface<T> | undefined;
|
|
96
|
+
|
|
97
|
+
run(id?: string): Promise<this>;
|
|
98
|
+
|
|
99
|
+
remove(id: string): this;
|
|
100
|
+
|
|
101
|
+
clear(force?: boolean): this;
|
|
102
|
+
|
|
103
|
+
work(id?: string): this;
|
|
104
|
+
|
|
105
|
+
start(id?: string): this;
|
|
106
|
+
|
|
107
|
+
pause(id?: string): this;
|
|
108
|
+
|
|
109
|
+
stop(id?: string): this;
|
|
110
|
+
|
|
111
|
+
resume(id?: string): this;
|
|
112
|
+
|
|
113
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
export interface CreateUserSessionInterface {
|
|
3
|
+
username?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
password: string;
|
|
7
|
+
prefix?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CreateUserAccountInterface {
|
|
11
|
+
username?: string;
|
|
12
|
+
email: string;
|
|
13
|
+
password: string;
|
|
14
|
+
password_confirmation: string;
|
|
15
|
+
first_names?: string;
|
|
16
|
+
last_name?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
otp?: string;
|
|
19
|
+
country?: string;
|
|
20
|
+
city?: string;
|
|
21
|
+
address?: string;
|
|
22
|
+
gender?: string;
|
|
23
|
+
birth_date?: string;
|
|
24
|
+
organization?: string;
|
|
25
|
+
idRecto?: any;
|
|
26
|
+
idVerso?: any;
|
|
27
|
+
selfie?: any;
|
|
28
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// @liorian/sdk — convenience entry point.
|
|
2
|
+
// Prefer targeted imports: subpaths (`@liorian/sdk/presentation/ui/button`) or
|
|
3
|
+
// folder barrels (`@liorian/sdk/domain/entities`, `@liorian/sdk/infrastructure/hooks`, …).
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Domain
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
export { UserProfileEnum, USER_PROFILE_META } from "./domain/index";
|
|
9
|
+
export type { UserProfileInterface, UserProfiledInterface } from "./domain/index";
|
|
10
|
+
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Utilities & services
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
export {
|
|
15
|
+
cn,
|
|
16
|
+
CommonClassName,
|
|
17
|
+
isTauri,
|
|
18
|
+
requestPushPermission,
|
|
19
|
+
ACTIVITY_LOCK_PREFERENCE_LABEL,
|
|
20
|
+
ActivityLockService,
|
|
21
|
+
FormSnapshotService,
|
|
22
|
+
ACTIVITY_LOCK_EVENT,
|
|
23
|
+
ACTIVITY_UNLOCK_EVENT,
|
|
24
|
+
ACTIVITY_LOCK_FORM_DRAFT_KEY,
|
|
25
|
+
camelCase,
|
|
26
|
+
capitalize,
|
|
27
|
+
capitalizeFirstLetter,
|
|
28
|
+
kebabToPascalCase,
|
|
29
|
+
toTitleCase,
|
|
30
|
+
unCamelCase,
|
|
31
|
+
} from "./infrastructure";
|
|
32
|
+
export type {
|
|
33
|
+
PushPermissionState,
|
|
34
|
+
ActivityLockState,
|
|
35
|
+
ActivityLockOptions,
|
|
36
|
+
ActivityLockFormField,
|
|
37
|
+
ActivityLockFormSnapshot,
|
|
38
|
+
} from "./infrastructure";
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Hooks
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
export {
|
|
44
|
+
useIsMobile,
|
|
45
|
+
useIsDesktop,
|
|
46
|
+
useIsTauri,
|
|
47
|
+
useActivityLockDraft,
|
|
48
|
+
DESKTOP_BREAKPOINT,
|
|
49
|
+
} from "./infrastructure";
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Auth providers
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
export { AuthProvider, AuthGuard } from "./infrastructure";
|
|
55
|
+
export type { AuthProviderProps } from "./infrastructure";
|
|
56
|
+
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
// Components
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
export {
|
|
61
|
+
LocalTime,
|
|
62
|
+
AuthLockScreen,
|
|
63
|
+
AuthSessionView,
|
|
64
|
+
SsoSignInView,
|
|
65
|
+
SsoCallbackView,
|
|
66
|
+
SsoDisconnectView,
|
|
67
|
+
Activity,
|
|
68
|
+
} from "./presentation";
|
|
69
|
+
export type {
|
|
70
|
+
LocalTimeProps,
|
|
71
|
+
AuthLockScreenProps,
|
|
72
|
+
SsoSignInViewProps,
|
|
73
|
+
SsoCallbackViewProps,
|
|
74
|
+
SsoDisconnectViewProps,
|
|
75
|
+
ActivityContainerProps,
|
|
76
|
+
ActivityLoaderProps,
|
|
77
|
+
} from "./presentation";
|
|
78
|
+
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Theme
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
export {
|
|
83
|
+
PreferColorSchemeEnum,
|
|
84
|
+
ThemePreferColorSchemeProvider,
|
|
85
|
+
SwitchColorScheme,
|
|
86
|
+
ThemeSwitcherButton,
|
|
87
|
+
useThemePreferColorSchemeStore,
|
|
88
|
+
} from "./presentation";
|
|
89
|
+
export type { ThemeCacheInterface } from "./presentation";
|
|
90
|
+
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Katon theme & dashboard
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
export {
|
|
95
|
+
View,
|
|
96
|
+
ViewWrapper,
|
|
97
|
+
ViewHelmet,
|
|
98
|
+
ViewFrame,
|
|
99
|
+
ViewStatus,
|
|
100
|
+
DashboardLayout,
|
|
101
|
+
} from "./presentation";
|
|
102
|
+
export type {
|
|
103
|
+
ScreenViewProps,
|
|
104
|
+
ViewWrapperProps,
|
|
105
|
+
ViewHelmetProps,
|
|
106
|
+
ViewFrameProps,
|
|
107
|
+
ViewStatusProps,
|
|
108
|
+
DashboardLayoutProps,
|
|
109
|
+
DashboardHeaderProps,
|
|
110
|
+
DashboardHeaderTopProps,
|
|
111
|
+
DashboardHeaderStartProps,
|
|
112
|
+
DashboardIconProps,
|
|
113
|
+
DashboardTitleProps,
|
|
114
|
+
DashboardDescriptionProps,
|
|
115
|
+
DashboardActionsProps,
|
|
116
|
+
DashboardMetricsProps,
|
|
117
|
+
DashboardMetricCardProps,
|
|
118
|
+
DashboardBodyProps,
|
|
119
|
+
DashboardGridProps,
|
|
120
|
+
DashboardColProps,
|
|
121
|
+
DashboardSectionProps,
|
|
122
|
+
DashboardSectionHeaderProps,
|
|
123
|
+
DashboardSectionTitleProps,
|
|
124
|
+
DashboardSectionDescriptionProps,
|
|
125
|
+
DashboardSectionActionsProps,
|
|
126
|
+
DashboardSectionContentProps,
|
|
127
|
+
DashboardCardProps,
|
|
128
|
+
DashboardCardHeaderProps,
|
|
129
|
+
DashboardCardTitleProps,
|
|
130
|
+
DashboardCardDescriptionProps,
|
|
131
|
+
DashboardCardContentProps,
|
|
132
|
+
DashboardCardFooterProps,
|
|
133
|
+
DashboardStatGridProps,
|
|
134
|
+
DashboardItemCardProps,
|
|
135
|
+
DashboardActionPillProps,
|
|
136
|
+
DashboardTableProps,
|
|
137
|
+
DashboardTableHeaderProps,
|
|
138
|
+
DashboardTableBodyProps,
|
|
139
|
+
DashboardTableRowProps,
|
|
140
|
+
DashboardTableHeadProps,
|
|
141
|
+
DashboardTableCellProps,
|
|
142
|
+
DashboardBottomBarProps,
|
|
143
|
+
} from "./presentation";
|
|
144
|
+
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// Data
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
export { UserGenderEnum, countriesConstant } from "./infrastructure";
|
|
149
|
+
export type { CountryInterface } from "./infrastructure";
|
|
150
|
+
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// Design tokens & motion
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
export { getToken, tokens } from "./infrastructure/library";
|
|
155
|
+
export type { DesignSystemTokens } from "./infrastructure/library";
|
|
156
|
+
export {
|
|
157
|
+
elasticChild,
|
|
158
|
+
elasticContainer,
|
|
159
|
+
elasticEnter,
|
|
160
|
+
elasticExit,
|
|
161
|
+
elasticPulse,
|
|
162
|
+
elasticScaleEnter,
|
|
163
|
+
elasticSlideInLeft,
|
|
164
|
+
elasticSlideInRight,
|
|
165
|
+
elasticSlideUp,
|
|
166
|
+
staggeredSpringList,
|
|
167
|
+
} from "./infrastructure/library";
|
|
168
|
+
export type { EnterAnimation } from "./infrastructure/library";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {ICacheStorageCapability} from "./types";
|
|
4
|
+
import {CacheStorageType} from "./enum";
|
|
5
|
+
import {StackableCapability} from "../stackable/capability";
|
|
6
|
+
import {StackableEntityType} from "../stackable/types";
|
|
7
|
+
import {EncryptionService} from "../../utilities/encryption.service";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export class CacheStorageCapability<T extends StackableEntityType>
|
|
11
|
+
extends StackableCapability<T>
|
|
12
|
+
implements ICacheStorageCapability<T> {
|
|
13
|
+
|
|
14
|
+
private _ready: Promise<T> | null = null;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
public readonly key: string,
|
|
18
|
+
public readonly type: CacheStorageType = CacheStorageType.LOCAL,
|
|
19
|
+
protected readonly encrypted: boolean = true
|
|
20
|
+
) {
|
|
21
|
+
super();
|
|
22
|
+
this._init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private _init() {
|
|
26
|
+
if (typeof window !== 'undefined') {
|
|
27
|
+
this._ready = this.load();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Résout une fois le cache chargé depuis le stockage local (décryptage inclus). */
|
|
32
|
+
async ready(): Promise<T> {
|
|
33
|
+
if (!this._ready) {
|
|
34
|
+
this._ready = this.load();
|
|
35
|
+
}
|
|
36
|
+
return this._ready;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private _getCookies(): Record<string, string> {
|
|
40
|
+
if (typeof document === 'undefined') return {};
|
|
41
|
+
return document.cookie.split(';').reduce((acc, cookie) => {
|
|
42
|
+
const [key, value] = cookie.trim().split('=');
|
|
43
|
+
if (key && value) acc[key] = decodeURIComponent(value);
|
|
44
|
+
return acc;
|
|
45
|
+
}, {} as Record<string, string>);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private _setCookie(name: string, value: string, days = 7) {
|
|
49
|
+
if (typeof document === 'undefined') return;
|
|
50
|
+
const date = new Date();
|
|
51
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
52
|
+
const expires = "; expires=" + date.toUTCString();
|
|
53
|
+
document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=/; SameSite=Strict";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async load(): Promise<T> {
|
|
57
|
+
try {
|
|
58
|
+
let stack: string | null = null;
|
|
59
|
+
|
|
60
|
+
if (typeof window !== 'undefined') {
|
|
61
|
+
if (this.type === CacheStorageType.LOCAL) {
|
|
62
|
+
stack = localStorage.getItem(this.key);
|
|
63
|
+
} else if (this.type === CacheStorageType.SESSION) {
|
|
64
|
+
stack = sessionStorage.getItem(this.key);
|
|
65
|
+
} else if (this.type === CacheStorageType.COOKIE) {
|
|
66
|
+
stack = this._getCookies()[this.key] || null;
|
|
67
|
+
}
|
|
68
|
+
} else if (this.type === CacheStorageType.COOKIE) {
|
|
69
|
+
// Server-side: we might be able to get cookies if we had access to headers,
|
|
70
|
+
// but in a generic capability we might not have them injected.
|
|
71
|
+
// For now, return empty or handle via a specialized server-side provider if needed.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (stack && this.encrypted) {
|
|
75
|
+
try {
|
|
76
|
+
const decrypted = await EncryptionService.decrypt(stack);
|
|
77
|
+
return this.fromString(decrypted);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.error("Decryption error, falling back to raw data:", e);
|
|
80
|
+
return this.fromString(stack);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.fromString(stack || "{}");
|
|
85
|
+
|
|
86
|
+
} catch (e) {
|
|
87
|
+
console.error(e);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {} as T;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async save(): Promise<boolean> {
|
|
94
|
+
try {
|
|
95
|
+
const data = this.toJson();
|
|
96
|
+
|
|
97
|
+
if (this.encrypted) {
|
|
98
|
+
const encryptedData = await EncryptionService.encrypt(data);
|
|
99
|
+
return this._persist(encryptedData);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return this._persist(data);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
console.error(e);
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private _persist(data: string): boolean {
|
|
110
|
+
if (typeof window === 'undefined') {
|
|
111
|
+
// Server-side: Cannot persist to localStorage/sessionStorage.
|
|
112
|
+
// For cookies, we would need to set headers, which usually happens in Middleware or Server Actions.
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (this.type === CacheStorageType.LOCAL) {
|
|
117
|
+
localStorage.setItem(this.key, data);
|
|
118
|
+
} else if (this.type === CacheStorageType.SESSION) {
|
|
119
|
+
sessionStorage.setItem(this.key, data);
|
|
120
|
+
} else if (this.type === CacheStorageType.COOKIE) {
|
|
121
|
+
this._setCookie(this.key, data);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|