@sneat/auth-ui 0.27.41 → 0.27.43

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-buttons.component.js","sourceRoot":"","sources":["../../../../../../libs/auth/ui/src/provider-buttons/provider-buttons.component.ts","../../../../../../libs/auth/ui/src/provider-buttons/provider-buttons.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,MAAM,EACN,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,gBAAgB,CAAC;;AAExB,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY;IACZ,WAAW;IACX,eAAe;IACf,cAAc;IACd,YAAY;CACJ,CAAC;AAMX,MAAM,SAAS,GAAG;IAChB;QACE,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE,SAAS;KACxB;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,SAAS;KACxB;IACD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,sBAAsB;QAC7B,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,YAAY,EAAE,WAAW;KAC1B;IACD;QACE,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,SAAS;QAChB,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C,KAAK,CAAC;IACrB,CAAC;IACS,MAAM,CAAC,QAAyB;QACxC,IACE,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;YAE9C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;8GA9BU,4BAA4B;kGAA5B,4BAA4B,2oBCnFzC,0rCAsCA,gFDwCY,MAAM,kTAAE,OAAO,2JAAE,OAAO,0NAAE,QAAQ,6FAAE,OAAO,yFAAE,MAAM,oDAAE,UAAU;;2FAK9D,4BAA4B;kBAPxC,SAAS;+BACE,6BAA6B,WAC9B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,mBAGzD,uBAAuB,CAAC,MAAM","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n output,\n} from '@angular/core';\nimport {\n IonCol,\n IonIcon,\n IonItem,\n IonLabel,\n IonList,\n IonRow,\n IonSpinner,\n} from '@ionic/angular';\nimport {\n logoApple,\n logoFacebook,\n logoGithub,\n logoGoogle,\n logoWindows,\n} from 'ionicons/icons';\n\n/** Fixed display order, independent of the caller's visibility allowlist order. */\nexport const OAUTH_PROVIDER_IDS = [\n 'google.com',\n 'apple.com',\n 'microsoft.com',\n 'facebook.com',\n 'github.com',\n] as const;\nexport type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];\n/** Plain text only; absent, blank or over-160-character labels use English defaults. */\nexport type OAuthProviderLabels = Readonly<\n Partial<Record<OAuthProviderId, string>>\n>;\nconst providers = [\n {\n id: 'google.com',\n label: 'Login with Google',\n icon: logoGoogle,\n color: 'danger',\n spinnerColor: undefined,\n },\n {\n id: 'apple.com',\n label: 'Login with Apple',\n icon: logoApple,\n color: 'dark',\n spinnerColor: undefined,\n },\n {\n id: 'microsoft.com',\n label: 'Login with Microsoft',\n icon: logoWindows,\n color: 'secondary',\n spinnerColor: 'secondary',\n },\n {\n id: 'facebook.com',\n label: 'Login with Facebook',\n icon: logoFacebook,\n color: 'primary',\n spinnerColor: 'primary',\n },\n {\n id: 'github.com',\n label: 'Login with GitHub',\n icon: logoGithub,\n color: 'tertiary',\n spinnerColor: 'tertiary',\n },\n] as const;\n\n/** Presentation only: the host owns authentication, readiness, navigation and errors. */\n@Component({\n selector: 'sneat-auth-provider-buttons',\n imports: [IonCol, IonIcon, IonItem, IonLabel, IonList, IonRow, IonSpinner],\n templateUrl: './provider-buttons.component.html',\n styles: ':host { display: block; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AuthProviderButtonsComponent {\n readonly providers = input<readonly OAuthProviderId[] | undefined>();\n readonly busy = input<OAuthProviderId | undefined>();\n readonly disabled = input(false);\n readonly labels = input<OAuthProviderLabels>({});\n readonly providerSelected = output<OAuthProviderId>();\n readonly rows = computed(() =>\n [providers.slice(0, 2), providers.slice(2, 4), providers.slice(4)]\n .map((row) =>\n row.filter(\n (provider) => this.providers()?.includes(provider.id) ?? true,\n ),\n )\n .filter((row) => row.length),\n );\n protected label(provider: (typeof providers)[number]): string {\n const label = this.labels()[provider.id];\n return typeof label === 'string' &&\n label.trim().length &&\n label.length <= 160\n ? label.trim()\n : provider.label;\n }\n protected select(provider: OAuthProviderId): void {\n if (\n !this.disabled() &&\n !this.busy() &&\n (this.providers()?.includes(provider) ?? true)\n )\n this.providerSelected.emit(provider);\n }\n}\n","@for (row of rows(); track $index) {\n <ion-row>\n @for (provider of row; track provider.id) {\n <ion-col size=\"12\" size-md=\"6\">\n <ion-list lines=\"none\">\n <ion-item\n [button]=\"true\"\n [detail]=\"false\"\n type=\"button\"\n [disabled]=\"disabled() || !!busy()\"\n [attr.aria-busy]=\"busy() === provider.id ? 'true' : null\"\n [attr.data-provider]=\"provider.id\"\n (click)=\"select(provider.id)\"\n >\n @if (busy() === provider.id) {\n <ion-spinner\n slot=\"start\"\n name=\"lines-small\"\n [color]=\"provider.spinnerColor\"\n aria-hidden=\"true\"\n />\n } @else {\n <ion-icon\n slot=\"start\"\n [color]=\"provider.color\"\n [icon]=\"provider.icon\"\n aria-hidden=\"true\"\n />\n }\n <ion-label [color]=\"provider.color\">{{\n label(provider)\n }}</ion-label>\n </ion-item>\n </ion-list>\n </ion-col>\n }\n </ion-row>\n}\n"]}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=sneat-auth-ui-provider-buttons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sneat-auth-ui-provider-buttons.js","sourceRoot":"","sources":["../../../../../../libs/auth/ui/src/provider-buttons/sneat-auth-ui-provider-buttons.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
package/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './lib/pages/sneat-auth-routing.module';
2
2
  export * from './lib/pages/login-page/auth-panel.component';
3
3
  export type { AuthPanelInitialMode } from './lib/pages/login-page/email-login-form/email-login-form.component';
4
4
  export * from './lib/pages/login-page/telegram-login-config';
5
+ export { LoginWithTelegramComponent } from './lib/pages/login-page/login-with-telegram.component';
5
6
  export * from './lib/components';
6
7
  export * from './lib/pipes/person-names.pipe';
7
8
  export * from './lib/sso';
@@ -17,6 +17,8 @@ export declare class AuthPanelComponent implements OnInit {
17
17
  readonly showCredentials: import("@angular/core").InputSignal<boolean>;
18
18
  readonly accountReadyChange: EventEmitter<AuthPanelAccountReadyChange>;
19
19
  protected readonly signingWith: import("@angular/core").WritableSignal<EmailFormSigningWith | AuthProviderID | undefined>;
20
+ protected readonly oauthProviders: ("apple.com" | "google.com" | "microsoft.com" | "facebook.com" | "github.com")[];
21
+ protected readonly oauthSigningWith: import("@angular/core").Signal<"apple.com" | "google.com" | "microsoft.com" | "facebook.com" | "github.com" | undefined>;
20
22
  protected readonly authRecoveryNeeded: import("@angular/core").WritableSignal<boolean>;
21
23
  /**
22
24
  * Set when sign-in hit an email that already has an account: names the
@@ -15,6 +15,7 @@ export declare class LoginWithTelegramComponent implements OnInit {
15
15
  private readonly telegramLoginConfig;
16
16
  private nonceTimer?;
17
17
  private legacyCallback?;
18
+ private readonly legacyCallbackName;
18
19
  constructor();
19
20
  readonly isUserAuthenticated: import("@angular/core").InputSignal<boolean>;
20
21
  readonly botID: import("@angular/core").InputSignal<string>;
@@ -18,6 +18,12 @@ export declare class SneatAuthWithTelegramService {
18
18
  private readonly errorLogger;
19
19
  private readonly apiService;
20
20
  private readonly authService;
21
+ private readonly destroyRef;
22
+ private readonly linkUserID?;
23
+ private linkContextInvalidated;
24
+ constructor();
25
+ private matchesLinkUser;
26
+ private linkContextIsCurrent;
21
27
  /** Legacy Login Widget: posts the widget's signed payload. */
22
28
  loginWithTelegram(botID: string, tgAuthData: ITelegramAuthData, isUserAuthenticated: boolean): void;
23
29
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sneat/auth-ui",
3
- "version": "0.27.41",
3
+ "version": "0.27.43",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,6 +19,7 @@
19
19
  "@sneat/space-services": "^0.27.0"
20
20
  },
21
21
  "dependencies": {
22
+ "ionicons": "8.1.0",
22
23
  "tslib": "2.8.1"
23
24
  },
24
25
  "type": "module",
@@ -31,6 +32,10 @@
31
32
  ".": {
32
33
  "types": "./sneat-auth-ui.d.ts",
33
34
  "default": "./esm2022/sneat-auth-ui.js"
35
+ },
36
+ "./provider-buttons": {
37
+ "types": "./provider-buttons/sneat-auth-ui-provider-buttons.d.ts",
38
+ "default": "./esm2022/provider-buttons/sneat-auth-ui-provider-buttons.js"
34
39
  }
35
40
  },
36
41
  "sideEffects": false
@@ -0,0 +1,31 @@
1
+ # OAuth provider buttons
2
+
3
+ > **Web UI:** follow the [Sneat web UI bible](https://github.com/sneat-co/sneat-specs/blob/main/standards/frontend-ux/README.md).
4
+
5
+ Import `AuthProviderButtonsComponent` from `@sneat/auth-ui/provider-buttons`.
6
+ This standalone OnPush component renders the existing Google, Apple, Microsoft,
7
+ Facebook and GitHub provider rows. It needs no auth, router, user-record,
8
+ Firestore or analytics providers. Selecting a native Ionic button emits
9
+ `providerSelected: OAuthProviderId`; the host owns authentication, navigation,
10
+ errors and account readiness. Construction starts no authentication or storage
11
+ operation. SVG icons are bundled through the component's direct Ionicons dependency,
12
+ so consumers need no global icon registration or icon-asset requests.
13
+
14
+ Inputs:
15
+
16
+ - `providers`: optional provider allowlist; omitted shows all five, `[]` shows none.
17
+ Display order stays Google, Apple, Microsoft, Facebook, GitHub.
18
+ - `busy`: optional active provider; shows its spinner and disables all buttons.
19
+ - `disabled`: disables every button, including while another sign-in method is busy.
20
+ - `labels`: partial plain-text map keyed by provider ID. Missing, blank or labels
21
+ longer than 160 characters fall back to the existing English label.
22
+
23
+ For example, `[labels]="{'google.com': 'Войти через Google'}"` localizes that
24
+ button. Content is interpolated as text. The component supplies rows/columns
25
+ without a card or page shell, so it can remain inside the existing AuthPanel grid
26
+ or a host-owned login dialog. Telegram, company SSO, email and account-readiness
27
+ behavior remain in AuthPanel.
28
+
29
+ A consumer must install a published `@sneat/auth-ui` release containing this
30
+ secondary entry; source aliases alone do not make it available in an older package.
31
+ Lazy hosts should load the entry only on explicit login intent.
@@ -0,0 +1,2 @@
1
+ export { AuthProviderButtonsComponent, OAUTH_PROVIDER_IDS, } from './provider-buttons.component';
2
+ export type { OAuthProviderId, OAuthProviderLabels, } from './provider-buttons.component';
@@ -0,0 +1,81 @@
1
+ import * as i0 from "@angular/core";
2
+ /** Fixed display order, independent of the caller's visibility allowlist order. */
3
+ export declare const OAUTH_PROVIDER_IDS: readonly ["google.com", "apple.com", "microsoft.com", "facebook.com", "github.com"];
4
+ export type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];
5
+ /** Plain text only; absent, blank or over-160-character labels use English defaults. */
6
+ export type OAuthProviderLabels = Readonly<Partial<Record<OAuthProviderId, string>>>;
7
+ declare const providers: readonly [{
8
+ readonly id: "google.com";
9
+ readonly label: "Login with Google";
10
+ readonly icon: string;
11
+ readonly color: "danger";
12
+ readonly spinnerColor: undefined;
13
+ }, {
14
+ readonly id: "apple.com";
15
+ readonly label: "Login with Apple";
16
+ readonly icon: string;
17
+ readonly color: "dark";
18
+ readonly spinnerColor: undefined;
19
+ }, {
20
+ readonly id: "microsoft.com";
21
+ readonly label: "Login with Microsoft";
22
+ readonly icon: string;
23
+ readonly color: "secondary";
24
+ readonly spinnerColor: "secondary";
25
+ }, {
26
+ readonly id: "facebook.com";
27
+ readonly label: "Login with Facebook";
28
+ readonly icon: string;
29
+ readonly color: "primary";
30
+ readonly spinnerColor: "primary";
31
+ }, {
32
+ readonly id: "github.com";
33
+ readonly label: "Login with GitHub";
34
+ readonly icon: string;
35
+ readonly color: "tertiary";
36
+ readonly spinnerColor: "tertiary";
37
+ }];
38
+ /** Presentation only: the host owns authentication, readiness, navigation and errors. */
39
+ export declare class AuthProviderButtonsComponent {
40
+ readonly providers: import("@angular/core").InputSignal<readonly ("google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com")[] | undefined>;
41
+ readonly busy: import("@angular/core").InputSignal<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com" | undefined>;
42
+ readonly disabled: import("@angular/core").InputSignal<boolean>;
43
+ readonly labels: import("@angular/core").InputSignal<Readonly<Partial<Record<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com", string>>>>;
44
+ readonly providerSelected: import("@angular/core").OutputEmitterRef<"google.com" | "apple.com" | "microsoft.com" | "facebook.com" | "github.com">;
45
+ readonly rows: import("@angular/core").Signal<({
46
+ readonly id: "google.com";
47
+ readonly label: "Login with Google";
48
+ readonly icon: string;
49
+ readonly color: "danger";
50
+ readonly spinnerColor: undefined;
51
+ } | {
52
+ readonly id: "apple.com";
53
+ readonly label: "Login with Apple";
54
+ readonly icon: string;
55
+ readonly color: "dark";
56
+ readonly spinnerColor: undefined;
57
+ } | {
58
+ readonly id: "microsoft.com";
59
+ readonly label: "Login with Microsoft";
60
+ readonly icon: string;
61
+ readonly color: "secondary";
62
+ readonly spinnerColor: "secondary";
63
+ } | {
64
+ readonly id: "facebook.com";
65
+ readonly label: "Login with Facebook";
66
+ readonly icon: string;
67
+ readonly color: "primary";
68
+ readonly spinnerColor: "primary";
69
+ } | {
70
+ readonly id: "github.com";
71
+ readonly label: "Login with GitHub";
72
+ readonly icon: string;
73
+ readonly color: "tertiary";
74
+ readonly spinnerColor: "tertiary";
75
+ })[][]>;
76
+ protected label(provider: (typeof providers)[number]): string;
77
+ protected select(provider: OAuthProviderId): void;
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthProviderButtonsComponent, never>;
79
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthProviderButtonsComponent, "sneat-auth-provider-buttons", never, { "providers": { "alias": "providers"; "required": false; "isSignal": true; }; "busy": { "alias": "busy"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "providerSelected": "providerSelected"; }, never, never, true, never>;
80
+ }
81
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@sneat/auth-ui/provider-buttons" />
5
+ export * from './index';