@onramper/onramper-react-native 1.2.1 → 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 +33 -0
- package/README.md +1 -1
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64/OnramperSDK.framework/Info.plist +0 -0
- 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 +1268 -1268
- 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/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 +1268 -1268
- package/ios/Frameworks/OnramperSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/OnramperSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/OnramperSDK.yml +1261 -1261
- package/ios/HybridOnramperCheckoutButton.swift +77 -3
- package/lib/commonjs/CheckoutButton.js +34 -0
- package/lib/commonjs/CheckoutButton.js.map +1 -0
- package/lib/commonjs/OnramperClient.js +3 -7
- 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 +3 -7
- 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.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/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.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/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/OnramperReactNative-Swift-Cxx-Bridge.hpp +37 -0
- package/nitrogen/generated/ios/c++/HybridOnramperCheckoutButtonSpecSwift.hpp +9 -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/HybridOnramperCheckoutButtonSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridOnramperCheckoutButtonSpec_cxx.swift +32 -0
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridOnramperCheckoutButtonSpec.hpp +4 -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 +2 -5
- package/src/generated/OnramperCheckoutButtonConfig.json +1 -0
- package/src/specs/OnramperCheckoutButton.nitro.ts +6 -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()
|
|
@@ -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
|
/**
|
|
@@ -145,12 +145,8 @@ class OnramperClient {
|
|
|
145
145
|
await this.configured;
|
|
146
146
|
const result = await this.native.getCheckoutRequirements(JSON.stringify(request), JSON.stringify(prefill), JSON.stringify(buttonStyle));
|
|
147
147
|
const quote = JSON.parse(result.quoteJson);
|
|
148
|
-
const button = /*#__PURE__*/(0, _react.createElement)(
|
|
149
|
-
intentHandle: result.intentHandle
|
|
150
|
-
style: {
|
|
151
|
-
width: '100%',
|
|
152
|
-
minHeight: 56
|
|
153
|
-
}
|
|
148
|
+
const button = /*#__PURE__*/(0, _react.createElement)(_CheckoutButton.CheckoutButton, {
|
|
149
|
+
intentHandle: result.intentHandle
|
|
154
150
|
});
|
|
155
151
|
return {
|
|
156
152
|
button,
|
|
@@ -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,GAAG,CAAyC,CAAC;;EAE3F;EACA;;EAGAG,WAAWA,CAACC,MAA6B,EAAE;IACzC;IACA,IAAI,CAACP,MAAM,CAACQ,gBAAgB,CAAEC,IAAI,IAAK;MACrC,MAAMC,CAAC,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAkB;MAC3C,IAAI,CAACb,KAAK,GAAGc,CAAC;MACd,IAAIA,CAAC,CAACb,IAAI,KAAK,QAAQ,EAAE,IAAI,CAACC,SAAS,GAAGe,qBAAa,CAACC,IAAI,CAACJ,CAAC,CAACK,KAAK,CAAC;MACrE,KAAK,MAAMC,EAAE,IAAI,IAAI,CAACd,cAAc,EAAEc,EAAE,CAACN,CAAC,CAAC;IAC7C,CAAC,CAAC;;IAEF;IACA;IACA,IAAI,CAACV,MAAM,CAACiB,gBAAgB,CAAER,IAAI,IAAK;MACrC,MAAMS,CAAC,GAAGP,IAAI,CAACC,KAAK,CAACH,IAAI,CAAkB;MAC3C,IAAIS,CAAC,CAACC,IAAI,KAAK,mBAAmB,EAAE;QAClC,IAAI,CAACC,0B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EA;EACA8C,gBAAgBA,CAAsBC,IAAO,EAAE/C,EAAgC,EAAc;IAC3F,MAAMgD,OAAO,GAAI9C,CAAgB,IAAK;MACpC,IAAIA,CAAC,CAACC,IAAI,KAAK4C,IAAI,EAAE/C,EAAE,CAACE,CAAoB,CAAC;IAC/C,CAAC;IACD,IAAI,CAACd,cAAc,CAACuD,GAAG,CAACK,OAAO,CAAC;IAChC,OAAO,MAAM;MACX,IAAI,CAAC5D,cAAc,CAACwD,MAAM,CAACI,OAAO,CAAC;IACrC,CAAC;EACH;;EAEA;EACAC,OAAOA,CAAA,EAAS;IACd,IAAI,CAAC/D,cAAc,CAACgE,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC9D,cAAc,CAAC8D,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC7D,sBAAsB,CAAC6D,KAAK,CAAC,CAAC;IACnC,IAAI,CAAClE,MAAM,CAACmE,OAAO,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
|
/**
|
|
@@ -141,12 +141,8 @@ export class OnramperClient {
|
|
|
141
141
|
await this.configured;
|
|
142
142
|
const result = await this.native.getCheckoutRequirements(JSON.stringify(request), JSON.stringify(prefill), JSON.stringify(buttonStyle));
|
|
143
143
|
const quote = JSON.parse(result.quoteJson);
|
|
144
|
-
const button = /*#__PURE__*/createElement(
|
|
145
|
-
intentHandle: result.intentHandle
|
|
146
|
-
style: {
|
|
147
|
-
width: '100%',
|
|
148
|
-
minHeight: 56
|
|
149
|
-
}
|
|
144
|
+
const button = /*#__PURE__*/createElement(CheckoutButton, {
|
|
145
|
+
intentHandle: result.intentHandle
|
|
150
146
|
});
|
|
151
147
|
return {
|
|
152
148
|
button,
|
|
@@ -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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,CAAC,CAACC,IAAI,KAAK0C,IAAI,EAAE7C,EAAE,CAACE,CAAoB,CAAC;IAC/C,CAAC;IACD,IAAI,CAACb,cAAc,CAACoD,GAAG,CAACK,OAAO,CAAC;IAChC,OAAO,MAAM;MACX,IAAI,CAACzD,cAAc,CAACqD,MAAM,CAACI,OAAO,CAAC;IACrC,CAAC;EACH;;EAEA;EACAC,OAAOA,CAAA,EAAS;IACd,IAAI,CAAC5D,cAAc,CAAC6D,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC3D,cAAc,CAAC2D,KAAK,CAAC,CAAC;IAC3B,IAAI,CAAC1D,sBAAsB,CAAC0D,KAAK,CAAC,CAAC;IACnC,IAAI,CAAC9D,MAAM,CAAC+D,OAAO,CAAC,CAAC;EACvB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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"}
|
|
@@ -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;AACzC,OAAO,KAAK,EAAiB,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,6BAA6B;IAC5C,yHAAyH;IACzH,MAAM,EAAE,YAAY,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;;;G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AAC,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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnramperCheckoutButton.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/OnramperCheckoutButton.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKjG,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"OnramperCheckoutButton.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/OnramperCheckoutButton.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKjG,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,6BAA8B,SAAQ,iBAAiB;CAAG;AAE3E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAC7C,2BAA2B,EAC3B,6BAA6B,EAC7B;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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.js").OnramperCheckoutButtonViewProps, import("./specs/OnramperCheckoutButton.nitro.js").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.js").OnramperCheckoutButtonViewProps, import("./specs/OnramperCheckoutButton.nitro.js").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"}
|
|
@@ -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,aAAU,CAAC;AACzC,OAAO,KAAK,EAAiB,SAAS,EAAE,YAAY,EAAE,MAAM,aAAU,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,YAAS,CAAC;AAEjB,MAAM,WAAW,6BAA6B;IAC5C,yHAAyH;IACzH,MAAM,EAAE,YAAY,CAAC;IACrB,wEAAwE;IACxE,KAAK,EAAE,aAAa,CAAC;CACtB;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,KAAK,EAAE,aAAa,CAAoB;IACxC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAQ;IACvC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6C;IAC5E,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAqD;IAI5F,OAAO,CAAC,QAAQ,CAAC,U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,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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnramperCheckoutButton.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/OnramperCheckoutButton.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKjG,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"OnramperCheckoutButton.nitro.d.ts","sourceRoot":"","sources":["../../../../../src/specs/OnramperCheckoutButton.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKjG,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,6BAA8B,SAAQ,iBAAiB;CAAG;AAE3E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAC7C,2BAA2B,EAC3B,6BAA6B,EAC7B;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CACjB,CAAC"}
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
namespace margelo::nitro::onramper::bridge::swift {
|
|
17
17
|
|
|
18
|
+
// pragma MARK: std::function<void(double /* height */)>
|
|
19
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
|
+
auto swiftClosure = OnramperReactNative::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
21
|
+
return [swiftClosure = std::move(swiftClosure)](double height) mutable -> void {
|
|
22
|
+
swiftClosure.call(height);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
// pragma MARK: std::shared_ptr<HybridOnramperCheckoutButtonSpec>
|
|
19
27
|
std::shared_ptr<HybridOnramperCheckoutButtonSpec> create_std__shared_ptr_HybridOnramperCheckoutButtonSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
20
28
|
OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx swiftPart = OnramperReactNative::HybridOnramperCheckoutButtonSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -43,6 +43,43 @@ namespace OnramperReactNative { class HybridOnramperNitroSpec_cxx; }
|
|
|
43
43
|
*/
|
|
44
44
|
namespace margelo::nitro::onramper::bridge::swift {
|
|
45
45
|
|
|
46
|
+
// pragma MARK: std::function<void(double /* height */)>
|
|
47
|
+
/**
|
|
48
|
+
* Specialized version of `std::function<void(double)>`.
|
|
49
|
+
*/
|
|
50
|
+
using Func_void_double = std::function<void(double /* height */)>;
|
|
51
|
+
/**
|
|
52
|
+
* Wrapper class for a `std::function<void(double / * height * /)>`, this can be used from Swift.
|
|
53
|
+
*/
|
|
54
|
+
class Func_void_double_Wrapper final {
|
|
55
|
+
public:
|
|
56
|
+
explicit Func_void_double_Wrapper(std::function<void(double /* height */)>&& func): _function(std::make_unique<std::function<void(double /* height */)>>(std::move(func))) {}
|
|
57
|
+
inline void call(double height) const noexcept {
|
|
58
|
+
_function->operator()(height);
|
|
59
|
+
}
|
|
60
|
+
private:
|
|
61
|
+
std::unique_ptr<std::function<void(double /* height */)>> _function;
|
|
62
|
+
} SWIFT_NONCOPYABLE;
|
|
63
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
64
|
+
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
|
|
65
|
+
return Func_void_double_Wrapper(std::move(value));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// pragma MARK: std::optional<std::function<void(double /* height */)>>
|
|
69
|
+
/**
|
|
70
|
+
* Specialized version of `std::optional<std::function<void(double / * height * /)>>`.
|
|
71
|
+
*/
|
|
72
|
+
using std__optional_std__function_void_double____height______ = std::optional<std::function<void(double /* height */)>>;
|
|
73
|
+
inline std::optional<std::function<void(double /* height */)>> create_std__optional_std__function_void_double____height______(const std::function<void(double /* height */)>& value) noexcept {
|
|
74
|
+
return std::optional<std::function<void(double /* height */)>>(value);
|
|
75
|
+
}
|
|
76
|
+
inline bool has_value_std__optional_std__function_void_double____height______(const std::optional<std::function<void(double /* height */)>>& optional) noexcept {
|
|
77
|
+
return optional.has_value();
|
|
78
|
+
}
|
|
79
|
+
inline std::function<void(double /* height */)> get_std__optional_std__function_void_double____height______(const std::optional<std::function<void(double /* height */)>>& optional) noexcept {
|
|
80
|
+
return optional.value();
|
|
81
|
+
}
|
|
82
|
+
|
|
46
83
|
// pragma MARK: std::shared_ptr<HybridOnramperCheckoutButtonSpec>
|
|
47
84
|
/**
|
|
48
85
|
* Specialized version of `std::shared_ptr<HybridOnramperCheckoutButtonSpec>`.
|
|
@@ -15,6 +15,8 @@ namespace OnramperReactNative { class HybridOnramperCheckoutButtonSpec_cxx; }
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
#include <string>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <optional>
|
|
18
20
|
|
|
19
21
|
#include "OnramperReactNative-Swift-Cxx-Umbrella.hpp"
|
|
20
22
|
|
|
@@ -69,6 +71,13 @@ namespace margelo::nitro::onramper {
|
|
|
69
71
|
inline void setIntentHandle(const std::string& intentHandle) noexcept override {
|
|
70
72
|
_swiftPart.setIntentHandle(intentHandle);
|
|
71
73
|
}
|
|
74
|
+
inline std::optional<std::function<void(double /* height */)>> getOnContentHeightChange() noexcept override {
|
|
75
|
+
auto __result = _swiftPart.getOnContentHeightChange();
|
|
76
|
+
return __result;
|
|
77
|
+
}
|
|
78
|
+
inline void setOnContentHeightChange(const std::optional<std::function<void(double /* height */)>>& onContentHeightChange) noexcept override {
|
|
79
|
+
_swiftPart.setOnContentHeightChange(onContentHeightChange);
|
|
80
|
+
}
|
|
72
81
|
|
|
73
82
|
public:
|
|
74
83
|
// Methods
|
|
@@ -84,6 +84,11 @@ using namespace margelo::nitro::onramper::views;
|
|
|
84
84
|
swiftPart.setIntentHandle(newViewProps.intentHandle.value);
|
|
85
85
|
newViewProps.intentHandle.isDirty = false;
|
|
86
86
|
}
|
|
87
|
+
// onContentHeightChange: optional
|
|
88
|
+
if (newViewProps.onContentHeightChange.isDirty) {
|
|
89
|
+
swiftPart.setOnContentHeightChange(newViewProps.onContentHeightChange.value);
|
|
90
|
+
newViewProps.onContentHeightChange.isDirty = false;
|
|
91
|
+
}
|
|
87
92
|
|
|
88
93
|
swiftPart.afterUpdate();
|
|
89
94
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.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 `(_ height: Double) -> 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_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.onramper.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ height: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ height: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(height: Double) -> Void {
|
|
25
|
+
self.closure(height)
|
|
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_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
44
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|