Modules
Synerise
Declared In
lib/main/Synerise.js
Declaration
class Synerise
Properties
Property | Type | Description |
---|---|---|
Initializer | SyneriseInitializer |
Returns new builder object used for initialization |
Settings | SettingsModule |
Returns Settings module when Synerise is initialized |
Client | ClientModule |
Returns Client module when Synerise is initialized |
Tracker | TrackerModule |
Returns Tracker module when Synerise is initialized |
Notifications | NotificationsModule |
Returns Notifications module when Synerise is initialized |
Injector | InjectorModule |
Returns Injector module when Synerise is initialized |
Promotions | PromotionsModule |
Returns Promotions module when Synerise is initialized |
Content | ContentModule |
Returns Content module when Synerise is initialized |
Methods
Sets the callback function that is invoked when the Synerise SDK is initialized.
public static onReady(callback: () => void)
Sets the callback function that is invoked when an error occurs while initializing the Synerise SDK.
public static onError(callback: (error: Error) => void)
Checks if Synerise is initialized.
public static isInitialized(): boolean
Changes Client API Key dynamically.
public static changeClientApiKey(clientApiKey: string)
Synerise Initializer
Builder object to initialize the SDK step by step.
Declared In
lib/main/Synerise.js
Declaration
class SyneriseInitializer
Methods
Sets Client API Key for the SDK initialization.
public withClientApiKey(clientApiKey: string)
Sets Synerise API base URL for SDK initialization in a custom environment.
public withBaseUrl(baseUrl: string)
Enables/disables console logs.
public withDebugModeEnabled(debugModeEnabled: boolean)
Enables/disables crash handling.
public withCrashHandlingEnabled(crashHandlingEnabled: boolean)
Sets settings that have to be set before Synerise is initialized.
public withSettings(settings: ISettingsOptions)
Initializes Synerise.
public init()
BaseModule
Main module abstract class for inheriting classes.
Declared In
lib/main/modules/BaseModule.js
Declaration
class BaseModule
Notifications
The module for managing notifications.
Declared In
lib/main/modules/NotificationsModule.js
Related To
Inherits From
Declaration
class NotificationsModule extends Module
Methods
Registers a customer for Push Notifications. (Click for more details)
public registerForNotifications(registrationToken: string, mobileAgreement: boolean, onSuccess: () => void, onError: (error: Error) => void)
Checks if a notification’s sender is Synerise. (Click for more details)
public isSyneriseNotification(payload: object): boolean
Checks if a notification’s sender is Synerise and its kind is Simple Push. (Click for more details)
public isSyneriseSimplePush(payload: object): boolean
Checks if a notification’s sender is Synerise and its kind is Banner. (Click for more details)
public isSyneriseBanner(payload: object): boolean
Checks if a notification’s sender is Synerise and its kind is Silent Command. (Click for more details)
public isSilentCommand(payload: object): boolean
Checks if a notification’s sender is Synerise and its kind is Silent SDK Command. (Click for more details)
public isSilentSDKCommand(payload: object): boolean
Checks if the notification payload is encrypted by Synerise. (Click for more details)
public isNotificationEncrypted(payload: object): boolean
Decrypts a notification payload. (Click for more details)
public decryptNotification(payload: object): object | null
Handles a notification payload with an action and starts activity. (Click for more details)
public handleNotification(payload: object, actionIdentifier: string | null)
Client
The module for managing customer account data, registration, and authorization.
Declared In
lib/main/modules/ClientModule.js
Related To
ClientAccountRegisterContext
ClientIdentityProvider
ClientAuthContext
ClientOAuthAuthenticationContext
ClientFacebookAuthenticationContext
ClientAppleSignInAuthenticationContext
ClientAccountInformation
ClientAccountUpdateContext
Token
Inherits From
Declaration
class ClientModule extends Module
Methods
Registers a new customer account. (Click for more details)
public registerAccount(context: ClientAccountRegisterContext, onSuccess: () => void, onError: (error: Error) => void)
Confirms a customer’s account. (Click for more details)
public confirmAccount(token: string, onSuccess: () => void, onError: (error: Error) => void)
Activates a customer’s account. (Click for more details)
public activateAccount(email: string, onSuccess: () => void, onError: (error: Error) => void)
Signs a customer in with email and password. (Click for more details)
public signIn(email: string, password: string, onSuccess: () => void, onError: (error: Error) => void)
Signs a customer in conditionally with email and password. (Click for more details)
public signInConditionally(email: string, password: string, onSuccess: () => void, onError: (error: Error) => void)
Signs a customer in with an external token. (Click for more details)
public authenticate(token: string, provider: ClientIdentityProvider, context: ClientAuthContext, onSuccess: (authResult: ClientConditionalAuthResult) => void, onError: (error: Error) => void)
Signs a customer in conditionally with an external token. (Click for more details)
public authenticateConditionally(token: string, provider: ClientIdentityProvider, context: ClientAuthContext, onSuccess: (authResult: ClientConditionalAuthResult) => void, onError: (error: Error) => void)
DEPRECATED - Signs a customer in with OAuth Access Token. (Click for more details)
public authenticateByOAuth(accessToken: string, context: ClientOAuthAuthenticationContext, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Signs in a registered customer with OAuth Access Token. (Click for more details)
public authenticateByOAuthIfRegistered(accessToken: string, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Signs a customer in with Facebook Token. (Click for more details)
public authenticateByFacebook(facebookToken: string, context: ClientFacebookAuthenticationContext, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Signs in a registered customer with Facebook Token. (Click for more details)
public authenticateByFacebookIfRegistered(facebookToken: string, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Signs a customer in with Sign In With Apple. (Click for more details)
public authenticateByAppleSignIn(identityToken: string, context: ClientAppleSignInAuthenticationContext, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Signs in a registered customer with Sign In With Apple. (Click for more details)
public authenticateByAppleSignInIfRegistered(identityToken: string, authID: string, onSuccess: () => void, onError: (error: Error) => void)
Checks if a customer is signed in (if customer’s token is not expired). (Click for more details)
public isSignedIn(): boolean
Signs out a customer. (Click for more details)
public signOut()
Refreshes the customer’s token. (Click for more details)
public refreshToken(onSuccess: () => void, onError: (error: Error) => void)
Retrieves the customer’s token. (Click for more details)
public retrieveToken(onSuccess: (token: Token) => void, onError: (error: Error) => void)
Retrieves the customer’s UUID. (Click for more details)
public getUUID(): string
Regenerates the customer’s UUID and clears authentication token, login (if applicable), custom email, and custom identifier. (Click for more details)
public regenerateUUID()
Regenerates the customer’s UUID and clears authentication token, login (if applicable), custom email, and custom identifier. (Click for more details)
public regenerateUUIDWithClientIdentifier(clientIdentifier: string)
Destroys the whole session completely. (Click for more details)
public destroySession()
Gets a customer’s account information. (Click for more details)
public getAccount(onSuccess: (clientAccountInformation: ClientAccountInformation) => void, onError: (error: Error) => void)
Updates a customer’s account information. (Click for more details)
public updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void)
Requests a customer’s password reset with email. (Click for more details)
public requestPasswordReset(email: string, onSuccess: () => void, onError: (error: Error) => void)
Confirms a customer’s password reset with a new password and token. (Click for more details)
public confirmPasswordReset(password: string, token: string, onSuccess: () => void, onError: (error: Error) => void)
Changes a customer’s password. (Click for more details)
public changePassword(oldPassword: string, newPassword: string, onSuccess: () => void, onError: (error: Error) => void)
Requests a customer’s email change. (Click for more details)
public requestEmailChange(email: string, password: string | null, externalToken: string | null, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
Confirms a customer’s email change with a token. (Click for more details)
public confirmEmailChange(token: string, newsletterAgreement: Boolean, onSuccess: () => void, onError: (error: Error) => void)
Requests a customer’s phone update. (Click for more details)
public requestPhoneUpdate(phone: string, onSuccess: () => void, onError: (error: Error) => void)
Confirms a customer’s phone update with a code. (Click for more details)
public confirmPhoneUpdate(phone: string, confirmationCode: string, smsAgreement: boolean, onSuccess: () => void, onError: (error: Error) => void)
Requests a customer’s account registration process with PIN code. (Click for more details)
public requestAccountActivationByPin(email: string, onSuccess: () => void, onError: (error: Error)
Confirms a customer’s account registration process with PIN code. (Click for more details)
public confirmAccountActivationByPin(pinCode: string, email: string, onSuccess: () => void, onError: (error: Error) => void)
Deletes a customer’s account information. (Click for more details)
public deleteAccountByIdentityProvider(clientAuthFactor: string, clientIdentityProvider: ClientIdentityProvider, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
Deletes a customer’s account information. (Click for more details)
public deleteAccount(password: string, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Deletes a customer’s account information by OAuth. (Click for more details)
public deleteAccountByOAuth(password: string, onSuccess: () => void, onError: (error: Error) => void)
DEPRECATED - Deletes a customer’s account information by Facebook. (Click for more details)
public deleteAccountByFacebook(password: string, onSuccess: () => void, onError: (error: Error) => void)
Recognizes anonymous customer and saves personal information from their database entries. (Click for more details)
public recognizeAnonymous(email: string | null, customIdentify: string | null, parameters: Record<string, any> | null)
Tracker
The module for sending event tracking data to Synerise backend. Tracking is performed by creating pre-defined or custom event objects and sending these to Synerise. It also includes automatic event interception by the Auto-Tracking feature.
Declared In
lib/main/modules/TrackerModule.js
Related To
Inherits From
Declaration
class TrackerModule extends Module
Methods
Sets the custom identifier for the current customer. The custom identifier will be sent with every event in event params. (Click for more details)
public setCustomIdentifier(identifier: string)
Sets the custom email for the current customer. The custom email will be sent with every event in event params. (Click for more details)
public setCustomEmail(email: string)
Adds a new event to the queue and sends available events to the server if possible. (Click for more details)
public send(event: Event)
Sends events from the queue to the server by force. (Click for more details)
public flushEvents(onSuccess: () => void)
Injector
The module for handling Synerise UI activities such as walkthrough, banner, simple push, and so on.
Declared In
lib/main/modules/InjectorModule.js
Inherits From
Declaration
class InjectorModule extends Module
Methods
Sets an object for Injector listener methods.
public setListener(listener: IInjectorListener)
Sets an object for banner listener methods.
public setBannerListener(listener: IInjectorBannerListener)
Sets if banners should be shown or not.
public setShouldBannerPresentFlag(shouldPresentBanner: boolean)
Fetches banners set for mobile campaigns and caches the valid ones. (Click for more details)
public fetchBanners(onSuccess: (banners: Array<Object>) => void, onError: (error: Error) => void)
Provides valid banners directly from SDK cache. (Click for more details)
public getBanners(): Array<Object>
Shows a banner immediately. (Click for more details)
public showBanner(banner: Object, markPresented: boolean)
Sets an object for walkthrough listener methods.
public setWalkthroughListener(listener: IInjectorWalkthroughListener)
Fetches a walkthrough. (Click for more details)
public getWalkthrough()
Shows a walkthrough when it is loaded. (Click for more details)
public showWalkthrough()
Checks if a walkthrough is loaded. (Click for more details)
public isWalkthroughLoaded(): boolean
Checks if the walkthrough is unique compared to the previous one. (Click for more details)
public isLoadedWalkthroughUnique(): boolean
Promotions
The module for handling promotions and vouchers from Synerise SDK.
Declared In
lib/main/modules/PromotionsModule.js
Related To
PromotionResponse
Promotion
AssignVoucherResponse
VoucherCodesResponse
Inherits From
Declaration
class PromotionsModule extends Module
Methods
Gets all available promotions that are defined for this customer. (Click for more details)
public getAllPromotions(onSuccess: (promotionResponse: PromotionResponse) => void, onError: (error: Error) => void)
Gets promotions that are defined for parameters provided in the query object. (Click for more details)
public getPromotions(apiQuery: PromotionsApiQuery, onSuccess: (promotionResponse: PromotionResponse) => void, onError: (error: Error) => void)
Gets a promotion identified by UUID. (Click for more details)
public getPromotionByUUID(uuid: string, onSuccess: (promotion: Promotion) => void, onError: (error: Error) => void)
Gets a promotion identified by code. (Click for more details)
public getPromotionByCode(code: string, onSuccess: (promotion: Promotion) => void, onError: (error: Error) => void)
Activates a promotion identified by UUID. (Click for more details)
public activatePromotionByUUID(uuid: string, onSuccess: () => void, onError: (error: Error) => void)
Activates a promotion identified by code. (Click for more details)
public activatePromotionByCode(code: string, onSuccess: () => void, onError: (error: Error) => void)
Activates promotions with code or with UUID in a batch. (Click for more details)
public activatePromotionsBatch(promotionsIdentifiers: Array<PromotionIdentifier>, onSuccess: () => void, onError: (error: Error) => void)
De-activates a promotion identified by UUID. (Click for more details)
public deactivatePromotionByUUID(uuid: string, onSuccess: () => void, onError: (error: Error) => void)
De-activates promotion identified by code. (Click for more details)
public deactivatePromotionByCode(code: string, onSuccess: () => void, onError: (error: Error) => void)
De-activates promotions with code or with UUID in a batch. (Click for more details)
public deactivatePromotionsBatch(promotionsIdentifiers: Array<PromotionIdentifier>, onSuccess: () => void, onError: (error: Error) => void)
Gets a voucher code permanently assigned to a customer (the same code every time). If no code is permanently assigned, the method assigns a voucher from the provided pool so that the same code is returned in all future calls. (Click for more details)
public getOrAssignVoucher(poolUuid: string, onSuccess: (assignVoucherRespone: AssignVoucherResponse) => void, onError: (error: Error) => void)
Assigns a voucher from a pool to a customer. Every request returns different code until the pool is empty. (Click for more details)
public assignVoucherCode(poolUuid: string, onSuccess: (assignVoucherRespone: AssignVoucherResponse) => void, onError: (error: Error) => void)
Gets a customer’s voucher codes. (Click for more details)
public getAssignedVoucherCodes(onSuccess: (voucherCodesResponse: VoucherCodesResponse) => void, onError: (error: Error) => void)
Content
The module for handling content from Synerise backend such as documents, recommendations, and so on.
Declared In
lib/main/modules/ContentModule.js
Related To
RecommendationResponse
Recommendation
DocumentsApiQuery
Inherits From
Declaration
class ContentModule extends Module
Methods
Gets the document that is defined for the provided slug. (Click for more details)
public getDocument(slug: string, onSuccess: (document: Object) => void, onError: (error: Error) => void)
Gets documents that are defined for parameters provided in the query object. (Click for more details)
public getDocuments(apiQuery: DocumentsApiQuery, onSuccess: (documents: Array<Object>) => void, onError: (error: Error) => void)
Gets recommendations that are defined for the options provided. (Click for more details)
public getRecommendations(options: RecommendationOptions, onSuccess: (recommendationResponse: RecommendationResponse) => void, onError: (error: Error) => void)
Gets the customer’s highest-priority screen view campaign. (Click for more details)
public getScreenView(onSuccess: (screenViewResponse: ScreenViewResponse) => void, onError: (error: Error) => void)