1 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
2 import { FormGroup } from '@angular/forms'
3 import { FormReactive, FormReactiveService } from '@app/shared/shared-forms'
4 import { REGISTER_REASON_VALIDATOR, REGISTER_TERMS_VALIDATOR } from '../shared'
7 selector: 'my-register-step-terms',
8 templateUrl: './register-step-terms.component.html',
9 styleUrls: [ './step.component.scss' ]
11 export class RegisterStepTermsComponent extends FormReactive implements OnInit {
12 @Input() hasCodeOfConduct = false
13 @Input() requiresApproval: boolean
14 @Input() minimumAge = 16
15 @Input() instanceName: string
17 @Output() formBuilt = new EventEmitter<FormGroup>()
18 @Output() termsClick = new EventEmitter<void>()
19 @Output() codeOfConductClick = new EventEmitter<void>()
22 protected formReactiveService: FormReactiveService
28 return window.location.host
33 terms: REGISTER_TERMS_VALIDATOR,
35 registrationReason: this.requiresApproval
36 ? REGISTER_REASON_VALIDATOR
40 setTimeout(() => this.formBuilt.emit(this.form))
43 onTermsClick (event: Event) {
44 event.preventDefault()
45 this.termsClick.emit()
48 onCodeOfConductClick (event: Event) {
49 event.preventDefault()
50 this.codeOfConductClick.emit()