Opens a layer if the user hasn't agreed to the terms yet. The user is considered to have agreed to the terms when the given "cookie" is set or the user has agreed prior to the same "identifier".

The layer is positioned "absolute" while spanning over the area.

Call "getDecision()" to open the layer if the user hasn't made a decision yet.

Slots:

  • default: the content of the layer (terms)

Properties

agreed: boolean

Contains the decision of the user.

Can be used to set a disagreed decision to an agreed decision. A manually changed decision is not saved in the session storage.

buttonAgreeClass: string = ''

Classes added to the button wrapped by the "agree to cookies" hylo-button.

buttonDisagreeClass: string = ''

Classes added to the button wrapped by the "disagree to cookies" hylo-button.

buttonsWrapperClass: string = ''

Classes added to the wrapper of the cookies buttons.

cookie: string

Name of a cookie which will be checked whether it is set or not. The decision layer will only appear if the cookie is not set. The cookie is considered to be set when its value is "1".

dontListenToBanner: boolean

By default the component listens to the hyloCookieBannerSaved event of the hylo-cookie-banner component. It updates itself when the event got fired. This setting disables the behavior.

hyloButtonAgreeClass: string = ''

Classes added to the "agree to cookies" hylo-button.

hyloButtonDisagreeClass: string = ''

Classes added to the "disagree to cookies" hylo-button.

hyloButtonDisagreeHide: boolean

Hides the "disagree to cookies" button.

identifier: string

A unique identifier under which the user's decision is saved in the session storage. The decision layer will only appear if the user has not agreed yet. The user's decision is considered not agreed if the "cookie" is not set and the identifier is not set to be agreed in the session storage.

textAgree: string

Text of the "agree to cookies" button.

textDisagree: string

Text of the "disagree to cookies" button.

Methods

  • Closes the layer.

    Returns Promise<void>

  • The returned promise resolves with the user decision. Opens the decision layer if the user hasn't agreed yet, either through the "cookie" setting or a prior decision with the same "identifier".

    Parameters

    • always: boolean = false

      opens the decision layer always

    Returns Promise<boolean>

  • Sets the decision. Triggers the promise which got created by the last "getDecision()" call.

    Is only applied if the layer is open/visible/active, unless the force parameter is set.

    Parameters

    • decision: boolean

      the decision to be set

    • force: boolean = false

      set the decision, even when the layer is not visible/open

    Returns Promise<void>

  • Checks the current status of the "cookie" and the "identifier" and sets "agreed" accordingly.

    If agreed and the layer is showing, it hides the layer. If agreed and a getDecision promise is not resolved yet, it resolves it.

    Returns Promise<void>

Events

hyloCookieLayer: EventEmitter<{
    agreed: boolean;
    identifier: string;
}>

Fires after the user made a decision. Other hylo-cookie-layer components are listening to the event and update themselves if the "identifier" fits.

Type declaration

  • agreed: boolean
  • identifier: string

Generated using TypeDoc