New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

countly-sdk-react-native-bridge

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

countly-sdk-react-native-bridge - npm Package Compare versions

Comparing version 22.2.2 to 22.2.3

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 22.02.3
* User profile added option to send bulk data in single request instead of individual request
* Fixed isInitialized variable reset on hot reload
* Underlying android SDK version is 22.02.3
* Underlying iOS SDK version is 22.06.1
## 22.02.2

@@ -2,0 +8,0 @@ * Added a way to add allowed package names for push notification intent security.

236

Countly.js

@@ -51,3 +51,4 @@ /**

// returns a promise
return await CountlyReactNative.isInitialized();
_isInitialized = await CountlyReactNative.isInitialized();
return _isInitialized;
}

@@ -854,3 +855,236 @@

//nothing is sent without calling save
Countly.userDataBulk = {};
//providing key/values with predefined and custom properties
Countly.userDataBulk.setUserProperties = async function(customAndPredefined){
if(!_isInitialized) {
var msg = "'init' must be called before 'setUserProperties'";
Countly.logError("setUserProperties", msg);
return msg;
}
var message = null;
if(!customAndPredefined) {
message = "User profile data should not be null or undefined";
Countly.logError("setUserProperties", message);
return message;
}
if(typeof customAndPredefined !== 'object'){
message = "unsupported data type of user data '" + (typeof customAndPredefined) + "'";
Countly.logWarning("setUserProperties", message);
return message;
}
for(var key in customAndPredefined){
if (typeof customAndPredefined[key] != "string" && key.toString() != "byear")
{
message = "skipping value for key '" + key.toString() + "', due to unsupported data type '" + (typeof customAndPredefined[key]) + "', its data type should be 'string'";
Countly.logWarning("setUserProperties", message);
}
}
if(customAndPredefined.org && !customAndPredefined.organization) {
customAndPredefined.organization = customAndPredefined.org;
delete customAndPredefined.org;
}
if(customAndPredefined.byear) {
Countly.validateParseInt(customAndPredefined.byear, "key byear", "setUserProperties");
customAndPredefined.byear = customAndPredefined.byear.toString();
}
CountlyReactNative.userDataBulk_setUserProperties(customAndPredefined);
};
Countly.userDataBulk.save = async function(){
if(!_isInitialized) {
var msg = "'init' must be called before 'save'";
Countly.logError("save", msg);
return msg;
}
CountlyReactNative.userDataBulk_save([]);
};
Countly.userDataBulk.setProperty = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'setProperty'";
Countly.logError("setProperty", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "setProperty");
if(message) {
return message;
}
message = await Countly.validateValidUserData(keyValue, "value", "setProperty");
if(message) {
return message;
}
keyName = keyName.toString();
keyValue = keyValue.toString();
if(keyName && (keyValue || keyValue == "")) {
CountlyReactNative.userDataBulk_setProperty([keyName, keyValue]);
}
};
Countly.userDataBulk.increment = async function(keyName){
if(!_isInitialized) {
var msg = "'init' must be called before 'increment'";
Countly.logError("increment", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "setProperty");
if(message) {
return message;
}
keyName = keyName.toString();
if(keyName) {
CountlyReactNative.userDataBulk_increment([keyName]);
}
};
Countly.userDataBulk.incrementBy = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'incrementBy'";
Countly.logError("incrementBy", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "incrementBy");
if(message) {
return message;
}
message = await Countly.validateUserDataValue(keyValue, "value", "incrementBy");
if(message) {
return message;
}
var intValue = parseInt(keyValue).toString();
CountlyReactNative.userDataBulk_incrementBy([keyName, intValue]);
};
Countly.userDataBulk.multiply = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'multiply'";
Countly.logError("multiply", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "multiply");
if(message) {
return message;
}
message = await Countly.validateUserDataValue(keyValue, "value", "multiply");
if(message) {
return message;
}
var intValue = parseInt(keyValue).toString();
CountlyReactNative.userDataBulk_multiply([keyName, intValue]);
};
Countly.userDataBulk.saveMax = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'saveMax'";
Countly.logError("saveMax", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "saveMax");
if(message) {
return message;
}
message = await Countly.validateUserDataValue(keyValue, "value", "saveMax");
if(message) {
return message;
}
var intValue = parseInt(keyValue).toString();
CountlyReactNative.userDataBulk_saveMax([keyName, intValue]);
};
Countly.userDataBulk.saveMin = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'saveMin'";
Countly.logError("saveMin", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "saveMin");
if(message) {
return message;
}
message = await Countly.validateUserDataValue(keyValue, "value", "saveMin");
if(message) {
return message;
}
var intValue = parseInt(keyValue).toString();
CountlyReactNative.userDataBulk_saveMin([keyName, intValue]);
};
Countly.userDataBulk.setOnce = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'setOnce'";
Countly.logError("setOnce", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "setOnce");
if(message) {
return message;
}
message = await Countly.validateValidUserData(keyValue, "value", "setOnce");
if(message) {
return message;
}
keyValue = keyValue.toString();
if(keyValue || keyValue == "") {
CountlyReactNative.userDataBulk_setOnce([keyName, keyValue]);
}
};
Countly.userDataBulk.pushUniqueValue = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'pushUniqueValue'";
Countly.logError("pushUniqueValue", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "pushUniqueValue");
if(message) {
return message;
}
message = await Countly.validateValidUserData(keyValue, "value", "pushUniqueValue");
if(message) {
return message;
}
keyValue = keyValue.toString();
if(keyValue || keyValue == "") {
CountlyReactNative.userDataBulk_pushUniqueValue([keyName, keyValue]);
}
};
Countly.userDataBulk.pushValue = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'pushValue'";
Countly.logError("pushValue", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "pushValue");
if(message) {
return message;
}
message = await Countly.validateValidUserData(keyValue, "value", "pushValue");
if(message) {
return message;
}
keyValue = keyValue.toString();
if(keyValue || keyValue == "") {
CountlyReactNative.userDataBulk_pushValue([keyName, keyValue]);
}
};
Countly.userDataBulk.pullValue = async function(keyName, keyValue){
if(!_isInitialized) {
var msg = "'init' must be called before 'pullValue'";
Countly.logError("pullValue", msg);
return msg;
}
var message = await Countly.validateString(keyName, "key", "pullValue");
if(message) {
return message;
}
message = await Countly.validateValidUserData(keyValue, "value", "pullValue");
if(message) {
return message;
}
keyValue = keyValue.toString();
if(keyValue || keyValue == "") {
CountlyReactNative.userDataBulk_pullValue([keyName, keyValue]);
}
};
/**

@@ -857,0 +1091,0 @@ *

@@ -11,3 +11,3 @@ import React, { Component } from 'react';

super(props);
this.state = {ratingId: '625f9032028614795fe5a85b'};
this.state = {ratingId: '61eac4627b8ad224e37bb3f5'};
this.config = {};

@@ -24,2 +24,4 @@

this.onSendUserData = this.onSendUserData.bind(this);
this.onSendUserDataBulk = this.onSendUserDataBulk.bind(this);
this.onSetUserProperties = this.onSetUserProperties.bind(this);
this.onUpdateUserData = this.onUpdateUserData.bind(this);

@@ -45,3 +47,3 @@ this.userData_setProperty = this.userData_setProperty.bind(this);

componentDidMount(){
this.onInit();
// this.onInit();
}

@@ -63,4 +65,4 @@

Countly.enableApm(); // Enable APM features, which includes the recording of app start time.
Countly.pushTokenType(Countly.messagingMode.DEVELOPMENT, "Channel Name", "Channel Description"); // Set messaging mode for push notifications
Countly.pushTokenType(Countly.messagingMode.DEVELOPMENT, "ChannelName", "ChannelDescription"); // Set messaging mode for push notifications
if (Platform.OS.match("ios")) {

@@ -78,11 +80,12 @@ Countly.recordAttributionID("ADVERTISING_ID");

Countly.appLoadingFinished();
/**
* Push notifications settings
/**
* Push notifications settings
* Should be call after init
*/
Countly.registerForNotification(function(theNotification){
console.log("Just received this notification data: " + JSON.stringify(theNotification));
alert('theNotification: ' + JSON.stringify(theNotification));
var jsonString = JSON.stringify(JSON.parse(theNotification))
console.log("Just received this notification data: " + jsonString);
alert('theNotification: ' + jsonString);
}); // Set callback to receive push notifications
Countly.askForNotificationPermission(); // This method will ask for permission, enables push notification and send push token to countly server.
Countly.askForNotificationPermission("android.resource://com.countly.demo/raw/notif_sample"); // This method will ask for permission, enables push notification and send push token to countly server.

@@ -113,2 +116,48 @@ }

onSetUserProperties(){
// example for setUserData
var options = {};
// Predefined user properties
options.name = "Name of User";
options.username = "Username";
options.email = "User Email";
options.organization = "User Organization";
options.phone = "User Contact number";
options.picture = "https://count.ly/images/logos/countly-logo.png";
options.picturePath = "";
options.gender = "Male";
options.byear = 1989;
// Custom User Properties
options.customeValueA = "Custom value A";
options.customeValueB = "Custom value B";
Countly.userDataBulk.setUserProperties(options);
Countly.userDataBulk.save();
};
onSendUserDataBulk(){
Promise.allSettled([Countly.userDataBulk.setProperty("key", "value"),
Countly.userDataBulk.setProperty("increment", 5),
Countly.userDataBulk.increment("increment"),
Countly.userDataBulk.setProperty("incrementBy", 5),
Countly.userDataBulk.incrementBy("incrementBy", 10),
Countly.userDataBulk.setProperty("multiply", 5),
Countly.userDataBulk.multiply("multiply", 20),
Countly.userDataBulk.setProperty("saveMax", 5),
Countly.userDataBulk.saveMax("saveMax", 100),
Countly.userDataBulk.setProperty("saveMin", 5),
Countly.userDataBulk.saveMin("saveMin", 50),
Countly.userDataBulk.setOnce("setOnce", 200),
Countly.userDataBulk.pushUniqueValue("type", "morning"),
Countly.userDataBulk.pushValue("type", "morning"),
Countly.userDataBulk.pullValue("type", "morning")])
.then(values => {
// We need to call the "save" in then block else it will cause a race condition and "save" may call before all the user profiles calls are completed
Countly.userDataBulk.save();
})
};
onUpdateUserData(){

@@ -493,2 +542,4 @@ // example for setUserData

this.onSendUserData();
this.onSendUserDataBulk();
this.onSetUserProperties();
this.onUpdateUserData();

@@ -568,4 +619,9 @@ this.userData_setProperty();

< Button onPress = { this.onSetUserProperties } title = "Set Users Properties" color = "#00b5ad"> </Button>
< Button onPress = { this.onSendUserDataBulk } title = "Send Users Data Bulk" color = "#00b5ad"> </Button>
<Text style={[{textAlign: 'center'}]}>User Methods End</Text>
<Text style={[{textAlign: 'center'}]}>.</Text>

@@ -572,0 +628,0 @@

2

package.json
{
"name": "countly-sdk-react-native-bridge",
"version": "22.02.2",
"version": "22.02.3",
"author": "Countly <hello@count.ly> (https://count.ly/)",

@@ -5,0 +5,0 @@ "bugs": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc