UNPKG

moh-common-lib

Version:

A library of Angular components, services, and styles for B.C. Government Ministry of Health (MoH).

122 lines (121 loc) 6.03 kB
import { EventEmitter, OnInit, AfterViewInit, ElementRef } from '@angular/core'; import { ModalDirective } from 'ngx-bootstrap/modal'; import { Observable } from 'rxjs'; import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; import { CommonLogger } from '../../services/logger.service'; import { AbstractHttpService } from '../../services/abstract-api-service'; import { ControlValueAccessor } from '@angular/forms'; /** * Consent Modal is a Modal with the Information or Notice. It can be used to get the User's consent an * then proceed with the application. It also makes an API call to the SPA-ENV server to see if the app is under * maintenance. * * * @example * <common-consent-modal #mspConsentModal body='Body Of Consent' * title='Notice' [application]="mspAccountApp" * processName='MSP' * agreeLabel='I have read and understand this info' * (onClose)="addressChangeChkBx.focus()"> * </common-consent-modal> * @export */ export interface ISpaEnvResponse { SPA_ENV_MSP_MAINTENANCE_FLAG: string; SPA_ENV_MSP_MAINTENANCE_MESSAGE: string; SPA_ENV_ACL_MAINTENANCE_FLAG: string; SPA_ENV_ACL_MAINTENANCE_MESSAGE: string; SPA_ENV_SUPPBEN_MAINTENANCE_FLAG: string; SPA_ENV_SUPPBEN_MAINTENANCE_MESSAGE: string; SPA_ENV_SUPPBEN_MAINTENANCE_START: string; SPA_ENV_SUPPBEN_MAINTENANCE_END: string; SPA_ENV_PACUTOFF_MAINTENANCE_FLAG: string; SPA_ENV_PACUTOFF_MAINTENANCE_MESSAGE: string; SPA_ENV_PACUTOFF_MAINTENANCE_START: string; SPA_ENV_NOW: string; SPA_ENV_PACUTOFF_MAINTENANCE_END: string; } /** * ConsentModalComponent, aka the "Information Collection Notice", is a modal * designed to be shown at the beginning of an application. It is a boilerplate * checkbox to consent to information collection. * * Currently this component requires the body to be manually set as a child * element (via transclusion) * * TODO - Set default body if none is passed in. * * @example * <common-consent-modal #consentModal [isUnderMaintenance]="false" * title="Information collection notice" * agreeLabel="I have read and understand this information" * processName="processName" * (accept)="accountLetterApplication.infoCollectionAgreement = $event; saveApplication($event)"> * <p><strong>Keep your personal information secure – especially when using a shared device like a computer at a library, school or café.</strong> To delete any information that was entered, either complete the application and submit it or, if you don’t finish, close the web browser.</p><p><strong>Need to take a break and come back later?</strong> The data you enter on this form is saved locally to the computer or device you are using until you close the web browser or submit your application.</p><p><strong>Information in this application is collected by the Ministry of Health</strong> under section 26(a), (c) and (e) of the Freedom of Information and Protection of Privacy Act and will be used to determine eligibility for provincial health care benefits in BC and administer Premium Assistance. Should you have any questions about the collection of this personal information please <a href="http://www2.gov.bc.ca/gov/content/health/health-drug-coverage/msp/bc-residents-contact-us" target="_blank">contact Health Insurance BC <i class="fa fa-external-link" aria-hidden="true"></i></a>.</p> * </common-consent-modal> * * * // Component code - Remove backticks when copying (necessary to render docs) * `@ViewChild('consentModal') consentModal: ConsentModalComponent` * ... * openModal(){ * this.consentModal.showFullSizeView(); * } */ export declare class ConsentModalComponent extends AbstractHttpService implements ControlValueAccessor, OnInit, AfterViewInit { protected http: HttpClient; private logService; protected _headers: HttpHeaders; processName: string; /** * If `isUnderMaintenance` is true, then this will automatically try and * make a request to the SPA ENV server to determine if it's in a * maintenance window. If your application determines this manually, leave * this alone. */ isUnderMaintenance: boolean; title: string; body: string; agreeLabel: string; continueButton: string; maintenanceFlag: string; url: string; fullSizeViewModal: ModalDirective; modalContents: ElementRef; continueButtonRef: ElementRef; close: EventEmitter<void>; cutOffDate: EventEmitter<ISpaEnvResponse>; accept: EventEmitter<boolean>; /** * Used in cases where we have custom form controls inside NgContent that we * wish to be satisifed before user can continue through modal. */ disableContinue: boolean; spaEnvRes: ISpaEnvResponse; maintenanceMessage: string; protected focusableEls: HTMLElement[]; protected focusedEl: HTMLElement; protected closed: boolean; private _applicationHeaderMap; agreeCheck: boolean; _onChange: (_: any) => void; _onTouched: () => void; constructor(http: HttpClient, logService: CommonLogger); ngOnInit(): void; ngAfterViewInit(): void; handleKeyDown(event: KeyboardEvent): void; sendSpaEnvServer(rapidResponseCode: string): Observable<any>; handleTab(): void; handleTabBackwards(): void; /** * Call this method to display the modal. */ showFullSizeView(): void; continue(): void; protected handleError(error: HttpErrorResponse): Observable<HttpErrorResponse>; inMaintenance(): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; writeValue(value: any): void; isContinueDisabled(): boolean; }