feat(cooee): add plugin (#4228)

* feat(Cooee): add Cooee plugin

* chore(Cooee): update document

* Update index.ts

Co-authored-by: Daniel Sogl <daniel@sogls.de>
This commit is contained in:
Ashish Gaikwad 2022-06-30 14:29:42 +05:30 committed by GitHub
parent 19fc222ea9
commit 7a528b42d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<any>} Returns a promise so user can be notified.
* @param eventName {string} Name of the event
* @param eventProperties {Record<string, any>} Properties of the event
*/
@Cordova()
sendEvent(eventName: string, eventProperties: Record<string, any>): Promise<any> {
return;
}
/**
* Send the given user data and user properties to the server.
* @return {Promise<any>} Returns a promise so user can be notified.
* @param userProfile {Record<string, any>} User data to send to the server
*/
@Cordova()
updateUserProfile(userProfile: Record<string, any>): Promise<any> {
return;
}
/**
* Send the given screen name with every event.
* @return {Promise<any>} Returns a promise so user can be notified.
* @param screenName {string} Screen name to send to the server
*/
@Cordova()
setCurrentScreen(screenName: string): Promise<any> {
return;
}
/**
* Provide Cooee's userID assigned to the current user.
* @return {Promise<any>} Returns a promise with userId.
*/
@Cordova()
getUserID(): Promise<any> {
return;
}
}