From 7a528b42d9427222d01b8e0da675045996be042d Mon Sep 17 00:00:00 2001 From: Ashish Gaikwad Date: Thu, 30 Jun 2022 14:29:42 +0530 Subject: [PATCH] feat(cooee): add plugin (#4228) * feat(Cooee): add Cooee plugin * chore(Cooee): update document * Update index.ts Co-authored-by: Daniel Sogl --- .../plugins/lets-cooee/index.ts | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts diff --git a/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts b/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts new file mode 100644 index 000000000..016e0493e --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/lets-cooee/index.ts @@ -0,0 +1,75 @@ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; + +/** + * @name Lets Cooee + * @description + * AI driven Personalised Notifications for Better Customer Engagement + * + * @usage + * ```typescript + * import { Cooee } from '@awesome-cordova-plugins/lets-cooee/nx'; + * + * + * constructor(private cooee: Cooee) { } + * + * ... + * + * + * this.cooee.functionName('Hello', 123) + * .then((res: any) => console.log(res)) + * .catch((error: any) => console.error(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'Cooee', + plugin: '@letscooee/cordova-plugin', + pluginRef: 'cordova.plugins.Cooee', + repo: 'https://github.com/letscooee/cordova-plugin-cooee', + install: 'ionic cordova plugin add @letscooee/cordova-plugin --variable COOEE_APP_ID=appId', + installVariables: ['COOEE_APP_ID'], + platforms: ['Android', 'iOS'], +}) +@Injectable() +export class Cooee extends AwesomeCordovaNativePlugin { + /** + * Send the given user data and user properties to the server. + * @return {Promise} Returns a promise so user can be notified. + * @param eventName {string} Name of the event + * @param eventProperties {Record} Properties of the event + */ + @Cordova() + sendEvent(eventName: string, eventProperties: Record): Promise { + return; + } + + /** + * Send the given user data and user properties to the server. + * @return {Promise} Returns a promise so user can be notified. + * @param userProfile {Record} User data to send to the server + */ + @Cordova() + updateUserProfile(userProfile: Record): Promise { + return; + } + + /** + * Send the given screen name with every event. + * @return {Promise} Returns a promise so user can be notified. + * @param screenName {string} Screen name to send to the server + */ + @Cordova() + setCurrentScreen(screenName: string): Promise { + return; + } + + /** + * Provide Cooee's userID assigned to the current user. + * @return {Promise} Returns a promise with userId. + */ + @Cordova() + getUserID(): Promise { + return; + } +}