Merge branch 'main' into item-back-button

This commit is contained in:
Michael Spalti
2023-01-20 16:28:57 -08:00
8 changed files with 29 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<ds-themed-loading *ngIf="(loading | async) || (isAuthenticated | async)" class="m-5"></ds-themed-loading>
<div *ngIf="!(loading | async) && !(isAuthenticated | async)" class="px-4 py-3 login-container">
<ng-container *ngFor="let authMethod of (authMethods | async); let i = index">
<ng-container *ngFor="let authMethod of (authMethods); let i = index">
<div *ngIf="i === 1" class="text-center mt-2">
<span class="align-middle">{{"login.form.or-divider" | translate}}</span>
</div>

View File

@@ -14,6 +14,7 @@ import { AuthService } from '../../core/auth/auth.service';
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
import { FeatureID } from '../../core/data/feature-authorization/feature-id';
import { CoreState } from '../../core/core-state.model';
import { AuthMethodType } from '../../core/auth/models/auth.method-type';
/**
* /users/sign-in
@@ -36,7 +37,7 @@ export class LogInComponent implements OnInit {
* The list of authentication methods available
* @type {AuthMethod[]}
*/
public authMethods: Observable<AuthMethod[]>;
public authMethods: AuthMethod[];
/**
* Whether user is authenticated.
@@ -62,9 +63,12 @@ export class LogInComponent implements OnInit {
ngOnInit(): void {
this.authMethods = this.store.pipe(
this.store.pipe(
select(getAuthenticationMethods),
);
).subscribe(methods => {
// ignore the ip authentication method when it's returned by the backend
this.authMethods = methods.filter(a => a.authMethodType !== AuthMethodType.Ip);
});
// set loading
this.loading = this.store.pipe(select(isAuthenticationLoading));

View File

@@ -11,7 +11,7 @@ describe('Angulartics2DSpace', () => {
beforeEach(() => {
angulartics2 = {
eventTrack: observableOf({action: 'pageView', properties: {object: 'mock-object'}}),
eventTrack: observableOf({action: 'page_view', properties: {object: 'mock-object'}}),
filterDeveloperMode: () => filter(() => true)
} as any;
statisticsService = jasmine.createSpyObj('statisticsService', {trackViewEvent: null});

View File

@@ -24,7 +24,7 @@ export class Angulartics2DSpace {
}
private eventTrack(event) {
if (event.action === 'pageView') {
if (event.action === 'page_view') {
this.statisticsService.trackViewEvent(event.properties.object);
} else if (event.action === 'search') {
this.statisticsService.trackSearchEvent(

View File

@@ -20,7 +20,7 @@ export class ViewTrackerComponent implements OnInit {
ngOnInit(): void {
this.angulartics2.eventTrack.next({
action: 'pageView',
action: 'page_view',
properties: {object: this.object},
});
}

View File

@@ -1,4 +1,7 @@
import { Angulartics2GoogleAnalytics, Angulartics2GoogleTagManager } from 'angulartics2';
import {
Angulartics2GoogleAnalytics,
Angulartics2GoogleGlobalSiteTag,
} from 'angulartics2';
import { of } from 'rxjs';
import { GoogleAnalyticsService } from './google-analytics.service';
@@ -16,7 +19,7 @@ describe('GoogleAnalyticsService', () => {
const srcTestValue = 'mock-script-src';
let service: GoogleAnalyticsService;
let googleAnalyticsSpy: Angulartics2GoogleAnalytics;
let googleTagManagerSpy: Angulartics2GoogleTagManager;
let googleTagManagerSpy: Angulartics2GoogleGlobalSiteTag;
let configSpy: ConfigurationDataService;
let klaroServiceSpy: jasmine.SpyObj<KlaroService>;
let scriptElementMock: any;
@@ -37,7 +40,7 @@ describe('GoogleAnalyticsService', () => {
googleAnalyticsSpy = jasmine.createSpyObj('Angulartics2GoogleAnalytics', [
'startTracking',
]);
googleTagManagerSpy = jasmine.createSpyObj('Angulartics2GoogleTagManager', [
googleTagManagerSpy = jasmine.createSpyObj('Angulartics2GoogleGlobalSiteTag', [
'startTracking',
]);

View File

@@ -1,7 +1,10 @@
import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from '@angular/core';
import { Angulartics2GoogleAnalytics, Angulartics2GoogleTagManager } from 'angulartics2';
import {
Angulartics2GoogleAnalytics,
Angulartics2GoogleGlobalSiteTag,
} from 'angulartics2';
import { combineLatest } from 'rxjs';
import { ConfigurationDataService } from '../core/data/configuration-data.service';
@@ -19,7 +22,7 @@ export class GoogleAnalyticsService {
constructor(
private googleAnalytics: Angulartics2GoogleAnalytics,
private googleTagManager: Angulartics2GoogleTagManager,
private googleGlobalSiteTag: Angulartics2GoogleGlobalSiteTag,
private klaroService: KlaroService,
private configService: ConfigurationDataService,
@Inject(DOCUMENT) private document: any,
@@ -70,7 +73,7 @@ export class GoogleAnalyticsService {
this.document.body.appendChild(libScript);
// start tracking
this.googleTagManager.startTracking();
this.googleGlobalSiteTag.startTracking();
} else {
// add trackingId snippet to page
const keyScript = this.document.createElement('script');

View File

@@ -6,7 +6,11 @@ import { ServerModule, ServerTransferStateModule } from '@angular/platform-serve
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { Angulartics2, Angulartics2GoogleAnalytics, Angulartics2GoogleTagManager } from 'angulartics2';
import {
Angulartics2,
Angulartics2GoogleAnalytics,
Angulartics2GoogleGlobalSiteTag
} from 'angulartics2';
import { AppComponent } from '../../app/app.component';
@@ -63,7 +67,7 @@ export function createTranslateLoader(transferState: TransferState) {
useClass: AngularticsProviderMock
},
{
provide: Angulartics2GoogleTagManager,
provide: Angulartics2GoogleGlobalSiteTag,
useClass: AngularticsProviderMock
},
{