platform-helpers/trace-event.js

'use strict';

/**
 * An incoming event (or visit_end pseudoevent), a summary of the component-level 'events' that make up a Tealium Trace.
 *
 * @hideconstructor
 */
class TraceEvent {
  constructor () {
    /**
     * The overall 'event_type' for the ParentEvent. Can be 'visit_end' for the pseudoevent, 'tealium_event' from the incoming event, or link/view as a fallback.
     * @type string
     */
    this.trace_event_type = 'unknown';
    /**
     * The tealium_event value on the incoming event, if present
     * @type string
     */
    this.tealium_event = '';

    /**
     * The relevant Visitor Profile before this event, an instance of [VisitorProfile]{@link module:traceHelper~VisitorProfile}
     * @type object
     * @instance [VisitorProfile]{@link module:traceHelper~VisitorProfile}
     */
    this.visitor_profile_before = {};

    /**
     * The relevant Visitor Profile after this event, an instance of [VisitorProfile]{@link module:traceHelper~VisitorProfile}
     * @type object
     */
    this.visitor_profile_after = {};

    /**
     * The raw names of audiences membership before this event, if any
     * @type array
     */
    this.audiences_before = [];

    /**
     * The raw names of audiences left as a result of this event, if any
     * @type array
     */
    this.audiences_left = [];

    /**
     * The raw names of audiences joined as a result of this event, if any
     * @type array
     */
    this.audiences_joined = [];

    /**
     * The raw names of audiences membership after this event, if any
     * @type array
     */
    this.audiences_after = [];

    /**
     * The raw names of badges before this event, if any
     * @type array
     */
    this.badges_before = [];

    /**
     * The raw names of badges added as a result of this event, if any
     * @type array
     */
    this.badges_added = [];

    /**
     * The raw names of badges removed as a result of this event, if any
     * @type array
     */
    this.badges_removed = [];

    /**
     * The raw names of badges after this event, if any
     * @type array
     */
    this.badges_after = [];

    /**
     * The summarized events included in this event
     * @type array
     */
    this.entries = [];

    /**
     * The raw Trace JSON entries included in this event (directly from the internal API response)
     * @type array
     */
    this.rawEntries = [];

    /**
     * Actions executed as a result of this event, if any. Each element is an instance of [ConnectorAction]{@link module:ConnectorAction}
     * @type array
     *
     */
    this.executed_actions = [];

    /**
     * Actions triggered (not necessarily executed or successful) as a result of this event, if any.  Each element is an instance of [ConnectorAction]{@link module:ConnectorAction}
     * @type array
     */
    this.triggered_actions = [];

    /**
     * Batch actions queued as a result of this event, if any. .Each element is an instance of [ConnectorAction]{@link module:ConnectorAction}
     * @type array
     */
    this.queued_actions = [];

    /**
     * Delayed actions queued as a result of this event, if any. Each element is an instance of [ConnectorAction]{@link module:ConnectorAction}
     * @type array
     */
    this.queued_delayed_actions = [];

    /**
     * Actions that were blocked for some reason (consent, usually), if any. Each element is an instance of [ConnectorAction]{@link module:ConnectorAction}
     * @type array
     */
    this.not_triggered_actions = [];
  }
}

module.exports = TraceEvent;