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,333 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import CarrotSDK
|
|
3
|
+
|
|
4
|
+
/// Native entry point for initialising the Carrot quest SDK at app launch.
|
|
5
|
+
///
|
|
6
|
+
/// Call this from `AppDelegate` when you want the SDK ready before the JS
|
|
7
|
+
/// bundle finishes loading. Apps that do not care about launch timing can skip
|
|
8
|
+
/// it and call `setup()` from JS instead.
|
|
9
|
+
///
|
|
10
|
+
/// ```swift
|
|
11
|
+
/// // AppDelegate.swift
|
|
12
|
+
/// CarrotQuestSetup.configure(apiKey: "your-key", locale: "ru")
|
|
13
|
+
/// ```
|
|
14
|
+
///
|
|
15
|
+
/// Initialisation is single-flight: concurrent calls — including a native
|
|
16
|
+
/// launch-time init racing a JS `setup()` — join the in-flight attempt instead
|
|
17
|
+
/// of starting a second one, and every caller is notified when it settles.
|
|
18
|
+
@objc public final class CarrotQuestSetup: NSObject {
|
|
19
|
+
|
|
20
|
+
/// The options that decide *which account and server* the SDK talks to.
|
|
21
|
+
///
|
|
22
|
+
/// Everything else (theme) is applied after initialisation and can be
|
|
23
|
+
/// changed freely, so it is not part of the conflict check.
|
|
24
|
+
private struct Identity: Equatable {
|
|
25
|
+
let apiKey: String
|
|
26
|
+
let locale: String?
|
|
27
|
+
let useEuServer: Bool
|
|
28
|
+
let appGroup: String?
|
|
29
|
+
let isServiceMode: Bool
|
|
30
|
+
|
|
31
|
+
/// Human-readable list of what differs, for the conflict error.
|
|
32
|
+
func differences(from other: Identity) -> [String] {
|
|
33
|
+
var result: [String] = []
|
|
34
|
+
if apiKey != other.apiKey { result.append("API key") }
|
|
35
|
+
if locale != other.locale { result.append("locale") }
|
|
36
|
+
if useEuServer != other.useEuServer { result.append("EU server flag") }
|
|
37
|
+
if appGroup != other.appGroup { result.append("App Group") }
|
|
38
|
+
if isServiceMode != other.isServiceMode { result.append("service mode") }
|
|
39
|
+
return result
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private enum State {
|
|
44
|
+
case idle
|
|
45
|
+
case initializing(Identity)
|
|
46
|
+
case configured(Identity)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
private static let lock = NSLock()
|
|
50
|
+
private static var state: State = .idle
|
|
51
|
+
/// Callers waiting on the in-flight attempt. Drained exactly once when it
|
|
52
|
+
/// settles.
|
|
53
|
+
private static var pending: [(Error?) -> Void] = []
|
|
54
|
+
/// SDK operations called after setup started but before it finished.
|
|
55
|
+
private static var readinessWaiters: [(Error?) -> Void] = []
|
|
56
|
+
private static var configuredAppGroup: String?
|
|
57
|
+
/// Theme supplied by a caller that joined an in-flight init; applied on
|
|
58
|
+
/// success so a later `setup` does not lose it.
|
|
59
|
+
private static var pendingTheme: NSNumber?
|
|
60
|
+
|
|
61
|
+
/// App Group recorded at setup. The notification helpers need it to reach
|
|
62
|
+
/// the shared store written by the service extension.
|
|
63
|
+
public static var appGroup: String? {
|
|
64
|
+
lock.lock()
|
|
65
|
+
defer { lock.unlock() }
|
|
66
|
+
return configuredAppGroup
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// The API key the SDK was initialised with, once initialisation succeeded.
|
|
70
|
+
public static var apiKey: String? {
|
|
71
|
+
lock.lock()
|
|
72
|
+
defer { lock.unlock() }
|
|
73
|
+
|
|
74
|
+
if case .configured(let identity) = state {
|
|
75
|
+
return identity.apiKey
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return nil
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// Whether the SDK finished initialising successfully.
|
|
82
|
+
@objc public static var isConfigured: Bool {
|
|
83
|
+
return apiKey != nil
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Run an SDK operation once the one application-level setup call settles.
|
|
87
|
+
///
|
|
88
|
+
/// Operations arriving during setup wait natively. A call made before setup
|
|
89
|
+
/// starts, or a setup failure, receives an error instead of racing the SDK.
|
|
90
|
+
static func whenConfigured(_ completion: @escaping (Error?) -> Void) {
|
|
91
|
+
lock.lock()
|
|
92
|
+
|
|
93
|
+
switch state {
|
|
94
|
+
case .configured:
|
|
95
|
+
lock.unlock()
|
|
96
|
+
completion(nil)
|
|
97
|
+
case .initializing:
|
|
98
|
+
readinessWaiters.append(completion)
|
|
99
|
+
lock.unlock()
|
|
100
|
+
case .idle:
|
|
101
|
+
lock.unlock()
|
|
102
|
+
completion(CarrotQuestError.notConfigured)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// Queue a fire-and-forget operation without leaking readiness into JS.
|
|
107
|
+
static func runWhenConfigured(
|
|
108
|
+
_ name: String,
|
|
109
|
+
operation: @escaping () -> Void
|
|
110
|
+
) {
|
|
111
|
+
whenConfigured { error in
|
|
112
|
+
if let error = error {
|
|
113
|
+
NSLog("[CarrotQuest] %@ skipped because setup did not complete: %@", name, error.localizedDescription)
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
operation()
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// Initialise the SDK.
|
|
122
|
+
///
|
|
123
|
+
/// Runs off the main thread — `Carrot.setup` performs I/O and would
|
|
124
|
+
/// otherwise block the launch runloop. `completion` is called on an
|
|
125
|
+
/// unspecified queue, once, when initialisation settles.
|
|
126
|
+
///
|
|
127
|
+
/// - Parameters:
|
|
128
|
+
/// - apiKey: Your Carrot quest API key.
|
|
129
|
+
/// - locale: Optional locale override, e.g. `"ru"`. The SDK resolves its
|
|
130
|
+
/// language from the system locale and exposes no `setLanguage` API, so
|
|
131
|
+
/// this writes `AppleLanguages`/`AppleLocale` before `setup` runs.
|
|
132
|
+
/// - theme: Optional chat theme, applied on success.
|
|
133
|
+
/// - useEuServer: Route traffic to Carrot's EU servers.
|
|
134
|
+
/// - appGroup: App Group shared with your Notification Service Extension.
|
|
135
|
+
/// - isServiceMode: Run without UI, for use inside an extension process.
|
|
136
|
+
@objc public static func configure(
|
|
137
|
+
apiKey: String,
|
|
138
|
+
locale: String? = nil,
|
|
139
|
+
theme: NSNumber? = nil,
|
|
140
|
+
useEuServer: Bool = false,
|
|
141
|
+
appGroup: String? = nil,
|
|
142
|
+
isServiceMode: Bool = false,
|
|
143
|
+
completion: ((Error?) -> Void)? = nil
|
|
144
|
+
) {
|
|
145
|
+
let identity = Identity(
|
|
146
|
+
apiKey: apiKey,
|
|
147
|
+
locale: locale,
|
|
148
|
+
useEuServer: useEuServer,
|
|
149
|
+
appGroup: appGroup,
|
|
150
|
+
isServiceMode: isServiceMode
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
lock.lock()
|
|
154
|
+
|
|
155
|
+
switch state {
|
|
156
|
+
case .configured(let existing):
|
|
157
|
+
lock.unlock()
|
|
158
|
+
|
|
159
|
+
let conflict = self.conflict(between: existing, and: identity)
|
|
160
|
+
|
|
161
|
+
if conflict == nil, let theme = theme {
|
|
162
|
+
// Identity matches, so this is a re-configure rather than a second
|
|
163
|
+
// init. Apply the mutable options instead of dropping them — a native
|
|
164
|
+
// launch-time setup often has no theme, and the later JS call is where
|
|
165
|
+
// it arrives.
|
|
166
|
+
applyTheme(theme)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
completion?(conflict)
|
|
170
|
+
return
|
|
171
|
+
|
|
172
|
+
case .initializing(let existing):
|
|
173
|
+
if let conflict = conflict(between: existing, and: identity) {
|
|
174
|
+
lock.unlock()
|
|
175
|
+
completion?(conflict)
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Join the in-flight attempt rather than initialising a second time, but
|
|
180
|
+
// carry this caller's theme into it so it is not lost.
|
|
181
|
+
if let theme = theme {
|
|
182
|
+
pendingTheme = theme
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if let completion = completion {
|
|
186
|
+
pending.append(completion)
|
|
187
|
+
}
|
|
188
|
+
lock.unlock()
|
|
189
|
+
return
|
|
190
|
+
|
|
191
|
+
case .idle:
|
|
192
|
+
state = .initializing(identity)
|
|
193
|
+
configuredAppGroup = appGroup
|
|
194
|
+
pendingTheme = theme
|
|
195
|
+
if let completion = completion {
|
|
196
|
+
pending.append(completion)
|
|
197
|
+
}
|
|
198
|
+
lock.unlock()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if let locale = locale {
|
|
202
|
+
applyLocale(locale)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
DispatchQueue.global(qos: .userInitiated).async {
|
|
206
|
+
Carrot.shared.setup(
|
|
207
|
+
withApiKey: apiKey,
|
|
208
|
+
useEuServer: useEuServer,
|
|
209
|
+
withAppGroup: appGroup,
|
|
210
|
+
isServiceMode: isServiceMode,
|
|
211
|
+
successHandler: {
|
|
212
|
+
settleSuccess(identity: identity)
|
|
213
|
+
},
|
|
214
|
+
errorHandler: { message in
|
|
215
|
+
NSLog("[CarrotQuest] setup failed: %@", message)
|
|
216
|
+
settleFailure(CarrotQuestError.setupFailed(message))
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/// Apply the latest joined theme and publish `.configured` atomically.
|
|
223
|
+
///
|
|
224
|
+
/// A matching configure call either contributes its theme before this lock is
|
|
225
|
+
/// acquired, or observes `.configured` afterward and queues its own theme.
|
|
226
|
+
/// No caller can join between the final theme snapshot and the state change.
|
|
227
|
+
private static func settleSuccess(identity: Identity) {
|
|
228
|
+
lock.lock()
|
|
229
|
+
let theme = pendingTheme
|
|
230
|
+
pendingTheme = nil
|
|
231
|
+
|
|
232
|
+
if let theme = theme {
|
|
233
|
+
// applyTheme queues on the serial main queue. Calling it while holding the
|
|
234
|
+
// state lock preserves ordering with a later configured call.
|
|
235
|
+
applyTheme(theme)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
state = .configured(identity)
|
|
239
|
+
let waiting = pending
|
|
240
|
+
pending = []
|
|
241
|
+
let ready = readinessWaiters
|
|
242
|
+
readinessWaiters = []
|
|
243
|
+
lock.unlock()
|
|
244
|
+
|
|
245
|
+
for completion in waiting {
|
|
246
|
+
completion(nil)
|
|
247
|
+
}
|
|
248
|
+
for completion in ready {
|
|
249
|
+
completion(nil)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/// Return to `.idle` after a failed attempt so a later call can retry.
|
|
254
|
+
private static func settleFailure(_ error: Error) {
|
|
255
|
+
lock.lock()
|
|
256
|
+
state = .idle
|
|
257
|
+
pendingTheme = nil
|
|
258
|
+
let waiting = pending
|
|
259
|
+
pending = []
|
|
260
|
+
let ready = readinessWaiters
|
|
261
|
+
readinessWaiters = []
|
|
262
|
+
lock.unlock()
|
|
263
|
+
|
|
264
|
+
for completion in waiting {
|
|
265
|
+
completion(error)
|
|
266
|
+
}
|
|
267
|
+
for completion in ready {
|
|
268
|
+
completion(error)
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/// Apply a theme on an already-initialised SDK. Safe to call at any point
|
|
273
|
+
/// after `setup` succeeds.
|
|
274
|
+
private static func applyTheme(_ theme: NSNumber) {
|
|
275
|
+
guard let value = Carrot.Theme(rawValue: theme.intValue) else { return }
|
|
276
|
+
|
|
277
|
+
DispatchQueue.main.async {
|
|
278
|
+
Carrot.shared.setTheme(value)
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/// Refuse to re-point a live SDK at a different account or server.
|
|
283
|
+
///
|
|
284
|
+
/// Silently keeping the first configuration would let a second `setup` call
|
|
285
|
+
/// resolve successfully while data continued flowing to the wrong Carrot
|
|
286
|
+
/// account.
|
|
287
|
+
private static func conflict(between existing: Identity, and requested: Identity) -> Error? {
|
|
288
|
+
let differences = existing.differences(from: requested)
|
|
289
|
+
|
|
290
|
+
guard !differences.isEmpty else { return nil }
|
|
291
|
+
|
|
292
|
+
return CarrotQuestError.configurationConflict(differences.joined(separator: ", "))
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/// Override the process locale so the SDK picks up the right language.
|
|
296
|
+
///
|
|
297
|
+
/// Must run before `Carrot.setup`. This mutates `UserDefaults` app-wide.
|
|
298
|
+
private static func applyLocale(_ locale: String) {
|
|
299
|
+
UserDefaults.standard.set([locale], forKey: "AppleLanguages")
|
|
300
|
+
UserDefaults.standard.set(locale, forKey: "AppleLocale")
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
enum CarrotQuestError: LocalizedError {
|
|
305
|
+
case setupFailed(String)
|
|
306
|
+
case notConfigured
|
|
307
|
+
case authFailed(String)
|
|
308
|
+
case logoutFailed(String)
|
|
309
|
+
case noPresentingWindow
|
|
310
|
+
case invalidPayload
|
|
311
|
+
case configurationConflict(String)
|
|
312
|
+
|
|
313
|
+
var errorDescription: String? {
|
|
314
|
+
switch self {
|
|
315
|
+
case .setupFailed(let message):
|
|
316
|
+
return "Carrot quest setup failed: \(message)"
|
|
317
|
+
case .notConfigured:
|
|
318
|
+
return
|
|
319
|
+
"Carrot quest is not configured. Await setup() first, or call CarrotQuestSetup.configure(apiKey:) from AppDelegate."
|
|
320
|
+
case .authFailed(let message):
|
|
321
|
+
return "Carrot quest auth failed: \(message)"
|
|
322
|
+
case .logoutFailed(let message):
|
|
323
|
+
return "Carrot quest logout failed: \(message)"
|
|
324
|
+
case .noPresentingWindow:
|
|
325
|
+
return "Carrot quest could not open the chat: no active window."
|
|
326
|
+
case .invalidPayload:
|
|
327
|
+
return "Carrot quest could not decode the notification payload as a JSON object."
|
|
328
|
+
case .configurationConflict(let differences):
|
|
329
|
+
return
|
|
330
|
+
"Carrot quest is already initialised with a different \(differences). The SDK cannot be re-pointed at another account or server at runtime; restart the process to change it."
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["CarrotQuest.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { noopSubscription } from "./subscriptions.js";
|
|
4
|
+
const unsupported = method => {
|
|
5
|
+
throw new Error(`react-native-carrot-quest: ${method}() is only supported on iOS and Android.`);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// MARK: - Lifecycle
|
|
9
|
+
|
|
10
|
+
export function isConfigured() {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
export function setup(_apiKey, _options) {
|
|
14
|
+
return unsupported('setup');
|
|
15
|
+
}
|
|
16
|
+
export function getSdkVersion() {
|
|
17
|
+
return unsupported('getSdkVersion');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// MARK: - Authentication
|
|
21
|
+
|
|
22
|
+
export function auth(_userId, _userAuthKey) {
|
|
23
|
+
return unsupported('auth');
|
|
24
|
+
}
|
|
25
|
+
export function hashedAuth(_userId, _hash) {
|
|
26
|
+
return unsupported('hashedAuth');
|
|
27
|
+
}
|
|
28
|
+
export function logout() {
|
|
29
|
+
return unsupported('logout');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// MARK: - Chat UI
|
|
33
|
+
|
|
34
|
+
export function openChat() {
|
|
35
|
+
return unsupported('openChat');
|
|
36
|
+
}
|
|
37
|
+
export function closeChat() {
|
|
38
|
+
return unsupported('closeChat');
|
|
39
|
+
}
|
|
40
|
+
export function isChatOpen() {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
export function onChatVisibilityChanged(_listener) {
|
|
44
|
+
return noopSubscription;
|
|
45
|
+
}
|
|
46
|
+
export function setTheme(_theme) {
|
|
47
|
+
unsupported('setTheme');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// MARK: - Unread state
|
|
51
|
+
|
|
52
|
+
export function getUnreadConversationsCount() {
|
|
53
|
+
return unsupported('getUnreadConversationsCount');
|
|
54
|
+
}
|
|
55
|
+
export function getUnreadMessagesCount() {
|
|
56
|
+
return unsupported('getUnreadMessagesCount');
|
|
57
|
+
}
|
|
58
|
+
export function onUnreadConversationsChanged(_listener) {
|
|
59
|
+
return noopSubscription;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// MARK: - User properties
|
|
63
|
+
|
|
64
|
+
export function setUserProperties(_properties) {
|
|
65
|
+
unsupported('setUserProperties');
|
|
66
|
+
}
|
|
67
|
+
export function setProperties(_properties) {
|
|
68
|
+
unsupported('setProperties');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// MARK: - Tracking
|
|
72
|
+
|
|
73
|
+
export function trackEvent(_name, _params) {
|
|
74
|
+
unsupported('trackEvent');
|
|
75
|
+
}
|
|
76
|
+
export function trackScreen(_name) {
|
|
77
|
+
unsupported('trackScreen');
|
|
78
|
+
}
|
|
79
|
+
export function trackUtm(_url) {
|
|
80
|
+
unsupported('trackUtm');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// MARK: - Push notifications
|
|
84
|
+
|
|
85
|
+
export function setPushToken(_token) {
|
|
86
|
+
unsupported('setPushToken');
|
|
87
|
+
}
|
|
88
|
+
export function deletePushToken() {
|
|
89
|
+
unsupported('deletePushToken');
|
|
90
|
+
}
|
|
91
|
+
export function pushNotificationsUnsubscribe() {
|
|
92
|
+
return unsupported('pushNotificationsUnsubscribe');
|
|
93
|
+
}
|
|
94
|
+
export function pushCampaignsUnsubscribe() {
|
|
95
|
+
return unsupported('pushCampaignsUnsubscribe');
|
|
96
|
+
}
|
|
97
|
+
export function isCarrotPush(_payload) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
export function isAutoMessage(_payload) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
export function handlePushNotification(_payload) {
|
|
104
|
+
unsupported('handlePushNotification');
|
|
105
|
+
}
|
|
106
|
+
export function handlePushClick(_payload, _openLink) {
|
|
107
|
+
unsupported('handlePushClick');
|
|
108
|
+
}
|
|
109
|
+
export function getPushLink(_payload) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
export function wasPushShownEarlier(_payload) {
|
|
113
|
+
return Promise.resolve(false);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// MARK: - Deep links
|
|
117
|
+
|
|
118
|
+
export function onUrlOpen(_source, _listener) {
|
|
119
|
+
return noopSubscription;
|
|
120
|
+
}
|
|
121
|
+
export function openBrowserLink(_url) {
|
|
122
|
+
unsupported('openBrowserLink');
|
|
123
|
+
}
|
|
124
|
+
export function openUniversalLink(_url) {
|
|
125
|
+
unsupported('openUniversalLink');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// MARK: - Diagnostics
|
|
129
|
+
|
|
130
|
+
export function getDiagnostics() {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
export function onLog(_listener) {
|
|
134
|
+
return noopSubscription;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=carrot-quest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["noopSubscription","unsupported","method","Error","isConfigured","setup","_apiKey","_options","getSdkVersion","auth","_userId","_userAuthKey","hashedAuth","_hash","logout","openChat","closeChat","isChatOpen","onChatVisibilityChanged","_listener","setTheme","_theme","getUnreadConversationsCount","getUnreadMessagesCount","onUnreadConversationsChanged","setUserProperties","_properties","setProperties","trackEvent","_name","_params","trackScreen","trackUtm","_url","setPushToken","_token","deletePushToken","pushNotificationsUnsubscribe","pushCampaignsUnsubscribe","isCarrotPush","_payload","isAutoMessage","handlePushNotification","handlePushClick","_openLink","getPushLink","undefined","wasPushShownEarlier","Promise","resolve","onUrlOpen","_source","openBrowserLink","openUniversalLink","getDiagnostics","onLog"],"sourceRoot":"../../src","sources":["carrot-quest.tsx"],"mappings":";;AAUA,SAASA,gBAAgB,QAAQ,oBAAiB;AAElD,MAAMC,WAAW,GAAIC,MAAc,IAAY;EAC7C,MAAM,IAAIC,KAAK,CACb,8BAA8BD,MAAM,0CACtC,CAAC;AACH,CAAC;;AAED;;AAEA,OAAO,SAASE,YAAYA,CAAA,EAAY;EACtC,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,KAAKA,CACnBC,OAAe,EACfC,QAAkC,EACnB;EACf,OAAON,WAAW,CAAC,OAAO,CAAC;AAC7B;AAEA,OAAO,SAASO,aAAaA,CAAA,EAAW;EACtC,OAAOP,WAAW,CAAC,eAAe,CAAC;AACrC;;AAEA;;AAEA,OAAO,SAASQ,IAAIA,CAClBC,OAAe,EACfC,YAAoB,EACS;EAC7B,OAAOV,WAAW,CAAC,MAAM,CAAC;AAC5B;AAEA,OAAO,SAASW,UAAUA,CACxBF,OAAe,EACfG,KAAa,EACgB;EAC7B,OAAOZ,WAAW,CAAC,YAAY,CAAC;AAClC;AAEA,OAAO,SAASa,MAAMA,CAAA,EAAkB;EACtC,OAAOb,WAAW,CAAC,QAAQ,CAAC;AAC9B;;AAEA;;AAEA,OAAO,SAASc,QAAQA,CAAA,EAAkB;EACxC,OAAOd,WAAW,CAAC,UAAU,CAAC;AAChC;AAEA,OAAO,SAASe,SAASA,CAAA,EAAkB;EACzC,OAAOf,WAAW,CAAC,WAAW,CAAC;AACjC;AAEA,OAAO,SAASgB,UAAUA,CAA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B;EACxD,OAAOrC,WAAW,CAAC,0BAA0B,CAAC;AAChD;AAEA,OAAO,SAASsC,YAAYA,CAC1BC,QAA0C,EACjC;EACT,OAAO,KAAK;AACd;AAEA,OAAO,SAASC,aAAaA,CAC3BD,QAA0C,EACjC;EACT,OAAO,KAAK;AACd;AAEA,OAAO,SAASE,sBAAsBA,CACpCF,QAA0C,EACpC;EACNvC,WAAW,CAAC,wBAAwB,CAAC;AACvC;AAEA,OAAO,SAAS0C,eAAeA,CAC7BH,QAA0C,EAC1CI,SAAmB,EACb;EACN3C,WAAW,CAAC,iBAAiB,CAAC;AAChC;AAEA,OAAO,SAAS4C,WAAWA,CACzBL,QAA0C,EACtB;EACpB,OAAOM,SAAS;AAClB;AAEA,OAAO,SAASC,mBAAmBA,CACjCP,QAA0C,EACxB;EAClB,OAAOQ,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC;AAC/B;;AAEA;;AAEA,OAAO,SAASC,SAASA,CACvBC,OAA6B,EAC7BhC,SAAgC,EACP;EACzB,OAAOnB,gBAAgB;AACzB;AAEA,OAAO,SAASoD,eAAeA,CAACnB,IAAY,EAAQ;EAClDhC,WAAW,CAAC,iBAAiB,CAAC;AAChC;AAEA,OAAO,SAASoD,iBAAiBA,CAACpB,IAAY,EAAQ;EACpDhC,WAAW,CAAC,mBAAmB,CAAC;AAClC;;AAEA;;AAEA,OAAO,SAASqD,cAAcA,CAAA,EAAuB;EACnD,OAAOR,SAAS;AAClB;AAEA,OAAO,SAASS,KAAKA,CACnBpC,SAA+C,EACtB;EACzB,OAAOnB,gBAAgB;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import { createChannel } from "./subscriptions.js";
|
|
5
|
+
const native = NitroModules.createHybridObject('CarrotQuest');
|
|
6
|
+
|
|
7
|
+
// MARK: - Lifecycle
|
|
8
|
+
|
|
9
|
+
export function isConfigured() {
|
|
10
|
+
return native.isConfigured;
|
|
11
|
+
}
|
|
12
|
+
export function setup(apiKey, options) {
|
|
13
|
+
return native.setup(apiKey, options);
|
|
14
|
+
}
|
|
15
|
+
export function getSdkVersion() {
|
|
16
|
+
return native.getSdkVersion();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: - Authentication
|
|
20
|
+
|
|
21
|
+
export function auth(userId, userAuthKey) {
|
|
22
|
+
return native.auth(userId, userAuthKey);
|
|
23
|
+
}
|
|
24
|
+
export function hashedAuth(userId, hash) {
|
|
25
|
+
return native.hashedAuth(userId, hash);
|
|
26
|
+
}
|
|
27
|
+
export function logout() {
|
|
28
|
+
return native.logout();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: - Chat UI
|
|
32
|
+
|
|
33
|
+
export function openChat() {
|
|
34
|
+
return native.openChat();
|
|
35
|
+
}
|
|
36
|
+
export function closeChat() {
|
|
37
|
+
return native.closeChat();
|
|
38
|
+
}
|
|
39
|
+
export function isChatOpen() {
|
|
40
|
+
return native.isChatOpen;
|
|
41
|
+
}
|
|
42
|
+
const chatVisibilityChannel = createChannel(dispatch => native.onChatVisibilityChanged(dispatch));
|
|
43
|
+
export function onChatVisibilityChanged(listener) {
|
|
44
|
+
return chatVisibilityChannel(listener);
|
|
45
|
+
}
|
|
46
|
+
export function setTheme(theme) {
|
|
47
|
+
native.setTheme(theme);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// MARK: - Unread state
|
|
51
|
+
|
|
52
|
+
export function getUnreadConversationsCount() {
|
|
53
|
+
return native.getUnreadConversationsCount();
|
|
54
|
+
}
|
|
55
|
+
export function getUnreadMessagesCount() {
|
|
56
|
+
return native.getUnreadMessagesCount();
|
|
57
|
+
}
|
|
58
|
+
const unreadConversationsChannel = createChannel(dispatch => native.onUnreadConversationsChanged(dispatch));
|
|
59
|
+
export function onUnreadConversationsChanged(listener) {
|
|
60
|
+
return unreadConversationsChannel(listener);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// MARK: - User properties
|
|
64
|
+
|
|
65
|
+
export function setUserProperties(properties) {
|
|
66
|
+
native.setUserProperties(properties);
|
|
67
|
+
}
|
|
68
|
+
export function setProperties(properties) {
|
|
69
|
+
native.setProperties(properties);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// MARK: - Tracking
|
|
73
|
+
|
|
74
|
+
export function trackEvent(name, params) {
|
|
75
|
+
native.trackEvent(name, params);
|
|
76
|
+
}
|
|
77
|
+
export function trackScreen(name) {
|
|
78
|
+
native.trackScreen(name);
|
|
79
|
+
}
|
|
80
|
+
export function trackUtm(url) {
|
|
81
|
+
native.trackUtm(url);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// MARK: - Push notifications
|
|
85
|
+
|
|
86
|
+
export function setPushToken(token) {
|
|
87
|
+
native.setPushToken(token);
|
|
88
|
+
}
|
|
89
|
+
export function deletePushToken() {
|
|
90
|
+
native.deletePushToken();
|
|
91
|
+
}
|
|
92
|
+
export function pushNotificationsUnsubscribe() {
|
|
93
|
+
return native.pushNotificationsUnsubscribe();
|
|
94
|
+
}
|
|
95
|
+
export function pushCampaignsUnsubscribe() {
|
|
96
|
+
return native.pushCampaignsUnsubscribe();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Accepts either a decoded payload object or the raw JSON string the native
|
|
101
|
+
* side expects.
|
|
102
|
+
*/
|
|
103
|
+
const encodePayload = payload => typeof payload === 'string' ? payload : JSON.stringify(payload);
|
|
104
|
+
export function isCarrotPush(payload) {
|
|
105
|
+
return native.isCarrotPush(encodePayload(payload));
|
|
106
|
+
}
|
|
107
|
+
export function isAutoMessage(payload) {
|
|
108
|
+
return native.isAutoMessage(encodePayload(payload));
|
|
109
|
+
}
|
|
110
|
+
export function handlePushNotification(payload) {
|
|
111
|
+
native.handlePushNotification(encodePayload(payload));
|
|
112
|
+
}
|
|
113
|
+
export function handlePushClick(payload, openLink = true) {
|
|
114
|
+
native.handlePushClick(encodePayload(payload), openLink);
|
|
115
|
+
}
|
|
116
|
+
export function getPushLink(payload) {
|
|
117
|
+
return native.getPushLink(encodePayload(payload));
|
|
118
|
+
}
|
|
119
|
+
export function wasPushShownEarlier(payload) {
|
|
120
|
+
return native.wasPushShownEarlier(encodePayload(payload));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// MARK: - Deep links
|
|
124
|
+
|
|
125
|
+
// The SDK registers a handler per url type, so each source gets its own
|
|
126
|
+
// channel rather than sharing one.
|
|
127
|
+
const urlChannels = new Map();
|
|
128
|
+
export function onUrlOpen(source, listener) {
|
|
129
|
+
let channel = urlChannels.get(source);
|
|
130
|
+
if (!channel) {
|
|
131
|
+
channel = createChannel(dispatch => native.onUrlOpen(source, dispatch));
|
|
132
|
+
urlChannels.set(source, channel);
|
|
133
|
+
}
|
|
134
|
+
return channel(listener);
|
|
135
|
+
}
|
|
136
|
+
export function openBrowserLink(url) {
|
|
137
|
+
native.openBrowserLink(url);
|
|
138
|
+
}
|
|
139
|
+
export function openUniversalLink(url) {
|
|
140
|
+
native.openUniversalLink(url);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// MARK: - Diagnostics
|
|
144
|
+
|
|
145
|
+
export function getDiagnostics() {
|
|
146
|
+
return native.getDiagnostics();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// The only channel with a native detach — and the only one whose volume makes
|
|
150
|
+
// it matter, since a verbose log level pushes an entry per network call.
|
|
151
|
+
const logChannel = createChannel(dispatch => native.onLog(dispatch), () => native.offLog());
|
|
152
|
+
export function onLog(listener) {
|
|
153
|
+
return logChannel(listener);
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=carrot-quest.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","createChannel","native","createHybridObject","isConfigured","setup","apiKey","options","getSdkVersion","auth","userId","userAuthKey","hashedAuth","hash","logout","openChat","closeChat","isChatOpen","chatVisibilityChannel","dispatch","onChatVisibilityChanged","listener","setTheme","theme","getUnreadConversationsCount","getUnreadMessagesCount","unreadConversationsChannel","onUnreadConversationsChanged","setUserProperties","properties","setProperties","trackEvent","name","params","trackScreen","trackUtm","url","setPushToken","token","deletePushToken","pushNotificationsUnsubscribe","pushCampaignsUnsubscribe","encodePayload","payload","JSON","stringify","isCarrotPush","isAutoMessage","handlePushNotification","handlePushClick","openLink","getPushLink","wasPushShownEarlier","urlChannels","Map","onUrlOpen","source","channel","get","set","openBrowserLink","openUniversalLink","getDiagnostics","logChannel","onLog","offLog"],"sourceRoot":"../../src","sources":["carrot-quest.native.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAYzD,SAASC,aAAa,QAAQ,oBAAiB;AAE/C,MAAMC,MAAM,GAAGF,YAAY,CAACG,kBAAkB,CAAc,aAAa,CAAC;;AAE1E;;AAEA,OAAO,SAASC,YAAYA,CAAA,EAAY;EACtC,OAAOF,MAAM,CAACE,YAAY;AAC5B;AAEA,OAAO,SAASC,KAAKA,CACnBC,MAAc,EACdC,OAAiC,EAClB;EACf,OAAOL,MAAM,CAACG,KAAK,CAACC,MAAM,EAAEC,OAAO,CAAC;AACtC;AAEA,OAAO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAON,MAAM,CAACM,aAAa,CAAC,CAAC;AAC/B;;AAEA;;AAEA,OAAO,SAASC,IAAIA,CAClBC,MAAc,EACdC,WAAmB,EACU;EAC7B,OAAOT,MAAM,CAACO,IAAI,CAACC,MAAM,EAAEC,WAAW,CAAC;AACzC;AAEA,OAAO,SAASC,UAAUA,CACxBF,MAAc,EACdG,IAAY,EACiB;EAC7B,OAAOX,MAAM,CAACU,UAAU,CAACF,MAAM,EAAEG,IAAI,CAAC;AACxC;AAEA,OAAO,SAASC,MAAMA,CAAA,EAAkB;EACtC,OAAOZ,MAAM,CAACY,MAAM,CAAC,CAAC;AACxB;;AAEA;;AAEA,OAAO,SAAS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tB,CAAC;AAED,OAAO,SAASD,KAAKA,CACnB3C,QAA8C,EACrB;EACzB,OAAO0C,UAAU,CAAC1C,QAAQ,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as CarrotQuest from './carrot-quest';
|
|
4
|
+
export default CarrotQuest;
|
|
5
|
+
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';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CarrotQuest","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"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAO,KAAKA,WAAW,MAAM,gBAAgB;AAE7C,eAAeA,WAAW;AAE1B,SACEC,IAAI,EACJC,SAAS,EACTC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,aAAa,EACbC,2BAA2B,EAC3BC,sBAAsB,EACtBC,eAAe,EACfC,sBAAsB,EACtBC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,MAAM,EACNC,uBAAuB,EACvBC,KAAK,EACLC,4BAA4B,EAC5BC,SAAS,EACTC,eAAe,EACfC,QAAQ,EACRC,iBAAiB,EACjBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACRC,iBAAiB,EACjBC,KAAK,EACLC,UAAU,EACVC,WAAW,EACXC,QAAQ,QACH,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|