react-native-carrot-quest 0.1.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/CarrotQuest.podspec +34 -0
- package/LICENSE +20 -0
- package/README.md +457 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +136 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuest.kt +585 -0
- package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuestPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/carrotquest/CarrotQuestSetup.kt +472 -0
- package/ios/CarrotQuest.swift +588 -0
- package/ios/CarrotQuestSetup.swift +333 -0
- package/lib/module/CarrotQuest.nitro.js +4 -0
- package/lib/module/CarrotQuest.nitro.js.map +1 -0
- package/lib/module/carrot-quest.js +136 -0
- package/lib/module/carrot-quest.js.map +1 -0
- package/lib/module/carrot-quest.native.js +155 -0
- package/lib/module/carrot-quest.native.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/subscriptions.js +76 -0
- package/lib/module/subscriptions.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/CarrotQuest.nitro.d.ts +394 -0
- package/lib/typescript/src/CarrotQuest.nitro.d.ts.map +1 -0
- package/lib/typescript/src/carrot-quest.d.ts +37 -0
- package/lib/typescript/src/carrot-quest.d.ts.map +1 -0
- package/lib/typescript/src/carrot-quest.native.d.ts +37 -0
- package/lib/typescript/src/carrot-quest.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/subscriptions.d.ts +32 -0
- package/lib/typescript/src/subscriptions.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JCarrotQuestEventValue.cpp +30 -0
- package/nitrogen/generated/android/c++/JCarrotQuestEventValue.hpp +83 -0
- package/nitrogen/generated/android/c++/JCarrotQuestLogCategory.hpp +76 -0
- package/nitrogen/generated/android/c++/JCarrotQuestLogEntry.hpp +100 -0
- package/nitrogen/generated/android/c++/JCarrotQuestLogLevel.hpp +70 -0
- package/nitrogen/generated/android/c++/JCarrotQuestProperty.hpp +74 -0
- package/nitrogen/generated/android/c++/JCarrotQuestPropertyKind.hpp +61 -0
- package/nitrogen/generated/android/c++/JCarrotQuestPropertyOperation.hpp +73 -0
- package/nitrogen/generated/android/c++/JCarrotQuestSetupOptions.hpp +94 -0
- package/nitrogen/generated/android/c++/JCarrotQuestTheme.hpp +64 -0
- package/nitrogen/generated/android/c++/JCarrotQuestUrlSource.hpp +64 -0
- package/nitrogen/generated/android/c++/JCarrotQuestUserProperties.hpp +84 -0
- package/nitrogen/generated/android/c++/JFunc_void_CarrotQuestLogEntry.hpp +84 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridCarrotQuestSpec.cpp +388 -0
- package/nitrogen/generated/android/c++/JHybridCarrotQuestSpec.hpp +96 -0
- package/nitrogen/generated/android/carrotquest+autolinking.cmake +82 -0
- package/nitrogen/generated/android/carrotquest+autolinking.gradle +27 -0
- package/nitrogen/generated/android/carrotquestOnLoad.cpp +62 -0
- package/nitrogen/generated/android/carrotquestOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestEventValue.kt +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogCategory.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogEntry.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestLogLevel.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestProperty.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestPropertyKind.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestPropertyOperation.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestSetupOptions.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestTheme.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestUrlSource.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/CarrotQuestUserProperties.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_CarrotQuestLogEntry.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_bool.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/HybridCarrotQuestSpec.kt +209 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/carrotquestOnLoad.kt +35 -0
- package/nitrogen/generated/ios/CarrotQuest+autolinking.rb +62 -0
- package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Bridge.cpp +97 -0
- package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Bridge.hpp +637 -0
- package/nitrogen/generated/ios/CarrotQuest-Swift-Cxx-Umbrella.hpp +80 -0
- package/nitrogen/generated/ios/CarrotQuestAutolinking.mm +33 -0
- package/nitrogen/generated/ios/CarrotQuestAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridCarrotQuestSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCarrotQuestSpecSwift.hpp +344 -0
- package/nitrogen/generated/ios/swift/CarrotQuestEventValue.swift +32 -0
- package/nitrogen/generated/ios/swift/CarrotQuestLogCategory.swift +64 -0
- package/nitrogen/generated/ios/swift/CarrotQuestLogEntry.swift +86 -0
- package/nitrogen/generated/ios/swift/CarrotQuestLogLevel.swift +56 -0
- package/nitrogen/generated/ios/swift/CarrotQuestProperty.swift +56 -0
- package/nitrogen/generated/ios/swift/CarrotQuestPropertyKind.swift +44 -0
- package/nitrogen/generated/ios/swift/CarrotQuestPropertyOperation.swift +60 -0
- package/nitrogen/generated/ios/swift/CarrotQuestSetupOptions.swift +172 -0
- package/nitrogen/generated/ios/swift/CarrotQuestTheme.swift +48 -0
- package/nitrogen/generated/ios/swift/CarrotQuestUrlSource.swift +48 -0
- package/nitrogen/generated/ios/swift/CarrotQuestUserProperties.swift +110 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CarrotQuestLogEntry.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_double_.swift +53 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCarrotQuestSpec.swift +88 -0
- package/nitrogen/generated/ios/swift/HybridCarrotQuestSpec_cxx.swift +674 -0
- package/nitrogen/generated/shared/c++/CarrotQuestLogCategory.hpp +100 -0
- package/nitrogen/generated/shared/c++/CarrotQuestLogEntry.hpp +114 -0
- package/nitrogen/generated/shared/c++/CarrotQuestLogLevel.hpp +92 -0
- package/nitrogen/generated/shared/c++/CarrotQuestProperty.hpp +101 -0
- package/nitrogen/generated/shared/c++/CarrotQuestPropertyKind.hpp +80 -0
- package/nitrogen/generated/shared/c++/CarrotQuestPropertyOperation.hpp +96 -0
- package/nitrogen/generated/shared/c++/CarrotQuestSetupOptions.hpp +121 -0
- package/nitrogen/generated/shared/c++/CarrotQuestTheme.hpp +84 -0
- package/nitrogen/generated/shared/c++/CarrotQuestUrlSource.hpp +84 -0
- package/nitrogen/generated/shared/c++/CarrotQuestUserProperties.hpp +97 -0
- package/nitrogen/generated/shared/c++/HybridCarrotQuestSpec.cpp +55 -0
- package/nitrogen/generated/shared/c++/HybridCarrotQuestSpec.hpp +118 -0
- package/package.json +140 -0
- package/src/CarrotQuest.nitro.ts +493 -0
- package/src/carrot-quest.native.tsx +241 -0
- package/src/carrot-quest.tsx +207 -0
- package/src/index.tsx +57 -0
- package/src/subscriptions.ts +83 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A JS-side listener registry that multiplexes many subscribers over a single
|
|
5
|
+
* native callback.
|
|
6
|
+
*
|
|
7
|
+
* Each SDK hook (`onVisibilityUIChanged`, `setCloseChatCallback`,
|
|
8
|
+
* `setUnreadConversationsCallback`, `CustomUrlOpener.set(for:)`) is a *setter*:
|
|
9
|
+
* registering twice replaces the first callback. Handing that directly to app
|
|
10
|
+
* code means two components cannot both listen, and a component that remounts
|
|
11
|
+
* — or is hot-reloaded — leaves a stale closure installed with no way to
|
|
12
|
+
* detach it.
|
|
13
|
+
*
|
|
14
|
+
* So the native callback is installed exactly once per channel, and fan-out
|
|
15
|
+
* happens here where a subscription can actually be removed.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Returned by every listener registration. Call `remove()` to unsubscribe. */
|
|
19
|
+
|
|
20
|
+
const noopSubscription = {
|
|
21
|
+
remove: () => {}
|
|
22
|
+
};
|
|
23
|
+
export { noopSubscription };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates an `add(listener)` function for one native channel.
|
|
27
|
+
*
|
|
28
|
+
* @param install receives the fan-out dispatcher and wires it to the native
|
|
29
|
+
* callback. Called on the first subscription, and again after a teardown.
|
|
30
|
+
* @param uninstall detaches the native callback once the last listener is
|
|
31
|
+
* removed. Omit it for channels the SDK cannot detach — the dispatcher then
|
|
32
|
+
* stays installed and fans out to an empty set, which is only acceptable for
|
|
33
|
+
* low-frequency signals.
|
|
34
|
+
*/
|
|
35
|
+
export function createChannel(install, uninstall) {
|
|
36
|
+
const listeners = new Set();
|
|
37
|
+
let installed = false;
|
|
38
|
+
const dispatch = (...args) => {
|
|
39
|
+
// Copy first: a listener may unsubscribe itself (or another) while we emit.
|
|
40
|
+
for (const listener of [...listeners]) {
|
|
41
|
+
try {
|
|
42
|
+
listener(...args);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
// One misbehaving subscriber must not stop the others, and this call
|
|
45
|
+
// originates from native code where a throw has nowhere to go.
|
|
46
|
+
console.error('react-native-carrot-quest: listener threw', error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return listener => {
|
|
51
|
+
if (!installed) {
|
|
52
|
+
// Install lazily so merely importing the package does not register
|
|
53
|
+
// native callbacks.
|
|
54
|
+
installed = true;
|
|
55
|
+
install(dispatch);
|
|
56
|
+
}
|
|
57
|
+
listeners.add(listener);
|
|
58
|
+
let removed = false;
|
|
59
|
+
return {
|
|
60
|
+
remove: () => {
|
|
61
|
+
// Idempotent: removing twice must not disturb a re-added listener.
|
|
62
|
+
if (removed) return;
|
|
63
|
+
removed = true;
|
|
64
|
+
listeners.delete(listener);
|
|
65
|
+
|
|
66
|
+
// Detach once nobody is listening, so native stops pushing across the
|
|
67
|
+
// bridge. The next subscription reinstalls.
|
|
68
|
+
if (listeners.size === 0 && uninstall && installed) {
|
|
69
|
+
installed = false;
|
|
70
|
+
uninstall();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["noopSubscription","remove","createChannel","install","uninstall","listeners","Set","installed","dispatch","args","listener","error","console","add","removed","delete","size"],"sourceRoot":"../../src","sources":["subscriptions.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAKA,MAAMA,gBAAyC,GAAG;EAAEC,MAAM,EAAEA,CAAA,KAAM,CAAC;AAAE,CAAC;AAEtE,SAASD,gBAAgB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,aAAaA,CAC3BC,OAAoD,EACpDC,SAAsB,EAC0C;EAChE,MAAMC,SAAS,GAAG,IAAIC,GAAG,CAA0B,CAAC;EACpD,IAAIC,SAAS,GAAG,KAAK;EAErB,MAAMC,QAAQ,GAAGA,CAAC,GAAGC,IAAU,KAAK;IAClC;IACA,KAAK,MAAMC,QAAQ,IAAI,CAAC,GAAGL,SAAS,CAAC,EAAE;MACrC,IAAI;QACFK,QAAQ,CAAC,GAAGD,IAAI,CAAC;MACnB,CAAC,CAAC,OAAOE,KAAK,EAAE;QACd;QACA;QACAC,OAAO,CAACD,KAAK,CAAC,2CAA2C,EAAEA,KAAK,CAAC;MACnE;IACF;EACF,CAAC;EAED,OAAQD,QAAQ,IAAK;IACnB,IAAI,CAACH,SAAS,EAAE;MACd;MACA;MACAA,SAAS,GAAG,IAAI;MAChBJ,OAAO,CAACK,QAAQ,CAAC;IACnB;IAEAH,SAAS,CAACQ,GAAG,CAACH,QAAQ,CAAC;IAEvB,IAAII,OAAO,GAAG,KAAK;IAEnB,OAAO;MACLb,MAAM,EAAEA,CAAA,KAAM;QACZ;QACA,IAAIa,OAAO,EAAE;QACbA,OAAO,GAAG,IAAI;QACdT,SAAS,CAACU,MAAM,CAACL,QAAQ,CAAC;;QAE1B;QACA;QACA,IAAIL,SAAS,CAACW,IAAI,KAAK,CAAC,IAAIZ,SAAS,IAAIG,SAAS,EAAE;UAClDA,SAAS,GAAG,KAAK;UACjBH,SAAS,CAAC,CAAC;QACb;MACF;IACF,CAAC;EACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
/**
|
|
3
|
+
* Chat colour theme.
|
|
4
|
+
*
|
|
5
|
+
* `fromDevice` follows the device's light/dark setting (`Theme.fromMobile` on
|
|
6
|
+
* iOS, `ThemeSdk.FROM_DEVICE` on Android). `fromWeb` uses whatever is
|
|
7
|
+
* configured in your Carrot quest web dashboard.
|
|
8
|
+
*/
|
|
9
|
+
export type CarrotQuestTheme = 'light' | 'dark' | 'fromDevice' | 'fromWeb';
|
|
10
|
+
/**
|
|
11
|
+
* Android SDK log level, in increasing verbosity. Android only — the iOS SDK
|
|
12
|
+
* exposes no logging control.
|
|
13
|
+
*
|
|
14
|
+
* `debugging` maps to the SDK's `DEBUG` level. It is spelled out rather than
|
|
15
|
+
* abbreviated because Nitro derives a C++ enum member from each value, and
|
|
16
|
+
* `DEBUG` is a preprocessor macro in React Native's Debug configuration — the
|
|
17
|
+
* generated header would not compile in any app that includes it.
|
|
18
|
+
*/
|
|
19
|
+
export type CarrotQuestLogLevel = 'none' | 'error' | 'warn' | 'info' | 'debugging' | 'verbose';
|
|
20
|
+
/**
|
|
21
|
+
* Which subsystem produced a log entry. Mirrors Android's `SdkLogCategory`.
|
|
22
|
+
*/
|
|
23
|
+
export type CarrotQuestLogCategory = 'general' | 'network' | 'connectivity' | 'auth' | 'realtime' | 'lifecycle' | 'database' | 'push';
|
|
24
|
+
/**
|
|
25
|
+
* A single log line emitted by the native SDK. Android only.
|
|
26
|
+
*/
|
|
27
|
+
export interface CarrotQuestLogEntry {
|
|
28
|
+
/** Milliseconds since the Unix epoch. */
|
|
29
|
+
timestampMs: number;
|
|
30
|
+
level: CarrotQuestLogLevel;
|
|
31
|
+
category: CarrotQuestLogCategory;
|
|
32
|
+
tag: string;
|
|
33
|
+
message: string;
|
|
34
|
+
/** Structured context, stringified. Empty when the entry carries none. */
|
|
35
|
+
fields: Record<string, string>;
|
|
36
|
+
/** Description of an attached throwable, when the entry has one. */
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* How a property value is merged with any existing value.
|
|
41
|
+
*
|
|
42
|
+
* Mirrors `UserProperty.Operations` (iOS) / `Operation` (Android).
|
|
43
|
+
*/
|
|
44
|
+
export type CarrotQuestPropertyOperation = 'updateOrCreate' | 'setOnce' | 'add' | 'delete' | 'append' | 'union' | 'exclude';
|
|
45
|
+
/**
|
|
46
|
+
* Which of the SDK's typed property namespaces a key belongs to.
|
|
47
|
+
*
|
|
48
|
+
* - `custom` — a free-form property (default)
|
|
49
|
+
* - `system` — one of `name`, `phone`, `email`
|
|
50
|
+
* - `ecommerce` — one of the {@link CarrotQuestEcommerceProperty} keys
|
|
51
|
+
*/
|
|
52
|
+
export type CarrotQuestPropertyKind = 'custom' | 'system' | 'ecommerce';
|
|
53
|
+
/**
|
|
54
|
+
* Which links the SDK should hand to your own handler instead of opening
|
|
55
|
+
* itself. Mirrors `CustomUrlOpener.UrlType` on iOS.
|
|
56
|
+
*/
|
|
57
|
+
export type CarrotQuestUrlSource = 'push' | 'chat' | 'popup' | 'all';
|
|
58
|
+
/**
|
|
59
|
+
* A value an event parameter can carry.
|
|
60
|
+
*
|
|
61
|
+
* Android's `EventParams.Builder` accepts strings, booleans, ints, longs and
|
|
62
|
+
* doubles; iOS takes an untyped params dictionary. Values keep their JSON type
|
|
63
|
+
* on the wire rather than being stringified.
|
|
64
|
+
*/
|
|
65
|
+
export type CarrotQuestEventValue = string | number | boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Predefined e-commerce property keys, mapped to the SDK's
|
|
68
|
+
* `EcommerceUserProperty.Property` enum on both platforms.
|
|
69
|
+
*/
|
|
70
|
+
export type CarrotQuestEcommerceProperty = 'cartAmount' | 'viewedProducts' | 'cartItems' | 'lastOrderStatus' | 'lastPayment' | 'revenue' | 'profit' | 'group' | 'discount' | 'ordersCount' | 'orderedItems' | 'orderedCategories' | 'viewedCategories';
|
|
71
|
+
/**
|
|
72
|
+
* A single user property with full control over its namespace and merge
|
|
73
|
+
* operation. Use {@link CarrotQuest.setProperties} to send a batch.
|
|
74
|
+
*/
|
|
75
|
+
export interface CarrotQuestProperty {
|
|
76
|
+
/**
|
|
77
|
+
* For `kind: 'system'` one of `name` / `phone` / `email`; for
|
|
78
|
+
* `kind: 'ecommerce'` a {@link CarrotQuestEcommerceProperty}; otherwise any
|
|
79
|
+
* free-form key.
|
|
80
|
+
*/
|
|
81
|
+
key: string;
|
|
82
|
+
value: string;
|
|
83
|
+
/** Defaults to `updateOrCreate`. */
|
|
84
|
+
operation?: CarrotQuestPropertyOperation;
|
|
85
|
+
/** Defaults to `custom`. */
|
|
86
|
+
kind?: CarrotQuestPropertyKind;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The ergonomic subset of user properties.
|
|
90
|
+
*
|
|
91
|
+
* `name`, `phone` and `email` map to the SDK's predefined system properties.
|
|
92
|
+
* Everything in `custom` is sent as a free-form property. Empty strings are
|
|
93
|
+
* dropped rather than written as blank values. For merge operations or
|
|
94
|
+
* e-commerce keys use {@link CarrotQuest.setProperties} instead.
|
|
95
|
+
*/
|
|
96
|
+
export interface CarrotQuestUserProperties {
|
|
97
|
+
name?: string;
|
|
98
|
+
phone?: string;
|
|
99
|
+
email?: string;
|
|
100
|
+
custom?: Record<string, string>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Options applied when the Carrot quest SDK is initialised.
|
|
104
|
+
*/
|
|
105
|
+
export interface CarrotQuestSetupOptions {
|
|
106
|
+
/**
|
|
107
|
+
* Force a locale for the Carrot SDK UI, e.g. `'ru'`.
|
|
108
|
+
*
|
|
109
|
+
* The SDK has no public `setLanguage` API and resolves its language from the
|
|
110
|
+
* system locale, so this is applied by overriding the process locale before
|
|
111
|
+
* `setup` runs. On Android this calls `Locale.setDefault`, which is
|
|
112
|
+
* process-global and affects the whole app.
|
|
113
|
+
*
|
|
114
|
+
* Leave unset to follow the device language.
|
|
115
|
+
*/
|
|
116
|
+
locale?: string;
|
|
117
|
+
/** Chat colour theme. Defaults to the SDK's own default when unset. */
|
|
118
|
+
theme?: CarrotQuestTheme;
|
|
119
|
+
/**
|
|
120
|
+
* Route traffic to Carrot's EU servers.
|
|
121
|
+
*
|
|
122
|
+
* On iOS this maps to the documented `useEuServer` setup parameter. On
|
|
123
|
+
* Android it selects the four-argument `setup(context, key, boolean,
|
|
124
|
+
* callback)` overload — the SDK is obfuscated and that flag is *inferred*
|
|
125
|
+
* from the neighbouring `isUseEuApi()` accessor rather than documented, so
|
|
126
|
+
* verify the routing before relying on it. When this option is unset the
|
|
127
|
+
* three-argument overload is used and behaviour is unchanged.
|
|
128
|
+
*/
|
|
129
|
+
useEuServer?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* App Group identifier shared with your Notification Service Extension.
|
|
132
|
+
* Required for rich pushes and duplicate suppression. iOS only.
|
|
133
|
+
*/
|
|
134
|
+
appGroup?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Run the SDK in service mode (no UI), for use inside an extension process.
|
|
137
|
+
* iOS only.
|
|
138
|
+
*/
|
|
139
|
+
isServiceMode?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Fully-qualified activity class name the chat returns to when it closes,
|
|
142
|
+
* e.g. `'com.example.MainActivity'`. Android only.
|
|
143
|
+
*/
|
|
144
|
+
parentActivityClassName?: string;
|
|
145
|
+
/**
|
|
146
|
+
* Drawable resource *name* (not id) used for the push notification icon,
|
|
147
|
+
* e.g. `'ic_notification'`. Resolved with `Resources.getIdentifier`.
|
|
148
|
+
* Android only.
|
|
149
|
+
*/
|
|
150
|
+
notificationIconResourceName?: string;
|
|
151
|
+
/** SDK log level. Android only. */
|
|
152
|
+
logLevel?: CarrotQuestLogLevel;
|
|
153
|
+
/**
|
|
154
|
+
* Allow sensitive values (tokens, user ids) into SDK logs. Android only.
|
|
155
|
+
* Leave off in production.
|
|
156
|
+
*/
|
|
157
|
+
logIncludeSensitive?: boolean;
|
|
158
|
+
}
|
|
159
|
+
export interface CarrotQuest extends HybridObject<{
|
|
160
|
+
ios: 'swift';
|
|
161
|
+
android: 'kotlin';
|
|
162
|
+
}> {
|
|
163
|
+
/**
|
|
164
|
+
* Whether the SDK finished initialising successfully.
|
|
165
|
+
*
|
|
166
|
+
* This reflects the SDK's own state (`isInit()` on Android), not merely that
|
|
167
|
+
* {@link setup} was called.
|
|
168
|
+
*/
|
|
169
|
+
readonly isConfigured: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Initialise the SDK with your Carrot quest API key.
|
|
172
|
+
*
|
|
173
|
+
* Call this once from `index.js` or the root app component. Operations called
|
|
174
|
+
* while setup is still in flight wait in the native setup queue, so consuming
|
|
175
|
+
* apps do not need their own readiness promise or repeated setup calls.
|
|
176
|
+
*
|
|
177
|
+
* Resolves only once the SDK reports success. Concurrent matching setup calls
|
|
178
|
+
* share a single initialisation and all resolve together.
|
|
179
|
+
*
|
|
180
|
+
* Rejects if the SDK reports a failure, e.g. an invalid API key or no
|
|
181
|
+
* network.
|
|
182
|
+
*/
|
|
183
|
+
setup(apiKey: string, options?: CarrotQuestSetupOptions): Promise<void>;
|
|
184
|
+
/** The underlying native SDK version. */
|
|
185
|
+
getSdkVersion(): string;
|
|
186
|
+
/**
|
|
187
|
+
* Authenticate with the User Auth Key — the **simple, less secure** flow.
|
|
188
|
+
*
|
|
189
|
+
* `userAuthKey` is the single key from your Carrot quest settings, stored in
|
|
190
|
+
* the app itself and identical for every user. It is intended for apps with
|
|
191
|
+
* no backend. Because the key ships inside the binary, anyone who extracts it
|
|
192
|
+
* can authenticate as any user id.
|
|
193
|
+
*
|
|
194
|
+
* If you have a backend, use {@link hashedAuth} instead.
|
|
195
|
+
*
|
|
196
|
+
* Resolves with the Carrot-side user id.
|
|
197
|
+
*/
|
|
198
|
+
auth(userId: string, userAuthKey: string): Promise<string | undefined>;
|
|
199
|
+
/**
|
|
200
|
+
* Authenticate with a backend-generated hash — the **recommended secure**
|
|
201
|
+
* flow.
|
|
202
|
+
*
|
|
203
|
+
* `hash` is generated per user on your server from your Carrot secret key,
|
|
204
|
+
* which never leaves it. Prefer this over {@link auth} whenever you have a
|
|
205
|
+
* backend.
|
|
206
|
+
*
|
|
207
|
+
* Resolves with the Carrot-side user id.
|
|
208
|
+
*/
|
|
209
|
+
hashedAuth(userId: string, hash: string): Promise<string | undefined>;
|
|
210
|
+
/** Sign the current user out and clear their local session. */
|
|
211
|
+
logout(): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Present the chat UI. Rejects if the UI cannot be presented — on Android
|
|
214
|
+
* when there is no foreground activity, on iOS when there is no key window.
|
|
215
|
+
*/
|
|
216
|
+
openChat(): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Dismiss the chat UI.
|
|
219
|
+
*
|
|
220
|
+
* iOS only — the Android SDK exposes no programmatic close. Resolves without
|
|
221
|
+
* doing anything on Android.
|
|
222
|
+
*/
|
|
223
|
+
closeChat(): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Whether the chat UI is currently presented.
|
|
226
|
+
*
|
|
227
|
+
* iOS only; always `false` on Android, which exposes no equivalent.
|
|
228
|
+
*/
|
|
229
|
+
readonly isChatOpen: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Observe chat visibility.
|
|
232
|
+
*
|
|
233
|
+
* On iOS this maps to `onVisibilityUIChanged` and fires for both open and
|
|
234
|
+
* close. On Android only `setCloseChatCallback` exists, so the listener
|
|
235
|
+
* fires with `false` on close and never with `true`.
|
|
236
|
+
*/
|
|
237
|
+
onChatVisibilityChanged(listener: (visible: boolean) => void): void;
|
|
238
|
+
/** Apply a colour theme to the chat UI. */
|
|
239
|
+
setTheme(theme: CarrotQuestTheme): void;
|
|
240
|
+
/**
|
|
241
|
+
* Number of conversations with unread messages.
|
|
242
|
+
*
|
|
243
|
+
* iOS reads `getUnreadConversationsCount`; Android counts
|
|
244
|
+
* `getUnreadConversations()`.
|
|
245
|
+
*/
|
|
246
|
+
getUnreadConversationsCount(): Promise<number>;
|
|
247
|
+
/**
|
|
248
|
+
* Number of unread messages.
|
|
249
|
+
*
|
|
250
|
+
* iOS only — Android exposes conversations but not a message count.
|
|
251
|
+
* Resolves with `undefined` on Android.
|
|
252
|
+
*/
|
|
253
|
+
getUnreadMessagesCount(): Promise<number | undefined>;
|
|
254
|
+
/**
|
|
255
|
+
* Observe the unread conversation count.
|
|
256
|
+
*
|
|
257
|
+
* Android only, via `setUnreadConversationsCallback`. Never fires on iOS —
|
|
258
|
+
* poll {@link getUnreadConversationsCount} there instead.
|
|
259
|
+
*/
|
|
260
|
+
onUnreadConversationsChanged(listener: (count: number) => void): void;
|
|
261
|
+
/** Attach the common user properties. Fire-and-forget. */
|
|
262
|
+
setUserProperties(properties: CarrotQuestUserProperties): void;
|
|
263
|
+
/**
|
|
264
|
+
* Attach properties with explicit merge operations and namespaces.
|
|
265
|
+
* Fire-and-forget.
|
|
266
|
+
*/
|
|
267
|
+
setProperties(properties: CarrotQuestProperty[]): void;
|
|
268
|
+
/**
|
|
269
|
+
* Track a named event.
|
|
270
|
+
*
|
|
271
|
+
* Values keep their JSON type: Android dispatches to the matching
|
|
272
|
+
* `EventParams.Builder.put` overload and iOS passes them through the params
|
|
273
|
+
* dictionary. Non-integral numbers go through as doubles.
|
|
274
|
+
* Fire-and-forget.
|
|
275
|
+
*/
|
|
276
|
+
trackEvent(name: string, params?: Record<string, CarrotQuestEventValue>): void;
|
|
277
|
+
/** Track a screen view. Fire-and-forget. */
|
|
278
|
+
trackScreen(name: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Record UTM attribution from a campaign URL. Fire-and-forget.
|
|
281
|
+
*/
|
|
282
|
+
trackUtm(url: string): void;
|
|
283
|
+
/**
|
|
284
|
+
* Register the device push token.
|
|
285
|
+
*
|
|
286
|
+
* Pass the APNs token as a hex string on iOS, or the FCM token on Android.
|
|
287
|
+
*/
|
|
288
|
+
setPushToken(token: string): void;
|
|
289
|
+
/**
|
|
290
|
+
* Clear the registered push token.
|
|
291
|
+
*
|
|
292
|
+
* iOS only — the Android SDK exposes no token deletion. No-op on Android.
|
|
293
|
+
*/
|
|
294
|
+
deletePushToken(): void;
|
|
295
|
+
/** Unsubscribe the current user from push notifications. */
|
|
296
|
+
pushNotificationsUnsubscribe(): Promise<void>;
|
|
297
|
+
/** Unsubscribe the current user from push campaigns. */
|
|
298
|
+
pushCampaignsUnsubscribe(): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Whether a notification payload originated from Carrot quest.
|
|
301
|
+
*
|
|
302
|
+
* `payloadJson` is the JSON-encoded remote message payload — `userInfo` on
|
|
303
|
+
* iOS, the FCM data map on Android.
|
|
304
|
+
*/
|
|
305
|
+
isCarrotPush(payloadJson: string): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Whether a Carrot payload is an automated message rather than a reply.
|
|
308
|
+
*
|
|
309
|
+
* **Android is SDK-backed; iOS is best effort.** Android calls
|
|
310
|
+
* `Carrot.isAutoMessage`. The iOS SDK exposes no equivalent, so this reads a
|
|
311
|
+
* `type` discriminator out of the payload — a shape inferred from Carrot's
|
|
312
|
+
* messages, not a documented contract. Verify against your own payloads
|
|
313
|
+
* before branching on it, and treat `false` as "unknown" on iOS.
|
|
314
|
+
*/
|
|
315
|
+
isAutoMessage(payloadJson: string): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Hand a Carrot push payload to the SDK so it can present the notification.
|
|
318
|
+
*/
|
|
319
|
+
handlePushNotification(payloadJson: string): void;
|
|
320
|
+
/**
|
|
321
|
+
* Report that the user tapped a Carrot notification.
|
|
322
|
+
*
|
|
323
|
+
* iOS only — on Android tapping is routed through the notification's own
|
|
324
|
+
* pending intent. No-op on Android.
|
|
325
|
+
*
|
|
326
|
+
* @param openLink whether the SDK should follow the notification's link
|
|
327
|
+
* itself, or leave it to your {@link onUrlOpen} handler.
|
|
328
|
+
*/
|
|
329
|
+
handlePushClick(payloadJson: string, openLink: boolean): void;
|
|
330
|
+
/**
|
|
331
|
+
* Extract the deep link from a Carrot push payload.
|
|
332
|
+
*
|
|
333
|
+
* **Best effort, iOS only.** The SDK's own accessor is
|
|
334
|
+
* `getLink(from: UNNotificationResponse)`, and a `UNNotificationResponse`
|
|
335
|
+
* cannot cross into JS — so this scans the payload for the link keys Carrot
|
|
336
|
+
* is observed to use. Android SDK 3.1.0 removed its push-link accessor
|
|
337
|
+
* entirely and always returns `undefined`.
|
|
338
|
+
*
|
|
339
|
+
* For a guaranteed link, call
|
|
340
|
+
* `CarrotNotificationService.shared.getLink(from:)` from your own
|
|
341
|
+
* `UNUserNotificationCenterDelegate` in native code, or let the SDK follow
|
|
342
|
+
* the link itself via {@link handlePushClick} with `openLink: true`.
|
|
343
|
+
*/
|
|
344
|
+
getPushLink(payloadJson: string): string | undefined;
|
|
345
|
+
/**
|
|
346
|
+
* Whether this notification was already shown, using the App Group store.
|
|
347
|
+
*
|
|
348
|
+
* iOS only; always `false` on Android. Requires
|
|
349
|
+
* {@link CarrotQuestSetupOptions.appGroup}.
|
|
350
|
+
*/
|
|
351
|
+
wasPushShownEarlier(payloadJson: string): Promise<boolean>;
|
|
352
|
+
/**
|
|
353
|
+
* Intercept links the SDK would otherwise open itself.
|
|
354
|
+
*
|
|
355
|
+
* iOS only — the Android SDK routes links through
|
|
356
|
+
* {@link CarrotQuestSetupOptions.parentActivityClassName} and exposes no
|
|
357
|
+
* equivalent hook. Never fires on Android.
|
|
358
|
+
*
|
|
359
|
+
* @param source which links to intercept: `push`, `chat`, `popup` or `all`.
|
|
360
|
+
*/
|
|
361
|
+
onUrlOpen(source: CarrotQuestUrlSource, listener: (url: string) => void): void;
|
|
362
|
+
/** Ask the SDK to open a URL in the in-app browser. iOS only. */
|
|
363
|
+
openBrowserLink(url: string): void;
|
|
364
|
+
/** Ask the SDK to open a URL as a universal link. iOS only. */
|
|
365
|
+
openUniversalLink(url: string): void;
|
|
366
|
+
/**
|
|
367
|
+
* A formatted dump of the SDK's internal state and recent logs.
|
|
368
|
+
*
|
|
369
|
+
* Android only, via `getDiagnostics()`. Returns `undefined` on iOS.
|
|
370
|
+
*/
|
|
371
|
+
getDiagnostics(): string | undefined;
|
|
372
|
+
/**
|
|
373
|
+
* Receive the SDK's log entries, e.g. to forward them to a crash reporter.
|
|
374
|
+
*
|
|
375
|
+
* Android only, via `setLogSink`. Never fires on iOS, whose SDK exposes no
|
|
376
|
+
* logging hook.
|
|
377
|
+
*
|
|
378
|
+
* Entries are filtered by {@link CarrotQuestSetupOptions.logLevel}, so leave
|
|
379
|
+
* that at `info` or lower in production — `verbose` crosses the bridge for
|
|
380
|
+
* every network call. Values are redacted unless
|
|
381
|
+
* {@link CarrotQuestSetupOptions.logIncludeSensitive} is on.
|
|
382
|
+
*/
|
|
383
|
+
onLog(listener: (entry: CarrotQuestLogEntry) => void): void;
|
|
384
|
+
/**
|
|
385
|
+
* Detach the log listener installed by {@link onLog}.
|
|
386
|
+
*
|
|
387
|
+
* Called by the package's subscription registry when the last `onLog`
|
|
388
|
+
* subscriber is removed — without it the SDK would keep pushing every log
|
|
389
|
+
* line across the bridge to nobody. You should not need to call it directly;
|
|
390
|
+
* use the subscription returned by the package's `onLog` instead.
|
|
391
|
+
*/
|
|
392
|
+
offLog(): void;
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=CarrotQuest.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CarrotQuest.nitro.d.ts","sourceRoot":"","sources":["../../../src/CarrotQuest.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B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,IAAI,CAAC;IAEnC,+DAA+D;IAC/D,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAIrC;;;;OAIG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IAErC;;;;;;;;;;OAUG;IACH,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI,CAAC;IAE5D;;;;;;;OAOG;IACH,MAAM,IAAI,IAAI,CAAC;CAChB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CarrotQuestEventValue, CarrotQuestLogEntry, CarrotQuestProperty, CarrotQuestSetupOptions, CarrotQuestTheme, CarrotQuestUrlSource, CarrotQuestUserProperties } from './CarrotQuest.nitro';
|
|
2
|
+
import type { CarrotQuestSubscription } from './subscriptions';
|
|
3
|
+
export declare function isConfigured(): boolean;
|
|
4
|
+
export declare function setup(_apiKey: string, _options?: CarrotQuestSetupOptions): Promise<void>;
|
|
5
|
+
export declare function getSdkVersion(): string;
|
|
6
|
+
export declare function auth(_userId: string, _userAuthKey: string): Promise<string | undefined>;
|
|
7
|
+
export declare function hashedAuth(_userId: string, _hash: string): Promise<string | undefined>;
|
|
8
|
+
export declare function logout(): Promise<void>;
|
|
9
|
+
export declare function openChat(): Promise<void>;
|
|
10
|
+
export declare function closeChat(): Promise<void>;
|
|
11
|
+
export declare function isChatOpen(): boolean;
|
|
12
|
+
export declare function onChatVisibilityChanged(_listener: (visible: boolean) => void): CarrotQuestSubscription;
|
|
13
|
+
export declare function setTheme(_theme: CarrotQuestTheme): void;
|
|
14
|
+
export declare function getUnreadConversationsCount(): Promise<number>;
|
|
15
|
+
export declare function getUnreadMessagesCount(): Promise<number | undefined>;
|
|
16
|
+
export declare function onUnreadConversationsChanged(_listener: (count: number) => void): CarrotQuestSubscription;
|
|
17
|
+
export declare function setUserProperties(_properties: CarrotQuestUserProperties): void;
|
|
18
|
+
export declare function setProperties(_properties: CarrotQuestProperty[]): void;
|
|
19
|
+
export declare function trackEvent(_name: string, _params?: Record<string, CarrotQuestEventValue>): void;
|
|
20
|
+
export declare function trackScreen(_name: string): void;
|
|
21
|
+
export declare function trackUtm(_url: string): void;
|
|
22
|
+
export declare function setPushToken(_token: string): void;
|
|
23
|
+
export declare function deletePushToken(): void;
|
|
24
|
+
export declare function pushNotificationsUnsubscribe(): Promise<void>;
|
|
25
|
+
export declare function pushCampaignsUnsubscribe(): Promise<void>;
|
|
26
|
+
export declare function isCarrotPush(_payload: Record<string, unknown> | string): boolean;
|
|
27
|
+
export declare function isAutoMessage(_payload: Record<string, unknown> | string): boolean;
|
|
28
|
+
export declare function handlePushNotification(_payload: Record<string, unknown> | string): void;
|
|
29
|
+
export declare function handlePushClick(_payload: Record<string, unknown> | string, _openLink?: boolean): void;
|
|
30
|
+
export declare function getPushLink(_payload: Record<string, unknown> | string): string | undefined;
|
|
31
|
+
export declare function wasPushShownEarlier(_payload: Record<string, unknown> | string): Promise<boolean>;
|
|
32
|
+
export declare function onUrlOpen(_source: CarrotQuestUrlSource, _listener: (url: string) => void): CarrotQuestSubscription;
|
|
33
|
+
export declare function openBrowserLink(_url: string): void;
|
|
34
|
+
export declare function openUniversalLink(_url: string): void;
|
|
35
|
+
export declare function getDiagnostics(): string | undefined;
|
|
36
|
+
export declare function onLog(_listener: (entry: CarrotQuestLogEntry) => void): CarrotQuestSubscription;
|
|
37
|
+
//# sourceMappingURL=carrot-quest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrot-quest.d.ts","sourceRoot":"","sources":["../../../src/carrot-quest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAW/D,w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C,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEpD;AAID,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AAED,wBAAgB,KAAK,CACnB,SAAS,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC9C,uBAAuB,CAEzB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CarrotQuestEventValue, CarrotQuestLogEntry, CarrotQuestProperty, CarrotQuestSetupOptions, CarrotQuestTheme, CarrotQuestUrlSource, CarrotQuestUserProperties } from './CarrotQuest.nitro';
|
|
2
|
+
import type { CarrotQuestSubscription } from './subscriptions';
|
|
3
|
+
export declare function isConfigured(): boolean;
|
|
4
|
+
export declare function setup(apiKey: string, options?: CarrotQuestSetupOptions): Promise<void>;
|
|
5
|
+
export declare function getSdkVersion(): string;
|
|
6
|
+
export declare function auth(userId: string, userAuthKey: string): Promise<string | undefined>;
|
|
7
|
+
export declare function hashedAuth(userId: string, hash: string): Promise<string | undefined>;
|
|
8
|
+
export declare function logout(): Promise<void>;
|
|
9
|
+
export declare function openChat(): Promise<void>;
|
|
10
|
+
export declare function closeChat(): Promise<void>;
|
|
11
|
+
export declare function isChatOpen(): boolean;
|
|
12
|
+
export declare function onChatVisibilityChanged(listener: (visible: boolean) => void): CarrotQuestSubscription;
|
|
13
|
+
export declare function setTheme(theme: CarrotQuestTheme): void;
|
|
14
|
+
export declare function getUnreadConversationsCount(): Promise<number>;
|
|
15
|
+
export declare function getUnreadMessagesCount(): Promise<number | undefined>;
|
|
16
|
+
export declare function onUnreadConversationsChanged(listener: (count: number) => void): CarrotQuestSubscription;
|
|
17
|
+
export declare function setUserProperties(properties: CarrotQuestUserProperties): void;
|
|
18
|
+
export declare function setProperties(properties: CarrotQuestProperty[]): void;
|
|
19
|
+
export declare function trackEvent(name: string, params?: Record<string, CarrotQuestEventValue>): void;
|
|
20
|
+
export declare function trackScreen(name: string): void;
|
|
21
|
+
export declare function trackUtm(url: string): void;
|
|
22
|
+
export declare function setPushToken(token: string): void;
|
|
23
|
+
export declare function deletePushToken(): void;
|
|
24
|
+
export declare function pushNotificationsUnsubscribe(): Promise<void>;
|
|
25
|
+
export declare function pushCampaignsUnsubscribe(): Promise<void>;
|
|
26
|
+
export declare function isCarrotPush(payload: Record<string, unknown> | string): boolean;
|
|
27
|
+
export declare function isAutoMessage(payload: Record<string, unknown> | string): boolean;
|
|
28
|
+
export declare function handlePushNotification(payload: Record<string, unknown> | string): void;
|
|
29
|
+
export declare function handlePushClick(payload: Record<string, unknown> | string, openLink?: boolean): void;
|
|
30
|
+
export declare function getPushLink(payload: Record<string, unknown> | string): string | undefined;
|
|
31
|
+
export declare function wasPushShownEarlier(payload: Record<string, unknown> | string): Promise<boolean>;
|
|
32
|
+
export declare function onUrlOpen(source: CarrotQuestUrlSource, listener: (url: string) => void): CarrotQuestSubscription;
|
|
33
|
+
export declare function openBrowserLink(url: string): void;
|
|
34
|
+
export declare function openUniversalLink(url: string): void;
|
|
35
|
+
export declare function getDiagnostics(): string | undefined;
|
|
36
|
+
export declare function onLog(listener: (entry: CarrotQuestLogEntry) => void): CarrotQuestSubscription;
|
|
37
|
+
//# sourceMappingURL=carrot-quest.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrot-quest.native.d.ts","sourceRoot":"","sources":["../../../src/carrot-quest.native.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAO/D,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,OA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AEnD;AAID,wBAAgB,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnD;AASD,wBAAgB,KAAK,CACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAC7C,uBAAuB,CAEzB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as CarrotQuest from './carrot-quest';
|
|
2
|
+
export default CarrotQuest;
|
|
3
|
+
export { auth, closeChat, deletePushToken, getDiagnostics, getPushLink, getSdkVersion, getUnreadConversationsCount, getUnreadMessagesCount, handlePushClick, handlePushNotification, hashedAuth, isAutoMessage, isCarrotPush, isChatOpen, isConfigured, logout, onChatVisibilityChanged, onLog, onUnreadConversationsChanged, onUrlOpen, openBrowserLink, openChat, openUniversalLink, pushCampaignsUnsubscribe, pushNotificationsUnsubscribe, setProperties, setPushToken, setTheme, setUserProperties, setup, trackEvent, trackScreen, trackUtm, } from './carrot-quest';
|
|
4
|
+
export type { CarrotQuestSubscription } from './subscriptions';
|
|
5
|
+
export type { CarrotQuest, CarrotQuestEcommerceProperty, CarrotQuestEventValue, CarrotQuestLogCategory, CarrotQuestLogEntry, CarrotQuestLogLevel, CarrotQuestProperty, CarrotQuestPropertyKind, CarrotQuestPropertyOperation, CarrotQuestSetupOptions, CarrotQuestTheme, CarrotQuestUrlSource, CarrotQuestUserProperties, } from './CarrotQuest.nitro';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAE9C,eAAe,WAAW,CAAC;AAE3B,OAAO,EACL,IAAI,EACJ,SAAS,EACT,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,EACb,2BAA2B,EAC3B,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,MAAM,EACN,uBAAuB,EACvB,KAAK,EACL,4BAA4B,EAC5B,SAAS,EACT,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,WAAW,EACX,QAAQ,GACT,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,YAAY,EACV,WAAW,EACX,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A JS-side listener registry that multiplexes many subscribers over a single
|
|
3
|
+
* native callback.
|
|
4
|
+
*
|
|
5
|
+
* Each SDK hook (`onVisibilityUIChanged`, `setCloseChatCallback`,
|
|
6
|
+
* `setUnreadConversationsCallback`, `CustomUrlOpener.set(for:)`) is a *setter*:
|
|
7
|
+
* registering twice replaces the first callback. Handing that directly to app
|
|
8
|
+
* code means two components cannot both listen, and a component that remounts
|
|
9
|
+
* — or is hot-reloaded — leaves a stale closure installed with no way to
|
|
10
|
+
* detach it.
|
|
11
|
+
*
|
|
12
|
+
* So the native callback is installed exactly once per channel, and fan-out
|
|
13
|
+
* happens here where a subscription can actually be removed.
|
|
14
|
+
*/
|
|
15
|
+
/** Returned by every listener registration. Call `remove()` to unsubscribe. */
|
|
16
|
+
export interface CarrotQuestSubscription {
|
|
17
|
+
remove(): void;
|
|
18
|
+
}
|
|
19
|
+
declare const noopSubscription: CarrotQuestSubscription;
|
|
20
|
+
export { noopSubscription };
|
|
21
|
+
/**
|
|
22
|
+
* Creates an `add(listener)` function for one native channel.
|
|
23
|
+
*
|
|
24
|
+
* @param install receives the fan-out dispatcher and wires it to the native
|
|
25
|
+
* callback. Called on the first subscription, and again after a teardown.
|
|
26
|
+
* @param uninstall detaches the native callback once the last listener is
|
|
27
|
+
* removed. Omit it for channels the SDK cannot detach — the dispatcher then
|
|
28
|
+
* stays installed and fans out to an empty set, which is only acceptable for
|
|
29
|
+
* low-frequency signals.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createChannel<Args extends unknown[]>(install: (dispatch: (...args: Args) => void) => void, uninstall?: () => void): (listener: (...args: Args) => void) => CarrotQuestSubscription;
|
|
32
|
+
//# sourceMappingURL=subscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/subscriptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,QAAA,MAAM,gBAAgB,EAAE,uBAA8C,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,OAAO,EAAE,EAClD,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,KAAK,IAAI,EACpD,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,KAAK,uBAAuB,CA6ChE"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cxxNamespace": ["carrotquest"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"iosModuleName": "CarrotQuest"
|
|
5
|
+
},
|
|
6
|
+
"android": {
|
|
7
|
+
"androidNamespace": ["carrotquest"],
|
|
8
|
+
"androidCxxLibName": "carrotquest"
|
|
9
|
+
},
|
|
10
|
+
"autolinking": {
|
|
11
|
+
"CarrotQuest": {
|
|
12
|
+
"ios": {
|
|
13
|
+
"language": "swift",
|
|
14
|
+
"implementationClassName": "CarrotQuest"
|
|
15
|
+
},
|
|
16
|
+
"android": {
|
|
17
|
+
"language": "kotlin",
|
|
18
|
+
"implementationClassName": "CarrotQuest"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"ignorePaths": ["node_modules"]
|
|
23
|
+
}
|