|
@ -1,13 +1,24 @@ |
|
|
import { publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
import { publicRoutes } from '@ghostfolio/common/routes/routes'; |
|
|
|
|
|
import { GfMembershipCardComponent } from '@ghostfolio/ui/membership-card'; |
|
|
|
|
|
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; |
|
|
|
|
|
|
|
|
|
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { |
|
|
import { |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectorRef, |
|
|
ChangeDetectorRef, |
|
|
Component, |
|
|
Component, |
|
|
|
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
Inject, |
|
|
Inject, |
|
|
OnInit |
|
|
OnInit |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
|
|
import { |
|
|
|
|
|
MAT_DIALOG_DATA, |
|
|
|
|
|
MatDialogModule, |
|
|
|
|
|
MatDialogRef |
|
|
|
|
|
} from '@angular/material/dialog'; |
|
|
|
|
|
import { RouterModule } from '@angular/router'; |
|
|
|
|
|
import { IonIcon } from '@ionic/angular/standalone'; |
|
|
import { addIcons } from 'ionicons'; |
|
|
import { addIcons } from 'ionicons'; |
|
|
import { arrowForwardOutline, checkmarkCircleOutline } from 'ionicons/icons'; |
|
|
import { arrowForwardOutline, checkmarkCircleOutline } from 'ionicons/icons'; |
|
|
import ms from 'ms'; |
|
|
import ms from 'ms'; |
|
@ -19,17 +30,26 @@ import { SubscriptionInterstitialDialogParams } from './interfaces/interfaces'; |
|
|
@Component({ |
|
|
@Component({ |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
changeDetection: ChangeDetectionStrategy.OnPush, |
|
|
host: { class: 'd-flex flex-column flex-grow-1 h-100' }, |
|
|
host: { class: 'd-flex flex-column flex-grow-1 h-100' }, |
|
|
|
|
|
imports: [ |
|
|
|
|
|
CommonModule, |
|
|
|
|
|
GfMembershipCardComponent, |
|
|
|
|
|
GfPremiumIndicatorComponent, |
|
|
|
|
|
IonIcon, |
|
|
|
|
|
MatButtonModule, |
|
|
|
|
|
MatDialogModule, |
|
|
|
|
|
RouterModule |
|
|
|
|
|
], |
|
|
|
|
|
schemas: [CUSTOM_ELEMENTS_SCHEMA], |
|
|
selector: 'gf-subscription-interstitial-dialog', |
|
|
selector: 'gf-subscription-interstitial-dialog', |
|
|
styleUrls: ['./subscription-interstitial-dialog.scss'], |
|
|
styleUrls: ['./subscription-interstitial-dialog.scss'], |
|
|
templateUrl: 'subscription-interstitial-dialog.html', |
|
|
templateUrl: 'subscription-interstitial-dialog.html' |
|
|
standalone: false |
|
|
|
|
|
}) |
|
|
}) |
|
|
export class SubscriptionInterstitialDialog implements OnInit { |
|
|
export class GfSubscriptionInterstitialDialogComponent implements OnInit { |
|
|
private static readonly SKIP_BUTTON_DELAY_IN_SECONDS = 5; |
|
|
private static readonly SKIP_BUTTON_DELAY_IN_SECONDS = 5; |
|
|
private static readonly VARIANTS_COUNT = 4; |
|
|
private static readonly VARIANTS_COUNT = 4; |
|
|
|
|
|
|
|
|
public remainingSkipButtonDelay = |
|
|
public remainingSkipButtonDelay = |
|
|
SubscriptionInterstitialDialog.SKIP_BUTTON_DELAY_IN_SECONDS; |
|
|
GfSubscriptionInterstitialDialogComponent.SKIP_BUTTON_DELAY_IN_SECONDS; |
|
|
public routerLinkPricing = publicRoutes.pricing.routerLink; |
|
|
public routerLinkPricing = publicRoutes.pricing.routerLink; |
|
|
public variantIndex: number; |
|
|
public variantIndex: number; |
|
|
|
|
|
|
|
@ -38,10 +58,10 @@ export class SubscriptionInterstitialDialog implements OnInit { |
|
|
public constructor( |
|
|
public constructor( |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
private changeDetectorRef: ChangeDetectorRef, |
|
|
@Inject(MAT_DIALOG_DATA) public data: SubscriptionInterstitialDialogParams, |
|
|
@Inject(MAT_DIALOG_DATA) public data: SubscriptionInterstitialDialogParams, |
|
|
public dialogRef: MatDialogRef<SubscriptionInterstitialDialog> |
|
|
public dialogRef: MatDialogRef<GfSubscriptionInterstitialDialogComponent> |
|
|
) { |
|
|
) { |
|
|
this.variantIndex = Math.floor( |
|
|
this.variantIndex = Math.floor( |
|
|
Math.random() * SubscriptionInterstitialDialog.VARIANTS_COUNT |
|
|
Math.random() * GfSubscriptionInterstitialDialogComponent.VARIANTS_COUNT |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
addIcons({ arrowForwardOutline, checkmarkCircleOutline }); |
|
|
addIcons({ arrowForwardOutline, checkmarkCircleOutline }); |
|
@ -50,7 +70,9 @@ export class SubscriptionInterstitialDialog implements OnInit { |
|
|
public ngOnInit() { |
|
|
public ngOnInit() { |
|
|
interval(ms('1 second')) |
|
|
interval(ms('1 second')) |
|
|
.pipe( |
|
|
.pipe( |
|
|
take(SubscriptionInterstitialDialog.SKIP_BUTTON_DELAY_IN_SECONDS), |
|
|
take( |
|
|
|
|
|
GfSubscriptionInterstitialDialogComponent.SKIP_BUTTON_DELAY_IN_SECONDS |
|
|
|
|
|
), |
|
|
tap(() => { |
|
|
tap(() => { |
|
|
this.remainingSkipButtonDelay--; |
|
|
this.remainingSkipButtonDelay--; |
|
|
|
|
|
|
|
|