react-native-carrot-quest 0.4.0 → 0.5.0

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.
package/README.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # react-native-carrot-quest
2
2
 
3
- Unofficial React Native bindings for the [Carrot quest](https://www.carrotquest.io/) mobile SDKs, built with [Nitro Modules](https://nitro.margelo.com/).
3
+ [![npm version](https://img.shields.io/npm/v/react-native-carrot-quest)](https://www.npmjs.com/package/react-native-carrot-quest)
4
+ [![npm downloads](https://img.shields.io/npm/dm/react-native-carrot-quest)](https://www.npmjs.com/package/react-native-carrot-quest)
5
+ [![CI](https://github.com/Ahmedhamed77/react-native-carrot-quest/actions/workflows/ci.yml/badge.svg)](https://github.com/Ahmedhamed77/react-native-carrot-quest/actions/workflows/ci.yml)
6
+ [![license](https://img.shields.io/npm/l/react-native-carrot-quest)](./LICENSE)
7
+ ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20Android-blue)
8
+
9
+ **Carrot quest SDK for React Native** — add the [Carrot quest](https://www.carrotquest.io/)
10
+ (carrotquest) customer messenger to your iOS and Android app: live chat with
11
+ support, push notifications, user identification and properties, event and
12
+ screen tracking, and UTM attribution. Unofficial, typed in TypeScript, and built
13
+ with [Nitro Modules](https://nitro.margelo.com/) for the React Native New
14
+ Architecture.
15
+
16
+ ```ts
17
+ import { setup, hashedAuth, openChat } from 'react-native-carrot-quest';
18
+
19
+ await setup('YOUR_API_KEY');
20
+ await hashedAuth(userId, hashFromYourBackend);
21
+ await openChat();
22
+ ```
4
23
 
5
24
  > **Not affiliated with Carrot quest.** Carrot does not officially support React
6
25
  > Native, so this package maintains its own compatibility coverage against the
@@ -415,7 +434,7 @@ Only set it if you need to pin the chat to one language.
415
434
  | Platform | Pinned |
416
435
  |---|---|
417
436
  | iOS | `CarrotquestSDK ~> 3.4` (verified against 3.4.0) |
418
- | Android | `io.carrotquest:android-sdk:3.4.2-commonRelease` |
437
+ | Android | `io.carrotquest:android-sdk:3.5.1-commonRelease` |
419
438
 
420
439
  Upgrading an existing iOS app: run `pod update CarrotquestSDK` — a Podfile.lock
421
440
  pinned to 3.1–3.3 will not move on its own, and 3.4+ is required for the log and
@@ -425,7 +444,7 @@ Carrot publishes one Android artifact per region flavour — `commonRelease` or
425
444
  `usRelease`. Override from your app's `android/build.gradle`:
426
445
 
427
446
  ```gradle
428
- ext { carrotSdkVersion = "3.4.2-usRelease" }
447
+ ext { carrotSdkVersion = "3.5.1-usRelease" }
429
448
  ```
430
449
 
431
450
  **Android 2.x is not supported.** It exposes a callback-free `setup()` that
@@ -7,11 +7,11 @@ buildscript {
7
7
  // Carrot publishes one artifact per region flavour: `commonRelease` for the
8
8
  // default servers, `usRelease` for the US ones. Override from your app's
9
9
  // android/build.gradle:
10
- // ext { carrotSdkVersion = "3.4.2-usRelease" }
10
+ // ext { carrotSdkVersion = "3.5.1-usRelease" }
11
11
  //
12
12
  // Must stay on the 3.x line — 2.x has a callback-free `setup`, a `setDebug`
13
13
  // toggle and JSON-string event params, none of which this bridge uses.
14
- carrotSdkVersion: "3.4.2-commonRelease"
14
+ carrotSdkVersion: "3.5.1-commonRelease"
15
15
  ]
16
16
 
17
17
  ext.getExtOrDefault = { prop ->
@@ -416,7 +416,9 @@ class CarrotQuest : HybridCarrotQuestSpec() {
416
416
  override fun trackUtm(url: String) {
417
417
  if (url.isEmpty()) return
418
418
 
419
- Carrot.trackUtm(url)
419
+ CarrotQuestSetup.runWhenConfigured("trackUtm") {
420
+ Carrot.trackUtm(url)
421
+ }
420
422
  }
421
423
 
422
424
  // MARK: - Push notifications
@@ -492,12 +494,8 @@ class CarrotQuest : HybridCarrotQuestSpec() {
492
494
  val result = mutableMapOf<String, String>()
493
495
 
494
496
  json.keys().forEach { key ->
495
- val value = json.get(key)
496
- result[key] = if (value is JSONObject || value is org.json.JSONArray) {
497
- value.toString()
498
- } else {
499
- value.toString()
500
- }
497
+ // Nested objects/arrays are re-encoded as JSON, as FCM delivers them.
498
+ result[key] = json.get(key).toString()
501
499
  }
502
500
 
503
501
  result
@@ -404,7 +404,11 @@ final class CarrotQuest: HybridCarrotQuestSpec {
404
404
  func trackUtm(url: String) throws {
405
405
  guard let parsed = URL(string: url) else { return }
406
406
 
407
- Carrot.shared.trackUtm(parsed)
407
+ // Queued like every other call: a campaign deep link that opens the app
408
+ // cold arrives before setup has finished.
409
+ CarrotQuestSetup.runWhenConfigured("trackUtm") {
410
+ Carrot.shared.trackUtm(parsed)
411
+ }
408
412
  }
409
413
 
410
414
  // MARK: - Push notifications
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-carrot-quest",
3
- "version": "0.4.0",
4
- "description": "Unofficial React Native bindings for the Carrot quest SDK, built with Nitro Modules.",
3
+ "version": "0.5.0",
4
+ "description": "React Native SDK for Carrot quest (carrotquest) — live chat, push notifications, user tracking and events for iOS and Android. Unofficial, built with Nitro Modules.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
@@ -47,8 +47,31 @@
47
47
  },
48
48
  "keywords": [
49
49
  "react-native",
50
+ "react-native-carrot-quest",
51
+ "carrot-quest",
52
+ "carrotquest",
53
+ "carrot quest",
54
+ "react-native-carrotquest",
55
+ "nitro",
56
+ "nitro-modules",
57
+ "react-native-nitro-modules",
58
+ "customer-support",
59
+ "live-chat",
60
+ "chat",
61
+ "in-app-chat",
62
+ "messenger",
63
+ "crm",
64
+ "push-notifications",
65
+ "user-tracking",
66
+ "analytics",
67
+ "marketing-automation",
50
68
  "ios",
51
- "android"
69
+ "android",
70
+ "swift",
71
+ "kotlin",
72
+ "typescript",
73
+ "new-architecture",
74
+ "sdk"
52
75
  ],
53
76
  "repository": {
54
77
  "type": "git",