@keycloakify/angular 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keycloakify/angular",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "peerDependencies": {
5
5
  "keycloakify": "^11.3.16",
6
6
  "@angular/core": "^18.0.0",
@@ -1,4 +1,11 @@
1
- import { createGetKcContextMock } from 'keycloakify/account/KcContext';
1
+ /* eslint-disable @angular-eslint/component-class-suffix */
2
+ import { Component, inject, OnInit, Type } from '@angular/core';
3
+ import { provideKeycloakifyAngular } from '@keycloakify/angular/login/providers/keycloakify-angular';
4
+ import { TemplateComponent } from '@keycloakify/angular/login/template';
5
+ import { getKcPage } from './KcPage';
6
+ import { getI18n } from './i18n';
7
+ import { KC_ACCOUNT_CONTEXT } from '@keycloakify/angular/login/tokens/kc-context';
8
+ import { createGetKcContextMock } from 'keycloakify/login/KcContext';
2
9
  import { kcEnvDefaults, themeNames } from '../kc.gen';
3
10
  import type { KcContextExtension, KcContextExtensionPerPage } from './KcContext';
4
11
 
@@ -16,3 +23,42 @@ export const { getKcContextMock } = createGetKcContextMock({
16
23
  overrides: {},
17
24
  overridesPerPage: {}
18
25
  });
26
+
27
+ type StoryContextLike = {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ globals: Record<string, any>;
30
+ };
31
+
32
+ export const decorators = (_: unknown, context: StoryContextLike) => ({
33
+ applicationConfig: {
34
+ providers: [
35
+ provideKeycloakifyAngular({
36
+ doUseDefaultCss: true,
37
+ classes: {},
38
+ kcContext: getKcContextMock({
39
+ pageId: context.globals['pageId'],
40
+ overrides: context.globals['overrides']
41
+ }),
42
+ getI18n: getI18n
43
+ })
44
+ ]
45
+ }
46
+ });
47
+
48
+ @Component({
49
+ selector: 'kc-page-story',
50
+ template: `@if (pageComponent) {
51
+ <kc-root [page]="pageComponent"></kc-root>
52
+ }`,
53
+ standalone: true,
54
+ imports: [TemplateComponent]
55
+ })
56
+ export class KcPageStory implements OnInit {
57
+ pageComponent: Type<unknown> | undefined;
58
+ kcContext = inject(KC_ACCOUNT_CONTEXT);
59
+ ngOnInit() {
60
+ getKcPage(this.kcContext.pageId).then(kcPage => {
61
+ this.pageComponent = kcPage.PageComponent;
62
+ });
63
+ }
64
+ }