diff --git a/src/@awesome-cordova-plugins/plugins/we-cap-inbox/index.ts b/src/@awesome-cordova-plugins/plugins/we-cap-inbox/index.ts new file mode 100644 index 000000000..fdb1ddeed --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/we-cap-inbox/index.ts @@ -0,0 +1,160 @@ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, AwesomeCordovaNativePlugin } from '@awesome-cordova-plugins/core'; + +/** + * @name WE Cap Inbox + * @description + * This plugin provides functionalities to manage notifications in your app. + * + * @usage + * ```typescript + * import { WECapInbox } from '@awesome-cordova-plugins/we-cap-inbox'; + * + * constructor(private wECapInbox: WECapInbox) { } + * + * ... + * + * this.WECapInbox.getNotificationCount() + * .then((count: number) => console.log(count)) + * .catch((error: string) => console.error(error)); + * ``` + */ + +@Plugin({ + pluginName: 'WECapInbox', + plugin: 'we-notificationinbox-cordova', // npm package name, example: cordova-plugin-camera + pluginRef: 'WENotificationInboxPlugin', // the variable reference to call the plugin, + repo: 'https://github.com/WebEngage/we-ionic-notification-inbox', + platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] +}) +@Injectable() +export class WECapInbox extends AwesomeCordovaNativePlugin { + /** + * Resets the notification count. + * @returns {Promise} + */ + @Cordova() + resetNotificationCount(): Promise { + return; + } + + /** + * Retrieves the count of notifications. + * @param {function} successCallback + * @param {function} errorCallback + * @returns {Promise} - The count of notifications. + */ + @Cordova() + getNotificationCount(successCallback: (count: String) => void, errorCallback: (error: string) => void): Promise { + return; + } + + /**- + * Retrieves Notification List + * @param {JsonObject | null} offset - Optional offset for notifications + * @param {function} successCallback + * @param {function} errorCallback + * @returns {Promise} + */ + @Cordova() + getNotificationList( + offset: JsonObject | null, + successCallback: (notifications: NotificationResponse) => void, + errorCallback: (error: string) => void + ): Promise { + return; + } + + /** + * Marks a specific notification as read. + * @param {JsonObject} notificationObject - The notification to mark as read. + * @returns {Promise} + */ + @Cordova() + markRead(notificationObject: JsonObject): Promise { + return; + } + + /** + * Marks a specific notification as unread. + * @param {JsonObject} notificationObject - The notification to mark as unread. + * @returns {Promise} + */ + @Cordova() + markUnread(notificationObject: JsonObject): Promise { + return; + } + + /** + * Tracks a click event on a notification. + * @param {JsonObject} notificationObject - The notification that was clicked. + * @returns {Promise} + */ + @Cordova() + trackClick(notificationObject: JsonObject): Promise { + return; + } + + /** + * Tracks the view event of a notification. + * @param {JsonObject} notificationObject - The notification that was viewed. + * @returns {Promise} + */ + @Cordova() + trackView(notificationObject: JsonObject): Promise { + return; + } + + /** + * Marks a specific notification as deleted. + * @param {JsonObject} notificationObject - The notification to delete. + * @returns {Promise} + */ + @Cordova() + markDelete(notificationObject: JsonObject): Promise { + return; + } + + /** + * Marks all notifications as read. + * @param {JsonArray} notificationList - An array of notification identifiers to mark as read. + * @returns {Promise} + */ + @Cordova() + readAll(notificationList: JsonArray): Promise { + return; + } + + /** + * Marks all notifications as unread. + * @param {JsonArray} notificationList - An array of notification identifiers to mark as unread. + * @returns {Promise} + */ + @Cordova() + unReadAll(notificationList: JsonArray): Promise { + return; + } + + /** + * Deletes all notifications. + * @param {JsonArray} notificationList - An array of notification identifiers to delete. + * @returns {Promise} + */ + @Cordova() + deleteAll(notificationList: JsonArray): Promise { + return; + } +} + +export type JsonValue = string | number | boolean | null | JsonObject | JsonArray; + +export type NotificationResponse = { + hasNext: boolean; + messageList: JsonArray; +}; + +export type JsonObject = { + [key: string]: JsonValue; +}; + +export type JsonArray = JsonValue[]; diff --git a/src/@awesome-cordova-plugins/plugins/webengage/index.ts b/src/@awesome-cordova-plugins/plugins/webengage/index.ts index 5f0139103..78bd3ac77 100644 --- a/src/@awesome-cordova-plugins/plugins/webengage/index.ts +++ b/src/@awesome-cordova-plugins/plugins/webengage/index.ts @@ -7,7 +7,7 @@ import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-pl * Awesome Cordova Plugins wrapper that wraps Webengage Cordova plugin for Android and iOS * @usage * ```typescript - * import { Webengage, WebengageUser, WebengagePush, WebengageNotification } from '@awesome-cordova-plugins/webengage/ngx'; + * import { Webengage, WebengageUser, WebengagePush, WebengageNotification, WebengageJwtManager } from '@awesome-cordova-plugins/webengage/ngx'; * * * constructor(private webengage: Webengage, private webengageUser: WebengageUser, private webengagePush: WebengagePush, private webengageNotification: WebengageNotification ) { } @@ -96,7 +96,17 @@ export class WebengageUser extends AwesomeCordovaNativePlugin { * @returns {Promise} */ @Cordova() - login(userId: string): Promise { + login(userId: string, jwtToken?: string): Promise { + return; + } + + /** + * Logs user in + * @param {string} userId + * @returns {Promise} + */ + @Cordova() + setSecureToken(userId: string, jwtToken: string): Promise { return; } @@ -140,6 +150,38 @@ export class WebengageUser extends AwesomeCordovaNativePlugin { setUserOptIn(channel: string, optIn: any): Promise { return; } + + /** + * Sets user location + * @param {number} latitude + * @param {number} longitude + * @returns {Promise} + */ + @Cordova() + setLocation(latitude: number, longitude: number): Promise { + return; + } +} + +/** + * @hidden + */ +@Plugin({ + pluginName: 'Webengage', + plugin: 'cordova-plugin-webengage', + pluginRef: 'webengage.jwtManager', +}) +@Injectable() +export class WebengageJwtManager extends AwesomeCordovaNativePlugin { + /** + * Callback function is invoked when a Jwt token is clicked + * @param {any} callback + * @returns {Promise} + */ + @Cordova() + tokenInvalidatedCallback(callback: any): Promise { + return; + } } /**