@onramper/onramper-react-native 1.0.1

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.
Files changed (163) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +5 -0
  4. package/OnramperReactNative.podspec +36 -0
  5. package/README.md +114 -0
  6. package/app.plugin.js +51 -0
  7. package/ios/Frameworks/LICENSE +202 -0
  8. package/ios/Frameworks/NOTICE +5 -0
  9. package/ios/Frameworks/OnramperSDK.xcframework/Info.plist +48 -0
  10. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Info.plist +0 -0
  11. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  12. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftinterface +548 -0
  13. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK +0 -0
  14. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/Info.plist +0 -0
  15. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/PrivacyInfo.xcprivacy +27 -0
  16. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/PrivacyInfo.xcprivacy +27 -0
  17. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Info.plist +20 -0
  18. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
  19. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +2518 -0
  20. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Info.plist +0 -0
  21. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  22. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +548 -0
  23. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  24. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +548 -0
  25. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK +0 -0
  26. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/Info.plist +0 -0
  27. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/PrivacyInfo.xcprivacy +27 -0
  28. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/PrivacyInfo.xcprivacy +27 -0
  29. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Info.plist +20 -0
  30. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
  31. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +2518 -0
  32. package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/OnramperSDK.yml +2487 -0
  33. package/ios/HybridOnramperCheckoutButton.swift +112 -0
  34. package/ios/HybridOnramperNitro.swift +194 -0
  35. package/ios/OnramperCheckoutBridge.swift +88 -0
  36. package/ios/OnramperSDKBridge.swift +185 -0
  37. package/ios/PreparedIntentRegistry.swift +78 -0
  38. package/lib/commonjs/OnramperCheckoutButtonView.js +16 -0
  39. package/lib/commonjs/OnramperCheckoutButtonView.js.map +1 -0
  40. package/lib/commonjs/OnramperClient.js +161 -0
  41. package/lib/commonjs/OnramperClient.js.map +1 -0
  42. package/lib/commonjs/OnramperNative.js +22 -0
  43. package/lib/commonjs/OnramperNative.js.map +1 -0
  44. package/lib/commonjs/errors.js +35 -0
  45. package/lib/commonjs/errors.js.map +1 -0
  46. package/lib/commonjs/events.js +6 -0
  47. package/lib/commonjs/events.js.map +1 -0
  48. package/lib/commonjs/generated/OnramperCheckoutButtonConfig.json +10 -0
  49. package/lib/commonjs/index.js +27 -0
  50. package/lib/commonjs/index.js.map +1 -0
  51. package/lib/commonjs/package.json +1 -0
  52. package/lib/commonjs/specs/OnramperCheckoutButton.nitro.js +6 -0
  53. package/lib/commonjs/specs/OnramperCheckoutButton.nitro.js.map +1 -0
  54. package/lib/commonjs/specs/OnramperNitro.nitro.js +6 -0
  55. package/lib/commonjs/specs/OnramperNitro.nitro.js.map +1 -0
  56. package/lib/commonjs/types.js +6 -0
  57. package/lib/commonjs/types.js.map +1 -0
  58. package/lib/module/OnramperCheckoutButtonView.js +11 -0
  59. package/lib/module/OnramperCheckoutButtonView.js.map +1 -0
  60. package/lib/module/OnramperClient.js +156 -0
  61. package/lib/module/OnramperClient.js.map +1 -0
  62. package/lib/module/OnramperNative.js +18 -0
  63. package/lib/module/OnramperNative.js.map +1 -0
  64. package/lib/module/errors.js +30 -0
  65. package/lib/module/errors.js.map +1 -0
  66. package/lib/module/events.js +4 -0
  67. package/lib/module/events.js.map +1 -0
  68. package/lib/module/generated/OnramperCheckoutButtonConfig.json +10 -0
  69. package/lib/module/index.js +8 -0
  70. package/lib/module/index.js.map +1 -0
  71. package/lib/module/package.json +1 -0
  72. package/lib/module/specs/OnramperCheckoutButton.nitro.js +4 -0
  73. package/lib/module/specs/OnramperCheckoutButton.nitro.js.map +1 -0
  74. package/lib/module/specs/OnramperNitro.nitro.js +4 -0
  75. package/lib/module/specs/OnramperNitro.nitro.js.map +1 -0
  76. package/lib/module/types.js +4 -0
  77. package/lib/module/types.js.map +1 -0
  78. package/lib/typescript/commonjs/package.json +1 -0
  79. package/lib/typescript/commonjs/src/OnramperCheckoutButtonView.d.ts +9 -0
  80. package/lib/typescript/commonjs/src/OnramperCheckoutButtonView.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/src/OnramperClient.d.ts +49 -0
  82. package/lib/typescript/commonjs/src/OnramperClient.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/src/OnramperNative.d.ts +9 -0
  84. package/lib/typescript/commonjs/src/OnramperNative.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/src/errors.d.ts +13 -0
  86. package/lib/typescript/commonjs/src/errors.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/events.d.ts +48 -0
  88. package/lib/typescript/commonjs/src/events.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/src/index.d.ts +9 -0
  90. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts +10 -0
  92. package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts +39 -0
  94. package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/src/types.d.ts +127 -0
  96. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  97. package/lib/typescript/module/package.json +1 -0
  98. package/lib/typescript/module/src/OnramperCheckoutButtonView.d.ts +9 -0
  99. package/lib/typescript/module/src/OnramperCheckoutButtonView.d.ts.map +1 -0
  100. package/lib/typescript/module/src/OnramperClient.d.ts +49 -0
  101. package/lib/typescript/module/src/OnramperClient.d.ts.map +1 -0
  102. package/lib/typescript/module/src/OnramperNative.d.ts +9 -0
  103. package/lib/typescript/module/src/OnramperNative.d.ts.map +1 -0
  104. package/lib/typescript/module/src/errors.d.ts +13 -0
  105. package/lib/typescript/module/src/errors.d.ts.map +1 -0
  106. package/lib/typescript/module/src/events.d.ts +48 -0
  107. package/lib/typescript/module/src/events.d.ts.map +1 -0
  108. package/lib/typescript/module/src/index.d.ts +9 -0
  109. package/lib/typescript/module/src/index.d.ts.map +1 -0
  110. package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts +10 -0
  111. package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -0
  112. package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts +39 -0
  113. package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts.map +1 -0
  114. package/lib/typescript/module/src/types.d.ts +127 -0
  115. package/lib/typescript/module/src/types.d.ts.map +1 -0
  116. package/nitro.json +19 -0
  117. package/nitrogen/generated/.gitattributes +1 -0
  118. package/nitrogen/generated/ios/OnramperReactNative+autolinking.rb +62 -0
  119. package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.cpp +107 -0
  120. package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.hpp +299 -0
  121. package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Umbrella.hpp +60 -0
  122. package/nitrogen/generated/ios/OnramperReactNativeAutolinking.mm +41 -0
  123. package/nitrogen/generated/ios/OnramperReactNativeAutolinking.swift +38 -0
  124. package/nitrogen/generated/ios/c++/HybridOnramperCheckoutButtonSpecSwift.cpp +11 -0
  125. package/nitrogen/generated/ios/c++/HybridOnramperCheckoutButtonSpecSwift.hpp +81 -0
  126. package/nitrogen/generated/ios/c++/HybridOnramperNitroSpecSwift.cpp +11 -0
  127. package/nitrogen/generated/ios/c++/HybridOnramperNitroSpecSwift.hpp +150 -0
  128. package/nitrogen/generated/ios/c++/views/HybridOnramperCheckoutButtonComponent.mm +122 -0
  129. package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____.swift +61 -0
  130. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  131. package/nitrogen/generated/ios/swift/Func_void_NitroSessionCredentials.swift +46 -0
  132. package/nitrogen/generated/ios/swift/Func_void_PreparedIntentResult.swift +46 -0
  133. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  134. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_NitroSessionCredentials__.swift +66 -0
  135. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  136. package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec.swift +55 -0
  137. package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec_cxx.swift +156 -0
  138. package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec.swift +63 -0
  139. package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec_cxx.swift +309 -0
  140. package/nitrogen/generated/ios/swift/NitroSessionCredentials.swift +34 -0
  141. package/nitrogen/generated/ios/swift/OnramperNitroConfig.swift +49 -0
  142. package/nitrogen/generated/ios/swift/PreparedIntentResult.swift +34 -0
  143. package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.cpp +22 -0
  144. package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.hpp +63 -0
  145. package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.cpp +29 -0
  146. package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.hpp +80 -0
  147. package/nitrogen/generated/shared/c++/NitroSessionCredentials.hpp +87 -0
  148. package/nitrogen/generated/shared/c++/OnramperNitroConfig.hpp +99 -0
  149. package/nitrogen/generated/shared/c++/PreparedIntentResult.hpp +87 -0
  150. package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.cpp +83 -0
  151. package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.hpp +111 -0
  152. package/nitrogen/generated/shared/json/OnramperCheckoutButtonConfig.json +10 -0
  153. package/package.json +107 -0
  154. package/src/OnramperCheckoutButtonView.tsx +15 -0
  155. package/src/OnramperClient.ts +170 -0
  156. package/src/OnramperNative.ts +19 -0
  157. package/src/errors.ts +69 -0
  158. package/src/events.ts +23 -0
  159. package/src/generated/OnramperCheckoutButtonConfig.json +10 -0
  160. package/src/index.ts +30 -0
  161. package/src/specs/OnramperCheckoutButton.nitro.ts +16 -0
  162. package/src/specs/OnramperNitro.nitro.ts +60 -0
  163. package/src/types.ts +133 -0
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// NitroSessionCredentials.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
+
35
+ namespace margelo::nitro::onramper {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (NitroSessionCredentials).
39
+ */
40
+ struct NitroSessionCredentials final {
41
+ public:
42
+ std::string sessionId SWIFT_PRIVATE;
43
+ std::string sessionToken SWIFT_PRIVATE;
44
+
45
+ public:
46
+ NitroSessionCredentials() = default;
47
+ explicit NitroSessionCredentials(std::string sessionId, std::string sessionToken): sessionId(sessionId), sessionToken(sessionToken) {}
48
+
49
+ public:
50
+ friend bool operator==(const NitroSessionCredentials& lhs, const NitroSessionCredentials& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::onramper
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ NitroSessionCredentials <> JS NitroSessionCredentials (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::onramper::NitroSessionCredentials> final {
60
+ static inline margelo::nitro::onramper::NitroSessionCredentials fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::onramper::NitroSessionCredentials(
63
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionId"))),
64
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionToken")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::onramper::NitroSessionCredentials& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sessionId"), JSIConverter<std::string>::toJSI(runtime, arg.sessionId));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sessionToken"), JSIConverter<std::string>::toJSI(runtime, arg.sessionToken));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionId")))) return false;
82
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionToken")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,99 @@
1
+ ///
2
+ /// OnramperNitroConfig.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
+
35
+ namespace margelo::nitro::onramper {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (OnramperNitroConfig).
39
+ */
40
+ struct OnramperNitroConfig final {
41
+ public:
42
+ std::string apiKey SWIFT_PRIVATE;
43
+ std::string clientId SWIFT_PRIVATE;
44
+ std::string environment SWIFT_PRIVATE;
45
+ std::string theme SWIFT_PRIVATE;
46
+ std::string logLevel SWIFT_PRIVATE;
47
+
48
+ public:
49
+ OnramperNitroConfig() = default;
50
+ explicit OnramperNitroConfig(std::string apiKey, std::string clientId, std::string environment, std::string theme, std::string logLevel): apiKey(apiKey), clientId(clientId), environment(environment), theme(theme), logLevel(logLevel) {}
51
+
52
+ public:
53
+ friend bool operator==(const OnramperNitroConfig& lhs, const OnramperNitroConfig& rhs) = default;
54
+ };
55
+
56
+ } // namespace margelo::nitro::onramper
57
+
58
+ namespace margelo::nitro {
59
+
60
+ // C++ OnramperNitroConfig <> JS OnramperNitroConfig (object)
61
+ template <>
62
+ struct JSIConverter<margelo::nitro::onramper::OnramperNitroConfig> final {
63
+ static inline margelo::nitro::onramper::OnramperNitroConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
+ jsi::Object obj = arg.asObject(runtime);
65
+ return margelo::nitro::onramper::OnramperNitroConfig(
66
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apiKey"))),
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "clientId"))),
68
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "environment"))),
69
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme"))),
70
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel")))
71
+ );
72
+ }
73
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::onramper::OnramperNitroConfig& arg) {
74
+ jsi::Object obj(runtime);
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "apiKey"), JSIConverter<std::string>::toJSI(runtime, arg.apiKey));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "clientId"), JSIConverter<std::string>::toJSI(runtime, arg.clientId));
77
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "environment"), JSIConverter<std::string>::toJSI(runtime, arg.environment));
78
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "theme"), JSIConverter<std::string>::toJSI(runtime, arg.theme));
79
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "logLevel"), JSIConverter<std::string>::toJSI(runtime, arg.logLevel));
80
+ return obj;
81
+ }
82
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
83
+ if (!value.isObject()) {
84
+ return false;
85
+ }
86
+ jsi::Object obj = value.getObject(runtime);
87
+ if (!nitro::isPlainObject(runtime, obj)) {
88
+ return false;
89
+ }
90
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "apiKey")))) return false;
91
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "clientId")))) return false;
92
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "environment")))) return false;
93
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "theme")))) return false;
94
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "logLevel")))) return false;
95
+ return true;
96
+ }
97
+ };
98
+
99
+ } // namespace margelo::nitro
@@ -0,0 +1,87 @@
1
+ ///
2
+ /// PreparedIntentResult.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
+
35
+ namespace margelo::nitro::onramper {
36
+
37
+ /**
38
+ * A struct which can be represented as a JavaScript object (PreparedIntentResult).
39
+ */
40
+ struct PreparedIntentResult final {
41
+ public:
42
+ std::string intentHandle SWIFT_PRIVATE;
43
+ std::string quoteJson SWIFT_PRIVATE;
44
+
45
+ public:
46
+ PreparedIntentResult() = default;
47
+ explicit PreparedIntentResult(std::string intentHandle, std::string quoteJson): intentHandle(intentHandle), quoteJson(quoteJson) {}
48
+
49
+ public:
50
+ friend bool operator==(const PreparedIntentResult& lhs, const PreparedIntentResult& rhs) = default;
51
+ };
52
+
53
+ } // namespace margelo::nitro::onramper
54
+
55
+ namespace margelo::nitro {
56
+
57
+ // C++ PreparedIntentResult <> JS PreparedIntentResult (object)
58
+ template <>
59
+ struct JSIConverter<margelo::nitro::onramper::PreparedIntentResult> final {
60
+ static inline margelo::nitro::onramper::PreparedIntentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
61
+ jsi::Object obj = arg.asObject(runtime);
62
+ return margelo::nitro::onramper::PreparedIntentResult(
63
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intentHandle"))),
64
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quoteJson")))
65
+ );
66
+ }
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::onramper::PreparedIntentResult& arg) {
68
+ jsi::Object obj(runtime);
69
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "intentHandle"), JSIConverter<std::string>::toJSI(runtime, arg.intentHandle));
70
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "quoteJson"), JSIConverter<std::string>::toJSI(runtime, arg.quoteJson));
71
+ return obj;
72
+ }
73
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
74
+ if (!value.isObject()) {
75
+ return false;
76
+ }
77
+ jsi::Object obj = value.getObject(runtime);
78
+ if (!nitro::isPlainObject(runtime, obj)) {
79
+ return false;
80
+ }
81
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intentHandle")))) return false;
82
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quoteJson")))) return false;
83
+ return true;
84
+ }
85
+ };
86
+
87
+ } // namespace margelo::nitro
@@ -0,0 +1,83 @@
1
+ ///
2
+ /// HybridOnramperCheckoutButtonComponent.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 "HybridOnramperCheckoutButtonComponent.hpp"
9
+
10
+ #include <string>
11
+ #include <exception>
12
+ #include <utility>
13
+ #include <NitroModules/NitroDefines.hpp>
14
+ #include <NitroModules/JSIConverter.hpp>
15
+ #include <NitroModules/PropNameIDCache.hpp>
16
+ #include <react/renderer/core/RawValue.h>
17
+ #include <react/renderer/core/ShadowNode.h>
18
+ #include <react/renderer/core/ComponentDescriptor.h>
19
+ #include <react/renderer/components/view/ViewProps.h>
20
+
21
+ namespace margelo::nitro::onramper::views {
22
+
23
+ extern const char HybridOnramperCheckoutButtonComponentName[] = "OnramperCheckoutButton";
24
+
25
+ HybridOnramperCheckoutButtonProps::HybridOnramperCheckoutButtonProps(const react::PropsParserContext& context,
26
+ const HybridOnramperCheckoutButtonProps& sourceProps,
27
+ const react::RawProps& rawProps):
28
+ react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
29
+ intentHandle([&]() -> CachedProp<std::string> {
30
+ try {
31
+ const react::RawValue* rawValue = rawProps.at("intentHandle", nullptr, nullptr);
32
+ if (rawValue == nullptr) return sourceProps.intentHandle;
33
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
34
+ return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.intentHandle);
35
+ } catch (const std::exception& exc) {
36
+ throw std::runtime_error(std::string("OnramperCheckoutButton.intentHandle: ") + exc.what());
37
+ }
38
+ }()),
39
+ hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridOnramperCheckoutButtonSpec>& /* ref */)>>> {
40
+ try {
41
+ const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
42
+ if (rawValue == nullptr) return sourceProps.hybridRef;
43
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
44
+ return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridOnramperCheckoutButtonSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.hybridRef);
45
+ } catch (const std::exception& exc) {
46
+ throw std::runtime_error(std::string("OnramperCheckoutButton.hybridRef: ") + exc.what());
47
+ }
48
+ }()) { }
49
+
50
+ bool HybridOnramperCheckoutButtonProps::filterObjectKeys(const std::string& propName) {
51
+ switch (hashString(propName)) {
52
+ case hashString("intentHandle"): return true;
53
+ case hashString("hybridRef"): return true;
54
+ default: return false;
55
+ }
56
+ }
57
+
58
+ HybridOnramperCheckoutButtonComponentDescriptor::HybridOnramperCheckoutButtonComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
59
+ : ConcreteComponentDescriptor(parameters,
60
+ react::RawPropsParser(/* enableJsiParser */ true)) {}
61
+
62
+ std::shared_ptr<const react::Props> HybridOnramperCheckoutButtonComponentDescriptor::cloneProps(const react::PropsParserContext& context,
63
+ const std::shared_ptr<const react::Props>& props,
64
+ react::RawProps rawProps) const {
65
+ // 1. Prepare raw props parser
66
+ rawProps.parse(rawPropsParser_);
67
+ // 2. Copy props with Nitro's cached copy constructor
68
+ return HybridOnramperCheckoutButtonShadowNode::Props(context, /* & */ rawProps, props);
69
+ }
70
+
71
+ #ifdef ANDROID
72
+ void HybridOnramperCheckoutButtonComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
73
+ // This is called immediately after `ShadowNode` is created, cloned or in progress.
74
+ // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
75
+ auto& concreteShadowNode = static_cast<HybridOnramperCheckoutButtonShadowNode&>(shadowNode);
76
+ const std::shared_ptr<const HybridOnramperCheckoutButtonProps>& constProps = concreteShadowNode.getConcreteSharedProps();
77
+ const std::shared_ptr<HybridOnramperCheckoutButtonProps>& props = std::const_pointer_cast<HybridOnramperCheckoutButtonProps>(constProps);
78
+ HybridOnramperCheckoutButtonState state{props};
79
+ concreteShadowNode.setStateData(std::move(state));
80
+ }
81
+ #endif
82
+
83
+ } // namespace margelo::nitro::onramper::views
@@ -0,0 +1,111 @@
1
+ ///
2
+ /// HybridOnramperCheckoutButtonComponent.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
+ #include <optional>
11
+ #include <NitroModules/NitroDefines.hpp>
12
+ #include <NitroModules/NitroHash.hpp>
13
+ #include <NitroModules/CachedProp.hpp>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/core/PropsParserContext.h>
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <react/renderer/components/view/ViewProps.h>
18
+
19
+ #include <string>
20
+ #include <memory>
21
+ #include "HybridOnramperCheckoutButtonSpec.hpp"
22
+ #include <functional>
23
+ #include <optional>
24
+
25
+ namespace margelo::nitro::onramper::views {
26
+
27
+ using namespace facebook;
28
+
29
+ /**
30
+ * The name of the actual native View.
31
+ */
32
+ extern const char HybridOnramperCheckoutButtonComponentName[];
33
+
34
+ /**
35
+ * Props for the "OnramperCheckoutButton" View.
36
+ */
37
+ class HybridOnramperCheckoutButtonProps final: public react::ViewProps {
38
+ public:
39
+ HybridOnramperCheckoutButtonProps() = default;
40
+ HybridOnramperCheckoutButtonProps(const react::PropsParserContext& context,
41
+ const HybridOnramperCheckoutButtonProps& sourceProps,
42
+ const react::RawProps& rawProps);
43
+
44
+ public:
45
+ CachedProp<std::string> intentHandle;
46
+ CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridOnramperCheckoutButtonSpec>& /* ref */)>>> hybridRef;
47
+
48
+ private:
49
+ static bool filterObjectKeys(const std::string& propName);
50
+ };
51
+
52
+ /**
53
+ * State for the "OnramperCheckoutButton" View.
54
+ */
55
+ class HybridOnramperCheckoutButtonState final {
56
+ public:
57
+ HybridOnramperCheckoutButtonState() = default;
58
+ explicit HybridOnramperCheckoutButtonState(const std::shared_ptr<HybridOnramperCheckoutButtonProps>& props):
59
+ _props(props) {}
60
+
61
+ public:
62
+ [[nodiscard]]
63
+ const std::shared_ptr<HybridOnramperCheckoutButtonProps>& getProps() const {
64
+ return _props;
65
+ }
66
+
67
+ public:
68
+ #ifdef ANDROID
69
+ HybridOnramperCheckoutButtonState(const HybridOnramperCheckoutButtonState& /* previousState */, folly::dynamic /* data */) {}
70
+ folly::dynamic getDynamic() const {
71
+ throw std::runtime_error("HybridOnramperCheckoutButtonState does not support folly!");
72
+ }
73
+ react::MapBuffer getMapBuffer() const {
74
+ throw std::runtime_error("HybridOnramperCheckoutButtonState does not support MapBuffer!");
75
+ };
76
+ #endif
77
+
78
+ private:
79
+ std::shared_ptr<HybridOnramperCheckoutButtonProps> _props;
80
+ };
81
+
82
+ /**
83
+ * The Shadow Node for the "OnramperCheckoutButton" View.
84
+ */
85
+ using HybridOnramperCheckoutButtonShadowNode = react::ConcreteViewShadowNode<HybridOnramperCheckoutButtonComponentName /* "HybridOnramperCheckoutButton" */,
86
+ HybridOnramperCheckoutButtonProps /* custom props */,
87
+ react::ViewEventEmitter /* default */,
88
+ HybridOnramperCheckoutButtonState /* custom state */>;
89
+
90
+ /**
91
+ * The Component Descriptor for the "OnramperCheckoutButton" View.
92
+ */
93
+ class HybridOnramperCheckoutButtonComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridOnramperCheckoutButtonShadowNode> {
94
+ public:
95
+ explicit HybridOnramperCheckoutButtonComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
96
+
97
+ public:
98
+ /**
99
+ * A faster path for cloning props - reuses the caching logic from `HybridOnramperCheckoutButtonProps`.
100
+ */
101
+ std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
102
+ const std::shared_ptr<const react::Props>& props,
103
+ react::RawProps rawProps) const override;
104
+ #ifdef ANDROID
105
+ void adopt(react::ShadowNode& shadowNode) const override;
106
+ #endif
107
+ };
108
+
109
+ /* The actual view for "OnramperCheckoutButton" needs to be implemented in platform-specific code. */
110
+
111
+ } // namespace margelo::nitro::onramper::views
@@ -0,0 +1,10 @@
1
+ {
2
+ "uiViewClassName": "OnramperCheckoutButton",
3
+ "supportsRawText": false,
4
+ "bubblingEventTypes": {},
5
+ "directEventTypes": {},
6
+ "validAttributes": {
7
+ "intentHandle": true,
8
+ "hybridRef": true
9
+ }
10
+ }
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@onramper/onramper-react-native",
3
+ "version": "1.0.1",
4
+ "description": "React Native wrapper for the Onramper iOS SDK",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
8
+ "react-native": "./src/index.ts",
9
+ "source": "./src/index.ts",
10
+ "exports": {
11
+ ".": {
12
+ "source": "./src/index.ts",
13
+ "import": {
14
+ "types": "./lib/typescript/module/src/index.d.ts",
15
+ "default": "./lib/module/index.js"
16
+ },
17
+ "require": {
18
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
19
+ "default": "./lib/commonjs/index.js"
20
+ }
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "lib",
26
+ "src",
27
+ "ios/*.swift",
28
+ "ios/Frameworks/OnramperSDK.xcframework",
29
+ "nitrogen/generated",
30
+ "nitro.json",
31
+ "OnramperReactNative.podspec",
32
+ "app.plugin.js",
33
+ "README.md",
34
+ "CHANGELOG.md",
35
+ "LICENSE",
36
+ "NOTICE"
37
+ ],
38
+ "scripts": {
39
+ "build": "bob build",
40
+ "clean": "rm -rf lib",
41
+ "lint": "biome check src",
42
+ "format": "biome format --write src",
43
+ "test": "jest",
44
+ "typecheck": "tsc --noEmit",
45
+ "nitrogen": "nitrogen && node scripts/sync-view-config.js",
46
+ "prepare": "bob build",
47
+ "prepack": "node scripts/check-xcframework.js",
48
+ "verify-version": "node scripts/verify-version.js",
49
+ "fetch-xcframework": "node scripts/fetch-xcframework.js",
50
+ "slim-xcframework": "node scripts/slim-xcframework.js"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "keywords": [
56
+ "react-native",
57
+ "expo",
58
+ "onramper",
59
+ "crypto",
60
+ "onramp"
61
+ ],
62
+ "repository": "https://github.com/onramper/onramper-react-native",
63
+ "author": "Onramper <engineering@onramper.com>",
64
+ "license": "Apache-2.0",
65
+ "homepage": "https://github.com/onramper/onramper-react-native#readme",
66
+ "onramperSDK": {
67
+ "checksum": "3b0ef3356d46bdda6f3dc29043e3f00a9386bfa3411ce3115f2d479044458740"
68
+ },
69
+ "peerDependencies": {
70
+ "react": ">=19.0.0",
71
+ "react-native": ">=0.79.0",
72
+ "react-native-nitro-modules": ">=0.35.0"
73
+ },
74
+ "devDependencies": {
75
+ "@biomejs/biome": "^1.9.0",
76
+ "@expo/config-plugins": "^10.0.0",
77
+ "@types/jest": "^29.5.14",
78
+ "@types/react": "~19.2.0",
79
+ "jest": "^29.7.0",
80
+ "nitrogen": "^0.35.9",
81
+ "react": "19.2.3",
82
+ "react-native": "0.85.3",
83
+ "react-native-builder-bob": "^0.41.0",
84
+ "react-native-nitro-modules": "^0.35.9",
85
+ "ts-jest": "^29.4.10",
86
+ "typescript": "~5.8.3"
87
+ },
88
+ "react-native-builder-bob": {
89
+ "source": "src",
90
+ "output": "lib",
91
+ "targets": [
92
+ [
93
+ "commonjs",
94
+ {
95
+ "esm": true
96
+ }
97
+ ],
98
+ [
99
+ "module",
100
+ {
101
+ "esm": true
102
+ }
103
+ ],
104
+ "typescript"
105
+ ]
106
+ }
107
+ }
@@ -0,0 +1,15 @@
1
+ import { getHostComponent } from 'react-native-nitro-modules';
2
+ import OnramperCheckoutButtonConfig from './generated/OnramperCheckoutButtonConfig.json';
3
+ import type { OnramperCheckoutButtonMethods, OnramperCheckoutButtonProps } from './specs/OnramperCheckoutButton.nitro';
4
+
5
+ export type { OnramperCheckoutButtonProps as OnramperCheckoutButtonViewProps };
6
+
7
+ /**
8
+ * Native checkout button. Renders the SwiftUI `OnramperCheckoutButton` that
9
+ * `OnramperClient.getCheckoutRequirements()` prepared, addressed by `intentHandle`.
10
+ * Standard view props (e.g. `style`) are supported via `HybridViewProps`.
11
+ */
12
+ export const OnramperCheckoutButtonView = getHostComponent<OnramperCheckoutButtonProps, OnramperCheckoutButtonMethods>(
13
+ 'OnramperCheckoutButton',
14
+ () => OnramperCheckoutButtonConfig,
15
+ );