Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc67dd0

Browse filesBrowse files
committed
RXJS 6 migration without rxjs-compat (aviabird#151)
* optimsations with rxjx 6 upgrade * firebase optimisations
1 parent 939ba24 commit cc67dd0
Copy full SHA for cc67dd0

50 files changed

+713-569Lines changed: 713 additions & 569 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎firebase.json‎

Copy file name to clipboardExpand all lines: firebase.json
+48-1Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,56 @@
66
"source": "**",
77
"destination": "/index.html"
88
}
9+
],
10+
"headers": [
11+
{
12+
"source": "**/*",
13+
"headers": [
14+
{
15+
"key": "Content-Security-Policy",
16+
"value": "script-src 'self' 'nonce-2726c7f26c' www.googletagmanager.com cdnjs.cloudflare.com www.google-analytics.com"
17+
},
18+
{
19+
"key": "X-Frame-Options",
20+
"value": "SAMEORIGIN"
21+
},
22+
{
23+
"key": "X-XSS-Protection",
24+
"value": "1; mode=block"
25+
}
26+
]
27+
},
28+
{
29+
"source": "**/*.@(jpg|jpeg|gif|png|svg)",
30+
"headers": [
31+
{
32+
"key": "Cache-Control",
33+
"value": "max-age=2592000"
34+
}
35+
]
36+
},
37+
{
38+
"source": "**/*.@(js|css)",
39+
"headers": [
40+
{
41+
"key": "Cache-Control",
42+
"value": "max-age=691200"
43+
}
44+
]
45+
},
46+
{
47+
// Sets the cache header for 404 pages to cache for 5 minutes
48+
"source": "404.html",
49+
"headers": [
50+
{
51+
"key": "Cache-Control",
52+
"value": "max-age=300"
53+
}
54+
]
55+
}
956
]
1057
},
1158
"database": {
1259
"rules": "database.rules.json"
1360
}
14-
}
61+
}
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+28-28Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,42 @@
2424
},
2525
"private": true,
2626
"dependencies": {
27-
"@angular/animations": "^6.0.0",
28-
"@angular/common": "^6.0.0",
29-
"@angular/compiler": "^6.0.0",
30-
"@angular/core": "^6.0.0",
31-
"@angular/forms": "^6.0.0",
32-
"@angular/http": "^6.0.0",
33-
"@angular/platform-browser": "^6.0.0",
34-
"@angular/platform-browser-dynamic": "^6.0.0",
35-
"@angular/router": "^6.0.0",
27+
"@angular/animations": "^6.0.3",
28+
"@angular/common": "^6.0.3",
29+
"@angular/compiler": "^6.0.3",
30+
"@angular/core": "^6.0.3",
31+
"@angular/forms": "^6.0.3",
32+
"@angular/http": "^6.0.3",
33+
"@angular/platform-browser": "^6.0.3",
34+
"@angular/platform-browser-dynamic": "^6.0.3",
35+
"@angular/router": "^6.0.3",
3636
"@ngrx/core": "^1.2.0",
37-
"@ngrx/effects": "^6.0.0-beta.1",
38-
"@ngrx/router-store": "^6.0.0-beta.1",
39-
"@ngrx/store": "^6.0.0-beta.1",
37+
"@ngrx/effects": "^6.0.1",
38+
"@ngrx/router-store": "^6.0.1",
39+
"@ngrx/store": "^6.0.1",
40+
"@ngx-progressbar/core": "^5.0.1",
41+
"@ngx-progressbar/http": "^5.0.1",
4042
"bootstrap": "^4.1.1",
41-
"core-js": "^2.5.4",
43+
"core-js": "^2.5.7",
4244
"font-awesome": "^4.7.0",
43-
"immutable": "^3.8.1",
44-
"ng2-ui-auth": "^8.0.1",
45-
"ngx-bootstrap": "^2.0.4",
46-
"ngx-drag-scroll": "^1.7.7",
47-
"reselect": "^2.5.4",
48-
"rxjs": "6",
49-
"rxjs-compat": "6",
45+
"immutable": "^3.8.2",
46+
"ng2-ui-auth": "^9.0.0-beta.2",
47+
"ngx-bootstrap": "^3.0.0",
48+
"ngx-drag-scroll": "^1.8.0",
49+
"ngx-toastr": "^8.7.3",
50+
"reselect": "^3.0.1",
51+
"rxjs": "^6.2.0",
5052
"webpack-bundle-analyzer": "^2.11.1",
5153
"zone.js": "^0.8.24"
5254
},
5355
"devDependencies": {
5456
"@angular-devkit/build-angular": "~0.5.0",
55-
"@angular/cli": "~6.0.0",
56-
"@angular/compiler-cli": "^6.0.0",
57-
"@angular/language-service": "^6.0.0",
57+
"@angular/cli": "^6.0.7",
58+
"@angular/compiler-cli": "^6.0.3",
59+
"@angular/language-service": "^6.0.3",
5860
"@angularclass/hmr": "^1.2.2",
59-
"@compodoc/compodoc": "^1.0.0-beta.8",
60-
"@ngrx/store-devtools": "^6.0.0-beta.1",
61+
"@compodoc/compodoc": "^1.1.3",
62+
"@ngrx/store-devtools": "^6.0.1",
6163
"@types/grecaptcha": "^2.0.31",
6264
"@types/jasmine": "~2.8.6",
6365
"@types/jasminewd2": "~2.0.3",
@@ -72,10 +74,8 @@
7274
"karma-coverage-istanbul-reporter": "~1.4.2",
7375
"karma-jasmine": "~1.1.1",
7476
"karma-jasmine-html-reporter": "^0.2.2",
75-
"ng2-toasty": "^4.0.3",
7677
"ngrx-store-freeze": "0.2.2",
77-
"ngx-progressbar": "^2.1.1",
78-
"node-sass": "^4.8.3",
78+
"node-sass": "^4.9.0",
7979
"nswag": "10.6.0",
8080
"protractor": "~5.3.0",
8181
"sass-loader": "^7.0.1",
Collapse file

‎src/app/app.component.html‎

Copy file name to clipboardExpand all lines: src/app/app.component.html
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div class="selected-theme">
22
<section>
3-
<ng-progress [speed]="200" [color]="'#fc6fb1'" [showSpinner]="false" [ease]="'easeOutQuad'" [trickleSpeed]="250"></ng-progress>
4-
<ng2-toasty [position]="'top-right'"></ng2-toasty>
3+
<ng-progress [color]="'red'" [spinner]="false"></ng-progress>
54

65
<app-header *ngIf="currentUrl && !isCheckoutRoute()"></app-header>
76
<app-checkout-header [currentStep]="currentStep" *ngIf="currentUrl && isCheckoutRoute()"></app-checkout-header>
Collapse file

‎src/app/app.component.ts‎

Copy file name to clipboardExpand all lines: src/app/app.component.ts
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { filter } from 'rxjs/operators';
12
import { getAuthStatus } from './auth/reducers/selectors';
23
import { AppState } from './interfaces';
34
import { Store } from '@ngrx/store';
4-
import { Subscription } from 'rxjs/Subscription';
5+
import { Subscription } from 'rxjs';
56
import { CheckoutService } from './core/services/checkout.service';
67
import { Component, OnInit, OnDestroy } from '@angular/core';
78
import { Router, NavigationEnd } from '@angular/router';
@@ -21,10 +22,9 @@ export class AppComponent implements OnInit, OnDestroy {
2122
private router: Router,
2223
private checkoutService: CheckoutService,
2324
private store: Store<AppState>
24-
) {
25-
router
26-
.events
27-
.filter(e => e instanceof NavigationEnd)
25+
) {
26+
router.events
27+
.pipe(filter(e => e instanceof NavigationEnd))
2828
.subscribe((e: NavigationEnd) => {
2929
this.currentUrl = e.url;
3030
this.findCurrentStep(this.currentUrl);
@@ -33,11 +33,9 @@ export class AppComponent implements OnInit, OnDestroy {
3333
}
3434

3535
ngOnInit() {
36-
this.store.select(getAuthStatus).
37-
subscribe(() => {
38-
this.orderSub$ = this.checkoutService.fetchCurrentOrder()
39-
.subscribe();
40-
});
36+
this.store.select(getAuthStatus).subscribe(() => {
37+
this.orderSub$ = this.checkoutService.fetchCurrentOrder().subscribe();
38+
});
4139
}
4240

4341
isCheckoutRoute() {
@@ -61,5 +59,4 @@ export class AppComponent implements OnInit, OnDestroy {
6159
ngOnDestroy() {
6260
this.orderSub$.unsubscribe();
6361
}
64-
6562
}
Collapse file

‎src/app/app.module.ts‎

Copy file name to clipboardExpand all lines: src/app/app.module.ts
+11-13Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,18 @@ import { CheckoutHeaderComponent } from './layout/checkout-header/checkout-heade
2525
import { CheckoutFooterComponent } from './layout/checkout-footer/checkout-footer.component';
2626
import { DragScrollModule } from 'ngx-drag-scroll';
2727
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
28-
// adding rx operators
29-
import 'rxjs/add/operator/map';
30-
import 'rxjs/add/operator/filter';
31-
import 'rxjs/add/operator/switchMap';
32-
import 'rxjs/add/operator/catch';
33-
import 'rxjs/add/operator/do';
34-
import 'rxjs/add/operator/finally';
35-
import 'rxjs/add/observable/of';
28+
import { ToastrModule } from 'ngx-toastr';
3629

3730
@NgModule({
3831
declarations: [
3932
AppComponent,
4033
CheckoutHeaderComponent,
41-
CheckoutFooterComponent,
34+
CheckoutFooterComponent
4235
],
4336
imports: [
4437
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }),
4538
StoreModule.forRoot(reducers, { metaReducers }),
4639

47-
4840
/**
4941
* Store devtools instrument the store retaining past versions of state
5042
* and recalculating new states. This enables powerful time-travel
@@ -73,11 +65,17 @@ import 'rxjs/add/observable/of';
7365
LayoutModule,
7466
Ng2UiAuthModule.forRoot(myAuthConfig),
7567
DragScrollModule,
68+
ToastrModule.forRoot({
69+
timeOut: 3000,
70+
positionClass: 'toast-top-right',
71+
preventDuplicates: true,
72+
progressBar: true,
73+
progressAnimation: 'increasing'
74+
}),
7675
CoreModule,
77-
SharedModule,
78-
76+
SharedModule
7977
],
8078
providers: [],
8179
bootstrap: [AppComponent]
8280
})
83-
export class AppModule { }
81+
export class AppModule {}
Collapse file

‎src/app/auth/components/forget-password/forget-password.component.ts‎

Copy file name to clipboardExpand all lines: src/app/auth/components/forget-password/forget-password.component.ts
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
2+
import {tap} from 'rxjs/operators';
13
import { AuthService } from './../../../core/services/auth.service';
24
import { AuthActions } from './../../actions/auth.actions';
35
import { ActivatedRoute, Router } from '@angular/router';
46
import { Store } from '@ngrx/store';
57
import { AppState } from './../../../interfaces';
6-
import { Subscription } from 'rxjs/Subscription';
8+
import { Subscription } from 'rxjs';
79
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
810
import { Component, OnInit, OnDestroy } from '@angular/core';
911

@@ -40,16 +42,16 @@ export class ForgetPasswordComponent implements OnInit, OnDestroy {
4042

4143
if (this.forgetPasswordForm.valid) {
4244
this.forgetPasswordSubs = this.authService
43-
.forgetPassword(values)
44-
.do(_ => {
45+
.forgetPassword(values).pipe(
46+
tap(_ => {
4547
this.emailSent = true,
4648
this.sentEmail = values.email
4749
}, (user) => {
4850
const errors = user.error.error || 'Something went wrong';
4951
keys.forEach(val => {
5052
this.pushErrorFor(val, errors);
5153
});
52-
}).subscribe();
54+
})).subscribe();
5355
} else {
5456
keys.forEach(val => {
5557
const ctrl = this.forgetPasswordForm.controls[val];
Collapse file

‎src/app/auth/components/login/login.component.ts‎

Copy file name to clipboardExpand all lines: src/app/auth/components/login/login.component.ts
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
import {tap} from 'rxjs/operators';
13
import { AuthActions } from './../../actions/auth.actions';
24
import { Component, OnInit, OnDestroy } from '@angular/core';
35
import { environment } from '../../../../environments/environment';
@@ -7,7 +9,7 @@ import { Store } from '@ngrx/store';
79
import { AppState } from '../../../interfaces';
810
import { Router, ActivatedRoute } from '@angular/router';
911
import { getAuthStatus } from '../../reducers/selectors';
10-
import { Subscription } from 'rxjs/Subscription';
12+
import { Subscription } from 'rxjs';
1113

1214
@Component({
1315
selector: 'app-login',
@@ -43,13 +45,13 @@ export class LoginComponent implements OnInit, OnDestroy {
4345

4446
if (this.signInForm.valid) {
4547
this.loginSubs = this.authService
46-
.login(values)
47-
.do(_ => _, (user) => {
48+
.login(values).pipe(
49+
tap(_ => _, (user) => {
4850
const errors = user.error.error || 'Something went wrong';
4951
keys.forEach(val => {
5052
this.pushErrorFor(val, errors);
5153
});
52-
}).subscribe();
54+
})).subscribe();
5355
} else {
5456
keys.forEach(val => {
5557
const ctrl = this.signInForm.controls[val];
Collapse file

‎src/app/auth/components/sign-up/sign-up.component.ts‎

Copy file name to clipboardExpand all lines: src/app/auth/components/sign-up/sign-up.component.ts
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
import {tap} from 'rxjs/operators';
13
import { Component, OnInit, OnDestroy } from '@angular/core';
24
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
35
import { environment } from '../../../../environments/environment';
@@ -6,7 +8,7 @@ import { AppState } from '../../../interfaces';
68
import { Router } from '@angular/router';
79
import { AuthService } from '../../../core/services/auth.service';
810
import { getAuthStatus } from '../../reducers/selectors';
9-
import { Subscription } from 'rxjs/Subscription';
11+
import { Subscription } from 'rxjs';
1012
import { AuthActions } from '../../actions/auth.actions';
1113

1214
@Component({
@@ -41,13 +43,13 @@ export class SignUpComponent implements OnInit, OnDestroy {
4143

4244
if (this.signUpForm.valid) {
4345
this.registerSubs = this.authService
44-
.register(values)
45-
.do(_ => _, (user) => {
46+
.register(values).pipe(
47+
tap(_ => _, (user) => {
4648
const errors = user.error.errors || {};
4749
keys.forEach(val => {
4850
if (errors[val]) { this.pushErrorFor(val, errors[val][0]); };
4951
});
50-
}).subscribe();
52+
})).subscribe();
5153
} else {
5254
keys.forEach(val => {
5355
const ctrl = this.signUpForm.controls[val];
Collapse file

‎src/app/auth/components/update-password/update-password.component.ts‎

Copy file name to clipboardExpand all lines: src/app/auth/components/update-password/update-password.component.ts
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
2+
import {tap} from 'rxjs/operators';
13
import { AuthService } from './../../../core/services/auth.service';
24
import { AuthActions } from './../../actions/auth.actions';
35
import { ActivatedRoute, Router } from '@angular/router';
46
import { AppState } from './../../../interfaces';
57
import { Store } from '@ngrx/store';
6-
import { Subscription } from 'rxjs/Subscription';
8+
import { Subscription } from 'rxjs';
79
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
810
import { Component, OnInit } from '@angular/core';
911

@@ -45,13 +47,13 @@ export class UpdatePasswordComponent implements OnInit {
4547

4648
if (this.updatePasswordForm.valid) {
4749
this.updatePasswordSubs = this.authService
48-
.updatePassword(values)
49-
.do(_ => this.passwordReset = true, (user) => {
50+
.updatePassword(values).pipe(
51+
tap(_ => this.passwordReset = true, (user) => {
5052
const errors = user.error.error || 'Something went wrong';
5153
keys.forEach(val => {
5254
this.pushErrorFor(val, errors);
5355
});
54-
}).subscribe();
56+
})).subscribe();
5557
} else {
5658
keys.forEach(val => {
5759
const ctrl = this.updatePasswordForm.controls[val];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.