@sneat/auth-ui 0.1.3 → 0.1.6

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.
Files changed (89) hide show
  1. package/esm2022/index.js +4 -0
  2. package/esm2022/index.js.map +1 -0
  3. package/esm2022/lib/components/auth-menu-item/auth-menu-item.component.js +82 -0
  4. package/esm2022/lib/components/auth-menu-item/auth-menu-item.component.js.map +1 -0
  5. package/esm2022/lib/components/index.js +4 -0
  6. package/esm2022/lib/components/index.js.map +1 -0
  7. package/esm2022/lib/components/user-auth-providers/user-auth-accounts.component.js +83 -0
  8. package/esm2022/lib/components/user-auth-providers/user-auth-accounts.component.js.map +1 -0
  9. package/esm2022/lib/components/user-auth-providers/user-auth-provider-status.js +118 -0
  10. package/esm2022/lib/components/user-auth-providers/user-auth-provider-status.js.map +1 -0
  11. package/esm2022/lib/components/user-required-fields/index.js +3 -0
  12. package/esm2022/lib/components/user-required-fields/index.js.map +1 -0
  13. package/esm2022/lib/components/user-required-fields/user-required-fields-modal.component.js +111 -0
  14. package/esm2022/lib/components/user-required-fields/user-required-fields-modal.component.js.map +1 -0
  15. package/esm2022/lib/components/user-required-fields/user-required-fields.service.js +29 -0
  16. package/esm2022/lib/components/user-required-fields/user-required-fields.service.js.map +1 -0
  17. package/esm2022/lib/pages/login-page/email-login-form/email-login-form.component.js +263 -0
  18. package/esm2022/lib/pages/login-page/email-login-form/email-login-form.component.js.map +1 -0
  19. package/esm2022/lib/pages/login-page/login-page.component.js +143 -0
  20. package/esm2022/lib/pages/login-page/login-page.component.js.map +1 -0
  21. package/esm2022/lib/pages/login-page/login-with-telegram.component.js +93 -0
  22. package/esm2022/lib/pages/login-page/login-with-telegram.component.js.map +1 -0
  23. package/esm2022/lib/pages/login-page/sneat-auth-with-telegram.service.js +31 -0
  24. package/esm2022/lib/pages/login-page/sneat-auth-with-telegram.service.js.map +1 -0
  25. package/esm2022/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.js +52 -0
  26. package/esm2022/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.js.map +1 -0
  27. package/esm2022/lib/pages/sneat-auth-routing.module.js +27 -0
  28. package/esm2022/lib/pages/sneat-auth-routing.module.js.map +1 -0
  29. package/esm2022/lib/pipes/person-names.pipe.js +35 -0
  30. package/esm2022/lib/pipes/person-names.pipe.js.map +1 -0
  31. package/esm2022/sneat-auth-ui.js +5 -0
  32. package/esm2022/sneat-auth-ui.js.map +1 -0
  33. package/lib/components/auth-menu-item/auth-menu-item.component.d.ts +24 -0
  34. package/lib/components/user-auth-providers/user-auth-accounts.component.d.ts +17 -0
  35. package/lib/components/user-auth-providers/user-auth-provider-status.d.ts +31 -0
  36. package/lib/components/user-required-fields/user-required-fields-modal.component.d.ts +31 -0
  37. package/lib/components/user-required-fields/user-required-fields.service.d.ts +7 -0
  38. package/lib/pages/login-page/email-login-form/email-login-form.component.d.ts +51 -0
  39. package/lib/pages/login-page/login-page.component.d.ts +30 -0
  40. package/lib/pages/login-page/login-with-telegram.component.d.ts +17 -0
  41. package/lib/pages/login-page/sneat-auth-with-telegram.service.d.ts +18 -0
  42. package/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.d.ts +13 -0
  43. package/lib/pages/sneat-auth-routing.module.d.ts +9 -0
  44. package/lib/pipes/person-names.pipe.d.ts +9 -0
  45. package/package.json +14 -2
  46. package/sneat-auth-ui.d.ts +5 -0
  47. package/tsconfig.lib.prod.tsbuildinfo +1 -0
  48. package/eslint.config.cjs +0 -7
  49. package/ng-package.json +0 -7
  50. package/project.json +0 -38
  51. package/src/lib/components/auth-menu-item/auth-menu-item.component.html +0 -59
  52. package/src/lib/components/auth-menu-item/auth-menu-item.component.spec.ts +0 -5
  53. package/src/lib/components/auth-menu-item/auth-menu-item.component.ts +0 -116
  54. package/src/lib/components/user-auth-providers/user-auth-accounts.component.html +0 -127
  55. package/src/lib/components/user-auth-providers/user-auth-accounts.component.spec.ts +0 -47
  56. package/src/lib/components/user-auth-providers/user-auth-accounts.component.ts +0 -109
  57. package/src/lib/components/user-auth-providers/user-auth-provider-status.html +0 -42
  58. package/src/lib/components/user-auth-providers/user-auth-provider-status.ts +0 -172
  59. package/src/lib/components/user-required-fields/user-required-fields-modal.component.html +0 -64
  60. package/src/lib/components/user-required-fields/user-required-fields-modal.component.spec.ts +0 -45
  61. package/src/lib/components/user-required-fields/user-required-fields-modal.component.ts +0 -141
  62. package/src/lib/components/user-required-fields/user-required-fields.service.spec.ts +0 -335
  63. package/src/lib/components/user-required-fields/user-required-fields.service.ts +0 -23
  64. package/src/lib/pages/login-page/email-login-form/email-login-form.component.html +0 -165
  65. package/src/lib/pages/login-page/email-login-form/email-login-form.component.spec.ts +0 -59
  66. package/src/lib/pages/login-page/email-login-form/email-login-form.component.ts +0 -356
  67. package/src/lib/pages/login-page/index.ts +0 -3
  68. package/src/lib/pages/login-page/login-page.component.html +0 -146
  69. package/src/lib/pages/login-page/login-page.component.spec.ts +0 -5
  70. package/src/lib/pages/login-page/login-page.component.ts +0 -209
  71. package/src/lib/pages/login-page/login-with-telegram.component.spec.ts +0 -42
  72. package/src/lib/pages/login-page/login-with-telegram.component.ts +0 -82
  73. package/src/lib/pages/login-page/sneat-auth-with-telegram.service.spec.ts +0 -31
  74. package/src/lib/pages/login-page/sneat-auth-with-telegram.service.ts +0 -56
  75. package/src/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.html +0 -35
  76. package/src/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.spec.ts +0 -43
  77. package/src/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.ts +0 -70
  78. package/src/lib/pages/sneat-auth-routing.module.ts +0 -25
  79. package/src/lib/pipes/person-names.pipe.spec.ts +0 -317
  80. package/src/lib/pipes/person-names.pipe.ts +0 -31
  81. package/src/test-setup.ts +0 -3
  82. package/tsconfig.json +0 -13
  83. package/tsconfig.lib.json +0 -19
  84. package/tsconfig.lib.prod.json +0 -7
  85. package/tsconfig.spec.json +0 -31
  86. package/vite.config.mts +0 -10
  87. /package/{src/index.ts → index.d.ts} +0 -0
  88. /package/{src/lib/components/index.ts → lib/components/index.d.ts} +0 -0
  89. /package/{src/lib/components/user-required-fields/index.ts → lib/components/user-required-fields/index.d.ts} +0 -0
@@ -0,0 +1,93 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import { Component, ElementRef, Input, inject } from '@angular/core';
3
+ import { SneatAuthWithTelegramService, } from './sneat-auth-with-telegram.service';
4
+ import * as i0 from "@angular/core";
5
+ let authWithTelegramService;
6
+ export class LoginWithTelegramComponent {
7
+ // TODO: Article about Telegram login
8
+ constructor() {
9
+ this.el = inject(ElementRef);
10
+ this.document = inject(DOCUMENT);
11
+ this.authWithTelegram = inject(SneatAuthWithTelegramService);
12
+ this.isUserAuthenticated = false;
13
+ this.botID = location.hostname.startsWith('local')
14
+ ? 'AlextDevBot'
15
+ : 'SneatBot';
16
+ this.size = 'large';
17
+ this.requestAccess = 'write';
18
+ this.userPic = true;
19
+ const authWithTelegram = this.authWithTelegram;
20
+ authWithTelegramService = authWithTelegram;
21
+ }
22
+ ngOnInit() {
23
+ const botID = this.botID;
24
+ if (botID) {
25
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
+ // @ts-ignore
27
+ window.onTelegramAuth = (tgAuthData) => {
28
+ // https://core.telegram.org/widgets/login#receiving-authorization-data
29
+ // After a successful authorization, the widget returns data
30
+ // by calling the callback function data-onauth with the JSON-object containing
31
+ // id, first_name, last_name, username, photo_url, auth_date and hash fields.
32
+ authWithTelegramService.loginWithTelegram(botID, tgAuthData, this.isUserAuthenticated);
33
+ };
34
+ const script = this.document.createElement('script');
35
+ script.src = 'https://telegram.org/js/telegram-widget.js?22';
36
+ script.setAttribute('data-telegram-login', botID);
37
+ script.setAttribute('data-request-access', this.requestAccess);
38
+ script.setAttribute('data-size', this.size);
39
+ if (!this.userPic) {
40
+ script.setAttribute('data-userpic', 'false');
41
+ }
42
+ // https://core.telegram.org/widgets/login#receiving-authorization-data
43
+ // After a successful authorization, the widget returns data
44
+ // by calling the callback function data-onauth with the JSON-object containing
45
+ // id, first_name, last_name, username, photo_url, auth_date and hash fields.
46
+ script.setAttribute('data-onauth', 'onTelegramAuth(user)');
47
+ this.el.nativeElement.appendChild(script);
48
+ }
49
+ }
50
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LoginWithTelegramComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
51
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.0", type: LoginWithTelegramComponent, isStandalone: true, selector: "sneat-login-with-telegram", inputs: { isUserAuthenticated: "isUserAuthenticated", botID: "botID", size: "size", requestAccess: "requestAccess", userPic: "userPic" }, providers: [SneatAuthWithTelegramService], ngImport: i0, template: `
52
+ <!--
53
+ <script
54
+ async
55
+ src="https://telegram.org/js/telegram-widget.js?22"
56
+ data-telegram-login="SneatBot"
57
+ data-size="large"
58
+ data-onauth="onTelegramAuth(user)"
59
+ data-request-access="write"
60
+ ></script>
61
+ -->
62
+ `, isInline: true }); }
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LoginWithTelegramComponent, decorators: [{
65
+ type: Component,
66
+ args: [{
67
+ providers: [SneatAuthWithTelegramService],
68
+ selector: 'sneat-login-with-telegram',
69
+ template: `
70
+ <!--
71
+ <script
72
+ async
73
+ src="https://telegram.org/js/telegram-widget.js?22"
74
+ data-telegram-login="SneatBot"
75
+ data-size="large"
76
+ data-onauth="onTelegramAuth(user)"
77
+ data-request-access="write"
78
+ ></script>
79
+ -->
80
+ `,
81
+ }]
82
+ }], ctorParameters: () => [], propDecorators: { isUserAuthenticated: [{
83
+ type: Input
84
+ }], botID: [{
85
+ type: Input
86
+ }], size: [{
87
+ type: Input
88
+ }], requestAccess: [{
89
+ type: Input
90
+ }], userPic: [{
91
+ type: Input
92
+ }] } });
93
+ //# sourceMappingURL=login-with-telegram.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-with-telegram.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/login-with-telegram.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAEL,4BAA4B,GAC7B,MAAM,oCAAoC,CAAC;;AAE5C,IAAI,uBAAqD,CAAC;AAkB1D,MAAM,OAAO,0BAA0B;IAKrC,qCAAqC;IACrC;QALiB,OAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;QACxB,aAAQ,GAAG,MAAM,CAAW,QAAQ,CAAC,CAAC;QAC9C,qBAAgB,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;QASjD,wBAAmB,GAAG,KAAK,CAAC;QAE5B,UAAK,GAAW,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;YACnE,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,UAAU,CAAC;QAEC,SAAI,GAAiC,OAAO,CAAC;QAC7C,kBAAa,GAAqB,OAAO,CAAC;QAC1C,YAAO,GAAG,IAAI,CAAC;QAb7B,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAE/C,uBAAuB,GAAG,gBAAgB,CAAC;IAC7C,CAAC;IAYD,QAAQ;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,KAAK,EAAE,CAAC;YACV,6DAA6D;YAC7D,aAAa;YACb,MAAM,CAAC,cAAc,GAAG,CAAC,UAA6B,EAAE,EAAE;gBACxD,uEAAuE;gBACvE,4DAA4D;gBAC5D,+EAA+E;gBAC/E,6EAA6E;gBAC7E,uBAAuB,CAAC,iBAAiB,CACvC,KAAK,EACL,UAAU,EACV,IAAI,CAAC,mBAAmB,CACzB,CAAC;YACJ,CAAC,CAAC;YAEF,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAErD,MAAM,CAAC,GAAG,GAAG,+CAA+C,CAAC;YAC7D,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM,CAAC,YAAY,CAAC,qBAAqB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/D,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YAC/C,CAAC;YACD,uEAAuE;YACvE,4DAA4D;YAC5D,+EAA+E;YAC/E,6EAA6E;YAC7E,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;YAC3D,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;8GAvDU,0BAA0B;kGAA1B,0BAA0B,kNAf1B,CAAC,4BAA4B,CAAC,0BAE/B;;;;;;;;;;;GAWT;;2FAEU,0BAA0B;kBAhBtC,SAAS;mBAAC;oBACT,SAAS,EAAE,CAAC,4BAA4B,CAAC;oBACzC,QAAQ,EAAE,2BAA2B;oBACrC,QAAQ,EAAE;;;;;;;;;;;GAWT;iBACF;;sBAaE,KAAK;;sBAEL,KAAK;;sBAIL,KAAK;;sBACL,KAAK;;sBACL,KAAK","sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { Component, ElementRef, Input, OnInit, inject } from '@angular/core';\nimport {\n ITelegramAuthData,\n SneatAuthWithTelegramService,\n} from './sneat-auth-with-telegram.service';\n\nlet authWithTelegramService: SneatAuthWithTelegramService;\n\n@Component({\n providers: [SneatAuthWithTelegramService],\n selector: 'sneat-login-with-telegram',\n template: `\n <!--\n\t\t\t\t<script\n\t\t\t\t\tasync\n\t\t\t\t\tsrc=\"https://telegram.org/js/telegram-widget.js?22\"\n\t\t\t\t\tdata-telegram-login=\"SneatBot\"\n\t\t\t\t\tdata-size=\"large\"\n\t\t\t\t\tdata-onauth=\"onTelegramAuth(user)\"\n\t\t\t\t\tdata-request-access=\"write\"\n\t\t\t\t></script>\n\t\t\t\t-->\n `,\n})\nexport class LoginWithTelegramComponent implements OnInit {\n private readonly el = inject(ElementRef);\n private readonly document = inject<Document>(DOCUMENT);\n readonly authWithTelegram = inject(SneatAuthWithTelegramService);\n\n // TODO: Article about Telegram login\n constructor() {\n const authWithTelegram = this.authWithTelegram;\n\n authWithTelegramService = authWithTelegram;\n }\n\n @Input() public isUserAuthenticated = false;\n\n @Input() public botID: string = location.hostname.startsWith('local')\n ? 'AlextDevBot'\n : 'SneatBot';\n\n @Input() public size: 'small' | 'medium' | 'large' = 'large';\n @Input() public requestAccess: 'write' | 'read' = 'write';\n @Input() public userPic = true;\n\n ngOnInit() {\n const botID = this.botID;\n if (botID) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.onTelegramAuth = (tgAuthData: ITelegramAuthData) => {\n // https://core.telegram.org/widgets/login#receiving-authorization-data\n // After a successful authorization, the widget returns data\n // by calling the callback function data-onauth with the JSON-object containing\n // id, first_name, last_name, username, photo_url, auth_date and hash fields.\n authWithTelegramService.loginWithTelegram(\n botID,\n tgAuthData,\n this.isUserAuthenticated,\n );\n };\n\n const script = this.document.createElement('script');\n\n script.src = 'https://telegram.org/js/telegram-widget.js?22';\n script.setAttribute('data-telegram-login', botID);\n script.setAttribute('data-request-access', this.requestAccess);\n script.setAttribute('data-size', this.size);\n if (!this.userPic) {\n script.setAttribute('data-userpic', 'false');\n }\n // https://core.telegram.org/widgets/login#receiving-authorization-data\n // After a successful authorization, the widget returns data\n // by calling the callback function data-onauth with the JSON-object containing\n // id, first_name, last_name, username, photo_url, auth_date and hash fields.\n script.setAttribute('data-onauth', 'onTelegramAuth(user)');\n this.el.nativeElement.appendChild(script);\n }\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { Injectable, inject } from '@angular/core';
2
+ import { SneatApiService } from '@sneat/api';
3
+ import { SneatAuthStateService } from '@sneat/auth-core';
4
+ import { ErrorLogger } from '@sneat/core';
5
+ import * as i0 from "@angular/core";
6
+ export class SneatAuthWithTelegramService {
7
+ constructor() {
8
+ this.errorLogger = inject(ErrorLogger);
9
+ this.apiService = inject(SneatApiService);
10
+ this.authService = inject(SneatAuthStateService);
11
+ }
12
+ loginWithTelegram(botID, tgAuthData, isUserAuthenticated) {
13
+ const postRequest = isUserAuthenticated
14
+ ? (endpoint, body) => this.apiService.post(endpoint, body)
15
+ : (endpoint, body) => this.apiService.postAsAnonymous(endpoint, body);
16
+ postRequest('auth/login-from-telegram-widget?botID=' + botID, tgAuthData).subscribe({
17
+ next: (response) => {
18
+ this.authService
19
+ .signInWithToken(response.token)
20
+ .catch(this.errorLogger.logErrorHandler('Failed to sign-in with custom token'));
21
+ },
22
+ error: this.errorLogger.logErrorHandler('signInWithTelegram() error:'),
23
+ });
24
+ }
25
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthWithTelegramService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
26
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthWithTelegramService }); }
27
+ }
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthWithTelegramService, decorators: [{
29
+ type: Injectable
30
+ }] });
31
+ //# sourceMappingURL=sneat-auth-with-telegram.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sneat-auth-with-telegram.service.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/login-page/sneat-auth-with-telegram.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;;AAkBxD,MAAM,OAAO,4BAA4B;IADzC;QAEmB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,eAAU,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;QACrC,gBAAW,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;KA+B9D;IA7BQ,iBAAiB,CACtB,KAAa,EACb,UAA6B,EAC7B,mBAA4B;QAE5B,MAAM,WAAW,GAGY,mBAAmB;YAC9C,CAAC,CAAC,CAAC,QAAgB,EAAE,IAAa,EAAE,EAAE,CAClC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAY,QAAQ,EAAE,IAAI,CAAC;YACnD,CAAC,CAAC,CAAC,QAAgB,EAAE,IAAa,EAAE,EAAE,CAClC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAY,QAAQ,EAAE,IAAI,CAAC,CAAC;QACjE,WAAW,CACT,wCAAwC,GAAG,KAAK,EAChD,UAAU,CACX,CAAC,SAAS,CAAC;YACV,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACjB,IAAI,CAAC,WAAW;qBACb,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;qBAC/B,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,qCAAqC,CACtC,CACF,CAAC;YACN,CAAC;YACD,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,6BAA6B,CAAC;SACvE,CAAC,CAAC;IACL,CAAC;8GAjCU,4BAA4B;kHAA5B,4BAA4B;;2FAA5B,4BAA4B;kBADxC,UAAU","sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { SneatApiService } from '@sneat/api';\nimport { SneatAuthStateService } from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { Observable } from 'rxjs';\n\nexport interface ITelegramAuthData {\n id: number;\n first_name: string;\n last_name: string;\n username?: string;\n photo_url?: string;\n auth_date: number;\n hash: string;\n}\n\ninterface IResponse {\n token: string;\n}\n\n@Injectable()\nexport class SneatAuthWithTelegramService {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly apiService = inject(SneatApiService);\n private readonly authService = inject(SneatAuthStateService);\n\n public loginWithTelegram(\n botID: string,\n tgAuthData: ITelegramAuthData,\n isUserAuthenticated: boolean,\n ): void {\n const postRequest: (\n endpoint: string,\n body: unknown,\n ) => Observable<IResponse> = isUserAuthenticated\n ? (endpoint: string, body: unknown) =>\n this.apiService.post<IResponse>(endpoint, body)\n : (endpoint: string, body: unknown) =>\n this.apiService.postAsAnonymous<IResponse>(endpoint, body);\n postRequest(\n 'auth/login-from-telegram-widget?botID=' + botID,\n tgAuthData,\n ).subscribe({\n next: (response) => {\n this.authService\n .signInWithToken(response.token)\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to sign-in with custom token',\n ),\n );\n },\n error: this.errorLogger.logErrorHandler('signInWithTelegram() error:'),\n });\n }\n}\n"]}
@@ -0,0 +1,52 @@
1
+ import { Component, inject } from '@angular/core';
2
+ import { IonButton, IonCard, IonContent, IonHeader, IonIcon, IonInput, IonItem, IonLabel, IonTitle, IonToolbar, NavController, } from '@ionic/angular/standalone';
3
+ import { SneatAuthStateService } from '@sneat/auth-core';
4
+ import { ErrorLogger } from '@sneat/core';
5
+ import * as i0 from "@angular/core";
6
+ export class SignInFromEmailLinkPageComponent {
7
+ constructor() {
8
+ this.errorLogger = inject(ErrorLogger);
9
+ this.authStateService = inject(SneatAuthStateService);
10
+ this.navController = inject(NavController);
11
+ this.emailFromStorage = false;
12
+ this.isSigning = false;
13
+ this.email = localStorage.getItem('emailForSignIn') || '';
14
+ this.emailFromStorage = !!this.email;
15
+ if (this.email) {
16
+ this.signIn();
17
+ }
18
+ }
19
+ signIn() {
20
+ this.isSigning = true;
21
+ this.authStateService.signInWithEmailLink(this.email).subscribe({
22
+ next: () => {
23
+ this.navController
24
+ .navigateRoot('/')
25
+ .catch(this.errorLogger.logErrorHandler('Failed to navigate to root page after signing in with email link'));
26
+ },
27
+ error: (err) => {
28
+ this.isSigning = false;
29
+ this.emailFromStorage = false;
30
+ this.errorLogger.logError(err, 'Failed to sign in with email link');
31
+ },
32
+ });
33
+ }
34
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SignInFromEmailLinkPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
35
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: SignInFromEmailLinkPageComponent, isStandalone: true, selector: "sneat-sign-in-from-email-link-page", ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"light\">\n <ion-title>Signing in with email link</ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <ion-card>\n @if (!emailFromStorage) {\n <p>\n Welcome to our app! For your safety please re-type your email address to\n sign-in.\n </p>\n }\n <ion-item>\n <ion-icon name=\"mail-outline\" slot=\"start\" />\n <ion-input\n label=\"Email\"\n [required]=\"true\"\n [readonly]=\"isSigning\"\n [value]=\"email\"\n [disabled]=\"emailFromStorage || isSigning\"\n />\n </ion-item>\n\n <ion-button [disabled]=\"isSigning\" (click)=\"signIn()\">\n <ion-label>\n @if (isSigning) {\n Signing in...\n } @else {\n Sign in\n }\n </ion-label>\n </ion-button>\n </ion-card>\n</ion-content>\n", dependencies: [{ kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }] }); }
36
+ }
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SignInFromEmailLinkPageComponent, decorators: [{
38
+ type: Component,
39
+ args: [{ selector: 'sneat-sign-in-from-email-link-page', imports: [
40
+ IonHeader,
41
+ IonToolbar,
42
+ IonTitle,
43
+ IonContent,
44
+ IonCard,
45
+ IonItem,
46
+ IonIcon,
47
+ IonInput,
48
+ IonButton,
49
+ IonLabel,
50
+ ], template: "<ion-header>\n <ion-toolbar color=\"light\">\n <ion-title>Signing in with email link</ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <ion-card>\n @if (!emailFromStorage) {\n <p>\n Welcome to our app! For your safety please re-type your email address to\n sign-in.\n </p>\n }\n <ion-item>\n <ion-icon name=\"mail-outline\" slot=\"start\" />\n <ion-input\n label=\"Email\"\n [required]=\"true\"\n [readonly]=\"isSigning\"\n [value]=\"email\"\n [disabled]=\"emailFromStorage || isSigning\"\n />\n </ion-item>\n\n <ion-button [disabled]=\"isSigning\" (click)=\"signIn()\">\n <ion-label>\n @if (isSigning) {\n Signing in...\n } @else {\n Sign in\n }\n </ion-label>\n </ion-button>\n </ion-card>\n</ion-content>\n" }]
51
+ }], ctorParameters: () => [] });
52
+ //# sourceMappingURL=sign-in-from-email-link-page.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-in-from-email-link-page.component.js","sourceRoot":"","sources":["../../../../../../../../libs/auth/ui/src/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.ts","../../../../../../../../libs/auth/ui/src/lib/pages/sign-in-from-email-link/sign-in-from-email-link-page.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,SAAS,EACT,OAAO,EACP,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;;AAkBxD,MAAM,OAAO,gCAAgC;IAS3C;QARiB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,qBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACjD,kBAAa,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAGvD,qBAAgB,GAAG,KAAK,CAAC;QACzB,cAAS,GAAG,KAAK,CAAC;QAGhB,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAC1D,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QACrC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAEM,MAAM;QACX,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC;YAC9D,IAAI,EAAE,GAAG,EAAE;gBACT,IAAI,CAAC,aAAa;qBACf,YAAY,CAAC,GAAG,CAAC;qBACjB,KAAK,CACJ,IAAI,CAAC,WAAW,CAAC,eAAe,CAC9B,kEAAkE,CACnE,CACF,CAAC;YACN,CAAC;YACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;gBAC9B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,mCAAmC,CAAC,CAAC;YACtE,CAAC;SACF,CAAC,CAAC;IACL,CAAC;8GAnCU,gCAAgC;kGAAhC,gCAAgC,8FCjC7C,s2BAmCA,4CDdI,SAAS,oGACT,UAAU,mFACV,QAAQ,iFACR,UAAU,wKACV,OAAO,yLACP,OAAO,0NACP,OAAO,2JACP,QAAQ,8eACR,SAAS,oPACT,QAAQ;;2FAGC,gCAAgC;kBAhB5C,SAAS;+BACE,oCAAoC,WAErC;wBACP,SAAS;wBACT,UAAU;wBACV,QAAQ;wBACR,UAAU;wBACV,OAAO;wBACP,OAAO;wBACP,OAAO;wBACP,QAAQ;wBACR,SAAS;wBACT,QAAQ;qBACT","sourcesContent":["import { Component, inject } from '@angular/core';\nimport {\n IonButton,\n IonCard,\n IonContent,\n IonHeader,\n IonIcon,\n IonInput,\n IonItem,\n IonLabel,\n IonTitle,\n IonToolbar,\n NavController,\n} from '@ionic/angular/standalone';\nimport { SneatAuthStateService } from '@sneat/auth-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\n\n@Component({\n selector: 'sneat-sign-in-from-email-link-page',\n templateUrl: 'sign-in-from-email-link-page.component.html',\n imports: [\n IonHeader,\n IonToolbar,\n IonTitle,\n IonContent,\n IonCard,\n IonItem,\n IonIcon,\n IonInput,\n IonButton,\n IonLabel,\n ],\n})\nexport class SignInFromEmailLinkPageComponent {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly authStateService = inject(SneatAuthStateService);\n private readonly navController = inject(NavController);\n\n email: string;\n emailFromStorage = false;\n isSigning = false;\n\n constructor() {\n this.email = localStorage.getItem('emailForSignIn') || '';\n this.emailFromStorage = !!this.email;\n if (this.email) {\n this.signIn();\n }\n }\n\n public signIn(): void {\n this.isSigning = true;\n this.authStateService.signInWithEmailLink(this.email).subscribe({\n next: () => {\n this.navController\n .navigateRoot('/')\n .catch(\n this.errorLogger.logErrorHandler(\n 'Failed to navigate to root page after signing in with email link',\n ),\n );\n },\n error: (err) => {\n this.isSigning = false;\n this.emailFromStorage = false;\n this.errorLogger.logError(err, 'Failed to sign in with email link');\n },\n });\n }\n}\n","<ion-header>\n <ion-toolbar color=\"light\">\n <ion-title>Signing in with email link</ion-title>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <ion-card>\n @if (!emailFromStorage) {\n <p>\n Welcome to our app! For your safety please re-type your email address to\n sign-in.\n </p>\n }\n <ion-item>\n <ion-icon name=\"mail-outline\" slot=\"start\" />\n <ion-input\n label=\"Email\"\n [required]=\"true\"\n [readonly]=\"isSigning\"\n [value]=\"email\"\n [disabled]=\"emailFromStorage || isSigning\"\n />\n </ion-item>\n\n <ion-button [disabled]=\"isSigning\" (click)=\"signIn()\">\n <ion-label>\n @if (isSigning) {\n Signing in...\n } @else {\n Sign in\n }\n </ion-label>\n </ion-button>\n </ion-card>\n</ion-content>\n"]}
@@ -0,0 +1,27 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule } from '@angular/router';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/router";
5
+ export const authRoutes = [
6
+ {
7
+ path: 'login',
8
+ loadComponent: () => import('./login-page/login-page.component').then((m) => m.LoginPageComponent),
9
+ },
10
+ {
11
+ path: 'sign-in-from-email-link',
12
+ loadComponent: () => import('./sign-in-from-email-link/sign-in-from-email-link-page.component').then((m) => m.SignInFromEmailLinkPageComponent),
13
+ },
14
+ ];
15
+ export class SneatAuthRoutingModule {
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
17
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] }); }
18
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthRoutingModule, imports: [RouterModule.forChild(authRoutes), RouterModule] }); }
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: SneatAuthRoutingModule, decorators: [{
21
+ type: NgModule,
22
+ args: [{
23
+ imports: [RouterModule.forChild(authRoutes)],
24
+ exports: [RouterModule],
25
+ }]
26
+ }] });
27
+ //# sourceMappingURL=sneat-auth-routing.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sneat-auth-routing.module.js","sourceRoot":"","sources":["../../../../../../../libs/auth/ui/src/lib/pages/sneat-auth-routing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAU,MAAM,iBAAiB,CAAC;;;AAEvD,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC;QACE,IAAI,EAAE,OAAO;QACb,aAAa,EAAE,GAAG,EAAE,CAClB,MAAM,CAAC,mCAAmC,CAAC,CAAC,IAAI,CAC9C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAC5B;KACJ;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,aAAa,EAAE,GAAG,EAAE,CAClB,MAAM,CAAC,kEAAkE,CAAC,CAAC,IAAI,CAC7E,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gCAAgC,CAC1C;KACJ;CACF,CAAC;AAMF,MAAM,OAAO,sBAAsB;8GAAtB,sBAAsB;+GAAtB,sBAAsB,wCAFvB,YAAY;+GAEX,sBAAsB,YAHvB,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,EACjC,YAAY;;2FAEX,sBAAsB;kBAJlC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;oBAC5C,OAAO,EAAE,CAAC,YAAY,CAAC;iBACxB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\n\nexport const authRoutes: Routes = [\n {\n path: 'login',\n loadComponent: () =>\n import('./login-page/login-page.component').then(\n (m) => m.LoginPageComponent,\n ),\n },\n {\n path: 'sign-in-from-email-link',\n loadComponent: () =>\n import('./sign-in-from-email-link/sign-in-from-email-link-page.component').then(\n (m) => m.SignInFromEmailLinkPageComponent,\n ),\n },\n];\n\n@NgModule({\n imports: [RouterModule.forChild(authRoutes)],\n exports: [RouterModule],\n})\nexport class SneatAuthRoutingModule {}\n"]}
@@ -0,0 +1,35 @@
1
+ import { Pipe } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class PersonNamesPipe {
4
+ transform(names) {
5
+ if (!names) {
6
+ return undefined;
7
+ }
8
+ if (names.fullName) {
9
+ return names.fullName;
10
+ }
11
+ if (!!names.firstName && !!names.lastName) {
12
+ return `${names.firstName} ${names.lastName}`;
13
+ }
14
+ return JSON.stringify(names);
15
+ }
16
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: PersonNamesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
17
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.0", ngImport: i0, type: PersonNamesPipe, isStandalone: true, name: "personNames" }); }
18
+ }
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: PersonNamesPipe, decorators: [{
20
+ type: Pipe,
21
+ args: [{ name: 'personNames' }]
22
+ }] });
23
+ export function personNames(name) {
24
+ if (!name) {
25
+ return undefined;
26
+ }
27
+ if (name.fullName) {
28
+ return name.fullName;
29
+ }
30
+ if (name.firstName && name.lastName && !name.nickName && !name.middleName) {
31
+ return `${name.firstName} ${name.lastName}`;
32
+ }
33
+ return name.nickName || name.firstName || name.lastName || name.middleName;
34
+ }
35
+ //# sourceMappingURL=person-names.pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-names.pipe.js","sourceRoot":"","sources":["../../../../../../../libs/auth/ui/src/lib/pipes/person-names.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;;AAIpD,MAAM,OAAO,eAAe;IAC1B,SAAS,CAAC,KAAoB;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,QAAQ,CAAC;QACxB,CAAC;QACD,IAAI,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;8GAZU,eAAe;4GAAf,eAAe;;2FAAf,eAAe;kBAD3B,IAAI;mBAAC,EAAE,IAAI,EAAE,aAAa,EAAE;;AAgB7B,MAAM,UAAU,WAAW,CAAC,IAAmB;IAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAC1E,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC;AAC7E,CAAC","sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\nimport { IPersonNames } from '@sneat/auth-models';\n\n@Pipe({ name: 'personNames' })\nexport class PersonNamesPipe implements PipeTransform {\n transform(names?: IPersonNames): string | undefined {\n if (!names) {\n return undefined;\n }\n if (names.fullName) {\n return names.fullName;\n }\n if (!!names.firstName && !!names.lastName) {\n return `${names.firstName} ${names.lastName}`;\n }\n return JSON.stringify(names);\n }\n}\n\nexport function personNames(name?: IPersonNames): string | undefined {\n if (!name) {\n return undefined;\n }\n if (name.fullName) {\n return name.fullName;\n }\n if (name.firstName && name.lastName && !name.nickName && !name.middleName) {\n return `${name.firstName} ${name.lastName}`;\n }\n return name.nickName || name.firstName || name.lastName || name.middleName;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=sneat-auth-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sneat-auth-ui.js","sourceRoot":"","sources":["../../../../../libs/auth/ui/src/sneat-auth-ui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
@@ -0,0 +1,24 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { ISneatAuthState, ISneatUserState } from '@sneat/auth-core';
3
+ import { Subject } from 'rxjs';
4
+ import { personNames } from '../../pipes/person-names.pipe';
5
+ import * as i0 from "@angular/core";
6
+ export declare class AuthMenuItemComponent implements OnDestroy {
7
+ private readonly errorLogger;
8
+ private readonly navCtrl;
9
+ private readonly authStateService;
10
+ private readonly menuController;
11
+ protected readonly $user: import("@angular/core").WritableSignal<ISneatUserState | undefined>;
12
+ protected $err: import("@angular/core").WritableSignal<unknown>;
13
+ protected readonly $authState: import("@angular/core").WritableSignal<ISneatAuthState | undefined>;
14
+ protected readonly $authStatus: import("@angular/core").Signal<"authenticating" | "authenticated" | "notAuthenticated" | undefined>;
15
+ protected readonly $isAuthenticating: import("@angular/core").Signal<boolean>;
16
+ protected readonly $destroyed: Subject<void>;
17
+ ngOnDestroy(): void;
18
+ constructor();
19
+ closeMenu(): void;
20
+ logout(event: Event): boolean;
21
+ protected readonly personName: typeof personNames;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthMenuItemComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthMenuItemComponent, "sneat-auth-menu-item", never, {}, {}, never, never, true, never>;
24
+ }
@@ -0,0 +1,17 @@
1
+ import { AuthProviderID } from '@sneat/auth-core';
2
+ import { IUserRecord } from '@sneat/auth-models';
3
+ import { SneatBaseComponent } from '@sneat/ui';
4
+ import * as i0 from "@angular/core";
5
+ export declare class UserAuthAccountsComponent extends SneatBaseComponent {
6
+ private readonly sneatUserService;
7
+ private readonly sneatApiService;
8
+ protected readonly $userRecord: import("@angular/core").WritableSignal<IUserRecord | undefined>;
9
+ protected readonly signingInWith: import("@angular/core").WritableSignal<AuthProviderID | undefined>;
10
+ constructor();
11
+ protected hasAccount(provider: 'telegram' | 'viber' | 'whatsapp'): boolean;
12
+ protected getAccountID(provider: 'telegram'): string;
13
+ protected disconnecting?: 'telegram' | 'viber' | 'whatsapp';
14
+ protected disconnect(provider: 'telegram'): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserAuthAccountsComponent, never>;
16
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserAuthAccountsComponent, "sneat-user-auth-accounts", never, {}, {}, never, never, true, never>;
17
+ }
@@ -0,0 +1,31 @@
1
+ import { EventEmitter, OnDestroy } from '@angular/core';
2
+ import { AuthProviderID, ISneatAuthUser } from '@sneat/auth-core';
3
+ import * as i0 from "@angular/core";
4
+ type IonicColor = 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark';
5
+ interface provider {
6
+ readonly id: AuthProviderID;
7
+ readonly title: string;
8
+ readonly icon: string;
9
+ readonly color: IonicColor;
10
+ }
11
+ export declare class UserAuthAProviderStatusComponent implements OnDestroy {
12
+ private readonly errorLogger;
13
+ private readonly authStateService;
14
+ private readonly $destroyed;
15
+ providerID: import("@angular/core").InputSignal<AuthProviderID>;
16
+ protected readonly provider: import("@angular/core").Signal<provider>;
17
+ readonly signingInWith: import("@angular/core").InputSignal<AuthProviderID | undefined>;
18
+ readonly signingInWithChange: EventEmitter<AuthProviderID | undefined>;
19
+ protected readonly currentUser: import("@angular/core").WritableSignal<ISneatAuthUser | null | undefined>;
20
+ constructor();
21
+ protected readonly isSigningIn: import("@angular/core").Signal<boolean>;
22
+ protected readonly isDisabled: import("@angular/core").Signal<boolean>;
23
+ readonly authProviderUserInfo: import("@angular/core").Signal<import("@angular/fire/auth").UserInfo | undefined>;
24
+ readonly isConnected: import("@angular/core").Signal<boolean>;
25
+ protected connect(): void;
26
+ protected disconnect(): void;
27
+ ngOnDestroy(): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserAuthAProviderStatusComponent, never>;
29
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserAuthAProviderStatusComponent, "sneat-user-auth-provider-status", never, { "providerID": { "alias": "providerID"; "required": true; "isSignal": true; }; "signingInWith": { "alias": "signingInWith"; "required": true; "isSignal": true; }; }, { "signingInWithChange": "signingInWithChange"; }, never, never, true, never>;
30
+ }
31
+ export {};
@@ -0,0 +1,31 @@
1
+ import { FormControl, FormGroup } from '@angular/forms';
2
+ import { ISneatUserState } from '@sneat/auth-core';
3
+ import { ISelectItem } from '@sneat/ui';
4
+ import { ISpaceContext } from '@sneat/space-models';
5
+ import { SneatBaseComponent } from '@sneat/ui';
6
+ import * as i0 from "@angular/core";
7
+ export declare class UserRequiredFieldsModalComponent extends SneatBaseComponent {
8
+ private readonly modalController;
9
+ private readonly userRecordService;
10
+ private readonly sneatUserService;
11
+ space: ISpaceContext;
12
+ protected readonly genders: ISelectItem[];
13
+ protected readonly ageGroups: ISelectItem[];
14
+ protected readonly firstName: FormControl<string | null>;
15
+ protected readonly lastName: FormControl<string | null>;
16
+ protected readonly gender: FormControl<string | null>;
17
+ protected readonly ageGroup: FormControl<string | null>;
18
+ protected readonly form: FormGroup<{
19
+ firstName: FormControl<string | null>;
20
+ lastName: FormControl<string | null>;
21
+ gender: FormControl<string | null>;
22
+ ageGroup: FormControl<string | null>;
23
+ }>;
24
+ protected submitting: boolean;
25
+ protected userState?: ISneatUserState;
26
+ constructor();
27
+ protected save(): void;
28
+ protected close(): void;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserRequiredFieldsModalComponent, never>;
30
+ static ɵcmp: i0.ɵɵComponentDeclaration<UserRequiredFieldsModalComponent, "sneat-user-required-fields-form", never, { "space": { "alias": "space"; "required": true; }; }, {}, never, never, true, never>;
31
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class UserRequiredFieldsService {
3
+ private readonly modalController;
4
+ open(): Promise<boolean>;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserRequiredFieldsService, never>;
6
+ static ɵprov: i0.ɵɵInjectableDeclaration<UserRequiredFieldsService>;
7
+ }
@@ -0,0 +1,51 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { Auth } from '@angular/fire/auth';
3
+ import { IonInput } from '@ionic/angular/standalone';
4
+ import { IAppInfo } from '@sneat/core';
5
+ import { UserCredential } from 'firebase/auth';
6
+ import * as i0 from "@angular/core";
7
+ export type EmailFormSigningWith = 'email' | 'emailLink' | 'resetPassword';
8
+ export declare class EmailLoginFormComponent {
9
+ readonly appInfo: IAppInfo;
10
+ private readonly analyticsService;
11
+ private readonly errorLogger;
12
+ private readonly toastController;
13
+ private readonly afAuth;
14
+ private readonly randomIdService;
15
+ private readonly sneatApiService;
16
+ private readonly userRecordService;
17
+ protected sign: 'in' | 'up';
18
+ protected email: string;
19
+ protected password: string;
20
+ protected firstName: string;
21
+ protected lastName: string;
22
+ protected spaceTitle: string;
23
+ protected wrongPassword: boolean;
24
+ protected signingWith?: EmailFormSigningWith;
25
+ readonly signingWithChange: EventEmitter<EmailFormSigningWith | undefined>;
26
+ readonly loggedIn: EventEmitter<UserCredential>;
27
+ emailInput?: IonInput;
28
+ spaceTitleInput?: IonInput;
29
+ readonly setFocusToInput: (input?: IonInput | import("@ionic/angular/standalone").IonTextarea, delay?: number) => void;
30
+ constructor();
31
+ get validEmail(): boolean;
32
+ getFirebaseAuth(): Auth;
33
+ signUp(): Promise<void>;
34
+ keyupEnter(): void;
35
+ signIn(): void;
36
+ private saveEmailForReuse;
37
+ sendSignInLink(): void;
38
+ private showToast;
39
+ resetPassword(): void;
40
+ private sendVerificationEmail;
41
+ private onLoggedIn;
42
+ private errorHandler;
43
+ private handleError;
44
+ private setSigningWith;
45
+ signChanged(): void;
46
+ ionViewDidEnter(): void;
47
+ private setFocusToEmail;
48
+ private setFocusToSpaceTitle;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<EmailLoginFormComponent, never>;
50
+ static ɵcmp: i0.ɵɵComponentDeclaration<EmailLoginFormComponent, "sneat-email-login-form", never, {}, { "signingWithChange": "signingWithChange"; "loggedIn": "loggedIn"; }, never, never, true, never>;
51
+ }
@@ -0,0 +1,30 @@
1
+ import { AuthProviderID } from '@sneat/auth-core';
2
+ import { SneatBaseComponent } from '@sneat/ui';
3
+ import { EmailFormSigningWith } from './email-login-form/email-login-form.component';
4
+ import { UserCredential } from 'firebase/auth';
5
+ import * as i0 from "@angular/core";
6
+ type Action = 'join' | 'refuse';
7
+ export declare class LoginPageComponent extends SneatBaseComponent {
8
+ private readonly analyticsService;
9
+ private readonly route;
10
+ private readonly navController;
11
+ private readonly userService;
12
+ private readonly authStateService;
13
+ private appInfo;
14
+ private readonly loginEventsHandler;
15
+ protected readonly signingWith: import("@angular/core").WritableSignal<AuthProviderID | undefined>;
16
+ private readonly redirectTo?;
17
+ protected readonly to?: string;
18
+ protected readonly action?: Action;
19
+ protected readonly isNativePlatform: boolean;
20
+ protected readonly appTitle: string;
21
+ constructor();
22
+ protected onEmailFormStatusChanged(signingWith?: EmailFormSigningWith): void;
23
+ protected loginWith(provider: AuthProviderID): Promise<void>;
24
+ protected onLoggedIn(userCredential: UserCredential): void;
25
+ private errorHandler;
26
+ private handleError;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoginPageComponent, never>;
28
+ static ɵcmp: i0.ɵɵComponentDeclaration<LoginPageComponent, "sneat-login", never, {}, {}, never, never, true, never>;
29
+ }
30
+ export {};
@@ -0,0 +1,17 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { SneatAuthWithTelegramService } from './sneat-auth-with-telegram.service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LoginWithTelegramComponent implements OnInit {
5
+ private readonly el;
6
+ private readonly document;
7
+ readonly authWithTelegram: SneatAuthWithTelegramService;
8
+ constructor();
9
+ isUserAuthenticated: boolean;
10
+ botID: string;
11
+ size: 'small' | 'medium' | 'large';
12
+ requestAccess: 'write' | 'read';
13
+ userPic: boolean;
14
+ ngOnInit(): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoginWithTelegramComponent, never>;
16
+ static ɵcmp: i0.ɵɵComponentDeclaration<LoginWithTelegramComponent, "sneat-login-with-telegram", never, { "isUserAuthenticated": { "alias": "isUserAuthenticated"; "required": false; }; "botID": { "alias": "botID"; "required": false; }; "size": { "alias": "size"; "required": false; }; "requestAccess": { "alias": "requestAccess"; "required": false; }; "userPic": { "alias": "userPic"; "required": false; }; }, {}, never, never, true, never>;
17
+ }
@@ -0,0 +1,18 @@
1
+ import * as i0 from "@angular/core";
2
+ export interface ITelegramAuthData {
3
+ id: number;
4
+ first_name: string;
5
+ last_name: string;
6
+ username?: string;
7
+ photo_url?: string;
8
+ auth_date: number;
9
+ hash: string;
10
+ }
11
+ export declare class SneatAuthWithTelegramService {
12
+ private readonly errorLogger;
13
+ private readonly apiService;
14
+ private readonly authService;
15
+ loginWithTelegram(botID: string, tgAuthData: ITelegramAuthData, isUserAuthenticated: boolean): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<SneatAuthWithTelegramService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<SneatAuthWithTelegramService>;
18
+ }
@@ -0,0 +1,13 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class SignInFromEmailLinkPageComponent {
3
+ private readonly errorLogger;
4
+ private readonly authStateService;
5
+ private readonly navController;
6
+ email: string;
7
+ emailFromStorage: boolean;
8
+ isSigning: boolean;
9
+ constructor();
10
+ signIn(): void;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<SignInFromEmailLinkPageComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<SignInFromEmailLinkPageComponent, "sneat-sign-in-from-email-link-page", never, {}, {}, never, never, true, never>;
13
+ }
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+ import * as i0 from "@angular/core";
3
+ import * as i1 from "@angular/router";
4
+ export declare const authRoutes: Routes;
5
+ export declare class SneatAuthRoutingModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<SneatAuthRoutingModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SneatAuthRoutingModule, never, [typeof i1.RouterModule], [typeof i1.RouterModule]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<SneatAuthRoutingModule>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import { PipeTransform } from '@angular/core';
2
+ import { IPersonNames } from '@sneat/auth-models';
3
+ import * as i0 from "@angular/core";
4
+ export declare class PersonNamesPipe implements PipeTransform {
5
+ transform(names?: IPersonNames): string | undefined;
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<PersonNamesPipe, never>;
7
+ static ɵpipe: i0.ɵɵPipeDeclaration<PersonNamesPipe, "personNames", true>;
8
+ }
9
+ export declare function personNames(name?: IPersonNames): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/auth-ui",
3
- "version": "0.1.3",
3
+ "version": "0.1.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -15,5 +15,17 @@
15
15
  "dependencies": {
16
16
  "tslib": "2.8.1"
17
17
  },
18
- "type": "module"
18
+ "type": "module",
19
+ "module": "esm2022/sneat-auth-ui.js",
20
+ "typings": "sneat-auth-ui.d.ts",
21
+ "exports": {
22
+ "./package.json": {
23
+ "default": "./package.json"
24
+ },
25
+ ".": {
26
+ "types": "./sneat-auth-ui.d.ts",
27
+ "default": "./esm2022/sneat-auth-ui.js"
28
+ }
29
+ },
30
+ "sideEffects": false
19
31
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@sneat/auth-ui" />
5
+ export * from './index';