import { ChangeDetectionStrategy , ChangeDetectorRef , Component , ElementRef , ViewChild , } from '@angular/core' ; import { Router } from '@angular/router' ; import { fromEvent } from 'rxjs' ; import { AbstractSubscriberComponent } from '../../../../common/components/abstract-subscriber/abstract-subscriber.component' ; import { ConfigsService } from '../../../../common/services/configs.service' ; import { FormToastService } from '../../../../common/services/form-toast.service' ; import { Session } from '../../../../services/session' ; import { BlockchainMarketingLinksService } from './blockchain-marketing-links.service' ; /**
 * Multi-page tokens marketing component
 */ @ Component ( { selector : 'm-blockchainMarketing__token--v2' , templateUrl : 'token.component.html' , styleUrls : [ './token.component.ng.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class BlockchainMarketingTokenV2Component extends AbstractSubscriberComponent { public readonly cdnAssetsUrl : string ; public readonly siteUrl : string ; @ ViewChild ( 'topAnchor' ) readonly topAnchor : ElementRef ; @ ViewChild ( 'composerOpenAnchor' ) readonly composerOpenAnchor : ElementRef ; constructor ( protected router , protected cd , private linksService , private session , private toast , configs ) { super ( ) ; this . cdnAssetsUrl = configs . get ( 'cdn_assets_url' ) ; this . siteUrl = configs . get ( 'site_url' ) ; } ngAfterViewInit ( ) { this . subscriptions . push ( fromEvent ( this . composerOpenAnchor . nativeElement , 'click' ) . subscribe ( $event => { if ( ! this . session . isLoggedIn ( ) ) { this . router . navigate ( [ '/' ] ) ; return ; } this . openComposerModal ( ) ; } ) ) ; } scrollToTop ( ) { if ( this . topAnchor . nativeElement ) { this . topAnchor . nativeElement . scrollIntoView ( { behavior : 'smooth' , block : 'start' , inline : 'nearest' , } ) ; } } returns { void } public onPurchaseComplete ( $event ) { } returns { BlockchainMarketingTokenComponent } public openComposerModal ( ) { this . linksService . openComposerModal ( ) ; } returns { void } public provideLiquidityClick ( ) { this . linksService . openLiquidityProvisionModal ( ) ; } returns { void } public navigateToReferrals ( ) { this . linksService . navigateToReferrals ( ) ; } returns { void } public holdClick ( ) { this . linksService . openTransferOnchainModal ( ) ; } returns { void } public airdropClick ( ) { this . toast . warn ( 'Coming soon!' ) ; } detectChanges ( ) { this . cd . markForCheck ( ) ; this . cd . detectChanges ( ) ; } }