{"version":3,"file":"wirewheel-sdk.cjs","sources":["../lib/src/entities/Action.ts","../lib/src/errors/UnauthorizedError.ts","../lib/src/errors/BadRequestError.ts","../lib/src/errors/NotFoundError.ts","../lib/src/errors/UnexpectedError.ts","../lib/src/HttpClient.ts","../lib/src/entities/Subject.ts","../lib/src/errors/ValidationError.ts","../lib/src/utils/isBrowser.ts","../lib/src/modules/PersistentStore.ts","../node_modules/js-cookie/dist/js.cookie.mjs","../lib/src/modules/CookiePersistentStore.ts","../lib/src/modules/MemoryStore.ts","../lib/src/modules/PersistentStoreFactory.ts","../lib/src/WireWheelClient.ts","../lib/src/PrivacyProtocolsClient.ts","../lib/src/utils/isChildWindow.ts","../lib/src/entities/MessageType.ts","../lib/src/modules/MessageService.ts","../lib/src/WireWheelSDK.ts","../lib/src/EmbeddedHandler.ts","../lib/src/utils/tokenCache.ts","../lib/src/utils/convertToBase64.ts"],"sourcesContent":["/** Supported action types.\n */\nexport enum ActionType {\n  Accept = 'accept',\n  Reject = 'reject',\n  Unselected = 'unselected',\n}\n\n/** A consent Action represents a single input from a Subject.\n *\n * In the Cookie Consent flow, it might be opt-in/opt-out actions on a specific cookie.\n *\n * The Action is performed on a {@link target} object, which belongs to a {@link vendor}.\n */\nexport type Action = {\n  /** Target object of this Action. */\n  target: string\n  /** Vendor that owns the target object. */\n  vendor: string\n  /** Type of action performed on the target object. */\n  action: ActionType\n}\n","export class UnauthorizedError extends Error {\n  status: number\n  constructor(message?: string) {\n    super()\n    this.message = message ? `Unauthorized: ${message}` : `Unauthorized.`\n    this.status = 401\n  }\n}\n","export class BadRequestError extends Error {\n  status: number\n  constructor(message?: string) {\n    super()\n    this.message = message ? `Bad Request: ${message}` : `Bad Request.`\n    this.status = 400\n  }\n}\n","export class NotFoundError extends Error {\n  status: number\n  constructor(message?: string) {\n    super()\n    this.message = message ? `Not found: ${message}` : `Not found.`\n    this.status = 404\n  }\n}\n","export class UnexpectedError extends Error {\n  status: number\n  constructor(message?: string) {\n    super()\n    this.message = message ? `Unexpected Error: ${message}` : `Unexpected Error.`\n    this.status = 500\n  }\n}\n","import axios, { AxiosInstance } from 'axios'\nimport { UnauthorizedError } from '@wirewheel/cmp/src/errors/UnauthorizedError'\nimport { BadRequestError } from '@wirewheel/cmp/src/errors/BadRequestError'\nimport { NotFoundError } from '@wirewheel/cmp/src/errors/NotFoundError'\nimport { UnexpectedError } from '@wirewheel/cmp/src/errors/UnexpectedError'\n\nconst errorMap = new Map([\n  [401, UnauthorizedError],\n  [400, BadRequestError],\n  [404, NotFoundError],\n  [500, UnexpectedError],\n])\n\ntype HttpClientConfig = {\n  apiUrl: string\n  token?: string\n  apiKey?: string\n}\n\nexport class HttpClient {\n  private _client: AxiosInstance\n  static create({ apiUrl, token, apiKey }: HttpClientConfig): HttpClient {\n    return new HttpClient(apiUrl, token, apiKey)\n  }\n\n  private constructor(\n    private readonly apiUrl: string,\n    private readonly token?: string,\n    private readonly apiKey?: string\n  ) {\n    const baseURL = new URL(this.apiUrl).href.replace(/\\/$/, '')\n    this._client = axios.create({\n      baseURL,\n      headers: {\n        ...(token && { authorization: `Bearer ${this.token}` }),\n        ...(apiKey && { 'x-api-key': apiKey }),\n      },\n    })\n\n    // FIXME(pablo): support for interceptors in mocked axios needs to be fixed\n    this._client?.interceptors?.response?.use(undefined, this.errorHandler)\n  }\n\n  async get(resource: string, config?: any): Promise<any> {\n    const response = await this._client.get(resource, config)\n    return response?.data\n  }\n\n  async post(resource: string, data: any, config?: any): Promise<any> {\n    const response = await this._client.post(resource, data, config)\n    return response?.data\n  }\n\n  private errorHandler(error: any) {\n    const status = error.response?.status\n    const message = error.response?.data?.message\n    const httpErrorClass = errorMap.has(status) ? errorMap.get(status) : undefined\n\n    if (httpErrorClass) {\n      throw new httpErrorClass(message)\n    }\n    throw error\n  }\n}\n","import * as uuid from 'uuid'\n\n/** A subject represents the person that's giving consent.\n *\n * A Subject might have two different ids. When he/she is not identified in the system, this SDK will generate\n * a random UUID to identify the current browser. Once the Subject is logged into the system, it can be\n * _converted_ to a verified Subject. A verified Subject has a custom id provided by the system.\n */\nexport class Subject {\n  /** Builds a verified Subject.\n   * @param id Custom id provided by the system.\n   * @return the new Subject that uses the verified id.\n   */\n  static verified(id: string): Subject {\n    return new Subject(id, undefined)\n  }\n\n  /** Builds an anonymous Subject and assigns a random UUID.\n   * @return the new anonymous Subject.\n   */\n  static anonymous(id?: string): Subject {\n    return new Subject(undefined, id || uuid.v4())\n  }\n\n  private constructor(\n    /** Verified user identifier. */\n    readonly verifiedId?: string,\n    /** Random UUID generated by the SDK. */\n    readonly anonymousId?: string\n  ) {}\n\n  get id(): string | undefined {\n    return this.verifiedId || this.anonymousId\n  }\n}\n","/** This error is thrown when there is a data validation error.\n */\nexport class ValidationError extends Error {\n  constructor(message: string) {\n    super(message)\n  }\n}\n","export function isBrowser(): boolean {\n  return typeof window !== 'undefined' && typeof window.document !== 'undefined'\n}\n","import { Subject } from '@wirewheel/cmp/src/entities/Subject'\n\nexport abstract class PersistentStore {\n  static canSetCookies(): boolean {\n    try {\n      // Set the test cookie with a value of \"test\"\n      document.cookie = 'test=test;SameSite=None;Secure'\n      // Check if the cookie was successfully set by reading the cookies string\n      const enabled = document.cookie.indexOf('test=test') >= 0\n      // Deleting cookie\n      document.cookie = 'test=test; expires=Thu, 01 Jan 1970 00:00:00 UTC; SameSite=None; Secure;'\n      return enabled\n    } catch (cause) {\n      console.warn(cause)\n      // Fallback if it cannot write a cookie\n      return false\n    }\n  }\n\n  protected abstract write(value: any): void\n  protected abstract read(): any\n\n  private parentDomain: string | undefined = undefined\n\n  protected constructor() {}\n\n  getParentDomain(): string | undefined {\n    return this.parentDomain\n  }\n\n  setParentDomain(newParentDomain: string) {\n    this.parentDomain = newParentDomain\n  }\n\n  getOrCreateSubject(): Subject {\n    const subject = this.getSubject() || Subject.anonymous()\n    this.setSubject(subject)\n    return subject\n  }\n\n  setSubject(subject: Subject): void {\n    this.write({ subject })\n  }\n\n  getSubject(): Subject | undefined {\n    const store = this.read()\n    if (!store.subject) return\n\n    const { verifiedId, anonymousId } = store.subject\n    return verifiedId ? Subject.verified(verifiedId) : Subject.anonymous(anonymousId)\n  }\n\n  getGPCConfirmationBySubjectId(subjectId: string) {\n    const gpcConfirmation = this.read().privacyProtocols\n    return gpcConfirmation && gpcConfirmation[subjectId]\n  }\n\n  setGPCConfirmationBySubjectId(subjectId: string, data: any) {\n    const privacyProtocols: any = this.read().privacyProtocols || {}\n\n    privacyProtocols[subjectId] = data\n    this.write({ privacyProtocols })\n  }\n}\n","/*! js-cookie v3.0.1 | MIT */\n/* eslint-disable no-var */\nfunction assign (target) {\n  for (var i = 1; i < arguments.length; i++) {\n    var source = arguments[i];\n    for (var key in source) {\n      target[key] = source[key];\n    }\n  }\n  return target\n}\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\nvar defaultConverter = {\n  read: function (value) {\n    if (value[0] === '\"') {\n      value = value.slice(1, -1);\n    }\n    return value.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent)\n  },\n  write: function (value) {\n    return encodeURIComponent(value).replace(\n      /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,\n      decodeURIComponent\n    )\n  }\n};\n/* eslint-enable no-var */\n\n/* eslint-disable no-var */\n\nfunction init (converter, defaultAttributes) {\n  function set (key, value, attributes) {\n    if (typeof document === 'undefined') {\n      return\n    }\n\n    attributes = assign({}, defaultAttributes, attributes);\n\n    if (typeof attributes.expires === 'number') {\n      attributes.expires = new Date(Date.now() + attributes.expires * 864e5);\n    }\n    if (attributes.expires) {\n      attributes.expires = attributes.expires.toUTCString();\n    }\n\n    key = encodeURIComponent(key)\n      .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n      .replace(/[()]/g, escape);\n\n    var stringifiedAttributes = '';\n    for (var attributeName in attributes) {\n      if (!attributes[attributeName]) {\n        continue\n      }\n\n      stringifiedAttributes += '; ' + attributeName;\n\n      if (attributes[attributeName] === true) {\n        continue\n      }\n\n      // Considers RFC 6265 section 5.2:\n      // ...\n      // 3.  If the remaining unparsed-attributes contains a %x3B (\";\")\n      //     character:\n      // Consume the characters of the unparsed-attributes up to,\n      // not including, the first %x3B (\";\") character.\n      // ...\n      stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n    }\n\n    return (document.cookie =\n      key + '=' + converter.write(value, key) + stringifiedAttributes)\n  }\n\n  function get (key) {\n    if (typeof document === 'undefined' || (arguments.length && !key)) {\n      return\n    }\n\n    // To prevent the for loop in the first place assign an empty array\n    // in case there are no cookies at all.\n    var cookies = document.cookie ? document.cookie.split('; ') : [];\n    var jar = {};\n    for (var i = 0; i < cookies.length; i++) {\n      var parts = cookies[i].split('=');\n      var value = parts.slice(1).join('=');\n\n      try {\n        var foundKey = decodeURIComponent(parts[0]);\n        jar[foundKey] = converter.read(value, foundKey);\n\n        if (key === foundKey) {\n          break\n        }\n      } catch (e) {}\n    }\n\n    return key ? jar[key] : jar\n  }\n\n  return Object.create(\n    {\n      set: set,\n      get: get,\n      remove: function (key, attributes) {\n        set(\n          key,\n          '',\n          assign({}, attributes, {\n            expires: -1\n          })\n        );\n      },\n      withAttributes: function (attributes) {\n        return init(this.converter, assign({}, this.attributes, attributes))\n      },\n      withConverter: function (converter) {\n        return init(assign({}, this.converter, converter), this.attributes)\n      }\n    },\n    {\n      attributes: { value: Object.freeze(defaultAttributes) },\n      converter: { value: Object.freeze(converter) }\n    }\n  )\n}\n\nvar api = init(defaultConverter, { path: '/' });\n/* eslint-enable no-var */\n\nexport default api;\n","import { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\nimport Cookies from 'js-cookie'\n\nconst ONE_YEAR_IN_DAYS = 365\nconst COOKIE_KEY = 'wwupcp'\n\ntype CookiePersistentStoreParams = {\n  cookieExpirationInDays?: number\n  refreshOnVisit?: boolean\n}\n\nexport class CookiePersistentStore extends PersistentStore {\n  private readonly expirationInDays: number\n  private readonly refreshOnVisit: boolean\n  constructor(params?: CookiePersistentStoreParams) {\n    super()\n    this.expirationInDays = params?.cookieExpirationInDays || ONE_YEAR_IN_DAYS\n    this.refreshOnVisit = params?.refreshOnVisit ?? false\n  }\n\n  protected read(): any {\n    try {\n      return JSON.parse(Cookies.get(COOKIE_KEY) as string)\n    } catch (cause) {\n      return {}\n    }\n  }\n\n  write(value: any): void {\n    const hostnameParts = location.hostname.split('.').reverse()\n    const parts: string[] = []\n    const currentValue = this.read()\n    let domain = ''\n\n    const expirationDate = this.getExpirationDate(currentValue.expirationDate)\n\n    hostnameParts.forEach((val) => {\n      parts.push(val)\n      domain = [...parts].reverse().join('.')\n      // TODO Ensure it only sets the cookie for one domain\n      Cookies.set(COOKIE_KEY, JSON.stringify({ ...currentValue, ...value, expirationDate }), {\n        domain: domain,\n        SameSite: 'None',\n        secure: true,\n        expires: expirationDate,\n      })\n    })\n  }\n\n  private getExpirationDate(currentExpirationDate: Date) {\n    const DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000\n\n    if (currentExpirationDate && !this.refreshOnVisit) {\n      return new Date(currentExpirationDate)\n    }\n    return new Date(new Date().getTime() + this.expirationInDays * DAY_IN_MILLISECONDS)\n  }\n}\n","import { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\n\nexport class MemoryStore extends PersistentStore {\n  private store: any = {}\n\n  constructor() {\n    super()\n  }\n\n  protected read(): any {\n    return this.store\n  }\n\n  write(value: any): void {\n    this.store = { ...this.store, ...value }\n  }\n}\n","import { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'\nimport { CookiePersistentStore } from '@wirewheel/cmp/src/modules/CookiePersistentStore'\nimport { MemoryStore } from '@wirewheel/cmp/src/modules/MemoryStore'\nimport { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\nimport { CookieConfig } from '@wirewheel/cmp/src/entities/CookieConfig'\n\nexport abstract class PersistentStoreFactory {\n  private static instance?: PersistentStore\n\n  static reset() {\n    PersistentStoreFactory.instance = undefined\n  }\n\n  static getStore(cookieConfig?: CookieConfig): PersistentStore {\n    if (!PersistentStoreFactory.instance || cookieConfig?.refreshOnVisit) {\n      if (isBrowser() && PersistentStore.canSetCookies()) {\n        PersistentStoreFactory.instance = new CookiePersistentStore({\n          cookieExpirationInDays: cookieConfig?.expirationInDays,\n          refreshOnVisit: cookieConfig?.refreshOnVisit,\n        })\n      } else {\n        PersistentStoreFactory.instance = new MemoryStore()\n      }\n    }\n    return PersistentStoreFactory.instance\n  }\n}\n","/** WireWheel Client to interact with the API\n */\nimport { HttpClient } from '@wirewheel/cmp/src/HttpClient'\nimport { ClientConfig } from '@wirewheel/cmp/src/entities/ClientConfig'\nimport { Subject } from '@wirewheel/cmp/src/entities/Subject'\nimport { Session } from '@wirewheel/cmp/src/entities/Session'\nimport { Action } from './entities/Action'\nimport { ValidationError } from '@wirewheel/cmp/src/errors/ValidationError'\nimport { GetUnifiedConsentResponse } from '@wirewheel/cmp/src/entities/GetUnifiedConsentResponse'\nimport { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'\nimport { Channel } from '@wirewheel/cmp/src/entities/Channel'\nimport { EmbeddedHandler } from '@wirewheel/cmp/src/EmbeddedHandler'\nimport { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\nimport { PersistentStoreFactory } from '@wirewheel/cmp/src/modules/PersistentStoreFactory'\n\nexport type HasConsentsPayload = {\n  subjectId?: string\n}\n\nexport type SaveProfilePayload = {\n  email: string\n  profile?: any\n}\n\nexport type VerifySubjectProfilePayload = {\n  email: string\n  verificationCode: string\n}\n\nexport type CreateConsentPayload = {\n  subject?: Subject\n  actions: Action[]\n  attributes?: {\n    [key: string]: any\n  }\n  tags?: string[]\n  compliance?: {\n    privacyPolicy?: {\n      version?: string\n      url: string\n    }\n    gpc?: 1\n  }\n  overrideCountryCode?: string\n  overrideRegionCode?: string\n}\n\nexport class WireWheelClient {\n  private readonly httpClient: HttpClient\n  private readonly store: PersistentStore\n\n  constructor(private readonly config: ClientConfig, private readonly embeddedHandler?: EmbeddedHandler) {\n    const { token, apiUrl, cookieConfig } = config\n    this.httpClient = HttpClient.create({ apiUrl, token })\n    this.store = PersistentStoreFactory.getStore(cookieConfig)\n  }\n\n  static new(config: ClientConfig, embeddedHandler?: EmbeddedHandler): WireWheelClient {\n    if (isBrowser()) {\n      PersistentStoreFactory.getStore(config.cookieConfig).getOrCreateSubject()\n    }\n\n    return new WireWheelClient(config, embeddedHandler)\n  }\n\n  get subject(): Subject | undefined {\n    return this.store.getSubject()\n  }\n\n  async login(verifiedId: string): Promise<void> {\n    if (!verifiedId) throw new ValidationError('verifiedId must be provided')\n\n    const subject = this.subject\n    if (subject?.anonymousId) {\n      try {\n        await this.mergeSubjects(subject.anonymousId, verifiedId)\n      } catch (error: any) {\n        if (error.status !== 404) {\n          console.log('Something went wrong while merging subjects')\n          throw error\n        }\n      }\n    }\n    const newSubject = Subject.verified(verifiedId)\n    this.store.setSubject(newSubject)\n    this.embeddedHandler?.login(newSubject)\n  }\n\n  async loginFromSession(sessionId: string): Promise<Session> {\n    if (!sessionId) throw new ValidationError('sessionId must be provided')\n\n    const response = await this.httpClient.get(`/sessions/${sessionId}`, { headers: this._getRegionHeaders })\n    const { subject } = response\n\n    if (this.subject?.anonymousId) {\n      try {\n        await this.mergeSubjects(this.subject.anonymousId, subject.verifiedId)\n      } catch (error: any) {\n        if (error.status !== 404) {\n          console.log('Something went wrong while merging subjects')\n          throw error\n        }\n      }\n    }\n    const newSubject = Subject.verified(subject.verifiedId)\n    this.store.setSubject(newSubject)\n    return response\n  }\n\n  logout(): void {\n    const subject = Subject.anonymous()\n    this.store.setSubject(subject)\n    this.embeddedHandler?.logout(subject)\n  }\n\n  private get _getRegionHeaders(): any {\n    return {\n      ...(this.config.overrideCountryCode && { 'x-country-code-override': this.config.overrideCountryCode }),\n      ...(this.config.overrideRegionCode && { 'x-region-code-override': this.config.overrideRegionCode }),\n    }\n  }\n\n  async createConsent(payload: CreateConsentPayload): Promise<string> {\n    const data = {\n      subject: payload.subject || this.subject,\n      actions: payload.actions,\n      tags: payload.tags || [],\n      attributes: payload.attributes,\n      compliance: payload.compliance,\n    }\n\n    const headers = {\n      ...(payload.overrideCountryCode && { 'x-country-code-override': payload.overrideCountryCode }),\n      ...(payload.overrideRegionCode && { 'x-region-code-override': payload.overrideRegionCode }),\n    }\n\n    const combinedHeaders = { ...this._getRegionHeaders, ...headers }\n\n    const { statusText } = await this.httpClient.post('/consents', data, { headers: combinedHeaders })\n    this.embeddedHandler?.createConsent(data.actions)\n    return statusText\n  }\n\n  async getUnifiedConsent(subjectId?: string): Promise<GetUnifiedConsentResponse> {\n    const id = subjectId || this.subject?.id\n\n    return await this.httpClient.get(`/consents/unified/${id}`, { headers: this._getRegionHeaders })\n  }\n\n  async saveProfile({ email, profile }: SaveProfilePayload): Promise<void> {\n    const data = { email, profile }\n    const result = await this.httpClient.post('/subjects/profile', data)\n    return result.verifiedId\n  }\n\n  async verifySubjectProfile({ email, verificationCode }: VerifySubjectProfilePayload): Promise<string> {\n    const data = { email, code: verificationCode }\n    const response = await this.httpClient.post(`/subjects/profile/verify`, data)\n    return response.verifiedId\n  }\n\n  async hasConsents(payload: HasConsentsPayload = {}): Promise<boolean> {\n    const { subjectId } = payload\n\n    const id = subjectId || this.subject?.id\n    if (!id) {\n      throw new ValidationError('Missing subjectId')\n    }\n    const response = await this.httpClient.get(`/consents/check/${id}`, { headers: this._getRegionHeaders })\n    return response.exists\n  }\n\n  async getProfileVerificationCode(email: string): Promise<string> {\n    const response = await this.httpClient.post('/subjects/profile/verification-code', { email })\n    return response.code\n  }\n\n  /**\n   * Retrieves the channel config given a channelId\n   * @param channelId\n   * @returns {Channel}\n   */\n  async getChannelConfig(channelId: string): Promise<Channel> {\n    if (!channelId) {\n      throw new Error('The channelId is required')\n    }\n    return await this.httpClient.get(`/channels/${channelId}`)\n  }\n\n  /**\n   * Merges the consents of the source subject into the target subject.\n   * @param sourceSubjectId\n   * @param targetSubjectId\n   */\n  async mergeSubjects(sourceSubjectId: string, targetSubjectId: string): Promise<void> {\n    await this.httpClient.post(`/subjects/merge`, {\n      sourceSubjectId,\n      targetSubjectId,\n    })\n  }\n}\n","import { HttpClient } from '@wirewheel/cmp/src/HttpClient'\nimport { PrivacyProtocolsConfig } from '@wirewheel/cmp/src/entities/PrivacyProtocolsConfig'\nimport { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'\nimport { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\nimport { PersistentStoreFactory } from '@wirewheel/cmp/src/modules/PersistentStoreFactory'\n\nexport class PrivacyProtocolsClient {\n  private readonly httpClient: HttpClient\n  private readonly attributes: Record<string, any>\n  private readonly store: PersistentStore\n\n  constructor(config: PrivacyProtocolsConfig) {\n    this.httpClient = HttpClient.create(config)\n    this.attributes = config.attributes || {}\n    this.store = PersistentStoreFactory.getStore(config.cookieConfig)\n  }\n\n  async registerPrivacyProtocols(): Promise<void> {\n    if (!isBrowser()) throw new Error('Operation only available for the browser')\n    const subject = this.store.getOrCreateSubject()\n\n    if (!subject.id || this.store.getGPCConfirmationBySubjectId(subject.id)) return\n\n    await this.httpClient.post('/consents/gpc', {\n      subject,\n      attributes: this.attributes,\n    })\n    this.store.setGPCConfirmationBySubjectId(subject.id, [{ gpc: 1 }])\n  }\n}\n","import { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'\n\nexport function isChildWindow(): boolean {\n  return isBrowser() && window !== top\n}\n","export enum MessageType {\n  LOGIN = 'login',\n  LOGOUT = 'logout',\n  CONSENT_WRITE = 'consent:write',\n  CHILD_INIT = 'child:init',\n  CHILD_LOADED = 'child:loaded',\n}\n","import { ValidationError } from '@wirewheel/cmp/src/errors/ValidationError'\nimport { Message } from '@wirewheel/cmp/src/entities/Message'\nimport { MessageListener } from '@wirewheel/cmp/src/entities/MessageListener'\nimport { isChildWindow } from '@wirewheel/cmp/src/utils/isChildWindow'\nimport { MessageType } from '@wirewheel/cmp/src/entities/MessageType'\nimport { PersistentStoreFactory } from '@wirewheel/cmp/src/modules/PersistentStoreFactory'\n\nexport class MessageService {\n  static createFromParent(targetIframe: HTMLIFrameElement): MessageService {\n    return new MessageService(targetIframe.contentWindow, () => targetIframe.src)\n  }\n\n  static createFromChild(): MessageService {\n    if (!isChildWindow()) {\n      throw new ValidationError('Parent window does not exist')\n    }\n    return new MessageService(window.parent, () => PersistentStoreFactory.getStore().getParentDomain() as string)\n  }\n\n  private eventListeners: Map<MessageType, MessageListener[]> = new Map()\n\n  constructor(\n    /** Window that will receive the messages. */\n    private readonly targetWindow: any,\n    /** Function to resolve the target window domain. */\n    private readonly targetDomainResolver: () => string\n  ) {\n    this.initialize()\n  }\n\n  on(type: MessageType, listener: MessageListener) {\n    if (!this.eventListeners.has(type)) {\n      this.eventListeners.set(type, [])\n    }\n    this.eventListeners.get(type)?.push(listener)\n  }\n\n  send(message: Message) {\n    this.targetWindow.postMessage(JSON.stringify({ message, isWireWheelSource: true }), this.targetDomainResolver())\n  }\n\n  private initialize() {\n    window.addEventListener('message', (event) => {\n      try {\n        const data = JSON.parse(event.data)\n        if (data.isWireWheelSource) {\n          const message = data.message as Message\n          this.eventListeners.get(message.type)?.forEach((listener: MessageListener) => {\n            listener(message)\n          })\n        }\n      } catch (e) {\n        //Invalid json passed, likely browser native message\n      }\n    })\n  }\n}\n","import { AuthorizationConfig } from '@wirewheel/cmp/src/entities/AuthorizationConfig'\nimport axios from 'axios'\nimport { ClientConfig } from '@wirewheel/cmp/src/entities/ClientConfig'\nimport { WireWheelClient } from '@wirewheel/cmp/src/WireWheelClient'\nimport { ValidationError } from '@wirewheel/cmp/src/errors/ValidationError'\nimport { convertToBase64 } from '@wirewheel/cmp/src/utils/convertToBase64'\nimport { PrivacyProtocolsClient } from '@wirewheel/cmp/src/PrivacyProtocolsClient'\nimport { PrivacyProtocolsConfig } from '@wirewheel/cmp/src/entities/PrivacyProtocolsConfig'\nimport { EmbeddedConfig } from '@wirewheel/cmp/src/entities/EmbeddedConfig'\nimport { EmbeddedHandler } from '@wirewheel/cmp/src/EmbeddedHandler'\nimport { isChildWindow } from '@wirewheel/cmp/src/utils/isChildWindow'\nimport { TokenCache } from '@wirewheel/cmp/src/utils/tokenCache'\nimport { ChildEmbeddedConfig } from '@wirewheel/cmp/src/entities/ChildEmbeddedConfig'\n\n/* eslint-disable no-unused-vars */\n// eslint does not understand this is exported and complains it is unused\nexport enum Scopes {\n  ConsentWrite = 'consent-insert-api',\n  ConsentRead = 'consent-get-api',\n  SubjectProfileManage = 'subject-profile-manage',\n}\n/* eslint-enable no-unused-vars */\n\nexport class WireWheelSDK {\n  private static tokenCache = new TokenCache()\n\n  /**\n   * This method retrieves an access token with authorization to execute the functions of the {@link WireWheelClient}\n   * @param config\n   * @param scopes\n   */\n  static async getToken(config: AuthorizationConfig, scopes: Scopes[]): Promise<string> {\n    if (scopes.length == 0) {\n      throw new ValidationError('Must provide at least one scope type.')\n    }\n    scopes.sort()\n    const token = this.tokenCache.get({ scopes, clientId: config.clientId })\n    if (token) return token\n\n    const consentContextToken = convertToBase64(`${config.clientId}:${config.clientSecret}`)\n    const response = await axios({\n      method: 'post',\n      url: config.issuer,\n      headers: {\n        authorization: `Basic ${consentContextToken}`,\n        'Content-Type': 'application/x-www-form-urlencoded',\n      },\n      data: `grant_type=client_credentials&scope=${scopes\n        .map((scope) => `${config.resourceServerName}/${scope}`)\n        .join(' ')}`,\n    })\n    const { data } = response\n\n    this.tokenCache.set({ scopes, clientId: config.clientId, expiresIn: data.expires_in }, data.access_token)\n    return data.access_token\n  }\n\n  /** createClient is a factory method for the instantiation  of {@link WireWheelClient} */\n  static createClient(config: ClientConfig, embeddedHandler?: EmbeddedHandler): WireWheelClient {\n    return WireWheelClient.new(config, embeddedHandler)\n  }\n\n  static async registerPrivacyProtocols(config: PrivacyProtocolsConfig): Promise<void> {\n    await new PrivacyProtocolsClient(config).registerPrivacyProtocols()\n  }\n\n  static initEmbeddedParent(config: EmbeddedConfig): EmbeddedHandler {\n    const { targetIframe, cookieConfig } = config\n    if (!targetIframe) {\n      throw new ValidationError('Target iframe invalid.')\n    }\n    return EmbeddedHandler.createFromParent(targetIframe, cookieConfig)\n  }\n\n  static initEmbeddedChild(config?: ChildEmbeddedConfig): EmbeddedHandler | undefined {\n    if (!isChildWindow()) {\n      return undefined\n    }\n\n    return EmbeddedHandler.createFromChild(config)\n  }\n}\n","import { MessageListener } from '@wirewheel/cmp/src/entities/MessageListener'\nimport { Message } from '@wirewheel/cmp/src/entities/Message'\nimport { MessageType } from '@wirewheel/cmp/src/entities/MessageType'\nimport { isChildWindow } from '@wirewheel/cmp/src/utils/isChildWindow'\nimport { MessageService } from '@wirewheel/cmp/src/modules/MessageService'\nimport { Subject } from '@wirewheel/cmp/src/entities/Subject'\nimport { Action } from '@wirewheel/cmp/src/entities/Action'\nimport { PersistentStore } from '@wirewheel/cmp/src/modules/PersistentStore'\nimport { PersistentStoreFactory } from '@wirewheel/cmp/src/modules/PersistentStoreFactory'\nimport { CookieConfig } from '@wirewheel/cmp/src/entities/CookieConfig'\nimport { ChildEmbeddedConfig } from '@wirewheel/cmp/src/entities/ChildEmbeddedConfig'\n\n/** Interval to wait for the child to be ready, in milliseconds. */\nconst CHILD_WAIT_INTERVAL = 250\n/** Timeout to stop waiting for the child window, in milliseconds. */\nconst CHILD_WAIT_TIMEOUT = 1000000\n\nexport class EmbeddedHandler {\n  private childLoaded = false\n\n  static createFromParent(targetIframe: HTMLIFrameElement, cookieConfig?: CookieConfig): EmbeddedHandler {\n    const messageService = MessageService.createFromParent(targetIframe)\n    const handler = new EmbeddedHandler(messageService, cookieConfig)\n    handler.initParent()\n    return handler\n  }\n\n  static createFromChild(childEmbeddedConfig?: ChildEmbeddedConfig): EmbeddedHandler {\n    const messageService = MessageService.createFromChild()\n    const handler = new EmbeddedHandler(messageService, childEmbeddedConfig?.cookieConfig)\n    handler.initChild()\n    return handler\n  }\n\n  private readonly store: PersistentStore\n\n  constructor(private readonly messageService: MessageService, private readonly cookieConfig?: CookieConfig) {\n    this.store = PersistentStoreFactory.getStore(cookieConfig)\n  }\n\n  on(type: MessageType, listener: MessageListener) {\n    this.messageService.on(type, listener)\n  }\n\n  send(message: Message) {\n    this.messageService.send(message)\n  }\n\n  login(subject: Subject) {\n    this.messageService.send({ type: MessageType.LOGIN, data: { subject } })\n  }\n\n  logout(subject: Subject) {\n    this.messageService.send({ type: MessageType.LOGOUT, data: { subject } })\n  }\n\n  createConsent(actions: Action[]) {\n    this.messageService.send({ type: MessageType.CONSENT_WRITE, data: { actions } })\n  }\n\n  initParent() {\n    if (isChildWindow()) {\n      console.log('invalid call to initParent(), this is a child window')\n      return\n    }\n\n    // Listen events in child application\n    this.messageService.on(MessageType.LOGIN, (message) => {\n      const { subject } = message.data\n      this.store.setSubject(subject)\n    })\n\n    this.messageService.on(MessageType.LOGOUT, (message) => {\n      const { subject } = message.data\n      this.store.setSubject(subject)\n    })\n\n    this.messageService.on(MessageType.CHILD_LOADED, (message) => {\n      if (!this.childLoaded) {\n        this.store.setSubject(message.data.subject)\n        this.childLoaded = true\n      }\n    })\n\n    const queryString = window.location.search\n    const params = new URLSearchParams(queryString)\n    const sessionId = params.get('sessionId')\n\n    setTimeout(this.sendHandshake.bind(this, undefined, sessionId), CHILD_WAIT_INTERVAL)\n  }\n\n  initChild(): void {\n    if (!isChildWindow()) {\n      console.log('invalid call to initChild(), this is a top level window')\n      return\n    }\n    this.messageService.on(MessageType.CHILD_INIT, (message) => {\n      if (message.data.subject) {\n        this.store.setSubject(message.data.subject)\n      }\n      this.store.setParentDomain(message.data.parentDomain)\n\n      this.messageService.send({\n        type: MessageType.CHILD_LOADED,\n        data: {\n          subject: this.store.getSubject(),\n        },\n      })\n    })\n  }\n\n  getParentDomain(): string | undefined {\n    return this.store.getParentDomain()\n  }\n\n  private sendHandshake(start: number = Date.now(), sessionId?: string | null) {\n    const elapsed: number = Date.now() - start\n    if (!this.childLoaded) {\n      if (elapsed > CHILD_WAIT_TIMEOUT) {\n        throw new Error('no answer from child window, embedded client initialization failed')\n      }\n\n      // Overrides the subject in the child app, if any\n      this.messageService.send({\n        type: MessageType.CHILD_INIT,\n        data: {\n          subject: this.store.getSubject(),\n          parentDomain: window.location.href,\n          sessionId: sessionId ?? undefined,\n        },\n      })\n      setTimeout(() => this.sendHandshake(start, sessionId), CHILD_WAIT_INTERVAL)\n    }\n  }\n}\n","class TokenInfo {\n  constructor(public accessToken: string, public expiresAt: Date) {}\n}\n\nexport class TokenCache {\n  private tokenMap: Map<string, TokenInfo>\n  constructor() {\n    this.tokenMap = new Map()\n  }\n\n  set({ scopes, clientId, expiresIn }: { scopes: string[]; clientId: string; expiresIn: number }, token: string) {\n    const date = new Date()\n    date.setSeconds(date.getSeconds() + expiresIn)\n\n    const tokenInfo = new TokenInfo(token, date)\n    const key = this._getTokenCacheKey({ scopes, clientId })\n    this.tokenMap.set(key, tokenInfo)\n  }\n\n  get({ scopes, clientId }: { scopes: string[]; clientId: string }): string | undefined {\n    const key = this._getTokenCacheKey({ scopes, clientId })\n    const token = this.tokenMap.get(key)\n    if (!token || token.expiresAt <= new Date()) return\n\n    return token.accessToken\n  }\n\n  private _getTokenCacheKey({ scopes, clientId }: { scopes: string[]; clientId: string }) {\n    const scopesKey = scopes.join('-')\n    return `${scopesKey}:${clientId}`\n  }\n}\n","import { isBrowser } from '@wirewheel/cmp/src/utils/isBrowser'\n\nexport function convertToBase64(text: string) {\n  if (isBrowser()) {\n    return window.btoa(text)\n  } else {\n    return Buffer.from(text).toString('base64')\n  }\n}\n"],"names":["ActionType","UnauthorizedError","_Error","message","_this","call","this","status","_inheritsLoose","_wrapNativeSuper","Error","BadRequestError","NotFoundError","UnexpectedError","errorMap","Map","create","apiUrl","token","apiKey","_client","baseURL","URL","href","replace","axios","headers","authorization","interceptors","_this$_client","response","use","undefined","errorHandler","_ref","HttpClient","_proto","prototype","get","resource","config","Promise","resolve","then","data","post","error","_error$response","_error$response2","_error$response2$data","httpErrorClass","has","Subject","verified","verifiedId","anonymousId","id","anonymous","uuid","v4","_createClass","key","ValidationError","isBrowser","window","document","canSetCookies","parentDomain","cookie","enabled","indexOf","cause","console","warn","PersistentStore","getParentDomain","setParentDomain","newParentDomain","getOrCreateSubject","subject","getSubject","setSubject","write","store","read","_store$subject","getGPCConfirmationBySubjectId","subjectId","privacyProtocols","gpcConfirmation","setGPCConfirmationBySubjectId","assign","target","i","arguments","length","source","api","init","converter","defaultAttributes","set","value","attributes","expires","Date","now","toUTCString","encodeURIComponent","decodeURIComponent","escape","stringifiedAttributes","attributeName","split","Object","cookies","jar","parts","slice","join","foundKey","e","remove","withAttributes","withConverter","freeze","path","CookiePersistentStore","_PersistentStore","params","_params$refreshOnVisi","expirationInDays","refreshOnVisit","cookieExpirationInDays","JSON","parse","Cookies","hostnameParts","location","hostname","reverse","currentValue","domain","expirationDate","getExpirationDate","forEach","val","push","stringify","_extends","SameSite","secure","currentExpirationDate","getTime","MemoryStore","PersistentStoreFactory","reset","instance","getStore","cookieConfig","WireWheelClient","embeddedHandler","httpClient","login","_temp3","_result2","_this$embeddedHandler","_this2","newSubject","_catch","mergeSubjects","log","_temp4","loginFromSession","sessionId","_this4","_getRegionHeaders","_temp6","_result4","_temp5","_this4$subject","reject","logout","_this$embeddedHandler2","createConsent","payload","_this6","actions","tags","compliance","overrideCountryCode","overrideRegionCode","combinedHeaders","statusText","_this6$embeddedHandle","getUnifiedConsent","_this8$subject","_this8","saveProfile","email","profile","result","verifySubjectProfile","_ref3","verificationCode","code","hasConsents","_this14$subject","_this14","exists","getProfileVerificationCode","getChannelConfig","channelId","sourceSubjectId","targetSubjectId","PrivacyProtocolsClient","registerPrivacyProtocols","gpc","isChildWindow","top","MessageType","Scopes","MessageService","targetWindow","targetDomainResolver","eventListeners","initialize","createFromParent","targetIframe","contentWindow","src","createFromChild","parent","on","type","listener","_this$eventListeners$","send","postMessage","isWireWheelSource","addEventListener","event","_this$eventListeners$2","messageService","childLoaded","handler","EmbeddedHandler","initParent","childEmbeddedConfig","initChild","LOGIN","LOGOUT","CONSENT_WRITE","CHILD_LOADED","queryString","search","URLSearchParams","setTimeout","sendHandshake","bind","CHILD_INIT","start","_this3","elapsed","accessToken","expiresAt","TokenCache","tokenMap","scopes","clientId","expiresIn","date","setSeconds","getSeconds","_getTokenCacheKey","tokenInfo","WireWheelSDK","getToken","sort","tokenCache","text","clientSecret","btoa","Buffer","from","toString","method","url","issuer","consentContextToken","map","scope","resourceServerName","expires_in","access_token","createClient","initEmbeddedParent","initEmbeddedChild"],"mappings":"mYAEYA,muDAAAA,QAAAA,gBAAAA,GAAAA,EAAAA,qBAAAA,QAAAA,WAIX,CAAA,IAHC,OAAA,SACAA,EAAA,OAAA,SACAA,EAAA,WAAA,aCLWC,IAAAA,eAEX,SAAAC,GAAA,SAAAD,EAAYE,GACV,IAAAC,EAD0B,OAC1BA,EAAAF,EAAAG,KAAAC,OAAAA,MAFFC,YAGE,EAAAH,EAAKD,QAAUA,EAA2BA,iBAAAA,EAA1C,gBACAC,EAAKG,OAAS,IAHYH,CAI3B,CANH,OAEEI,EAAAP,EAAAC,GAFFD,CAAA,CAEE,cAFFQ,EAAuCC,QCA1BC,eAEX,SAAAT,GAAA,SAAAS,EAAYR,GACV,IAAAC,EAD0B,OAC1BA,EAAAF,EAAAG,KAAAC,OAAAA,MAFFC,YAGE,EAAAH,EAAKD,QAAUA,EAA0BA,gBAAAA,EAAzC,eACAC,EAAKG,OAAS,IAHYH,CAI3B,CANH,OAEEI,EAAAG,EAAAT,GAFFS,CAAA,CAEE,cAFFF,EAAqCC,QCAxBE,eAEX,SAAAV,GAAA,SAAAU,EAAYT,GACV,IAAAC,EAD0B,OAC1BA,EAAAF,EAAAG,KAAAC,OAAAA,MAFFC,YAGE,EAAAH,EAAKD,QAAUA,EAAwBA,cAAAA,EAAvC,aACAC,EAAKG,OAAS,IAHYH,CAI3B,CANH,OAEEI,EAAAI,EAAAV,GAFFU,CAAA,CAEE,cAFFH,EAAmCC,QCAtBG,eAEX,SAAAX,GAAA,SAAAW,EAAYV,GACV,IAAAC,EAD0B,OAC1BA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