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,121 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CarrotQuestSetupOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `CarrotQuestTheme` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::carrotquest { enum class CarrotQuestTheme; }
|
|
33
|
+
// Forward declaration of `CarrotQuestLogLevel` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::carrotquest { enum class CarrotQuestLogLevel; }
|
|
35
|
+
|
|
36
|
+
#include <string>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "CarrotQuestTheme.hpp"
|
|
39
|
+
#include "CarrotQuestLogLevel.hpp"
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro::carrotquest {
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A struct which can be represented as a JavaScript object (CarrotQuestSetupOptions).
|
|
45
|
+
*/
|
|
46
|
+
struct CarrotQuestSetupOptions final {
|
|
47
|
+
public:
|
|
48
|
+
std::optional<std::string> locale SWIFT_PRIVATE;
|
|
49
|
+
std::optional<CarrotQuestTheme> theme SWIFT_PRIVATE;
|
|
50
|
+
std::optional<bool> useEuServer SWIFT_PRIVATE;
|
|
51
|
+
std::optional<std::string> appGroup SWIFT_PRIVATE;
|
|
52
|
+
std::optional<bool> isServiceMode SWIFT_PRIVATE;
|
|
53
|
+
std::optional<std::string> parentActivityClassName SWIFT_PRIVATE;
|
|
54
|
+
std::optional<std::string> notificationIconResourceName SWIFT_PRIVATE;
|
|
55
|
+
std::optional<CarrotQuestLogLevel> logLevel SWIFT_PRIVATE;
|
|
56
|
+
std::optional<bool> logIncludeSensitive SWIFT_PRIVATE;
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
CarrotQuestSetupOptions() = default;
|
|
60
|
+
explicit CarrotQuestSetupOptions(std::optional<std::string> locale, std::optional<CarrotQuestTheme> theme, std::optional<bool> useEuServer, std::optional<std::string> appGroup, std::optional<bool> isServiceMode, std::optional<std::string> parentActivityClassName, std::optional<std::string> notificationIconResourceName, std::optional<CarrotQuestLogLevel> logLevel, std::optional<bool> logIncludeSensitive): locale(locale), theme(theme), useEuServer(useEuServer), appGroup(appGroup), isServiceMode(isServiceMode), parentActivityClassName(parentActivityClassName), notificationIconResourceName(notificationIconResourceName), logLevel(logLevel), logIncludeSensitive(logIncludeSensitive) {}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
friend bool operator==(const CarrotQuestSetupOptions& lhs, const CarrotQuestSetupOptions& rhs) = default;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::carrotquest
|
|
67
|
+
|
|
68
|
+
namespace margelo::nitro {
|
|
69
|
+
|
|
70
|
+
// C++ CarrotQuestSetupOptions <> JS CarrotQuestSetupOptions (object)
|
|
71
|
+
template <>
|
|
72
|
+
struct JSIConverter<margelo::nitro::carrotquest::CarrotQuestSetupOptions> final {
|
|
73
|
+
static inline margelo::nitro::carrotquest::CarrotQuestSetupOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
74
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
75
|
+
return margelo::nitro::carrotquest::CarrotQuestSetupOptions(
|
|
76
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale"))),
|
|
77
|
+
JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestTheme>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme"))),
|
|
78
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useEuServer"))),
|
|
79
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "appGroup"))),
|
|
80
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isServiceMode"))),
|
|
81
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parentActivityClassName"))),
|
|
82
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationIconResourceName"))),
|
|
83
|
+
JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestLogLevel>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel"))),
|
|
84
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logIncludeSensitive")))
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::carrotquest::CarrotQuestSetupOptions& arg) {
|
|
88
|
+
jsi::Object obj(runtime);
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "locale"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.locale));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "theme"), JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestTheme>>::toJSI(runtime, arg.theme));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "useEuServer"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.useEuServer));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "appGroup"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.appGroup));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "isServiceMode"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isServiceMode));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "parentActivityClassName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.parentActivityClassName));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "notificationIconResourceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.notificationIconResourceName));
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "logLevel"), JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestLogLevel>>::toJSI(runtime, arg.logLevel));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "logIncludeSensitive"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.logIncludeSensitive));
|
|
98
|
+
return obj;
|
|
99
|
+
}
|
|
100
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
101
|
+
if (!value.isObject()) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
jsi::Object obj = value.getObject(runtime);
|
|
105
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locale")))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestTheme>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme")))) return false;
|
|
110
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "useEuServer")))) return false;
|
|
111
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "appGroup")))) return false;
|
|
112
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isServiceMode")))) return false;
|
|
113
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parentActivityClassName")))) return false;
|
|
114
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "notificationIconResourceName")))) return false;
|
|
115
|
+
if (!JSIConverter<std::optional<margelo::nitro::carrotquest::CarrotQuestLogLevel>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel")))) return false;
|
|
116
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logIncludeSensitive")))) return false;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CarrotQuestTheme.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::carrotquest {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (CarrotQuestTheme).
|
|
30
|
+
*/
|
|
31
|
+
enum class CarrotQuestTheme {
|
|
32
|
+
LIGHT SWIFT_NAME(light) = 0,
|
|
33
|
+
DARK SWIFT_NAME(dark) = 1,
|
|
34
|
+
FROMDEVICE SWIFT_NAME(fromdevice) = 2,
|
|
35
|
+
FROMWEB SWIFT_NAME(fromweb) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::carrotquest
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ CarrotQuestTheme <> JS CarrotQuestTheme (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::carrotquest::CarrotQuestTheme> final {
|
|
45
|
+
static inline margelo::nitro::carrotquest::CarrotQuestTheme fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("light"): return margelo::nitro::carrotquest::CarrotQuestTheme::LIGHT;
|
|
49
|
+
case hashString("dark"): return margelo::nitro::carrotquest::CarrotQuestTheme::DARK;
|
|
50
|
+
case hashString("fromDevice"): return margelo::nitro::carrotquest::CarrotQuestTheme::FROMDEVICE;
|
|
51
|
+
case hashString("fromWeb"): return margelo::nitro::carrotquest::CarrotQuestTheme::FROMWEB;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum CarrotQuestTheme - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::carrotquest::CarrotQuestTheme arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::carrotquest::CarrotQuestTheme::LIGHT: return JSIConverter<std::string>::toJSI(runtime, "light");
|
|
59
|
+
case margelo::nitro::carrotquest::CarrotQuestTheme::DARK: return JSIConverter<std::string>::toJSI(runtime, "dark");
|
|
60
|
+
case margelo::nitro::carrotquest::CarrotQuestTheme::FROMDEVICE: return JSIConverter<std::string>::toJSI(runtime, "fromDevice");
|
|
61
|
+
case margelo::nitro::carrotquest::CarrotQuestTheme::FROMWEB: return JSIConverter<std::string>::toJSI(runtime, "fromWeb");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert CarrotQuestTheme to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("light"):
|
|
74
|
+
case hashString("dark"):
|
|
75
|
+
case hashString("fromDevice"):
|
|
76
|
+
case hashString("fromWeb"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CarrotQuestUrlSource.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::carrotquest {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (CarrotQuestUrlSource).
|
|
30
|
+
*/
|
|
31
|
+
enum class CarrotQuestUrlSource {
|
|
32
|
+
PUSH SWIFT_NAME(push) = 0,
|
|
33
|
+
CHAT SWIFT_NAME(chat) = 1,
|
|
34
|
+
POPUP SWIFT_NAME(popup) = 2,
|
|
35
|
+
ALL SWIFT_NAME(all) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::carrotquest
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ CarrotQuestUrlSource <> JS CarrotQuestUrlSource (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::carrotquest::CarrotQuestUrlSource> final {
|
|
45
|
+
static inline margelo::nitro::carrotquest::CarrotQuestUrlSource fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("push"): return margelo::nitro::carrotquest::CarrotQuestUrlSource::PUSH;
|
|
49
|
+
case hashString("chat"): return margelo::nitro::carrotquest::CarrotQuestUrlSource::CHAT;
|
|
50
|
+
case hashString("popup"): return margelo::nitro::carrotquest::CarrotQuestUrlSource::POPUP;
|
|
51
|
+
case hashString("all"): return margelo::nitro::carrotquest::CarrotQuestUrlSource::ALL;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum CarrotQuestUrlSource - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::carrotquest::CarrotQuestUrlSource arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::carrotquest::CarrotQuestUrlSource::PUSH: return JSIConverter<std::string>::toJSI(runtime, "push");
|
|
59
|
+
case margelo::nitro::carrotquest::CarrotQuestUrlSource::CHAT: return JSIConverter<std::string>::toJSI(runtime, "chat");
|
|
60
|
+
case margelo::nitro::carrotquest::CarrotQuestUrlSource::POPUP: return JSIConverter<std::string>::toJSI(runtime, "popup");
|
|
61
|
+
case margelo::nitro::carrotquest::CarrotQuestUrlSource::ALL: return JSIConverter<std::string>::toJSI(runtime, "all");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert CarrotQuestUrlSource to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("push"):
|
|
74
|
+
case hashString("chat"):
|
|
75
|
+
case hashString("popup"):
|
|
76
|
+
case hashString("all"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CarrotQuestUserProperties.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
#include <optional>
|
|
35
|
+
#include <unordered_map>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::carrotquest {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (CarrotQuestUserProperties).
|
|
41
|
+
*/
|
|
42
|
+
struct CarrotQuestUserProperties final {
|
|
43
|
+
public:
|
|
44
|
+
std::optional<std::string> name SWIFT_PRIVATE;
|
|
45
|
+
std::optional<std::string> phone SWIFT_PRIVATE;
|
|
46
|
+
std::optional<std::string> email SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::unordered_map<std::string, std::string>> custom SWIFT_PRIVATE;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
CarrotQuestUserProperties() = default;
|
|
51
|
+
explicit CarrotQuestUserProperties(std::optional<std::string> name, std::optional<std::string> phone, std::optional<std::string> email, std::optional<std::unordered_map<std::string, std::string>> custom): name(name), phone(phone), email(email), custom(custom) {}
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
friend bool operator==(const CarrotQuestUserProperties& lhs, const CarrotQuestUserProperties& rhs) = default;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::carrotquest
|
|
58
|
+
|
|
59
|
+
namespace margelo::nitro {
|
|
60
|
+
|
|
61
|
+
// C++ CarrotQuestUserProperties <> JS CarrotQuestUserProperties (object)
|
|
62
|
+
template <>
|
|
63
|
+
struct JSIConverter<margelo::nitro::carrotquest::CarrotQuestUserProperties> final {
|
|
64
|
+
static inline margelo::nitro::carrotquest::CarrotQuestUserProperties fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
65
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
66
|
+
return margelo::nitro::carrotquest::CarrotQuestUserProperties(
|
|
67
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
68
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phone"))),
|
|
69
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email"))),
|
|
70
|
+
JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "custom")))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::carrotquest::CarrotQuestUserProperties& arg) {
|
|
74
|
+
jsi::Object obj(runtime);
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.name));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "phone"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.phone));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "email"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.email));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "custom"), JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::toJSI(runtime, arg.custom));
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
82
|
+
if (!value.isObject()) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
jsi::Object obj = value.getObject(runtime);
|
|
86
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phone")))) return false;
|
|
91
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email")))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "custom")))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCarrotQuestSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridCarrotQuestSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::carrotquest {
|
|
11
|
+
|
|
12
|
+
void HybridCarrotQuestSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("isConfigured", &HybridCarrotQuestSpec::getIsConfigured);
|
|
18
|
+
prototype.registerHybridGetter("isChatOpen", &HybridCarrotQuestSpec::getIsChatOpen);
|
|
19
|
+
prototype.registerHybridMethod("setup", &HybridCarrotQuestSpec::setup);
|
|
20
|
+
prototype.registerHybridMethod("getSdkVersion", &HybridCarrotQuestSpec::getSdkVersion);
|
|
21
|
+
prototype.registerHybridMethod("auth", &HybridCarrotQuestSpec::auth);
|
|
22
|
+
prototype.registerHybridMethod("hashedAuth", &HybridCarrotQuestSpec::hashedAuth);
|
|
23
|
+
prototype.registerHybridMethod("logout", &HybridCarrotQuestSpec::logout);
|
|
24
|
+
prototype.registerHybridMethod("openChat", &HybridCarrotQuestSpec::openChat);
|
|
25
|
+
prototype.registerHybridMethod("closeChat", &HybridCarrotQuestSpec::closeChat);
|
|
26
|
+
prototype.registerHybridMethod("onChatVisibilityChanged", &HybridCarrotQuestSpec::onChatVisibilityChanged);
|
|
27
|
+
prototype.registerHybridMethod("setTheme", &HybridCarrotQuestSpec::setTheme);
|
|
28
|
+
prototype.registerHybridMethod("getUnreadConversationsCount", &HybridCarrotQuestSpec::getUnreadConversationsCount);
|
|
29
|
+
prototype.registerHybridMethod("getUnreadMessagesCount", &HybridCarrotQuestSpec::getUnreadMessagesCount);
|
|
30
|
+
prototype.registerHybridMethod("onUnreadConversationsChanged", &HybridCarrotQuestSpec::onUnreadConversationsChanged);
|
|
31
|
+
prototype.registerHybridMethod("setUserProperties", &HybridCarrotQuestSpec::setUserProperties);
|
|
32
|
+
prototype.registerHybridMethod("setProperties", &HybridCarrotQuestSpec::setProperties);
|
|
33
|
+
prototype.registerHybridMethod("trackEvent", &HybridCarrotQuestSpec::trackEvent);
|
|
34
|
+
prototype.registerHybridMethod("trackScreen", &HybridCarrotQuestSpec::trackScreen);
|
|
35
|
+
prototype.registerHybridMethod("trackUtm", &HybridCarrotQuestSpec::trackUtm);
|
|
36
|
+
prototype.registerHybridMethod("setPushToken", &HybridCarrotQuestSpec::setPushToken);
|
|
37
|
+
prototype.registerHybridMethod("deletePushToken", &HybridCarrotQuestSpec::deletePushToken);
|
|
38
|
+
prototype.registerHybridMethod("pushNotificationsUnsubscribe", &HybridCarrotQuestSpec::pushNotificationsUnsubscribe);
|
|
39
|
+
prototype.registerHybridMethod("pushCampaignsUnsubscribe", &HybridCarrotQuestSpec::pushCampaignsUnsubscribe);
|
|
40
|
+
prototype.registerHybridMethod("isCarrotPush", &HybridCarrotQuestSpec::isCarrotPush);
|
|
41
|
+
prototype.registerHybridMethod("isAutoMessage", &HybridCarrotQuestSpec::isAutoMessage);
|
|
42
|
+
prototype.registerHybridMethod("handlePushNotification", &HybridCarrotQuestSpec::handlePushNotification);
|
|
43
|
+
prototype.registerHybridMethod("handlePushClick", &HybridCarrotQuestSpec::handlePushClick);
|
|
44
|
+
prototype.registerHybridMethod("getPushLink", &HybridCarrotQuestSpec::getPushLink);
|
|
45
|
+
prototype.registerHybridMethod("wasPushShownEarlier", &HybridCarrotQuestSpec::wasPushShownEarlier);
|
|
46
|
+
prototype.registerHybridMethod("onUrlOpen", &HybridCarrotQuestSpec::onUrlOpen);
|
|
47
|
+
prototype.registerHybridMethod("openBrowserLink", &HybridCarrotQuestSpec::openBrowserLink);
|
|
48
|
+
prototype.registerHybridMethod("openUniversalLink", &HybridCarrotQuestSpec::openUniversalLink);
|
|
49
|
+
prototype.registerHybridMethod("getDiagnostics", &HybridCarrotQuestSpec::getDiagnostics);
|
|
50
|
+
prototype.registerHybridMethod("onLog", &HybridCarrotQuestSpec::onLog);
|
|
51
|
+
prototype.registerHybridMethod("offLog", &HybridCarrotQuestSpec::offLog);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::carrotquest
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridCarrotQuestSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `CarrotQuestSetupOptions` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::carrotquest { struct CarrotQuestSetupOptions; }
|
|
18
|
+
// Forward declaration of `CarrotQuestTheme` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::carrotquest { enum class CarrotQuestTheme; }
|
|
20
|
+
// Forward declaration of `CarrotQuestUserProperties` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::carrotquest { struct CarrotQuestUserProperties; }
|
|
22
|
+
// Forward declaration of `CarrotQuestProperty` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::carrotquest { struct CarrotQuestProperty; }
|
|
24
|
+
// Forward declaration of `CarrotQuestUrlSource` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::carrotquest { enum class CarrotQuestUrlSource; }
|
|
26
|
+
// Forward declaration of `CarrotQuestLogEntry` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::carrotquest { struct CarrotQuestLogEntry; }
|
|
28
|
+
|
|
29
|
+
#include <NitroModules/Promise.hpp>
|
|
30
|
+
#include <string>
|
|
31
|
+
#include "CarrotQuestSetupOptions.hpp"
|
|
32
|
+
#include <optional>
|
|
33
|
+
#include <functional>
|
|
34
|
+
#include "CarrotQuestTheme.hpp"
|
|
35
|
+
#include "CarrotQuestUserProperties.hpp"
|
|
36
|
+
#include "CarrotQuestProperty.hpp"
|
|
37
|
+
#include <vector>
|
|
38
|
+
#include <variant>
|
|
39
|
+
#include <unordered_map>
|
|
40
|
+
#include "CarrotQuestUrlSource.hpp"
|
|
41
|
+
#include "CarrotQuestLogEntry.hpp"
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro::carrotquest {
|
|
44
|
+
|
|
45
|
+
using namespace margelo::nitro;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An abstract base class for `CarrotQuest`
|
|
49
|
+
* Inherit this class to create instances of `HybridCarrotQuestSpec` in C++.
|
|
50
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
51
|
+
* @example
|
|
52
|
+
* ```cpp
|
|
53
|
+
* class HybridCarrotQuest: public HybridCarrotQuestSpec {
|
|
54
|
+
* public:
|
|
55
|
+
* HybridCarrotQuest(...): HybridObject(TAG) { ... }
|
|
56
|
+
* // ...
|
|
57
|
+
* };
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
class HybridCarrotQuestSpec: public virtual HybridObject {
|
|
61
|
+
public:
|
|
62
|
+
// Constructor
|
|
63
|
+
explicit HybridCarrotQuestSpec(): HybridObject(TAG) { }
|
|
64
|
+
|
|
65
|
+
// Destructor
|
|
66
|
+
~HybridCarrotQuestSpec() override = default;
|
|
67
|
+
|
|
68
|
+
public:
|
|
69
|
+
// Properties
|
|
70
|
+
virtual bool getIsConfigured() = 0;
|
|
71
|
+
virtual bool getIsChatOpen() = 0;
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Methods
|
|
75
|
+
virtual std::shared_ptr<Promise<void>> setup(const std::string& apiKey, const std::optional<CarrotQuestSetupOptions>& options) = 0;
|
|
76
|
+
virtual std::string getSdkVersion() = 0;
|
|
77
|
+
virtual std::shared_ptr<Promise<std::optional<std::string>>> auth(const std::string& userId, const std::string& userAuthKey) = 0;
|
|
78
|
+
virtual std::shared_ptr<Promise<std::optional<std::string>>> hashedAuth(const std::string& userId, const std::string& hash) = 0;
|
|
79
|
+
virtual std::shared_ptr<Promise<void>> logout() = 0;
|
|
80
|
+
virtual std::shared_ptr<Promise<void>> openChat() = 0;
|
|
81
|
+
virtual std::shared_ptr<Promise<void>> closeChat() = 0;
|
|
82
|
+
virtual void onChatVisibilityChanged(const std::function<void(bool /* visible */)>& listener) = 0;
|
|
83
|
+
virtual void setTheme(CarrotQuestTheme theme) = 0;
|
|
84
|
+
virtual std::shared_ptr<Promise<double>> getUnreadConversationsCount() = 0;
|
|
85
|
+
virtual std::shared_ptr<Promise<std::optional<double>>> getUnreadMessagesCount() = 0;
|
|
86
|
+
virtual void onUnreadConversationsChanged(const std::function<void(double /* count */)>& listener) = 0;
|
|
87
|
+
virtual void setUserProperties(const CarrotQuestUserProperties& properties) = 0;
|
|
88
|
+
virtual void setProperties(const std::vector<CarrotQuestProperty>& properties) = 0;
|
|
89
|
+
virtual void trackEvent(const std::string& name, const std::optional<std::unordered_map<std::string, std::variant<bool, std::string, double>>>& params) = 0;
|
|
90
|
+
virtual void trackScreen(const std::string& name) = 0;
|
|
91
|
+
virtual void trackUtm(const std::string& url) = 0;
|
|
92
|
+
virtual void setPushToken(const std::string& token) = 0;
|
|
93
|
+
virtual void deletePushToken() = 0;
|
|
94
|
+
virtual std::shared_ptr<Promise<void>> pushNotificationsUnsubscribe() = 0;
|
|
95
|
+
virtual std::shared_ptr<Promise<void>> pushCampaignsUnsubscribe() = 0;
|
|
96
|
+
virtual bool isCarrotPush(const std::string& payloadJson) = 0;
|
|
97
|
+
virtual bool isAutoMessage(const std::string& payloadJson) = 0;
|
|
98
|
+
virtual void handlePushNotification(const std::string& payloadJson) = 0;
|
|
99
|
+
virtual void handlePushClick(const std::string& payloadJson, bool openLink) = 0;
|
|
100
|
+
virtual std::optional<std::string> getPushLink(const std::string& payloadJson) = 0;
|
|
101
|
+
virtual std::shared_ptr<Promise<bool>> wasPushShownEarlier(const std::string& payloadJson) = 0;
|
|
102
|
+
virtual void onUrlOpen(CarrotQuestUrlSource source, const std::function<void(const std::string& /* url */)>& listener) = 0;
|
|
103
|
+
virtual void openBrowserLink(const std::string& url) = 0;
|
|
104
|
+
virtual void openUniversalLink(const std::string& url) = 0;
|
|
105
|
+
virtual std::optional<std::string> getDiagnostics() = 0;
|
|
106
|
+
virtual void onLog(const std::function<void(const CarrotQuestLogEntry& /* entry */)>& listener) = 0;
|
|
107
|
+
virtual void offLog() = 0;
|
|
108
|
+
|
|
109
|
+
protected:
|
|
110
|
+
// Hybrid Setup
|
|
111
|
+
void loadHybridMethods() override;
|
|
112
|
+
|
|
113
|
+
protected:
|
|
114
|
+
// Tag for logging
|
|
115
|
+
static constexpr auto TAG = "CarrotQuest";
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
} // namespace margelo::nitro::carrotquest
|