@oracle/react-native-pushiomanager
Advanced tools
Comparing version 6.50.1 to 6.51.0
# Contributing | ||
We welcome your contributions! There are multiple ways to contribute. To get started, you will need to sign the [Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html) (OCA). | ||
We welcome your contributions! There are multiple ways to contribute. To get started, you will need to sign the [Oracle Contributor Agreement](https://oca.opensource.oracle.com/) (OCA). | ||
@@ -5,0 +5,0 @@ |
587
index.js
/* | ||
* Copyright © 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright © 2022, Oracle and/or its affiliates. All rights reserved. | ||
* | ||
@@ -16,3 +16,114 @@ * Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
export default class PushIOManager { | ||
/** | ||
*@callback callback | ||
*@param {failure} error object | ||
*@param {success} info object | ||
*/ | ||
/** | ||
* @typedef {object} Preference | ||
* @property {string} key - Unique Identifier for this preference. | ||
* @property {string} label - Human-Readable description of this preference. | ||
* @property {string} type - Data type of this preference. Possible values: 'STRING', 'NUMBER', 'BOOLEAN'. | ||
* @property {string} value - Preference value. | ||
*/ | ||
/** | ||
* @typedef {object} MessageCenterMessage | ||
* @property {string} messageID | ||
* @property {string} subject | ||
* @property {string} message | ||
* @property {string} iconURL | ||
* @property {string} messageCenterName | ||
* @property {string} deeplinkURL | ||
* @property {string} richMessageHTML | ||
* @property {string} richMessageURL | ||
* @property {string} sentTimestamp | ||
* @property {string} expiryTimestamp | ||
*/ | ||
/** | ||
* @typedef {object} InteractiveNotificationCategory | ||
* @property {string} orcl_category | ||
* @property {InteractiveNotificationButton[]} orcl_btns | ||
*/ | ||
/** | ||
* @typedef {object} InteractiveNotificationButton | ||
* @property {string} id | ||
* @property {string} action | ||
* @property {string} label | ||
*/ | ||
/** | ||
* @typedef {object} RemoteMessage | ||
* @property {string} to | ||
* @property {string=} collapseKey | ||
* @property {string=} messageId | ||
* @property {string=} messageType | ||
* @property {string=} ttl | ||
* @property {object} data | ||
*/ | ||
/** | ||
* @typedef {object} GeoRegion | ||
* @property {string} geofenceId | ||
* @property {string} geofenceName | ||
* @property {string} zoneName | ||
* @property {string} zoneId | ||
* @property {string} source | ||
* @property {number} deviceBearing | ||
* @property {number} deviceSpeed | ||
* @property {number} dwellTime | ||
* @property {object} extra | ||
*/ | ||
/** | ||
* @typedef {object} BeaconRegion | ||
* @property {string} beaconId | ||
* @property {string} beaconName | ||
* @property {string} beaconTag | ||
* @property {string} beaconProximity | ||
* @property {string} iBeaconUUID | ||
* @property {number} iBeaconMajor | ||
* @property {number} iBeaconMinor | ||
* @property {string} eddyStoneId1 | ||
* @property {string} eddyStoneId2 | ||
* @property {string} zoneName | ||
* @property {string} zoneId | ||
* @property {string} source | ||
* @property {number} dwellTime | ||
* @property {object} extra | ||
*/ | ||
/** | ||
* @typedef {object} ConversionEvent | ||
* @property {string} orderId | ||
* @property {number} orderTotal | ||
* @property {number} orderQuantity | ||
* @property {number} conversionType | ||
* @property {object} customProperties | ||
*/ | ||
/** | ||
* | ||
* loggingLevel; to be used with [setLogLevel()]{@link setLogLevel} | ||
* @typedef {Enumerator}loggingLevel | ||
* @param {number} NONE:0 | ||
* @param {number} ERROR :1 | ||
* @param {number} INFO: 2 | ||
* @param {number} WARN: 3 | ||
* @param {number} DEBUG: 4 | ||
* @param {number} VERBOSE: 5 | ||
* @readonly | ||
* @enum {number} | ||
* @memberof PushIOManager | ||
* | ||
*/ | ||
/** | ||
* Sets the log level to print in console. | ||
* @param {number} loggingLevel Numeric value to set type of logging | ||
*/ | ||
static setLogLevel(loggingLevel) { | ||
@@ -22,2 +133,7 @@ RCTPushIOManager.setLogLevel(loggingLevel); | ||
/** | ||
* Gets the Responsys SDK version. | ||
* @param {callback} callback Success callback with the SDK version value. | ||
*/ | ||
static getLibVersion(callback) { | ||
@@ -31,2 +147,10 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Sets Enable/Disable logging. By default logging is enabled with default Info {@link loggingLevel}. | ||
* <br/>Developer can change the log level by calling {@link setLogLevel}. | ||
* @param {boolean} isEnabled true, enable console log printing. | ||
* <br/> false, disable console log printing. | ||
* | ||
*/ | ||
static setLoggingEnabled(isEnabled) { | ||
@@ -36,2 +160,12 @@ RCTPushIOManager.setLoggingEnabled(isEnabled); | ||
/** | ||
* Registers this app installation with Responsys. | ||
* | ||
* @param {boolean} useLocation Whether to send location data along with the registration request. Passing `true` will show the default system location permission dialog prompt. | ||
* (User location is not available on iOS platform.) | ||
* @param {callback} callback callback with boolean value TRUE if register event created and stored successfully, FALSE otherwise. | ||
* @see {@tutorial Config} | ||
*/ | ||
static registerApp(useLocation, callback) { | ||
@@ -45,2 +179,10 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Unregister this app installation with Responsys. This will prevent the app from receiving push notifications. | ||
* @see {@tutorial Config} | ||
* @param {callback} callback callback with boolean value TRUE if unregister event created and stored successfully, | ||
* <br/>FALSE otherwise. | ||
* | ||
*/ | ||
static unregisterApp(callback) { | ||
@@ -50,2 +192,12 @@ RCTPushIOManager.unregisterApp(callback); | ||
/** | ||
* Configures the SDK using the provided config file name. | ||
* <br/>For Android, the file should be placed in the android <i>src/main/assets</i> directory | ||
* @see {@tutorial Config} | ||
* @param {string} fileName Name of the json config file. | ||
* @param {callback} callback callback with the result of configuration. | ||
* | ||
* | ||
*/ | ||
static configure(fileName, callback) { | ||
@@ -55,2 +207,7 @@ RCTPushIOManager.configure(fileName, callback); | ||
/** | ||
* Overwrites the Responsys API key provided in the pushio_config.json - this method should be called immediately after creating a new PushIOManager. | ||
* | ||
* @param {string} apiKey The new API key. | ||
*/ | ||
static overwriteApiKey(apiKey) { | ||
@@ -60,2 +217,9 @@ RCTPushIOManager.overwriteApiKey(apiKey); | ||
/** | ||
* Overwrites the Responsys API key provided in the pushio_config.json - | ||
* this method should be called immediately after creating a new PushIOManager. | ||
* | ||
* @param {string} accountToken The new Account token | ||
*/ | ||
static overwriteAccountToken(accountToken) { | ||
@@ -65,2 +229,11 @@ RCTPushIOManager.overwriteAccountToken(accountToken); | ||
/** | ||
* Records pre-defined and custom events. | ||
* <br/>You can set extra properties specific to this event via the properties parameter. | ||
* | ||
* @param {string} eventName name of the event to be tracked | ||
* @param {object} properties event properties to attach with the given event name. | ||
* @param {function} callback callback. | ||
*/ | ||
static trackEvent(eventName, properties) { | ||
@@ -70,2 +243,7 @@ RCTPushIOManager.trackEvent(eventName, properties); | ||
/** | ||
* Sets the External Device Tracking ID. Useful if you have another ID for this device. | ||
* @param {string} externalDeviceTrackingID External Device Tracking ID. | ||
*/ | ||
static setExternalDeviceTrackingID(externalDeviceTrackingID) { | ||
@@ -75,2 +253,7 @@ RCTPushIOManager.setExternalDeviceTrackingID(externalDeviceTrackingID); | ||
/** | ||
* Gets the External Device Tracking ID. | ||
* @param {callback} callback callback with External Device Tracking ID | ||
*/ | ||
static getExternalDeviceTrackingID(callback) { | ||
@@ -84,2 +267,8 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Associates this app installation with the provided userId in Responsys. | ||
* <br/> UserId can be set to target individual users for push notifications, sent along with push registration. | ||
* @param {string} userId User ID | ||
*/ | ||
static registerUserId(userId) { | ||
@@ -89,2 +278,7 @@ RCTPushIOManager.registerUserId(userId); | ||
/** | ||
* Gets the User ID set earlier using [registerUserId]{@link registerUserId}. | ||
* @param {callback} callback callback with userId | ||
*/ | ||
static getRegisteredUserId(callback) { | ||
@@ -98,2 +292,8 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Removes association between this app installation and the User ID that | ||
* was set earlier using [registerUserId]{@link registerUserId}. | ||
* <br/>Generally used when the user logs out. | ||
*/ | ||
static unregisterUserId() { | ||
@@ -103,2 +303,11 @@ RCTPushIOManager.unregisterUserId(); | ||
/** | ||
* Sends push engagement information to Responsys. | ||
* <br>Tracks the engagement for the provided engagement metric type with additional properties | ||
* | ||
* @param {engagementType} metric One of [engagementType]{@link engagementType} | ||
* @param {object=} properties Custom data to be sent along with this request. | ||
* @param {callback} callback callback. | ||
*/ | ||
static trackEngagement(metric, properties, callback) { | ||
@@ -113,2 +322,8 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Sends the MessageCenter open engagement for the provided message id to Responsys. Call this whenever message is opened. | ||
* <br/><br/>This should be called when the message-detail view is visible to the user | ||
* @param {string} messageID engagement message id to be reported | ||
*/ | ||
static trackMessageCenterOpenEngagement(messageId) { | ||
@@ -118,5 +333,14 @@ RCTPushIOManager.trackMessageCenterOpenEngagement(messageId); | ||
/** | ||
* Sends Message Center message engagement to Responsys. | ||
* <br/>This should be called when the message-list view is visible to the user. | ||
* @param {string} messageID engagement message id to be reported | ||
*/ | ||
static trackMessageCenterDisplayEngagement(messageId) { | ||
RCTPushIOManager.trackMessageCenterDisplayEngagement(messageId); | ||
} | ||
/** | ||
* Create a session when MessagaCenter/Inbox view will appear. | ||
*/ | ||
@@ -130,2 +354,5 @@ static onMessageCenterViewDisplayed() { | ||
} | ||
/** | ||
* Sync all the MessageCenter display engagements to Responsys server | ||
*/ | ||
@@ -140,2 +367,15 @@ static onMessageCenterViewFinished() { | ||
/** | ||
* Declares a preference that will be used later with [set...Preference()]{@link setStringPreference} | ||
* | ||
* @param {string} key Unique ID for this preference. | ||
* @param {string} label Human-Readable description of this preference. | ||
* @param {string} valueType Data type of this preference. Possible values: 'STRING', 'NUMBER', 'BOOLEAN'. | ||
* @param {callback} callback Success callback. | ||
* | ||
* @see {@link setBoolPreference} | ||
* @see {@link setNumberPreference} | ||
* @see {@link setStringPreference} | ||
*/ | ||
static declarePreference(key, label, valueType, callback) { | ||
@@ -145,5 +385,20 @@ RCTPushIOManager.declarePreference(key, label, valueType, callback); | ||
/** | ||
* Saves the key/value along with the label provided earlier in [declarePreference]{@link declarePreference} | ||
* | ||
* @param {string} key Unique ID for this preference. | ||
* @param {string} value Value of type String. | ||
* @param {callback} callback callback with boolean value TRUE if string preference value assigned, FALSE otherwise | ||
*/ | ||
static setStringPreference(key, value, callback) { | ||
RCTPushIOManager.setStringPreference(key, value, callback); | ||
} | ||
/** | ||
* Saves the key/value along with the label provided earlier in [declarePreference]{@link declarePreference} | ||
* | ||
* @param {string} key Unique ID for this preference. | ||
* @param {number} value Value of type Number. | ||
* @param {callback} callback Success callback. | ||
*/ | ||
@@ -154,2 +409,10 @@ static setNumberPreference(key, value, callback) { | ||
/** | ||
* Saves the key/value along with the label provided earlier in [declarePreference]{@link declarePreference} | ||
* | ||
* @param {string} key Unique ID for this preference. | ||
* @param {boolean} value Value of type Boolean. | ||
* @param {callback} callback callback with preference if preference is found for the key, NULL otherwise. | ||
*/ | ||
static setBooleanPreference(key, value, callback) { | ||
@@ -159,5 +422,15 @@ RCTPushIOManager.setBooleanPreference(key, value, callback); | ||
/** | ||
* Gets all preferences set earlier using [set...Preference()]{@link setStringPreference}. | ||
* @param {String} key Unique ID of preference. | ||
* @param {callback} callback callback with preference if preference is found for the key, NULL otherwise. | ||
*/ | ||
static getPreference(key, callback) { | ||
RCTPushIOManager.getPreference(key, callback); | ||
} | ||
/** | ||
* Gets all preferences set earlier using [set...Preference()]{@link setStringPreference}. | ||
* @param {function} callback Success callback with {Preference[]} Array of [Preference]{@link Preference} in success callback. | ||
*/ | ||
@@ -167,2 +440,7 @@ static getPreferences(callback) { | ||
} | ||
/** | ||
* Removes preference data for the given key. | ||
* | ||
* @param {string} key Unique ID for this preference. | ||
*/ | ||
@@ -173,2 +451,6 @@ static removePreference(key) { | ||
/** | ||
* Removes all preference data. | ||
*/ | ||
static clearAllPreferences() { | ||
@@ -178,5 +460,14 @@ RCTPushIOManager.clearAllPreferences(); | ||
/** | ||
* Gets the API Key used by the device to register with Responsys. | ||
* @param {function} callback callback with configured APIKey. nil if no api-key configured. | ||
*/ | ||
static getAPIKey(callback) { | ||
RCTPushIOManager.getAPIKey(callback); | ||
} | ||
/** | ||
* Gets the Account Token used by the device to register with Responsys. | ||
* @param {callback} callback callback with configured AccountToken. nil if no AccountToken configured | ||
*/ | ||
@@ -187,2 +478,7 @@ static getAccountToken(callback) { | ||
/** | ||
* Sets the advertising ID. | ||
* @param {string} advertisingId External Device Tracking ID. | ||
*/ | ||
static setAdvertisingID(advertisingId) { | ||
@@ -196,2 +492,8 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Gets the advertising ID. | ||
* <br/> In iOS, its Advertising Identifier (IDFA) (@link setAdvertisingID} | ||
* @param {callback} callback Success callback with advertising Identifier. | ||
*/ | ||
static getAdvertisingID(callback) { | ||
@@ -205,2 +507,7 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Gets the Responsys Device ID. | ||
* @param {callback} callback Success callback with device ID value. | ||
*/ | ||
static getDeviceID(callback) { | ||
@@ -210,2 +517,8 @@ RCTPushIOManager.getDeviceID(callback); | ||
/** | ||
* sets the Responsys web URL. | ||
* | ||
* @param {string} executeRsysWebURL url | ||
*/ | ||
static setExecuteRsysWebUrl(executeRsysWebURL) { | ||
@@ -215,2 +528,8 @@ RCTPushIOManager.setExecuteRsysWebURL(executeRsysWebURL); | ||
/** | ||
* Gets the Responsys web URL. | ||
* | ||
* @param {callback} callback Success callback with device ID value. | ||
*/ | ||
static getExecuteRsysWebUrl(callback) { | ||
@@ -224,2 +543,7 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Removes push engagement related data for a session. | ||
* <br/>This will prevent further engagements from being reported until the app is opened again via a push notification. | ||
*/ | ||
static resetEngagementContext() { | ||
@@ -229,2 +553,8 @@ RCTPushIOManager.resetEngagementContext(); | ||
/** | ||
* Gets the maximum age of engagement | ||
* @param {callback} callback callback with number value of server returned max age value (when application invoked from email). | ||
* <br/> Return -1 if no max age (from server) fetched. | ||
*/ | ||
static getEngagementMaxAge(callback) { | ||
@@ -234,5 +564,15 @@ RCTPushIOManager.getEngagementMaxAge(callback); | ||
/** | ||
* Gets the engagement date recorded when engagement information fetched from server and stored locally. | ||
* @param {callback} callback callback with string value of engagement date,time in ISO 8601 format | ||
*/ | ||
static getEngagementTimestamp(callback) { | ||
RCTPushIOManager.getEngagementTimestamp(callback); | ||
} | ||
/** | ||
* Enable the fetch messages for all message center names from the server | ||
* @param {boolean} messageCenterEnabled boolean value to enable the messages fetch. | ||
* <br/> True to enable ,False to disable. | ||
*/ | ||
@@ -243,2 +583,7 @@ static setMessageCenterEnabled(messageCenterEnabled) { | ||
/** | ||
* Gets the status of MessageCenter enabled | ||
* @param {function} callback callback with boolean value. | ||
*/ | ||
static isMessageCenterEnabled(callback) { | ||
@@ -248,2 +593,9 @@ RCTPushIOManager.isMessageCenterEnabled(callback); | ||
/** | ||
* Fetch the list of Message Center messages for given MessageCenter name. | ||
* | ||
* @param {string} messageCenter Name of MessageCenter to fetch the list of messages | ||
* @param {callback} callback Success callback with messageCenter and messages, Failure callback with messageCenter and errorReason | ||
*/ | ||
static fetchMessagesForMessageCenter(messageCenter, callback) { | ||
@@ -253,5 +605,19 @@ RCTPushIOManager.fetchMessagesForMessageCenter(messageCenter, callback); | ||
/** | ||
* Fetches rich content for the given message ID. | ||
* | ||
* @param {string} messageID | ||
* @param {callback} callback Success callback with messageId and richContent, Failure callback with messageId and errorReason | ||
*/ | ||
static fetchRichContentForMessage(messageId, callback) { | ||
RCTPushIOManager.fetchRichContentForMessage(messageId, callback); | ||
} | ||
/** | ||
* Sets the badge count on app icon for the no. of Message Center messages. | ||
* | ||
* @param {number} badgeCount | ||
* @param {boolean} forceSetBadge Force a server-sync for the newly set badge count. | ||
* @param {callback} callback callback. | ||
*/ | ||
@@ -266,2 +632,8 @@ static setBadgeCount(badgeCount, forceSetBadge, callback) { | ||
/** | ||
* Gets the current badge count for Message Center messages. | ||
* | ||
* @param {callback} callback callback as a number value. | ||
*/ | ||
static getBadgeCount(callback) { | ||
@@ -271,2 +643,9 @@ RCTPushIOManager.getBadgeCount(callback); | ||
/** | ||
* Resets the badge count for Message Center messages.<br/>This is equivalent to calling [setBadgeCount(0, true)]{@link PushIOManager#setsetBadgeCount} | ||
* | ||
* @param {boolean} forceSetBadge Force a server-sync for the newly set badge count. | ||
* @param {callback} callback callback. | ||
*/ | ||
static resetBadgeCount(forceSetBadge, callback) { | ||
@@ -280,2 +659,6 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Removes all Message Center messages from the SDK's cache.<br/><br/>This does not affect your local cache of the messages. | ||
*/ | ||
static resetMessageCenter() { | ||
@@ -289,5 +672,16 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Removes all In-App messages from the SDK's cache. | ||
* | ||
*/ | ||
static clearInAppMessages() { | ||
RCTPushIOManager.clearInAppMessages(); | ||
} | ||
/** | ||
* Enable/Disable the in-app messages pre-fetch. | ||
* <br/>If enabled, all the in-app messages are pre-fetch and stored in the SDK, and triggered from local storage. | ||
* <br/>If disabled then in-app messages are not pre-fetched, so not available to be triggered for the event i.e.: $ExplicitAppOpen. | ||
* @param {Boolean} isEnabled | ||
*/ | ||
@@ -302,5 +696,15 @@ static setInAppFetchEnabled(isEnabled) { | ||
/** | ||
* Enable the crash logging of PushIO sdk. | ||
* <br/>It will not make and capture any crashes of apps. By default it is enable. You can set `NO` | ||
* <br/>if you do not want PushIO sdk to collect crashes. | ||
* @param {Boolean} isEnabled boolean value to enable the crash logging. | ||
*/ | ||
static setCrashLoggingEnabled(isEnabled) { | ||
RCTPushIOManager.setCrashLoggingEnabled(isEnabled); | ||
} | ||
/** | ||
* Check if crash logging is enabled for PushIOManager SDK. We capture only crashes related to sdk. | ||
* @param {callback} callback with boolean value | ||
*/ | ||
@@ -311,2 +715,8 @@ static isCrashLoggingEnabled(callback) { | ||
/** | ||
* Sets the device token | ||
* <br/> available in Android only | ||
* @param {string} deviceToken | ||
*/ | ||
static setDeviceToken(deviceToken) { | ||
@@ -319,2 +729,7 @@ if (Platform.OS === 'android') { | ||
} | ||
/** | ||
* Checks if the push payload provided is sent by Responsys platform or not. | ||
* @param {object} message | ||
* @param {callback} callback | ||
*/ | ||
@@ -329,2 +744,8 @@ static isResponsysPush(message, callback) { | ||
/** | ||
* Informs the SDK that the user has entered a geo-fence. | ||
* @param {GeoRegion} region | ||
* @param {callback} callback callback with regionID and regionType. | ||
*/ | ||
static onGeoRegionEntered(region, callback) { | ||
@@ -338,2 +759,9 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Informs the SDK that the user has exited a geo-fence. | ||
* | ||
* @param {GeoRegion} region | ||
* @param {callback} callback callback with regionID and regionType. | ||
*/ | ||
static onGeoRegionExited(region, callback) { | ||
@@ -347,2 +775,9 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Informs the SDK that the user has entered a beacon region. | ||
* | ||
* @param {BeaconRegion} region | ||
* @param {callback} callback callback with regionID and regionType. | ||
*/ | ||
static onBeaconRegionEntered(region, callback) { | ||
@@ -356,2 +791,9 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Informs the SDK that the user has exited a beacon region. | ||
* | ||
* @param {BeaconRegion} region | ||
* @param {callback} callback callback with regionID and regionType. | ||
*/ | ||
static onBeaconRegionExited(region, callback) { | ||
@@ -366,2 +808,8 @@ if (Platform.OS === 'android') { | ||
/** | ||
* Sends Message Center message engagement to Responsys. | ||
* <br/>This should be called when the message-list view is visible to the user. | ||
* @param {string} messageID | ||
*/ | ||
static trackMessageCenterDisplayEngagement(messageID) { | ||
@@ -371,5 +819,14 @@ RCTPushIOManager.trackMessageCenterDisplayEngagement(messageID); | ||
/** | ||
* Sends Message Center message engagement to Responsys. | ||
* <br/>This should be called when the message-detail view is visible to the user. | ||
* @param {string} messageID | ||
*/ | ||
static trackMessageCenterOpenEngagement(messageID) { | ||
RCTPushIOManager.trackMessageCenterOpenEngagement(messageID); | ||
} | ||
/** | ||
* Create a session when Message Center/Inbox view will appear. | ||
*/ | ||
@@ -383,2 +840,5 @@ static messageCenterViewDidMount() { | ||
} | ||
/** | ||
* Sync all the MessageCenter display engagements to responsys server. | ||
*/ | ||
@@ -394,2 +854,6 @@ static messageCenterViewWillUnmount() { | ||
// Android-Only APIs | ||
/** | ||
* Sets Enable/Disable the Message Center badging | ||
* @param {Boolean} isBadgingEnabled | ||
*/ | ||
static setMessageCenterBadgingEnabled(isBadgingEnabled) { | ||
@@ -402,2 +866,6 @@ if (Platform.OS === 'android') { | ||
} | ||
/** | ||
* | ||
* @param {*} areNotificationsStacked | ||
*/ | ||
@@ -436,2 +904,8 @@ static setNotificationsStacked(areNotificationsStacked) { | ||
/** | ||
* Request the SDK to process and display notification using the provided {@link com.google.firebase.messaging.RemoteMessage} | ||
* | ||
* @param message | ||
*/ | ||
static handleMessage(message) { | ||
@@ -444,2 +918,5 @@ if (Platform.OS === 'android') { | ||
} | ||
/** | ||
* Removes all app-defined Interactive Notification categories from the SDK's cache. | ||
*/ | ||
@@ -453,2 +930,7 @@ static clearInteractiveNotificationCategories() { | ||
} | ||
/** | ||
* Adds a new app-defined Interactive Notification category. | ||
* @param {InteractiveNotificationCategory} notificationCategory | ||
* @param {callback} callback | ||
*/ | ||
@@ -462,2 +944,6 @@ static addInteractiveNotificationCategory(notificationCategory, callback) { | ||
} | ||
/** | ||
* Removes app-defined Interactive Notification category. | ||
* @param {string} categoryId | ||
*/ | ||
@@ -471,2 +957,7 @@ static deleteInteractiveNotificationCategory(categoryId) { | ||
} | ||
/** | ||
* Gets a single Interactive Notification category for the given category ID. | ||
* @param {string} categoryId | ||
* @param {callback} callback | ||
*/ | ||
@@ -484,2 +975,5 @@ static getInteractiveNotificationCategory(categoryId, callback) { | ||
// iOS-Only APIs | ||
/** | ||
* | ||
*/ | ||
static registerForRemoteNotifications() { | ||
@@ -493,2 +987,7 @@ if (Platform.OS === 'ios') { | ||
/** | ||
* registerForAllRemoteNotificationTypes Listener is added | ||
* @param {callback} callback | ||
*/ | ||
static registerForAllRemoteNotificationTypes(callback) { | ||
@@ -510,2 +1009,11 @@ if (Platform.OS === 'ios') { | ||
/** | ||
* Asks user permissions for all push notifications types. i.e.: Sound/Badge/Alert types. | ||
* If readyForRegistrationCompHandler is not set, then provided completionHandler is assigned to it, to let application have access when SDK receives deviceToken. | ||
* Only available on iOS platform. | ||
* @param {int} authOptions Notification auth types i.e.: Sound/Badge/Alert. | ||
* @param {InteractiveNotificationCategory[]} categories categories Contains the notification categories definitions. | ||
* @param {*} callback | ||
*/ | ||
static registerForNotificationAuthorizations(authOptions, categories, callback) { | ||
@@ -519,2 +1027,11 @@ if (Platform.OS === 'ios') { | ||
/** | ||
* Asks user permissions for all push notifications types. i.e.: Sound/Badge/Alert types. You can pass the notification categories definitions to register. | ||
* | ||
* Only available on iOS platform. | ||
* | ||
* @param {InteractiveNotificationCategory[]} categories Contains the notification categories definitions. | ||
* @param {callback} callback callback. | ||
*/ | ||
static registerForAllRemoteNotificationTypesWithCategories(categories, callback) { | ||
@@ -528,2 +1045,8 @@ if (Platform.OS === 'ios') { | ||
/** | ||
* Check if log printing is enabled in debug console. | ||
* @param {boolean} isLoggingEnabled | ||
* @param {callback} callback with boolean value | ||
*/ | ||
static isLoggingEnabled(callback) { | ||
@@ -536,2 +1059,7 @@ if (Platform.OS === 'ios') { | ||
} | ||
/** | ||
* Checks if the push notification response provided is sent by Responsys platform or not. | ||
* @param {*} response | ||
* @param {callback} callback with boolean value.TRUE if push payload is sent by Responsys platform otherwise FALSE. | ||
*/ | ||
@@ -562,2 +1090,6 @@ static isResponsysNotificationResponse(response, callback) { | ||
/** | ||
Reset all SDK data. i.e.: DeviceID, UserId, Preferences. | ||
*/ | ||
static resetAllData() { | ||
@@ -582,2 +1114,7 @@ if (Platform.OS === 'ios') { | ||
} | ||
/** | ||
* To Add listener for deelink | ||
* @param {Boolean} isSet | ||
* @param {callback} callback | ||
*/ | ||
@@ -599,2 +1136,5 @@ static setOpenURLListener(isSet, callback) { | ||
} | ||
/** | ||
* Set the delay to display Rich Push. If this flag is set Rich Push will be not displayed immediately and to display it call `showRichPushMessage` API. | ||
*/ | ||
@@ -605,5 +1145,14 @@ static showRichPushMessage() { | ||
/** | ||
* Gets the status ofthe delay Rich Push flag | ||
* @param {callback} callback with boolean value | ||
*/ | ||
static isRichPushDelaySet(callback) { | ||
RCTPushIOManager.isRichPushDelaySet(callback); | ||
} | ||
/** | ||
* Tracks the conversions for PUSHIO_ENGAGEMENT_METRIC_INAPP_PURCHASE and PUSHIO_ENGAGEMENT_METRIC_PURCHASE events. | ||
* @param {ConversionEvent} event | ||
* @param {callback} callback | ||
*/ | ||
@@ -617,2 +1166,9 @@ static trackConversionEvent(event, callback) { | ||
/** | ||
* Sets delay in registration. Registration will be delayed while launching the app/from coming to background | ||
* @param {Boolean} delayRegistration | ||
* | ||
*/ | ||
static setDelayRegistration(delayRegistration) { | ||
@@ -625,2 +1181,7 @@ if (Platform.OS === 'android') { | ||
} | ||
/** | ||
* This api provides the status, if `setDelayRegistration` is enabled of not. | ||
* @param {callback} callback with boolean value. true if registration will be delayed otherwise false | ||
* | ||
*/ | ||
@@ -634,2 +1195,26 @@ static isDelayRegistration(callback) { | ||
} | ||
static setNotificationSmallIconColor(color) { | ||
if (Platform.OS === 'android') { | ||
RCTPushIOManager.setNotificationSmallIconColor(color); | ||
} else { | ||
console.log("API not supported"); | ||
} | ||
} | ||
static setNotificationSmallIcon(resourceName) { | ||
if (Platform.OS === 'android') { | ||
RCTPushIOManager.setNotificationSmallIcon(resourceName); | ||
} else { | ||
console.log("API not supported"); | ||
} | ||
} | ||
static setNotificationLargeIcon(resourceName) { | ||
if (Platform.OS === 'android') { | ||
RCTPushIOManager.setNotificationLargeIcon(resourceName); | ||
} else { | ||
console.log("API not supported"); | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved. | ||
@@ -3,0 +3,0 @@ The Universal Permissive License (UPL), Version 1.0 |
{ | ||
"name": "@oracle/react-native-pushiomanager", | ||
"version": "6.50.1", | ||
"version": "6.51.0", | ||
"description": "React Native Module for Responsys Mobile SDK", | ||
@@ -10,2 +10,6 @@ "main": "index.js", | ||
}, | ||
"scripts": { | ||
"postinstall": "rm -rf ./framework/PushIOManager.framework && cp -Rf ../../../ios/framework/PushIOManager.framework ./framework/ || { exit 1 && \n\n\n Error ==> PushIOManager.framework not found. Please copy the PushIOManager.framework to YOUR_APP_DIR/ios/framework/ and install package again. Follow README.md Installation instructions.<=== \n\n\n}" | ||
}, | ||
"keywords": [ | ||
@@ -12,0 +16,0 @@ "responsys", |
110
README.md
@@ -13,2 +13,4 @@ # React Native Module for Responsys SDK | ||
- [Installation](#installation) | ||
* [For Android](#for-android-3) | ||
* [For iOS](#for-ios-3) | ||
- [Integration](#integration) | ||
@@ -25,2 +27,4 @@ * [For Android](#for-android-2) | ||
* [Notification Preferences](#notification-preferences) | ||
- [Upgrades](#upgrades) | ||
* [6.50.1 to 6.51] (#upgrade_6.51) | ||
- [Support](#support) | ||
@@ -49,3 +53,2 @@ - [License](#license) | ||
- Get the `pushio_config.json` file generated from your credentials and place it in your project's `android/app/src/main/assets` folder. You might have to create the directory if it is not already present. | ||
- Download the SDK native binary from [here](https://www.oracle.com/downloads/applications/cx/responsys-mobile-sdk.html) and place it in the project's `android/app/src/main/libs` folder. | ||
@@ -57,4 +60,5 @@ | ||
- Download the `pushio_config.json` file generated from your credentials. | ||
- After adding the plugin in your app, copy `PushIOManager.framework` and place it in the plugin `node_modules/react-native-pushiomanager/PushIOManager/` folder. | ||
- ***Important:*** Copy `PushIOManager.framework` and place it in the plugin `YOUR_APP_DIR/ios/framework/` folder **before adding plugin to project**. | ||
## Installation | ||
@@ -69,17 +73,29 @@ | ||
### For Android | ||
- Create a new directory - `PushIOManager` inside your app's `android` directory. | ||
- Download the SDK native binary from [here](https://www.oracle.com/downloads/applications/cx/responsys-mobile-sdk.html) and place the .aar file in this `android/PushIOManager/` directory. | ||
- Inside the `android/PushIOManager` directory, create a file `build.gradle` with the following code: | ||
```gradle | ||
configurations.maybeCreate("default") | ||
artifacts.add("default", file('PushIOManager-6.51.aar') | ||
``` | ||
- Add the following to your project-wide `settings.gradle` file: | ||
```gradle | ||
include ':PushIOManager' | ||
project(':PushIOManager').projectDir = new File(rootProject.projectDir, './PushIOManager') | ||
``` | ||
### For iOS | ||
- After installing plugin you need to link `PushIOManager` dependency to your project `Podfile`. Please follow below steps: | ||
After installing plugin you need to install cocoapods, | ||
- Open your React Native App Project `Podfile.` Add the below line | ||
- Go to `ios` directory of you app, `cd YOUR_APP_DIR/ios/` | ||
- Run `pod install` | ||
`pod 'PushIOManager', :path => '<PATH_TO_node_modules/react-native-pushiomanager/PushIOManager/_Directory>'` after `use_native_modules!`. | ||
Eg: | ||
``` | ||
use_native_modules! | ||
pod 'PushIOManager', :path => '../node_modules/react-native-pushiomanager/PushIOManager/' | ||
``` | ||
- Run `pod install` | ||
***Note:*** This step will fail if `PushIOManager.framework` is not available in `YOUR_APP_DIR/ios/framework/` folder **before adding plugin to project with `npm` or `yarn`**. Copy the `PushIOManager.framework` to `YOUR_APP_DIR/ios/framework/` and perform `Installation` step again. | ||
@@ -209,3 +225,8 @@ | ||
withCompletionHandler:completionHandler]; | ||
} | ||
} | ||
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { | ||
[[PushIOManager sharedInstance] openURL:url options:options]; | ||
return YES; | ||
} | ||
``` | ||
@@ -215,6 +236,6 @@ | ||
- For In-App Messages and Rich Push Content follow the below steps : | ||
* To Enable Custom URI scheme for displaying In-App Messages and Rich Push content follow the [Step 1](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg/). You don't need to add the code. | ||
* To Enable Custom URI scheme for displaying In-App Messages and Rich Push content follow the [Step 1](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm). | ||
You can find the API key in the `pushio_config.json` that was placed in your Xcode project earlier during setup. | ||
* Follow [Step 2](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg/) to add the required capabilites in your Xcode project for In-App messages. You don't need to add the code. | ||
* Follow [Step 2](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm) to add the required capabilites in your Xcode project for In-App messages. | ||
@@ -311,4 +332,12 @@ - For Media Attachments you can follow the following [guide](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/media-attachments/). Copy and paste the code provided in guide in respective files. | ||
``` | ||
#### For iOS | ||
These below steps are required for iOS In-App Messages. | ||
* To Enable Custom URI scheme for displaying In-App Messages and Rich Push content follow the [Step 1](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm). | ||
You can find the API key in the `pushio_config.json` that was placed in your Xcode project earlier during setup. | ||
* Follow [Step 2](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm) to add the required capabilites in your Xcode project for In-App messages. | ||
### Message Center | ||
@@ -370,2 +399,49 @@ | ||
### Changing Notification Icon and Color (Android Only) | ||
Responsys SDK uses the app icon as the icon for notifications. You can change this by using the following two APIs, | ||
```javascript | ||
PushIOManager.setNotificationLargeIcon("ic_notification_large"); | ||
PushIOManager.setNotificationSmallIcon("ic_notification_small"); | ||
``` | ||
- Icon name should be provided without the file extension. | ||
- Icon images should be present in your app's `drawable` or `mipmap` directory, i.e. `android/app/src/main/res/drawable` or `android/app/src/main/res/mipmap`. | ||
It is also possible to change the notification small icon color by using the following API, | ||
```javascript | ||
PushIOManager.setNotificationSmallIconColor("#d1350f"); | ||
``` | ||
## Upgrades | ||
### 6.50.1 to 6.51 | ||
With the release of v6.51.0, we have simplified the plugin integration process. | ||
Due to this change, you will need to perform the following steps one-time only. | ||
### For Android | ||
- Remove the existing `PushIOManager-6.50.1.aar` file from `app/src/main/libs` directory. | ||
- Follow the setup instructions given in the [Installation](#for-android-3) section above. | ||
### For iOS | ||
- Find and remove the following line from the `YOUR_APP_DIR/ios/Podfile`, | ||
``` | ||
pod 'PushIOManager', :path => '<PATH_TO_node_modules/@oracle/react-native-pushiomanager/PushIOManager/_Directory>'` | ||
``` | ||
- Create a `framework` directory inside `YOUR_APP_DIR/ios/` directory. | ||
- Copy the latest PushIOManager.framework inside `YOUR_APP_DIR/ios/framework/` | ||
- Install the latest plugin `yarn add @oracle/react-native-pushiomanager` | ||
## Support | ||
@@ -378,4 +454,4 @@ | ||
Copyright (c) 2020 Oracle and/or its affiliates and released under the Universal Permissive License (UPL), Version 1.0. | ||
Copyright (c) 2022 Oracle and/or its affiliates and released under the Universal Permissive License (UPL), Version 1.0. | ||
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
AI-detected potential security risk
Supply chain riskAI has determined that this package may contain potential security issues or vulnerabilities.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1087748
32
990
448
1
1