|
| 1 | +import { Injectable } from '@angular/core'; |
| 2 | +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @name Lets Cooee |
| 6 | + * @description |
| 7 | + * AI driven Personalised Notifications for Better Customer Engagement |
| 8 | + * |
| 9 | + * @usage |
| 10 | + * ```typescript |
| 11 | + * import { Cooee } from '@awesome-cordova-plugins/lets-cooee/nx'; |
| 12 | + * |
| 13 | + * |
| 14 | + * constructor(private cooee: Cooee) { } |
| 15 | + * |
| 16 | + * ... |
| 17 | + * |
| 18 | + * |
| 19 | + * this.cooee.functionName('Hello', 123) |
| 20 | + * .then((res: any) => console.log(res)) |
| 21 | + * .catch((error: any) => console.error(error)); |
| 22 | + * |
| 23 | + * ``` |
| 24 | + */ |
| 25 | +@Plugin({ |
| 26 | + pluginName: 'Cooee', |
| 27 | + plugin: '@letscooee/cordova-plugin', |
| 28 | + pluginRef: 'cordova.plugins.Cooee', |
| 29 | + repo: 'https://github.com/letscooee/cordova-plugin-cooee', |
| 30 | + install: 'ionic cordova plugin add @letscooee/cordova-plugin --variable COOEE_APP_ID=appId', |
| 31 | + installVariables: ['COOEE_APP_ID'], |
| 32 | + platforms: ['Android', 'iOS'], |
| 33 | +}) |
| 34 | +@Injectable() |
| 35 | +export class Cooee extends AwesomeCordovaNativePlugin { |
| 36 | + /** |
| 37 | + * Send the given user data and user properties to the server. |
| 38 | + * @return {Promise<any>} Returns a promise so user can be notified. |
| 39 | + * @param eventName {string} Name of the event |
| 40 | + * @param eventProperties {Record<string, any>} Properties of the event |
| 41 | + */ |
| 42 | + @Cordova() |
| 43 | + sendEvent(eventName: string, eventProperties: Record<string, any>): Promise<any> { |
| 44 | + return; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Send the given user data and user properties to the server. |
| 49 | + * @return {Promise<any>} Returns a promise so user can be notified. |
| 50 | + * @param userProfile {Record<string, any>} User data to send to the server |
| 51 | + */ |
| 52 | + @Cordova() |
| 53 | + updateUserProfile(userProfile: Record<string, any>): Promise<any> { |
| 54 | + return; |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Send the given screen name with every event. |
| 59 | + * @return {Promise<any>} Returns a promise so user can be notified. |
| 60 | + * @param screenName {string} Screen name to send to the server |
| 61 | + */ |
| 62 | + @Cordova() |
| 63 | + setCurrentScreen(screenName: string): Promise<any> { |
| 64 | + return; |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Provide Cooee's userID assigned to the current user. |
| 69 | + * @return {Promise<any>} Returns a promise with userId. |
| 70 | + */ |
| 71 | + @Cordova() |
| 72 | + getUserID(): Promise<any> { |
| 73 | + return; |
| 74 | + } |
| 75 | +} |
0 commit comments