-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webengage): add webengage plugin (#2604)
* feat(webengage): add webengage plugin * refactor
- Loading branch information
1 parent
c671386
commit bd5bd7e
Showing
1 changed file
with
201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; | ||
|
||
/** | ||
* @name Webengage | ||
* @description | ||
* Ionic-Native wrapper that wraps Webengage Cordova plugin for Android and iOS | ||
* | ||
* @usage | ||
* ```typescript | ||
* import { Webengage, WebengageUser, WebengagePush, WebengageNotification } from '@ionic-native/webengage'; | ||
* | ||
* | ||
* constructor(private webengage: Webengage, private webengageUser: WebengageUser, private webengagePush: WebengagePush, private webengageNotification: WebengageNotification ) { } | ||
* | ||
* ... | ||
* | ||
* this.webengage.engage(); | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
pluginName: 'Webengage', | ||
plugin: 'cordova-plugin-webengage', | ||
pluginRef: 'webengage', | ||
repo: 'https://github.com/WebEngage/cordova-plugin', | ||
install: '', | ||
installVariables: [], | ||
platforms: ['Android', 'iOS'] | ||
}) | ||
@Injectable() | ||
export class Webengage extends IonicNativePlugin { | ||
/** | ||
* Initializes WebEngage SDK | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
engage(): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Sets WebEngage SDK configuration | ||
* @param {string} key | ||
* @param {any} value | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
options(key: string, value: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Tracks event | ||
* @param {string} eventName | ||
* @param {any} attributes | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
track(eventName: string, attributes: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Tracks screen | ||
* @param {string} eventName | ||
* @param {any} screenData | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
screen(screenName: string, screenData: any): Promise<any> { | ||
return; | ||
} | ||
} | ||
|
||
@Plugin({ | ||
pluginName: 'Webengage', | ||
plugin: 'cordova-plugin-webengage', | ||
pluginRef: 'webengage.user', | ||
repo: 'https://github.com/WebEngage/cordova-plugin', | ||
install: '', | ||
installVariables: [], | ||
platforms: ['Android', 'iOS'] | ||
}) | ||
@Injectable() | ||
export class WebengageUser extends IonicNativePlugin { | ||
/** | ||
* Logs user in | ||
* @param {string} userId | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
login(userId: string): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Logs user out | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
logout(): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Sets user attribute | ||
* @param {string} key | ||
* @param {any} value | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
setAttribute(key: string, value: any): Promise<any> { | ||
return; | ||
} | ||
} | ||
|
||
@Plugin({ | ||
pluginName: 'Webengage', | ||
plugin: 'cordova-plugin-webengage', | ||
pluginRef: 'webengage.push', | ||
repo: 'https://github.com/WebEngage/cordova-plugin', | ||
install: '', | ||
installVariables: [], | ||
platforms: ['Android', 'iOS'] | ||
}) | ||
@Injectable() | ||
export class WebengagePush extends IonicNativePlugin { | ||
/** | ||
* Callback function is invoked when a push notification is clicked | ||
* @param {any} callback | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
onClick(callback: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Sets push notification configuration | ||
* @param {string} key | ||
* @param {any} value | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
options(key: string, value: any): Promise<any> { | ||
return; | ||
} | ||
} | ||
|
||
@Plugin({ | ||
pluginName: 'Webengage', | ||
plugin: 'cordova-plugin-webengage', | ||
pluginRef: 'webengage.notification', | ||
repo: 'https://github.com/WebEngage/cordova-plugin', | ||
install: '', | ||
installVariables: [], | ||
platforms: ['Android', 'iOS'] | ||
}) | ||
@Injectable() | ||
export class WebengageNotification extends IonicNativePlugin { | ||
/** | ||
* Callback function is invoked when a in-app notification is shown | ||
* @param {any} callback | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
onShown(callback: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Callback function is invoked when a in-app notification is clicked | ||
* @param {any} callback | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
onClick(callback: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Callback function is invoked when a in-app notification is dismissed | ||
* @param {any} callback | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
onDismiss(callback: any): Promise<any> { | ||
return; | ||
} | ||
|
||
/** | ||
* Sets in-app notification configuration | ||
* @param {string} key | ||
* @param {any} value | ||
* @return {Promise<any>} | ||
*/ | ||
@Cordova() | ||
options(key: string, value: any): Promise<any> { | ||
return; | ||
} | ||
} |