@edsis/angular 22.1.3 → 22.2.8
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/LICENSE +21 -0
- package/README.md +87 -399
- package/SECURITY.md +18 -0
- package/SUPPORT.md +15 -0
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +125 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +146 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +52 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/edsis-angular-chart-area.mjs +508 -0
- package/fesm2022/edsis-angular-chart-bar.mjs +946 -0
- package/fesm2022/edsis-angular-chart-core.mjs +1282 -0
- package/fesm2022/edsis-angular-chart-line.mjs +544 -0
- package/fesm2022/edsis-angular-chart-pie.mjs +524 -0
- package/fesm2022/edsis-angular-chart-primitives.mjs +1647 -0
- package/fesm2022/edsis-angular-chart-radar.mjs +693 -0
- package/fesm2022/edsis-angular-chart-radial.mjs +542 -0
- package/fesm2022/edsis-angular-chart-scatter.mjs +486 -0
- package/fesm2022/edsis-angular-chart.mjs +3 -0
- package/fesm2022/edsis-angular-component-accordion.mjs +513 -0
- package/fesm2022/edsis-angular-component-alert-dialog.mjs +1001 -0
- package/fesm2022/edsis-angular-component-alert.mjs +268 -0
- package/fesm2022/edsis-angular-component-aspect-ratio.mjs +80 -0
- package/fesm2022/edsis-angular-component-avatar.mjs +410 -0
- package/fesm2022/edsis-angular-component-badge.mjs +111 -0
- package/fesm2022/edsis-angular-component-breadcrumb.mjs +464 -0
- package/fesm2022/edsis-angular-component-button-group.mjs +252 -0
- package/fesm2022/edsis-angular-component-button.mjs +155 -0
- package/fesm2022/edsis-angular-component-calendar.mjs +835 -0
- package/fesm2022/edsis-angular-component-card.mjs +460 -0
- package/fesm2022/edsis-angular-component-carousel.mjs +700 -0
- package/fesm2022/edsis-angular-component-checkbox.mjs +398 -0
- package/fesm2022/edsis-angular-component-collapsible.mjs +305 -0
- package/fesm2022/edsis-angular-component-combobox.mjs +544 -0
- package/fesm2022/edsis-angular-component-command.mjs +815 -0
- package/fesm2022/edsis-angular-component-composer.mjs +840 -0
- package/fesm2022/edsis-angular-component-context-menu.mjs +197 -0
- package/fesm2022/edsis-angular-component-date-picker.mjs +798 -0
- package/fesm2022/edsis-angular-component-dialog.mjs +798 -0
- package/fesm2022/edsis-angular-component-drawer.mjs +2 -0
- package/fesm2022/edsis-angular-component-dropdown-menu.mjs +1259 -0
- package/fesm2022/edsis-angular-component-editor.mjs +1000 -0
- package/fesm2022/edsis-angular-component-empty.mjs +351 -0
- package/fesm2022/edsis-angular-component-form.mjs +821 -0
- package/fesm2022/edsis-angular-component-hover-card.mjs +486 -0
- package/fesm2022/edsis-angular-component-icon.mjs +253 -0
- package/fesm2022/edsis-angular-component-input-group.mjs +453 -0
- package/fesm2022/edsis-angular-component-input-otp.mjs +957 -0
- package/fesm2022/edsis-angular-component-input.mjs +87 -0
- package/fesm2022/edsis-angular-component-item.mjs +720 -0
- package/fesm2022/edsis-angular-component-kanban.mjs +812 -0
- package/fesm2022/edsis-angular-component-kbd.mjs +124 -0
- package/fesm2022/edsis-angular-component-label.mjs +82 -0
- package/fesm2022/edsis-angular-component-menubar.mjs +481 -0
- package/fesm2022/edsis-angular-component-native-select.mjs +168 -0
- package/fesm2022/edsis-angular-component-navigation-menu.mjs +685 -0
- package/fesm2022/edsis-angular-component-pagination.mjs +425 -0
- package/fesm2022/edsis-angular-component-pillbox.mjs +1679 -0
- package/fesm2022/edsis-angular-component-popover.mjs +292 -0
- package/fesm2022/edsis-angular-component-progress.mjs +184 -0
- package/fesm2022/edsis-angular-component-radio.mjs +491 -0
- package/fesm2022/edsis-angular-component-resizable.mjs +703 -0
- package/fesm2022/edsis-angular-component-scroll-area.mjs +133 -0
- package/fesm2022/edsis-angular-component-segmented-control.mjs +408 -0
- package/fesm2022/edsis-angular-component-select.mjs +743 -0
- package/fesm2022/edsis-angular-component-separator.mjs +102 -0
- package/fesm2022/edsis-angular-component-sheet.mjs +874 -0
- package/fesm2022/edsis-angular-component-skeleton.mjs +62 -0
- package/fesm2022/edsis-angular-component-slider.mjs +676 -0
- package/fesm2022/edsis-angular-component-spinner.mjs +157 -0
- package/fesm2022/edsis-angular-component-switch.mjs +361 -0
- package/fesm2022/edsis-angular-component-table.mjs +446 -0
- package/fesm2022/edsis-angular-component-tabs.mjs +592 -0
- package/fesm2022/edsis-angular-component-textarea.mjs +85 -0
- package/fesm2022/edsis-angular-component-timeline.mjs +619 -0
- package/fesm2022/edsis-angular-component-toast.mjs +231 -0
- package/fesm2022/edsis-angular-component-toggle-group.mjs +579 -0
- package/fesm2022/edsis-angular-component-toggle.mjs +189 -0
- package/fesm2022/edsis-angular-component-tooltip.mjs +804 -0
- package/fesm2022/edsis-angular-component-utils-core.mjs +181 -0
- package/fesm2022/edsis-angular-component-utils-overlay.mjs +54 -0
- package/fesm2022/edsis-angular-component-utils-scale.mjs +76 -0
- package/fesm2022/edsis-angular-component-utils.mjs +2 -0
- package/fesm2022/edsis-angular-component.mjs +0 -0
- package/fesm2022/edsis-angular-navigation-core.mjs +15 -0
- package/fesm2022/edsis-angular-navigation-icon.mjs +35 -0
- package/fesm2022/edsis-angular-navigation-navigation-badge-count.component-BWWWaUgy.mjs +234 -0
- package/fesm2022/edsis-angular-navigation-navigation-dockbar-menu.component-Bx2bxTID.mjs +834 -0
- package/fesm2022/edsis-angular-navigation-navigation-entry-grid.component-Duzt1ffz.mjs +823 -0
- package/fesm2022/edsis-angular-navigation-navigation-flyout-menu.component-cJ8Q1vM6.mjs +670 -0
- package/fesm2022/edsis-angular-navigation-navigation-horizontal.component-CDQ1wt2_.mjs +689 -0
- package/fesm2022/edsis-angular-navigation-navigation-item.component-C1VzerJp.mjs +1522 -0
- package/fesm2022/edsis-angular-navigation-navigation-list.component-BPYLfrID.mjs +346 -0
- package/fesm2022/edsis-angular-navigation-service.mjs +558 -0
- package/fesm2022/edsis-angular-navigation-types.mjs +151 -0
- package/fesm2022/edsis-angular-navigation.mjs +3338 -0
- package/fesm2022/edsis-angular-sdk.mjs +100 -0
- package/fesm2022/edsis-angular-theme-component-settings.mjs +1877 -0
- package/fesm2022/edsis-angular-theme-layout-services.mjs +252 -0
- package/fesm2022/edsis-angular-theme-layout-types.mjs +45 -0
- package/fesm2022/edsis-angular-theme-layout-wrapper.mjs +2568 -0
- package/fesm2022/edsis-angular-theme-layout.mjs +1089 -0
- package/fesm2022/edsis-angular-theme-page-core.mjs +315 -0
- package/fesm2022/edsis-angular-theme-page-filter.mjs +409 -0
- package/fesm2022/edsis-angular-theme-page-overview.mjs +88 -0
- package/fesm2022/edsis-angular-theme-page-root.mjs +693 -0
- package/fesm2022/edsis-angular-theme-page-side.mjs +342 -0
- package/fesm2022/edsis-angular-theme-page-slots.mjs +258 -0
- package/fesm2022/edsis-angular-theme-page.mjs +7 -0
- package/fesm2022/edsis-angular-theme-shell-services.mjs +231 -0
- package/fesm2022/edsis-angular-theme-shell-types.mjs +102 -0
- package/fesm2022/edsis-angular-theme-shell.mjs +1352 -0
- package/fesm2022/edsis-angular-theme-styles.mjs +572 -0
- package/fesm2022/edsis-angular-theme.mjs +0 -0
- package/fesm2022/edsis-angular.mjs +5 -8
- package/navigation/README.md +576 -0
- package/package.json +477 -52
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +120 -0
- package/theme/component/settings/README.md +154 -0
- package/theme/layout/README.md +604 -0
- package/theme/page/README.md +505 -0
- package/theme/shell/README.md +344 -0
- package/theme/styles/README.md +202 -0
- package/theme/styles/css/base/components.css +577 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +208 -0
- package/theme/styles/css/base/theme.css +353 -0
- package/theme/styles/css/base/tokens.css +388 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/fonts.css +85 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/edsis-angular-chart-area.d.ts +139 -0
- package/types/edsis-angular-chart-bar.d.ts +291 -0
- package/types/edsis-angular-chart-core.d.ts +822 -0
- package/types/edsis-angular-chart-line.d.ts +148 -0
- package/types/edsis-angular-chart-pie.d.ts +202 -0
- package/types/edsis-angular-chart-primitives.d.ts +360 -0
- package/types/edsis-angular-chart-radar.d.ts +198 -0
- package/types/edsis-angular-chart-radial.d.ts +187 -0
- package/types/edsis-angular-chart-scatter.d.ts +181 -0
- package/types/edsis-angular-chart.d.ts +3 -0
- package/types/edsis-angular-component-accordion.d.ts +139 -0
- package/types/edsis-angular-component-alert-dialog.d.ts +288 -0
- package/types/edsis-angular-component-alert.d.ts +72 -0
- package/types/edsis-angular-component-aspect-ratio.d.ts +20 -0
- package/types/edsis-angular-component-avatar.d.ts +111 -0
- package/types/edsis-angular-component-badge.d.ts +36 -0
- package/types/edsis-angular-component-breadcrumb.d.ts +85 -0
- package/types/edsis-angular-component-button-group.d.ts +50 -0
- package/types/edsis-angular-component-button.d.ts +44 -0
- package/types/edsis-angular-component-calendar.d.ts +150 -0
- package/types/edsis-angular-component-card.d.ts +123 -0
- package/types/edsis-angular-component-carousel.d.ts +155 -0
- package/types/edsis-angular-component-checkbox.d.ts +100 -0
- package/types/edsis-angular-component-collapsible.d.ts +68 -0
- package/types/edsis-angular-component-combobox.d.ts +105 -0
- package/types/edsis-angular-component-command.d.ts +215 -0
- package/types/edsis-angular-component-composer.d.ts +190 -0
- package/types/edsis-angular-component-context-menu.d.ts +64 -0
- package/types/edsis-angular-component-date-picker.d.ts +199 -0
- package/types/edsis-angular-component-dialog.d.ts +231 -0
- package/types/edsis-angular-component-drawer.d.ts +2 -0
- package/types/edsis-angular-component-dropdown-menu.d.ts +370 -0
- package/types/edsis-angular-component-editor.d.ts +234 -0
- package/types/edsis-angular-component-empty.d.ts +85 -0
- package/types/edsis-angular-component-form.d.ts +223 -0
- package/types/edsis-angular-component-hover-card.d.ts +133 -0
- package/types/edsis-angular-component-icon.d.ts +90 -0
- package/types/edsis-angular-component-input-group.d.ts +98 -0
- package/types/edsis-angular-component-input-otp.d.ts +249 -0
- package/types/edsis-angular-component-input.d.ts +31 -0
- package/types/edsis-angular-component-item.d.ts +169 -0
- package/types/edsis-angular-component-kanban.d.ts +165 -0
- package/types/edsis-angular-component-kbd.d.ts +25 -0
- package/types/edsis-angular-component-label.d.ts +19 -0
- package/types/edsis-angular-component-menubar.d.ts +123 -0
- package/types/edsis-angular-component-native-select.d.ts +39 -0
- package/types/edsis-angular-component-navigation-menu.d.ts +163 -0
- package/types/edsis-angular-component-pagination.d.ts +83 -0
- package/types/edsis-angular-component-pillbox.d.ts +380 -0
- package/types/edsis-angular-component-popover.d.ts +96 -0
- package/types/edsis-angular-component-progress.d.ts +45 -0
- package/types/edsis-angular-component-radio.d.ts +137 -0
- package/types/edsis-angular-component-resizable.d.ts +166 -0
- package/types/edsis-angular-component-scroll-area.d.ts +37 -0
- package/types/edsis-angular-component-segmented-control.d.ts +102 -0
- package/types/edsis-angular-component-select.d.ts +138 -0
- package/types/edsis-angular-component-separator.d.ts +26 -0
- package/types/edsis-angular-component-sheet.d.ts +240 -0
- package/types/edsis-angular-component-skeleton.d.ts +13 -0
- package/types/edsis-angular-component-slider.d.ts +148 -0
- package/types/edsis-angular-component-spinner.d.ts +31 -0
- package/types/edsis-angular-component-switch.d.ts +101 -0
- package/types/edsis-angular-component-table.d.ts +109 -0
- package/types/edsis-angular-component-tabs.d.ts +183 -0
- package/types/edsis-angular-component-textarea.d.ts +27 -0
- package/types/edsis-angular-component-timeline.d.ts +146 -0
- package/types/edsis-angular-component-toast.d.ts +60 -0
- package/types/edsis-angular-component-toggle-group.d.ts +161 -0
- package/types/edsis-angular-component-toggle.d.ts +47 -0
- package/types/edsis-angular-component-tooltip.d.ts +233 -0
- package/types/edsis-angular-component-utils-core.d.ts +175 -0
- package/types/edsis-angular-component-utils-overlay.d.ts +17 -0
- package/types/edsis-angular-component-utils-scale.d.ts +27 -0
- package/types/edsis-angular-component-utils.d.ts +2 -0
- package/types/edsis-angular-component.d.ts +1 -0
- package/types/edsis-angular-navigation-core.d.ts +55 -0
- package/types/edsis-angular-navigation-icon.d.ts +9 -0
- package/types/edsis-angular-navigation-service.d.ts +121 -0
- package/types/edsis-angular-navigation-types.d.ts +185 -0
- package/types/edsis-angular-navigation.d.ts +862 -0
- package/types/edsis-angular-sdk.d.ts +87 -0
- package/types/edsis-angular-theme-component-settings.d.ts +205 -0
- package/types/edsis-angular-theme-layout-services.d.ts +143 -0
- package/types/edsis-angular-theme-layout-types.d.ts +36 -0
- package/types/edsis-angular-theme-layout-wrapper.d.ts +670 -0
- package/types/edsis-angular-theme-layout.d.ts +218 -0
- package/types/edsis-angular-theme-page-core.d.ts +151 -0
- package/types/edsis-angular-theme-page-filter.d.ts +127 -0
- package/types/edsis-angular-theme-page-overview.d.ts +28 -0
- package/types/edsis-angular-theme-page-root.d.ts +172 -0
- package/types/edsis-angular-theme-page-side.d.ts +90 -0
- package/types/edsis-angular-theme-page-slots.d.ts +61 -0
- package/types/edsis-angular-theme-page.d.ts +7 -0
- package/types/edsis-angular-theme-shell-services.d.ts +188 -0
- package/types/edsis-angular-theme-shell-types.d.ts +102 -0
- package/types/edsis-angular-theme-shell.d.ts +178 -0
- package/types/edsis-angular-theme-styles.d.ts +295 -0
- package/types/edsis-angular-theme.d.ts +1 -0
- package/types/edsis-angular.d.ts +5 -2
- package/fesm2022/edsis-angular-block-shell.mjs +0 -1329
- package/fesm2022/edsis-angular-block-shell.mjs.map +0 -1
- package/fesm2022/edsis-angular-block-themes.mjs +0 -1007
- package/fesm2022/edsis-angular-block-themes.mjs.map +0 -1
- package/fesm2022/edsis-angular-module-auth.mjs +0 -2582
- package/fesm2022/edsis-angular-module-auth.mjs.map +0 -1
- package/fesm2022/edsis-angular-platform-mfe.mjs +0 -329
- package/fesm2022/edsis-angular-platform-mfe.mjs.map +0 -1
- package/fesm2022/edsis-angular-services-runtime.mjs +0 -385
- package/fesm2022/edsis-angular-services-runtime.mjs.map +0 -1
- package/fesm2022/edsis-angular.mjs.map +0 -1
- package/types/edsis-angular-block-shell.d.ts +0 -190
- package/types/edsis-angular-block-themes.d.ts +0 -94
- package/types/edsis-angular-module-auth.d.ts +0 -533
- package/types/edsis-angular-platform-mfe.d.ts +0 -126
- package/types/edsis-angular-services-runtime.d.ts +0 -118
|
@@ -1,2582 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Service, inject, signal, computed, makeEnvironmentProviders, provideAppInitializer, Component, DestroyRef, Injector, viewChild, ElementRef, effect, afterNextRender, input, untracked } from '@angular/core';
|
|
3
|
-
import { HttpClient, HttpErrorResponse, HttpContextToken, HttpContext, provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
|
|
4
|
-
import { provideApiConfiguration } from '@edsis/sdk/shared';
|
|
5
|
-
import { Router, RouterOutlet, ActivatedRoute, RouterLink } from '@angular/router';
|
|
6
|
-
import { setNativeNotificationBadge, RuntimeContextService, NativeHostService } from '@edsis/angular/services/runtime';
|
|
7
|
-
import { firstValueFrom, throwError, from, timeout, finalize } from 'rxjs';
|
|
8
|
-
import { catchError, switchMap } from 'rxjs/operators';
|
|
9
|
-
import { DOCUMENT, Location } from '@angular/common';
|
|
10
|
-
import { LayoutService, LayoutComponent, DesktopAppBarComponent, LayoutFluidComponent } from '@edsis/theme/layout';
|
|
11
|
-
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
12
|
-
import { AuthSessionService, AuthMagicLinkService } from '@edsis/sdk/auth';
|
|
13
|
-
import { AlertComponent, AlertDescriptionComponent } from '@edsis/component/alert';
|
|
14
|
-
import { AspectRatioComponent } from '@edsis/component/aspect-ratio';
|
|
15
|
-
import { ButtonComponent } from '@edsis/component/button';
|
|
16
|
-
import { CardActionComponent, CardComponent, CardContentComponent, CardDescriptionComponent, CardFooterComponent, CardHeaderComponent, CardTitleComponent } from '@edsis/component/card';
|
|
17
|
-
import { SpinnerComponent } from '@edsis/component/spinner';
|
|
18
|
-
import { form, required, email, maxLength, submit, FormField } from '@angular/forms/signals';
|
|
19
|
-
import { InputGroupAddonComponent, InputGroupButtonComponent, InputGroupComponent, InputGroupInputComponent } from '@edsis/component/input-group';
|
|
20
|
-
import { LabelComponent } from '@edsis/component/label';
|
|
21
|
-
import { SeparatorComponent } from '@edsis/component/separator';
|
|
22
|
-
|
|
23
|
-
const DEFAULT_LOGIN_PATH = '/login';
|
|
24
|
-
const DEFAULT_LOGOUT_PATH = '/logout';
|
|
25
|
-
const DEFAULT_VERIFY_PATH = '/verify';
|
|
26
|
-
const DEFAULT_AUTHENTICATED_HOME_PATH = '/dashboard';
|
|
27
|
-
const DEFAULT_HEALTH_CHECK_TIMEOUT_MS = 4000;
|
|
28
|
-
const GOOGLE_AUTH_GATEWAY_DEFAULT_START_ENDPOINT = '/v1/auth/google/start';
|
|
29
|
-
const GOOGLE_AUTH_GATEWAY_DEFAULT_HANDOFF_ENDPOINT = '/v1/auth/google/handoff';
|
|
30
|
-
/**
|
|
31
|
-
* Path route callback Google di dalam `authRoutes`; juga menjadi sumber
|
|
32
|
-
* derivasi `redirectUri` (`${appUrl}/auth/google/callback`), sehingga URL yang
|
|
33
|
-
* didaftarkan di Google Cloud Console selalu konsisten dengan route library.
|
|
34
|
-
*/
|
|
35
|
-
const GOOGLE_OAUTH_CALLBACK_ROUTE_PATH = 'auth/google/callback';
|
|
36
|
-
const EDSIS_AUTH_CONFIG = new InjectionToken('EDSIS_AUTH_CONFIG');
|
|
37
|
-
function resolveEdsisAuthConfig(config) {
|
|
38
|
-
const loginPath = normalizePath(config.loginPath, DEFAULT_LOGIN_PATH);
|
|
39
|
-
const apiUrl = normalizeAbsoluteUrl(config.apiUrl, 'apiUrl');
|
|
40
|
-
const appUrl = normalizeAbsoluteUrl(config.appUrl, 'appUrl');
|
|
41
|
-
return {
|
|
42
|
-
apiUrl,
|
|
43
|
-
appUrl,
|
|
44
|
-
loginPath,
|
|
45
|
-
logoutPath: normalizePath(config.logoutPath, DEFAULT_LOGOUT_PATH),
|
|
46
|
-
verifyPath: normalizePath(config.verifyPath, DEFAULT_VERIFY_PATH),
|
|
47
|
-
authenticatedHomePath: normalizePath(config.authenticatedHomePath, DEFAULT_AUTHENTICATED_HOME_PATH),
|
|
48
|
-
guestHomePath: normalizePath(config.guestHomePath, loginPath),
|
|
49
|
-
healthCheck: {
|
|
50
|
-
enabled: config.healthCheck?.enabled ?? false,
|
|
51
|
-
url: config.healthCheck?.url ?? `${apiUrl.replace(/\/+$/, '')}/health`,
|
|
52
|
-
timeoutMs: config.healthCheck?.timeoutMs ?? DEFAULT_HEALTH_CHECK_TIMEOUT_MS,
|
|
53
|
-
},
|
|
54
|
-
oauth: {
|
|
55
|
-
google: resolveGoogleOauth(config.oauth?.google, appUrl, apiUrl),
|
|
56
|
-
nativeGoogle: config.oauth?.nativeGoogle && config.oauth.nativeGoogle.enabled !== false
|
|
57
|
-
? { apiUrl: normalizeSameOriginPath(config.oauth.nativeGoogle.apiUrl ?? '/api') }
|
|
58
|
-
: null,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
function resolveGoogleOauth(config, appUrl, apiUrl) {
|
|
63
|
-
if (!config) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const callbackUrl = `${appUrl}/${GOOGLE_OAUTH_CALLBACK_ROUTE_PATH}`;
|
|
67
|
-
if (config.mode === 'gateway') {
|
|
68
|
-
const mfeId = config.mfeId.trim();
|
|
69
|
-
if (mfeId.length > 64 || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(mfeId)) {
|
|
70
|
-
throw new Error('Edsis Google Auth Gateway requires a lower-kebab-case mfeId of at most 64 characters.');
|
|
71
|
-
}
|
|
72
|
-
const baseUrl = normalizeGatewayBaseUrl(config.gateway?.baseUrl ?? apiUrl, apiUrl);
|
|
73
|
-
const startEndpoint = normalizeGatewayEndpoint(config.gateway?.startEndpoint ?? GOOGLE_AUTH_GATEWAY_DEFAULT_START_ENDPOINT, 'startEndpoint');
|
|
74
|
-
const handoffEndpoint = normalizeGatewayEndpoint(config.gateway?.handoffEndpoint ?? GOOGLE_AUTH_GATEWAY_DEFAULT_HANDOFF_ENDPOINT, 'handoffEndpoint');
|
|
75
|
-
return {
|
|
76
|
-
mode: 'gateway',
|
|
77
|
-
mfeId,
|
|
78
|
-
returnUrl: callbackUrl,
|
|
79
|
-
gateway: {
|
|
80
|
-
baseUrl,
|
|
81
|
-
startUrl: joinGatewayUrl(baseUrl, startEndpoint),
|
|
82
|
-
handoffUrl: joinGatewayUrl(baseUrl, handoffEndpoint),
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const clientId = config.clientId.trim();
|
|
87
|
-
return clientId
|
|
88
|
-
? {
|
|
89
|
-
mode: 'direct',
|
|
90
|
-
clientId,
|
|
91
|
-
redirectUri: callbackUrl,
|
|
92
|
-
}
|
|
93
|
-
: null;
|
|
94
|
-
}
|
|
95
|
-
function normalizeGatewayBaseUrl(value, apiUrl) {
|
|
96
|
-
const baseUrl = normalizeAbsoluteUrl(value, 'Google Auth Gateway baseUrl');
|
|
97
|
-
const parsed = new URL(baseUrl);
|
|
98
|
-
const apiOrigin = new URL(apiUrl).origin;
|
|
99
|
-
const isLoopback = ['localhost', '127.0.0.1', '[::1]'].includes(parsed.hostname);
|
|
100
|
-
const hasAllowedProtocol = parsed.protocol === 'https:' || (parsed.protocol === 'http:' && isLoopback);
|
|
101
|
-
if (!hasAllowedProtocol || parsed.username || parsed.password || parsed.search || parsed.hash) {
|
|
102
|
-
throw new Error('Edsis Google Auth Gateway baseUrl must use HTTPS (HTTP is allowed only for loopback development) without credentials, query, or hash.');
|
|
103
|
-
}
|
|
104
|
-
if (parsed.origin !== apiOrigin) {
|
|
105
|
-
throw new Error('Edsis Google Auth Gateway baseUrl must use the same origin (scheme, host, and port) as apiUrl so the refresh-cookie session cannot split across origins.');
|
|
106
|
-
}
|
|
107
|
-
return baseUrl;
|
|
108
|
-
}
|
|
109
|
-
function normalizeGatewayEndpoint(value, label) {
|
|
110
|
-
const endpoint = value.trim();
|
|
111
|
-
const segments = endpoint.split('/').slice(1);
|
|
112
|
-
if (!endpoint.startsWith('/') ||
|
|
113
|
-
endpoint.startsWith('//') ||
|
|
114
|
-
endpoint.includes('?') ||
|
|
115
|
-
endpoint.includes('#') ||
|
|
116
|
-
segments.length === 0 ||
|
|
117
|
-
segments.some((segment) => !/^[A-Za-z0-9._~-]+$/u.test(segment) || segment === '.' || segment === '..')) {
|
|
118
|
-
throw new Error(`Edsis Google Auth Gateway ${label} must be a root-relative path.`);
|
|
119
|
-
}
|
|
120
|
-
return endpoint;
|
|
121
|
-
}
|
|
122
|
-
function joinGatewayUrl(baseUrl, endpoint) {
|
|
123
|
-
return `${baseUrl}/${endpoint.replace(/^\/+/, '')}`;
|
|
124
|
-
}
|
|
125
|
-
function normalizeSameOriginPath(value) {
|
|
126
|
-
const normalizedValue = value.trim().replace(/\/+$/u, '');
|
|
127
|
-
if (!normalizedValue.startsWith('/') ||
|
|
128
|
-
normalizedValue.startsWith('//') ||
|
|
129
|
-
normalizedValue.includes('?') ||
|
|
130
|
-
normalizedValue.includes('#')) {
|
|
131
|
-
throw new Error('Edsis native Google auth requires a same-origin apiUrl path.');
|
|
132
|
-
}
|
|
133
|
-
return (normalizedValue || '/');
|
|
134
|
-
}
|
|
135
|
-
function normalizeAbsoluteUrl(value, label) {
|
|
136
|
-
const normalizedValue = value.trim();
|
|
137
|
-
if (!normalizedValue) {
|
|
138
|
-
throw new Error(`Edsis auth requires a non-empty ${label}.`);
|
|
139
|
-
}
|
|
140
|
-
const normalizedUrl = new URL(normalizedValue);
|
|
141
|
-
return normalizedUrl.toString().replace(/\/$/, '');
|
|
142
|
-
}
|
|
143
|
-
function normalizePath(value, fallback) {
|
|
144
|
-
const normalizedValue = value?.trim();
|
|
145
|
-
if (!normalizedValue) {
|
|
146
|
-
return fallback;
|
|
147
|
-
}
|
|
148
|
-
return (normalizedValue.startsWith('/') ? normalizedValue : `/${normalizedValue}`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const DEFAULT_EDSIS_AUTH_MESSAGES = {
|
|
152
|
-
brand: {
|
|
153
|
-
mark: 'ETOS',
|
|
154
|
-
},
|
|
155
|
-
login: {
|
|
156
|
-
title: 'Etos Account Center',
|
|
157
|
-
intro: 'Masukkan email yang terdaftar. Kami akan mengirimkan tautan verifikasi untuk masuk ke aplikasi.',
|
|
158
|
-
badge: 'LOGIN',
|
|
159
|
-
emailPlaceholder: 'your@email.com',
|
|
160
|
-
submit: 'Kirim',
|
|
161
|
-
submitting: 'Mengirim...',
|
|
162
|
-
emailRequired: 'Email wajib diisi.',
|
|
163
|
-
emailInvalid: 'Gunakan format email yang valid dengan panjang maksimal 255 karakter.',
|
|
164
|
-
magicLinkSent: 'Magic link berhasil dikirim.',
|
|
165
|
-
magicLinkFailed: 'Gagal mengirim magic link.',
|
|
166
|
-
oauthComingSoon: 'Segera hadir',
|
|
167
|
-
oauthGoogleAria: 'Login dengan Google segera hadir',
|
|
168
|
-
oauthMicrosoftAria: 'Login dengan Microsoft segera hadir',
|
|
169
|
-
oauthAppleAria: 'Login dengan Apple segera hadir',
|
|
170
|
-
healthUnavailableTitle: 'Layanan sedang tidak tersedia',
|
|
171
|
-
healthUnavailableBody: 'Kami tidak dapat menghubungi server autentikasi. Silakan coba lagi.',
|
|
172
|
-
healthRetry: 'Coba lagi',
|
|
173
|
-
healthChecking: 'Memeriksa ketersediaan layanan…',
|
|
174
|
-
},
|
|
175
|
-
google: {
|
|
176
|
-
title: 'Menyelesaikan Google Sign-In.',
|
|
177
|
-
intro: 'Kode otorisasi dari Google ditukar menjadi sesi oleh backend, sesi refresh cookie dibentuk, lalu access token hanya disimpan di memori aplikasi.',
|
|
178
|
-
badge: 'GOOGLE',
|
|
179
|
-
signInAria: 'Login dengan Google',
|
|
180
|
-
googleRedirecting: 'Mengarahkan ke Google...',
|
|
181
|
-
gatewayStartFailed: 'Gagal memulai login melalui Auth Gateway. Silakan coba lagi.',
|
|
182
|
-
gatewayHandoffInProgress: 'Menyelesaikan sesi Google melalui Auth Gateway...',
|
|
183
|
-
gatewaySessionMissing: 'Sesi keamanan Auth Gateway tidak ditemukan atau sudah kedaluwarsa. Silakan ulangi login dari awal.',
|
|
184
|
-
nativeSignInInProgress: 'Menyelesaikan login Google di perangkat...',
|
|
185
|
-
nativeSignInUnavailable: 'Google Sign-In native tidak tersedia pada perangkat ini. Perbarui aplikasi atau hubungi administrator.',
|
|
186
|
-
nativeSignInFailed: 'Login Google pada perangkat gagal diproses.',
|
|
187
|
-
googleExchangeInProgress: 'Menukar kode otorisasi Google...',
|
|
188
|
-
exchangeInProgressAria: 'Menukar kode otorisasi Google',
|
|
189
|
-
googleStateMismatch: 'Verifikasi keamanan gagal: state OAuth tidak cocok atau hilang. Silakan ulangi login dari awal.',
|
|
190
|
-
googleAccessDenied: 'Login Google dibatalkan. Silakan coba lagi jika ini tidak disengaja.',
|
|
191
|
-
googleCallbackError: 'Login Google gagal diproses.',
|
|
192
|
-
googleRetry: 'Kembali ke login',
|
|
193
|
-
missingAccessToken: 'Login Google berhasil, tetapi access token tidak ditemukan di respons backend.',
|
|
194
|
-
successRedirect: 'Login Google berhasil. Mengarahkan ke dashboard...',
|
|
195
|
-
openDashboard: 'Buka dashboard',
|
|
196
|
-
},
|
|
197
|
-
logout: {
|
|
198
|
-
title: 'Mengakhiri sesi Edsis.',
|
|
199
|
-
intro: 'Halaman ini membersihkan sesi lokal lalu memanggil endpoint logout untuk merevoke refresh-token cookie pada backend.',
|
|
200
|
-
badge: 'LOGOUT',
|
|
201
|
-
pending: 'Mengakhiri sesi...',
|
|
202
|
-
pendingAria: 'Mengakhiri sesi',
|
|
203
|
-
success: 'Sesi berhasil diakhiri.',
|
|
204
|
-
failed: 'Sesi lokal sudah dihapus, tetapi request logout gagal.',
|
|
205
|
-
failedNote: 'Backend tidak mengonfirmasi logout, tetapi sesi lokal sudah dihapus.',
|
|
206
|
-
backToLogin: 'Kembali ke login',
|
|
207
|
-
openDashboard: 'Buka dashboard',
|
|
208
|
-
},
|
|
209
|
-
verify: {
|
|
210
|
-
title: 'Memverifikasi magic link.',
|
|
211
|
-
intro: 'Token akan dikonsumsi satu kali, sesi refresh cookie dibentuk di backend, lalu access token disimpan secara lokal untuk aplikasi.',
|
|
212
|
-
badge: 'VERIFY',
|
|
213
|
-
pending: 'Memverifikasi magic link...',
|
|
214
|
-
pendingAria: 'Memverifikasi magic link',
|
|
215
|
-
tokenMissing: 'Token magic link tidak ditemukan pada URL yang dibuka.',
|
|
216
|
-
invalidOrExpired: 'Magic link tidak valid atau sudah kedaluwarsa.',
|
|
217
|
-
successRedirect: 'Verifikasi berhasil. Mengarahkan ke dashboard...',
|
|
218
|
-
missingAccessToken: 'Verifikasi berhasil, tetapi access token tidak ditemukan di respons backend.',
|
|
219
|
-
requestNewLink: 'Minta link baru',
|
|
220
|
-
openDashboard: 'Buka dashboard',
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
const EDSIS_AUTH_MESSAGES = new InjectionToken('EDSIS_AUTH_MESSAGES', {
|
|
224
|
-
factory: () => DEFAULT_EDSIS_AUTH_MESSAGES,
|
|
225
|
-
});
|
|
226
|
-
function mergeEdsisAuthMessages(override) {
|
|
227
|
-
if (!override) {
|
|
228
|
-
return DEFAULT_EDSIS_AUTH_MESSAGES;
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
brand: { ...DEFAULT_EDSIS_AUTH_MESSAGES.brand, ...override.brand },
|
|
232
|
-
login: { ...DEFAULT_EDSIS_AUTH_MESSAGES.login, ...override.login },
|
|
233
|
-
google: { ...DEFAULT_EDSIS_AUTH_MESSAGES.google, ...override.google },
|
|
234
|
-
logout: { ...DEFAULT_EDSIS_AUTH_MESSAGES.logout, ...override.logout },
|
|
235
|
-
verify: { ...DEFAULT_EDSIS_AUTH_MESSAGES.verify, ...override.verify },
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER = new InjectionToken('EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER');
|
|
240
|
-
class TauriNativeGoogleAuthAdapter {
|
|
241
|
-
async signInWithGoogle(input) {
|
|
242
|
-
const { invoke } = await import('@tauri-apps/api/core');
|
|
243
|
-
const response = await invoke('plugin:edsis-google-auth|sign_in', {
|
|
244
|
-
nonce: input.nonce,
|
|
245
|
-
});
|
|
246
|
-
if (!isNativeGoogleSignInResult(response)) {
|
|
247
|
-
throw new Error('Native Google Sign-In returned an invalid response.');
|
|
248
|
-
}
|
|
249
|
-
return response;
|
|
250
|
-
}
|
|
251
|
-
async signOutFromGoogle() {
|
|
252
|
-
const { invoke } = await import('@tauri-apps/api/core');
|
|
253
|
-
await invoke('plugin:edsis-google-auth|sign_out');
|
|
254
|
-
}
|
|
255
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TauriNativeGoogleAuthAdapter, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
256
|
-
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.0", ngImport: i0, type: TauriNativeGoogleAuthAdapter, autoProvided: false });
|
|
257
|
-
}
|
|
258
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: TauriNativeGoogleAuthAdapter, decorators: [{
|
|
259
|
-
type: Service,
|
|
260
|
-
args: [{ autoProvided: false }]
|
|
261
|
-
}] });
|
|
262
|
-
function isNativeGoogleSignInResult(value) {
|
|
263
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
const result = value;
|
|
267
|
-
return ((result['platform'] === 'ios' || result['platform'] === 'android') &&
|
|
268
|
-
typeof result['idToken'] === 'string' &&
|
|
269
|
-
result['idToken'].trim().length > 0 &&
|
|
270
|
-
typeof result['clientInstanceId'] === 'string' &&
|
|
271
|
-
result['clientInstanceId'].trim().length > 0);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/** Native desktop features are optional; browser consumers have no bridge. */
|
|
275
|
-
async function setAuthNotificationBadge(unreadCount) {
|
|
276
|
-
await setNativeNotificationBadge(unreadCount);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Cookie-backed authentication state. The access token intentionally exists
|
|
280
|
-
* only in this service instance; the long-lived refresh token is an HttpOnly
|
|
281
|
-
* cookie owned by the server.
|
|
282
|
-
*/
|
|
283
|
-
class AuthService {
|
|
284
|
-
http = inject(HttpClient);
|
|
285
|
-
config = inject(EDSIS_AUTH_CONFIG);
|
|
286
|
-
router = inject(Router, { optional: true });
|
|
287
|
-
runtime = inject(RuntimeContextService, { optional: true });
|
|
288
|
-
nativeGoogleAdapter = inject(EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER, {
|
|
289
|
-
optional: true,
|
|
290
|
-
});
|
|
291
|
-
accessTokenState = signal('', /* @ts-ignore */
|
|
292
|
-
...(ngDevMode ? [{ debugName: "accessTokenState" }] : /* istanbul ignore next */ []));
|
|
293
|
-
userState = signal(null, /* @ts-ignore */
|
|
294
|
-
...(ngDevMode ? [{ debugName: "userState" }] : /* istanbul ignore next */ []));
|
|
295
|
-
refreshInFlight = null;
|
|
296
|
-
initialization = null;
|
|
297
|
-
accessToken = this.accessTokenState.asReadonly();
|
|
298
|
-
user = this.userState.asReadonly();
|
|
299
|
-
isAuthenticated = computed(() => Boolean(this.accessTokenState()), /* @ts-ignore */
|
|
300
|
-
...(ngDevMode ? [{ debugName: "isAuthenticated" }] : /* istanbul ignore next */ []));
|
|
301
|
-
get apiUrl() {
|
|
302
|
-
return this.config.apiUrl.replace(/\/+$/u, '');
|
|
303
|
-
}
|
|
304
|
-
get sessionApiUrl() {
|
|
305
|
-
const nativeApiUrl = this.config.oauth.nativeGoogle?.apiUrl;
|
|
306
|
-
if (this.runtime?.isTabletShell() === true && nativeApiUrl) {
|
|
307
|
-
return nativeApiUrl.replace(/\/+$/u, '');
|
|
308
|
-
}
|
|
309
|
-
const google = this.config.oauth.google;
|
|
310
|
-
return google?.mode === 'gateway' ? google.gateway.baseUrl : this.apiUrl;
|
|
311
|
-
}
|
|
312
|
-
/** Restores an existing cookie session. A missing/expired cookie is normal. */
|
|
313
|
-
initialize() {
|
|
314
|
-
this.initialization ??= this.restoreSession();
|
|
315
|
-
return this.initialization;
|
|
316
|
-
}
|
|
317
|
-
async restoreSession() {
|
|
318
|
-
// Runtime selection must settle before choosing the cookie origin. Angular
|
|
319
|
-
// app initializers run concurrently, so auth cannot rely on provider order.
|
|
320
|
-
if (this.runtime) {
|
|
321
|
-
await this.runtime.initialize();
|
|
322
|
-
}
|
|
323
|
-
if (await this.refresh()) {
|
|
324
|
-
try {
|
|
325
|
-
await this.loadCurrentUser();
|
|
326
|
-
}
|
|
327
|
-
catch (error) {
|
|
328
|
-
// The interceptor has already attempted one cookie refresh. If it
|
|
329
|
-
// ultimately produced 401, startup remains an anonymous state rather
|
|
330
|
-
// than a rejected app initializer.
|
|
331
|
-
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
332
|
-
this.clearSession();
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
throw error;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/** One shared refresh operation for initializer and concurrent 401 retries. */
|
|
340
|
-
refresh() {
|
|
341
|
-
if (this.refreshInFlight) {
|
|
342
|
-
return this.refreshInFlight;
|
|
343
|
-
}
|
|
344
|
-
this.refreshInFlight = firstValueFrom(this.http.post(`${this.sessionApiUrl}/v1/auth/refresh`, null, {
|
|
345
|
-
withCredentials: true,
|
|
346
|
-
}))
|
|
347
|
-
.then((response) => {
|
|
348
|
-
this.applyTokenResponse(response);
|
|
349
|
-
return Boolean(this.accessTokenState());
|
|
350
|
-
})
|
|
351
|
-
.catch((error) => {
|
|
352
|
-
this.clearSession();
|
|
353
|
-
// A 401 on startup is an expected anonymous state, not an application error.
|
|
354
|
-
if (!(error instanceof HttpErrorResponse) || error.status !== 401) {
|
|
355
|
-
throw error;
|
|
356
|
-
}
|
|
357
|
-
return false;
|
|
358
|
-
})
|
|
359
|
-
.finally(() => {
|
|
360
|
-
this.refreshInFlight = null;
|
|
361
|
-
});
|
|
362
|
-
return this.refreshInFlight;
|
|
363
|
-
}
|
|
364
|
-
async loadCurrentUser() {
|
|
365
|
-
const token = this.accessTokenState();
|
|
366
|
-
if (!token) {
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
const response = await firstValueFrom(this.http.get(`${this.sessionApiUrl}/v1/auth/me`, {
|
|
370
|
-
withCredentials: true,
|
|
371
|
-
headers: { Authorization: `Bearer ${token}` },
|
|
372
|
-
}));
|
|
373
|
-
const user = response;
|
|
374
|
-
this.userState.set(user);
|
|
375
|
-
return user;
|
|
376
|
-
}
|
|
377
|
-
async logout() {
|
|
378
|
-
try {
|
|
379
|
-
await firstValueFrom(this.http.post(`${this.sessionApiUrl}/v1/auth/logout`, null, { withCredentials: true }));
|
|
380
|
-
}
|
|
381
|
-
finally {
|
|
382
|
-
this.clearSession();
|
|
383
|
-
await this.clearNativeGoogleSession();
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
clearSession() {
|
|
387
|
-
this.accessTokenState.set('');
|
|
388
|
-
this.userState.set(null);
|
|
389
|
-
}
|
|
390
|
-
/** Allows existing OAuth exchanges to establish the same memory-only state. */
|
|
391
|
-
acceptTokenResponse(response) {
|
|
392
|
-
if (response && typeof response === 'object') {
|
|
393
|
-
this.applyTokenResponse(response);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
redirectToLogin() {
|
|
397
|
-
this.clearSession();
|
|
398
|
-
void this.router?.navigateByUrl(this.config.guestHomePath, { replaceUrl: true });
|
|
399
|
-
}
|
|
400
|
-
applyTokenResponse(response) {
|
|
401
|
-
const isPersistentResponse = 'accessToken' in response;
|
|
402
|
-
const token = isPersistentResponse
|
|
403
|
-
? response.accessToken
|
|
404
|
-
: (response.access_token ?? response.data?.access_token);
|
|
405
|
-
this.accessTokenState.set(typeof token === 'string' ? token : '');
|
|
406
|
-
const user = isPersistentResponse ? response.user : (response.user ?? response.data?.user);
|
|
407
|
-
if (user) {
|
|
408
|
-
this.userState.set(user);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
async clearNativeGoogleSession() {
|
|
412
|
-
if (!this.nativeGoogleAdapter ||
|
|
413
|
-
this.runtime?.isTabletShell() !== true ||
|
|
414
|
-
!this.runtime.supports('google-native-sign-in')) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
try {
|
|
418
|
-
await this.nativeGoogleAdapter.signOutFromGoogle();
|
|
419
|
-
}
|
|
420
|
-
catch {
|
|
421
|
-
// Backend logout and memory cleanup remain authoritative. A native SDK
|
|
422
|
-
// sign-out failure must not restore or persist the application session.
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
426
|
-
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.0", ngImport: i0, type: AuthService });
|
|
427
|
-
}
|
|
428
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthService, decorators: [{
|
|
429
|
-
type: Service
|
|
430
|
-
}] });
|
|
431
|
-
|
|
432
|
-
const EDSIS_SKIP_AUTH = new HttpContextToken(() => false);
|
|
433
|
-
const EDSIS_AUTH_RETRY = new HttpContextToken(() => false);
|
|
434
|
-
const AUTH_ENDPOINTS = new Set(['/v1/auth/login', '/v1/auth/refresh', '/v1/auth/logout']);
|
|
435
|
-
function apiPath(url, apiUrl) {
|
|
436
|
-
// A consumer may use Angular's same-origin dev/prod proxy (`/api/...`) even
|
|
437
|
-
// when `apiUrl` names the upstream origin. Such relative URLs are API calls.
|
|
438
|
-
if (url.startsWith('/')) {
|
|
439
|
-
const path = url.split(/[?#]/, 1)[0] ?? url;
|
|
440
|
-
return path === '/api' || path.startsWith('/api/') ? path : null;
|
|
441
|
-
}
|
|
442
|
-
try {
|
|
443
|
-
const resolved = new URL(url);
|
|
444
|
-
const api = new URL(apiUrl);
|
|
445
|
-
if (resolved.origin !== api.origin)
|
|
446
|
-
return null;
|
|
447
|
-
const apiBasePath = api.pathname.replace(/\/+$/u, '') || '/';
|
|
448
|
-
if (apiBasePath !== '/' &&
|
|
449
|
-
resolved.pathname !== apiBasePath &&
|
|
450
|
-
!resolved.pathname.startsWith(`${apiBasePath}/`)) {
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
return resolved.pathname;
|
|
454
|
-
}
|
|
455
|
-
catch {
|
|
456
|
-
return null;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
function isApiRequest(url, apiUrl) {
|
|
460
|
-
return apiPath(url, apiUrl) !== null;
|
|
461
|
-
}
|
|
462
|
-
function authorize(request, token, retry = false) {
|
|
463
|
-
return request.clone({
|
|
464
|
-
withCredentials: true,
|
|
465
|
-
context: retry ? request.context.set(EDSIS_AUTH_RETRY, true) : request.context,
|
|
466
|
-
setHeaders: token ? { Authorization: `Bearer ${token}` } : {},
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
const edsisAuthInterceptor = (request, next) => {
|
|
470
|
-
const auth = inject(AuthService);
|
|
471
|
-
if (request.context.get(EDSIS_SKIP_AUTH) || !isApiRequest(request.url, auth.apiUrl)) {
|
|
472
|
-
return next(request);
|
|
473
|
-
}
|
|
474
|
-
const path = apiPath(request.url, auth.apiUrl);
|
|
475
|
-
const normalizedAuthPath = path?.startsWith('/api/') ? path.slice(4) : path;
|
|
476
|
-
const isAuthEndpoint = AUTH_ENDPOINTS.has(normalizedAuthPath ?? '') || normalizedAuthPath?.startsWith('/v1/auth/');
|
|
477
|
-
const prepared = authorize(request, isAuthEndpoint ? '' : auth.accessToken());
|
|
478
|
-
if (isAuthEndpoint) {
|
|
479
|
-
return next(prepared);
|
|
480
|
-
}
|
|
481
|
-
return next(prepared).pipe(catchError((error) => {
|
|
482
|
-
if (!(error instanceof HttpErrorResponse) ||
|
|
483
|
-
error.status !== 401 ||
|
|
484
|
-
request.context.get(EDSIS_AUTH_RETRY)) {
|
|
485
|
-
return throwError(() => error);
|
|
486
|
-
}
|
|
487
|
-
return from(auth.refresh()).pipe(switchMap((refreshed) => {
|
|
488
|
-
if (!refreshed) {
|
|
489
|
-
return throwError(() => error);
|
|
490
|
-
}
|
|
491
|
-
return next(authorize(request, auth.accessToken(), true));
|
|
492
|
-
}), catchError(() => {
|
|
493
|
-
auth.redirectToLogin();
|
|
494
|
-
return throwError(() => error);
|
|
495
|
-
}));
|
|
496
|
-
}));
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Health-check backend auth untuk `AuthLoginPage` (internal, di-provide oleh
|
|
501
|
-
* `provideEdsisAuth`). Sehat = HTTP 2xx dalam `timeoutMs`; body tidak diparse.
|
|
502
|
-
* Tanpa polling — hanya on-load, pre-submit, dan Retry manual.
|
|
503
|
-
*/
|
|
504
|
-
class AuthHealthService {
|
|
505
|
-
http = inject(HttpClient);
|
|
506
|
-
config = inject(EDSIS_AUTH_CONFIG);
|
|
507
|
-
_status = signal('idle', /* @ts-ignore */
|
|
508
|
-
...(ngDevMode ? [{ debugName: "_status" }] : /* istanbul ignore next */ []));
|
|
509
|
-
status = this._status.asReadonly();
|
|
510
|
-
isChecking = computed(() => this._status() === 'checking', /* @ts-ignore */
|
|
511
|
-
...(ngDevMode ? [{ debugName: "isChecking" }] : /* istanbul ignore next */ []));
|
|
512
|
-
isUnhealthy = computed(() => this._status() === 'unhealthy', /* @ts-ignore */
|
|
513
|
-
...(ngDevMode ? [{ debugName: "isUnhealthy" }] : /* istanbul ignore next */ []));
|
|
514
|
-
inFlight = false;
|
|
515
|
-
/** true jika sehat ATAU health-check dimatikan. Tak pernah throw. */
|
|
516
|
-
async check() {
|
|
517
|
-
const healthCheck = this.config.healthCheck;
|
|
518
|
-
if (!healthCheck.enabled) {
|
|
519
|
-
this._status.set('healthy');
|
|
520
|
-
return true;
|
|
521
|
-
}
|
|
522
|
-
if (this.inFlight) {
|
|
523
|
-
return this._status() === 'healthy';
|
|
524
|
-
}
|
|
525
|
-
this.inFlight = true;
|
|
526
|
-
this._status.set('checking');
|
|
527
|
-
try {
|
|
528
|
-
await firstValueFrom(this.http
|
|
529
|
-
.get(healthCheck.url, {
|
|
530
|
-
observe: 'response',
|
|
531
|
-
context: new HttpContext().set(EDSIS_SKIP_AUTH, true),
|
|
532
|
-
})
|
|
533
|
-
.pipe(timeout(healthCheck.timeoutMs)));
|
|
534
|
-
this._status.set('healthy');
|
|
535
|
-
return true;
|
|
536
|
-
}
|
|
537
|
-
catch {
|
|
538
|
-
this._status.set('unhealthy');
|
|
539
|
-
return false;
|
|
540
|
-
}
|
|
541
|
-
finally {
|
|
542
|
-
this.inFlight = false;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthHealthService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
546
|
-
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.0", ngImport: i0, type: AuthHealthService, autoProvided: false });
|
|
547
|
-
}
|
|
548
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthHealthService, decorators: [{
|
|
549
|
-
type: Service,
|
|
550
|
-
args: [{ autoProvided: false }]
|
|
551
|
-
}] });
|
|
552
|
-
|
|
553
|
-
class NativeGoogleAuthService {
|
|
554
|
-
http = inject(HttpClient);
|
|
555
|
-
auth = inject(AuthService);
|
|
556
|
-
config = inject(EDSIS_AUTH_CONFIG);
|
|
557
|
-
runtime = inject(RuntimeContextService, { optional: true });
|
|
558
|
-
adapter = inject(EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER);
|
|
559
|
-
requiresNativeGoogle = computed(() => this.runtime?.isTabletShell() === true, /* @ts-ignore */
|
|
560
|
-
...(ngDevMode ? [{ debugName: "requiresNativeGoogle" }] : /* istanbul ignore next */ []));
|
|
561
|
-
isAvailable = computed(() => {
|
|
562
|
-
const runtime = this.runtime;
|
|
563
|
-
return (this.config.oauth.nativeGoogle !== null &&
|
|
564
|
-
runtime?.isTabletShell() === true &&
|
|
565
|
-
toNativePlatform(runtime.context().platform) !== null &&
|
|
566
|
-
runtime.supports('google-native-sign-in'));
|
|
567
|
-
}, /* @ts-ignore */
|
|
568
|
-
...(ngDevMode ? [{ debugName: "isAvailable" }] : /* istanbul ignore next */ []));
|
|
569
|
-
async signIn() {
|
|
570
|
-
const nativeConfig = this.config.oauth.nativeGoogle;
|
|
571
|
-
const platform = toNativePlatform(this.runtime?.context().platform);
|
|
572
|
-
if (!nativeConfig || !platform || !this.isAvailable()) {
|
|
573
|
-
throw new Error('Native Google Sign-In is not available in this runtime.');
|
|
574
|
-
}
|
|
575
|
-
const challengeResponse = await firstValueFrom(this.http.post(`${nativeConfig.apiUrl}/v1/auth/google/native/challenge`, { platform, deviceType: 'tablet' }, { withCredentials: true }));
|
|
576
|
-
const challenge = parseChallenge(challengeResponse);
|
|
577
|
-
const response = await this.exchangeNativeToken(nativeConfig.apiUrl, platform, challenge);
|
|
578
|
-
this.auth.acceptTokenResponse(response);
|
|
579
|
-
if (!this.auth.isAuthenticated()) {
|
|
580
|
-
throw new Error('Native Google Sign-In response did not contain an access token.');
|
|
581
|
-
}
|
|
582
|
-
try {
|
|
583
|
-
await this.auth.loadCurrentUser();
|
|
584
|
-
}
|
|
585
|
-
catch (error) {
|
|
586
|
-
this.auth.clearSession();
|
|
587
|
-
throw error;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
async exchangeNativeToken(apiUrl, platform, challenge) {
|
|
591
|
-
let nativeResult = await this.adapter.signInWithGoogle({
|
|
592
|
-
nonce: challenge.nonce,
|
|
593
|
-
});
|
|
594
|
-
if (nativeResult.platform !== platform) {
|
|
595
|
-
throw new Error('Native Google Sign-In platform does not match the runtime.');
|
|
596
|
-
}
|
|
597
|
-
const clientInstanceId = nativeResult.clientInstanceId;
|
|
598
|
-
let idToken = nativeResult.idToken;
|
|
599
|
-
nativeResult = null;
|
|
600
|
-
try {
|
|
601
|
-
return await firstValueFrom(this.http.post(`${apiUrl}/v1/auth/google/native`, {
|
|
602
|
-
platform,
|
|
603
|
-
idToken,
|
|
604
|
-
challengeId: challenge.challengeId,
|
|
605
|
-
clientInstanceId,
|
|
606
|
-
deviceType: 'tablet',
|
|
607
|
-
}, { withCredentials: true }));
|
|
608
|
-
}
|
|
609
|
-
finally {
|
|
610
|
-
// Strings cannot be zeroized in JavaScript, but dropping both local
|
|
611
|
-
// references immediately after the HTTPS exchange keeps the ID token
|
|
612
|
-
// outside application state and shortens its lifetime in the WebView.
|
|
613
|
-
idToken = '';
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: NativeGoogleAuthService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
617
|
-
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.0", ngImport: i0, type: NativeGoogleAuthService, autoProvided: false });
|
|
618
|
-
}
|
|
619
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: NativeGoogleAuthService, decorators: [{
|
|
620
|
-
type: Service,
|
|
621
|
-
args: [{ autoProvided: false }]
|
|
622
|
-
}] });
|
|
623
|
-
function toNativePlatform(platform) {
|
|
624
|
-
return platform === 'ios' || platform === 'android' ? platform : null;
|
|
625
|
-
}
|
|
626
|
-
function parseChallenge(value) {
|
|
627
|
-
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
628
|
-
throw new Error('Native Google challenge returned an invalid response.');
|
|
629
|
-
}
|
|
630
|
-
const challenge = value.data;
|
|
631
|
-
if (typeof challenge !== 'object' || challenge === null || Array.isArray(challenge)) {
|
|
632
|
-
throw new Error('Native Google challenge returned an invalid response.');
|
|
633
|
-
}
|
|
634
|
-
const challengeRecord = challenge;
|
|
635
|
-
const challengeId = challengeRecord['challengeId'];
|
|
636
|
-
const nonce = challengeRecord['nonce'];
|
|
637
|
-
if (typeof challengeId !== 'string' ||
|
|
638
|
-
!challengeId.trim() ||
|
|
639
|
-
typeof nonce !== 'string' ||
|
|
640
|
-
!nonce.trim()) {
|
|
641
|
-
throw new Error('Native Google challenge returned an invalid response.');
|
|
642
|
-
}
|
|
643
|
-
return { challengeId, nonce };
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
function provideEdsisAuth(config) {
|
|
647
|
-
const resolvedConfig = resolveEdsisAuthConfig(config);
|
|
648
|
-
return makeEnvironmentProviders([
|
|
649
|
-
provideApiConfiguration(resolvedConfig.apiUrl),
|
|
650
|
-
provideHttpClient(withFetch(), withInterceptors([edsisAuthInterceptor, ...(config.httpInterceptors ?? [])])),
|
|
651
|
-
// Completes before initial navigation, therefore guards see restored state.
|
|
652
|
-
provideAppInitializer(() => inject(AuthService).initialize()),
|
|
653
|
-
{
|
|
654
|
-
provide: EDSIS_AUTH_CONFIG,
|
|
655
|
-
useValue: resolvedConfig,
|
|
656
|
-
},
|
|
657
|
-
{
|
|
658
|
-
provide: EDSIS_AUTH_MESSAGES,
|
|
659
|
-
useValue: mergeEdsisAuthMessages(config.messages),
|
|
660
|
-
},
|
|
661
|
-
AuthHealthService,
|
|
662
|
-
NativeGoogleAuthService,
|
|
663
|
-
TauriNativeGoogleAuthAdapter,
|
|
664
|
-
{
|
|
665
|
-
provide: EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER,
|
|
666
|
-
useExisting: TauriNativeGoogleAuthAdapter,
|
|
667
|
-
},
|
|
668
|
-
]);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
const authenticatedGuard = async () => {
|
|
672
|
-
const router = inject(Router);
|
|
673
|
-
const authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
674
|
-
const auth = inject(AuthService);
|
|
675
|
-
if (auth.isAuthenticated()) {
|
|
676
|
-
return true;
|
|
677
|
-
}
|
|
678
|
-
return router.parseUrl(authConfig.guestHomePath);
|
|
679
|
-
};
|
|
680
|
-
const homeRedirectGuard = async () => {
|
|
681
|
-
const router = inject(Router);
|
|
682
|
-
const authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
683
|
-
const auth = inject(AuthService);
|
|
684
|
-
return router.parseUrl(auth.isAuthenticated() ? authConfig.authenticatedHomePath : authConfig.guestHomePath);
|
|
685
|
-
};
|
|
686
|
-
const guestOnlyGuard = async () => {
|
|
687
|
-
const router = inject(Router);
|
|
688
|
-
const authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
689
|
-
const auth = inject(AuthService);
|
|
690
|
-
if (!auth.isAuthenticated()) {
|
|
691
|
-
return true;
|
|
692
|
-
}
|
|
693
|
-
return router.parseUrl(authConfig.authenticatedHomePath);
|
|
694
|
-
};
|
|
695
|
-
|
|
696
|
-
const GOOGLE_GATEWAY_SESSION_STORAGE_KEY = 'auth-google-gateway-session';
|
|
697
|
-
const GOOGLE_GATEWAY_SESSION_VERSION = 1;
|
|
698
|
-
const PKCE_RANDOM_BYTE_LENGTH = 32;
|
|
699
|
-
const PKCE_VERIFIER_PATTERN = /^[A-Za-z0-9._~-]{43,128}$/u;
|
|
700
|
-
/** RFC 7636 verifier with 256 bits of entropy and no persisted token material. */
|
|
701
|
-
function createGooglePkceVerifier(windowRef) {
|
|
702
|
-
const randomBytes = windowRef.crypto.getRandomValues(new Uint8Array(PKCE_RANDOM_BYTE_LENGTH));
|
|
703
|
-
return encodeBase64Url(windowRef, randomBytes);
|
|
704
|
-
}
|
|
705
|
-
/** RFC 7636 S256 challenge for the verifier retained in the one-time session. */
|
|
706
|
-
async function createGooglePkceChallenge(windowRef, codeVerifier) {
|
|
707
|
-
if (!PKCE_VERIFIER_PATTERN.test(codeVerifier)) {
|
|
708
|
-
throw new Error('Google Auth Gateway PKCE verifier must contain 43-128 RFC 7636 characters.');
|
|
709
|
-
}
|
|
710
|
-
const digest = await windowRef.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier));
|
|
711
|
-
return encodeBase64Url(windowRef, new Uint8Array(digest));
|
|
712
|
-
}
|
|
713
|
-
/** Stores only the verifier and short-lived correlation metadata. */
|
|
714
|
-
function storeGoogleGatewaySession(documentRef, session) {
|
|
715
|
-
try {
|
|
716
|
-
const storage = documentRef.defaultView?.sessionStorage;
|
|
717
|
-
if (!storage) {
|
|
718
|
-
throw new Error('sessionStorage is unavailable.');
|
|
719
|
-
}
|
|
720
|
-
storage.setItem(GOOGLE_GATEWAY_SESSION_STORAGE_KEY, JSON.stringify(session));
|
|
721
|
-
}
|
|
722
|
-
catch {
|
|
723
|
-
throw new Error('Google Auth Gateway cannot retain its one-time PKCE session.');
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
function clearGoogleGatewaySession(documentRef) {
|
|
727
|
-
try {
|
|
728
|
-
documentRef.defaultView?.sessionStorage?.removeItem(GOOGLE_GATEWAY_SESSION_STORAGE_KEY);
|
|
729
|
-
}
|
|
730
|
-
catch {
|
|
731
|
-
// Storage-disabled browsers are treated as having no resumable PKCE session.
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Consumes the PKCE session exactly once. Malformed, expired, or cross-MFE
|
|
736
|
-
* records fail closed after removal so they cannot be replayed.
|
|
737
|
-
*/
|
|
738
|
-
function consumeGoogleGatewaySession(documentRef, expected) {
|
|
739
|
-
let storage = null;
|
|
740
|
-
let serialized = null;
|
|
741
|
-
try {
|
|
742
|
-
storage = documentRef.defaultView?.sessionStorage ?? null;
|
|
743
|
-
serialized = storage?.getItem(GOOGLE_GATEWAY_SESSION_STORAGE_KEY) ?? null;
|
|
744
|
-
}
|
|
745
|
-
catch {
|
|
746
|
-
return null;
|
|
747
|
-
}
|
|
748
|
-
finally {
|
|
749
|
-
try {
|
|
750
|
-
storage?.removeItem(GOOGLE_GATEWAY_SESSION_STORAGE_KEY);
|
|
751
|
-
}
|
|
752
|
-
catch {
|
|
753
|
-
// Best-effort removal; the callback still fails closed below.
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (!serialized) {
|
|
757
|
-
return null;
|
|
758
|
-
}
|
|
759
|
-
try {
|
|
760
|
-
const value = JSON.parse(serialized);
|
|
761
|
-
if (!isGoogleGatewaySession(value)) {
|
|
762
|
-
return null;
|
|
763
|
-
}
|
|
764
|
-
const now = expected.now ?? Date.now();
|
|
765
|
-
if (value.mfeId !== expected.mfeId ||
|
|
766
|
-
value.returnUrl !== expected.returnUrl ||
|
|
767
|
-
value.expiresAt <= now) {
|
|
768
|
-
return null;
|
|
769
|
-
}
|
|
770
|
-
return value;
|
|
771
|
-
}
|
|
772
|
-
catch {
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
function isGoogleGatewaySession(value) {
|
|
777
|
-
if (!value || typeof value !== 'object') {
|
|
778
|
-
return false;
|
|
779
|
-
}
|
|
780
|
-
const record = value;
|
|
781
|
-
return (record['version'] === GOOGLE_GATEWAY_SESSION_VERSION &&
|
|
782
|
-
typeof record['mfeId'] === 'string' &&
|
|
783
|
-
typeof record['returnUrl'] === 'string' &&
|
|
784
|
-
typeof record['codeVerifier'] === 'string' &&
|
|
785
|
-
PKCE_VERIFIER_PATTERN.test(record['codeVerifier']) &&
|
|
786
|
-
typeof record['expiresAt'] === 'number' &&
|
|
787
|
-
Number.isSafeInteger(record['expiresAt']));
|
|
788
|
-
}
|
|
789
|
-
function encodeBase64Url(windowRef, bytes) {
|
|
790
|
-
const binary = Array.from(bytes, (byte) => String.fromCharCode(byte)).join('');
|
|
791
|
-
return windowRef.btoa(binary).replace(/\+/gu, '-').replace(/\//gu, '_').replace(/=+$/gu, '');
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
const GOOGLE_OAUTH_STATE_STORAGE_KEY = 'auth-google-state';
|
|
795
|
-
const GOOGLE_OAUTH_AUTHORIZE_URL = 'https://accounts.google.com/o/oauth2/v2/auth';
|
|
796
|
-
const GOOGLE_OAUTH_SCOPE = 'openid email profile';
|
|
797
|
-
const GOOGLE_OAUTH_STATE_BYTE_LENGTH = 16;
|
|
798
|
-
/** Nilai `state` acak berbasis crypto (anti-CSRF untuk round-trip OAuth). */
|
|
799
|
-
function createGoogleOauthState(windowRef) {
|
|
800
|
-
const randomBytes = windowRef.crypto.getRandomValues(new Uint8Array(GOOGLE_OAUTH_STATE_BYTE_LENGTH));
|
|
801
|
-
return Array.from(randomBytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
802
|
-
}
|
|
803
|
-
function buildGoogleAuthorizeUrl(options) {
|
|
804
|
-
const authorizeUrl = new URL(GOOGLE_OAUTH_AUTHORIZE_URL);
|
|
805
|
-
authorizeUrl.searchParams.set('client_id', options.clientId);
|
|
806
|
-
authorizeUrl.searchParams.set('redirect_uri', options.redirectUri);
|
|
807
|
-
authorizeUrl.searchParams.set('response_type', 'code');
|
|
808
|
-
authorizeUrl.searchParams.set('scope', GOOGLE_OAUTH_SCOPE);
|
|
809
|
-
authorizeUrl.searchParams.set('state', options.state);
|
|
810
|
-
return authorizeUrl.toString();
|
|
811
|
-
}
|
|
812
|
-
function storeGoogleOauthState(documentRef, state) {
|
|
813
|
-
documentRef.defaultView?.sessionStorage?.setItem(GOOGLE_OAUTH_STATE_STORAGE_KEY, state);
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Baca lalu hapus state dari sessionStorage. State sekali pakai: dikonsumsi di
|
|
817
|
-
* semua cabang callback agar tidak bocor ke percobaan login berikutnya.
|
|
818
|
-
*/
|
|
819
|
-
function consumeGoogleOauthState(documentRef) {
|
|
820
|
-
const sessionStorageRef = documentRef.defaultView?.sessionStorage;
|
|
821
|
-
const state = sessionStorageRef?.getItem(GOOGLE_OAUTH_STATE_STORAGE_KEY)?.trim() ?? '';
|
|
822
|
-
sessionStorageRef?.removeItem(GOOGLE_OAUTH_STATE_STORAGE_KEY);
|
|
823
|
-
return state;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
const MAX_GATEWAY_SESSION_LIFETIME_SECONDS = 600;
|
|
827
|
-
/** HTTP client for the central Google Auth Gateway mode. */
|
|
828
|
-
class GoogleGatewayAuthService {
|
|
829
|
-
config = inject(EDSIS_AUTH_CONFIG);
|
|
830
|
-
documentRef = inject(DOCUMENT);
|
|
831
|
-
http = inject(HttpClient);
|
|
832
|
-
async start() {
|
|
833
|
-
const gateway = this.requireGatewayConfig();
|
|
834
|
-
const windowRef = this.requireWindow();
|
|
835
|
-
clearGoogleGatewaySession(this.documentRef);
|
|
836
|
-
const codeVerifier = createGooglePkceVerifier(windowRef);
|
|
837
|
-
const codeChallenge = await createGooglePkceChallenge(windowRef, codeVerifier);
|
|
838
|
-
const response = await firstValueFrom(this.http.post(gateway.gateway.startUrl, {
|
|
839
|
-
mfeId: gateway.mfeId,
|
|
840
|
-
returnUrl: gateway.returnUrl,
|
|
841
|
-
codeChallenge,
|
|
842
|
-
codeChallengeMethod: 'S256',
|
|
843
|
-
}, { context: skipAuthContext() }));
|
|
844
|
-
const start = parseStartResponse(response);
|
|
845
|
-
storeGoogleGatewaySession(this.documentRef, {
|
|
846
|
-
version: 1,
|
|
847
|
-
mfeId: gateway.mfeId,
|
|
848
|
-
returnUrl: gateway.returnUrl,
|
|
849
|
-
codeVerifier,
|
|
850
|
-
expiresAt: Date.now() + start.expiresInSeconds * 1000,
|
|
851
|
-
});
|
|
852
|
-
return start.authorizationUrl;
|
|
853
|
-
}
|
|
854
|
-
consumeSession() {
|
|
855
|
-
const gateway = this.requireGatewayConfig();
|
|
856
|
-
return consumeGoogleGatewaySession(this.documentRef, {
|
|
857
|
-
mfeId: gateway.mfeId,
|
|
858
|
-
returnUrl: gateway.returnUrl,
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
exchangeHandoff(handoffCode, session) {
|
|
862
|
-
const gateway = this.requireGatewayConfig();
|
|
863
|
-
const normalizedHandoffCode = handoffCode.trim();
|
|
864
|
-
if (!normalizedHandoffCode) {
|
|
865
|
-
throw new Error('Google Auth Gateway callback is missing its handoff code.');
|
|
866
|
-
}
|
|
867
|
-
if (session.mfeId !== gateway.mfeId ||
|
|
868
|
-
session.returnUrl !== gateway.returnUrl ||
|
|
869
|
-
session.expiresAt <= Date.now()) {
|
|
870
|
-
throw new Error('Google Auth Gateway session is invalid or expired for this MFE.');
|
|
871
|
-
}
|
|
872
|
-
return firstValueFrom(this.http.post(gateway.gateway.handoffUrl, {
|
|
873
|
-
mfeId: gateway.mfeId,
|
|
874
|
-
returnUrl: gateway.returnUrl,
|
|
875
|
-
handoffCode: normalizedHandoffCode,
|
|
876
|
-
codeVerifier: session.codeVerifier,
|
|
877
|
-
}, {
|
|
878
|
-
context: skipAuthContext(),
|
|
879
|
-
withCredentials: true,
|
|
880
|
-
}));
|
|
881
|
-
}
|
|
882
|
-
requireGatewayConfig() {
|
|
883
|
-
const google = this.config.oauth.google;
|
|
884
|
-
if (google?.mode !== 'gateway') {
|
|
885
|
-
throw new Error('Google Auth Gateway mode is not configured.');
|
|
886
|
-
}
|
|
887
|
-
return google;
|
|
888
|
-
}
|
|
889
|
-
requireWindow() {
|
|
890
|
-
const windowRef = this.documentRef.defaultView;
|
|
891
|
-
if (!windowRef) {
|
|
892
|
-
throw new Error('Google Auth Gateway requires a browser window.');
|
|
893
|
-
}
|
|
894
|
-
return windowRef;
|
|
895
|
-
}
|
|
896
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: GoogleGatewayAuthService, deps: [], target: i0.ɵɵFactoryTarget.Service });
|
|
897
|
-
static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.0", ngImport: i0, type: GoogleGatewayAuthService });
|
|
898
|
-
}
|
|
899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: GoogleGatewayAuthService, decorators: [{
|
|
900
|
-
type: Service
|
|
901
|
-
}] });
|
|
902
|
-
function parseStartResponse(response) {
|
|
903
|
-
if (!response || typeof response !== 'object') {
|
|
904
|
-
throw new Error('Google Auth Gateway returned an invalid start response.');
|
|
905
|
-
}
|
|
906
|
-
const envelope = response;
|
|
907
|
-
const data = envelope['data'];
|
|
908
|
-
if (!data || typeof data !== 'object') {
|
|
909
|
-
throw new Error('Google Auth Gateway start response is missing data.');
|
|
910
|
-
}
|
|
911
|
-
const record = data;
|
|
912
|
-
const authorizationUrl = record['authorizationUrl'];
|
|
913
|
-
const expiresInSeconds = record['expiresInSeconds'];
|
|
914
|
-
if (typeof authorizationUrl !== 'string' || !isTrustedGoogleAuthorizationUrl(authorizationUrl)) {
|
|
915
|
-
throw new Error('Google Auth Gateway returned an invalid authorization URL.');
|
|
916
|
-
}
|
|
917
|
-
if (typeof expiresInSeconds !== 'number' ||
|
|
918
|
-
!Number.isSafeInteger(expiresInSeconds) ||
|
|
919
|
-
expiresInSeconds <= 0 ||
|
|
920
|
-
expiresInSeconds > MAX_GATEWAY_SESSION_LIFETIME_SECONDS) {
|
|
921
|
-
throw new Error('Google Auth Gateway returned an invalid session lifetime.');
|
|
922
|
-
}
|
|
923
|
-
return { authorizationUrl, expiresInSeconds };
|
|
924
|
-
}
|
|
925
|
-
function isTrustedGoogleAuthorizationUrl(value) {
|
|
926
|
-
try {
|
|
927
|
-
const authorizationUrl = new URL(value);
|
|
928
|
-
const trustedUrl = new URL(GOOGLE_OAUTH_AUTHORIZE_URL);
|
|
929
|
-
return (authorizationUrl.origin === trustedUrl.origin &&
|
|
930
|
-
authorizationUrl.pathname === trustedUrl.pathname &&
|
|
931
|
-
!authorizationUrl.username &&
|
|
932
|
-
!authorizationUrl.password);
|
|
933
|
-
}
|
|
934
|
-
catch {
|
|
935
|
-
return false;
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
function skipAuthContext() {
|
|
939
|
-
return new HttpContext().set(EDSIS_SKIP_AUTH, true);
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
class AuthShellPage {
|
|
943
|
-
runtimeContext = inject(RuntimeContextService, { optional: true });
|
|
944
|
-
nativeHost = inject(NativeHostService, { optional: true });
|
|
945
|
-
layout = inject(LayoutService);
|
|
946
|
-
isDesktopAppearance = computed(() => this.layout.appearance() === 'desktop', /* @ts-ignore */
|
|
947
|
-
...(ngDevMode ? [{ debugName: "isDesktopAppearance" }] : /* istanbul ignore next */ []));
|
|
948
|
-
desktopAppBarPlatform = computed(() => {
|
|
949
|
-
const context = this.runtimeContext?.context();
|
|
950
|
-
if (!context || context.host === 'browser') {
|
|
951
|
-
return undefined;
|
|
952
|
-
}
|
|
953
|
-
return context.deviceType === 'macos' || context.deviceType === 'windows'
|
|
954
|
-
? context.deviceType
|
|
955
|
-
: null;
|
|
956
|
-
}, /* @ts-ignore */
|
|
957
|
-
...(ngDevMode ? [{ debugName: "desktopAppBarPlatform" }] : /* istanbul ignore next */ []));
|
|
958
|
-
onDesktopWindowControlRequested(action) {
|
|
959
|
-
const nativeHost = this.nativeHost;
|
|
960
|
-
if (!nativeHost?.supports('window-controls')) {
|
|
961
|
-
return;
|
|
962
|
-
}
|
|
963
|
-
void nativeHost.emitWindowControl(action).catch((error) => {
|
|
964
|
-
console.error(`Failed to run window control: ${action}`, error);
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
onDesktopWindowDragRequested() {
|
|
968
|
-
const nativeHost = this.nativeHost;
|
|
969
|
-
if (!nativeHost?.supports('window-controls')) {
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
void nativeHost.startDragging().catch((error) => {
|
|
973
|
-
console.error('Failed to start window dragging', error);
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthShellPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
977
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AuthShellPage, isStandalone: true, selector: "edsis-auth-shell-page", host: { classAttribute: "contents" }, ngImport: i0, template: `
|
|
978
|
-
@if (isDesktopAppearance()) {
|
|
979
|
-
<DesktopAppBar
|
|
980
|
-
[platform]="desktopAppBarPlatform()"
|
|
981
|
-
(windowControlRequested)="onDesktopWindowControlRequested($event)"
|
|
982
|
-
(windowDragRequested)="onDesktopWindowDragRequested()"
|
|
983
|
-
/>
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
<Layout surface="grid" width="fluid">
|
|
987
|
-
<LayoutFluid>
|
|
988
|
-
<div class="w-full max-w-xl">
|
|
989
|
-
<router-outlet />
|
|
990
|
-
</div>
|
|
991
|
-
</LayoutFluid>
|
|
992
|
-
</Layout>
|
|
993
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: LayoutComponent, selector: "Layout", inputs: ["surface", "width", "class"] }, { kind: "component", type: DesktopAppBarComponent, selector: "DesktopAppBar", inputs: ["class", "avatarInitials", "navigation", "platform"], outputs: ["windowControlRequested", "windowDragRequested", "flyoutRequested", "avatarRequested"] }, { kind: "component", type: LayoutFluidComponent, selector: "LayoutFluid", inputs: ["class"] }] });
|
|
994
|
-
}
|
|
995
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthShellPage, decorators: [{
|
|
996
|
-
type: Component,
|
|
997
|
-
args: [{
|
|
998
|
-
selector: 'edsis-auth-shell-page',
|
|
999
|
-
imports: [RouterOutlet, LayoutComponent, DesktopAppBarComponent, LayoutFluidComponent],
|
|
1000
|
-
host: {
|
|
1001
|
-
class: 'contents',
|
|
1002
|
-
},
|
|
1003
|
-
template: `
|
|
1004
|
-
@if (isDesktopAppearance()) {
|
|
1005
|
-
<DesktopAppBar
|
|
1006
|
-
[platform]="desktopAppBarPlatform()"
|
|
1007
|
-
(windowControlRequested)="onDesktopWindowControlRequested($event)"
|
|
1008
|
-
(windowDragRequested)="onDesktopWindowDragRequested()"
|
|
1009
|
-
/>
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
<Layout surface="grid" width="fluid">
|
|
1013
|
-
<LayoutFluid>
|
|
1014
|
-
<div class="w-full max-w-xl">
|
|
1015
|
-
<router-outlet />
|
|
1016
|
-
</div>
|
|
1017
|
-
</LayoutFluid>
|
|
1018
|
-
</Layout>
|
|
1019
|
-
`,
|
|
1020
|
-
}]
|
|
1021
|
-
}] });
|
|
1022
|
-
|
|
1023
|
-
function extractMagicToken(queryToken, fragment) {
|
|
1024
|
-
const tokenFromQuery = normalizeText(queryToken);
|
|
1025
|
-
if (tokenFromQuery) {
|
|
1026
|
-
return tokenFromQuery;
|
|
1027
|
-
}
|
|
1028
|
-
const normalizedFragment = normalizeText(fragment?.startsWith('#') ? fragment.slice(1) : fragment);
|
|
1029
|
-
if (!normalizedFragment) {
|
|
1030
|
-
return null;
|
|
1031
|
-
}
|
|
1032
|
-
const fragmentParams = new URLSearchParams(normalizedFragment);
|
|
1033
|
-
const tokenFromFragment = normalizeText(fragmentParams.get('token')) ??
|
|
1034
|
-
normalizeText(fragmentParams.get('magic_token')) ??
|
|
1035
|
-
normalizeText(fragmentParams.get('value'));
|
|
1036
|
-
if (tokenFromFragment) {
|
|
1037
|
-
return tokenFromFragment;
|
|
1038
|
-
}
|
|
1039
|
-
return normalizedFragment.includes('=') ? null : normalizedFragment;
|
|
1040
|
-
}
|
|
1041
|
-
function getResponseMessage(response, fallback) {
|
|
1042
|
-
if (!hasMessage(response)) {
|
|
1043
|
-
return fallback;
|
|
1044
|
-
}
|
|
1045
|
-
return normalizeText(response.message) ?? fallback;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Pesan error dari body respons backend saja. Berbeda dengan `getErrorMessage`,
|
|
1049
|
-
* `HttpErrorResponse.message` sintetis ("Http failure response for ...") tidak
|
|
1050
|
-
* pernah dipakai, sehingga tanpa pesan backend selalu jatuh ke fallback ramah.
|
|
1051
|
-
*/
|
|
1052
|
-
function getBackendErrorMessage(error, fallback) {
|
|
1053
|
-
if (!(error instanceof HttpErrorResponse)) {
|
|
1054
|
-
return fallback;
|
|
1055
|
-
}
|
|
1056
|
-
const errorBody = error.error;
|
|
1057
|
-
if (typeof errorBody === 'string') {
|
|
1058
|
-
return normalizeText(errorBody) ?? fallback;
|
|
1059
|
-
}
|
|
1060
|
-
if (hasMessage(errorBody)) {
|
|
1061
|
-
return normalizeText(errorBody.message) ?? fallback;
|
|
1062
|
-
}
|
|
1063
|
-
return fallback;
|
|
1064
|
-
}
|
|
1065
|
-
function getErrorMessage(error, fallback) {
|
|
1066
|
-
if (error instanceof HttpErrorResponse) {
|
|
1067
|
-
const errorBody = error.error;
|
|
1068
|
-
if (typeof errorBody === 'string') {
|
|
1069
|
-
return normalizeText(errorBody) ?? fallback;
|
|
1070
|
-
}
|
|
1071
|
-
if (hasMessage(errorBody)) {
|
|
1072
|
-
return normalizeText(errorBody.message) ?? fallback;
|
|
1073
|
-
}
|
|
1074
|
-
return normalizeText(error.message) ?? fallback;
|
|
1075
|
-
}
|
|
1076
|
-
if (error instanceof Error) {
|
|
1077
|
-
return normalizeText(error.message) ?? fallback;
|
|
1078
|
-
}
|
|
1079
|
-
return fallback;
|
|
1080
|
-
}
|
|
1081
|
-
function hasMessage(value) {
|
|
1082
|
-
return typeof value === 'object' && value !== null && 'message' in value;
|
|
1083
|
-
}
|
|
1084
|
-
function normalizeText(value) {
|
|
1085
|
-
if (typeof value !== 'string') {
|
|
1086
|
-
return null;
|
|
1087
|
-
}
|
|
1088
|
-
const normalizedValue = value.trim();
|
|
1089
|
-
return normalizedValue.length > 0 ? normalizedValue : null;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
class AuthGoogleCallbackPage {
|
|
1093
|
-
documentRef = inject(DOCUMENT);
|
|
1094
|
-
destroyRef = inject(DestroyRef);
|
|
1095
|
-
injector = inject(Injector);
|
|
1096
|
-
route = inject(ActivatedRoute);
|
|
1097
|
-
router = inject(Router);
|
|
1098
|
-
location = inject(Location);
|
|
1099
|
-
authSessionService = inject(AuthSessionService);
|
|
1100
|
-
authService = inject(AuthService);
|
|
1101
|
-
authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
1102
|
-
googleGateway = inject(GoogleGatewayAuthService);
|
|
1103
|
-
messages = inject(EDSIS_AUTH_MESSAGES);
|
|
1104
|
-
loginPath = this.authConfig.loginPath;
|
|
1105
|
-
authenticatedHomePath = this.authConfig.authenticatedHomePath;
|
|
1106
|
-
state = signal('pending', /* @ts-ignore */
|
|
1107
|
-
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
1108
|
-
message = signal(this.messages.google.googleExchangeInProgress, /* @ts-ignore */
|
|
1109
|
-
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
1110
|
-
// `a[Button]` adalah komponen, jadi tanpa `read` query template-ref ini
|
|
1111
|
-
// mengembalikan instance ButtonComponent — bukan elemen anchor-nya.
|
|
1112
|
-
retryLink = viewChild('retryLink', { ...(ngDevMode ? { debugName: "retryLink" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
1113
|
-
constructor() {
|
|
1114
|
-
effect(() => {
|
|
1115
|
-
if (this.state() !== 'error') {
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
afterNextRender(() => this.retryLink()?.nativeElement.focus(), { injector: this.injector });
|
|
1119
|
-
});
|
|
1120
|
-
this.handleCallback();
|
|
1121
|
-
}
|
|
1122
|
-
handleCallback() {
|
|
1123
|
-
const queryParams = this.route.snapshot.queryParamMap;
|
|
1124
|
-
const oauthError = queryParams.get('error')?.trim() ?? '';
|
|
1125
|
-
const code = queryParams.get('code')?.trim() ?? '';
|
|
1126
|
-
const returnedState = queryParams.get('state')?.trim() ?? '';
|
|
1127
|
-
const handoffCode = queryParams.get('handoffCode')?.trim() ?? '';
|
|
1128
|
-
const googleOauth = this.authConfig.oauth.google;
|
|
1129
|
-
this.clearCallbackParamsFromAddressBar();
|
|
1130
|
-
if (!googleOauth) {
|
|
1131
|
-
consumeGoogleOauthState(this.documentRef);
|
|
1132
|
-
clearGoogleGatewaySession(this.documentRef);
|
|
1133
|
-
this.fail(this.messages.google.googleCallbackError);
|
|
1134
|
-
return;
|
|
1135
|
-
}
|
|
1136
|
-
if (googleOauth.mode === 'gateway') {
|
|
1137
|
-
consumeGoogleOauthState(this.documentRef);
|
|
1138
|
-
// Konsumsi verifier sebelum bercabang; callback error dan replay tidak
|
|
1139
|
-
// boleh menyisakan sesi PKCE yang dapat dipakai kembali.
|
|
1140
|
-
const gatewaySession = this.googleGateway.consumeSession();
|
|
1141
|
-
if (oauthError) {
|
|
1142
|
-
this.fail(this.callbackErrorMessage(oauthError));
|
|
1143
|
-
return;
|
|
1144
|
-
}
|
|
1145
|
-
if (!gatewaySession) {
|
|
1146
|
-
this.fail(this.messages.google.gatewaySessionMissing);
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
if (!handoffCode) {
|
|
1150
|
-
this.fail(this.messages.google.googleCallbackError);
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
void this.exchangeGatewayHandoff(handoffCode, gatewaySession);
|
|
1154
|
-
return;
|
|
1155
|
-
}
|
|
1156
|
-
clearGoogleGatewaySession(this.documentRef);
|
|
1157
|
-
// Direct-mode state dikonsumsi (dibaca + dihapus) sebelum bercabang supaya
|
|
1158
|
-
// bersih di semua cabang, termasuk error dari Google.
|
|
1159
|
-
const storedState = consumeGoogleOauthState(this.documentRef);
|
|
1160
|
-
if (oauthError) {
|
|
1161
|
-
this.fail(this.callbackErrorMessage(oauthError));
|
|
1162
|
-
return;
|
|
1163
|
-
}
|
|
1164
|
-
if (!returnedState || !storedState || returnedState !== storedState) {
|
|
1165
|
-
this.fail(this.messages.google.googleStateMismatch);
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
if (!code) {
|
|
1169
|
-
this.fail(this.messages.google.googleCallbackError);
|
|
1170
|
-
return;
|
|
1171
|
-
}
|
|
1172
|
-
this.exchangeDirectCode(code);
|
|
1173
|
-
}
|
|
1174
|
-
clearCallbackParamsFromAddressBar() {
|
|
1175
|
-
this.location.replaceState(`/${GOOGLE_OAUTH_CALLBACK_ROUTE_PATH}`);
|
|
1176
|
-
}
|
|
1177
|
-
exchangeDirectCode(code) {
|
|
1178
|
-
const googleOauth = this.authConfig.oauth.google;
|
|
1179
|
-
if (!googleOauth || googleOauth.mode !== 'direct') {
|
|
1180
|
-
this.fail(this.messages.google.googleCallbackError);
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
this.state.set('pending');
|
|
1184
|
-
this.message.set(this.messages.google.googleExchangeInProgress);
|
|
1185
|
-
// Exchange lewat method SDK hasil generate (konsisten dengan
|
|
1186
|
-
// verifyMagicLink/refreshAuthToken); path /v1/auth/google membuat
|
|
1187
|
-
// edsisAuthInterceptor otomatis memasang cookie credentials.
|
|
1188
|
-
this.authSessionService
|
|
1189
|
-
.exchangeGoogleCode({
|
|
1190
|
-
body: { code, redirectUri: googleOauth.redirectUri },
|
|
1191
|
-
})
|
|
1192
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
1193
|
-
.subscribe({
|
|
1194
|
-
next: (response) => this.complete(response),
|
|
1195
|
-
error: (error) => {
|
|
1196
|
-
this.fail(getBackendErrorMessage(error, this.messages.google.googleCallbackError));
|
|
1197
|
-
},
|
|
1198
|
-
});
|
|
1199
|
-
}
|
|
1200
|
-
async exchangeGatewayHandoff(handoffCode, session) {
|
|
1201
|
-
this.state.set('pending');
|
|
1202
|
-
this.message.set(this.messages.google.gatewayHandoffInProgress);
|
|
1203
|
-
try {
|
|
1204
|
-
const response = await this.googleGateway.exchangeHandoff(handoffCode, session);
|
|
1205
|
-
this.complete(response);
|
|
1206
|
-
}
|
|
1207
|
-
catch (error) {
|
|
1208
|
-
this.fail(getBackendErrorMessage(error, this.messages.google.googleCallbackError));
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
complete(response) {
|
|
1212
|
-
this.authService.acceptTokenResponse(response);
|
|
1213
|
-
if (!this.authService.isAuthenticated()) {
|
|
1214
|
-
this.fail(this.messages.google.missingAccessToken);
|
|
1215
|
-
return;
|
|
1216
|
-
}
|
|
1217
|
-
this.state.set('success');
|
|
1218
|
-
this.message.set(getResponseMessage(response, this.messages.google.successRedirect));
|
|
1219
|
-
void this.router.navigateByUrl(this.authenticatedHomePath, { replaceUrl: true });
|
|
1220
|
-
}
|
|
1221
|
-
callbackErrorMessage(error) {
|
|
1222
|
-
return error === 'access_denied'
|
|
1223
|
-
? this.messages.google.googleAccessDenied
|
|
1224
|
-
: this.messages.google.googleCallbackError;
|
|
1225
|
-
}
|
|
1226
|
-
fail(message) {
|
|
1227
|
-
this.state.set('error');
|
|
1228
|
-
this.message.set(message);
|
|
1229
|
-
}
|
|
1230
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthGoogleCallbackPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1231
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AuthGoogleCallbackPage, isStandalone: true, selector: "AuthGoogleCallbackPage", host: { classAttribute: "block" }, viewQueries: [{ propertyName: "retryLink", first: true, predicate: ["retryLink"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
|
|
1232
|
-
<Card
|
|
1233
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
1234
|
-
>
|
|
1235
|
-
<CardHeader
|
|
1236
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
1237
|
-
>
|
|
1238
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
1239
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
1240
|
-
<div
|
|
1241
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
1242
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
1243
|
-
>
|
|
1244
|
-
{{ messages.brand.mark }}
|
|
1245
|
-
</div>
|
|
1246
|
-
</AspectRatio>
|
|
1247
|
-
</div>
|
|
1248
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
1249
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
1250
|
-
messages.google.title
|
|
1251
|
-
}}</CardTitle>
|
|
1252
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
1253
|
-
{{ messages.google.intro }}
|
|
1254
|
-
</p>
|
|
1255
|
-
</div>
|
|
1256
|
-
<CardAction
|
|
1257
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
1258
|
-
>
|
|
1259
|
-
{{ messages.google.badge }}
|
|
1260
|
-
</CardAction>
|
|
1261
|
-
</CardHeader>
|
|
1262
|
-
|
|
1263
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
1264
|
-
<Alert
|
|
1265
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
1266
|
-
class="bg-background/70 shadow-sm"
|
|
1267
|
-
>
|
|
1268
|
-
@if (state() === 'pending') {
|
|
1269
|
-
<Spinner class="mt-0.5 size-4" [aria-label]="messages.google.exchangeInProgressAria" />
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
<AlertDescription>
|
|
1273
|
-
{{ message() }}
|
|
1274
|
-
</AlertDescription>
|
|
1275
|
-
</Alert>
|
|
1276
|
-
</CardContent>
|
|
1277
|
-
|
|
1278
|
-
@if (state() !== 'pending') {
|
|
1279
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
1280
|
-
@if (state() === 'error') {
|
|
1281
|
-
<a #retryLink Button [routerLink]="loginPath" variant="default">
|
|
1282
|
-
{{ messages.google.googleRetry }}
|
|
1283
|
-
</a>
|
|
1284
|
-
}
|
|
1285
|
-
<a
|
|
1286
|
-
Button
|
|
1287
|
-
[routerLink]="authenticatedHomePath"
|
|
1288
|
-
[variant]="state() === 'error' ? 'outline' : 'default'"
|
|
1289
|
-
>
|
|
1290
|
-
{{ messages.google.openDashboard }}
|
|
1291
|
-
</a>
|
|
1292
|
-
</CardFooter>
|
|
1293
|
-
}
|
|
1294
|
-
</Card>
|
|
1295
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: AlertComponent, selector: "Alert", inputs: ["variant", "class"] }, { kind: "component", type: AlertDescriptionComponent, selector: "AlertDescription", inputs: ["class"] }, { kind: "component", type: AspectRatioComponent, selector: "AspectRatio", inputs: ["ratio", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: CardActionComponent, selector: "CardAction", inputs: ["class"] }, { kind: "component", type: CardComponent, selector: "Card", inputs: ["size", "class"] }, { kind: "component", type: CardContentComponent, selector: "CardContent", inputs: ["class"] }, { kind: "component", type: CardDescriptionComponent, selector: "CardDescription, p[CardDescription]", inputs: ["class"] }, { kind: "component", type: CardFooterComponent, selector: "CardFooter", inputs: ["class"] }, { kind: "component", type: CardHeaderComponent, selector: "CardHeader", inputs: ["class"] }, { kind: "component", type: CardTitleComponent, selector: "CardTitle, h3[CardTitle]", inputs: ["class"] }, { kind: "component", type: SpinnerComponent, selector: "Spinner", inputs: ["class", "decorative", "aria-label", "aria-labelledby"] }] });
|
|
1296
|
-
}
|
|
1297
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthGoogleCallbackPage, decorators: [{
|
|
1298
|
-
type: Component,
|
|
1299
|
-
args: [{
|
|
1300
|
-
selector: 'AuthGoogleCallbackPage',
|
|
1301
|
-
imports: [
|
|
1302
|
-
RouterLink,
|
|
1303
|
-
AlertComponent,
|
|
1304
|
-
AlertDescriptionComponent,
|
|
1305
|
-
AspectRatioComponent,
|
|
1306
|
-
ButtonComponent,
|
|
1307
|
-
CardActionComponent,
|
|
1308
|
-
CardComponent,
|
|
1309
|
-
CardContentComponent,
|
|
1310
|
-
CardDescriptionComponent,
|
|
1311
|
-
CardFooterComponent,
|
|
1312
|
-
CardHeaderComponent,
|
|
1313
|
-
CardTitleComponent,
|
|
1314
|
-
SpinnerComponent,
|
|
1315
|
-
],
|
|
1316
|
-
host: {
|
|
1317
|
-
class: 'block',
|
|
1318
|
-
},
|
|
1319
|
-
template: `
|
|
1320
|
-
<Card
|
|
1321
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
1322
|
-
>
|
|
1323
|
-
<CardHeader
|
|
1324
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
1325
|
-
>
|
|
1326
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
1327
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
1328
|
-
<div
|
|
1329
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
1330
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
1331
|
-
>
|
|
1332
|
-
{{ messages.brand.mark }}
|
|
1333
|
-
</div>
|
|
1334
|
-
</AspectRatio>
|
|
1335
|
-
</div>
|
|
1336
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
1337
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
1338
|
-
messages.google.title
|
|
1339
|
-
}}</CardTitle>
|
|
1340
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
1341
|
-
{{ messages.google.intro }}
|
|
1342
|
-
</p>
|
|
1343
|
-
</div>
|
|
1344
|
-
<CardAction
|
|
1345
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
1346
|
-
>
|
|
1347
|
-
{{ messages.google.badge }}
|
|
1348
|
-
</CardAction>
|
|
1349
|
-
</CardHeader>
|
|
1350
|
-
|
|
1351
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
1352
|
-
<Alert
|
|
1353
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
1354
|
-
class="bg-background/70 shadow-sm"
|
|
1355
|
-
>
|
|
1356
|
-
@if (state() === 'pending') {
|
|
1357
|
-
<Spinner class="mt-0.5 size-4" [aria-label]="messages.google.exchangeInProgressAria" />
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
<AlertDescription>
|
|
1361
|
-
{{ message() }}
|
|
1362
|
-
</AlertDescription>
|
|
1363
|
-
</Alert>
|
|
1364
|
-
</CardContent>
|
|
1365
|
-
|
|
1366
|
-
@if (state() !== 'pending') {
|
|
1367
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
1368
|
-
@if (state() === 'error') {
|
|
1369
|
-
<a #retryLink Button [routerLink]="loginPath" variant="default">
|
|
1370
|
-
{{ messages.google.googleRetry }}
|
|
1371
|
-
</a>
|
|
1372
|
-
}
|
|
1373
|
-
<a
|
|
1374
|
-
Button
|
|
1375
|
-
[routerLink]="authenticatedHomePath"
|
|
1376
|
-
[variant]="state() === 'error' ? 'outline' : 'default'"
|
|
1377
|
-
>
|
|
1378
|
-
{{ messages.google.openDashboard }}
|
|
1379
|
-
</a>
|
|
1380
|
-
</CardFooter>
|
|
1381
|
-
}
|
|
1382
|
-
</Card>
|
|
1383
|
-
`,
|
|
1384
|
-
}]
|
|
1385
|
-
}], ctorParameters: () => [], propDecorators: { retryLink: [{ type: i0.ViewChild, args: ['retryLink', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
1386
|
-
|
|
1387
|
-
class AuthLoginPage {
|
|
1388
|
-
documentRef = inject(DOCUMENT);
|
|
1389
|
-
destroyRef = inject(DestroyRef);
|
|
1390
|
-
injector = inject(Injector);
|
|
1391
|
-
authMagicLinkService = inject(AuthMagicLinkService);
|
|
1392
|
-
authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
1393
|
-
googleGateway = inject(GoogleGatewayAuthService);
|
|
1394
|
-
nativeGoogle = inject(NativeGoogleAuthService, { optional: true });
|
|
1395
|
-
router = inject(Router, { optional: true });
|
|
1396
|
-
messages = inject(EDSIS_AUTH_MESSAGES);
|
|
1397
|
-
health = inject(AuthHealthService);
|
|
1398
|
-
googleOauth = this.authConfig.oauth.google;
|
|
1399
|
-
isGoogleRedirecting = signal(false, /* @ts-ignore */
|
|
1400
|
-
...(ngDevMode ? [{ debugName: "isGoogleRedirecting" }] : /* istanbul ignore next */ []));
|
|
1401
|
-
googleErrorMessage = signal(null, /* @ts-ignore */
|
|
1402
|
-
...(ngDevMode ? [{ debugName: "googleErrorMessage" }] : /* istanbul ignore next */ []));
|
|
1403
|
-
requiresNativeGoogle = computed(() => this.nativeGoogle?.requiresNativeGoogle() === true, /* @ts-ignore */
|
|
1404
|
-
...(ngDevMode ? [{ debugName: "requiresNativeGoogle" }] : /* istanbul ignore next */ []));
|
|
1405
|
-
isNativeGoogle = computed(() => this.nativeGoogle?.isAvailable() === true, /* @ts-ignore */
|
|
1406
|
-
...(ngDevMode ? [{ debugName: "isNativeGoogle" }] : /* istanbul ignore next */ []));
|
|
1407
|
-
googleSignInAvailable = computed(() => this.isNativeGoogle() || (!this.requiresNativeGoogle() && this.googleOauth !== null), /* @ts-ignore */
|
|
1408
|
-
...(ngDevMode ? [{ debugName: "googleSignInAvailable" }] : /* istanbul ignore next */ []));
|
|
1409
|
-
googleFeedbackMessage = computed(() => this.googleErrorMessage() ??
|
|
1410
|
-
(this.requiresNativeGoogle() && !this.isNativeGoogle()
|
|
1411
|
-
? this.messages.google.nativeSignInUnavailable
|
|
1412
|
-
: null), /* @ts-ignore */
|
|
1413
|
-
...(ngDevMode ? [{ debugName: "googleFeedbackMessage" }] : /* istanbul ignore next */ []));
|
|
1414
|
-
googleProgressMessage = computed(() => this.isNativeGoogle()
|
|
1415
|
-
? this.messages.google.nativeSignInInProgress
|
|
1416
|
-
: this.messages.google.googleRedirecting, /* @ts-ignore */
|
|
1417
|
-
...(ngDevMode ? [{ debugName: "googleProgressMessage" }] : /* istanbul ignore next */ []));
|
|
1418
|
-
loginModel = signal({ email: '' }, /* @ts-ignore */
|
|
1419
|
-
...(ngDevMode ? [{ debugName: "loginModel" }] : /* istanbul ignore next */ []));
|
|
1420
|
-
form = form(this.loginModel, (path) => {
|
|
1421
|
-
required(path.email);
|
|
1422
|
-
email(path.email);
|
|
1423
|
-
maxLength(path.email, 255);
|
|
1424
|
-
});
|
|
1425
|
-
responseMessage = signal(null, /* @ts-ignore */
|
|
1426
|
-
...(ngDevMode ? [{ debugName: "responseMessage" }] : /* istanbul ignore next */ []));
|
|
1427
|
-
errorMessage = signal(null, /* @ts-ignore */
|
|
1428
|
-
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
1429
|
-
emailFeedbackId = 'email-feedback';
|
|
1430
|
-
healthBannerId = 'auth-health-banner';
|
|
1431
|
-
// `button[Button]` adalah komponen, jadi tanpa `read` query template-ref ini
|
|
1432
|
-
// mengembalikan instance ButtonComponent — bukan elemen button-nya.
|
|
1433
|
-
retryButton = viewChild('healthRetryButton', { ...(ngDevMode ? { debugName: "retryButton" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
1434
|
-
constructor() {
|
|
1435
|
-
// On-load health check: non-blocking, no-op saat healthCheck.enabled=false.
|
|
1436
|
-
void this.health.check();
|
|
1437
|
-
effect(() => {
|
|
1438
|
-
if (this.health.status() !== 'unhealthy') {
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
afterNextRender(() => this.retryButton()?.nativeElement.focus(), { injector: this.injector });
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
hasInlineError = computed(() => {
|
|
1445
|
-
const emailState = this.form.email();
|
|
1446
|
-
return emailState.invalid() && (emailState.dirty() || emailState.touched());
|
|
1447
|
-
}, /* @ts-ignore */
|
|
1448
|
-
...(ngDevMode ? [{ debugName: "hasInlineError" }] : /* istanbul ignore next */ []));
|
|
1449
|
-
inlineErrorMessage = computed(() => {
|
|
1450
|
-
if (!this.hasInlineError()) {
|
|
1451
|
-
return null;
|
|
1452
|
-
}
|
|
1453
|
-
return this.form.email().getError('required')
|
|
1454
|
-
? this.messages.login.emailRequired
|
|
1455
|
-
: this.messages.login.emailInvalid;
|
|
1456
|
-
}, /* @ts-ignore */
|
|
1457
|
-
...(ngDevMode ? [{ debugName: "inlineErrorMessage" }] : /* istanbul ignore next */ []));
|
|
1458
|
-
feedbackMessage = computed(() => this.inlineErrorMessage() ?? this.responseMessage() ?? this.errorMessage(), /* @ts-ignore */
|
|
1459
|
-
...(ngDevMode ? [{ debugName: "feedbackMessage" }] : /* istanbul ignore next */ []));
|
|
1460
|
-
feedbackTone = computed(() => {
|
|
1461
|
-
if (this.inlineErrorMessage() || this.errorMessage()) {
|
|
1462
|
-
return 'error';
|
|
1463
|
-
}
|
|
1464
|
-
if (this.responseMessage()) {
|
|
1465
|
-
return 'success';
|
|
1466
|
-
}
|
|
1467
|
-
return null;
|
|
1468
|
-
}, /* @ts-ignore */
|
|
1469
|
-
...(ngDevMode ? [{ debugName: "feedbackTone" }] : /* istanbul ignore next */ []));
|
|
1470
|
-
fieldTone = computed(() => {
|
|
1471
|
-
if (this.hasInlineError() || this.errorMessage()) {
|
|
1472
|
-
return 'error';
|
|
1473
|
-
}
|
|
1474
|
-
if (this.responseMessage()) {
|
|
1475
|
-
return 'success';
|
|
1476
|
-
}
|
|
1477
|
-
return 'idle';
|
|
1478
|
-
}, /* @ts-ignore */
|
|
1479
|
-
...(ngDevMode ? [{ debugName: "fieldTone" }] : /* istanbul ignore next */ []));
|
|
1480
|
-
emailFieldClasses = computed(() => {
|
|
1481
|
-
const baseClasses = 'flex-nowrap bg-background/70 shadow-sm [&>[data-slot=input-group-control]]:h-12! [&>[data-slot=input-group-control]]:px-4! [&>[data-slot=input-group-control]]:text-base!';
|
|
1482
|
-
switch (this.fieldTone()) {
|
|
1483
|
-
case 'error':
|
|
1484
|
-
return `${baseClasses} border-destructive focus-within:border-destructive focus-within:ring-destructive/20`;
|
|
1485
|
-
case 'success':
|
|
1486
|
-
return `${baseClasses} border-emerald-500 focus-within:border-emerald-500 focus-within:ring-emerald-500/20`;
|
|
1487
|
-
default:
|
|
1488
|
-
return baseClasses;
|
|
1489
|
-
}
|
|
1490
|
-
}, /* @ts-ignore */
|
|
1491
|
-
...(ngDevMode ? [{ debugName: "emailFieldClasses" }] : /* istanbul ignore next */ []));
|
|
1492
|
-
retryHealth() {
|
|
1493
|
-
void this.health.check();
|
|
1494
|
-
}
|
|
1495
|
-
signInWithGoogle() {
|
|
1496
|
-
if (this.isGoogleRedirecting()) {
|
|
1497
|
-
return;
|
|
1498
|
-
}
|
|
1499
|
-
if (this.requiresNativeGoogle()) {
|
|
1500
|
-
if (this.isNativeGoogle()) {
|
|
1501
|
-
void this.signInWithNativeGoogle();
|
|
1502
|
-
}
|
|
1503
|
-
else {
|
|
1504
|
-
this.googleErrorMessage.set(this.messages.google.nativeSignInUnavailable);
|
|
1505
|
-
}
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
if (!this.googleSignInAvailable())
|
|
1509
|
-
return;
|
|
1510
|
-
const googleOauth = this.googleOauth;
|
|
1511
|
-
const windowRef = this.documentRef.defaultView;
|
|
1512
|
-
if (!googleOauth || !windowRef)
|
|
1513
|
-
return;
|
|
1514
|
-
if (googleOauth.mode === 'gateway') {
|
|
1515
|
-
void this.signInWithGatewayGoogle();
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
this.isGoogleRedirecting.set(true);
|
|
1519
|
-
this.googleErrorMessage.set(null);
|
|
1520
|
-
const state = createGoogleOauthState(windowRef);
|
|
1521
|
-
storeGoogleOauthState(this.documentRef, state);
|
|
1522
|
-
this.redirectTo(buildGoogleAuthorizeUrl({
|
|
1523
|
-
clientId: googleOauth.clientId,
|
|
1524
|
-
redirectUri: googleOauth.redirectUri,
|
|
1525
|
-
state,
|
|
1526
|
-
}));
|
|
1527
|
-
}
|
|
1528
|
-
async signInWithGatewayGoogle() {
|
|
1529
|
-
this.isGoogleRedirecting.set(true);
|
|
1530
|
-
this.googleErrorMessage.set(null);
|
|
1531
|
-
try {
|
|
1532
|
-
const authorizationUrl = await this.googleGateway.start();
|
|
1533
|
-
this.redirectTo(authorizationUrl);
|
|
1534
|
-
}
|
|
1535
|
-
catch (error) {
|
|
1536
|
-
this.googleErrorMessage.set(getBackendErrorMessage(error, this.messages.google.gatewayStartFailed));
|
|
1537
|
-
this.isGoogleRedirecting.set(false);
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
async signInWithNativeGoogle() {
|
|
1541
|
-
if (!this.nativeGoogle)
|
|
1542
|
-
return;
|
|
1543
|
-
this.isGoogleRedirecting.set(true);
|
|
1544
|
-
this.googleErrorMessage.set(null);
|
|
1545
|
-
try {
|
|
1546
|
-
await this.nativeGoogle.signIn();
|
|
1547
|
-
await this.router?.navigateByUrl(this.authConfig.authenticatedHomePath, {
|
|
1548
|
-
replaceUrl: true,
|
|
1549
|
-
});
|
|
1550
|
-
}
|
|
1551
|
-
catch {
|
|
1552
|
-
this.googleErrorMessage.set(this.messages.google.nativeSignInFailed);
|
|
1553
|
-
}
|
|
1554
|
-
finally {
|
|
1555
|
-
this.isGoogleRedirecting.set(false);
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
// Full-page redirect keluar dari SPA (bukan Router). Method terpisah karena
|
|
1559
|
-
// jsdom tidak mengizinkan stub pada location.assign.
|
|
1560
|
-
redirectTo(url) {
|
|
1561
|
-
this.documentRef.defaultView?.location.assign(url);
|
|
1562
|
-
}
|
|
1563
|
-
async submit() {
|
|
1564
|
-
await submit(this.form, async () => {
|
|
1565
|
-
// Pre-submit re-check: backend bisa mati setelah halaman dimuat.
|
|
1566
|
-
if (!(await this.health.check())) {
|
|
1567
|
-
return;
|
|
1568
|
-
}
|
|
1569
|
-
this.responseMessage.set(null);
|
|
1570
|
-
this.errorMessage.set(null);
|
|
1571
|
-
const email = this.form.email().value().trim().toLowerCase();
|
|
1572
|
-
this.form.email().value.set(email);
|
|
1573
|
-
try {
|
|
1574
|
-
const response = await firstValueFrom(this.authMagicLinkService
|
|
1575
|
-
.requestMagicLoginLink({
|
|
1576
|
-
body: {
|
|
1577
|
-
email,
|
|
1578
|
-
frontend_url: new URL(this.authConfig.appUrl).origin,
|
|
1579
|
-
},
|
|
1580
|
-
})
|
|
1581
|
-
.pipe(takeUntilDestroyed(this.destroyRef)));
|
|
1582
|
-
this.responseMessage.set(getResponseMessage(response, this.messages.login.magicLinkSent));
|
|
1583
|
-
}
|
|
1584
|
-
catch (error) {
|
|
1585
|
-
this.errorMessage.set(getErrorMessage(error, this.messages.login.magicLinkFailed));
|
|
1586
|
-
}
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthLoginPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1590
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AuthLoginPage, isStandalone: true, selector: "edsis-auth-login-page", host: { classAttribute: "block" }, viewQueries: [{ propertyName: "retryButton", first: true, predicate: ["healthRetryButton"], descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: `
|
|
1591
|
-
<Card
|
|
1592
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
1593
|
-
>
|
|
1594
|
-
<CardHeader
|
|
1595
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
1596
|
-
>
|
|
1597
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
1598
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
1599
|
-
<div
|
|
1600
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
1601
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
1602
|
-
>
|
|
1603
|
-
{{ messages.brand.mark }}
|
|
1604
|
-
</div>
|
|
1605
|
-
</AspectRatio>
|
|
1606
|
-
</div>
|
|
1607
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
1608
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
1609
|
-
messages.login.title
|
|
1610
|
-
}}</CardTitle>
|
|
1611
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
1612
|
-
{{ messages.login.intro }}
|
|
1613
|
-
</p>
|
|
1614
|
-
</div>
|
|
1615
|
-
<CardAction
|
|
1616
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
1617
|
-
>
|
|
1618
|
-
{{ messages.login.badge }}
|
|
1619
|
-
</CardAction>
|
|
1620
|
-
</CardHeader>
|
|
1621
|
-
|
|
1622
|
-
<CardContent class="pt-4 sm:pt-5">
|
|
1623
|
-
@if (health.isUnhealthy()) {
|
|
1624
|
-
<div
|
|
1625
|
-
[id]="healthBannerId"
|
|
1626
|
-
role="alert"
|
|
1627
|
-
aria-live="assertive"
|
|
1628
|
-
class="mb-5 space-y-1 rounded-none border border-destructive bg-destructive/10 p-4 text-destructive"
|
|
1629
|
-
>
|
|
1630
|
-
<p class="font-medium">{{ messages.login.healthUnavailableTitle }}</p>
|
|
1631
|
-
<p class="text-sm">{{ messages.login.healthUnavailableBody }}</p>
|
|
1632
|
-
<button
|
|
1633
|
-
#healthRetryButton
|
|
1634
|
-
Button
|
|
1635
|
-
type="button"
|
|
1636
|
-
variant="outline"
|
|
1637
|
-
size="sm"
|
|
1638
|
-
class="mt-2 border-destructive/50 text-destructive hover:bg-destructive/10 hover:text-destructive"
|
|
1639
|
-
[disabled]="health.isChecking()"
|
|
1640
|
-
(click)="retryHealth()"
|
|
1641
|
-
>
|
|
1642
|
-
{{ health.isChecking() ? messages.login.healthChecking : messages.login.healthRetry }}
|
|
1643
|
-
</button>
|
|
1644
|
-
</div>
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
<form class="space-y-6" (submit)="submit(); $event.preventDefault()">
|
|
1648
|
-
<div class="space-y-3">
|
|
1649
|
-
<label Label for="email" class="sr-only">Alamat email</label>
|
|
1650
|
-
<InputGroup [class]="emailFieldClasses()">
|
|
1651
|
-
<InputGroupAddon
|
|
1652
|
-
aria-hidden="true"
|
|
1653
|
-
class="min-h-12 px-4 bg-transparent text-primary [&_svg]:size-6!"
|
|
1654
|
-
>
|
|
1655
|
-
<svg
|
|
1656
|
-
viewBox="0 0 24 24"
|
|
1657
|
-
class="fill-none stroke-current"
|
|
1658
|
-
stroke-width="1.8"
|
|
1659
|
-
stroke-linecap="round"
|
|
1660
|
-
stroke-linejoin="round"
|
|
1661
|
-
>
|
|
1662
|
-
<path d="M4 7.5h16" />
|
|
1663
|
-
<path
|
|
1664
|
-
d="M5 6h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z"
|
|
1665
|
-
/>
|
|
1666
|
-
<path d="m5 8 7 5 7-5" />
|
|
1667
|
-
</svg>
|
|
1668
|
-
</InputGroupAddon>
|
|
1669
|
-
|
|
1670
|
-
<input
|
|
1671
|
-
InputGroupInput
|
|
1672
|
-
class="h-12! px-4! text-base!"
|
|
1673
|
-
id="email"
|
|
1674
|
-
type="email"
|
|
1675
|
-
inputmode="email"
|
|
1676
|
-
autocomplete="email"
|
|
1677
|
-
[attr.aria-describedby]="feedbackMessage() ? emailFeedbackId : null"
|
|
1678
|
-
[attr.aria-invalid]="fieldTone() === 'error' ? 'true' : null"
|
|
1679
|
-
[formField]="form.email"
|
|
1680
|
-
[placeholder]="messages.login.emailPlaceholder"
|
|
1681
|
-
/>
|
|
1682
|
-
|
|
1683
|
-
<button
|
|
1684
|
-
InputGroupButton
|
|
1685
|
-
type="submit"
|
|
1686
|
-
variant="default"
|
|
1687
|
-
size="sm"
|
|
1688
|
-
[disabled]="
|
|
1689
|
-
form().invalid() ||
|
|
1690
|
-
form().submitting() ||
|
|
1691
|
-
health.isChecking() ||
|
|
1692
|
-
health.isUnhealthy()
|
|
1693
|
-
"
|
|
1694
|
-
[attr.aria-describedby]="health.isUnhealthy() ? healthBannerId : null"
|
|
1695
|
-
class="order-30 h-12! min-w-24 rounded-none px-5 text-sm font-medium"
|
|
1696
|
-
>
|
|
1697
|
-
{{ form().submitting() ? messages.login.submitting : messages.login.submit }}
|
|
1698
|
-
</button>
|
|
1699
|
-
</InputGroup>
|
|
1700
|
-
|
|
1701
|
-
@if (feedbackMessage(); as feedback) {
|
|
1702
|
-
<p
|
|
1703
|
-
[id]="emailFeedbackId"
|
|
1704
|
-
class="text-sm"
|
|
1705
|
-
[class.text-destructive]="feedbackTone() === 'error'"
|
|
1706
|
-
[class.text-emerald-700]="feedbackTone() === 'success'"
|
|
1707
|
-
[attr.role]="feedbackTone() === 'error' ? 'alert' : 'status'"
|
|
1708
|
-
[attr.aria-live]="feedbackTone() === 'error' ? 'assertive' : 'polite'"
|
|
1709
|
-
>
|
|
1710
|
-
{{ feedback }}
|
|
1711
|
-
</p>
|
|
1712
|
-
}
|
|
1713
|
-
</div>
|
|
1714
|
-
|
|
1715
|
-
<div class="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3 pt-2">
|
|
1716
|
-
<Separator class="w-full" />
|
|
1717
|
-
<span
|
|
1718
|
-
class="min-w-14 text-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground"
|
|
1719
|
-
>
|
|
1720
|
-
Atau
|
|
1721
|
-
</span>
|
|
1722
|
-
<Separator class="w-full" />
|
|
1723
|
-
</div>
|
|
1724
|
-
|
|
1725
|
-
<div class="grid gap-3 pt-2 sm:grid-cols-3">
|
|
1726
|
-
<button
|
|
1727
|
-
Button
|
|
1728
|
-
type="button"
|
|
1729
|
-
variant="outline"
|
|
1730
|
-
size="lg"
|
|
1731
|
-
[disabled]="!googleSignInAvailable() || isGoogleRedirecting()"
|
|
1732
|
-
[attr.aria-label]="
|
|
1733
|
-
googleSignInAvailable()
|
|
1734
|
-
? messages.google.signInAria
|
|
1735
|
-
: requiresNativeGoogle()
|
|
1736
|
-
? messages.google.nativeSignInUnavailable
|
|
1737
|
-
: messages.login.oauthGoogleAria
|
|
1738
|
-
"
|
|
1739
|
-
[attr.title]="
|
|
1740
|
-
googleSignInAvailable()
|
|
1741
|
-
? null
|
|
1742
|
-
: requiresNativeGoogle()
|
|
1743
|
-
? messages.google.nativeSignInUnavailable
|
|
1744
|
-
: messages.login.oauthComingSoon
|
|
1745
|
-
"
|
|
1746
|
-
(click)="signInWithGoogle()"
|
|
1747
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
1748
|
-
>
|
|
1749
|
-
<span
|
|
1750
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
1751
|
-
aria-hidden="true"
|
|
1752
|
-
>
|
|
1753
|
-
<svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
|
|
1754
|
-
<path
|
|
1755
|
-
fill="#EA4335"
|
|
1756
|
-
d="M12.24 10.285v3.965h5.514c-.24 1.285-.96 2.374-2.045 3.105l3.305 2.565c1.925-1.775 3.03-4.39 3.03-7.49 0-.73-.065-1.43-.185-2.145z"
|
|
1757
|
-
/>
|
|
1758
|
-
<path
|
|
1759
|
-
fill="#34A853"
|
|
1760
|
-
d="M12 22c2.7 0 4.965-.895 6.62-2.425l-3.305-2.565c-.915.615-2.085.985-3.315.985-2.545 0-4.7-1.72-5.47-4.03H3.115v2.53A9.996 9.996 0 0 0 12 22"
|
|
1761
|
-
/>
|
|
1762
|
-
<path
|
|
1763
|
-
fill="#4A90E2"
|
|
1764
|
-
d="M6.53 13.965A5.996 5.996 0 0 1 6.24 12c0-.68.115-1.34.29-1.965v-2.53H3.115A9.996 9.996 0 0 0 2 12c0 1.61.385 3.135 1.115 4.495z"
|
|
1765
|
-
/>
|
|
1766
|
-
<path
|
|
1767
|
-
fill="#FBBC05"
|
|
1768
|
-
d="M12 6.005c1.47 0 2.79.505 3.83 1.495l2.87-2.87C16.96 3.01 14.695 2 12 2a9.996 9.996 0 0 0-8.885 5.505l3.415 2.53c.77-2.31 2.925-4.03 5.47-4.03"
|
|
1769
|
-
/>
|
|
1770
|
-
</svg>
|
|
1771
|
-
</span>
|
|
1772
|
-
{{ isGoogleRedirecting() ? googleProgressMessage() : 'Google' }}
|
|
1773
|
-
</button>
|
|
1774
|
-
<button
|
|
1775
|
-
Button
|
|
1776
|
-
type="button"
|
|
1777
|
-
variant="outline"
|
|
1778
|
-
size="lg"
|
|
1779
|
-
disabled
|
|
1780
|
-
[attr.aria-label]="messages.login.oauthMicrosoftAria"
|
|
1781
|
-
[attr.title]="messages.login.oauthComingSoon"
|
|
1782
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
1783
|
-
>
|
|
1784
|
-
<span
|
|
1785
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
1786
|
-
aria-hidden="true"
|
|
1787
|
-
>
|
|
1788
|
-
<svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
|
|
1789
|
-
<path fill="#F25022" d="M2 2h9.5v9.5H2z" />
|
|
1790
|
-
<path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
|
|
1791
|
-
<path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
|
|
1792
|
-
<path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
|
|
1793
|
-
</svg>
|
|
1794
|
-
</span>
|
|
1795
|
-
Microsoft
|
|
1796
|
-
</button>
|
|
1797
|
-
<button
|
|
1798
|
-
Button
|
|
1799
|
-
type="button"
|
|
1800
|
-
variant="outline"
|
|
1801
|
-
size="lg"
|
|
1802
|
-
disabled
|
|
1803
|
-
[attr.aria-label]="messages.login.oauthAppleAria"
|
|
1804
|
-
[attr.title]="messages.login.oauthComingSoon"
|
|
1805
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
1806
|
-
>
|
|
1807
|
-
<span
|
|
1808
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
1809
|
-
aria-hidden="true"
|
|
1810
|
-
>
|
|
1811
|
-
<svg
|
|
1812
|
-
viewBox="0 0 24 24"
|
|
1813
|
-
class="size-5 fill-current"
|
|
1814
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1815
|
-
>
|
|
1816
|
-
<path
|
|
1817
|
-
d="M15.482 2c.13 1.25-.31 2.19-.84 2.81-.55.65-1.47 1.15-2.39 1.08-.12-1.21.38-2.17.92-2.79.6-.68 1.61-1.17 2.31-1.1Zm3.94 16.85c-.41.94-.91 1.8-1.54 2.59-.86 1.07-1.57 1.8-2.39 1.8-.59 0-.99-.17-1.44-.36-.47-.2-.95-.4-1.63-.4-.71 0-1.22.2-1.7.4-.46.19-.85.35-1.38.37-.79.03-1.55-.8-2.42-1.87-1.86-2.28-3.3-6.43-1.38-9.77.96-1.66 2.68-2.72 4.55-2.75.71-.01 1.39.21 1.98.41.45.15.86.29 1.19.29.3 0 .73-.15 1.19-.31.68-.23 1.46-.49 2.28-.42 1.14.09 2.17.55 2.98 1.38-2.66 1.45-2.23 5.2.71 6.54Z"
|
|
1818
|
-
/>
|
|
1819
|
-
</svg>
|
|
1820
|
-
</span>
|
|
1821
|
-
Apple
|
|
1822
|
-
</button>
|
|
1823
|
-
</div>
|
|
1824
|
-
|
|
1825
|
-
@if (isGoogleRedirecting()) {
|
|
1826
|
-
<p class="sr-only" role="status" aria-live="polite">
|
|
1827
|
-
{{ googleProgressMessage() }}
|
|
1828
|
-
</p>
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
@if (googleFeedbackMessage(); as googleError) {
|
|
1832
|
-
<p class="text-sm text-destructive" role="alert" aria-live="assertive">
|
|
1833
|
-
{{ googleError }}
|
|
1834
|
-
</p>
|
|
1835
|
-
}
|
|
1836
|
-
</form>
|
|
1837
|
-
</CardContent>
|
|
1838
|
-
</Card>
|
|
1839
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "component", type: AspectRatioComponent, selector: "AspectRatio", inputs: ["ratio", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: CardActionComponent, selector: "CardAction", inputs: ["class"] }, { kind: "component", type: CardComponent, selector: "Card", inputs: ["size", "class"] }, { kind: "component", type: CardContentComponent, selector: "CardContent", inputs: ["class"] }, { kind: "component", type: CardDescriptionComponent, selector: "CardDescription, p[CardDescription]", inputs: ["class"] }, { kind: "component", type: CardHeaderComponent, selector: "CardHeader", inputs: ["class"] }, { kind: "component", type: CardTitleComponent, selector: "CardTitle, h3[CardTitle]", inputs: ["class"] }, { kind: "component", type: InputGroupAddonComponent, selector: "InputGroupAddon", inputs: ["align", "class"] }, { kind: "component", type: InputGroupButtonComponent, selector: "button[InputGroupButton], a[InputGroupButton]", inputs: ["variant", "size", "class"] }, { kind: "component", type: InputGroupComponent, selector: "InputGroup", inputs: ["class"] }, { kind: "component", type: InputGroupInputComponent, selector: "input[InputGroupInput]", inputs: ["class"] }, { kind: "component", type: LabelComponent, selector: "Label, label[Label]", inputs: ["for", "class"] }, { kind: "component", type: SeparatorComponent, selector: "Separator", inputs: ["orientation", "decorative", "class"] }] });
|
|
1840
|
-
}
|
|
1841
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthLoginPage, decorators: [{
|
|
1842
|
-
type: Component,
|
|
1843
|
-
args: [{
|
|
1844
|
-
selector: 'edsis-auth-login-page',
|
|
1845
|
-
imports: [
|
|
1846
|
-
FormField,
|
|
1847
|
-
AspectRatioComponent,
|
|
1848
|
-
ButtonComponent,
|
|
1849
|
-
CardActionComponent,
|
|
1850
|
-
CardComponent,
|
|
1851
|
-
CardContentComponent,
|
|
1852
|
-
CardDescriptionComponent,
|
|
1853
|
-
CardHeaderComponent,
|
|
1854
|
-
CardTitleComponent,
|
|
1855
|
-
InputGroupAddonComponent,
|
|
1856
|
-
InputGroupButtonComponent,
|
|
1857
|
-
InputGroupComponent,
|
|
1858
|
-
InputGroupInputComponent,
|
|
1859
|
-
LabelComponent,
|
|
1860
|
-
SeparatorComponent,
|
|
1861
|
-
],
|
|
1862
|
-
host: {
|
|
1863
|
-
class: 'block',
|
|
1864
|
-
},
|
|
1865
|
-
template: `
|
|
1866
|
-
<Card
|
|
1867
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
1868
|
-
>
|
|
1869
|
-
<CardHeader
|
|
1870
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
1871
|
-
>
|
|
1872
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
1873
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
1874
|
-
<div
|
|
1875
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
1876
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
1877
|
-
>
|
|
1878
|
-
{{ messages.brand.mark }}
|
|
1879
|
-
</div>
|
|
1880
|
-
</AspectRatio>
|
|
1881
|
-
</div>
|
|
1882
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
1883
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
1884
|
-
messages.login.title
|
|
1885
|
-
}}</CardTitle>
|
|
1886
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
1887
|
-
{{ messages.login.intro }}
|
|
1888
|
-
</p>
|
|
1889
|
-
</div>
|
|
1890
|
-
<CardAction
|
|
1891
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
1892
|
-
>
|
|
1893
|
-
{{ messages.login.badge }}
|
|
1894
|
-
</CardAction>
|
|
1895
|
-
</CardHeader>
|
|
1896
|
-
|
|
1897
|
-
<CardContent class="pt-4 sm:pt-5">
|
|
1898
|
-
@if (health.isUnhealthy()) {
|
|
1899
|
-
<div
|
|
1900
|
-
[id]="healthBannerId"
|
|
1901
|
-
role="alert"
|
|
1902
|
-
aria-live="assertive"
|
|
1903
|
-
class="mb-5 space-y-1 rounded-none border border-destructive bg-destructive/10 p-4 text-destructive"
|
|
1904
|
-
>
|
|
1905
|
-
<p class="font-medium">{{ messages.login.healthUnavailableTitle }}</p>
|
|
1906
|
-
<p class="text-sm">{{ messages.login.healthUnavailableBody }}</p>
|
|
1907
|
-
<button
|
|
1908
|
-
#healthRetryButton
|
|
1909
|
-
Button
|
|
1910
|
-
type="button"
|
|
1911
|
-
variant="outline"
|
|
1912
|
-
size="sm"
|
|
1913
|
-
class="mt-2 border-destructive/50 text-destructive hover:bg-destructive/10 hover:text-destructive"
|
|
1914
|
-
[disabled]="health.isChecking()"
|
|
1915
|
-
(click)="retryHealth()"
|
|
1916
|
-
>
|
|
1917
|
-
{{ health.isChecking() ? messages.login.healthChecking : messages.login.healthRetry }}
|
|
1918
|
-
</button>
|
|
1919
|
-
</div>
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
<form class="space-y-6" (submit)="submit(); $event.preventDefault()">
|
|
1923
|
-
<div class="space-y-3">
|
|
1924
|
-
<label Label for="email" class="sr-only">Alamat email</label>
|
|
1925
|
-
<InputGroup [class]="emailFieldClasses()">
|
|
1926
|
-
<InputGroupAddon
|
|
1927
|
-
aria-hidden="true"
|
|
1928
|
-
class="min-h-12 px-4 bg-transparent text-primary [&_svg]:size-6!"
|
|
1929
|
-
>
|
|
1930
|
-
<svg
|
|
1931
|
-
viewBox="0 0 24 24"
|
|
1932
|
-
class="fill-none stroke-current"
|
|
1933
|
-
stroke-width="1.8"
|
|
1934
|
-
stroke-linecap="round"
|
|
1935
|
-
stroke-linejoin="round"
|
|
1936
|
-
>
|
|
1937
|
-
<path d="M4 7.5h16" />
|
|
1938
|
-
<path
|
|
1939
|
-
d="M5 6h14a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z"
|
|
1940
|
-
/>
|
|
1941
|
-
<path d="m5 8 7 5 7-5" />
|
|
1942
|
-
</svg>
|
|
1943
|
-
</InputGroupAddon>
|
|
1944
|
-
|
|
1945
|
-
<input
|
|
1946
|
-
InputGroupInput
|
|
1947
|
-
class="h-12! px-4! text-base!"
|
|
1948
|
-
id="email"
|
|
1949
|
-
type="email"
|
|
1950
|
-
inputmode="email"
|
|
1951
|
-
autocomplete="email"
|
|
1952
|
-
[attr.aria-describedby]="feedbackMessage() ? emailFeedbackId : null"
|
|
1953
|
-
[attr.aria-invalid]="fieldTone() === 'error' ? 'true' : null"
|
|
1954
|
-
[formField]="form.email"
|
|
1955
|
-
[placeholder]="messages.login.emailPlaceholder"
|
|
1956
|
-
/>
|
|
1957
|
-
|
|
1958
|
-
<button
|
|
1959
|
-
InputGroupButton
|
|
1960
|
-
type="submit"
|
|
1961
|
-
variant="default"
|
|
1962
|
-
size="sm"
|
|
1963
|
-
[disabled]="
|
|
1964
|
-
form().invalid() ||
|
|
1965
|
-
form().submitting() ||
|
|
1966
|
-
health.isChecking() ||
|
|
1967
|
-
health.isUnhealthy()
|
|
1968
|
-
"
|
|
1969
|
-
[attr.aria-describedby]="health.isUnhealthy() ? healthBannerId : null"
|
|
1970
|
-
class="order-30 h-12! min-w-24 rounded-none px-5 text-sm font-medium"
|
|
1971
|
-
>
|
|
1972
|
-
{{ form().submitting() ? messages.login.submitting : messages.login.submit }}
|
|
1973
|
-
</button>
|
|
1974
|
-
</InputGroup>
|
|
1975
|
-
|
|
1976
|
-
@if (feedbackMessage(); as feedback) {
|
|
1977
|
-
<p
|
|
1978
|
-
[id]="emailFeedbackId"
|
|
1979
|
-
class="text-sm"
|
|
1980
|
-
[class.text-destructive]="feedbackTone() === 'error'"
|
|
1981
|
-
[class.text-emerald-700]="feedbackTone() === 'success'"
|
|
1982
|
-
[attr.role]="feedbackTone() === 'error' ? 'alert' : 'status'"
|
|
1983
|
-
[attr.aria-live]="feedbackTone() === 'error' ? 'assertive' : 'polite'"
|
|
1984
|
-
>
|
|
1985
|
-
{{ feedback }}
|
|
1986
|
-
</p>
|
|
1987
|
-
}
|
|
1988
|
-
</div>
|
|
1989
|
-
|
|
1990
|
-
<div class="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3 pt-2">
|
|
1991
|
-
<Separator class="w-full" />
|
|
1992
|
-
<span
|
|
1993
|
-
class="min-w-14 text-center text-sm font-medium uppercase tracking-[0.18em] text-muted-foreground"
|
|
1994
|
-
>
|
|
1995
|
-
Atau
|
|
1996
|
-
</span>
|
|
1997
|
-
<Separator class="w-full" />
|
|
1998
|
-
</div>
|
|
1999
|
-
|
|
2000
|
-
<div class="grid gap-3 pt-2 sm:grid-cols-3">
|
|
2001
|
-
<button
|
|
2002
|
-
Button
|
|
2003
|
-
type="button"
|
|
2004
|
-
variant="outline"
|
|
2005
|
-
size="lg"
|
|
2006
|
-
[disabled]="!googleSignInAvailable() || isGoogleRedirecting()"
|
|
2007
|
-
[attr.aria-label]="
|
|
2008
|
-
googleSignInAvailable()
|
|
2009
|
-
? messages.google.signInAria
|
|
2010
|
-
: requiresNativeGoogle()
|
|
2011
|
-
? messages.google.nativeSignInUnavailable
|
|
2012
|
-
: messages.login.oauthGoogleAria
|
|
2013
|
-
"
|
|
2014
|
-
[attr.title]="
|
|
2015
|
-
googleSignInAvailable()
|
|
2016
|
-
? null
|
|
2017
|
-
: requiresNativeGoogle()
|
|
2018
|
-
? messages.google.nativeSignInUnavailable
|
|
2019
|
-
: messages.login.oauthComingSoon
|
|
2020
|
-
"
|
|
2021
|
-
(click)="signInWithGoogle()"
|
|
2022
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
2023
|
-
>
|
|
2024
|
-
<span
|
|
2025
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
2026
|
-
aria-hidden="true"
|
|
2027
|
-
>
|
|
2028
|
-
<svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
|
|
2029
|
-
<path
|
|
2030
|
-
fill="#EA4335"
|
|
2031
|
-
d="M12.24 10.285v3.965h5.514c-.24 1.285-.96 2.374-2.045 3.105l3.305 2.565c1.925-1.775 3.03-4.39 3.03-7.49 0-.73-.065-1.43-.185-2.145z"
|
|
2032
|
-
/>
|
|
2033
|
-
<path
|
|
2034
|
-
fill="#34A853"
|
|
2035
|
-
d="M12 22c2.7 0 4.965-.895 6.62-2.425l-3.305-2.565c-.915.615-2.085.985-3.315.985-2.545 0-4.7-1.72-5.47-4.03H3.115v2.53A9.996 9.996 0 0 0 12 22"
|
|
2036
|
-
/>
|
|
2037
|
-
<path
|
|
2038
|
-
fill="#4A90E2"
|
|
2039
|
-
d="M6.53 13.965A5.996 5.996 0 0 1 6.24 12c0-.68.115-1.34.29-1.965v-2.53H3.115A9.996 9.996 0 0 0 2 12c0 1.61.385 3.135 1.115 4.495z"
|
|
2040
|
-
/>
|
|
2041
|
-
<path
|
|
2042
|
-
fill="#FBBC05"
|
|
2043
|
-
d="M12 6.005c1.47 0 2.79.505 3.83 1.495l2.87-2.87C16.96 3.01 14.695 2 12 2a9.996 9.996 0 0 0-8.885 5.505l3.415 2.53c.77-2.31 2.925-4.03 5.47-4.03"
|
|
2044
|
-
/>
|
|
2045
|
-
</svg>
|
|
2046
|
-
</span>
|
|
2047
|
-
{{ isGoogleRedirecting() ? googleProgressMessage() : 'Google' }}
|
|
2048
|
-
</button>
|
|
2049
|
-
<button
|
|
2050
|
-
Button
|
|
2051
|
-
type="button"
|
|
2052
|
-
variant="outline"
|
|
2053
|
-
size="lg"
|
|
2054
|
-
disabled
|
|
2055
|
-
[attr.aria-label]="messages.login.oauthMicrosoftAria"
|
|
2056
|
-
[attr.title]="messages.login.oauthComingSoon"
|
|
2057
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
2058
|
-
>
|
|
2059
|
-
<span
|
|
2060
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
2061
|
-
aria-hidden="true"
|
|
2062
|
-
>
|
|
2063
|
-
<svg viewBox="0 0 24 24" class="size-5" xmlns="http://www.w3.org/2000/svg">
|
|
2064
|
-
<path fill="#F25022" d="M2 2h9.5v9.5H2z" />
|
|
2065
|
-
<path fill="#7FBA00" d="M12.5 2H22v9.5h-9.5z" />
|
|
2066
|
-
<path fill="#00A4EF" d="M2 12.5h9.5V22H2z" />
|
|
2067
|
-
<path fill="#FFB900" d="M12.5 12.5H22V22h-9.5z" />
|
|
2068
|
-
</svg>
|
|
2069
|
-
</span>
|
|
2070
|
-
Microsoft
|
|
2071
|
-
</button>
|
|
2072
|
-
<button
|
|
2073
|
-
Button
|
|
2074
|
-
type="button"
|
|
2075
|
-
variant="outline"
|
|
2076
|
-
size="lg"
|
|
2077
|
-
disabled
|
|
2078
|
-
[attr.aria-label]="messages.login.oauthAppleAria"
|
|
2079
|
-
[attr.title]="messages.login.oauthComingSoon"
|
|
2080
|
-
class="h-12 gap-3 text-[0.74rem] font-medium uppercase tracking-[0.16em]"
|
|
2081
|
-
>
|
|
2082
|
-
<span
|
|
2083
|
-
class="inline-flex size-6 shrink-0 items-center justify-center"
|
|
2084
|
-
aria-hidden="true"
|
|
2085
|
-
>
|
|
2086
|
-
<svg
|
|
2087
|
-
viewBox="0 0 24 24"
|
|
2088
|
-
class="size-5 fill-current"
|
|
2089
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
2090
|
-
>
|
|
2091
|
-
<path
|
|
2092
|
-
d="M15.482 2c.13 1.25-.31 2.19-.84 2.81-.55.65-1.47 1.15-2.39 1.08-.12-1.21.38-2.17.92-2.79.6-.68 1.61-1.17 2.31-1.1Zm3.94 16.85c-.41.94-.91 1.8-1.54 2.59-.86 1.07-1.57 1.8-2.39 1.8-.59 0-.99-.17-1.44-.36-.47-.2-.95-.4-1.63-.4-.71 0-1.22.2-1.7.4-.46.19-.85.35-1.38.37-.79.03-1.55-.8-2.42-1.87-1.86-2.28-3.3-6.43-1.38-9.77.96-1.66 2.68-2.72 4.55-2.75.71-.01 1.39.21 1.98.41.45.15.86.29 1.19.29.3 0 .73-.15 1.19-.31.68-.23 1.46-.49 2.28-.42 1.14.09 2.17.55 2.98 1.38-2.66 1.45-2.23 5.2.71 6.54Z"
|
|
2093
|
-
/>
|
|
2094
|
-
</svg>
|
|
2095
|
-
</span>
|
|
2096
|
-
Apple
|
|
2097
|
-
</button>
|
|
2098
|
-
</div>
|
|
2099
|
-
|
|
2100
|
-
@if (isGoogleRedirecting()) {
|
|
2101
|
-
<p class="sr-only" role="status" aria-live="polite">
|
|
2102
|
-
{{ googleProgressMessage() }}
|
|
2103
|
-
</p>
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
@if (googleFeedbackMessage(); as googleError) {
|
|
2107
|
-
<p class="text-sm text-destructive" role="alert" aria-live="assertive">
|
|
2108
|
-
{{ googleError }}
|
|
2109
|
-
</p>
|
|
2110
|
-
}
|
|
2111
|
-
</form>
|
|
2112
|
-
</CardContent>
|
|
2113
|
-
</Card>
|
|
2114
|
-
`,
|
|
2115
|
-
}]
|
|
2116
|
-
}], ctorParameters: () => [], propDecorators: { retryButton: [{ type: i0.ViewChild, args: ['healthRetryButton', { ...{ read: ElementRef }, isSignal: true }] }] } });
|
|
2117
|
-
|
|
2118
|
-
class AuthLogoutPage {
|
|
2119
|
-
destroyRef = inject(DestroyRef);
|
|
2120
|
-
router = inject(Router);
|
|
2121
|
-
authService = inject(AuthService);
|
|
2122
|
-
authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
2123
|
-
messages = inject(EDSIS_AUTH_MESSAGES);
|
|
2124
|
-
guestHomePath = this.authConfig.guestHomePath;
|
|
2125
|
-
authenticatedHomePath = this.authConfig.authenticatedHomePath;
|
|
2126
|
-
state = signal('pending', /* @ts-ignore */
|
|
2127
|
-
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2128
|
-
message = signal(this.messages.logout.pending, /* @ts-ignore */
|
|
2129
|
-
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
2130
|
-
ngOnInit() {
|
|
2131
|
-
from(this.authService.logout())
|
|
2132
|
-
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => {
|
|
2133
|
-
if (this.state() === 'pending') {
|
|
2134
|
-
this.state.set('success');
|
|
2135
|
-
}
|
|
2136
|
-
}))
|
|
2137
|
-
.subscribe({
|
|
2138
|
-
next: () => {
|
|
2139
|
-
this.state.set('success');
|
|
2140
|
-
this.message.set(this.messages.logout.success);
|
|
2141
|
-
void this.router.navigateByUrl(this.guestHomePath, { replaceUrl: true });
|
|
2142
|
-
},
|
|
2143
|
-
error: (error) => {
|
|
2144
|
-
this.state.set('error');
|
|
2145
|
-
this.message.set(getErrorMessage(error, this.messages.logout.failed));
|
|
2146
|
-
},
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthLogoutPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2150
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AuthLogoutPage, isStandalone: true, selector: "edsis-auth-logout-page", host: { classAttribute: "block" }, ngImport: i0, template: `
|
|
2151
|
-
<Card
|
|
2152
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
2153
|
-
>
|
|
2154
|
-
<CardHeader
|
|
2155
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
2156
|
-
>
|
|
2157
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
2158
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
2159
|
-
<div
|
|
2160
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
2161
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
2162
|
-
>
|
|
2163
|
-
{{ messages.brand.mark }}
|
|
2164
|
-
</div>
|
|
2165
|
-
</AspectRatio>
|
|
2166
|
-
</div>
|
|
2167
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
2168
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
2169
|
-
messages.logout.title
|
|
2170
|
-
}}</CardTitle>
|
|
2171
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
2172
|
-
{{ messages.logout.intro }}
|
|
2173
|
-
</p>
|
|
2174
|
-
</div>
|
|
2175
|
-
<CardAction
|
|
2176
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
2177
|
-
>
|
|
2178
|
-
{{ messages.logout.badge }}
|
|
2179
|
-
</CardAction>
|
|
2180
|
-
</CardHeader>
|
|
2181
|
-
|
|
2182
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
2183
|
-
<Alert
|
|
2184
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
2185
|
-
class="bg-background/70 shadow-sm"
|
|
2186
|
-
>
|
|
2187
|
-
@if (state() === 'pending') {
|
|
2188
|
-
<Spinner class="mt-0.5 size-4" [attr.aria-label]="messages.logout.pendingAria" />
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
<AlertDescription>
|
|
2192
|
-
{{ message() }}
|
|
2193
|
-
</AlertDescription>
|
|
2194
|
-
</Alert>
|
|
2195
|
-
|
|
2196
|
-
@if (state() === 'error') {
|
|
2197
|
-
<Alert variant="destructive" class="shadow-sm">
|
|
2198
|
-
<AlertDescription>
|
|
2199
|
-
{{ messages.logout.failedNote }}
|
|
2200
|
-
</AlertDescription>
|
|
2201
|
-
</Alert>
|
|
2202
|
-
}
|
|
2203
|
-
</CardContent>
|
|
2204
|
-
|
|
2205
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
2206
|
-
<a Button [routerLink]="guestHomePath" variant="default">
|
|
2207
|
-
{{ messages.logout.backToLogin }}
|
|
2208
|
-
</a>
|
|
2209
|
-
<a Button [routerLink]="authenticatedHomePath" variant="outline">
|
|
2210
|
-
{{ messages.logout.openDashboard }}
|
|
2211
|
-
</a>
|
|
2212
|
-
</CardFooter>
|
|
2213
|
-
</Card>
|
|
2214
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: AlertComponent, selector: "Alert", inputs: ["variant", "class"] }, { kind: "component", type: AlertDescriptionComponent, selector: "AlertDescription", inputs: ["class"] }, { kind: "component", type: AspectRatioComponent, selector: "AspectRatio", inputs: ["ratio", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: CardActionComponent, selector: "CardAction", inputs: ["class"] }, { kind: "component", type: CardComponent, selector: "Card", inputs: ["size", "class"] }, { kind: "component", type: CardContentComponent, selector: "CardContent", inputs: ["class"] }, { kind: "component", type: CardDescriptionComponent, selector: "CardDescription, p[CardDescription]", inputs: ["class"] }, { kind: "component", type: CardFooterComponent, selector: "CardFooter", inputs: ["class"] }, { kind: "component", type: CardHeaderComponent, selector: "CardHeader", inputs: ["class"] }, { kind: "component", type: CardTitleComponent, selector: "CardTitle, h3[CardTitle]", inputs: ["class"] }, { kind: "component", type: SpinnerComponent, selector: "Spinner", inputs: ["class", "decorative", "aria-label", "aria-labelledby"] }] });
|
|
2215
|
-
}
|
|
2216
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthLogoutPage, decorators: [{
|
|
2217
|
-
type: Component,
|
|
2218
|
-
args: [{
|
|
2219
|
-
selector: 'edsis-auth-logout-page',
|
|
2220
|
-
imports: [
|
|
2221
|
-
RouterLink,
|
|
2222
|
-
AlertComponent,
|
|
2223
|
-
AlertDescriptionComponent,
|
|
2224
|
-
AspectRatioComponent,
|
|
2225
|
-
ButtonComponent,
|
|
2226
|
-
CardActionComponent,
|
|
2227
|
-
CardComponent,
|
|
2228
|
-
CardContentComponent,
|
|
2229
|
-
CardDescriptionComponent,
|
|
2230
|
-
CardFooterComponent,
|
|
2231
|
-
CardHeaderComponent,
|
|
2232
|
-
CardTitleComponent,
|
|
2233
|
-
SpinnerComponent,
|
|
2234
|
-
],
|
|
2235
|
-
host: {
|
|
2236
|
-
class: 'block',
|
|
2237
|
-
},
|
|
2238
|
-
template: `
|
|
2239
|
-
<Card
|
|
2240
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
2241
|
-
>
|
|
2242
|
-
<CardHeader
|
|
2243
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
2244
|
-
>
|
|
2245
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
2246
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
2247
|
-
<div
|
|
2248
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
2249
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
2250
|
-
>
|
|
2251
|
-
{{ messages.brand.mark }}
|
|
2252
|
-
</div>
|
|
2253
|
-
</AspectRatio>
|
|
2254
|
-
</div>
|
|
2255
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
2256
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
2257
|
-
messages.logout.title
|
|
2258
|
-
}}</CardTitle>
|
|
2259
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
2260
|
-
{{ messages.logout.intro }}
|
|
2261
|
-
</p>
|
|
2262
|
-
</div>
|
|
2263
|
-
<CardAction
|
|
2264
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
2265
|
-
>
|
|
2266
|
-
{{ messages.logout.badge }}
|
|
2267
|
-
</CardAction>
|
|
2268
|
-
</CardHeader>
|
|
2269
|
-
|
|
2270
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
2271
|
-
<Alert
|
|
2272
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
2273
|
-
class="bg-background/70 shadow-sm"
|
|
2274
|
-
>
|
|
2275
|
-
@if (state() === 'pending') {
|
|
2276
|
-
<Spinner class="mt-0.5 size-4" [attr.aria-label]="messages.logout.pendingAria" />
|
|
2277
|
-
}
|
|
2278
|
-
|
|
2279
|
-
<AlertDescription>
|
|
2280
|
-
{{ message() }}
|
|
2281
|
-
</AlertDescription>
|
|
2282
|
-
</Alert>
|
|
2283
|
-
|
|
2284
|
-
@if (state() === 'error') {
|
|
2285
|
-
<Alert variant="destructive" class="shadow-sm">
|
|
2286
|
-
<AlertDescription>
|
|
2287
|
-
{{ messages.logout.failedNote }}
|
|
2288
|
-
</AlertDescription>
|
|
2289
|
-
</Alert>
|
|
2290
|
-
}
|
|
2291
|
-
</CardContent>
|
|
2292
|
-
|
|
2293
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
2294
|
-
<a Button [routerLink]="guestHomePath" variant="default">
|
|
2295
|
-
{{ messages.logout.backToLogin }}
|
|
2296
|
-
</a>
|
|
2297
|
-
<a Button [routerLink]="authenticatedHomePath" variant="outline">
|
|
2298
|
-
{{ messages.logout.openDashboard }}
|
|
2299
|
-
</a>
|
|
2300
|
-
</CardFooter>
|
|
2301
|
-
</Card>
|
|
2302
|
-
`,
|
|
2303
|
-
}]
|
|
2304
|
-
}] });
|
|
2305
|
-
|
|
2306
|
-
class AuthVerifyPage {
|
|
2307
|
-
documentRef = inject(DOCUMENT);
|
|
2308
|
-
destroyRef = inject(DestroyRef);
|
|
2309
|
-
route = inject(ActivatedRoute);
|
|
2310
|
-
router = inject(Router);
|
|
2311
|
-
location = inject(Location);
|
|
2312
|
-
authMagicLinkService = inject(AuthMagicLinkService);
|
|
2313
|
-
authConfig = inject(EDSIS_AUTH_CONFIG);
|
|
2314
|
-
authService = inject(AuthService);
|
|
2315
|
-
messages = inject(EDSIS_AUTH_MESSAGES);
|
|
2316
|
-
queryParamMap = toSignal(this.route.queryParamMap, {
|
|
2317
|
-
initialValue: this.route.snapshot.queryParamMap,
|
|
2318
|
-
});
|
|
2319
|
-
fragment = toSignal(this.route.fragment, {
|
|
2320
|
-
initialValue: this.route.snapshot.fragment,
|
|
2321
|
-
});
|
|
2322
|
-
handledToken = undefined;
|
|
2323
|
-
verifySubscription = null;
|
|
2324
|
-
guestHomePath = this.authConfig.guestHomePath;
|
|
2325
|
-
authenticatedHomePath = this.authConfig.authenticatedHomePath;
|
|
2326
|
-
state = signal('pending', /* @ts-ignore */
|
|
2327
|
-
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
2328
|
-
message = signal(this.messages.verify.pending, /* @ts-ignore */
|
|
2329
|
-
...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
2330
|
-
token = input(undefined, /* @ts-ignore */
|
|
2331
|
-
...(ngDevMode ? [{ debugName: "token" }] : /* istanbul ignore next */ []));
|
|
2332
|
-
constructor() {
|
|
2333
|
-
this.destroyRef.onDestroy(() => this.verifySubscription?.unsubscribe());
|
|
2334
|
-
effect(() => {
|
|
2335
|
-
const token = extractMagicToken(this.token() ?? this.queryParamMap().get('token'), this.fragment());
|
|
2336
|
-
if (!token) {
|
|
2337
|
-
if (this.handledToken === null) {
|
|
2338
|
-
return;
|
|
2339
|
-
}
|
|
2340
|
-
this.handledToken = null;
|
|
2341
|
-
this.clearTokenFromAddressBar();
|
|
2342
|
-
this.state.set('error');
|
|
2343
|
-
this.message.set(this.messages.verify.tokenMissing);
|
|
2344
|
-
return;
|
|
2345
|
-
}
|
|
2346
|
-
if (token === this.handledToken) {
|
|
2347
|
-
return;
|
|
2348
|
-
}
|
|
2349
|
-
this.handledToken = token;
|
|
2350
|
-
this.clearTokenFromAddressBar();
|
|
2351
|
-
this.state.set('pending');
|
|
2352
|
-
this.message.set(this.messages.verify.pending);
|
|
2353
|
-
untracked(() => this.verify(token));
|
|
2354
|
-
});
|
|
2355
|
-
}
|
|
2356
|
-
clearTokenFromAddressBar() {
|
|
2357
|
-
this.location.replaceState(this.authConfig.verifyPath);
|
|
2358
|
-
}
|
|
2359
|
-
verify(token) {
|
|
2360
|
-
this.verifySubscription?.unsubscribe();
|
|
2361
|
-
this.verifySubscription = this.authMagicLinkService
|
|
2362
|
-
.verifyMagicLink({
|
|
2363
|
-
body: {
|
|
2364
|
-
token,
|
|
2365
|
-
device_type: 'web',
|
|
2366
|
-
},
|
|
2367
|
-
})
|
|
2368
|
-
.subscribe({
|
|
2369
|
-
next: (response) => {
|
|
2370
|
-
this.authService.acceptTokenResponse(response);
|
|
2371
|
-
if (!this.authService.isAuthenticated()) {
|
|
2372
|
-
this.state.set('error');
|
|
2373
|
-
this.message.set(this.messages.verify.missingAccessToken);
|
|
2374
|
-
return;
|
|
2375
|
-
}
|
|
2376
|
-
this.state.set('success');
|
|
2377
|
-
this.message.set(getResponseMessage(response, this.messages.verify.successRedirect));
|
|
2378
|
-
void this.router.navigateByUrl(this.authenticatedHomePath, { replaceUrl: true });
|
|
2379
|
-
},
|
|
2380
|
-
error: (error) => {
|
|
2381
|
-
this.state.set('error');
|
|
2382
|
-
this.message.set(getErrorMessage(error, this.messages.verify.invalidOrExpired));
|
|
2383
|
-
},
|
|
2384
|
-
});
|
|
2385
|
-
}
|
|
2386
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthVerifyPage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2387
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: AuthVerifyPage, isStandalone: true, selector: "edsis-auth-verify-page", inputs: { token: { classPropertyName: "token", publicName: "token", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block" }, ngImport: i0, template: `
|
|
2388
|
-
<Card
|
|
2389
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
2390
|
-
>
|
|
2391
|
-
<CardHeader
|
|
2392
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
2393
|
-
>
|
|
2394
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
2395
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
2396
|
-
<div
|
|
2397
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
2398
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
2399
|
-
>
|
|
2400
|
-
{{ messages.brand.mark }}
|
|
2401
|
-
</div>
|
|
2402
|
-
</AspectRatio>
|
|
2403
|
-
</div>
|
|
2404
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
2405
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
2406
|
-
messages.verify.title
|
|
2407
|
-
}}</CardTitle>
|
|
2408
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
2409
|
-
{{ messages.verify.intro }}
|
|
2410
|
-
</p>
|
|
2411
|
-
</div>
|
|
2412
|
-
<CardAction
|
|
2413
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
2414
|
-
>
|
|
2415
|
-
{{ messages.verify.badge }}
|
|
2416
|
-
</CardAction>
|
|
2417
|
-
</CardHeader>
|
|
2418
|
-
|
|
2419
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
2420
|
-
<Alert
|
|
2421
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
2422
|
-
class="bg-background/70 shadow-sm"
|
|
2423
|
-
>
|
|
2424
|
-
@if (state() === 'pending') {
|
|
2425
|
-
<Spinner class="mt-0.5 size-4" [attr.aria-label]="messages.verify.pendingAria" />
|
|
2426
|
-
}
|
|
2427
|
-
|
|
2428
|
-
<AlertDescription>
|
|
2429
|
-
{{ message() }}
|
|
2430
|
-
</AlertDescription>
|
|
2431
|
-
</Alert>
|
|
2432
|
-
|
|
2433
|
-
@if (state() === 'error') {
|
|
2434
|
-
<Alert variant="destructive" class="shadow-sm">
|
|
2435
|
-
<AlertDescription>
|
|
2436
|
-
Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai
|
|
2437
|
-
sebelumnya.
|
|
2438
|
-
</AlertDescription>
|
|
2439
|
-
</Alert>
|
|
2440
|
-
}
|
|
2441
|
-
</CardContent>
|
|
2442
|
-
|
|
2443
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
2444
|
-
<a Button [routerLink]="guestHomePath" variant="outline">
|
|
2445
|
-
{{ messages.verify.requestNewLink }}
|
|
2446
|
-
</a>
|
|
2447
|
-
<a Button [routerLink]="authenticatedHomePath" variant="default">
|
|
2448
|
-
{{ messages.verify.openDashboard }}
|
|
2449
|
-
</a>
|
|
2450
|
-
</CardFooter>
|
|
2451
|
-
</Card>
|
|
2452
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: AlertComponent, selector: "Alert", inputs: ["variant", "class"] }, { kind: "component", type: AlertDescriptionComponent, selector: "AlertDescription", inputs: ["class"] }, { kind: "component", type: AspectRatioComponent, selector: "AspectRatio", inputs: ["ratio", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: CardActionComponent, selector: "CardAction", inputs: ["class"] }, { kind: "component", type: CardComponent, selector: "Card", inputs: ["size", "class"] }, { kind: "component", type: CardContentComponent, selector: "CardContent", inputs: ["class"] }, { kind: "component", type: CardDescriptionComponent, selector: "CardDescription, p[CardDescription]", inputs: ["class"] }, { kind: "component", type: CardFooterComponent, selector: "CardFooter", inputs: ["class"] }, { kind: "component", type: CardHeaderComponent, selector: "CardHeader", inputs: ["class"] }, { kind: "component", type: CardTitleComponent, selector: "CardTitle, h3[CardTitle]", inputs: ["class"] }, { kind: "component", type: SpinnerComponent, selector: "Spinner", inputs: ["class", "decorative", "aria-label", "aria-labelledby"] }] });
|
|
2453
|
-
}
|
|
2454
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: AuthVerifyPage, decorators: [{
|
|
2455
|
-
type: Component,
|
|
2456
|
-
args: [{
|
|
2457
|
-
selector: 'edsis-auth-verify-page',
|
|
2458
|
-
imports: [
|
|
2459
|
-
RouterLink,
|
|
2460
|
-
AlertComponent,
|
|
2461
|
-
AlertDescriptionComponent,
|
|
2462
|
-
AspectRatioComponent,
|
|
2463
|
-
ButtonComponent,
|
|
2464
|
-
CardActionComponent,
|
|
2465
|
-
CardComponent,
|
|
2466
|
-
CardContentComponent,
|
|
2467
|
-
CardDescriptionComponent,
|
|
2468
|
-
CardFooterComponent,
|
|
2469
|
-
CardHeaderComponent,
|
|
2470
|
-
CardTitleComponent,
|
|
2471
|
-
SpinnerComponent,
|
|
2472
|
-
],
|
|
2473
|
-
host: {
|
|
2474
|
-
class: 'block',
|
|
2475
|
-
},
|
|
2476
|
-
template: `
|
|
2477
|
-
<Card
|
|
2478
|
-
class="w-full overflow-hidden rounded-none border-border/80 bg-card/95 shadow-2xl backdrop-blur-sm"
|
|
2479
|
-
>
|
|
2480
|
-
<CardHeader
|
|
2481
|
-
class="grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-x-4 gap-y-3 border-b border-border/60 bg-muted/15 pb-4 sm:pb-5"
|
|
2482
|
-
>
|
|
2483
|
-
<div class="w-16 shrink-0 sm:w-20">
|
|
2484
|
-
<AspectRatio [ratio]="3 / 2" class="overflow-hidden rounded-none bg-primary">
|
|
2485
|
-
<div
|
|
2486
|
-
class="flex h-full w-full items-center justify-center px-1 text-[1.25rem] leading-none tracking-[-0.08em] text-primary-foreground sm:text-[1.55rem]"
|
|
2487
|
-
style="font-family: 'Arial Black', Arial, sans-serif;"
|
|
2488
|
-
>
|
|
2489
|
-
{{ messages.brand.mark }}
|
|
2490
|
-
</div>
|
|
2491
|
-
</AspectRatio>
|
|
2492
|
-
</div>
|
|
2493
|
-
<div class="min-w-0 space-y-0.5 pt-0.5 sm:pt-1">
|
|
2494
|
-
<CardTitle class="text-xl leading-tight sm:text-2xl">{{
|
|
2495
|
-
messages.verify.title
|
|
2496
|
-
}}</CardTitle>
|
|
2497
|
-
<p CardDescription class="max-w-xl leading-6">
|
|
2498
|
-
{{ messages.verify.intro }}
|
|
2499
|
-
</p>
|
|
2500
|
-
</div>
|
|
2501
|
-
<CardAction
|
|
2502
|
-
class="col-start-3 row-span-1 mt-0! pt-0.5 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground sm:pt-1 sm:text-sm"
|
|
2503
|
-
>
|
|
2504
|
-
{{ messages.verify.badge }}
|
|
2505
|
-
</CardAction>
|
|
2506
|
-
</CardHeader>
|
|
2507
|
-
|
|
2508
|
-
<CardContent class="space-y-4 pt-6 sm:pt-7">
|
|
2509
|
-
<Alert
|
|
2510
|
-
[variant]="state() === 'error' ? 'destructive' : 'default'"
|
|
2511
|
-
class="bg-background/70 shadow-sm"
|
|
2512
|
-
>
|
|
2513
|
-
@if (state() === 'pending') {
|
|
2514
|
-
<Spinner class="mt-0.5 size-4" [attr.aria-label]="messages.verify.pendingAria" />
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2517
|
-
<AlertDescription>
|
|
2518
|
-
{{ message() }}
|
|
2519
|
-
</AlertDescription>
|
|
2520
|
-
</Alert>
|
|
2521
|
-
|
|
2522
|
-
@if (state() === 'error') {
|
|
2523
|
-
<Alert variant="destructive" class="shadow-sm">
|
|
2524
|
-
<AlertDescription>
|
|
2525
|
-
Pastikan Anda membuka link terbaru dari email dan token belum pernah dipakai
|
|
2526
|
-
sebelumnya.
|
|
2527
|
-
</AlertDescription>
|
|
2528
|
-
</Alert>
|
|
2529
|
-
}
|
|
2530
|
-
</CardContent>
|
|
2531
|
-
|
|
2532
|
-
<CardFooter class="flex flex-wrap gap-3 border-t border-border/60 bg-muted/10 pt-4 sm:pt-5">
|
|
2533
|
-
<a Button [routerLink]="guestHomePath" variant="outline">
|
|
2534
|
-
{{ messages.verify.requestNewLink }}
|
|
2535
|
-
</a>
|
|
2536
|
-
<a Button [routerLink]="authenticatedHomePath" variant="default">
|
|
2537
|
-
{{ messages.verify.openDashboard }}
|
|
2538
|
-
</a>
|
|
2539
|
-
</CardFooter>
|
|
2540
|
-
</Card>
|
|
2541
|
-
`,
|
|
2542
|
-
}]
|
|
2543
|
-
}], ctorParameters: () => [], propDecorators: { token: [{ type: i0.Input, args: [{ isSignal: true, alias: "token", required: false }] }] } });
|
|
2544
|
-
|
|
2545
|
-
const authRoutes = [
|
|
2546
|
-
{
|
|
2547
|
-
path: '',
|
|
2548
|
-
component: AuthShellPage,
|
|
2549
|
-
children: [
|
|
2550
|
-
{
|
|
2551
|
-
path: 'login',
|
|
2552
|
-
title: 'Login',
|
|
2553
|
-
canActivate: [guestOnlyGuard],
|
|
2554
|
-
component: AuthLoginPage,
|
|
2555
|
-
},
|
|
2556
|
-
{
|
|
2557
|
-
path: GOOGLE_OAUTH_CALLBACK_ROUTE_PATH,
|
|
2558
|
-
title: 'Google Sign-In',
|
|
2559
|
-
canActivate: [guestOnlyGuard],
|
|
2560
|
-
component: AuthGoogleCallbackPage,
|
|
2561
|
-
},
|
|
2562
|
-
{
|
|
2563
|
-
path: 'logout',
|
|
2564
|
-
title: 'Logout',
|
|
2565
|
-
component: AuthLogoutPage,
|
|
2566
|
-
},
|
|
2567
|
-
{
|
|
2568
|
-
path: 'verify',
|
|
2569
|
-
title: 'Verify',
|
|
2570
|
-
canActivate: [guestOnlyGuard],
|
|
2571
|
-
component: AuthVerifyPage,
|
|
2572
|
-
},
|
|
2573
|
-
],
|
|
2574
|
-
},
|
|
2575
|
-
];
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* Generated bundle index. Do not edit.
|
|
2579
|
-
*/
|
|
2580
|
-
|
|
2581
|
-
export { AuthGoogleCallbackPage, AuthLoginPage, AuthLogoutPage, AuthService, AuthShellPage, AuthVerifyPage, DEFAULT_EDSIS_AUTH_MESSAGES, EDSIS_AUTH_CONFIG, EDSIS_AUTH_MESSAGES, EDSIS_NATIVE_GOOGLE_AUTH_ADAPTER, EDSIS_SKIP_AUTH, GOOGLE_AUTH_GATEWAY_DEFAULT_HANDOFF_ENDPOINT, GOOGLE_AUTH_GATEWAY_DEFAULT_START_ENDPOINT, GOOGLE_GATEWAY_SESSION_STORAGE_KEY, GOOGLE_GATEWAY_SESSION_VERSION, GOOGLE_OAUTH_AUTHORIZE_URL, GOOGLE_OAUTH_CALLBACK_ROUTE_PATH, GOOGLE_OAUTH_STATE_STORAGE_KEY, GoogleGatewayAuthService, NativeGoogleAuthService, TauriNativeGoogleAuthAdapter, authRoutes, authenticatedGuard, buildGoogleAuthorizeUrl, clearGoogleGatewaySession, consumeGoogleGatewaySession, consumeGoogleOauthState, createGoogleOauthState, createGooglePkceChallenge, createGooglePkceVerifier, edsisAuthInterceptor, guestOnlyGuard, homeRedirectGuard, isNativeGoogleSignInResult, mergeEdsisAuthMessages, provideEdsisAuth, resolveEdsisAuthConfig, setAuthNotificationBadge, storeGoogleGatewaySession, storeGoogleOauthState };
|
|
2582
|
-
//# sourceMappingURL=edsis-angular-module-auth.mjs.map
|