Service to handle cookies.

Added in v2.0.0


Table of contents


capabilities

CookieSvc (interface)

Signature

export interface CookieSvc {
  cookie: Cookie;
}

Added in v2.0.0

instances

Live instance of Cookie service.

Signature

export declare const cookie: (E: CookieEnv) => Cookie;

Added in v2.0.0

model

Defines the Cookie service capabilities.

Signature

export interface Cookie {
  /**
   * Gets the Hub cookie.
   */
  getHub: CookieGet<HubCookie, HubCookieWithTarget>;
  /**
   * Sets the Hub cookie.
   */
  setHub: CookieSet<HubCookie>;
  /**
   * Gets the UTM cookie.
   */
  getUTM: CookieGet<UTMCookie>;
  /**
   * Sets the UTM cookie.
   */
  setUTM: CookieSet<UTMCookie>;
}

Added in v2.0.0

HubCookie (interface)

Defines the shape of SDK’s cookie value.

Signature

export interface HubCookie {
  token: string;
  workspaceId: string;
  nodeId: string;
  debug: boolean;
  context: string;
  contextInfo: Record<string, unknown>;
  sid: string;
  customerId?: string;
  hash?: string;
  target?: 'ENTRY' | 'AGGREGATE';
  aggregateToken?: string;
  aggregateNodeId?: string;
}

Added in v2.0.0

HubCookieWithTarget (interface)

Makes mandatory the SDK’s cookie target property.

Signature

export interface HubCookieWithTarget extends HubCookie {
  target: Exclude<HubCookie['target'], undefined>;
}

Added in v2.1.0

UTMCookie (interface)

Defines the shape of the UTM cookie value.

Signature

export interface UTMCookie {
  utm_source?: string;
  utm_medium?: string;
  utm_term?: string;
  utm_content?: string;
  utm_campaign?: string;
}

Added in v2.0.0

utils

CookieGet (interface)

Signature

export interface CookieGet<B, A extends B = B> {
  (fallback?: B): Effect<A>;
}

Added in v2.0.0

CookieSet (interface)

Signature

export interface CookieSet<A> {
  (value: A, options?: Cookies.CookieAttributes): Effect;
}

Added in v2.0.0