Entities references

Action

/** Supported action types.
 */
enum ActionType {
  Accept = 'accept',
  Reject = 'reject',
  Unselected = 'unselected',
}

/** A consent Action represents a single input from a Subject.
 *
 * In the Cookie Consent flow, it might be opt-in/opt-out actions on a specific cookie.
 *
 * The Action is performed on a {@link target} object, which belongs to a {@link vendor}.
 */
type Action = {
  /** Target object of this Action. */
  target: string
  /** Vendor that owns the target object. */
  vendor: string
  /** Type of action performed on the target object. */
  action: ActionType
}

ActionWithConsent

import { ActionType } from './Action'

/**
 * Represents a consent and its included actions.
 */
type ActionWithConsent = {
  /** Target object of this Action. */
  target: string
  /** Vendor that owns the target object. */
  vendor: string
  /** Type of action performed on the target object. */
  action: ActionType
  /** Consent Id. */
  consentId: string
  /** Channel Id. */
  channelId: string
  /** Creation Date of this consent.*/
  createdAt: Date
}

Attribute

/**
 * This type defines possible attributes to be configured by channel
 */
type Attribute = {
  name: string
  type: string
  jsonFieldName: string
}

AuthorizationConfig

/** This type defines the configuration required by the function [getToken] of [WireWheelSDK] to work.
 */
type AuthorizationConfig = {
  /** URL of authorization services provider */
  issuer: string
  /** The client_id is the public identifier of your app */
  clientId: string
  /** The client_secret is a secret known only to the application and the authorization server. */
  clientSecret: string
  /** The Cognito resource server name */
  resourceServerName: string
}

Channel

type Channel = {
  id: string
  brandId: string
  name: string
  description: string
  attributes: Attribute[]
  tags: string[]
  collection?: Collection
  createdAt: Date
}

ClientConfig

/**
 * This type defines the configuration required by a WireWheelClient to work.
 */
type ClientConfig = {
  /** Token with authorization to execute call to the Core API */
  token: string
  /** WireWheel's UPCP API URL */
  apiUrl: string
  /** Set a country code for the client instance */
  overrideCountryCode?: string
  /** Set a region code for the client instance */
  overrideRegionCode?: string
  /** Overrides the default configuration of the cookies*/
  cookieConfig?: {
    /** Amount of days in the future when the cookie expiration will be set */
    expirationInDays?: number
    /** Whether the expiration date should be refreshed on a new visit */
    refreshOnVisit?: boolean
  }
}

EmbeddedConfig

/** Defines the configuration to initialize the embedded rendering mode.
 */
type EmbeddedConfig = {
  /* A DOM iframe where the target child is rendered */
  targetIframe: HTMLIFrameElement
  cookieConfig?: {
    /** Amount of days in the future when the cookie expiration will be set */
    expirationInDays?: number
    /** Whether the expiration date should be refreshed on a new visit */
    refreshOnVisit?: boolean
  }
}

Collection

type Collection = {
  id: string
  name: string
  consents: Consent[]
  preferences: Preference[]
}

Conflict

/** A Conflict represents a collision between Actions across channels.
 */
import { ActionWithConsent } from './ActionWithConsent'

type Conflict = {
  /** Type represents the classification why exists some conflict with the consents */
  type: string
  /** Resolution represents the action taken to resolve the conflict */
  resolution: string
  /** List of actions in conflict */
  actionsInConflict: ActionWithConsent[]
}
type Consent = {
  id: string
  categories: string[]
  enabled: boolean
  title: string
  description: string
  target: string
  defaultAction: string
  acceptWording: string
  rejectWording: string
}

CreateConsentPayload

{
  subject: Subject
  actions: Action[]
  attributes?: any
  tags?: string[]
  compliance?: {
    privacyPolicy?: {
      version?: string
      url: string
    },
    gpc?: 1
  }
  // A country two letter ISO code. Defaults to the resolved country via IP if not provided
  overrideCountryCode?: string
  // A two letter ISO code for state, only US supported. Defaults to the resolved region via IP if not provided
  overrideRegionCode?: string
}

Preference

type Preference = {
  id: string
  categories: string[]
  enabled: boolean
  title: string
  description: string
  target: string
  defaultAction: ActionType
  acceptWording: string
  rejectWording: string
}

PrivacyProtocolsConfig

/**
 * This type defines the configuration required to register the privacy protocols.
 */
type PrivacyProtocolsConfig = {
  /** WireWheel's UPCP API URL */
  apiUrl: string
  /** Write only api key */
  apiKey: string
  /** Gpc attributes */
  attributes?: Record<string, any>
  /** Cookie-related config */
  cookieConfig?: {
    /** Amount of days in the future when the cookie expiration will be set */
    expirationInDays?: number
    /** Whether the expiration date should be refreshed on a new visit */
    refreshOnVisit?: boolean
  }
}

Scopes

An array of scopes can be used to generate access tokens with more or less permissions based on the actions needed to perform

enum Scopes {
  ConsentWrite = 'consent-insert-api',
  ConsentRead = 'consent-get-api',
  SubjectProfileManage = 'subject-profile-manage',
}

Subject

A subject in the system. It can have either an anonymousId or a verifiedId. If it is a verified subject, it can contain a profile

type Subject = {
  verifiedId?: string
  anonymousId?: string
  profile?: {
    email: string
    firstName?: string
    lastName?: string
  }
}

UnifiedConsent

type UnifiedConsent = {
  /** Subject Id. */
  subjectId: string
  /** Brand Id. */
  brandId: string
  /** Region of subject. */
  region: string
  /** List of Actions of consent. */
  actions: Action[]
  /** Attributes of consent. */
  attributes: { [key: string]: any }
}

MessageType

Supported event types

enum MessageType {
  LOGIN = 'login',
  LOGOUT = 'logout',
  CONSENT_WRITE = 'consent:write',
}

MessageListener

Callback to execute when an event is received

type MessageListener = (message: Message) => void

Message

type Message = {
  type: MessageType
  data: any
}
Last Updated:
Contributors: shaqosano