@developer_tribe/react-native-comnyx 0.13.8 → 0.13.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/android/generated/RCTAppDependencyProvider.h +25 -0
  2. package/android/generated/RCTAppDependencyProvider.mm +55 -0
  3. package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  4. package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  5. package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
  6. package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  7. package/android/generated/ReactAppDependencyProvider.podspec +34 -0
  8. package/android/generated/jni/CMakeLists.txt +36 -0
  9. package/android/generated/jni/RNComnyxSpec-generated.cpp +22 -0
  10. package/android/generated/jni/RNComnyxSpec.h +24 -0
  11. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +17 -0
  12. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +19 -0
  13. package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +10 -36
  14. package/lib/commonjs/register/collectData.js +10 -6
  15. package/lib/commonjs/register/collectData.js.map +1 -1
  16. package/lib/commonjs/version.js +1 -1
  17. package/lib/commonjs/version.js.map +1 -1
  18. package/lib/module/register/collectData.js +10 -6
  19. package/lib/module/register/collectData.js.map +1 -1
  20. package/lib/module/version.js +1 -1
  21. package/lib/module/version.js.map +1 -1
  22. package/lib/typescript/src/register/collectData.d.ts +1 -1
  23. package/lib/typescript/src/register/collectData.d.ts.map +1 -1
  24. package/lib/typescript/src/version.d.ts +1 -1
  25. package/lib/typescript/src/version.d.ts.map +1 -1
  26. package/package.json +25 -13
  27. package/src/register/collectData.ts +13 -9
  28. package/src/version.ts +1 -1
  29. package/lib/typescript/src/__tests__/acumulator.test.d.ts +0 -2
  30. package/lib/typescript/src/__tests__/acumulator.test.d.ts.map +0 -1
  31. package/src/__tests__/acumulator.test.ts +0 -216
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ #if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
12
+ #import <React-RCTAppDelegate/RCTDependencyProvider.h>
13
+ #elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
14
+ #import <React_RCTAppDelegate/RCTDependencyProvider.h>
15
+ #else
16
+ #import "RCTDependencyProvider.h"
17
+ #endif
18
+
19
+ NS_ASSUME_NONNULL_BEGIN
20
+
21
+ @interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
22
+
23
+ @end
24
+
25
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import "RCTAppDependencyProvider.h"
9
+ #import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
10
+ #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
11
+
12
+ @implementation RCTAppDependencyProvider {
13
+ NSArray<NSString *> * _URLRequestHandlerClassNames;
14
+ NSArray<NSString *> * _imageDataDecoderClassNames;
15
+ NSArray<NSString *> * _imageURLLoaderClassNames;
16
+ NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
17
+ }
18
+
19
+ - (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
20
+ static dispatch_once_t requestUrlToken;
21
+ dispatch_once(&requestUrlToken, ^{
22
+ self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
23
+ });
24
+
25
+ return _URLRequestHandlerClassNames;
26
+ }
27
+
28
+ - (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
29
+ static dispatch_once_t dataDecoderToken;
30
+ dispatch_once(&dataDecoderToken, ^{
31
+ _imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
32
+ });
33
+
34
+ return _imageDataDecoderClassNames;
35
+ }
36
+
37
+ - (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
38
+ static dispatch_once_t urlLoaderToken;
39
+ dispatch_once(&urlLoaderToken, ^{
40
+ _imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
41
+ });
42
+
43
+ return _imageURLLoaderClassNames;
44
+ }
45
+
46
+ - (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
47
+ static dispatch_once_t nativeComponentsToken;
48
+ dispatch_once(&nativeComponentsToken, ^{
49
+ _thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
50
+ });
51
+
52
+ return _thirdPartyFabricComponents;
53
+ }
54
+
55
+ @end
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @interface RCTModulesConformingToProtocolsProvider: NSObject
11
+
12
+ +(NSArray<NSString *> *)imageURLLoaderClassNames;
13
+
14
+ +(NSArray<NSString *> *)imageDataDecoderClassNames;
15
+
16
+ +(NSArray<NSString *> *)URLRequestHandlerClassNames;
17
+
18
+ @end
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import "RCTModulesConformingToProtocolsProvider.h"
9
+
10
+ @implementation RCTModulesConformingToProtocolsProvider
11
+
12
+ +(NSArray<NSString *> *)imageURLLoaderClassNames
13
+ {
14
+ return @[
15
+
16
+ ];
17
+ }
18
+
19
+ +(NSArray<NSString *> *)imageDataDecoderClassNames
20
+ {
21
+ return @[
22
+
23
+ ];
24
+ }
25
+
26
+ +(NSArray<NSString *> *)URLRequestHandlerClassNames
27
+ {
28
+ return @[
29
+
30
+ ];
31
+ }
32
+
33
+ @end
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @protocol RCTComponentViewProtocol;
11
+
12
+ @interface RCTThirdPartyComponentsProvider: NSObject
13
+
14
+ + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
15
+
16
+ @end
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+ #import "RCTThirdPartyComponentsProvider.h"
12
+ #import <React/RCTComponentViewProtocol.h>
13
+
14
+ @implementation RCTThirdPartyComponentsProvider
15
+
16
+ + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
17
+ {
18
+ return @{
19
+
20
+ };
21
+ }
22
+
23
+ @end
@@ -0,0 +1,34 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ version = "0.78.1"
7
+ source = { :git => 'https://github.com/facebook/react-native.git' }
8
+ if version == '1000.0.0'
9
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
10
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
11
+ else
12
+ source[:tag] = "v#{version}"
13
+ end
14
+
15
+ Pod::Spec.new do |s|
16
+ s.name = "ReactAppDependencyProvider"
17
+ s.version = version
18
+ s.summary = "The third party dependency provider for the app"
19
+ s.homepage = "https://reactnative.dev/"
20
+ s.documentation_url = "https://reactnative.dev/"
21
+ s.license = "MIT"
22
+ s.author = "Meta Platforms, Inc. and its affiliates"
23
+ s.platforms = min_supported_versions
24
+ s.source = source
25
+ s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
26
+
27
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
28
+ s.pod_target_xcconfig = {
29
+ "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
30
+ "DEFINES_MODULE" => "YES"
31
+ }
32
+
33
+ s.dependency "ReactCodegen"
34
+ end
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNComnyxSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNComnyxSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNComnyxSpec PUBLIC . react/renderer/components/RNComnyxSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNComnyxSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNComnyxSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNComnyxSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+
16
+
17
+ std::shared_ptr<TurboModule> RNComnyxSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
18
+
19
+ return nullptr;
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ JSI_EXPORT
22
+ std::shared_ptr<TurboModule> RNComnyxSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNComnyxSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+
15
+
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -5,15 +5,11 @@ import android.app.NotificationManager
5
5
  import android.app.PendingIntent
6
6
  import android.content.Context
7
7
  import android.content.Intent
8
- import android.graphics.Bitmap
9
- import android.graphics.Canvas
8
+ import android.content.pm.PackageManager
10
9
  import android.graphics.Color
11
- import android.graphics.drawable.BitmapDrawable
12
- import android.graphics.drawable.Drawable
13
10
  import android.os.Build
14
11
  import android.util.Log
15
12
  import androidx.core.app.NotificationCompat
16
- import androidx.core.content.ContextCompat
17
13
  import com.comnyx.ComnyxModule
18
14
  import com.facebook.react.bridge.Arguments
19
15
  import com.facebook.react.bridge.WritableMap
@@ -127,20 +123,22 @@ class NotificationsHelper(private val context: Context) {
127
123
  .setContentTitle(title)
128
124
  .setContentText(message)
129
125
 
130
- val iconResourceId = context.resources.getIdentifier("com.google.firebase.messaging.default_notification_icon", "drawable", context.packageName)
131
- if (iconResourceId != 0) {
132
- builder.setSmallIcon(iconResourceId)
133
- setLargeIconFromRes(builder, iconResourceId, "Firebase default notification icon")
134
- Logger.v("Using Firebase default notification icon", TAG)
126
+ val appInfoWithMeta = context.packageManager.getApplicationInfo(
127
+ context.packageName,
128
+ PackageManager.GET_META_DATA
129
+ )
130
+ val metaIconId = appInfoWithMeta.metaData
131
+ ?.getInt("com.google.firebase.messaging.default_notification_icon") ?: 0
132
+ if (metaIconId != 0) {
133
+ builder.setSmallIcon(metaIconId)
134
+ Logger.v("Using Firebase default notification icon from manifest meta-data", TAG)
135
135
  } else {
136
136
  try {
137
137
  val appInfo = context.packageManager.getApplicationInfo(context.packageName, 0)
138
138
  builder.setSmallIcon(appInfo.icon)
139
- setLargeIconFromRes(builder, appInfo.icon, "app icon")
140
139
  Logger.v("Firebase default notification icon not found, using app icon", TAG)
141
140
  } catch (e: Exception) {
142
141
  builder.setSmallIcon(android.R.drawable.ic_dialog_info)
143
- setLargeIconFromRes(builder, android.R.drawable.ic_dialog_info, "system default icon")
144
142
  Logger.v("Using system default icon as final fallback", TAG)
145
143
  }
146
144
  }
@@ -215,28 +213,4 @@ class NotificationsHelper(private val context: Context) {
215
213
  Logger.e("Error showing notification: ${e.message}", TAG, e)
216
214
  }
217
215
  }
218
-
219
- private fun setLargeIconFromRes(
220
- builder: NotificationCompat.Builder,
221
- resId: Int,
222
- sourceLabel: String
223
- ) {
224
- val drawable = ContextCompat.getDrawable(context, resId) ?: return
225
- val bitmap = drawableToBitmap(drawable)
226
- builder.setLargeIcon(bitmap)
227
- Logger.v("Using large icon from $sourceLabel", TAG)
228
- }
229
-
230
- private fun drawableToBitmap(drawable: Drawable): Bitmap {
231
- if (drawable is BitmapDrawable) {
232
- drawable.bitmap?.let { return it }
233
- }
234
- val width = drawable.intrinsicWidth.takeIf { it > 0 } ?: 1
235
- val height = drawable.intrinsicHeight.takeIf { it > 0 } ?: 1
236
- val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
237
- val canvas = Canvas(bitmap)
238
- drawable.setBounds(0, 0, canvas.width, canvas.height)
239
- drawable.draw(canvas)
240
- return bitmap
241
- }
242
216
  }
@@ -7,12 +7,16 @@ exports.collectData = collectData;
7
7
  exports.registerOneSignalForComnyx = registerOneSignalForComnyx;
8
8
  var _Accumulator = require("./Accumulator.js");
9
9
  function collectData(key, value) {
10
- _Accumulator.accumulator.add({
11
- customParameters: [{
12
- name: key,
13
- value
14
- }]
15
- });
10
+ if (typeof key === 'string') {
11
+ _Accumulator.accumulator.add({
12
+ customParameters: [{
13
+ name: key,
14
+ value
15
+ }]
16
+ });
17
+ } else {
18
+ _Accumulator.accumulator.add(key);
19
+ }
16
20
  }
17
21
 
18
22
  //* @deprecated
@@ -1 +1 @@
1
- {"version":3,"names":["_Accumulator","require","collectData","key","value","accumulator","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,SAASC,WAAWA,CAAIC,GAAW,EAAEC,KAAQ,EAAE;EACpDC,wBAAW,CAACC,GAAG,CAAC;IACdC,gBAAgB,EAAE,CAChB;MACEC,IAAI,EAAEL,GAAG;MACTC;IACF,CAAC;EAEL,CAAC,CAAC;AACJ;;AAEA;AACO,SAASK,0BAA0BA,CAACC,WAAmB,EAAE;EAC9DL,wBAAW,CAACC,GAAG,CAAC;IACdK,qBAAqB,EAAE;MACrBC,SAAS,EAAE;QACTF;MACF;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_Accumulator","require","collectData","key","value","accumulator","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,SAASC,WAAWA,CAAIC,GAAiC,EAAEC,KAAS,EAAE;EAC3E,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3BE,wBAAW,CAACC,GAAG,CAAC;MACdC,gBAAgB,EAAE,CAChB;QACEC,IAAI,EAAEL,GAAG;QACTC;MACF,CAAC;IAEL,CAAC,CAAC;EACJ,CAAC,MAAM;IACLC,wBAAW,CAACC,GAAG,CAACH,GAAG,CAAC;EACtB;AACF;;AAEA;AACO,SAASM,0BAA0BA,CAACC,WAAmB,EAAE;EAC9DL,wBAAW,CAACC,GAAG,CAAC;IACdK,qBAAqB,EAAE;MACrBC,SAAS,EAAE;QACTF;MACF;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.VERSION = void 0;
7
7
  // This file is auto-generated. Do not edit manually.
8
- const VERSION = exports.VERSION = '0.13.5';
8
+ const VERSION = exports.VERSION = '0.13.11';
9
9
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,SAAS","ignoreList":[]}
@@ -2,12 +2,16 @@
2
2
 
3
3
  import { accumulator } from "./Accumulator.js";
4
4
  export function collectData(key, value) {
5
- accumulator.add({
6
- customParameters: [{
7
- name: key,
8
- value
9
- }]
10
- });
5
+ if (typeof key === 'string') {
6
+ accumulator.add({
7
+ customParameters: [{
8
+ name: key,
9
+ value
10
+ }]
11
+ });
12
+ } else {
13
+ accumulator.add(key);
14
+ }
11
15
  }
12
16
 
13
17
  //* @deprecated
@@ -1 +1 @@
1
- {"version":3,"names":["accumulator","collectData","key","value","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAE3C,OAAO,SAASC,WAAWA,CAAIC,GAAW,EAAEC,KAAQ,EAAE;EACpDH,WAAW,CAACI,GAAG,CAAC;IACdC,gBAAgB,EAAE,CAChB;MACEC,IAAI,EAAEJ,GAAG;MACTC;IACF,CAAC;EAEL,CAAC,CAAC;AACJ;;AAEA;AACA,OAAO,SAASI,0BAA0BA,CAACC,WAAmB,EAAE;EAC9DR,WAAW,CAACI,GAAG,CAAC;IACdK,qBAAqB,EAAE;MACrBC,SAAS,EAAE;QACTF;MACF;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["accumulator","collectData","key","value","add","customParameters","name","registerOneSignalForComnyx","external_id","integrationParameters","onesignal"],"sourceRoot":"../../../src","sources":["register/collectData.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kBAAe;AAE3C,OAAO,SAASC,WAAWA,CAAIC,GAAiC,EAAEC,KAAS,EAAE;EAC3E,IAAI,OAAOD,GAAG,KAAK,QAAQ,EAAE;IAC3BF,WAAW,CAACI,GAAG,CAAC;MACdC,gBAAgB,EAAE,CAChB;QACEC,IAAI,EAAEJ,GAAG;QACTC;MACF,CAAC;IAEL,CAAC,CAAC;EACJ,CAAC,MAAM;IACLH,WAAW,CAACI,GAAG,CAACF,GAAG,CAAC;EACtB;AACF;;AAEA;AACA,OAAO,SAASK,0BAA0BA,CAACC,WAAmB,EAAE;EAC9DR,WAAW,CAACI,GAAG,CAAC;IACdK,qBAAqB,EAAE;MACrBC,SAAS,EAAE;QACTF;MACF;IACF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  // This file is auto-generated. Do not edit manually.
4
- export const VERSION = '0.13.5';
4
+ export const VERSION = '0.13.11';
5
5
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,SAAS","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- export declare function collectData<T>(key: string, value: T): void;
1
+ export declare function collectData<T>(key: string | Record<string, any>, value?: T): void;
2
2
  export declare function registerOneSignalForComnyx(external_id: string): void;
3
3
  //# sourceMappingURL=collectData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collectData.d.ts","sourceRoot":"","sources":["../../../../src/register/collectData.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QASnD;AAGD,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,QAQ7D"}
1
+ {"version":3,"file":"collectData.d.ts","sourceRoot":"","sources":["../../../../src/register/collectData.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,QAa1E;AAGD,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,QAQ7D"}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.13.5";
1
+ export declare const VERSION = "0.13.11";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-native-comnyx",
3
- "version": "0.13.8",
3
+ "version": "0.13.11",
4
4
  "description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -21,13 +21,25 @@
21
21
  "files": [
22
22
  "src",
23
23
  "lib",
24
- "android/src",
25
- "android/build.gradle",
26
- "android/gradle.properties",
24
+ "android",
27
25
  "ios",
28
26
  "cpp",
29
27
  "*.podspec",
30
- "react-native.config.js"
28
+ "react-native.config.js",
29
+ "!node_modules",
30
+ "!example",
31
+ "!example820",
32
+ "!server-scripts",
33
+ "!ios/build",
34
+ "!android/build",
35
+ "!android/gradle",
36
+ "!android/gradlew",
37
+ "!android/gradlew.bat",
38
+ "!android/local.properties",
39
+ "!**/__tests__",
40
+ "!**/__fixtures__",
41
+ "!**/__mocks__",
42
+ "!**/.*"
31
43
  ],
32
44
  "scripts": {
33
45
  "test": "jest --config jest.config.ts",
@@ -73,18 +85,18 @@
73
85
  "eslint-plugin-prettier": "^5.0.1",
74
86
  "jest": "^29.7.0",
75
87
  "prettier": "^3.0.3",
76
- "react-hook-form": "^7.66.0",
77
- "react-native": "^0.82.1",
78
88
  "react-native-builder-bob": "^0.33.1",
79
- "react-native-mmkv": "^4.0.0",
80
- "react-native-nitro-modules": "^0.31.4",
81
- "react-native-safe-area-context": "^5.5.2",
82
89
  "release-it": "^17.10.0",
83
90
  "ts-jest": "^29.4.5",
84
91
  "ts-node": "^10.9.2",
85
92
  "typescript": "5.1.6",
86
93
  "use-sync-external-store": "^1.5.0",
87
- "zustand": "^5.0.3"
94
+ "zustand": "^5.0.3",
95
+ "react-hook-form": "^7.66.0",
96
+ "react-native-mmkv": "^4.0.0",
97
+ "react-native-nitro-modules": "^0.31.4",
98
+ "react-native-safe-area-context": "^5.5.2",
99
+ "react-native": "^0.82.1"
88
100
  },
89
101
  "resolutions": {
90
102
  "@types/react": "^18.2.44",
@@ -92,11 +104,11 @@
92
104
  },
93
105
  "peerDependencies": {
94
106
  "react": ">=19.0.0",
95
- "react-hook-form": ">=7.66.0",
96
107
  "react-native": ">=0.81.0",
97
108
  "react-native-mmkv": ">=4.0.0",
98
109
  "react-native-nitro-modules": ">=0.31.4",
99
- "react-native-safe-area-context": ">=5.5.2"
110
+ "react-native-safe-area-context": ">=5.5.2",
111
+ "react-hook-form": ">=7.66.0"
100
112
  },
101
113
  "jest": {
102
114
  "preset": "react-native",
@@ -1,14 +1,18 @@
1
1
  import { accumulator } from './Accumulator';
2
2
 
3
- export function collectData<T>(key: string, value: T) {
4
- accumulator.add({
5
- customParameters: [
6
- {
7
- name: key,
8
- value,
9
- },
10
- ],
11
- });
3
+ export function collectData<T>(key: string | Record<string, any>, value?: T) {
4
+ if (typeof key === 'string') {
5
+ accumulator.add({
6
+ customParameters: [
7
+ {
8
+ name: key,
9
+ value,
10
+ },
11
+ ],
12
+ });
13
+ } else {
14
+ accumulator.add(key);
15
+ }
12
16
  }
13
17
 
14
18
  //* @deprecated
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const VERSION = '0.13.5';
2
+ export const VERSION = '0.13.11';
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=acumulator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acumulator.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/acumulator.test.ts"],"names":[],"mappings":""}
@@ -1,216 +0,0 @@
1
- // Mock timer functions
2
- import { Accumulator } from '../register/Accumulator';
3
-
4
- jest.useFakeTimers();
5
-
6
- describe('Accumulator', () => {
7
- let accumulator: Accumulator;
8
-
9
- beforeEach(() => {
10
- // Create a new accumulator instance before each test
11
- accumulator = new Accumulator();
12
- jest.clearAllMocks();
13
- jest.clearAllTimers();
14
- });
15
-
16
- describe('register', () => {
17
- it('should register a listener and initialize data', () => {
18
- const mockListener = jest.fn();
19
- accumulator.register(mockListener);
20
-
21
- expect(accumulator.get()).toEqual({
22
- customParameters: [],
23
- integrationParameters: {},
24
- });
25
- });
26
- });
27
-
28
- describe('add', () => {
29
- it('should throw error if register was not called', () => {
30
- expect(() => {
31
- accumulator.add({ customParameters: [] });
32
- }).toThrow('Register data is not set');
33
- });
34
-
35
- it('should merge custom parameters correctly', () => {
36
- const mockListener = jest.fn();
37
- accumulator.register(mockListener);
38
-
39
- accumulator.add({
40
- customParameters: [{ name: 'param1', value: 'value1' }],
41
- });
42
-
43
- accumulator.add({
44
- customParameters: [{ name: 'param2', value: 'value2' }],
45
- });
46
-
47
- expect(accumulator.get()?.customParameters).toEqual([
48
- { name: 'param1', value: 'value1' },
49
- { name: 'param2', value: 'value2' },
50
- ]);
51
- });
52
-
53
- it('should override existing custom parameters with same name', () => {
54
- const mockListener = jest.fn();
55
- accumulator.register(mockListener);
56
-
57
- accumulator.add({
58
- customParameters: [{ name: 'param1', value: 'value1' }],
59
- });
60
-
61
- accumulator.add({
62
- customParameters: [{ name: 'param1', value: 'newValue' }],
63
- });
64
-
65
- expect(accumulator.get()?.customParameters).toEqual([
66
- { name: 'param1', value: 'newValue' },
67
- ]);
68
- });
69
-
70
- it('should merge integration parameters', () => {
71
- const mockListener = jest.fn();
72
- accumulator.register(mockListener);
73
-
74
- accumulator.add({
75
- integrationParameters: {
76
- onesignal: {
77
- external_id: 'id1',
78
- },
79
- },
80
- });
81
-
82
- accumulator.add({
83
- integrationParameters: {
84
- onesignal: {
85
- external_id: 'id2',
86
- },
87
- },
88
- });
89
-
90
- expect(accumulator.get()?.integrationParameters).toEqual({
91
- onesignal: {
92
- external_id: 'id2',
93
- },
94
- });
95
- });
96
- });
97
-
98
- describe('flush', () => {
99
- it('should call listener with accumulated data and reset custom parameters', async () => {
100
- const mockListener = jest.fn().mockResolvedValue(undefined);
101
- accumulator.register(mockListener);
102
-
103
- accumulator.add({
104
- customParameters: [{ name: 'param1', value: 'value1' }],
105
- });
106
-
107
- await accumulator.flush();
108
-
109
- expect(mockListener).toHaveBeenCalledWith({
110
- customParameters: [{ name: 'param1', value: 'value1' }],
111
- integrationParameters: {},
112
- });
113
-
114
- expect(accumulator.get()?.customParameters).toEqual([]);
115
- });
116
-
117
- it('should throw error if register was not called', async () => {
118
- await expect(accumulator.flush()).rejects.toThrow(
119
- 'Register data is not set'
120
- );
121
- });
122
- });
123
-
124
- describe('debounce', () => {
125
- it('should call listener after debounce time', () => {
126
- const mockListener = jest.fn();
127
- accumulator.register(mockListener);
128
-
129
- accumulator.add({
130
- customParameters: [{ name: 'param1', value: 'value1' }],
131
- });
132
-
133
- expect(mockListener).not.toHaveBeenCalled();
134
-
135
- // Fast forward debounce time (3000ms)
136
- jest.advanceTimersByTime(3000);
137
-
138
- expect(mockListener).toHaveBeenCalledWith({
139
- customParameters: [{ name: 'param1', value: 'value1' }],
140
- integrationParameters: {},
141
- });
142
- });
143
-
144
- it('should reset timer on multiple calls', () => {
145
- const mockListener = jest.fn();
146
- accumulator.register(mockListener);
147
-
148
- accumulator.add({
149
- customParameters: [{ name: 'param1', value: 'value1' }],
150
- });
151
-
152
- // Advance halfway through debounce time
153
- jest.advanceTimersByTime(1500);
154
-
155
- accumulator.add({
156
- customParameters: [{ name: 'param2', value: 'value2' }],
157
- });
158
-
159
- // Advance halfway through debounce time again
160
- jest.advanceTimersByTime(1500);
161
-
162
- // Listener should not have been called yet
163
- expect(mockListener).not.toHaveBeenCalled();
164
-
165
- // Complete the debounce time
166
- jest.advanceTimersByTime(1500);
167
-
168
- expect(mockListener).toHaveBeenCalledWith({
169
- customParameters: [
170
- { name: 'param1', value: 'value1' },
171
- { name: 'param2', value: 'value2' },
172
- ],
173
- integrationParameters: {},
174
- });
175
- });
176
- });
177
-
178
- describe('clear and empty', () => {
179
- it('should clear all data', () => {
180
- const mockListener = jest.fn();
181
- accumulator.register(mockListener);
182
-
183
- accumulator.add({
184
- customParameters: [{ name: 'param1', value: 'value1' }],
185
- });
186
-
187
- accumulator.clear();
188
- expect(accumulator.get()).toBeNull();
189
- });
190
-
191
- it('should empty data to an empty object', () => {
192
- const mockListener = jest.fn();
193
- accumulator.register(mockListener);
194
-
195
- accumulator.add({
196
- customParameters: [{ name: 'param1', value: 'value1' }],
197
- });
198
-
199
- accumulator.empty();
200
- expect(accumulator.get()).toEqual({});
201
- });
202
- });
203
-
204
- describe('isListenerCalledOnce', () => {
205
- it('should return true after listener is called', async () => {
206
- const mockListener = jest.fn().mockResolvedValue(undefined);
207
- accumulator.register(mockListener);
208
-
209
- expect(accumulator.isListenerCalledOnce()).toBeFalsy();
210
-
211
- await accumulator.flush();
212
-
213
- expect(accumulator.isListenerCalledOnce()).toBeTruthy();
214
- });
215
- });
216
- });