mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-01-31 10:36:14 +08:00
feat(webengage): New Plugin for Notification Inbox (#4819)
* WebEngage SDK Security Added, New Plugin for Capacitor Inbox Added
* Added setLocation for Core
* Added NotificationResponse Type
* Changed count type from number to String
* Added dist library folders
* Revert "Added dist library folders"
This reverts commit ea77a41fea
.
* Updated comments
This commit is contained in:
parent
5f15119971
commit
3168688ce4
160
src/@awesome-cordova-plugins/plugins/we-cap-inbox/index.ts
Normal file
160
src/@awesome-cordova-plugins/plugins/we-cap-inbox/index.ts
Normal file
@ -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<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
resetNotificationCount(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the count of notifications.
|
||||
* @param {function} successCallback
|
||||
* @param {function} errorCallback
|
||||
* @returns {Promise<number>} - The count of notifications.
|
||||
*/
|
||||
@Cordova()
|
||||
getNotificationCount(successCallback: (count: String) => void, errorCallback: (error: string) => void): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**-
|
||||
* Retrieves Notification List
|
||||
* @param {JsonObject | null} offset - Optional offset for notifications
|
||||
* @param {function} successCallback
|
||||
* @param {function} errorCallback
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
getNotificationList(
|
||||
offset: JsonObject | null,
|
||||
successCallback: (notifications: NotificationResponse) => void,
|
||||
errorCallback: (error: string) => void
|
||||
): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a specific notification as read.
|
||||
* @param {JsonObject} notificationObject - The notification to mark as read.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
markRead(notificationObject: JsonObject): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a specific notification as unread.
|
||||
* @param {JsonObject} notificationObject - The notification to mark as unread.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
markUnread(notificationObject: JsonObject): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks a click event on a notification.
|
||||
* @param {JsonObject} notificationObject - The notification that was clicked.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
trackClick(notificationObject: JsonObject): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks the view event of a notification.
|
||||
* @param {JsonObject} notificationObject - The notification that was viewed.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
trackView(notificationObject: JsonObject): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a specific notification as deleted.
|
||||
* @param {JsonObject} notificationObject - The notification to delete.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
markDelete(notificationObject: JsonObject): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks all notifications as read.
|
||||
* @param {JsonArray} notificationList - An array of notification identifiers to mark as read.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
readAll(notificationList: JsonArray): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks all notifications as unread.
|
||||
* @param {JsonArray} notificationList - An array of notification identifiers to mark as unread.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
unReadAll(notificationList: JsonArray): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all notifications.
|
||||
* @param {JsonArray} notificationList - An array of notification identifiers to delete.
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
deleteAll(notificationList: JsonArray): Promise<void> {
|
||||
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[];
|
@ -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<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
login(userId: string): Promise<any> {
|
||||
login(userId: string, jwtToken?: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user in
|
||||
* @param {string} userId
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setSecureToken(userId: string, jwtToken: string): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -140,6 +150,38 @@ export class WebengageUser extends AwesomeCordovaNativePlugin {
|
||||
setUserOptIn(channel: string, optIn: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets user location
|
||||
* @param {number} latitude
|
||||
* @param {number} longitude
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
setLocation(latitude: number, longitude: number): Promise<any> {
|
||||
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<any>}
|
||||
*/
|
||||
@Cordova()
|
||||
tokenInvalidatedCallback(callback: any): Promise<any> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user