@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,60 @@
1
+ ///
2
+ /// OnramperReactNative-Swift-Cxx-Umbrella.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
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `HybridOnramperCheckoutButtonSpec` to properly resolve imports.
12
+ namespace margelo::nitro::onramper { class HybridOnramperCheckoutButtonSpec; }
13
+ // Forward declaration of `HybridOnramperNitroSpec` to properly resolve imports.
14
+ namespace margelo::nitro::onramper { class HybridOnramperNitroSpec; }
15
+ // Forward declaration of `NitroSessionCredentials` to properly resolve imports.
16
+ namespace margelo::nitro::onramper { struct NitroSessionCredentials; }
17
+ // Forward declaration of `OnramperNitroConfig` to properly resolve imports.
18
+ namespace margelo::nitro::onramper { struct OnramperNitroConfig; }
19
+ // Forward declaration of `PreparedIntentResult` to properly resolve imports.
20
+ namespace margelo::nitro::onramper { struct PreparedIntentResult; }
21
+
22
+ // Include C++ defined types
23
+ #include "HybridOnramperCheckoutButtonSpec.hpp"
24
+ #include "HybridOnramperNitroSpec.hpp"
25
+ #include "NitroSessionCredentials.hpp"
26
+ #include "OnramperNitroConfig.hpp"
27
+ #include "PreparedIntentResult.hpp"
28
+ #include <NitroModules/Promise.hpp>
29
+ #include <NitroModules/Result.hpp>
30
+ #include <exception>
31
+ #include <functional>
32
+ #include <memory>
33
+ #include <string>
34
+
35
+ // C++ helpers for Swift
36
+ #include "OnramperReactNative-Swift-Cxx-Bridge.hpp"
37
+
38
+ // Common C++ types used in Swift
39
+ #include <NitroModules/ArrayBufferHolder.hpp>
40
+ #include <NitroModules/AnyMapUtils.hpp>
41
+ #include <NitroModules/RuntimeError.hpp>
42
+ #include <NitroModules/DateToChronoDate.hpp>
43
+
44
+ // Forward declarations of Swift defined types
45
+ // Forward declaration of `HybridOnramperCheckoutButtonSpec_cxx` to properly resolve imports.
46
+ namespace OnramperReactNative { class HybridOnramperCheckoutButtonSpec_cxx; }
47
+ // Forward declaration of `HybridOnramperNitroSpec_cxx` to properly resolve imports.
48
+ namespace OnramperReactNative { class HybridOnramperNitroSpec_cxx; }
49
+
50
+ // Include Swift defined types
51
+ #if __has_include("OnramperReactNative-Swift.h")
52
+ // This header is generated by Xcode/Swift on every app build.
53
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "OnramperReactNative".
54
+ #include "OnramperReactNative-Swift.h"
55
+ // Same as above, but used when building with frameworks (`use_frameworks`)
56
+ #elif __has_include(<OnramperReactNative/OnramperReactNative-Swift.h>)
57
+ #include <OnramperReactNative/OnramperReactNative-Swift.h>
58
+ #else
59
+ #error OnramperReactNative's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "OnramperReactNative", and try building the app first.
60
+ #endif
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// OnramperReactNativeAutolinking.mm
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
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridOnramperNitroSpecSwift.hpp"
14
+ #include "HybridOnramperCheckoutButtonSpecSwift.hpp"
15
+
16
+ @interface OnramperReactNativeAutolinking : NSObject
17
+ @end
18
+
19
+ @implementation OnramperReactNativeAutolinking
20
+
21
+ + (void) load {
22
+ using namespace margelo::nitro;
23
+ using namespace margelo::nitro::onramper;
24
+
25
+ HybridObjectRegistry::registerHybridObjectConstructor(
26
+ "OnramperNitro",
27
+ []() -> std::shared_ptr<HybridObject> {
28
+ std::shared_ptr<HybridOnramperNitroSpec> hybridObject = OnramperReactNative::OnramperReactNativeAutolinking::createOnramperNitro();
29
+ return hybridObject;
30
+ }
31
+ );
32
+ HybridObjectRegistry::registerHybridObjectConstructor(
33
+ "OnramperCheckoutButton",
34
+ []() -> std::shared_ptr<HybridObject> {
35
+ std::shared_ptr<HybridOnramperCheckoutButtonSpec> hybridObject = OnramperReactNative::OnramperReactNativeAutolinking::createOnramperCheckoutButton();
36
+ return hybridObject;
37
+ }
38
+ );
39
+ }
40
+
41
+ @end
@@ -0,0 +1,38 @@
1
+ ///
2
+ /// OnramperReactNativeAutolinking.swift
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
+ import NitroModules
9
+
10
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class OnramperReactNativeAutolinking {
13
+ public typealias bridge = margelo.nitro.onramper.bridge.swift
14
+
15
+ public static func createOnramperNitro() -> bridge.std__shared_ptr_HybridOnramperNitroSpec_ {
16
+ let hybridObject = HybridOnramperNitro()
17
+ return { () -> bridge.std__shared_ptr_HybridOnramperNitroSpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isOnramperNitroRecyclable() -> Bool {
24
+ return HybridOnramperNitro.self is any RecyclableView.Type
25
+ }
26
+
27
+ public static func createOnramperCheckoutButton() -> bridge.std__shared_ptr_HybridOnramperCheckoutButtonSpec_ {
28
+ let hybridObject = HybridOnramperCheckoutButton()
29
+ return { () -> bridge.std__shared_ptr_HybridOnramperCheckoutButtonSpec_ in
30
+ let __cxxWrapped = hybridObject.getCxxWrapper()
31
+ return __cxxWrapped.getCxxPart()
32
+ }()
33
+ }
34
+
35
+ public static func isOnramperCheckoutButtonRecyclable() -> Bool {
36
+ return HybridOnramperCheckoutButton.self is any RecyclableView.Type
37
+ }
38
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridOnramperCheckoutButtonSpecSwift.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 "HybridOnramperCheckoutButtonSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::onramper {
11
+ } // namespace margelo::nitro::onramper
@@ -0,0 +1,81 @@
1
+ ///
2
+ /// HybridOnramperCheckoutButtonSpecSwift.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 "HybridOnramperCheckoutButtonSpec.hpp"
11
+
12
+ // Forward declaration of `HybridOnramperCheckoutButtonSpec_cxx` to properly resolve imports.
13
+ namespace OnramperReactNative { class HybridOnramperCheckoutButtonSpec_cxx; }
14
+
15
+
16
+
17
+ #include <string>
18
+
19
+ #include "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
20
+
21
+ namespace margelo::nitro::onramper {
22
+
23
+ /**
24
+ * The C++ part of HybridOnramperCheckoutButtonSpec_cxx.swift.
25
+ *
26
+ * HybridOnramperCheckoutButtonSpecSwift (C++) accesses HybridOnramperCheckoutButtonSpec_cxx (Swift), and might
27
+ * contain some additional bridging code for C++ <> Swift interop.
28
+ *
29
+ * Since this obviously introduces an overhead, I hope at some point in
30
+ * the future, HybridOnramperCheckoutButtonSpec_cxx can directly inherit from the C++ class HybridOnramperCheckoutButtonSpec
31
+ * to simplify the whole structure and memory management.
32
+ */
33
+ class HybridOnramperCheckoutButtonSpecSwift: public virtual HybridOnramperCheckoutButtonSpec {
34
+ public:
35
+ // Constructor from a Swift instance
36
+ explicit HybridOnramperCheckoutButtonSpecSwift(const OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& swiftPart):
37
+ HybridObject(HybridOnramperCheckoutButtonSpec::TAG),
38
+ _swiftPart(swiftPart) { }
39
+
40
+ public:
41
+ // Get the Swift part
42
+ inline OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& getSwiftPart() noexcept {
43
+ return _swiftPart;
44
+ }
45
+
46
+ public:
47
+ inline size_t getExternalMemorySize() noexcept override {
48
+ return _swiftPart.getMemorySize();
49
+ }
50
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
51
+ if (auto otherCast = std::dynamic_pointer_cast<HybridOnramperCheckoutButtonSpecSwift>(other)) {
52
+ return _swiftPart.equals(otherCast->_swiftPart);
53
+ }
54
+ return false;
55
+ }
56
+ void dispose() noexcept override {
57
+ _swiftPart.dispose();
58
+ }
59
+ std::string toString() override {
60
+ return _swiftPart.toString();
61
+ }
62
+
63
+ public:
64
+ // Properties
65
+ inline std::string getIntentHandle() noexcept override {
66
+ auto __result = _swiftPart.getIntentHandle();
67
+ return __result;
68
+ }
69
+ inline void setIntentHandle(const std::string& intentHandle) noexcept override {
70
+ _swiftPart.setIntentHandle(intentHandle);
71
+ }
72
+
73
+ public:
74
+ // Methods
75
+
76
+
77
+ private:
78
+ OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx _swiftPart;
79
+ };
80
+
81
+ } // namespace margelo::nitro::onramper
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridOnramperNitroSpecSwift.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 "HybridOnramperNitroSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::onramper {
11
+ } // namespace margelo::nitro::onramper
@@ -0,0 +1,150 @@
1
+ ///
2
+ /// HybridOnramperNitroSpecSwift.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 "HybridOnramperNitroSpec.hpp"
11
+
12
+ // Forward declaration of `HybridOnramperNitroSpec_cxx` to properly resolve imports.
13
+ namespace OnramperReactNative { class HybridOnramperNitroSpec_cxx; }
14
+
15
+ // Forward declaration of `OnramperNitroConfig` to properly resolve imports.
16
+ namespace margelo::nitro::onramper { struct OnramperNitroConfig; }
17
+ // Forward declaration of `PreparedIntentResult` to properly resolve imports.
18
+ namespace margelo::nitro::onramper { struct PreparedIntentResult; }
19
+ // Forward declaration of `NitroSessionCredentials` to properly resolve imports.
20
+ namespace margelo::nitro::onramper { struct NitroSessionCredentials; }
21
+
22
+ #include <NitroModules/Promise.hpp>
23
+ #include "OnramperNitroConfig.hpp"
24
+ #include <string>
25
+ #include "PreparedIntentResult.hpp"
26
+ #include <functional>
27
+ #include "NitroSessionCredentials.hpp"
28
+
29
+ #include "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
30
+
31
+ namespace margelo::nitro::onramper {
32
+
33
+ /**
34
+ * The C++ part of HybridOnramperNitroSpec_cxx.swift.
35
+ *
36
+ * HybridOnramperNitroSpecSwift (C++) accesses HybridOnramperNitroSpec_cxx (Swift), and might
37
+ * contain some additional bridging code for C++ <> Swift interop.
38
+ *
39
+ * Since this obviously introduces an overhead, I hope at some point in
40
+ * the future, HybridOnramperNitroSpec_cxx can directly inherit from the C++ class HybridOnramperNitroSpec
41
+ * to simplify the whole structure and memory management.
42
+ */
43
+ class HybridOnramperNitroSpecSwift: public virtual HybridOnramperNitroSpec {
44
+ public:
45
+ // Constructor from a Swift instance
46
+ explicit HybridOnramperNitroSpecSwift(const OnramperReactNative::HybridOnramperNitroSpec_cxx& swiftPart):
47
+ HybridObject(HybridOnramperNitroSpec::TAG),
48
+ _swiftPart(swiftPart) { }
49
+
50
+ public:
51
+ // Get the Swift part
52
+ inline OnramperReactNative::HybridOnramperNitroSpec_cxx& getSwiftPart() noexcept {
53
+ return _swiftPart;
54
+ }
55
+
56
+ public:
57
+ inline size_t getExternalMemorySize() noexcept override {
58
+ return _swiftPart.getMemorySize();
59
+ }
60
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
61
+ if (auto otherCast = std::dynamic_pointer_cast<HybridOnramperNitroSpecSwift>(other)) {
62
+ return _swiftPart.equals(otherCast->_swiftPart);
63
+ }
64
+ return false;
65
+ }
66
+ void dispose() noexcept override {
67
+ _swiftPart.dispose();
68
+ }
69
+ std::string toString() override {
70
+ return _swiftPart.toString();
71
+ }
72
+
73
+ public:
74
+ // Properties
75
+
76
+
77
+ public:
78
+ // Methods
79
+ inline std::shared_ptr<Promise<void>> configure(const OnramperNitroConfig& config) override {
80
+ auto __result = _swiftPart.configure(std::forward<decltype(config)>(config));
81
+ if (__result.hasError()) [[unlikely]] {
82
+ std::rethrow_exception(__result.error());
83
+ }
84
+ auto __value = std::move(__result.value());
85
+ return __value;
86
+ }
87
+ inline std::shared_ptr<Promise<void>> initialize(const std::string& sessionId, const std::string& sessionToken) override {
88
+ auto __result = _swiftPart.initialize(sessionId, sessionToken);
89
+ if (__result.hasError()) [[unlikely]] {
90
+ std::rethrow_exception(__result.error());
91
+ }
92
+ auto __value = std::move(__result.value());
93
+ return __value;
94
+ }
95
+ inline std::shared_ptr<Promise<void>> reset() override {
96
+ auto __result = _swiftPart.reset();
97
+ if (__result.hasError()) [[unlikely]] {
98
+ std::rethrow_exception(__result.error());
99
+ }
100
+ auto __value = std::move(__result.value());
101
+ return __value;
102
+ }
103
+ inline std::shared_ptr<Promise<void>> signOut() override {
104
+ auto __result = _swiftPart.signOut();
105
+ if (__result.hasError()) [[unlikely]] {
106
+ std::rethrow_exception(__result.error());
107
+ }
108
+ auto __value = std::move(__result.value());
109
+ return __value;
110
+ }
111
+ inline std::shared_ptr<Promise<PreparedIntentResult>> getCheckoutRequirements(const std::string& requestJson, const std::string& styleJson) override {
112
+ auto __result = _swiftPart.getCheckoutRequirements(requestJson, styleJson);
113
+ if (__result.hasError()) [[unlikely]] {
114
+ std::rethrow_exception(__result.error());
115
+ }
116
+ auto __value = std::move(__result.value());
117
+ return __value;
118
+ }
119
+ inline std::shared_ptr<Promise<void>> cancelPreparedIntent(const std::string& intentHandle) override {
120
+ auto __result = _swiftPart.cancelPreparedIntent(intentHandle);
121
+ if (__result.hasError()) [[unlikely]] {
122
+ std::rethrow_exception(__result.error());
123
+ }
124
+ auto __value = std::move(__result.value());
125
+ return __value;
126
+ }
127
+ inline void setStateListener(const std::function<void(const std::string& /* stateJson */)>& onState) override {
128
+ auto __result = _swiftPart.setStateListener(onState);
129
+ if (__result.hasError()) [[unlikely]] {
130
+ std::rethrow_exception(__result.error());
131
+ }
132
+ }
133
+ inline void setEventListener(const std::function<void(const std::string& /* eventJson */)>& onEvent) override {
134
+ auto __result = _swiftPart.setEventListener(onEvent);
135
+ if (__result.hasError()) [[unlikely]] {
136
+ std::rethrow_exception(__result.error());
137
+ }
138
+ }
139
+ inline void setSessionExpirationHandler(const std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<NitroSessionCredentials>>>>()>& handler) override {
140
+ auto __result = _swiftPart.setSessionExpirationHandler(handler);
141
+ if (__result.hasError()) [[unlikely]] {
142
+ std::rethrow_exception(__result.error());
143
+ }
144
+ }
145
+
146
+ private:
147
+ OnramperReactNative::HybridOnramperNitroSpec_cxx _swiftPart;
148
+ };
149
+
150
+ } // namespace margelo::nitro::onramper
@@ -0,0 +1,122 @@
1
+ ///
2
+ /// HybridOnramperCheckoutButtonComponent.mm
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
+ #import "HybridOnramperCheckoutButtonComponent.hpp"
9
+ #import <memory>
10
+ #import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
11
+ #import <React/RCTViewComponentView.h>
12
+ #import <React/RCTComponentViewFactory.h>
13
+ #import <React/UIView+ComponentViewProtocol.h>
14
+ #import <NitroModules/NitroDefines.hpp>
15
+ #import <UIKit/UIKit.h>
16
+
17
+ #import "HybridOnramperCheckoutButtonSpecSwift.hpp"
18
+ #import "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
19
+
20
+ #if __has_include(<cxxreact/ReactNativeVersion.h>)
21
+ #include <cxxreact/ReactNativeVersion.h>
22
+ #if REACT_NATIVE_VERSION_MINOR >= 82
23
+ #define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
24
+ #endif
25
+ #endif
26
+
27
+ using namespace facebook;
28
+ using namespace margelo::nitro::onramper;
29
+ using namespace margelo::nitro::onramper::views;
30
+
31
+ /**
32
+ * Represents the React Native View holder for the Nitro "OnramperCheckoutButton" HybridView.
33
+ */
34
+ @interface HybridOnramperCheckoutButtonComponent: RCTViewComponentView
35
+ + (BOOL)shouldBeRecycled;
36
+ @end
37
+
38
+ @implementation HybridOnramperCheckoutButtonComponent {
39
+ std::shared_ptr<HybridOnramperCheckoutButtonSpecSwift> _hybridView;
40
+ }
41
+
42
+ + (void) load {
43
+ [super load];
44
+ [RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridOnramperCheckoutButtonComponent class]];
45
+ }
46
+
47
+ + (react::ComponentDescriptorProvider) componentDescriptorProvider {
48
+ return react::concreteComponentDescriptorProvider<HybridOnramperCheckoutButtonComponentDescriptor>();
49
+ }
50
+
51
+ - (instancetype) init {
52
+ if (self = [super init]) {
53
+ std::shared_ptr<HybridOnramperCheckoutButtonSpec> hybridView = OnramperReactNative::OnramperReactNativeAutolinking::createOnramperCheckoutButton();
54
+ _hybridView = std::dynamic_pointer_cast<HybridOnramperCheckoutButtonSpecSwift>(hybridView);
55
+ [self updateView];
56
+ }
57
+ return self;
58
+ }
59
+
60
+ - (void) updateView {
61
+ // 1. Get Swift part
62
+ OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& swiftPart = _hybridView->getSwiftPart();
63
+
64
+ // 2. Get UIView*
65
+ void* viewUnsafe = swiftPart.getView();
66
+ UIView* view = (__bridge_transfer UIView*) viewUnsafe;
67
+
68
+ // 3. Update RCTViewComponentView's [contentView]
69
+ [self setContentView:view];
70
+ }
71
+
72
+ - (void) updateProps:(const std::shared_ptr<const react::Props>&)props
73
+ oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
74
+ // 1. Downcast props
75
+ const auto& newViewPropsConst = *std::static_pointer_cast<HybridOnramperCheckoutButtonProps const>(props);
76
+ auto& newViewProps = const_cast<HybridOnramperCheckoutButtonProps&>(newViewPropsConst);
77
+ OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& swiftPart = _hybridView->getSwiftPart();
78
+
79
+ // 2. Update each prop individually
80
+ swiftPart.beforeUpdate();
81
+
82
+ // intentHandle: string
83
+ if (newViewProps.intentHandle.isDirty) {
84
+ swiftPart.setIntentHandle(newViewProps.intentHandle.value);
85
+ newViewProps.intentHandle.isDirty = false;
86
+ }
87
+
88
+ swiftPart.afterUpdate();
89
+
90
+ // 3. Update hybridRef if it changed
91
+ if (newViewProps.hybridRef.isDirty) {
92
+ // hybridRef changed - call it with new this
93
+ const auto& maybeFunc = newViewProps.hybridRef.value;
94
+ if (maybeFunc.has_value()) {
95
+ maybeFunc.value()(_hybridView);
96
+ }
97
+ newViewProps.hybridRef.isDirty = false;
98
+ }
99
+
100
+ // 4. Continue in base class
101
+ [super updateProps:props oldProps:oldProps];
102
+ }
103
+
104
+ + (BOOL)shouldBeRecycled {
105
+ return OnramperReactNative::OnramperReactNativeAutolinking::isOnramperCheckoutButtonRecyclable();
106
+ }
107
+
108
+ - (void)prepareForRecycle {
109
+ [super prepareForRecycle];
110
+ OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& swiftPart = _hybridView->getSwiftPart();
111
+ swiftPart.maybePrepareForRecycle();
112
+ }
113
+
114
+ #ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
115
+ - (void)invalidate {
116
+ OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx& swiftPart = _hybridView->getSwiftPart();
117
+ swiftPart.onDropView();
118
+ [super invalidate];
119
+ }
120
+ #endif
121
+
122
+ @end
@@ -0,0 +1,61 @@
1
+ ///
2
+ /// Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____.swift
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
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `() -> Promise<Promise<NitroSessionCredentials>>` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____ {
15
+ public typealias bridge = margelo.nitro.onramper.bridge.swift
16
+
17
+ private let closure: () -> Promise<Promise<NitroSessionCredentials>>
18
+
19
+ public init(_ closure: @escaping () -> Promise<Promise<NitroSessionCredentials>>) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call() -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____ {
25
+ let __result: Promise<Promise<NitroSessionCredentials>> = self.closure()
26
+ return { () -> bridge.std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____ in
27
+ let __promise = bridge.create_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____()
28
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____(__promise)
29
+ __result
30
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__shared_ptr_Promise_NitroSessionCredentials__ in
31
+ let __promise = bridge.create_std__shared_ptr_Promise_NitroSessionCredentials__()
32
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_NitroSessionCredentials__(__promise)
33
+ __result
34
+ .then({ __result in __promiseHolder.resolve(__result) })
35
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
36
+ return __promise
37
+ }()) })
38
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
39
+ return __promise
40
+ }()
41
+ }
42
+
43
+ /**
44
+ * Casts this instance to a retained unsafe raw pointer.
45
+ * This acquires one additional strong reference on the object!
46
+ */
47
+ @inline(__always)
48
+ public func toUnsafe() -> UnsafeMutableRawPointer {
49
+ return Unmanaged.passRetained(self).toOpaque()
50
+ }
51
+
52
+ /**
53
+ * Casts an unsafe pointer to a `Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____`.
54
+ * The pointer has to be a retained opaque `Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____>`.
55
+ * This removes one strong reference from the object!
56
+ */
57
+ @inline(__always)
58
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____ {
59
+ return Unmanaged<Func_std__shared_ptr_Promise_std__shared_ptr_Promise_NitroSessionCredentials____>.fromOpaque(pointer).takeRetainedValue()
60
+ }
61
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void.swift
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
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `() -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void {
15
+ public typealias bridge = margelo.nitro.onramper.bridge.swift
16
+
17
+ private let closure: () -> Void
18
+
19
+ public init(_ closure: @escaping () -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call() -> Void {
25
+ self.closure()
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
44
+ return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_NitroSessionCredentials.swift
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
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: NitroSessionCredentials) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_NitroSessionCredentials {
15
+ public typealias bridge = margelo.nitro.onramper.bridge.swift
16
+
17
+ private let closure: (_ value: NitroSessionCredentials) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: NitroSessionCredentials) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: NitroSessionCredentials) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_NitroSessionCredentials`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_NitroSessionCredentials>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_NitroSessionCredentials {
44
+ return Unmanaged<Func_void_NitroSessionCredentials>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }