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
4
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 23.12.0 to 24.4.0

__tests__/utils.test.js

295

.eslintrc.json

@@ -10,3 +10,2 @@ {

},
"extends": ["plugin:react/recommended", "prettier", "eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parserOptions": {

@@ -20,112 +19,196 @@ "ecmaFeatures": {

},
"overrides": [
{
"files": ["__tests__/**/*"],
"env": {
"jest": true
}
}
],
"parser": "@typescript-eslint/parser",
"plugins": ["react", "react-native", "@typescript-eslint"],
"root": true,
"extends": ["airbnb/legacy"],
"rules": {
//JavaScript rules
"prefer-template": "error",
// allow .js files to contain JSX code
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }],
// prevent eslint to complain about the "styles" variable being used before it was defined
"no-use-before-define": ["error", { "variables": false }],
// ignore errors for the react-navigation package
"react/prop-types": ["error", { "ignore": ["navigation", "navigation.navigate"] }],
"no-var": "warn",
"curly": ["error", "all"],
//TypeScript related rules
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "warn",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error", //???
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/class-literal-property-style": "warn",
"@typescript-eslint/consistent-generic-constructors": "warn",
"@typescript-eslint/consistent-indexed-object-style": "warn",
"@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/consistent-type-definitions": "warn",
"@typescript-eslint/consistent-type-exports": "warn",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/explicit-member-accessibility": "warn",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"@typescript-eslint/member-ordering": "warn", //???
"@typescript-eslint/method-signature-style": "warn",
//"@typescript-eslint/naming-convention": "warn"
"@typescript-eslint/no-base-to-string": "warn",
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
"@typescript-eslint/no-confusing-void-expression": "warn",
"@typescript-eslint/no-duplicate-enum-values": "warn",
"@typescript-eslint/no-dynamic-delete": "warn",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-extraneous-class": "warn",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-invalid-void-type": "warn",
"@typescript-eslint/no-meaningless-void-operator": "warn",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-redundant-type-constituents": "warn",
"@typescript-eslint/no-require-imports": "warn",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-type-alias": "warn",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "warn",
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-declaration-merging": "warn",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-return": "error",
"@typescript-eslint/no-useless-empty-export": "warn",
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
"@typescript-eslint/parameter-properties": "warn",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/prefer-enum-initializers": "warn",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "warn",
"@typescript-eslint/prefer-literal-enum-member": "warn",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-readonly": "warn",
"@typescript-eslint/prefer-readonly-parameter-types": "warn",
"@typescript-eslint/prefer-reduce-type-parameter": "warn",
"@typescript-eslint/prefer-regexp-exec": "warn",
"@typescript-eslint/prefer-return-this-type": "warn",
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
"@typescript-eslint/prefer-ts-expect-error": "warn",
"@typescript-eslint/promise-function-async": "warn",
"@typescript-eslint/require-array-sort-compare": "warn",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/sort-type-constituents": "warn",
"@typescript-eslint/strict-boolean-expressions": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "warn",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/typedef": "warn",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/unified-signatures": "warn",
"@typescript-eslint/no-use-before-define": "warn",
"@typescript-eslint/no-var-requires": "error",
// Note: you must disable the base rule as it can report incorrect errors
"object-curly-spacing": "off",
"@typescript-eslint/object-curly-spacing": "warn"
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"comma-dangle": "off",
"no-restricted-globals": "off",
"no-restricted-properties": "off",
"strict": "off",
"no-unused-vars": "warn",
"no-var": "off",
"func-names": "off",
"consistent-return": "off",
"prefer-rest-params": "off",
"radix": "off",
"prefer-spread": "off",
"no-plusplus": "off",
"camelcase": "off",
"no-use-before-define": "off",
"no-lonely-if": "off",
"no-restricted-syntax": "off",
"vars-on-top": "off",
"no-param-reassign": "off",
"max-len": "off",
"guard-for-in": "off",
"no-underscore-dangle": "off",
"no-bitwise": "off",
"no-mixed-operators": "off",
"object-shorthand": "off",
"max-classes-per-file": "off",
"block-spacing": [
"error",
"always"
],
"brace-style": [
"error",
"1tbs"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error",
"last"
],
"computed-property-spacing": [
"error",
"never"
],
"curly": [
"error",
"all"
],
"eol-last": "off",
"func-call-spacing": [
"error",
"never"
],
"indent": [
"error",
4
],
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"lines-between-class-members": [
"error",
"always"
],
"no-multi-spaces": [
"error"
],
"no-trailing-spaces": [
"error",
{
"ignoreComments": true
}
],
"no-whitespace-before-property": [
"error"
],
"object-curly-newline": [
"error",
{
"multiline": true,
"consistent": true
}
],
"object-property-newline": [
"error",
{
"allowAllPropertiesOnSameLine": true
}
],
"semi": [
"error",
"always"
],
"semi-style": [
"error",
"last"
],
"space-before-blocks": [
"error",
"always"
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": [
"error"
],
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"switch-colon-spacing": [
"error"
],
"unicode-bom": [
"error",
"never"
],
"linebreak-style": [
"error",
"unix"
],
"no-useless-escape": "off",
"no-useless-concat": "off",
"quotes": [
"error",
"double"
],
"no-console": [
"off"
],
"dot-notation": [
"error"
],
"eqeqeq": [
"warn",
"always"
],
"no-alert": [
"error"
],
"no-caller": [
"error"
],
"no-eval": [
"error"
],
"no-extend-native": [
"error"
],
"no-iterator": [
"error"
],
"no-loop-func": [
"error"
],
"no-shadow": [
"error"
]
}
}
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},

@@ -5,0 +5,0 @@ "editor.defaultFormatter": "esbenp.prettier-vscode",

@@ -0,1 +1,29 @@

## 24.4.0
* ! Minor breaking change ! Tracking of foreground and background time for APM is disabled by default
* Added `disableAdditionalIntentRedirectionChecks` config method
* Added a new metric for detecting whether or not a device has a hinge for Android
* Added four new APM configuration options under the `CountlyConfig.apm` interface:
* `enableForegroundBackgroundTracking` for enabling automatic F/B time tracking
* `enableAppStartTimeTracking` for enabling automatic app launch time tracking (Android only)
* `enableManualAppLoadedTrigger` for enabling the manipulation of app load time finished timestamp
* `setAppStartTimestampOverride` for enabling the manipulation of app load time starting timestamp
* Added a new Event interface (`Countly.events`) that groups event related calls:
* `recordEvent` for recording an event
* `startEvent` for starting a timed event
* `cancelEvent` for canceling an ongoing timed event
* `endEvent` for ending a timed event and record it
* Mitigated an issue with `getRemoteConfigValueForKeyP` and `remoteConfigClearValues` happening when they were called before initializing the SDK
* Deprecated `enableApm` config option. Use `apm.enableAppStartTimeTracking` instead (for iOS also `enableForegroundBackgroundTracking` must be used)
* Deprecated the old events methods:
* `sendEvent` use `Countly.events.recordEvent` instead
* `startEvent` use `Countly.events.startEvent` instead
* `cancelEvent` use `Countly.events.cancelEvent` instead
* `endEvent` use `Countly.events.endEvent` instead
* Updated the underlying Android SDK version to 24.4.0
* Updated the underlying iOS SDK version to 24.4.0
## 23.12.0

@@ -2,0 +30,0 @@ * Added TS type declerations to the SDK

interface Segmentation {
[key: string]: string;
[key: string]: number | string | boolean;
}

@@ -66,17 +66,17 @@

declare module 'countly-sdk-react-native-bridge' {
import type CountlyConfig from 'countly-sdk-react-native-bridge/CountlyConfig'
declare module "countly-sdk-react-native-bridge" {
import type CountlyConfig from "countly-sdk-react-native-bridge/CountlyConfig";
namespace Countly {
serverUrl: string;
appKey: string;
eventEmitter: any;
CountlyReactNative: any;
_isCrashReportingEnabled: boolean;
_isInitialized: boolean;
_isPushInitialized: boolean;
widgetShownCallbackName: string;
widgetClosedCallbackName: string;
ratingWidgetCallbackName: string;
pushNotificationCallbackName: string;
string;
string;
any;
any;
boolean;
boolean;
boolean;
string;
string;
string;
string;
export const TemporaryDeviceIDString: string;

@@ -131,2 +131,52 @@ export interface messagingMode {

/**
* Countly Event Module
*/
namespace events {
/**
* Records an event.
* Event will be saved to the internal queue and will be sent to the server with the next trigger.
*
* @param {string} eventName - Name of the event (This will be displayed on the dashboard)
* @param {Segmentation} segmentation - Extra information to send with your event as key/value pairs
* @param {number} eventCount - Indicates how many times this event has happened (Default is 1)
* @param {number} eventSum - A numerical value that is attached to this event (Will be summed up on the dashboard for all events with the same name)
* @return {void}
*/
export function recordEvent(eventName: string, segmentation?: Segmentation, eventCount?: number, eventSum?: number): void;
/**
*
* Starts a Timed Event
* If 'endEvent' is not called (with the same event name) no event will be recorded.
*
* @param {string} eventName - name of the event
* @return {void}
*/
export function startEvent(eventName: string): void;
/**
*
* Ends a Timed Event if it is started.
* Should be called after startEvent.
* This will behave like recordEvent.
*
* @param {string} eventName - Name of the event (This will be displayed on the dashboard)
* @param {Segmentation} segmentation - Extra information to send with your event as key/value pairs
* @param {number} eventCount - Indicates how many times this event has happened (Default is 1)
* @param {number} eventSum - A numerical value that is attached to this event (Will be summed up on the dashboard for all events with the same name)
* @return {void} void
*/
export function endEvent(eventName: string, segmentation?: Segmentation, eventCount?: number, eventSum?: number): void;
/**
*
* Cancels a Timed Event if it is started.
*
* @param {string} eventName - name of the event
* @return {void}
*/
export function cancelEvent(eventName: string): void;
}
/**
* Initialize Countly

@@ -172,2 +222,3 @@ *

* Used to send various types of event;
* @deprecated in 24.4.0 : use 'Countly.events.recordEvent' instead of this.
*

@@ -210,2 +261,11 @@ * @param {CountlyEventOptions} options event

export function pushTokenType(tokenType: string, channelName: string, channelDescription: string): Promise<string> | string;
/**
*
* Send push token
* @param {object} options - object containing the push token
* {token: string}
*
* @return {string | void} error message or void
*/
export function sendPushToken(options: { readonly token?: string }): void;

@@ -220,2 +280,3 @@

*
* @return {string | void} error message or void
*/

@@ -254,3 +315,2 @@ export function askForNotificationPermission(customSoundPath?: string): string | void;

*
* @return {string | void} error message or void
*/

@@ -264,3 +324,2 @@ export function start(): void;

*
* @return {string | void} error message or void
*/

@@ -320,3 +379,4 @@ export function stop(): void;

* @param {string | null} ipAddress IP address of user's
* */
* @return {string | void} error message or void
*/
export function setLocation(

@@ -351,6 +411,5 @@ countryCode: string | null,

* @return {DeviceIdType | null} deviceIdType or null
* */
*/
export function getDeviceIDType(): Promise<DeviceIdType> | null;
/**

@@ -362,3 +421,3 @@ * Change the current device id

* @return {string | void} error message or void
* */
*/
export function changeDeviceId(newDeviceID: string, onServer: boolean): string | void;

@@ -449,2 +508,3 @@

* Start Event
* @deprecated in 24.4.0 : use 'Countly.events.startEvent' instead of this.
*

@@ -459,2 +519,3 @@ * @param {string} eventName name of event

* Cancel Event
* @deprecated in 24.4.0 : use 'Countly.events.cancelEvent' instead of this.
*

@@ -469,2 +530,3 @@ * @param {string} eventName name of event

* End Event
* @deprecated in 24.4.0 : use 'Countly.events.endEvent' instead of this.
*

@@ -486,11 +548,99 @@ * @param {string | object} options event options

namespace userData {
/**
*
* Set custom key and value pair for the current user.
*
* @param {string} keyName user property key
* @param {object} keyValue user property value
* @return {string | void} error message or void
*/
export function setProperty(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Increment custom user data by 1
*
* @param {string} keyName user property key
* @return {string | void} error message or void
*/
export function increment(keyName: string): Promise<void> | string;
/**
*
* Increment custom user data by a specified value
*
* @param {string} keyName user property key
* @param {string} keyValue value to increment user property by
* @return {string | void} error message or void
*/
export function incrementBy(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Multiply custom user data by a specified value
*
* @param {string} keyName user property key
* @param {string} keyValue value to multiply user property by
* @return {string | void} error message or void
*/
export function multiply(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Save the max value between current and provided value.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function saveMax(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Save the min value between current and provided value.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function saveMin(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Set the property value if it does not exist.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function setOnce(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Add value to custom property (array) if value does not exist within.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pushUniqueValue(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Add value to custom property (array).
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pushValue(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Remove value to custom property (array).
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pullValue(keyName: string, keyValue: any): Promise<void> | string;

@@ -500,13 +650,127 @@ }

namespace userDataBulk {
/**
*
* Custom key and value pairs for the current user.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {object} customAndPredefined custom key value pairs
* @return {string | void} error message or void
*/
export function setUserProperties(properties: object): Promise<void> | string;
/**
*
* Save user data and send to server.
*
* @return {string | void} error message or void
*/
export function save(): Promise<void>;
/**
*
* Set custom key and value pair for the current user.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName custom user data key
* @param {string} keyValue custom user data value
* @return {string | void} error message or void
*/
export function setProperty(keyName: string, keyValue: any): Promise<string> | string;
/**
*
* Increment custom user data by 1
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @return {string | void} error message or void
*/
export function increment(keyName: string): Promise<void> | string;
/**
*
* Increment custom user data by a specified value
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue value to increment user property by
* @return {string | void} error message or void
*/
export function incrementBy(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Multiply custom user data by a specified value
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue value to multiply user property by
* @return {string | void} error message or void
*/
export function multiply(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Save the max value between current and provided value.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function saveMax(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Save the min value between current and provided value.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function saveMin(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Set the property value if it does not exist.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function setOnce(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Add value to custom property (array) if value does not exist within.
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pushUniqueValue(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Add value to custom property (array).
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pushValue(keyName: string, keyValue: any): Promise<void> | string;
/**
*
* Remove value to custom property (array).
* Remember to call Countly.userDataBulk.save() after calling all userDataBulk methods to send the bulk data to server.
*
* @param {string} keyName user property key
* @param {string} keyValue user property value
* @return {string | void} error message or void
*/
export function pullValue(keyName: string, keyValue: any): Promise<void> | string;

@@ -572,7 +836,58 @@ }

export function removeAllConsent(): string | void;
/**
*
* Replaces all stored Remote Config values with new values from server.
*
* @param {function} callback function to be called after fetching values.
* @return {string | void} error message or void
*/
export function remoteConfigUpdate(callback: CountlyCallback): string | void;
/**
*
* Replace specific Remote Config key value pairs with new values from server.
*
* @param {string[]} keyNames array of keys to replace.
* @param {function} callback function to be called after fetching values.
* @return {string | void} error message or void
*/
export function updateRemoteConfigForKeysOnly(keyNames: readonly string[], callback: CountlyCallback): string | void;
/**
*
* Replace all except specific Remote Config key value pairs with new values from server.
*
* @param {string[]} keyNames array of keys to skip.
* @param {function} callback function to be called after fetching values.
* @return {string | void} error message or void
*/
export function updateRemoteConfigExceptKeys(keyNames: readonly string[], callback: CountlyCallback): string | void;
/**
*
* Replace Remote Config key value for a specific key with new values from server.
* This takes in a callback that is called after new values are fetched.
*
* @param {string} keyNames key to fetch.
* @param {function} callback function to be called after fetching new values.
* @return {string | void} error message or void
*/
export function getRemoteConfigValueForKey(keyName: string, callback: (value: any) => void): string | void;
/**
*
* Replace Remote Config key value for a specific key with new values from server. This returns a promise that can be listened to.
*
* @param {string} keyName key to fetch.
* @return {string | promise} error message or promise
*/
export function getRemoteConfigValueForKeyP(keyName: string): string | Promise<any>;
/**
*
* Clear all Remote Config values downloaded from the server.
*
* @return {string | promise} error message or promise
*/
export function remoteConfigClearValues(): string | Promise<string>;

@@ -595,2 +910,11 @@

): void;
/**
*
* For getting brief feedback from your users to be displayed on the
Countly dashboard.
*
* @param {function} callback function to be called after it completes.
* @return {string | void} error message or void
*/
export function showStarRating(callback?: CountlyCallback): string | void;

@@ -604,2 +928,3 @@

* @param {callback listener} [ratingWidgetCallback] This parameter is optional.
* @return {string | void} error message or void
*/

@@ -612,3 +937,3 @@ export function presentRatingWidgetWithID(widgetId: string, closeButtonText: string, ratingWidgetCallback?: CountlyErrorCallback): string | void;

* @param {callback listener} [onFinished] - returns (retrievedWidgets, error). This parameter is optional.
* @return {string | []} error message or []
* @return {string | []} error message or array of feedback widgets
*/

@@ -641,10 +966,58 @@ export function getFeedbackWidgets(onFinished?: FeedbackWidgetCallback): Promise<any> | string;

* @param {number} size - event count
*
*/
export function setEventSendThreshold(size: number): void;
/**
*
* Measure and record time taken by any operation.
*
* @param {string} traceKey name of trace
* @return {string | void} error message or void
*/
export function startTrace(traceKey: string): string | void;
/**
*
* Cancel custom trace.
*
* @param {string} traceKey name of trace
* @return {string | void} error message or void
*/
export function cancelTrace(traceKey: string): string | void;
/**
*
* Cancel all custom traces.
*
* @return {string | void} error message or void
*/
export function clearAllTraces(): string | void;
/**
*
* End a custom trace.
*
* @param {string} traceKey name of trace
* @param {object} customMetric metric with key/value pair
* @return {string | void} error message or void
*/
export function endTrace(traceKey: string, customMetric?: TraceCustomMetric): string | void;
/**
*
* Manually record a custom trace
*
* @param {string} networkTraceKey name of trace
* @param {number} responseCode HTTP status code of the received
response
* @param {number} requestPayloadSize Size of the request's
payload in bytes
* @param {number} responsePayloadSize Size
of the received response's payload in bytes
* @param {number} startTime UNIX timestamp in milliseconds for
the starting time of the request
* @param {number} endTime UNIX timestamp in milliseconds for
the ending time of the request
* @return {string | void} error message or void
*/
export function recordNetworkTrace(

@@ -660,3 +1033,3 @@ networkTraceKey: string,

/**
* @deprecated in 23.02.0 : use 'countlyConfig.enableApm' instead of 'enableApm'.
* @deprecated in 23.02.0 : use 'countlyConfig.apm' interface instead of 'enableApm'.
*

@@ -674,2 +1047,4 @@ * Enable APM features, which includes the recording of app start time.

* Should be called before Countly init
* @param {string} attributionID attribution ID
* @return {string | void} error message or void
*/

@@ -684,2 +1059,4 @@ export function enableAttribution(attributionID?: string): string;

* Currently implemented for iOS only
* @param {string} attributionID attribution ID
* @return {string | void} error message or void
*/

@@ -693,2 +1070,3 @@ export function recordAttributionID(attributionID: string): string | void;

* these requests' app key will be replaced with the current app key.
* @return {string | void} error message or void
*/

@@ -699,2 +1077,5 @@ export function replaceAllAppKeysInQueueWithCurrentAppKey(): string | void;

* set direct attribution Id for campaign attribution reporting.
* @param {string} campaignType type
* @param {string} campaignData data
* @return {string | void} error message or void
*/

@@ -705,2 +1086,4 @@ export function recordDirectAttribution(campaignType, campaignData): void;

* set indirect attribution Id for campaign attribution reporting.
* @param {string} attributionValues attribution values
* @return {string | void} error message or void
*/

@@ -713,2 +1096,3 @@ export function recordIndirectAttribution(attributionValues): void;

* these requests will be removed from request queue.
* @return {string | void} error message or void
*/

@@ -720,2 +1104,3 @@ export function removeDifferentAppKeysFromQueue(): string | void;

* Should be called after init.
* @return {string | void} error message or void
*/

@@ -727,11 +1112,12 @@ export function appLoadingFinished(): string | void;

* Should be called before Countly init
* @param {object} customMetric - metric with key/value pair
* @param {object} customMetric metric with key/value pair
* Supported data type for customMetric values is string
* @return {string | void} error message or void
*/
export function setCustomMetrics(customMetric: CustomMetric): string | void;
validateUserDataValue: ValidationFunction;
validateUserDataType: ValidationFunction;
validateValidUserData: ValidationFunction;
validateParseInt: ValidationFunction;
logWarning: (functionName: string, warning: string) => Promise<void>;
ValidationFunction;
ValidationFunction;
ValidationFunction;
ValidationFunction;
(functionName: string, warning: string) => Promise<void>;
}

@@ -742,5 +1128,37 @@

declare module 'countly-sdk-react-native-bridge/CountlyConfig' {
declare module "countly-sdk-react-native-bridge/CountlyConfig" {
/**
*
* This class holds APM specific configurations to be used with
* CountlyConfig class and serves as an interface.
*
*/
class CountlyConfigApm {
/**
* Enables the tracking of app start time. (For iOS after this call you
* will have to call [enableManualAppLoadedTrigger])
*/
enableAppStartTimeTracking(): CountlyConfigApm;
/**
* Enables the automatic tracking of app foreground and background
* durations.
*/
enableForegroundBackgroundTracking(): CountlyConfigApm;
/**
* Enables the usage of manual trigger [Countly.appLoadingFinished] to
* determine app start finish time.
*/
enableManualAppLoadedTrigger(): CountlyConfigApm;
/**
* Gives you the ability to override the app start initial timestamp.
* [timestamp] is the timestamp (in milliseconds)
*/
setAppStartTimestampOverride(timestamp: number): CountlyConfigApm;
}
/**
*
* Config object for Countly Init

@@ -751,9 +1169,14 @@ * Should be called before Countly "askForNotificationPermission"

declare class CountlyConfig {
/**
/**
* @param {string} serverURL server url
* @param {string} appKey application key
*/
constructor(serverURL: string, appKey: string);
constructor(serverURL: string, appKey: string);
/**
/**
* getter for CountlyConfigApm instance that is used to access CountlyConfigApm methods
*/
apm: CountlyConfigApm;
/**
* Method to set the server url

@@ -763,5 +1186,5 @@ *

*/
setServerURL(serverURL: string): CountlyConfig;
setServerURL(serverURL: string): CountlyConfig;
/**
/**
* Method to set the app key

@@ -771,5 +1194,5 @@ *

*/
setAppKey(appKey: string): CountlyConfig;
setAppKey(appKey: string): CountlyConfig;
/**
/**
* Method to set the device id

@@ -779,5 +1202,5 @@ *

*/
setDeviceID(deviceID: string): CountlyConfig;
setDeviceID(deviceID: string): CountlyConfig;
/**
/**
* Method to enable countly internal debugging logs

@@ -788,10 +1211,10 @@ *

*/
setLoggingEnabled(loggingEnabled: boolean): CountlyConfig;
setLoggingEnabled(loggingEnabled: boolean): CountlyConfig;
/**
/**
* Method to enable crash reporting to report unhandled crashes to Countly
*/
enableCrashReporting(): CountlyConfig;
enableCrashReporting(): CountlyConfig;
/**
/**
* Method to set if the consent feature is enabled.

@@ -804,5 +1227,5 @@ *

*/
setRequiresConsent(shouldRequireConsent: boolean): CountlyConfig;
setRequiresConsent(shouldRequireConsent: boolean): CountlyConfig;
/**
/**
* Method to give consent for specific features before init

@@ -814,5 +1237,5 @@ *

*/
giveConsent(consents: readonly string[]): CountlyConfig;
giveConsent(consents: readonly string[]): CountlyConfig;
/**
/**
* Method to set the user initial location

@@ -825,5 +1248,5 @@ *

*/
setLocation(locationCountryCode: string, locationCity: string, locationGpsCoordinates: string, locationIpAddress: string): CountlyConfig;
setLocation(locationCountryCode: string, locationCity: string, locationGpsCoordinates: string, locationIpAddress: string): CountlyConfig;
/**
/**
* Method to enable tamper protection. This sets the optional salt to be

@@ -835,10 +1258,18 @@ * used for calculating the checksum of requested data which will be sent

*/
enableParameterTamperingProtection(tamperingProtectionSalt: string): CountlyConfig;
enableParameterTamperingProtection(tamperingProtectionSalt: string): CountlyConfig;
/**
/**
* @deprecated in 24.4.0 : use 'countlyConfig.apm' interface instead of 'config.enableApm'.
*
* Method to enable application performance monitoring which includes the recording of app start time.
*/
enableApm(): CountlyConfig;
enableApm(): CountlyConfig;
/**
/**
* AdditionalIntentRedirectionChecks are enabled by default.
* This method should be used to disable them.
*/
disableAdditionalIntentRedirectionChecks(): CountlyConfig;
/**
* Method to set the push token type

@@ -853,5 +1284,5 @@ * @deprecated

*/
pushTokenType(tokenType: TokenType, channelName: string, channelDescription: string): CountlyConfig;
pushTokenType(tokenType: TokenType, channelName: string, channelDescription: string): CountlyConfig;
/**
/**
* Method to set the push token type

@@ -863,5 +1294,5 @@ * NB: ONLY FOR iOS

*/
setPushTokenType(tokenType: messagingMode): CountlyConfig;
setPushTokenType(tokenType: messagingMode): CountlyConfig;
/**
/**
* Method to set the push channel name and description

@@ -873,5 +1304,5 @@ * NB: ONLY FOR ANDROID

*/
setPushNotificationChannelInformation(name: string, description: string): CountlyConfig;
setPushNotificationChannelInformation(name: string, description: string): CountlyConfig;
/**
/**
* Method to set the push notification accent color

@@ -883,5 +1314,5 @@ * NB: ONLY FOR ANDROID

*/
setPushNotificationAccentColor(accentColor: string): CountlyConfig;
setPushNotificationAccentColor(accentColor: string): CountlyConfig;
/**
/**
* Method to configure intent redirection check

@@ -892,5 +1323,5 @@ *

*/
configureIntentRedirectionCheck(allowedIntentClassNames: readonly string[], allowedIntentPackageNames: readonly string[]): CountlyConfig;
configureIntentRedirectionCheck(allowedIntentClassNames: readonly string[], allowedIntentPackageNames: readonly string[]): CountlyConfig;
/**
/**
* Method to set star rating dialog text

@@ -902,5 +1333,5 @@ *

*/
setStarRatingDialogTexts(starRatingTextTitle: string, starRatingTextMessage: string, starRatingTextDismiss: string): CountlyConfig;
setStarRatingDialogTexts(starRatingTextTitle: string, starRatingTextMessage: string, starRatingTextDismiss: string): CountlyConfig;
/**
/**
* Report direct user attribution

@@ -911,5 +1342,5 @@ *

*/
recordDirectAttribution(campaignType: string, campaignData: object): CountlyConfig;
recordDirectAttribution(campaignType: string, campaignData: object): CountlyConfig;
/**
/**
* Report indirect user attribution

@@ -919,3 +1350,3 @@ *

*/
recordIndirectAttribution(attributionValues: object): CountlyConfig;
recordIndirectAttribution(attributionValues: object): CountlyConfig;
}

@@ -922,0 +1353,0 @@

@@ -1,2 +0,3 @@

import { initialize } from './Logger.js';
import { initialize } from "./Logger.js";
import CountlyConfigApm from "./lib/configuration_interfaces/countly_config_apm.js";
/**

@@ -19,5 +20,13 @@ * Countly SDK React Native Bridge

this.appKey = appKey;
this._countlyConfigApmInstance = new CountlyConfigApm();
}
/**
* Getter to get the APM specific configurations
*/
get apm() {
return this._countlyConfigApmInstance;
}
/**
* Method to set the server url

@@ -126,2 +135,4 @@ *

/**
* @deprecated in 24.4.0 : use 'countlyConfig.apm' interface instead of 'config.enableApm'.
*
* Method to enable application performance monitoring which includes the recording of app start time.

@@ -135,2 +146,11 @@ */

/**
* AdditionalIntentRedirectionChecks are enabled by default.
* This method should be used to disable them.
*/
disableAdditionalIntentRedirectionChecks() {
this.disableAdditionalIntentRedirectionChecks = true;
return this;
}
/**
* Method to set the push token type

@@ -137,0 +157,0 @@ * @deprecated

@@ -8,4 +8,4 @@ const CountlyState = {};

// Feedback module related variables
CountlyState.widgetShownCallbackName = 'widgetShownCallback';
CountlyState.widgetClosedCallbackName = 'widgetClosedCallback';
CountlyState.widgetShownCallbackName = "widgetShownCallback";
CountlyState.widgetClosedCallbackName = "widgetClosedCallback";
/*

@@ -12,0 +12,0 @@ * Callback to be executed when feedback widget is displayed

@@ -1,18 +0,19 @@

const lightOrange = '#FFA737';
const lightGreen = '#2DA657'; // countly green
const lightOrange = "#FFA737";
const lightGreen = "#2DA657"; // countly green
const navigationName = {
Home: 'Countly RN Example',
Feedback: 'Feedback',
Events: 'Events',
UserProfiles: 'User Profiles',
Views: 'Views',
Crashes: 'Crashes',
APM: 'APM',
Consent: 'Consent',
Others: 'Others',
DeviceID: 'Device ID',
RemoteConfig: 'Remote Config',
Home: "Countly RN Example",
Feedback: "Feedback",
Events: "Events",
UserProfiles: "User Profiles",
Views: "Views",
Crashes: "Crashes",
APM: "APM",
Consent: "Consent",
Others: "Others",
DeviceID: "Device ID",
RemoteConfig: "Remote Config",
eventLegacy: "Events Legacy"
};
export { lightOrange, navigationName, lightGreen };

@@ -1,5 +0,6 @@

import * as L from './Logger.js';
import * as L from "./Logger.js";
class Feedback {
#state;
constructor(state) {

@@ -21,3 +22,3 @@ this.#state = state;

L.d('getAvailableFeedbackWidgets, getAvailableFeedbackWidgets');
L.d("getAvailableFeedbackWidgets, getAvailableFeedbackWidgets");
let result = null;

@@ -54,3 +55,3 @@ let error = null;

if (!feedbackWidget) {
message = 'feedbackWidget should not be null or undefined';
message = "feedbackWidget should not be null or undefined";
L.e(`presentFeedbackWidget, ${message}`);

@@ -60,3 +61,3 @@ return { error: message };

if (!feedbackWidget.id) {
message = 'FeedbackWidget id should not be null or empty';
message = "FeedbackWidget id should not be null or empty";
L.e(`presentFeedbackWidget, ${message}`);

@@ -66,8 +67,8 @@ return { error: message };

if (!feedbackWidget.type) {
message = 'FeedbackWidget type should not be null or empty';
message = "FeedbackWidget type should not be null or empty";
L.e(`presentFeedbackWidget, ${message}`);
return { error: message };
}
if (typeof closeButtonText !== 'string') {
closeButtonText = '';
if (typeof closeButtonText !== "string") {
closeButtonText = "";
L.w(`presentFeedbackWidget, unsupported data type of closeButtonText : [${typeof args}]`);

@@ -90,4 +91,4 @@ }

feedbackWidget.name = feedbackWidget.name || '';
closeButtonText = closeButtonText || '';
feedbackWidget.name = feedbackWidget.name || "";
closeButtonText = closeButtonText || "";
this.#state.CountlyReactNative.presentFeedbackWidget([feedbackWidget.id, feedbackWidget.type, feedbackWidget.name, closeButtonText]);

@@ -94,0 +95,0 @@ return { error: null };

@@ -0,1 +1,34 @@

## 24.4.0
* Added `attemptToSendStoredRequests` method to combine all events in event queue into a request and attempt to process stored requests
* Added the iOS privacy manifest to the Countly SDK
* Added a separate SDK Limits Config with the following options:
* `setMaxKeyLength`
* `setMaxValueSize`
* `setMaxBreadcrumbCount`
* `setMaxSegmentationValues`
* `setMaxStackTraceLineLength`
* `setMaxStackTraceLinesPerThread`
* Fixed session duration inconsistency by incorporating checks for whether the session has started or not.
* Deprecated `maxKeyLength` initial config flag
* Deprecated `crashLogLimit` initial config flag
* Deprecated `maxValueLength` initial config flag
* Deprecated `maxSegmentationValues` initial config flag
## 24.1.0
* Added a separate APM Configs with following options:
* `enableForegroundBackgroundTracking`
* `enableAppStartTimeTracking`
* `enableManualAppLoadedTrigger`
* `setAppStartTimestampOverride:`
* Mitigated an issue in the symbol file uploading script where some dSYM files were archived without content
* Deprecated `enablePerformanceMonitoring` initial config flag
## 23.12.1
* dSYM uploading script now can upload multiple dSYM files if their location is provided
* Added support for Xcode 15 DWARF file environment variable changes while using dSYM upload script
## 23.12.0

@@ -2,0 +35,0 @@ * Added `disableLocation` initial config property to disable location tracking

@@ -1,2 +0,2 @@

const countlyNamespace = '[CountlyReactNative] ';
const countlyNamespace = "[CountlyReactNative] ";
let canLog = false;

@@ -10,7 +10,7 @@

canLog = debugMode && console !== undefined;
i('[Logger] initializing the module');
i("[Logger] initializing the module");
}
/**
* Error - this is a issues that needs attention right now.
* Error - this is for things that need immediate attention because SDK won’t work.
* @param {String} message

@@ -17,0 +17,0 @@ */

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

@@ -8,3 +8,5 @@ "bugs": {

},
"scripts": {},
"scripts": {
"test": "jest"
},
"deprecated": false,

@@ -25,25 +27,25 @@ "description": "Countly is an innovative, real-time, open source mobile analytics and push notifications platform.",

"devDependencies": {
"@babel/core": "7.23.3",
"@babel/preset-env": "7.23.3",
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.9",
"@babel/runtime": "7.23.2",
"@react-native-community/eslint-config": "3.2.0",
"@swc/core": "1.3.96",
"@swc/wasm": "1.3.97",
"@swc/core": "1.4.2",
"@swc/wasm": "1.4.2",
"@tsconfig/react-native": "3.0.2",
"@types/jest": "^29.5.8",
"@types/react": "18.2.37",
"@types/react": "18.2.61",
"@types/react-native": "0.72.6",
"@types/react-test-renderer": "18.0.6",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"babel-jest": "29.7.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"babel-jest": "^29.7.0",
"bufferutil": "4.0.8",
"encoding": "0.1.13",
"eslint": "8.53.0",
"eslint": "8.57.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "9.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard-with-typescript": "39.1.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-promise": "6.1.1",

@@ -57,3 +59,3 @@ "eslint-plugin-react": "7.33.2",

"node-notifier": "10.0.1",
"prettier": "3.0.3",
"prettier": "3.2.5",
"react-test-renderer": "18.2.0",

@@ -60,0 +62,0 @@ "ts-node": "10.9.1",

@@ -1,8 +0,8 @@

import parseErrorStackLib from '../react-native/Libraries/Core/Devtools/parseErrorStack.js';
import * as L from './Logger.js';
import * as L from "./Logger.js";
import parseErrorStackLib from "react-native/Libraries/Core/Devtools/parseErrorStack.js";
const DeviceIdType = {
DEVELOPER_SUPPLIED: 'DEVELOPER_SUPPLIED',
SDK_GENERATED: 'SDK_GENERATED',
TEMPORARY_ID: 'TEMPORARY_ID',
DEVELOPER_SUPPLIED: "DEVELOPER_SUPPLIED",
SDK_GENERATED: "SDK_GENERATED",
TEMPORARY_ID: "TEMPORARY_ID",
};

@@ -12,23 +12,25 @@

*
* internal countly function that converts String to DeviceIdType.
* internal countly function that converts int to DeviceIdType.
* @param {number} deviceIdType device id type as int
*
* @return {DeviceIdType || null} deviceIdType e.g DeviceIdType.DEVELOPER_SUPPLIED, DeviceIdType.TEMPORARY_ID, DeviceIdType.SDK_GENERATED.
* @return {DeviceIdType} deviceIdType e.g DeviceIdType.DEVELOPER_SUPPLIED, DeviceIdType.TEMPORARY_ID, DeviceIdType.SDK_GENERATED.
*/
function stringToDeviceIDType(deviceIdType) {
function intToDeviceIDType(deviceIdType) {
let result = null;
switch (deviceIdType) {
case 'DS':
result = DeviceIdType.DEVELOPER_SUPPLIED;
break;
case 'TID':
result = DeviceIdType.TEMPORARY_ID;
break;
case 'SG':
result = DeviceIdType.SDK_GENERATED;
break;
case 10101:
result = DeviceIdType.SDK_GENERATED;
break;
case 20202:
result = DeviceIdType.DEVELOPER_SUPPLIED;
break;
case 30303:
result = DeviceIdType.TEMPORARY_ID;
break;
default:
L.e("_getDeviceIdType, " + `unexpected deviceIdType [${deviceIdType}] from native side`);
result = DeviceIdType.SDK_GENERATED;
break;
}
if (result == null) {
L.e(`_getDeviceIdType, ` + `unexpected deviceIdType [${deviceIdType}] from native side`);
return null;
}
L.d(`_getDeviceIdType, DeviceIDType: ${result}`);
return result;

@@ -45,74 +47,92 @@ }

function configToJson(config) {
L.d('configToJson, Converting config to json');
L.d("configToJson, Converting config to json");
const json = {};
try {
json['serverURL'] = config.serverURL;
json['appKey'] = config.appKey;
json['deviceID'] = config.deviceID;
json.serverURL = config.serverURL;
json.appKey = config.appKey;
json.deviceID = config.deviceID;
if (config.loggingEnabled) {
json['loggingEnabled'] = config.loggingEnabled;
json.loggingEnabled = config.loggingEnabled;
}
if (config.crashReporting) {
json['crashReporting'] = config.crashReporting;
json.crashReporting = config.crashReporting;
}
if (config.shouldRequireConsent) {
json['shouldRequireConsent'] = config.shouldRequireConsent;
json.shouldRequireConsent = config.shouldRequireConsent;
}
if (config.consents) {
json['consents'] = config.consents;
json.consents = config.consents;
}
if (config.locationCountryCode) {
json['locationCountryCode'] = config.locationCountryCode;
json.locationCountryCode = config.locationCountryCode;
}
if (config.locationCity) {
json['locationCity'] = config.locationCity;
json.locationCity = config.locationCity;
}
if (config.locationGpsCoordinates) {
json['locationGpsCoordinates'] = config.locationGpsCoordinates;
json.locationGpsCoordinates = config.locationGpsCoordinates;
}
if (config.locationIpAddress) {
json['locationIpAddress'] = config.locationIpAddress;
json.locationIpAddress = config.locationIpAddress;
}
if (config.tamperingProtectionSalt) {
json['tamperingProtectionSalt'] = config.tamperingProtectionSalt;
json.tamperingProtectionSalt = config.tamperingProtectionSalt;
}
// APM ------------------------------------------------
if (config.apm.enableForegroundBackground) {
json.enableForegroundBackground = config.apm.enableForegroundBackground;
}
if (config.apm.enableManualAppLoaded) {
json.enableManualAppLoaded = config.apm.enableManualAppLoaded;
}
if (config.apm.startTSOverride) {
json.startTSOverride = config.apm.startTSOverride;
}
if (config.apm.trackAppStartTime) {
json.trackAppStartTime = config.apm.trackAppStartTime;
}
// Legacy APM
if (config.enableApm) {
json['enableApm'] = config.enableApm;
json.enableApm = config.enableApm;
}
// APM END --------------------------------------------
if (config.disableAdditionalIntentRedirectionChecks) {
json["disableAdditionalIntentRedirectionChecks"] = config.disableAdditionalIntentRedirectionChecks;
}
const pushNotification = {};
if (config.tokenType) {
pushNotification['tokenType'] = config.tokenType;
pushNotification.tokenType = config.tokenType;
}
if (config.channelName) {
pushNotification['channelName'] = config.channelName;
pushNotification.channelName = config.channelName;
}
if (config.channelDescription) {
pushNotification['channelDescription'] = config.channelDescription;
pushNotification.channelDescription = config.channelDescription;
}
if (config.accentColor) {
pushNotification['accentColor'] = config.accentColor;
pushNotification.accentColor = config.accentColor;
}
json['pushNotification'] = pushNotification;
json.pushNotification = pushNotification;
if (config.allowedIntentClassNames) {
json['allowedIntentClassNames'] = config.allowedIntentClassNames;
json.allowedIntentClassNames = config.allowedIntentClassNames;
}
if (config.allowedIntentClassNames) {
json['allowedIntentPackageNames'] = config.allowedIntentPackageNames;
json.allowedIntentPackageNames = config.allowedIntentPackageNames;
}
if (config.starRatingTextTitle) {
json['starRatingTextTitle'] = config.starRatingTextTitle;
json.starRatingTextTitle = config.starRatingTextTitle;
}
if (config.starRatingTextMessage) {
json['starRatingTextMessage'] = config.starRatingTextMessage;
json.starRatingTextMessage = config.starRatingTextMessage;
}
if (config.starRatingTextDismiss) {
json['starRatingTextDismiss'] = config.starRatingTextDismiss;
json.starRatingTextDismiss = config.starRatingTextDismiss;
}
if (config.campaignType) {
json['campaignType'] = config.campaignType;
json['campaignData'] = config.campaignData;
json.campaignType = config.campaignType;
json.campaignData = config.campaignData;
}
if (config.attributionValues) {
json['attributionValues'] = config.attributionValues;
json.attributionValues = config.attributionValues;
}

@@ -135,3 +155,3 @@ } catch (err) {

try {
if (Platform.hasOwnProperty('constants')) {
if (Platform.hasOwnProperty("constants")) {
// RN version >= 0.63

@@ -141,14 +161,12 @@ if (Platform.constants.reactNativeVersion.minor >= 64) {

jsStackTrace = parseErrorStackLib(e.stack);
}
// RN version == 0.63
else {
} else {
// RN version == 0.63
jsStackTrace = parseErrorStackLib(e);
}
}
// RN version < 0.63
else {
} else {
// RN version < 0.63
jsStackTrace = parseErrorStackLib(e);
}
} catch (e) {
// L.e('getStackTrace', e.message);
} catch (err) {
// L.e('getStackTrace', err.message);
}

@@ -158,2 +176,2 @@ return jsStackTrace;

export { configToJson, stringToDeviceIDType, DeviceIdType, getStackTrace };
export { configToJson, intToDeviceIDType, DeviceIdType, getStackTrace };

@@ -1,2 +0,2 @@

import * as L from './Logger.js';
import * as L from "./Logger.js";

@@ -14,7 +14,7 @@ /**

let message = null;
if (typeof stringValue === 'number') {
if (typeof stringValue === "number") {
return null;
}
if (typeof stringValue === 'string') {
L.w(`${functionName} unsupported data type '${typeof stringValue}', its data type should be 'number'`);
if (typeof stringValue === "string") {
L.d(`${functionName} unsupported data type '${typeof stringValue}', its data type should be 'number'`);
return null;

@@ -38,3 +38,3 @@ }

L.d(`validateValidUserData, Validating valid user data: [${stringValue}], name: [${stringName}], function: [${functionName}]`);
if (stringValue || stringValue == '') {
if (stringValue || stringValue == "") {
return null;

@@ -81,7 +81,7 @@ }

message = `${stringName} should not be null, undefined or empty`;
} else if (typeof stringValue !== 'string') {
} else if (typeof stringValue !== "string") {
message = `skipping value for '${stringName.toString()}', due to unsupported data type '${typeof stringValue}', its data type should be 'string'`;
}
if (message) {
L.e(`${functionName}, ${message}`);
L.d(`${functionName}, ${message}`);
}

@@ -118,2 +118,49 @@ return message;

export { validateUserDataValue as UserDataValue, validateString as String, validateParseInt as ParseInt, validateValidUserData as ValidUserData, validateUserDataType as UserDataType };
/**
* Validates event parameters.
* It will log a message if any issue is found and return false.
* If the parameters are valid, it will return true.
*
* @param {string} functionName - name of function that called this method for logging
* @param {string} eventName - provided event name
* @param {Segmentation} segmentation - provided segmentation
* @param {number} eventCount - provided event count
* @param {number} eventSum - provided event sum
* @returns {boolean} true if parameters are valid, false otherwise
*/
function areEventParametersValid(functionName, eventName, segmentation, eventCount, eventSum) {
if (!eventName || typeof eventName !== "string" || eventName.length === 0) {
L.w(`${functionName}, provided eventName: [${eventName}]. It must be a valid string!`);
return false;
}
if (segmentation && typeof segmentation !== "object") {
L.w(`${functionName}, provided segmentation: [${segmentation}]. It must be an object!`);
return false;
}
// validate segmentation values
if (segmentation) {
for (const key in segmentation) {
const value = segmentation[key];
const valueType = typeof value;
if (value && valueType !== "string" && valueType !== "number" && valueType !== "boolean") {
L.w(`${functionName}, segmentation value: [${value}] for the key: [${key}] must be a number, string or boolean!`);
return false;
}
}
}
if (eventCount && (typeof eventCount !== "number" || eventCount < 0)) {
L.w(`${functionName}, provided eventCount: [${eventCount}]. It must be a positive number!`);
return false;
}
if (eventSum && typeof eventSum !== "number") {
L.w(`${functionName}, provided eventSum: [${eventSum}]. It must be a number!`);
return false;
}
return true;
}
export { validateUserDataValue as UserDataValue, validateString as String, validateParseInt as ParseInt, validateValidUserData as ValidUserData, validateUserDataType as UserDataType, areEventParametersValid };

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 too big to display

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

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

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

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