Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Consents

This class keeps track of all granted or denied consents of a user.

There are two different types of consents:

  • Consents for common features like if we're allowed to evaluate the locale or a user agent.
  • Consents per measurement campaign.

The time of the consent is recorded along with it's state: If it was actually granted or denied.

Consents for common features are given indefinitely, since they are only ever recorded along with running campaigns.

Consents for campaigns only last for a certain amount of days.

Hierarchy

  • Consents

Index

Constructors

constructor

  • new Consents(json?: { campaigns: ConsentsMap; features: ConsentsMap }): Consents
  • Parameters

    • Optional json: { campaigns: ConsentsMap; features: ConsentsMap }

      Optional data from JSON deserialization to assign.

      • campaigns: ConsentsMap
      • features: ConsentsMap

    Returns Consents

Properties

campaigns

campaigns: {} = {}

Type declaration

features

features: {} = {}

Type declaration

Methods

denyCampaign

  • denyCampaign(campaignId: string): CampaignConsent
  • User denies consent to run a specific campaign.

    Parameters

    • campaignId: string

    Returns CampaignConsent

denyFeature

  • denyFeature(feature: Feature): FeatureConsent
  • User denies consent to evaluate a Feature.

    Parameters

    Returns FeatureConsent

grantCampaign

  • grantCampaign(campaignId: string, campaign: Campaign): CampaignConsent
  • User consents to run a specific campaign.

    Parameters

    • campaignId: string
       The campaign ID.
      
    • campaign: Campaign
       The campaign.
      

    Returns CampaignConsent

grantFeature

  • grantFeature(feature: Feature): FeatureConsent
  • User consents to evaluate a Feature.

    Parameters

    Returns FeatureConsent

hasBeenGranted

  • hasBeenGranted(feature: Feature): boolean
  • Parameters

    Returns boolean

    if consent to a Feature was given.

isCampaignCurrentlyGranted

  • isCampaignCurrentlyGranted(campaignId: string): boolean
  • returns:

    {boolean} if consent to run a campaign was given and is now valid.

    Parameters

    • campaignId: string

    Returns boolean

isCampaignGranted

  • isCampaignGranted(campaignId: string, start: Dayjs, end: Dayjs): boolean
  • Parameters

    • campaignId: string
    • start: Dayjs
    • end: Dayjs

    Returns boolean

    if consent to run a campaign was given and is valid for the given period.

Generated using TypeDoc