Skip to content

Commit

Permalink
feat: remove ngx-cookie-banner functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
shauke committed Nov 4, 2020
1 parent ce3cfb7 commit 38231c1
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 125 deletions.
15 changes: 0 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
"lodash-es": "^4.17.15",
"morgan": "^1.10.0",
"ng-recaptcha": "^6.0.2",
"ngx-cookie-banner": "^0.1.1",
"ngx-infinite-scroll": "^9.1.0",
"ngx-swiper-wrapper": "^10.0.0",
"ngx-toastr": "^13.1.0",
Expand Down
14 changes: 0 additions & 14 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,3 @@

<footer data-testing-id="section-footer"><ish-footer [deviceType]="deviceType$ | async"></ish-footer></footer>
</div>

<!-- component that provides a banner to inform users about cookie usage -->
<ngx-cookie-banner #cookie>
<div class="copy" *ngIf="isBrowser">
<div class="row">
<div class="col-12 col-md-10">
<span [ishServerHtml]="'cookie_law.text' | translate: { '0': 'page://privacy.policy' }"></span>
</div>
<div class="col-12 col-md-2 button-container">
<button class="btn" type="button" (click)="cookie.dismiss()">{{ 'cookie_law.button' | translate }}</button>
</div>
</div>
</div>
</ngx-cookie-banner>
3 changes: 1 addition & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { MockComponent, MockDirective } from 'ng-mocks';
import { NgxCookieBannerModule } from 'ngx-cookie-banner';
import { instance, mock } from 'ts-mockito';

import { ServerHtmlDirective } from 'ish-core/directives/server-html.directive';
Expand All @@ -28,7 +27,7 @@ describe('App Component', () => {
MockComponent(HeaderComponent),
MockDirective(ServerHtmlDirective),
],
imports: [NgxCookieBannerModule.forRoot(), RouterTestingModule, TranslateModule.forRoot()],
imports: [RouterTestingModule, TranslateModule.forRoot()],
providers: [{ provide: AppFacade, useFactory: () => instance(mock(AppFacade)) }],
}).compileComponents();
});
Expand Down
32 changes: 3 additions & 29 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import { isPlatformBrowser } from '@angular/common';
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
Inject,
OnDestroy,
OnInit,
PLATFORM_ID,
ViewChild,
} from '@angular/core';
import { NgxCookieBannerComponent } from 'ngx-cookie-banner';
import { Observable, Subject, noop } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { ChangeDetectionStrategy, Component, Inject, OnInit, PLATFORM_ID, ViewChild } from '@angular/core';
import { Observable } from 'rxjs';

import { AppFacade } from 'ish-core/facades/app.facade';
import { DeviceType } from 'ish-core/models/viewtype/viewtype.types';
Expand All @@ -26,16 +15,12 @@ import { DeviceType } from 'ish-core/models/viewtype/viewtype.types';
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
export class AppComponent implements OnInit {
@ViewChild('cookie', { static: true })
banner: NgxCookieBannerComponent;

isBrowser: boolean;
wrapperClasses$: Observable<string[]>;
deviceType$: Observable<DeviceType>;

private destroy$ = new Subject();

constructor(private appFacade: AppFacade, @Inject(PLATFORM_ID) platformId: string) {
this.isBrowser = isPlatformBrowser(platformId);
}
Expand All @@ -44,15 +29,4 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
this.deviceType$ = this.appFacade.deviceType$;
this.wrapperClasses$ = this.appFacade.appWrapperClasses$;
}

ngAfterViewInit() {
// It is currently necessary to manually subscribe at this
// point to initialize the banner component.
this.banner.isSeen.pipe(takeUntil(this.destroy$)).subscribe(noop);
}

ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
}
6 changes: 1 addition & 5 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ErrorHandler, NgModule, Optional, SkipSelf } from '@angular/core';
import { ServiceWorkerModule } from '@angular/service-worker';
import { FormlyModule } from '@ngx-formly/core';
import { TranslateModule } from '@ngx-translate/core';
import { NgxCookieBannerModule } from 'ngx-cookie-banner';
import { BrowserCookiesModule } from 'ngx-utils-cookies-port';

import { environment } from '../../environments/environment';
Expand Down Expand Up @@ -33,9 +32,6 @@ import { ModuleLoaderService } from './utils/module-loader/module-loader.service
HttpClientModule,
IdentityProviderModule,
InternationalizationModule,
NgxCookieBannerModule.forRoot({
cookieName: 'cookieLawSeen',
}),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.serviceWorker }),
StateManagementModule,
],
Expand All @@ -55,7 +51,7 @@ import { ModuleLoaderService } from './utils/module-loader/module-loader.service
},
],
// exports needed to use the cookie banner in the AppComponent
exports: [NgxCookieBannerModule, TranslateModule],
exports: [TranslateModule],
})
export class CoreModule {
constructor(@Optional() @SkipSelf() parentModule: CoreModule, moduleLoader: ModuleLoaderService) {
Expand Down
2 changes: 0 additions & 2 deletions src/assets/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,6 @@
"common.button.spinning.label": "Wird hinzugefügt...",
"common.home.link": "Home",
"common.view_all.link": "Alle anzeigen",
"cookie_law.button": "Akzeptieren",
"cookie_law.text": "Diese Website verwendet Cookies, um Ihre Nutzung unserer Website zu verbessern. Detailliertere Informationen finden Sie in unserer <a href=\"{{0}}\">Datenschutzerklärung</a>.",
"customer.credentials.login.not_unique.error": "Die angegebene E-Mail-Adresse wird bereits verwendet. Prüfen Sie die Richtigkeit der Eingabe oder geben Sie eine andere E-Mail-Adresse an.",
"customer.credentials.passwordreset.invalid_password.error.PasswordExpressionViolation": "Das Kennwort muss mindestens 7 Zeichen enthalten, bestehend aus Zahlen und Buchstaben, keine Leerzeichen.",
"customer.missing_fields.error": "Fehlende Felder",
Expand Down
2 changes: 0 additions & 2 deletions src/assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,6 @@
"common.button.spinning.label": "Adding...",
"common.home.link": "Home",
"common.view_all.link": "View All",
"cookie_law.button": "Accept",
"cookie_law.text": "This website uses cookies to improve your experience on our site. More detailed information is provided in our <a href=\"{{0}}\">Privacy Policy</a>.",
"customer.credentials.login.not_unique.error": "A user with that e-mail address already exists. Please check the information for accuracy or enter a different e-mail address.",
"customer.credentials.passwordreset.invalid_password.error.PasswordExpressionViolation": "The password must include 7 characters minimum, containing numbers and letters, no spaces.",
"customer.missing_fields.error": "Missing fields",
Expand Down
2 changes: 0 additions & 2 deletions src/assets/i18n/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,6 @@
"common.button.spinning.label": "En train d’ajouter...",
"common.home.link": "Accueil",
"common.view_all.link": "Tout afficher",
"cookie_law.button": "Accepter",
"cookie_law.text": "Ce site Web utilise des cookies pour améliorer votre expérience sur notre site. Vous trouverez des informations plus détaillées dans notre <a href=\"{{0}}\">politique de confidentialité</a>.",
"customer.credentials.login.not_unique.error": "Un utilisateur avec cette adresse courriel existe déjà. Veuillez vérifier l’exactitude des informations ou entrer une adresse courriel différente.",
"customer.credentials.passwordreset.invalid_password.error.PasswordExpressionViolation": "Le mot de passe doit comporter un minimum de 7 caractères, comprenant des chiffres et des lettres, sans espaces.",
"customer.missing_fields.error": "Champs manquants",
Expand Down
1 change: 0 additions & 1 deletion src/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,3 @@
@import 'pages/productdetail/tacton';
@import 'pages/productdetail/product-images';
@import 'pages/productdetail/product-info';
@import 'plugins/cookie-banner';
52 changes: 0 additions & 52 deletions src/styles/plugins/cookie-banner.scss

This file was deleted.

0 comments on commit 38231c1

Please sign in to comment.