Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add notification types as an enum in utils
  • Loading branch information
Matt Carroll committed Aug 7, 2019
commit c98a5bfb2ef7a01da4cfdfa6e06f6d98b48b295a
41 changes: 41 additions & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,44 @@ export function sprintf(format: string, ...args: any[]): string {
}
})
}
/*
* Notification types for use with NotificationCenter
* Format is EVENT: <list of parameters to callback>
*
* SDK consumers can use these to register callbacks with the notification center.
*
* @deprecated since 3.1.0
* ACTIVATE: An impression event will be sent to Optimizely
* Callbacks will receive an object argument with the following properties:
* - experiment {Object}
* - userId {string}
* - attributes {Object|undefined}
* - variation {Object}
* - logEvent {Object}
*
* DECISION: A decision is made in the system. i.e. user activation,
* feature access or feature-variable value retrieval
* Callbacks will receive an object argument with the following properties:
* - type {string}
* - userId {string}
* - attributes {Object|undefined}
* - decisionInfo {Object|undefined}
*
* OPTIMIZELY_CONFIG_UPDATE: This Optimizely instance has been updated with a new
* config
*
* TRACK: A conversion event will be sent to Optimizely
* Callbacks will receive the an object argument with the following properties:
* - eventKey {string}
* - userId {string}
* - attributes {Object|undefined}
* - eventTags {Object|undefined}
* - logEvent {Object}
*
*/
export enum NOTIFICATION_TYPES {
ACTIVATE = "ACTIVATE:experiment, user_id,attributes, variation, event",
DECISION = "DECISION:type, userId, attributes, decisionInfo",
OPTIMIZELY_CONFIG_UPDATE = "OPTIMIZELY_CONFIG_UPDATE",
TRACK = "TRACK:event_key, user_id, attributes, event_tags, event"
}