UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

3 lines (2 loc) 1.31 kB
import{getUniqueId as t}from"../../../utils/idGenerator.js";function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}class i{static registerTooltipHandler(t){this.updateGlobalTooltip=t,this.registered=!0}static canRegisterTooltipHandler(){return!this.registered}static showTooltip(t){clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>this.updateGlobalTooltip({...t,visible:!0}),this.DEFAULT_TIMEOUT)}static hideTooltip(t){clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>this.updateGlobalTooltip({...t,visible:!1}),this.DEFAULT_TIMEOUT)}static reset(){this.registered=!1,this.updateGlobalTooltip=()=>{},this.notifyPrimaryReset()}static notifyPrimaryReset(){this.eventTarget.dispatchEvent(new Event(i.PRIMARY_TOOLTIP_RESET_EVENT))}static onPrimaryReset(t){return this.eventTarget.addEventListener(i.PRIMARY_TOOLTIP_RESET_EVENT,t),()=>this.eventTarget.removeEventListener(i.PRIMARY_TOOLTIP_RESET_EVENT,t)}}e(i,"tooltipId",t("adyen-checkout-tooltip")),e(i,"DEFAULT_TIMEOUT",100),e(i,"PRIMARY_TOOLTIP_RESET_EVENT","primary-tooltip-reset"),e(i,"timeoutId",null),e(i,"registered",!1),e(i,"updateGlobalTooltip",()=>{}),e(i,"eventTarget",new EventTarget);export{i as TooltipController}; //# sourceMappingURL=TooltipController.js.map