@atlasauth/angular 0.9.0 → 0.11.0

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.
@@ -57,6 +57,7 @@ export declare class AtlasService implements OnDestroy {
57
57
  readonly pendingAttempt: {
58
58
  id: string;
59
59
  status: string;
60
+ policyToken?: string;
60
61
  } | null;
61
62
  private readonly _status;
62
63
  private readonly _user;
@@ -11,6 +11,7 @@ import { OrganizationSwitcherComponent } from './components/organization-switche
11
11
  import { UserProfileComponent } from './components/user-profile.component';
12
12
  import { OrganizationProfileComponent } from './components/organization-profile.component';
13
13
  import { OrganizationAuditLogComponent } from './components/organization-audit-log.component';
14
+ import { AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent } from './components/policy-host';
14
15
  /**
15
16
  * Every standalone directive and component the SDK ships. Import the array in a
16
17
  * standalone component's `imports`, or rely on `AtlasModule` re-exporting it for
@@ -20,4 +21,4 @@ import { OrganizationAuditLogComponent } from './components/organization-audit-l
20
21
  * @Component({ standalone: true, imports: [...ATLAS_UI], template: '…' })
21
22
  * ```
22
23
  */
23
- export declare const ATLAS_UI: readonly [typeof AtlasSignedInDirective, typeof AtlasSignedOutDirective, typeof AtlasLoadingDirective, typeof AtlasLoadedDirective, typeof AtlasProtectDirective, typeof AtlasRootDirective, typeof SignInComponent, typeof SignUpComponent, typeof UserButtonComponent, typeof OrganizationSwitcherComponent, typeof UserProfileComponent, typeof OrganizationProfileComponent, typeof OrganizationAuditLogComponent];
24
+ export declare const ATLAS_UI: readonly [typeof AtlasSignedInDirective, typeof AtlasSignedOutDirective, typeof AtlasLoadingDirective, typeof AtlasLoadedDirective, typeof AtlasProtectDirective, typeof AtlasRootDirective, typeof SignInComponent, typeof SignUpComponent, typeof UserButtonComponent, typeof OrganizationSwitcherComponent, typeof UserProfileComponent, typeof OrganizationProfileComponent, typeof OrganizationAuditLogComponent, typeof AtlasPoliciesDirective, typeof PolicyAcceptStepComponent, typeof PolicyGateComponent];
@@ -90,6 +90,8 @@ export declare class AttemptFlowComponent {
90
90
  */
91
91
  emailVerification: string;
92
92
  resend: EventEmitter<void>;
93
+ /** The user declined a policy the sign-in was waiting on (`needs_policy_acceptance`): cancel the attempt. */
94
+ policyDeclined: EventEmitter<string>;
93
95
  protected values: Record<string, string>;
94
96
  protected t(key: string, vars?: Record<string, string>): string;
95
97
  /** A server error in the app's language (`error.<reason>`, else the server's message). */
@@ -121,9 +123,11 @@ export declare class AttemptFlowComponent {
121
123
  protected showEmailCodeOption(): boolean;
122
124
  /** The "we sent a code to …" line on the code step. */
123
125
  protected codeSentText(): string | null;
126
+ /** The attempt is `needs_policy_acceptance`. */
127
+ protected awaitingPolicies(): boolean;
124
128
  protected showSubmit(): boolean;
125
129
  protected fields(): StepField[];
126
130
  static ɵfac: i0.ɵɵFactoryDeclaration<AttemptFlowComponent, never>;
127
- static ɵcmp: i0.ɵɵComponentDeclaration<AttemptFlowComponent, "atlas-attempt-flow", never, { "attempt": { "alias": "attempt"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "sessionKept": { "alias": "sessionKept"; "required": false; }; "titleKey": { "alias": "titleKey"; "required": false; }; "captcha": { "alias": "captcha"; "required": false; }; "firstFactors": { "alias": "firstFactors"; "required": false; }; "preparedFactor": { "alias": "preparedFactor"; "required": false; }; "offerEmailSecondFactor": { "alias": "offerEmailSecondFactor"; "required": false; }; "emailedSecondFactor": { "alias": "emailedSecondFactor"; "required": false; }; "offerSmsSecondFactor": { "alias": "offerSmsSecondFactor"; "required": false; }; "textedSecondFactor": { "alias": "textedSecondFactor"; "required": false; }; "enrollment": { "alias": "enrollment"; "required": false; }; "enrollmentState": { "alias": "enrollmentState"; "required": false; }; "emailVerification": { "alias": "emailVerification"; "required": false; }; }, { "submitFlow": "submitFlow"; "chooseFactor": "chooseFactor"; "emailSecondFactor": "emailSecondFactor"; "smsSecondFactor": "smsSecondFactor"; "resend": "resend"; }, never, never, true, never>;
131
+ static ɵcmp: i0.ɵɵComponentDeclaration<AttemptFlowComponent, "atlas-attempt-flow", never, { "attempt": { "alias": "attempt"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "sessionKept": { "alias": "sessionKept"; "required": false; }; "titleKey": { "alias": "titleKey"; "required": false; }; "captcha": { "alias": "captcha"; "required": false; }; "firstFactors": { "alias": "firstFactors"; "required": false; }; "preparedFactor": { "alias": "preparedFactor"; "required": false; }; "offerEmailSecondFactor": { "alias": "offerEmailSecondFactor"; "required": false; }; "emailedSecondFactor": { "alias": "emailedSecondFactor"; "required": false; }; "offerSmsSecondFactor": { "alias": "offerSmsSecondFactor"; "required": false; }; "textedSecondFactor": { "alias": "textedSecondFactor"; "required": false; }; "enrollment": { "alias": "enrollment"; "required": false; }; "enrollmentState": { "alias": "enrollmentState"; "required": false; }; "emailVerification": { "alias": "emailVerification"; "required": false; }; }, { "submitFlow": "submitFlow"; "chooseFactor": "chooseFactor"; "emailSecondFactor": "emailSecondFactor"; "smsSecondFactor": "smsSecondFactor"; "resend": "resend"; "policyDeclined": "policyDeclined"; }, never, never, true, never>;
128
132
  }
129
133
  export {};
@@ -1,5 +1,5 @@
1
1
  import { WritableSignal } from '@angular/core';
2
- import { FapiClient, type CaptchaController, type FlowState, type InstanceSettings, type MfaChoices, type MfaEnrollmentController, type MfaEnrollmentState } from '@atlasauth/js';
2
+ import { FapiClient, PolicyAcceptanceController, type CaptchaController, type FlowState, type InstanceSettings, type MfaChoices, type MfaEnrollmentController, type MfaEnrollmentState } from '@atlasauth/js';
3
3
  /**
4
4
  * The server-driven sign-in / sign-up engine, shared by `<atlas-sign-in>` and
5
5
  * `<atlas-sign-up>` — the Angular counterpart of React's `useFlow` hook.
@@ -68,6 +68,11 @@ export declare class AtlasFlowController {
68
68
  readonly enrollment: MfaEnrollmentController;
69
69
  /** {@link enrollment}'s state, for templates. */
70
70
  readonly enrollmentState: WritableSignal<MfaEnrollmentState>;
71
+ /**
72
+ * The instance's policies (terms, privacy, …) for the create-account form:
73
+ * {@link create} sends their acceptances and reloads them after a refusal.
74
+ */
75
+ readonly policies: PolicyAcceptanceController;
71
76
  private pollTimer;
72
77
  private identifier;
73
78
  constructor(client: FapiClient, reload: () => Promise<boolean>, pending: {
@@ -119,6 +124,10 @@ export declare class AtlasFlowController {
119
124
  * the app sees a signed-in user.
120
125
  */
121
126
  submit(values: Record<string, string>): Promise<void>;
127
+ /** Load the sign-up's policies into {@link policies} (`<atlas-sign-up>` calls it on init). */
128
+ loadPolicies(locale?: string): Promise<void>;
129
+ /** The user declined a policy a sign-in was waiting on: cancel the attempt and say why. */
130
+ declinePolicy(title: string): void;
122
131
  /**
123
132
  * Create an account (`POST /v1/client/sign_ups`) from a create-account form's
124
133
  * values — email, password and any configured sign-up fields — carrying the
@@ -0,0 +1,88 @@
1
+ import { EventEmitter, OnChanges, OnDestroy, OnInit, type SimpleChanges } from '@angular/core';
2
+ import { type PolicyAcceptanceController, type PolicyClasses, type PolicyT } from '@atlasauth/js';
3
+ import { AtlasService } from '../atlas.service';
4
+ import * as i0 from "@angular/core";
5
+ /** The policy UI's translator (the localization bundle, else the English policy strings) for the current Atlas service. */
6
+ export declare function policyUi(atlas: AtlasService): {
7
+ t: PolicyT;
8
+ classes: PolicyClasses;
9
+ };
10
+ /**
11
+ * `[atlasPolicies]="controller"` — draws the instance's policies (terms, privacy,
12
+ * …) into the host element: `kind="consent"` (default) is the checkbox block with
13
+ * its in-page viewer, `kind="clickwrap"` the "By continuing you agree to …" line.
14
+ * The state is the controller's (`AtlasFlowController.policies`); the DOM comes
15
+ * from `@atlasauth/js`, shared with every SDK.
16
+ */
17
+ export declare class AtlasPoliciesDirective implements OnInit, OnChanges, OnDestroy {
18
+ private readonly host;
19
+ private readonly atlas;
20
+ private mounted;
21
+ private ready;
22
+ controller: PolicyAcceptanceController | null;
23
+ atlasPolicyKind: 'consent' | 'clickwrap';
24
+ ngOnInit(): void;
25
+ ngOnChanges(changes: SimpleChanges): void;
26
+ ngOnDestroy(): void;
27
+ private draw;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<AtlasPoliciesDirective, never>;
29
+ static ɵdir: i0.ɵɵDirectiveDeclaration<AtlasPoliciesDirective, "[atlasPolicies]", never, { "controller": { "alias": "atlasPolicies"; "required": false; }; "atlasPolicyKind": { "alias": "atlasPolicyKind"; "required": false; }; }, {}, never, never, true, never>;
30
+ }
31
+ /**
32
+ * `<atlas-policy-accept-step>` — the sign-in step for a `needs_policy_acceptance`
33
+ * attempt: scroll-mode policies in their unskippable dialog, the rest as
34
+ * checkboxes, then "Accept and continue". Emits `submitFlow` with the
35
+ * `policy_acceptances` JSON for the flow, and `declined` with the policy title
36
+ * when the user declines (cancel the attempt).
37
+ */
38
+ export declare class PolicyAcceptStepComponent implements OnInit, OnChanges, OnDestroy {
39
+ private readonly host;
40
+ private readonly atlas;
41
+ private step;
42
+ private alive;
43
+ attempt: {
44
+ id: string | null;
45
+ pending_policies?: unknown;
46
+ } | null;
47
+ busy: boolean;
48
+ submitFlow: EventEmitter<Record<string, string>>;
49
+ declined: EventEmitter<string>;
50
+ protected readonly loading: import("@angular/core").WritableSignal<boolean>;
51
+ protected loadingText: string;
52
+ ngOnInit(): void;
53
+ ngOnChanges(changes: SimpleChanges): void;
54
+ ngOnDestroy(): void;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<PolicyAcceptStepComponent, never>;
56
+ static ɵcmp: i0.ɵɵComponentDeclaration<PolicyAcceptStepComponent, "atlas-policy-accept-step", never, { "attempt": { "alias": "attempt"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; }, { "submitFlow": "submitFlow"; "declined": "declined"; }, never, never, true, never>;
57
+ }
58
+ /**
59
+ * `<atlas-policy-gate>` — in-app re-acceptance. For a signed-in user, a banner
60
+ * when a policy needs re-acceptance; "Review and accept" opens the unskippable
61
+ * dialog / checkboxes and posts `/v1/client/me/policies/accept`. Projects its
62
+ * content always.
63
+ */
64
+ export declare class PolicyGateComponent implements OnInit, OnDestroy {
65
+ private readonly host;
66
+ private readonly atlas;
67
+ private readonly ui;
68
+ private gate;
69
+ private off;
70
+ private step;
71
+ private readonly version;
72
+ accepted: EventEmitter<void>;
73
+ protected readonly reviewing: import("@angular/core").WritableSignal<boolean>;
74
+ protected readonly error: import("@angular/core").WritableSignal<string>;
75
+ protected title: string;
76
+ protected reviewText: string;
77
+ protected linkClass: string;
78
+ protected errorClass: string;
79
+ protected bannerClass: string;
80
+ protected cardClass: string;
81
+ protected bannerText(): string | null;
82
+ ngOnInit(): void;
83
+ begin(): Promise<void>;
84
+ private close;
85
+ ngOnDestroy(): void;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<PolicyGateComponent, never>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<PolicyGateComponent, "atlas-policy-gate", never, {}, { "accepted": "accepted"; }, never, ["*"], true, never>;
88
+ }
@@ -1,5 +1,5 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { type CaptchaController, type FieldError, type InstanceSettings, type PublicSignUpField } from '@atlasauth/js';
1
+ import { EventEmitter, OnChanges, OnDestroy, type SimpleChanges } from '@angular/core';
2
+ import { type PolicyAcceptanceController, type CaptchaController, type FieldError, type InstanceSettings, type PublicSignUpField } from '@atlasauth/js';
3
3
  import { type ElementKey } from '../appearance';
4
4
  import * as i0 from "@angular/core";
5
5
  /** What the create-account form emits: the values typed plus the consent tick. */
@@ -15,8 +15,10 @@ export interface SignUpFormSubmit {
15
15
  * email (`settings.emailDelivery.passwordSignUp === false`) it shows the
16
16
  * `signUp.emailUnavailable` notice instead of the form.
17
17
  */
18
- export declare class SignUpFormComponent {
18
+ export declare class SignUpFormComponent implements OnChanges, OnDestroy {
19
19
  private readonly atlas;
20
+ private readonly cdr;
21
+ private unwatch;
20
22
  settings: InstanceSettings | null;
21
23
  busy: boolean;
22
24
  errors: FieldError[];
@@ -27,12 +29,18 @@ export declare class SignUpFormComponent {
27
29
  } | null;
28
30
  /** Whether the password / passkey toggle is shown (both are offered). */
29
31
  switchable: boolean;
32
+ /** The instance's policies (terms, privacy, …); they replace the legacy consent row. */
33
+ policies: PolicyAcceptanceController | null;
30
34
  /** The user asked for the other sign-up method. */
31
35
  switchMode: EventEmitter<void>;
32
36
  /** Emits the typed values and the consent tick when the form is submitted. */
33
37
  submitSignUp: EventEmitter<SignUpFormSubmit>;
34
38
  protected values: Record<string, string>;
35
39
  protected agreed: boolean;
40
+ protected declined: string | null;
41
+ ngOnChanges(changes: SimpleChanges): void;
42
+ ngOnDestroy(): void;
43
+ protected hasPolicies(): boolean;
36
44
  protected t(key: string, vars?: Record<string, string>): string;
37
45
  /** A server error in the app's language (`error.<reason>`, else the server's message). */
38
46
  protected errorText(error: FieldError): string;
@@ -55,5 +63,5 @@ export declare class SignUpFormComponent {
55
63
  protected fieldErrorsFor(name: string): FieldError[];
56
64
  protected onSubmit(event: Event): void;
57
65
  static ɵfac: i0.ɵɵFactoryDeclaration<SignUpFormComponent, never>;
58
- static ɵcmp: i0.ɵɵComponentDeclaration<SignUpFormComponent, "atlas-sign-up-form", never, { "settings": { "alias": "settings"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "captcha": { "alias": "captcha"; "required": false; }; "passkey": { "alias": "passkey"; "required": false; }; "switchable": { "alias": "switchable"; "required": false; }; }, { "switchMode": "switchMode"; "submitSignUp": "submitSignUp"; }, never, never, true, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<SignUpFormComponent, "atlas-sign-up-form", never, { "settings": { "alias": "settings"; "required": false; }; "busy": { "alias": "busy"; "required": false; }; "errors": { "alias": "errors"; "required": false; }; "captcha": { "alias": "captcha"; "required": false; }; "passkey": { "alias": "passkey"; "required": false; }; "switchable": { "alias": "switchable"; "required": false; }; "policies": { "alias": "policies"; "required": false; }; }, { "switchMode": "switchMode"; "submitSignUp": "submitSignUp"; }, never, never, true, never>;
59
67
  }
@@ -14,6 +14,7 @@ import * as i10 from "./components/organization-switcher.component";
14
14
  import * as i11 from "./components/user-profile.component";
15
15
  import * as i12 from "./components/organization-profile.component";
16
16
  import * as i13 from "./components/organization-audit-log.component";
17
+ import * as i14 from "./components/policy-host";
17
18
  /**
18
19
  * Standalone-provider entry point (Angular 17+). Register Atlas once at the
19
20
  * application root — the direct analogue of wrapping the tree in React's
@@ -42,6 +43,6 @@ export declare function provideAtlas(options: AtlasOptions): EnvironmentProvider
42
43
  export declare class AtlasModule {
43
44
  static forRoot(options: AtlasOptions): ModuleWithProviders<AtlasModule>;
44
45
  static ɵfac: i0.ɵɵFactoryDeclaration<AtlasModule, never>;
45
- static ɵmod: i0.ɵɵNgModuleDeclaration<AtlasModule, never, [typeof i1.AtlasSignedInDirective, typeof i2.AtlasSignedOutDirective, typeof i3.AtlasLoadingDirective, typeof i4.AtlasLoadedDirective, typeof i5.AtlasProtectDirective, typeof i6.AtlasRootDirective, typeof i7.SignInComponent, typeof i8.SignUpComponent, typeof i9.UserButtonComponent, typeof i10.OrganizationSwitcherComponent, typeof i11.UserProfileComponent, typeof i12.OrganizationProfileComponent, typeof i13.OrganizationAuditLogComponent], [typeof i1.AtlasSignedInDirective, typeof i2.AtlasSignedOutDirective, typeof i3.AtlasLoadingDirective, typeof i4.AtlasLoadedDirective, typeof i5.AtlasProtectDirective, typeof i6.AtlasRootDirective, typeof i7.SignInComponent, typeof i8.SignUpComponent, typeof i9.UserButtonComponent, typeof i10.OrganizationSwitcherComponent, typeof i11.UserProfileComponent, typeof i12.OrganizationProfileComponent, typeof i13.OrganizationAuditLogComponent]>;
46
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AtlasModule, never, [typeof i1.AtlasSignedInDirective, typeof i2.AtlasSignedOutDirective, typeof i3.AtlasLoadingDirective, typeof i4.AtlasLoadedDirective, typeof i5.AtlasProtectDirective, typeof i6.AtlasRootDirective, typeof i7.SignInComponent, typeof i8.SignUpComponent, typeof i9.UserButtonComponent, typeof i10.OrganizationSwitcherComponent, typeof i11.UserProfileComponent, typeof i12.OrganizationProfileComponent, typeof i13.OrganizationAuditLogComponent, typeof i14.AtlasPoliciesDirective, typeof i14.PolicyAcceptStepComponent, typeof i14.PolicyGateComponent], [typeof i1.AtlasSignedInDirective, typeof i2.AtlasSignedOutDirective, typeof i3.AtlasLoadingDirective, typeof i4.AtlasLoadedDirective, typeof i5.AtlasProtectDirective, typeof i6.AtlasRootDirective, typeof i7.SignInComponent, typeof i8.SignUpComponent, typeof i9.UserButtonComponent, typeof i10.OrganizationSwitcherComponent, typeof i11.UserProfileComponent, typeof i12.OrganizationProfileComponent, typeof i13.OrganizationAuditLogComponent, typeof i14.AtlasPoliciesDirective, typeof i14.PolicyAcceptStepComponent, typeof i14.PolicyGateComponent]>;
46
47
  static ɵinj: i0.ɵɵInjectorDeclaration<AtlasModule>;
47
48
  }
@@ -24,6 +24,7 @@ export { ImpersonationBannerComponent } from './lib/components/impersonation-ban
24
24
  export { AttemptFlowComponent } from './lib/components/attempt-flow.component';
25
25
  export { SignUpFormComponent, type SignUpFormSubmit, } from './lib/components/sign-up-form.component';
26
26
  export { AtlasCaptchaSlotDirective } from './lib/directives/captcha-slot.directive';
27
+ export { AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent } from './lib/components/policy-host';
27
28
  export { AtlasFlowController } from './lib/components/flow-controller';
28
29
  export { ATLAS_UI } from './lib/atlas.ui';
29
30
  export { atlasGuard, atlasChildGuard, type AtlasGuardOptions, } from './lib/guards/atlas.guard';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasauth/angular",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Official Angular SDK for Atlas — the Angular peer of @atlasauth/react.",
5
5
  "license": "MIT",
6
6
  "module": "./dist/fesm2022/atlas-angular.mjs",
@@ -19,8 +19,8 @@
19
19
  "sideEffects": false,
20
20
  "dependencies": {
21
21
  "tslib": "^2.6.3",
22
- "@atlasauth/design": "0.2.0",
23
- "@atlasauth/js": "0.16.0",
22
+ "@atlasauth/design": "0.3.0",
23
+ "@atlasauth/js": "0.20.0",
24
24
  "@atlasauth/authz": "0.2.0"
25
25
  },
26
26
  "peerDependencies": {