@onramper/onramper-react-native 1.2.0 → 1.2.2-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.
- package/CHANGELOG.md +51 -0
- package/README.md +10 -1
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios.swiftinterface +12 -1
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/Info.plist +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +2240 -2234
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Info.plist +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +12 -1
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/Modules/OnramperSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +12 -1
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/OnramperSDK.framework/OnramperSDK_OnramperSDK.bundle/Info.plist +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/DWARF/OnramperSDK +0 -0
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/OnramperSDK.yml +2240 -2234
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/OnramperSDK.yml +2206 -2200
- package/ios/HybridOnramperCheckoutButton.swift +77 -3
- package/ios/HybridOnramperNitro.swift +12 -0
- package/lib/commonjs/CheckoutButton.js +34 -0
- package/lib/commonjs/CheckoutButton.js.map +1 -0
- package/lib/commonjs/OnramperClient.js +38 -8
- package/lib/commonjs/OnramperClient.js.map +1 -1
- package/lib/commonjs/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/lib/module/CheckoutButton.js +30 -0
- package/lib/module/CheckoutButton.js.map +1 -0
- package/lib/module/OnramperClient.js +38 -8
- package/lib/module/OnramperClient.js.map +1 -1
- package/lib/module/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/lib/typescript/commonjs/src/CheckoutButton.d.ts +20 -0
- package/lib/typescript/commonjs/src/CheckoutButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/OnramperClient.d.ts +5 -0
- package/lib/typescript/commonjs/src/OnramperClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts +6 -0
- package/lib/typescript/commonjs/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts +1 -0
- package/lib/typescript/commonjs/src/specs/OnramperNitro.nitro.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types.d.ts +2 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/CheckoutButton.d.ts +20 -0
- package/lib/typescript/module/src/CheckoutButton.d.ts.map +1 -0
- package/lib/typescript/module/src/OnramperClient.d.ts +5 -0
- package/lib/typescript/module/src/OnramperClient.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts +6 -0
- package/lib/typescript/module/src/specs/OnramperCheckoutButton.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts +1 -0
- package/lib/typescript/module/src/specs/OnramperNitro.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/types.d.ts +2 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.hpp +75 -0
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Umbrella.hpp +1 -0
- package/nitrogen/generated/ios/c++/HybridOnramperCheckoutButtonSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/c++/HybridOnramperNitroSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/views/HybridOnramperCheckoutButtonComponent.mm +5 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +53 -0
- package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec_cxx.swift +32 -0
- package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOnramperNitroSpec_cxx.swift +22 -0
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridOnramperNitroSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.cpp +11 -0
- package/nitrogen/generated/shared/c++/views/HybridOnramperCheckoutButtonComponent.hpp +3 -2
- package/nitrogen/generated/shared/json/OnramperCheckoutButtonConfig.json +1 -0
- package/package.json +4 -2
- package/src/CheckoutButton.ts +28 -0
- package/src/OnramperClient.ts +40 -6
- package/src/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/src/specs/OnramperCheckoutButton.nitro.ts +6 -0
- package/src/specs/OnramperNitro.nitro.ts +2 -0
- package/src/types.ts +2 -0
|
@@ -12,6 +12,14 @@ import UIKit
|
|
|
12
12
|
final class HybridOnramperCheckoutButton: HybridOnramperCheckoutButtonSpec {
|
|
13
13
|
private let container = CheckoutContainerView()
|
|
14
14
|
private var mountedHandle: String?
|
|
15
|
+
private var lastReportedHeight: CGFloat = 0
|
|
16
|
+
/// Latest height SwiftUI measured, kept so a callback attached after the
|
|
17
|
+
/// measurement (or replaced later) still receives it.
|
|
18
|
+
private var measuredHeight: CGFloat = 0
|
|
19
|
+
|
|
20
|
+
var onContentHeightChange: ((_ height: Double) -> Void)? {
|
|
21
|
+
didSet { flushContentHeight() }
|
|
22
|
+
}
|
|
15
23
|
|
|
16
24
|
var intentHandle: String = "" {
|
|
17
25
|
didSet {
|
|
@@ -24,22 +32,65 @@ final class HybridOnramperCheckoutButton: HybridOnramperCheckoutButtonSpec {
|
|
|
24
32
|
|
|
25
33
|
private func mount(handle: String) {
|
|
26
34
|
mountedHandle = handle
|
|
35
|
+
lastReportedHeight = 0
|
|
36
|
+
measuredHeight = 0
|
|
27
37
|
Task { @MainActor [weak self] in
|
|
28
38
|
guard let self else { return }
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
let entry = await PreparedIntentRegistry.shared.consume(handle)
|
|
40
|
+
// A newer handle arrived while this one was being consumed; it owns the view.
|
|
41
|
+
guard self.mountedHandle == handle else { return }
|
|
42
|
+
guard let entry else {
|
|
43
|
+
// Handle was invalidated or already consumed. Remove whatever an earlier
|
|
44
|
+
// handle hosted, so a stale Buy button can't stay on screen.
|
|
45
|
+
self.container.clear()
|
|
31
46
|
return
|
|
32
47
|
}
|
|
33
48
|
// Pin the SwiftUI content to the container's width so long ToS text wraps
|
|
34
49
|
// instead of laying out at its intrinsic (single-line) width and spilling
|
|
35
|
-
// past the right edge. `.fixedSize(vertical:)` lets it
|
|
50
|
+
// past the right edge. `.fixedSize(vertical:)` lets it take its ideal
|
|
51
|
+
// height, which is measured and reported to JS so React Native can size
|
|
52
|
+
// the view (ToS text below the Buy button makes it taller than 56pt, and
|
|
53
|
+
// can appear or disappear after mount).
|
|
36
54
|
self.container.host(AnyView(
|
|
37
55
|
entry.button
|
|
38
56
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
39
57
|
.fixedSize(horizontal: false, vertical: true)
|
|
58
|
+
.background(GeometryReader { proxy in
|
|
59
|
+
// SwiftUI's first pass can run before the hosting view has a width,
|
|
60
|
+
// where wrapped text measures as one word per line (~1000pt tall).
|
|
61
|
+
// Report nothing for that pass; the real width follows immediately.
|
|
62
|
+
Color.clear.preference(
|
|
63
|
+
key: CheckoutContentHeightKey.self,
|
|
64
|
+
value: proxy.size.width > 0 ? proxy.size.height : 0
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
.onPreferenceChange(CheckoutContentHeightKey.self) { [weak self] height in
|
|
68
|
+
self?.reportContentHeight(height)
|
|
69
|
+
}
|
|
40
70
|
))
|
|
41
71
|
}
|
|
42
72
|
}
|
|
73
|
+
|
|
74
|
+
// Main thread only: called from SwiftUI preference changes and Nitro prop setters.
|
|
75
|
+
private func reportContentHeight(_ height: CGFloat) {
|
|
76
|
+
guard height > 0 else { return }
|
|
77
|
+
measuredHeight = height
|
|
78
|
+
flushContentHeight()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private func flushContentHeight() {
|
|
82
|
+
guard measuredHeight > 0, abs(measuredHeight - lastReportedHeight) > 0.5, let onContentHeightChange else { return }
|
|
83
|
+
lastReportedHeight = measuredHeight
|
|
84
|
+
onContentHeightChange(Double(measuredHeight))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/// Carries the hosted content's laid-out height out of SwiftUI.
|
|
89
|
+
private struct CheckoutContentHeightKey: PreferenceKey {
|
|
90
|
+
static let defaultValue: CGFloat = 0
|
|
91
|
+
static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) {
|
|
92
|
+
value = max(value, nextValue())
|
|
93
|
+
}
|
|
43
94
|
}
|
|
44
95
|
|
|
45
96
|
/// Container that hosts the SwiftUI button and (re)attaches the hosting
|
|
@@ -47,6 +98,18 @@ final class HybridOnramperCheckoutButton: HybridOnramperCheckoutButtonSpec {
|
|
|
47
98
|
final class CheckoutContainerView: UIView {
|
|
48
99
|
private var hostingController: UIHostingController<AnyView>?
|
|
49
100
|
|
|
101
|
+
override init(frame: CGRect) {
|
|
102
|
+
super.init(frame: frame)
|
|
103
|
+
// Backstop: never draw over neighbouring React Native views, even for the
|
|
104
|
+
// frame between a content-size change and JS applying the new height.
|
|
105
|
+
clipsToBounds = true
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
required init?(coder: NSCoder) {
|
|
109
|
+
super.init(coder: coder)
|
|
110
|
+
clipsToBounds = true
|
|
111
|
+
}
|
|
112
|
+
|
|
50
113
|
@MainActor
|
|
51
114
|
func host(_ rootView: AnyView) {
|
|
52
115
|
// Re-hosting (e.g. when `intentHandle` changes) must tear the previous
|
|
@@ -55,6 +118,11 @@ final class CheckoutContainerView: UIView {
|
|
|
55
118
|
detachHosted()
|
|
56
119
|
let controller = UIHostingController(rootView: rootView)
|
|
57
120
|
controller.view.backgroundColor = .clear
|
|
121
|
+
// Inside a ScrollView near the notch/home indicator the hosting controller
|
|
122
|
+
// would otherwise inject safe-area padding that shifts the content as it scrolls.
|
|
123
|
+
if #available(iOS 16.4, *) {
|
|
124
|
+
controller.safeAreaRegions = []
|
|
125
|
+
}
|
|
58
126
|
controller.view.translatesAutoresizingMaskIntoConstraints = false
|
|
59
127
|
hostingController = controller
|
|
60
128
|
addSubview(controller.view)
|
|
@@ -67,6 +135,12 @@ final class CheckoutContainerView: UIView {
|
|
|
67
135
|
attachChildIfPossible()
|
|
68
136
|
}
|
|
69
137
|
|
|
138
|
+
/// Removes the hosted content, leaving the view empty.
|
|
139
|
+
@MainActor
|
|
140
|
+
func clear() {
|
|
141
|
+
detachHosted()
|
|
142
|
+
}
|
|
143
|
+
|
|
70
144
|
override func didMoveToWindow() {
|
|
71
145
|
super.didMoveToWindow()
|
|
72
146
|
attachChildIfPossible()
|
|
@@ -11,10 +11,12 @@ import SwiftUI
|
|
|
11
11
|
final class HybridOnramperNitro: HybridOnramperNitroSpec {
|
|
12
12
|
private var client: OnramperClient?
|
|
13
13
|
private var stateObservation: AnyCancellable?
|
|
14
|
+
private var transactionIdObservation: AnyCancellable?
|
|
14
15
|
private var eventTask: Task<Void, Never>?
|
|
15
16
|
|
|
16
17
|
private var onState: ((String) -> Void)?
|
|
17
18
|
private var onEvent: ((String) -> Void)?
|
|
19
|
+
private var onTransactionId: ((String?) -> Void)?
|
|
18
20
|
// Nitro wraps a callback's return value in a Promise; our callback already
|
|
19
21
|
// returns Promise<NitroSessionCredentials>, hence the doubly-nested Promise.
|
|
20
22
|
private var sessionHandler: (() -> Promise<Promise<NitroSessionCredentials>>)?
|
|
@@ -33,6 +35,10 @@ final class HybridOnramperNitro: HybridOnramperNitroSpec {
|
|
|
33
35
|
self.onEvent = onEvent
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
func setTransactionIdListener(onTransactionId: @escaping (String?) -> Void) {
|
|
39
|
+
self.onTransactionId = onTransactionId
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
func setSessionExpirationHandler(handler: @escaping () -> Promise<Promise<NitroSessionCredentials>>) {
|
|
37
43
|
self.sessionHandler = handler
|
|
38
44
|
}
|
|
@@ -96,6 +102,9 @@ final class HybridOnramperNitro: HybridOnramperNitroSpec {
|
|
|
96
102
|
stateObservation = client.$state.sink { [weak self] state in
|
|
97
103
|
self?.onState?(jsonString(state.toJSDict()))
|
|
98
104
|
}
|
|
105
|
+
transactionIdObservation = client.$currentTransactionId.sink { [weak self] transactionId in
|
|
106
|
+
self?.onTransactionId?(transactionId)
|
|
107
|
+
}
|
|
99
108
|
// `events` is a computed AsyncStream that captures a single continuation, so
|
|
100
109
|
// access it exactly once here. CheckoutEvent is Sendable → safe to iterate
|
|
101
110
|
// off the main actor.
|
|
@@ -199,10 +208,13 @@ final class HybridOnramperNitro: HybridOnramperNitroSpec {
|
|
|
199
208
|
func dispose() {
|
|
200
209
|
stateObservation?.cancel()
|
|
201
210
|
stateObservation = nil
|
|
211
|
+
transactionIdObservation?.cancel()
|
|
212
|
+
transactionIdObservation = nil
|
|
202
213
|
eventTask?.cancel()
|
|
203
214
|
eventTask = nil
|
|
204
215
|
onState = nil
|
|
205
216
|
onEvent = nil
|
|
217
|
+
onTransactionId = nil
|
|
206
218
|
sessionHandler = nil
|
|
207
219
|
lastPreparedHandle = nil
|
|
208
220
|
client = nil
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CHECKOUT_BUTTON_FALLBACK_HEIGHT = void 0;
|
|
7
|
+
exports.CheckoutButton = CheckoutButton;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
10
|
+
var _OnramperCheckoutButtonView = require("./OnramperCheckoutButtonView.js");
|
|
11
|
+
// Height of the bare Buy button. Used until native reports the measured content
|
|
12
|
+
// height so the first frame isn't collapsed.
|
|
13
|
+
const CHECKOUT_BUTTON_FALLBACK_HEIGHT = exports.CHECKOUT_BUTTON_FALLBACK_HEIGHT = 56;
|
|
14
|
+
/**
|
|
15
|
+
* Sizes the native checkout button to its SwiftUI content. The content grows when
|
|
16
|
+
* the SDK shows ToS text under the Buy button (which can change after mount), and
|
|
17
|
+
* Yoga can't measure a SwiftUI view — so native reports the height and it is
|
|
18
|
+
* applied here as an explicit `height`.
|
|
19
|
+
*/
|
|
20
|
+
function CheckoutButton({
|
|
21
|
+
intentHandle
|
|
22
|
+
}) {
|
|
23
|
+
const [height, setHeight] = (0, _react.useState)(null);
|
|
24
|
+
const onContentHeightChange = (0, _react.useMemo)(() => (0, _reactNativeNitroModules.callback)(h => setHeight(Math.ceil(h))), []);
|
|
25
|
+
return /*#__PURE__*/(0, _react.createElement)(_OnramperCheckoutButtonView.OnramperCheckoutButtonView, {
|
|
26
|
+
intentHandle,
|
|
27
|
+
onContentHeightChange,
|
|
28
|
+
style: {
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: height ?? CHECKOUT_BUTTON_FALLBACK_HEIGHT
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=CheckoutButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeNitroModules","_OnramperCheckoutButtonView","CHECKOUT_BUTTON_FALLBACK_HEIGHT","exports","CheckoutButton","intentHandle","height","setHeight","useState","onContentHeightChange","useMemo","callback","h","Math","ceil","createElement","OnramperCheckoutButtonView","style","width"],"sourceRoot":"../../src","sources":["CheckoutButton.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAF,OAAA;AAEA;AACA;AACO,MAAMG,+BAA+B,GAAAC,OAAA,CAAAD,+BAAA,GAAG,EAAE;AAMjD;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAAC;EAAEC;AAAkC,CAAC,EAAE;EACpE,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAgB,IAAI,CAAC;EACzD,MAAMC,qBAAqB,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAAC,iCAAQ,EAAEC,CAAS,IAAKL,SAAS,CAACM,IAAI,CAACC,IAAI,CAACF,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EACjG,oBAAO,IAAAG,oBAAa,EAACC,sDAA0B,EAAE;IAC/CX,YAAY;IACZI,qBAAqB;IACrBQ,KAAK,EAAE;MAAEC,KAAK,EAAE,MAAM;MAAEZ,MAAM,EAAEA,MAAM,IAAIJ;IAAgC;EAC5E,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.OnramperClient = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var
|
|
8
|
+
var _CheckoutButton = require("./CheckoutButton.js");
|
|
9
9
|
var _OnramperNative = require("./OnramperNative.js");
|
|
10
10
|
var _errors = require("./errors.js");
|
|
11
11
|
/**
|
|
@@ -19,11 +19,13 @@ class OnramperClient {
|
|
|
19
19
|
kind: 'idle'
|
|
20
20
|
};
|
|
21
21
|
lastError = null;
|
|
22
|
+
currentTransactionId = null;
|
|
22
23
|
|
|
23
24
|
// Each client owns its own native instance (and thus its own SDK client).
|
|
24
25
|
native = (0, _OnramperNative.createOnramperNative)();
|
|
25
26
|
stateListeners = new Set();
|
|
26
27
|
eventListeners = new Set();
|
|
28
|
+
transactionIdListeners = new Set();
|
|
27
29
|
|
|
28
30
|
// Resolved when the constructor-issued configure() completes. Public methods
|
|
29
31
|
// that need the native client await this first.
|
|
@@ -37,11 +39,21 @@ class OnramperClient {
|
|
|
37
39
|
for (const fn of this.stateListeners) fn(s);
|
|
38
40
|
});
|
|
39
41
|
|
|
40
|
-
// Single native checkout-event callback →
|
|
42
|
+
// Single native checkout-event callback → keep the transaction ID mirror
|
|
43
|
+
// synchronized at finalization, then fan out to checkout listeners.
|
|
41
44
|
this.native.setEventListener(json => {
|
|
42
45
|
const e = JSON.parse(json);
|
|
46
|
+
if (e.type === 'checkoutFinalized') {
|
|
47
|
+
this.updateCurrentTransactionId(e.response.onramperTransactionId);
|
|
48
|
+
}
|
|
43
49
|
for (const fn of this.eventListeners) fn(e);
|
|
44
50
|
});
|
|
51
|
+
this.native.setTransactionIdListener(transactionId => {
|
|
52
|
+
// The SDK transiently publishes nil while re-preparing after the payment
|
|
53
|
+
// sheet is dismissed. The finalized transaction ID remains durable across
|
|
54
|
+
// that attempt change; only explicit reset()/signOut() clear the JS mirror.
|
|
55
|
+
if (transactionId !== undefined) this.updateCurrentTransactionId(transactionId);
|
|
56
|
+
});
|
|
45
57
|
|
|
46
58
|
// The SDK calls this when its session expires; return fresh credentials.
|
|
47
59
|
// Nitro stores the async callback natively and awaits it directly — no
|
|
@@ -68,6 +80,17 @@ class OnramperClient {
|
|
|
68
80
|
// before calling initialize(). The error still surfaces via initialize().
|
|
69
81
|
this.configured.catch(() => undefined);
|
|
70
82
|
}
|
|
83
|
+
updateCurrentTransactionId(next) {
|
|
84
|
+
if (next === this.currentTransactionId) return;
|
|
85
|
+
this.currentTransactionId = next;
|
|
86
|
+
for (const fn of [...this.transactionIdListeners]) {
|
|
87
|
+
try {
|
|
88
|
+
fn(next);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Onramper transaction ID listener threw:', error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
71
94
|
async initialize(creds) {
|
|
72
95
|
try {
|
|
73
96
|
await this.configured;
|
|
@@ -80,6 +103,7 @@ class OnramperClient {
|
|
|
80
103
|
try {
|
|
81
104
|
await this.configured;
|
|
82
105
|
await this.native.reset();
|
|
106
|
+
this.updateCurrentTransactionId(null);
|
|
83
107
|
} catch (e) {
|
|
84
108
|
throw _errors.OnramperError.from(e);
|
|
85
109
|
}
|
|
@@ -95,6 +119,7 @@ class OnramperClient {
|
|
|
95
119
|
try {
|
|
96
120
|
await this.configured;
|
|
97
121
|
await this.native.signOut();
|
|
122
|
+
this.updateCurrentTransactionId(null);
|
|
98
123
|
} catch (e) {
|
|
99
124
|
throw _errors.OnramperError.from(e);
|
|
100
125
|
}
|
|
@@ -120,12 +145,8 @@ class OnramperClient {
|
|
|
120
145
|
await this.configured;
|
|
121
146
|
const result = await this.native.getCheckoutRequirements(JSON.stringify(request), JSON.stringify(prefill), JSON.stringify(buttonStyle));
|
|
122
147
|
const quote = JSON.parse(result.quoteJson);
|
|
123
|
-
const button = /*#__PURE__*/(0, _react.createElement)(
|
|
124
|
-
intentHandle: result.intentHandle
|
|
125
|
-
style: {
|
|
126
|
-
width: '100%',
|
|
127
|
-
minHeight: 56
|
|
128
|
-
}
|
|
148
|
+
const button = /*#__PURE__*/(0, _react.createElement)(_CheckoutButton.CheckoutButton, {
|
|
149
|
+
intentHandle: result.intentHandle
|
|
129
150
|
});
|
|
130
151
|
return {
|
|
131
152
|
button,
|
|
@@ -149,6 +170,14 @@ class OnramperClient {
|
|
|
149
170
|
};
|
|
150
171
|
}
|
|
151
172
|
|
|
173
|
+
/** Subscribe to the durable Onramper transaction ID. Successful reset/signOut publish null. */
|
|
174
|
+
addTransactionIdListener(fn) {
|
|
175
|
+
this.transactionIdListeners.add(fn);
|
|
176
|
+
return () => {
|
|
177
|
+
this.transactionIdListeners.delete(fn);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
152
181
|
/** Subscribe to a specific checkout event. Returns an unsubscribe function. */
|
|
153
182
|
addEventListener(name, fn) {
|
|
154
183
|
const wrapper = e => {
|
|
@@ -164,6 +193,7 @@ class OnramperClient {
|
|
|
164
193
|
destroy() {
|
|
165
194
|
this.stateListeners.clear();
|
|
166
195
|
this.eventListeners.clear();
|
|
196
|
+
this.transactionIdListeners.clear();
|
|
167
197
|
this.native.dispose();
|
|
168
198
|
}
|
|
169
199
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","
|
|
1
|
+
{"version":3,"names":["_react","require","_CheckoutButton","_OnramperNative","_errors","OnramperClient","state","kind","lastError","currentTransactionId","native","createOnramperNative","stateListeners","Set","eventListeners","transactionIdListeners","constructor","config","setStateListener","json","s","JSON","parse","OnramperError","from","error","fn","setEventListener","e","type","updateCurrentTransactionId","response","onramperTransactionId","setTransactionIdListener","transactionId","undefined","setSessionExpirationHandler","creds","onSessionExpired","sessionId","sessionToken","configured","configure","apiKey","clientId","environment","theme","logLevel","catch","err","next","console","initialize","reset","signOut","getCheckoutRequirements","request","buttonStyle","prefill","result","stringify","quote","quoteJson","button","createElement","CheckoutButton","intentHandle","cancelPreparedIntent","addStateListener","add","delete","addTransactionIdListener","addEventListener","name","wrapper","destroy","clear","dispose","exports"],"sourceRoot":"../../src","sources":["OnramperClient.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAmBA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,cAAc,CAAC;EAC1BC,KAAK,GAAkB;IAAEC,IAAI,EAAE;EAAO,CAAC;EACvCC,SAAS,GAAyB,IAAI;EACtCC,oBAAoB,GAAkB,IAAI;;EAE1C;EACiBC,MAAM,GAAG,IAAAC,oCAAoB,EAAC,CAAC;EAE/BC,cAAc,GAAG,IAAIC,GAAG,CAAiC,CAAC;EAC1DC,cAAc,GAAG,IAAID,GAAG,CAAiC,CAAC;EAC1DE,sBAAsB,GAAG,IAAIF,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O,CAAC,CAAC;EACvB;AACF;AAACC,OAAA,CAAAzE,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement, useMemo, useState } from 'react';
|
|
4
|
+
import { callback } from 'react-native-nitro-modules';
|
|
5
|
+
import { OnramperCheckoutButtonView } from "./OnramperCheckoutButtonView.js";
|
|
6
|
+
|
|
7
|
+
// Height of the bare Buy button. Used until native reports the measured content
|
|
8
|
+
// height so the first frame isn't collapsed.
|
|
9
|
+
export const CHECKOUT_BUTTON_FALLBACK_HEIGHT = 56;
|
|
10
|
+
/**
|
|
11
|
+
* Sizes the native checkout button to its SwiftUI content. The content grows when
|
|
12
|
+
* the SDK shows ToS text under the Buy button (which can change after mount), and
|
|
13
|
+
* Yoga can't measure a SwiftUI view — so native reports the height and it is
|
|
14
|
+
* applied here as an explicit `height`.
|
|
15
|
+
*/
|
|
16
|
+
export function CheckoutButton({
|
|
17
|
+
intentHandle
|
|
18
|
+
}) {
|
|
19
|
+
const [height, setHeight] = useState(null);
|
|
20
|
+
const onContentHeightChange = useMemo(() => callback(h => setHeight(Math.ceil(h))), []);
|
|
21
|
+
return /*#__PURE__*/createElement(OnramperCheckoutButtonView, {
|
|
22
|
+
intentHandle,
|
|
23
|
+
onContentHeightChange,
|
|
24
|
+
style: {
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: height ?? CHECKOUT_BUTTON_FALLBACK_HEIGHT
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=CheckoutButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElement","useMemo","useState","callback","OnramperCheckoutButtonView","CHECKOUT_BUTTON_FALLBACK_HEIGHT","CheckoutButton","intentHandle","height","setHeight","onContentHeightChange","h","Math","ceil","style","width"],"sourceRoot":"../../src","sources":["CheckoutButton.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxD,SAASC,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,0BAA0B,QAAQ,iCAA8B;;AAEzE;AACA;AACA,OAAO,MAAMC,+BAA+B,GAAG,EAAE;AAMjD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC;AAAkC,CAAC,EAAE;EACpE,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGP,QAAQ,CAAgB,IAAI,CAAC;EACzD,MAAMQ,qBAAqB,GAAGT,OAAO,CAAC,MAAME,QAAQ,CAAEQ,CAAS,IAAKF,SAAS,CAACG,IAAI,CAACC,IAAI,CAACF,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;EACjG,oBAAOX,aAAa,CAACI,0BAA0B,EAAE;IAC/CG,YAAY;IACZG,qBAAqB;IACrBI,KAAK,EAAE;MAAEC,KAAK,EAAE,MAAM;MAAEP,MAAM,EAAEA,MAAM,IAAIH;IAAgC;EAC5E,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { createElement } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { CheckoutButton } from "./CheckoutButton.js";
|
|
5
5
|
import { createOnramperNative } from "./OnramperNative.js";
|
|
6
6
|
import { OnramperError } from "./errors.js";
|
|
7
7
|
/**
|
|
@@ -15,11 +15,13 @@ export class OnramperClient {
|
|
|
15
15
|
kind: 'idle'
|
|
16
16
|
};
|
|
17
17
|
lastError = null;
|
|
18
|
+
currentTransactionId = null;
|
|
18
19
|
|
|
19
20
|
// Each client owns its own native instance (and thus its own SDK client).
|
|
20
21
|
native = createOnramperNative();
|
|
21
22
|
stateListeners = new Set();
|
|
22
23
|
eventListeners = new Set();
|
|
24
|
+
transactionIdListeners = new Set();
|
|
23
25
|
|
|
24
26
|
// Resolved when the constructor-issued configure() completes. Public methods
|
|
25
27
|
// that need the native client await this first.
|
|
@@ -33,11 +35,21 @@ export class OnramperClient {
|
|
|
33
35
|
for (const fn of this.stateListeners) fn(s);
|
|
34
36
|
});
|
|
35
37
|
|
|
36
|
-
// Single native checkout-event callback →
|
|
38
|
+
// Single native checkout-event callback → keep the transaction ID mirror
|
|
39
|
+
// synchronized at finalization, then fan out to checkout listeners.
|
|
37
40
|
this.native.setEventListener(json => {
|
|
38
41
|
const e = JSON.parse(json);
|
|
42
|
+
if (e.type === 'checkoutFinalized') {
|
|
43
|
+
this.updateCurrentTransactionId(e.response.onramperTransactionId);
|
|
44
|
+
}
|
|
39
45
|
for (const fn of this.eventListeners) fn(e);
|
|
40
46
|
});
|
|
47
|
+
this.native.setTransactionIdListener(transactionId => {
|
|
48
|
+
// The SDK transiently publishes nil while re-preparing after the payment
|
|
49
|
+
// sheet is dismissed. The finalized transaction ID remains durable across
|
|
50
|
+
// that attempt change; only explicit reset()/signOut() clear the JS mirror.
|
|
51
|
+
if (transactionId !== undefined) this.updateCurrentTransactionId(transactionId);
|
|
52
|
+
});
|
|
41
53
|
|
|
42
54
|
// The SDK calls this when its session expires; return fresh credentials.
|
|
43
55
|
// Nitro stores the async callback natively and awaits it directly — no
|
|
@@ -64,6 +76,17 @@ export class OnramperClient {
|
|
|
64
76
|
// before calling initialize(). The error still surfaces via initialize().
|
|
65
77
|
this.configured.catch(() => undefined);
|
|
66
78
|
}
|
|
79
|
+
updateCurrentTransactionId(next) {
|
|
80
|
+
if (next === this.currentTransactionId) return;
|
|
81
|
+
this.currentTransactionId = next;
|
|
82
|
+
for (const fn of [...this.transactionIdListeners]) {
|
|
83
|
+
try {
|
|
84
|
+
fn(next);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('Onramper transaction ID listener threw:', error);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
67
90
|
async initialize(creds) {
|
|
68
91
|
try {
|
|
69
92
|
await this.configured;
|
|
@@ -76,6 +99,7 @@ export class OnramperClient {
|
|
|
76
99
|
try {
|
|
77
100
|
await this.configured;
|
|
78
101
|
await this.native.reset();
|
|
102
|
+
this.updateCurrentTransactionId(null);
|
|
79
103
|
} catch (e) {
|
|
80
104
|
throw OnramperError.from(e);
|
|
81
105
|
}
|
|
@@ -91,6 +115,7 @@ export class OnramperClient {
|
|
|
91
115
|
try {
|
|
92
116
|
await this.configured;
|
|
93
117
|
await this.native.signOut();
|
|
118
|
+
this.updateCurrentTransactionId(null);
|
|
94
119
|
} catch (e) {
|
|
95
120
|
throw OnramperError.from(e);
|
|
96
121
|
}
|
|
@@ -116,12 +141,8 @@ export class OnramperClient {
|
|
|
116
141
|
await this.configured;
|
|
117
142
|
const result = await this.native.getCheckoutRequirements(JSON.stringify(request), JSON.stringify(prefill), JSON.stringify(buttonStyle));
|
|
118
143
|
const quote = JSON.parse(result.quoteJson);
|
|
119
|
-
const button = /*#__PURE__*/createElement(
|
|
120
|
-
intentHandle: result.intentHandle
|
|
121
|
-
style: {
|
|
122
|
-
width: '100%',
|
|
123
|
-
minHeight: 56
|
|
124
|
-
}
|
|
144
|
+
const button = /*#__PURE__*/createElement(CheckoutButton, {
|
|
145
|
+
intentHandle: result.intentHandle
|
|
125
146
|
});
|
|
126
147
|
return {
|
|
127
148
|
button,
|
|
@@ -145,6 +166,14 @@ export class OnramperClient {
|
|
|
145
166
|
};
|
|
146
167
|
}
|
|
147
168
|
|
|
169
|
+
/** Subscribe to the durable Onramper transaction ID. Successful reset/signOut publish null. */
|
|
170
|
+
addTransactionIdListener(fn) {
|
|
171
|
+
this.transactionIdListeners.add(fn);
|
|
172
|
+
return () => {
|
|
173
|
+
this.transactionIdListeners.delete(fn);
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
148
177
|
/** Subscribe to a specific checkout event. Returns an unsubscribe function. */
|
|
149
178
|
addEventListener(name, fn) {
|
|
150
179
|
const wrapper = e => {
|
|
@@ -160,6 +189,7 @@ export class OnramperClient {
|
|
|
160
189
|
destroy() {
|
|
161
190
|
this.stateListeners.clear();
|
|
162
191
|
this.eventListeners.clear();
|
|
192
|
+
this.transactionIdListeners.clear();
|
|
163
193
|
this.native.dispose();
|
|
164
194
|
}
|
|
165
195
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createElement","
|
|
1
|
+
{"version":3,"names":["createElement","CheckoutButton","createOnramperNative","OnramperError","OnramperClient","state","kind","lastError","currentTransactionId","native","stateListeners","Set","eventListeners","transactionIdListeners","constructor","config","setStateListener","json","s","JSON","parse","from","error","fn","setEventListener","e","type","updateCurrentTransactionId","response","onramperTransactionId","setTransactionIdListener","transactionId","undefined","setSessionExpirationHandler","creds","onSessionExpired","sessionId","sessionToken","configured","configure","apiKey","clientId","environment","theme","logLevel","catch","err","next","console","initialize","reset","signOut","getCheckoutRequirements","request","buttonStyle","prefill","result","stringify","quote","quoteJson","button","intentHandle","cancelPreparedIntent","addStateListener","add","delete","addTransactionIdListener","addEventListener","name","wrapper","destroy","clear","dispose"],"sourceRoot":"../../src","sources":["OnramperClient.ts"],"mappings":";;AAAA,SAA4BA,aAAa,QAAQ,OAAO;AAExD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,oBAAoB,QAAQ,qBAAkB;AACvD,SAASC,aAAa,QAAQ,aAAU;AAmBxC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,CAAC;EAC1BC,KAAK,GAAkB;IAAEC,IAAI,EAAE;EAAO,CAAC;EACvCC,SAAS,GAAyB,IAAI;EACtCC,oBAAoB,GAAkB,IAAI;;EAE1C;EACiBC,MAAM,GAAGP,oBAAoB,CAAC,CAAC;EAE/BQ,cAAc,GAAG,IAAIC,GAAG,CAAiC,CAAC;EAC1DC,cAAc,GAAG,IAAID,GAAG,CAAiC,CAAC;EAC1DE,sBAAsB,GAAG,IAAIF,GAAG,CAAyC,CAAC;;EAE3F;EACA;;EAGAG,WAAWA,CAACC,MAA6B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|
|
|
1
|
+
export declare const CHECKOUT_BUTTON_FALLBACK_HEIGHT = 56;
|
|
2
|
+
export interface CheckoutButtonProps {
|
|
3
|
+
intentHandle: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Sizes the native checkout button to its SwiftUI content. The content grows when
|
|
7
|
+
* the SDK shows ToS text under the Buy button (which can change after mount), and
|
|
8
|
+
* Yoga can't measure a SwiftUI view — so native reports the height and it is
|
|
9
|
+
* applied here as an explicit `height`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function CheckoutButton({ intentHandle }: CheckoutButtonProps): import("react").CElement<{
|
|
12
|
+
hybridRef?: import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<import("./OnramperCheckoutButtonView").OnramperCheckoutButtonViewProps, import("./specs/OnramperCheckoutButton.nitro").OnramperCheckoutButtonMethods>) => void) | undefined> | undefined;
|
|
13
|
+
intentHandle: string;
|
|
14
|
+
onContentHeightChange?: import("react-native-nitro-modules").NitroViewWrappedCallback<((height: number) => void) | undefined> | undefined;
|
|
15
|
+
} & import("react-native").ViewProps, import("react").Component<{
|
|
16
|
+
hybridRef?: import("react-native-nitro-modules").NitroViewWrappedCallback<((ref: import("react-native-nitro-modules").HybridView<import("./OnramperCheckoutButtonView").OnramperCheckoutButtonViewProps, import("./specs/OnramperCheckoutButton.nitro").OnramperCheckoutButtonMethods>) => void) | undefined> | undefined;
|
|
17
|
+
intentHandle: string;
|
|
18
|
+
onContentHeightChange?: import("react-native-nitro-modules").NitroViewWrappedCallback<((height: number) => void) | undefined> | undefined;
|
|
19
|
+
} & import("react-native").ViewProps, {}, any> & import("react-native").ReactNativeElement>;
|
|
20
|
+
//# sourceMappingURL=CheckoutButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutButton.d.ts","sourceRoot":"","sources":["../../../../src/CheckoutButton.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;;;;;;;;4FAQnE"}
|
|
@@ -17,11 +17,14 @@ export interface GetCheckoutRequirementsResult {
|
|
|
17
17
|
export declare class OnramperClient {
|
|
18
18
|
state: OnramperState;
|
|
19
19
|
lastError: OnramperError | null;
|
|
20
|
+
currentTransactionId: string | null;
|
|
20
21
|
private readonly native;
|
|
21
22
|
private readonly stateListeners;
|
|
22
23
|
private readonly eventListeners;
|
|
24
|
+
private readonly transactionIdListeners;
|
|
23
25
|
private readonly configured;
|
|
24
26
|
constructor(config: OnramperConfiguration);
|
|
27
|
+
private updateCurrentTransactionId;
|
|
25
28
|
initialize(creds: SessionCredentials): Promise<void>;
|
|
26
29
|
reset(): Promise<void>;
|
|
27
30
|
/**
|
|
@@ -51,6 +54,8 @@ export declare class OnramperClient {
|
|
|
51
54
|
cancelPreparedIntent(intentHandle: string): Promise<void>;
|
|
52
55
|
/** Subscribe to state changes. Returns an unsubscribe function. */
|
|
53
56
|
addStateListener(fn: (state: OnramperState) => void): () => void;
|
|
57
|
+
/** Subscribe to the durable Onramper transaction ID. Successful reset/signOut publish null. */
|
|
58
|
+
addTransactionIdListener(fn: (transactionId: string | null) => void): () => void;
|
|
54
59
|
/** Subscribe to a specific checkout event. Returns an unsubscribe function. */
|
|
55
60
|
addEventListener<K extends EventName>(name: K, fn: (e: EventPayload<K>) => void): () => void;
|
|
56
61
|
/** Tear down: clears JS listeners and releases the native callbacks + SDK client. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnramperClient.d.ts","sourceRoot":"","sources":["../../../../src/OnramperClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,OAAO,CAAC;AAIzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC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CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAqD;IAI5F,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;gBAE/B,MAAM,EAAE,qBAAqB;IAoDzC,OAAO,CAAC,0BAA0B;IAa5B,UAAU,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IASpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAU5B;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B;;;;;;;;;;;;;;OAcG;IACG,uBAAuB,CAC3B,OAAO,EAAE,eAAe,EACxB,WAAW,GAAE,mBAAwB,EACrC,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,6BAA6B,CAAC;IAgBzC,oFAAoF;IACpF,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAOhE,+FAA+F;IAC/F,wBAAwB,CAAC,EAAE,EAAE,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI;IAOhF,+EAA+E;IAC/E,gBAAgB,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI;IAU5F,qFAAqF;IACrF,OAAO,IAAI,IAAI;CAMhB"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-native-nitro-modules';
|
|
2
2
|
export interface OnramperCheckoutButtonProps extends HybridViewProps {
|
|
3
3
|
intentHandle: string;
|
|
4
|
+
/**
|
|
5
|
+
* Called with the hosted SwiftUI content's height (points) whenever it changes —
|
|
6
|
+
* e.g. when ToS text appears under the Buy button. React Native can't measure
|
|
7
|
+
* the SwiftUI content itself, so the JS wrapper applies this as `height`.
|
|
8
|
+
*/
|
|
9
|
+
onContentHeightChange?: (height: number) => void;
|
|
4
10
|
}
|
|
5
11
|
export interface OnramperCheckoutButtonMethods extends HybridViewMethods {
|
|
6
12
|
}
|