@revrag-ai/embed-react-native 1.0.6 → 1.0.7
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/LICENSE +1 -1
- package/README.md +13 -382
- package/android/CMakeLists.txt +15 -0
- package/android/build.gradle +77 -25
- package/android/cpp-adapter.cpp +8 -0
- package/android/generated/java/com/revragai/embedreactnative/NativeEmbedReactNativeSpec.java +37 -0
- package/android/generated/jni/CMakeLists.txt +49 -0
- package/android/generated/jni/RNEmbedReactNativeSpec-generated.cpp +32 -0
- package/android/generated/jni/RNEmbedReactNativeSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI.h +67 -0
- package/android/gradle.properties +5 -5
- package/cpp/revrag-ai-embed-react-native.cpp +7 -0
- package/cpp/revrag-ai-embed-react-native.h +8 -0
- package/ios/EmbedReactNative.h +9 -0
- package/ios/{Onwid.mm → EmbedReactNative.mm} +4 -4
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec-generated.mm +29 -0
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec.h +50 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI.h +67 -0
- package/lib/commonjs/NativeEmbedReactNative.js +9 -0
- package/{dist/commonjs/onwidApi → lib/commonjs/api}/api.js +84 -13
- package/lib/commonjs/api/types/embed.api.types.js +2 -0
- package/{dist/module/component/audiowave.js → lib/commonjs/components/Embed/EmbedAudioWave.js} +21 -17
- package/{dist/module/component/OnwidButton.js → lib/commonjs/components/Embed/EmbedButton.js} +65 -61
- package/{dist/module/component/voice.js → lib/commonjs/components/Embed/EmbedVoice.js} +18 -14
- package/{dist/commonjs/style/onwidButton.style.js → lib/commonjs/components/styles/EmbedButton.style.js} +14 -9
- package/{dist/module/Event/onwid.js → lib/commonjs/events/embed.event.js} +14 -10
- package/{dist → lib}/commonjs/hooks/initialize.js +18 -12
- package/{dist/commonjs/hooks/initializelivekit.js → lib/commonjs/hooks/initialize.livekit.js} +8 -5
- package/lib/commonjs/hooks/types/voiceAgent.types.js +6 -0
- package/{dist/module/hooks/voiceAgent.js → lib/commonjs/hooks/voiceagent.js} +36 -31
- package/lib/commonjs/index.js +34 -0
- package/{dist/module/index.d.js → lib/commonjs/index.types.js} +7 -7
- package/lib/commonjs/store/store.key.js +46 -0
- package/{dist/module/utils/reanimatedHelpers.js → lib/commonjs/utils/reanimated.helper.js} +23 -17
- package/lib/module/NativeEmbedReactNative.js +5 -0
- package/{dist/module/onwidApi → lib/module/api}/api.js +67 -4
- package/lib/module/api/types/embed.api.types.js +2 -0
- package/{dist/commonjs/component/audiowave.js → lib/module/components/Embed/EmbedAudioWave.js} +2 -3
- package/{dist/commonjs/component/OnwidButton.js → lib/module/components/Embed/EmbedButton.js} +10 -11
- package/{dist/commonjs/component/voice.js → lib/module/components/Embed/EmbedVoice.js} +1 -1
- package/{dist/module/style/onwidButton.style.js → lib/module/components/styles/EmbedButton.style.js} +3 -3
- package/{dist/commonjs/Event/onwid.js → lib/module/events/embed.event.js} +6 -6
- package/{dist → lib}/module/hooks/initialize.js +3 -3
- package/{dist/module/hooks/initializelivekit.js → lib/module/hooks/initialize.livekit.js} +1 -1
- package/{dist/commonjs/hooks/voiceAgent.js → lib/module/hooks/voiceagent.js} +4 -4
- package/lib/module/index.js +7 -0
- package/{dist/commonjs/index.d.js → lib/module/index.types.js} +2 -1
- package/{dist/commonjs/utils/reanimatedHelpers.js → lib/module/utils/reanimated.helper.js} +14 -14
- package/lib/typescript/module/package.json +1 -0
- package/package.json +67 -33
- package/react-native.config.js +8 -14
- package/revrag-ai-embed-react-native.podspec +41 -0
- package/Onwid.podspec +0 -20
- package/dist/commonjs/NativeOnwid.js +0 -5
- package/dist/commonjs/button.json +0 -1
- package/dist/commonjs/index.js +0 -34
- package/dist/commonjs/onwidApi/api.types.js +0 -2
- package/dist/commonjs/utils/utils.js +0 -2
- package/dist/module/NativeOnwid.js +0 -5
- package/dist/module/button.json +0 -1
- package/dist/module/hooks/voiceAgent.types.js +0 -4
- package/dist/module/index.js +0 -34
- package/dist/module/onwidApi/api.types.js +0 -2
- package/dist/module/store.key.js +0 -38
- package/dist/module/utils/utils.js +0 -2
- package/dist/typescript/Event/onwid.d.ts +0 -14
- package/dist/typescript/NativeOnwid.d.ts +0 -7
- package/dist/typescript/component/OnwidButton.d.ts +0 -29
- package/dist/typescript/component/audiowave.d.ts +0 -7
- package/dist/typescript/component/voice.d.ts +0 -16
- package/dist/typescript/hooks/initialize.d.ts +0 -3
- package/dist/typescript/hooks/initialize.types.d.ts +0 -6
- package/dist/typescript/hooks/initializelivekit.d.ts +0 -4
- package/dist/typescript/hooks/voiceAgent.d.ts +0 -3
- package/dist/typescript/hooks/voiceAgent.types.d.ts +0 -17
- package/dist/typescript/index.d.ts +0 -27
- package/dist/typescript/onwidApi/api.d.ts +0 -54
- package/dist/typescript/onwidApi/api.types.d.ts +0 -22
- package/dist/typescript/store.key.d.ts +0 -4
- package/dist/typescript/style/onwidButton.style.d.ts +0 -99
- package/dist/typescript/utils/reanimatedHelpers.d.ts +0 -30
- package/dist/typescript/utils/utils.d.ts +0 -1
- package/ios/Onwid.h +0 -5
- package/scripts/verify-setup.js +0 -90
- /package/{dist/commonjs/hooks → lib/commonjs/hooks/types}/initialize.types.js +0 -0
- /package/{dist/module/hooks → lib/module/hooks/types}/initialize.types.js +0 -0
- /package/{dist/commonjs/hooks → lib/module/hooks/types}/voiceAgent.types.js +0 -0
- /package/{dist/commonjs → lib/module/store}/store.key.js +0 -0
- /package/{dist → lib/typescript}/commonjs/package.json +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNEmbedReactNativeSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeEmbedReactNativeSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, NumberKind, "multiply", "(DD)D", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
NativeEmbedReactNativeSpecJSI::NativeEmbedReactNativeSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
21
|
+
: JavaTurboModule(params) {
|
|
22
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeSpecJSI_multiply};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
std::shared_ptr<TurboModule> RNEmbedReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
26
|
+
if (moduleName == "EmbedReactNative") {
|
|
27
|
+
return std::make_shared<NativeEmbedReactNativeSpecJSI>(params);
|
|
28
|
+
}
|
|
29
|
+
return nullptr;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeEmbedReactNative'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeEmbedReactNativeSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeEmbedReactNativeSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNEmbedReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNEmbedReactNativeSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeEmbedReactNativeCxxSpecJSI *>(&turboModule)->multiply(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
NativeEmbedReactNativeCxxSpecJSI::NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
23
|
+
: TurboModule("EmbedReactNative", jsInvoker) {
|
|
24
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpec : public TurboModule {
|
|
29
|
+
public:
|
|
30
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
31
|
+
return delegate_.get(rt, propName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static constexpr std::string_view kModuleName = "EmbedReactNative";
|
|
35
|
+
|
|
36
|
+
protected:
|
|
37
|
+
NativeEmbedReactNativeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
38
|
+
: TurboModule(std::string{NativeEmbedReactNativeCxxSpec::kModuleName}, jsInvoker),
|
|
39
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
class Delegate : public NativeEmbedReactNativeCxxSpecJSI {
|
|
44
|
+
public:
|
|
45
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
46
|
+
NativeEmbedReactNativeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
double multiply(jsi::Runtime &rt, double a, double b) override {
|
|
51
|
+
static_assert(
|
|
52
|
+
bridging::getParameterCount(&T::multiply) == 3,
|
|
53
|
+
"Expected multiply(...) to have 3 parameters");
|
|
54
|
+
|
|
55
|
+
return bridging::callFromJs<double>(
|
|
56
|
+
rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
friend class NativeEmbedReactNativeCxxSpec;
|
|
61
|
+
T *instance_;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Delegate delegate_;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace facebook::react
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
EmbedReactNative_kotlinVersion=1.7.0
|
|
2
|
+
EmbedReactNative_minSdkVersion=21
|
|
3
|
+
EmbedReactNative_targetSdkVersion=31
|
|
4
|
+
EmbedReactNative_compileSdkVersion=31
|
|
5
|
+
EmbedReactNative_ndkversion=21.4.7075529
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#import "
|
|
1
|
+
#import "EmbedReactNative.h"
|
|
2
2
|
|
|
3
|
-
@implementation
|
|
3
|
+
@implementation EmbedReactNative
|
|
4
4
|
RCT_EXPORT_MODULE()
|
|
5
5
|
|
|
6
6
|
- (NSNumber *)multiply:(double)a b:(double)b {
|
|
7
|
-
NSNumber *result = @(a
|
|
7
|
+
NSNumber *result = @(revragai_embedreactnative::multiply(a, b));
|
|
8
8
|
|
|
9
9
|
return result;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ RCT_EXPORT_MODULE()
|
|
|
12
12
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
13
13
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
14
14
|
{
|
|
15
|
-
return std::make_shared<facebook::react::
|
|
15
|
+
return std::make_shared<facebook::react::NativeEmbedReactNativeSpecJSI>(params);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "RNEmbedReactNativeSpec.h"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
static facebook::jsi::Value __hostFunction_NativeEmbedReactNativeSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
20
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, NumberKind, "multiply", @selector(multiply:b:), args, count);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
NativeEmbedReactNativeSpecJSI::NativeEmbedReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
24
|
+
: ObjCTurboModule(params) {
|
|
25
|
+
|
|
26
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeSpecJSI_multiply};
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of RNEmbedReactNativeSpec symbols
|
|
19
|
+
#ifndef RNEmbedReactNativeSpec_H
|
|
20
|
+
#define RNEmbedReactNativeSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@protocol NativeEmbedReactNativeSpec <RCTBridgeModule, RCTTurboModule>
|
|
35
|
+
|
|
36
|
+
- (NSNumber *)multiply:(double)a
|
|
37
|
+
b:(double)b;
|
|
38
|
+
|
|
39
|
+
@end
|
|
40
|
+
namespace facebook::react {
|
|
41
|
+
/**
|
|
42
|
+
* ObjC++ class for module 'NativeEmbedReactNative'
|
|
43
|
+
*/
|
|
44
|
+
class JSI_EXPORT NativeEmbedReactNativeSpecJSI : public ObjCTurboModule {
|
|
45
|
+
public:
|
|
46
|
+
NativeEmbedReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
47
|
+
};
|
|
48
|
+
} // namespace facebook::react
|
|
49
|
+
|
|
50
|
+
#endif // RNEmbedReactNativeSpec_H
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNEmbedReactNativeSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeEmbedReactNativeCxxSpecJSI *>(&turboModule)->multiply(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
NativeEmbedReactNativeCxxSpecJSI::NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
23
|
+
: TurboModule("EmbedReactNative", jsInvoker) {
|
|
24
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpec : public TurboModule {
|
|
29
|
+
public:
|
|
30
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
31
|
+
return delegate_.get(rt, propName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static constexpr std::string_view kModuleName = "EmbedReactNative";
|
|
35
|
+
|
|
36
|
+
protected:
|
|
37
|
+
NativeEmbedReactNativeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
38
|
+
: TurboModule(std::string{NativeEmbedReactNativeCxxSpec::kModuleName}, jsInvoker),
|
|
39
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
class Delegate : public NativeEmbedReactNativeCxxSpecJSI {
|
|
44
|
+
public:
|
|
45
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
46
|
+
NativeEmbedReactNativeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
double multiply(jsi::Runtime &rt, double a, double b) override {
|
|
51
|
+
static_assert(
|
|
52
|
+
bridging::getParameterCount(&T::multiply) == 3,
|
|
53
|
+
"Expected multiply(...) to have 3 parameters");
|
|
54
|
+
|
|
55
|
+
return bridging::callFromJs<double>(
|
|
56
|
+
rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
friend class NativeEmbedReactNativeCxxSpec;
|
|
61
|
+
T *instance_;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Delegate delegate_;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('EmbedReactNative');
|
|
9
|
+
//# sourceMappingURL=NativeEmbedReactNative.js.map
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateUserData = exports.registerOnInitialize = exports.initializeApi = exports.getTokenDetails = exports.APIService = void 0;
|
|
7
|
+
var _storeKey = require("../store/store.key.js");
|
|
5
8
|
/**
|
|
6
9
|
* APIService class that ensures proper initialization before API calls
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
class APIService {
|
|
9
12
|
static instance = null;
|
|
10
13
|
apiBaseUrl = null;
|
|
11
14
|
isInitialized = false;
|
|
@@ -28,7 +31,7 @@ export class APIService {
|
|
|
28
31
|
if (this.isInitialized && this.apiBaseUrl) {
|
|
29
32
|
return; // Already initialized
|
|
30
33
|
}
|
|
31
|
-
const AgentData = await getAgentData();
|
|
34
|
+
const AgentData = await (0, _storeKey.getAgentData)();
|
|
32
35
|
console.log('AgentData', AgentData);
|
|
33
36
|
if (AgentData?.onwidUrl) {
|
|
34
37
|
this.apiBaseUrl = AgentData.onwidUrl;
|
|
@@ -52,7 +55,7 @@ export class APIService {
|
|
|
52
55
|
* Get headers with stored API key
|
|
53
56
|
*/
|
|
54
57
|
async getHeaders() {
|
|
55
|
-
const AgentData = await getAgentData();
|
|
58
|
+
const AgentData = await (0, _storeKey.getAgentData)();
|
|
56
59
|
if (!AgentData?.apiKey) {
|
|
57
60
|
throw new Error('API key not found in keychain');
|
|
58
61
|
}
|
|
@@ -78,7 +81,7 @@ export class APIService {
|
|
|
78
81
|
});
|
|
79
82
|
const data = await response.json();
|
|
80
83
|
console.log('dat config data after register', data);
|
|
81
|
-
await setAgentData(data, '@config_data');
|
|
84
|
+
await (0, _storeKey.setAgentData)(data, '@config_data');
|
|
82
85
|
if (!response.ok) {
|
|
83
86
|
console.log('registerOnInitialize error', data.error);
|
|
84
87
|
throw new Error(data.error || 'Registration failed');
|
|
@@ -89,9 +92,30 @@ export class APIService {
|
|
|
89
92
|
};
|
|
90
93
|
} catch (error) {
|
|
91
94
|
console.log('registerOnInitialize error', error);
|
|
95
|
+
|
|
96
|
+
// Enhanced error handling for common iOS network issues
|
|
97
|
+
let errorMessage = 'Unknown error occurred';
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
errorMessage = error.message;
|
|
100
|
+
|
|
101
|
+
// iOS ATS related errors
|
|
102
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
103
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Network connectivity errors
|
|
107
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
108
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Timeout errors
|
|
112
|
+
if (error.message.includes('timeout')) {
|
|
113
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
92
116
|
return {
|
|
93
117
|
success: false,
|
|
94
|
-
error:
|
|
118
|
+
error: errorMessage
|
|
95
119
|
};
|
|
96
120
|
}
|
|
97
121
|
}
|
|
@@ -124,9 +148,30 @@ export class APIService {
|
|
|
124
148
|
};
|
|
125
149
|
} catch (error) {
|
|
126
150
|
console.log('updateUserData error', error);
|
|
151
|
+
|
|
152
|
+
// Enhanced error handling for common iOS network issues
|
|
153
|
+
let errorMessage = 'Unknown error occurred';
|
|
154
|
+
if (error instanceof Error) {
|
|
155
|
+
errorMessage = error.message;
|
|
156
|
+
|
|
157
|
+
// iOS ATS related errors
|
|
158
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
159
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Network connectivity errors
|
|
163
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
164
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Timeout errors
|
|
168
|
+
if (error.message.includes('timeout')) {
|
|
169
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
127
172
|
return {
|
|
128
173
|
success: false,
|
|
129
|
-
error:
|
|
174
|
+
error: errorMessage
|
|
130
175
|
};
|
|
131
176
|
}
|
|
132
177
|
}
|
|
@@ -157,29 +202,55 @@ export class APIService {
|
|
|
157
202
|
};
|
|
158
203
|
} catch (error) {
|
|
159
204
|
console.log('getTokenDetails error', error);
|
|
205
|
+
|
|
206
|
+
// Enhanced error handling for common iOS network issues
|
|
207
|
+
let errorMessage = 'Unknown error occurred';
|
|
208
|
+
if (error instanceof Error) {
|
|
209
|
+
errorMessage = error.message;
|
|
210
|
+
|
|
211
|
+
// iOS ATS related errors
|
|
212
|
+
if (error.message.includes('The resource could not be loaded') || error.message.includes('App Transport Security')) {
|
|
213
|
+
errorMessage = `Network request blocked by iOS App Transport Security. ` + `Please configure ATS exceptions in Info.plist for HTTP endpoints, ` + `or use HTTPS instead. Error: ${error.message}`;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Network connectivity errors
|
|
217
|
+
if (error.message.includes('Network request failed') || error.message.includes('Failed to fetch')) {
|
|
218
|
+
errorMessage = `Network request failed. Please check your internet connection ` + `and ensure the API endpoint (${this.apiBaseUrl}) is accessible. ` + `Error: ${error.message}`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Timeout errors
|
|
222
|
+
if (error.message.includes('timeout')) {
|
|
223
|
+
errorMessage = `Request timeout. The API server may be slow to respond or unreachable. ` + `Error: ${error.message}`;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
160
226
|
return {
|
|
161
227
|
success: false,
|
|
162
|
-
error:
|
|
228
|
+
error: errorMessage
|
|
163
229
|
};
|
|
164
230
|
}
|
|
165
231
|
}
|
|
166
232
|
}
|
|
167
233
|
|
|
168
234
|
// Export convenience functions for backward compatibility
|
|
169
|
-
|
|
235
|
+
exports.APIService = APIService;
|
|
236
|
+
const initializeApi = async () => {
|
|
170
237
|
const apiService = APIService.getInstance();
|
|
171
238
|
await apiService.initialize();
|
|
172
239
|
};
|
|
173
|
-
|
|
240
|
+
exports.initializeApi = initializeApi;
|
|
241
|
+
const registerOnInitialize = async () => {
|
|
174
242
|
const apiService = APIService.getInstance();
|
|
175
243
|
return await apiService.registerOnInitialize();
|
|
176
244
|
};
|
|
177
|
-
|
|
245
|
+
exports.registerOnInitialize = registerOnInitialize;
|
|
246
|
+
const updateUserData = async params => {
|
|
178
247
|
const apiService = APIService.getInstance();
|
|
179
248
|
return await apiService.updateUserData(params);
|
|
180
249
|
};
|
|
181
|
-
|
|
250
|
+
exports.updateUserData = updateUserData;
|
|
251
|
+
const getTokenDetails = async params => {
|
|
182
252
|
const apiService = APIService.getInstance();
|
|
183
253
|
return await apiService.getTokenDetails(params);
|
|
184
254
|
};
|
|
255
|
+
exports.getTokenDetails = getTokenDetails;
|
|
185
256
|
//# sourceMappingURL=api.js.map
|