@atlasauth/angular 0.11.0 → 0.12.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.
@@ -4,7 +4,7 @@ import { isPlatformBrowser, DOCUMENT } from '@angular/common';
4
4
  import { toSignal } from '@angular/core/rxjs-interop';
5
5
  import { BehaviorSubject, Subject, combineLatest, firstValueFrom } from 'rxjs';
6
6
  import { map, distinctUntilChanged, filter, take } from 'rxjs/operators';
7
- import { createOrganizationAuditLog, POLICY_STRINGS, TokenCache, SignOutNotifier, resolveFrontendApi, withDevBrowser, catalogLocale, configureReferralCapture, FapiClient, SignOutGuard, localizedErrorMessage, reauthenticate, getTemplateToken, getProviderToken, signOutReasonFromClient, readRedirectResult, completeOAuthPopupLanding, mapOAuthPopupPayload, stripRedirectParams, closeOAuthPopupAfterSignIn, SDK_HEADER, sdkHeaderValue, reportSdkAdvisory, readExpiry, msUntilRefresh, policyTranslator, injectPolicyStyles, mountPolicyClickwrap, mountPolicyConsent, controllerForPending, mountPolicyAcceptStep, joinTitles, formatPolicyDate, PolicyGateController, groupSetupKey, enrollmentSubmitKey, nextStep, awaitingSignUpLink, canDownloadRecoveryCodes, copyRecoveryCodes, downloadRecoveryCodes, createCaptchaController, atlasCaptchaLabels, PolicyAcceptanceController, flowFromPending, initialFlow, createMfaEnrollment, mfaChoicesFrom, fetchInstanceSettings, fetchLastSignInMethod, offeredFirstFactors, prepareFactor, signInCaptchaOptions, flowNeedsCaptcha, planFirstFactor, advanceWithCaptcha, loadPolicies, createSignUp, prepareSecondFactorCode, resendSignUpVerification, createPasskeySignUp, finishPasskeySignUp, pendingRecoveryCodes, acknowledgeRecoveryCodes, shouldKeepPolling, pollAttempt, lastUsedMethodLabel, signUp, confirmPolicies, passkeysSupported, awaitingPasskey, OrganizationProfileController, describeAuditAction, actorFromClaims } from '@atlasauth/js';
7
+ import { createOrganizationAuditLog, POLICY_STRINGS, TokenCache, SignOutNotifier, resolveFrontendApi, withDevBrowser, catalogLocale, configureReferralCapture, FapiClient, SignOutGuard, localizedErrorMessage, reauthenticate, getTemplateToken, getProviderToken, signOutReasonFromClient, readRedirectResult, completeOAuthPopupLanding, mapOAuthPopupPayload, stripRedirectParams, closeOAuthPopupAfterSignIn, SDK_HEADER, sdkHeaderValue, reportSdkAdvisory, readExpiry, msUntilRefresh, policyTranslator, injectPolicyStyles, mountPolicyClickwrap, mountPolicyConsent, controllerForPending, mountPolicyAcceptStep, joinTitles, formatPolicyDate, PolicyGateController, groupSetupKey, enrollmentSubmitKey, nextStep, awaitingSignUpLink, canDownloadRecoveryCodes, copyRecoveryCodes, downloadRecoveryCodes, createCaptchaController, atlasCaptchaLabels, PolicyAcceptanceController, flowFromPending, initialFlow, createMfaEnrollment, mfaChoicesFrom, fetchInstanceSettings, fetchLastSignInMethod, offeredFirstFactors, prepareFactor, signInCaptchaOptions, flowNeedsCaptcha, planFirstFactor, advanceWithCaptcha, loadPolicies, createSignUp, prepareSecondFactorCode, resendSignUpVerification, createPasskeySignUp, finishPasskeySignUp, pendingRecoveryCodes, acknowledgeRecoveryCodes, shouldKeepPolling, pollAttempt, lastUsedMethodLabel, signUp, confirmPolicies, passkeysSupported, awaitingPasskey, listCibaRequests, getCibaPin, decideCibaRequest, setCibaPin, clearCibaPin, OrganizationProfileController, describeAuditAction, actorFromClaims } from '@atlasauth/js';
8
8
  export { FapiClient, SIGN_OUT_EVENT, SignOutError, advance, flowFromPending, getProviderToken, initialFlow, onAtlasSignOut, pollAttempt, prepareFactor, requestForStep, shouldKeepPolling } from '@atlasauth/js';
9
9
  import { evaluate } from '@atlasauth/authz';
10
10
  export { evaluate, hasFromClaims } from '@atlasauth/authz';
@@ -389,7 +389,7 @@ function withFallback(locale) {
389
389
  }
390
390
 
391
391
  /** This package's version, sent as `X-Atlas-SDK` (kept in step with package.json by a test). */
392
- const ATLAS_ANGULAR_VERSION = '0.9.0';
392
+ const ATLAS_ANGULAR_VERSION = '0.11.0';
393
393
  const ATLAS_ANGULAR_SDK = { name: '@atlasauth/angular', version: ATLAS_ANGULAR_VERSION };
394
394
 
395
395
  /**
@@ -3647,6 +3647,151 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3647
3647
  }]
3648
3648
  }] });
3649
3649
 
3650
+ /**
3651
+ * `<atlas-manage-ciba>` — sign-in requests apps start on the user's behalf (CIBA), with approve and deny, and
3652
+ * the optional CIBA PIN apps must send as the user code. The Angular peer of React's `<ManageCiba/>`. Renders
3653
+ * nothing when there is no request, no PIN and no app that could ask.
3654
+ */
3655
+ class ManageCibaComponent {
3656
+ atlas = inject(AtlasService);
3657
+ requests = signal([]);
3658
+ pin = signal(null);
3659
+ newPin = signal('');
3660
+ password = signal('');
3661
+ message = signal(null);
3662
+ client = this.atlas.createFapiClient();
3663
+ ngOnInit() {
3664
+ void this.load();
3665
+ }
3666
+ async load() {
3667
+ const [r, p] = await Promise.all([listCibaRequests(this.client).catch(() => []), getCibaPin(this.client).catch(() => null)]);
3668
+ this.requests.set(r);
3669
+ this.pin.set(p);
3670
+ }
3671
+ async run(fn, fallback) {
3672
+ this.message.set(null);
3673
+ try {
3674
+ await fn();
3675
+ this.newPin.set('');
3676
+ this.password.set('');
3677
+ await this.load();
3678
+ }
3679
+ catch (e) {
3680
+ this.message.set(e instanceof Error && e.message ? e.message : fallback);
3681
+ }
3682
+ }
3683
+ decide(id, decision) {
3684
+ return this.run(() => decideCibaRequest(this.client, id, decision), decision === 'approve' ? 'Could not approve.' : 'Could not deny.');
3685
+ }
3686
+ save(event) {
3687
+ event.preventDefault();
3688
+ return this.run(() => setCibaPin(this.client, { pin: this.newPin(), currentPassword: this.password() }), 'Could not save the PIN.');
3689
+ }
3690
+ remove() {
3691
+ return this.run(() => clearCibaPin(this.client, { currentPassword: this.password() }), 'Could not remove the PIN.');
3692
+ }
3693
+ cls(key, base) {
3694
+ return classFor(key, this.atlas.appearance, base);
3695
+ }
3696
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ManageCibaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3697
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: ManageCibaComponent, isStandalone: true, selector: "atlas-manage-ciba", ngImport: i0, template: `
3698
+ @if (requests().length || (pin() && (pin()!.set || pin()!.available))) {
3699
+ <section [class]="cls('card', 'atlas-card')" data-atlas="manage-ciba">
3700
+ @if (requests().length) {
3701
+ <h2>Sign-in requests from apps</h2>
3702
+ <ul>
3703
+ @for (r of requests(); track r.id) {
3704
+ <li>
3705
+ <strong>{{ r.client_name }}</strong>
3706
+ @if (r.binding_message) {
3707
+ <div>{{ r.binding_message }}</div>
3708
+ }
3709
+ <small>{{ r.scope.join(', ') }}</small>
3710
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="decide(r.id, 'approve')">Approve</button>
3711
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="decide(r.id, 'deny')">Deny</button>
3712
+ </li>
3713
+ }
3714
+ </ul>
3715
+ }
3716
+ @if (pin(); as p) {
3717
+ @if (p.set || p.available) {
3718
+ <form (submit)="save($event)">
3719
+ <h2>CIBA PIN</h2>
3720
+ <p>{{ p.set ? 'You have a CIBA PIN.' : 'You have not set a CIBA PIN.' }} Apps that start a sign-in request for you must send it.</p>
3721
+ <input type="password" autocomplete="current-password" placeholder="Current password" aria-label="Current password" [value]="password()" (input)="password.set($any($event.target).value)" />
3722
+ <input type="password" inputmode="numeric" autocomplete="off" placeholder="6 to 12 digits" aria-label="New CIBA PIN" [value]="newPin()" (input)="newPin.set($any($event.target).value)" />
3723
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="submit">{{ p.set ? 'Change PIN' : 'Set PIN' }}</button>
3724
+ @if (p.set) {
3725
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="remove()">Remove PIN</button>
3726
+ }
3727
+ @if (message(); as m) {
3728
+ <small role="status">{{ m }}</small>
3729
+ }
3730
+ </form>
3731
+ }
3732
+ }
3733
+ @if (message(); as m) {
3734
+ @if (!pin() || !(pin()!.set || pin()!.available)) {
3735
+ <small role="status">{{ m }}</small>
3736
+ }
3737
+ }
3738
+ </section>
3739
+ }
3740
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3741
+ }
3742
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ManageCibaComponent, decorators: [{
3743
+ type: Component,
3744
+ args: [{
3745
+ selector: 'atlas-manage-ciba',
3746
+ standalone: true,
3747
+ changeDetection: ChangeDetectionStrategy.OnPush,
3748
+ template: `
3749
+ @if (requests().length || (pin() && (pin()!.set || pin()!.available))) {
3750
+ <section [class]="cls('card', 'atlas-card')" data-atlas="manage-ciba">
3751
+ @if (requests().length) {
3752
+ <h2>Sign-in requests from apps</h2>
3753
+ <ul>
3754
+ @for (r of requests(); track r.id) {
3755
+ <li>
3756
+ <strong>{{ r.client_name }}</strong>
3757
+ @if (r.binding_message) {
3758
+ <div>{{ r.binding_message }}</div>
3759
+ }
3760
+ <small>{{ r.scope.join(', ') }}</small>
3761
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="decide(r.id, 'approve')">Approve</button>
3762
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="decide(r.id, 'deny')">Deny</button>
3763
+ </li>
3764
+ }
3765
+ </ul>
3766
+ }
3767
+ @if (pin(); as p) {
3768
+ @if (p.set || p.available) {
3769
+ <form (submit)="save($event)">
3770
+ <h2>CIBA PIN</h2>
3771
+ <p>{{ p.set ? 'You have a CIBA PIN.' : 'You have not set a CIBA PIN.' }} Apps that start a sign-in request for you must send it.</p>
3772
+ <input type="password" autocomplete="current-password" placeholder="Current password" aria-label="Current password" [value]="password()" (input)="password.set($any($event.target).value)" />
3773
+ <input type="password" inputmode="numeric" autocomplete="off" placeholder="6 to 12 digits" aria-label="New CIBA PIN" [value]="newPin()" (input)="newPin.set($any($event.target).value)" />
3774
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="submit">{{ p.set ? 'Change PIN' : 'Set PIN' }}</button>
3775
+ @if (p.set) {
3776
+ <button [class]="cls('formButtonSecondary', 'atlas-button-secondary')" type="button" (click)="remove()">Remove PIN</button>
3777
+ }
3778
+ @if (message(); as m) {
3779
+ <small role="status">{{ m }}</small>
3780
+ }
3781
+ </form>
3782
+ }
3783
+ }
3784
+ @if (message(); as m) {
3785
+ @if (!pin() || !(pin()!.set || pin()!.available)) {
3786
+ <small role="status">{{ m }}</small>
3787
+ }
3788
+ }
3789
+ </section>
3790
+ }
3791
+ `,
3792
+ }]
3793
+ }] });
3794
+
3650
3795
  /**
3651
3796
  * `<atlas-user-profile>` — the signed-in user's account surface (emails,
3652
3797
  * security). The Angular peer of React's `<UserProfile/>`. Renders nothing when
@@ -3753,15 +3898,18 @@ class UserProfileComponent {
3753
3898
  <h2>{{ t('userProfile.securitySection') }}</h2>
3754
3899
  <p>{{ user.mfa_enabled ? '2FA on' : '2FA off' }}</p>
3755
3900
  </section>
3901
+
3902
+ <atlas-manage-ciba />
3756
3903
  </div>
3757
3904
  }
3758
- `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3905
+ `, isInline: true, dependencies: [{ kind: "component", type: ManageCibaComponent, selector: "atlas-manage-ciba" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3759
3906
  }
3760
3907
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: UserProfileComponent, decorators: [{
3761
3908
  type: Component,
3762
3909
  args: [{
3763
3910
  selector: 'atlas-user-profile',
3764
3911
  standalone: true,
3912
+ imports: [ManageCibaComponent],
3765
3913
  changeDetection: ChangeDetectionStrategy.OnPush,
3766
3914
  template: `
3767
3915
  @if (atlas.user(); as user) {
@@ -3818,6 +3966,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3818
3966
  <h2>{{ t('userProfile.securitySection') }}</h2>
3819
3967
  <p>{{ user.mfa_enabled ? '2FA on' : '2FA off' }}</p>
3820
3968
  </section>
3969
+
3970
+ <atlas-manage-ciba />
3821
3971
  </div>
3822
3972
  }
3823
3973
  `,
@@ -4582,6 +4732,7 @@ const ATLAS_UI = [
4582
4732
  UserProfileComponent,
4583
4733
  OrganizationProfileComponent,
4584
4734
  OrganizationAuditLogComponent,
4735
+ ManageCibaComponent,
4585
4736
  AtlasPoliciesDirective,
4586
4737
  PolicyAcceptStepComponent,
4587
4738
  PolicyGateComponent,
@@ -4642,7 +4793,7 @@ class AtlasModule {
4642
4793
  return { ngModule: AtlasModule, providers };
4643
4794
  }
4644
4795
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AtlasModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4645
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: AtlasModule, imports: [AtlasSignedInDirective, AtlasSignedOutDirective, AtlasLoadingDirective, AtlasLoadedDirective, AtlasProtectDirective, AtlasRootDirective, SignInComponent, SignUpComponent, UserButtonComponent, OrganizationSwitcherComponent, UserProfileComponent, OrganizationProfileComponent, OrganizationAuditLogComponent, AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent], exports: [AtlasSignedInDirective, AtlasSignedOutDirective, AtlasLoadingDirective, AtlasLoadedDirective, AtlasProtectDirective, AtlasRootDirective, SignInComponent, SignUpComponent, UserButtonComponent, OrganizationSwitcherComponent, UserProfileComponent, OrganizationProfileComponent, OrganizationAuditLogComponent, AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent] });
4796
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: AtlasModule, imports: [AtlasSignedInDirective, AtlasSignedOutDirective, AtlasLoadingDirective, AtlasLoadedDirective, AtlasProtectDirective, AtlasRootDirective, SignInComponent, SignUpComponent, UserButtonComponent, OrganizationSwitcherComponent, UserProfileComponent, OrganizationProfileComponent, OrganizationAuditLogComponent, ManageCibaComponent, AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent], exports: [AtlasSignedInDirective, AtlasSignedOutDirective, AtlasLoadingDirective, AtlasLoadedDirective, AtlasProtectDirective, AtlasRootDirective, SignInComponent, SignUpComponent, UserButtonComponent, OrganizationSwitcherComponent, UserProfileComponent, OrganizationProfileComponent, OrganizationAuditLogComponent, ManageCibaComponent, AtlasPoliciesDirective, PolicyAcceptStepComponent, PolicyGateComponent] });
4646
4797
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AtlasModule });
4647
4798
  }
4648
4799
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AtlasModule, decorators: [{
@@ -4803,5 +4954,5 @@ function atlasChildGuard(options = {}) {
4803
4954
  * Generated bundle index. Do not edit.
4804
4955
  */
4805
4956
 
4806
- export { ATLAS_ANGULAR_SDK, ATLAS_ANGULAR_VERSION, ATLAS_OPTIONS, ATLAS_UI, AtlasCaptchaSlotDirective, AtlasFlowController, AtlasLoadedDirective, AtlasLoadingDirective, AtlasModule, AtlasOrganizationAuditLog, AtlasPoliciesDirective, AtlasProtectDirective, AtlasRootDirective, AtlasService, AtlasSignedInDirective, AtlasSignedOutDirective, AttemptFlowComponent, DEFAULT_TOKENS, EN_US, ImpersonationBannerComponent, OrganizationAuditLogComponent, OrganizationProfileComponent, OrganizationSwitcherComponent, PolicyAcceptStepComponent, PolicyGateComponent, SignInComponent, SignUpComponent, SignUpFormComponent, THEMES, UserButtonComponent, UserProfileComponent, atlasChildGuard, atlasGuard, classFor, cssVariables, explicitTokens, provideAtlas, renderAppearance, resolveTokens, translate, withFallback };
4957
+ export { ATLAS_ANGULAR_SDK, ATLAS_ANGULAR_VERSION, ATLAS_OPTIONS, ATLAS_UI, AtlasCaptchaSlotDirective, AtlasFlowController, AtlasLoadedDirective, AtlasLoadingDirective, AtlasModule, AtlasOrganizationAuditLog, AtlasPoliciesDirective, AtlasProtectDirective, AtlasRootDirective, AtlasService, AtlasSignedInDirective, AtlasSignedOutDirective, AttemptFlowComponent, DEFAULT_TOKENS, EN_US, ImpersonationBannerComponent, ManageCibaComponent, OrganizationAuditLogComponent, OrganizationProfileComponent, OrganizationSwitcherComponent, PolicyAcceptStepComponent, PolicyGateComponent, SignInComponent, SignUpComponent, SignUpFormComponent, THEMES, UserButtonComponent, UserProfileComponent, atlasChildGuard, atlasGuard, classFor, cssVariables, explicitTokens, provideAtlas, renderAppearance, resolveTokens, translate, withFallback };
4807
4958
  //# sourceMappingURL=atlasauth-angular.mjs.map