From bd5bd7ea9df69676a837853c532fbb9613bfd247 Mon Sep 17 00:00:00 2001 From: Ashwin Dinesh Date: Sun, 29 Jul 2018 12:41:05 +0530 Subject: [PATCH] feat(webengage): add webengage plugin (#2604) * feat(webengage): add webengage plugin * refactor --- src/@ionic-native/plugins/webengage/index.ts | 201 +++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 src/@ionic-native/plugins/webengage/index.ts diff --git a/src/@ionic-native/plugins/webengage/index.ts b/src/@ionic-native/plugins/webengage/index.ts new file mode 100644 index 0000000000..3ff3da34c6 --- /dev/null +++ b/src/@ionic-native/plugins/webengage/index.ts @@ -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} + */ + @Cordova() + engage(): Promise { + return; + } + + /** + * Sets WebEngage SDK configuration + * @param {string} key + * @param {any} value + * @return {Promise} + */ + @Cordova() + options(key: string, value: any): Promise { + return; + } + + /** + * Tracks event + * @param {string} eventName + * @param {any} attributes + * @return {Promise} + */ + @Cordova() + track(eventName: string, attributes: any): Promise { + return; + } + + /** + * Tracks screen + * @param {string} eventName + * @param {any} screenData + * @return {Promise} + */ + @Cordova() + screen(screenName: string, screenData: any): Promise { + 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} + */ + @Cordova() + login(userId: string): Promise { + return; + } + + /** + * Logs user out + * @return {Promise} + */ + @Cordova() + logout(): Promise { + return; + } + + /** + * Sets user attribute + * @param {string} key + * @param {any} value + * @return {Promise} + */ + @Cordova() + setAttribute(key: string, value: any): Promise { + 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} + */ + @Cordova() + onClick(callback: any): Promise { + return; + } + + /** + * Sets push notification configuration + * @param {string} key + * @param {any} value + * @return {Promise} + */ + @Cordova() + options(key: string, value: any): Promise { + 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} + */ + @Cordova() + onShown(callback: any): Promise { + return; + } + + /** + * Callback function is invoked when a in-app notification is clicked + * @param {any} callback + * @return {Promise} + */ + @Cordova() + onClick(callback: any): Promise { + return; + } + + /** + * Callback function is invoked when a in-app notification is dismissed + * @param {any} callback + * @return {Promise} + */ + @Cordova() + onDismiss(callback: any): Promise { + return; + } + + /** + * Sets in-app notification configuration + * @param {string} key + * @param {any} value + * @return {Promise} + */ + @Cordova() + options(key: string, value: any): Promise { + return; + } +}