react-native-klarna-inapp-sdk 2.4.10 → 2.5.0
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/README.md +2 -1
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/KlarnaMobileSDKPackage.java +5 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/checkout/KlarnaCheckoutViewManager.java +4 -10
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/WebViewResizeObserver.java +28 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/event/ComponentEventSender.java +5 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/ui/ResizeObserverWrapperView.java +2 -2
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/ui/WrapperView.java +2 -2
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/common/ui/YogaLayoutHelper.java +39 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/expresscheckout/KlarnaExpressCheckoutViewCallback.kt +30 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/expresscheckout/KlarnaExpressCheckoutViewEventSender.kt +80 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/expresscheckout/KlarnaExpressCheckoutViewManager.java +544 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewEventHandler.java +30 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewEventSender.java +64 -0
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewManager.java +356 -0
- package/android/src/newarch/java/com/klarna/mobile/sdk/reactnative/spec/RNKlarnaExpressCheckoutViewSpec.java +31 -0
- package/android/src/newarch/java/com/klarna/mobile/sdk/reactnative/spec/RNKlarnaOSMViewSpec.java +31 -0
- package/android/src/oldarch/java/com/klarna/mobile/sdk/reactnative/spec/RNKlarnaExpressCheckoutViewSpec.java +36 -0
- package/android/src/oldarch/java/com/klarna/mobile/sdk/reactnative/spec/RNKlarnaOSMViewSpec.java +32 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/KlarnaMobileSDKPackageTest.java +5 -1
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/common/ui/YogaLayoutHelperTest.java +79 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/expresscheckout/KlarnaExpressCheckoutViewManagerTest.java +259 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewEventHandlerTest.java +136 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewEventSenderTest.java +184 -0
- package/android/src/test/java/com/klarna/mobile/sdk/reactnative/osm/KlarnaOSMViewManagerTest.java +385 -0
- package/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj +55 -1
- package/ios/Sources/KlarnaExpressCheckoutViewManager.h +5 -0
- package/ios/Sources/KlarnaExpressCheckoutViewManager.mm +39 -0
- package/ios/Sources/KlarnaOSMViewManager.h +5 -0
- package/ios/Sources/KlarnaOSMViewManager.mm +59 -0
- package/ios/Sources/view/KlarnaExpressCheckoutButtonDelegateProxy.swift +145 -0
- package/ios/Sources/view/KlarnaExpressCheckoutViewWrapper.h +41 -0
- package/ios/Sources/view/KlarnaOSMViewWrapper.h +48 -0
- package/ios/Sources/view/newarch/KlarnaExpressCheckoutViewWrapper.mm +228 -0
- package/ios/Sources/view/newarch/KlarnaOSMViewWrapper.mm +294 -0
- package/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm +20 -13
- package/ios/Sources/view/oldarch/KlarnaExpressCheckoutViewWrapper.mm +222 -0
- package/ios/Sources/view/oldarch/KlarnaOSMViewWrapper.mm +273 -0
- package/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm +11 -13
- package/ios/Tests/KlarnaExpressCheckoutViewWrapperTests.m +391 -0
- package/ios/Tests/KlarnaOSMViewWrapperTests.m +450 -0
- package/ios/Tests/KlarnaStandaloneWebViewWrapperTests.m +105 -0
- package/lib/commonjs/KlarnaExpressCheckoutView.js +75 -0
- package/lib/commonjs/KlarnaExpressCheckoutView.js.map +1 -0
- package/lib/commonjs/KlarnaOSMView.js +94 -0
- package/lib/commonjs/KlarnaOSMView.js.map +1 -0
- package/lib/commonjs/index.js +99 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/KlarnaExpressCheckoutViewNativeComponent.js +11 -0
- package/lib/commonjs/specs/KlarnaExpressCheckoutViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/KlarnaOSMViewNativeComponent.js +16 -0
- package/lib/commonjs/specs/KlarnaOSMViewNativeComponent.js.map +1 -0
- package/lib/commonjs/types/button/KlarnaButtonShape.js +14 -0
- package/lib/commonjs/types/button/KlarnaButtonShape.js.map +1 -0
- package/lib/commonjs/types/button/KlarnaButtonStyle.js +13 -0
- package/lib/commonjs/types/button/KlarnaButtonStyle.js.map +1 -0
- package/lib/commonjs/types/button/KlarnaButtonTheme.js +14 -0
- package/lib/commonjs/types/button/KlarnaButtonTheme.js.map +1 -0
- package/lib/commonjs/types/common/KlarnaExpressCheckoutSessionOptions.js +9 -0
- package/lib/commonjs/types/common/KlarnaExpressCheckoutSessionOptions.js.map +1 -0
- package/lib/commonjs/types/common/KlarnaOSMPlacementKey.js +2 -0
- package/lib/commonjs/types/common/KlarnaOSMPlacementKey.js.map +1 -0
- package/lib/commonjs/types/common/KlarnaTheme.js +14 -0
- package/lib/commonjs/types/common/KlarnaTheme.js.map +1 -0
- package/lib/module/KlarnaExpressCheckoutView.js +64 -0
- package/lib/module/KlarnaExpressCheckoutView.js.map +1 -0
- package/lib/module/KlarnaOSMView.js +84 -0
- package/lib/module/KlarnaOSMView.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/KlarnaExpressCheckoutViewNativeComponent.js +3 -0
- package/lib/module/specs/KlarnaExpressCheckoutViewNativeComponent.js.map +1 -0
- package/lib/module/specs/KlarnaOSMViewNativeComponent.js +7 -0
- package/lib/module/specs/KlarnaOSMViewNativeComponent.js.map +1 -0
- package/lib/module/types/button/KlarnaButtonShape.js +7 -0
- package/lib/module/types/button/KlarnaButtonShape.js.map +1 -0
- package/lib/module/types/button/KlarnaButtonStyle.js +6 -0
- package/lib/module/types/button/KlarnaButtonStyle.js.map +1 -0
- package/lib/module/types/button/KlarnaButtonTheme.js +7 -0
- package/lib/module/types/button/KlarnaButtonTheme.js.map +1 -0
- package/lib/module/types/common/KlarnaExpressCheckoutSessionOptions.js +2 -0
- package/lib/module/types/common/KlarnaExpressCheckoutSessionOptions.js.map +1 -0
- package/lib/module/types/common/KlarnaOSMPlacementKey.js +2 -0
- package/lib/module/types/common/KlarnaOSMPlacementKey.js.map +1 -0
- package/lib/module/types/common/KlarnaTheme.js +7 -0
- package/lib/module/types/common/KlarnaTheme.js.map +1 -0
- package/lib/typescript/KlarnaExpressCheckoutView.d.ts +47 -0
- package/lib/typescript/KlarnaExpressCheckoutView.d.ts.map +1 -0
- package/lib/typescript/KlarnaOSMView.d.ts +36 -0
- package/lib/typescript/KlarnaOSMView.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/specs/KlarnaExpressCheckoutViewNativeComponent.d.ts +45 -0
- package/lib/typescript/specs/KlarnaExpressCheckoutViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/KlarnaOSMViewNativeComponent.d.ts +35 -0
- package/lib/typescript/specs/KlarnaOSMViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/types/button/KlarnaButtonShape.d.ts +6 -0
- package/lib/typescript/types/button/KlarnaButtonShape.d.ts.map +1 -0
- package/lib/typescript/types/button/KlarnaButtonStyle.d.ts +5 -0
- package/lib/typescript/types/button/KlarnaButtonStyle.d.ts.map +1 -0
- package/lib/typescript/types/button/KlarnaButtonTheme.d.ts +6 -0
- package/lib/typescript/types/button/KlarnaButtonTheme.d.ts.map +1 -0
- package/lib/typescript/types/common/KlarnaExpressCheckoutSessionOptions.d.ts +10 -0
- package/lib/typescript/types/common/KlarnaExpressCheckoutSessionOptions.d.ts.map +1 -0
- package/lib/typescript/types/common/KlarnaOSMPlacementKey.d.ts +2 -0
- package/lib/typescript/types/common/KlarnaOSMPlacementKey.d.ts.map +1 -0
- package/lib/typescript/types/common/KlarnaTheme.d.ts +6 -0
- package/lib/typescript/types/common/KlarnaTheme.d.ts.map +1 -0
- package/package.json +5 -3
- package/react-native-klarna-inapp-sdk.podspec +2 -1
- package/src/KlarnaExpressCheckoutView.tsx +169 -0
- package/src/KlarnaOSMView.tsx +157 -0
- package/src/index.tsx +9 -0
- package/src/specs/KlarnaExpressCheckoutViewNativeComponent.ts +66 -0
- package/src/specs/KlarnaOSMViewNativeComponent.ts +50 -0
- package/src/types/button/KlarnaButtonShape.ts +5 -0
- package/src/types/button/KlarnaButtonStyle.ts +4 -0
- package/src/types/button/KlarnaButtonTheme.ts +5 -0
- package/src/types/common/KlarnaExpressCheckoutSessionOptions.ts +13 -0
- package/src/types/common/KlarnaOSMPlacementKey.ts +3 -0
- package/src/types/common/KlarnaTheme.ts +5 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React, { Component, type RefObject } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
type NativeMethods,
|
|
4
|
+
type NativeSyntheticEvent,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import type { KlarnaMobileSDKError } from './types/common/KlarnaMobileSDKError';
|
|
9
|
+
import type { KlarnaOSMPlacementKey } from './types/common/KlarnaOSMPlacementKey';
|
|
10
|
+
import { KlarnaEnvironment } from './types/common/KlarnaEnvironment';
|
|
11
|
+
import { KlarnaRegion } from './types/common/KlarnaRegion';
|
|
12
|
+
import { KlarnaTheme } from './types/common/KlarnaTheme';
|
|
13
|
+
import RNKlarnaOSMView, {
|
|
14
|
+
Commands as RNKlarnaOSMViewCommands,
|
|
15
|
+
type RNKlarnaOSMViewProps,
|
|
16
|
+
} from './specs/KlarnaOSMViewNativeComponent';
|
|
17
|
+
|
|
18
|
+
export interface KlarnaOSMViewProps {
|
|
19
|
+
style?: ViewStyle;
|
|
20
|
+
readonly clientId: string;
|
|
21
|
+
readonly placementKey: KlarnaOSMPlacementKey;
|
|
22
|
+
readonly locale: string;
|
|
23
|
+
readonly purchaseAmount: string;
|
|
24
|
+
readonly environment: KlarnaEnvironment;
|
|
25
|
+
readonly region: KlarnaRegion;
|
|
26
|
+
readonly theme?: KlarnaTheme;
|
|
27
|
+
readonly backgroundColor?: string;
|
|
28
|
+
readonly textColor?: string;
|
|
29
|
+
readonly returnUrl?: string;
|
|
30
|
+
readonly onError?: (error: KlarnaMobileSDKError) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface KlarnaOSMViewState {
|
|
34
|
+
nativeViewHeight: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class KlarnaOSMView extends Component<
|
|
38
|
+
KlarnaOSMViewProps,
|
|
39
|
+
KlarnaOSMViewState
|
|
40
|
+
> {
|
|
41
|
+
private osmViewRef: RefObject<
|
|
42
|
+
Component<RNKlarnaOSMViewProps> & Readonly<NativeMethods>
|
|
43
|
+
>;
|
|
44
|
+
private isOSMViewReady = false;
|
|
45
|
+
private hasError = false;
|
|
46
|
+
|
|
47
|
+
constructor(props: KlarnaOSMViewProps) {
|
|
48
|
+
super(props);
|
|
49
|
+
this.state = {
|
|
50
|
+
nativeViewHeight: 0,
|
|
51
|
+
};
|
|
52
|
+
this.osmViewRef = React.createRef();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentDidUpdate(prevProps: KlarnaOSMViewProps) {
|
|
56
|
+
if (
|
|
57
|
+
this.isOSMViewReady &&
|
|
58
|
+
(prevProps.clientId !== this.props.clientId ||
|
|
59
|
+
prevProps.placementKey !== this.props.placementKey ||
|
|
60
|
+
prevProps.locale !== this.props.locale ||
|
|
61
|
+
prevProps.purchaseAmount !== this.props.purchaseAmount ||
|
|
62
|
+
prevProps.environment !== this.props.environment ||
|
|
63
|
+
prevProps.region !== this.props.region ||
|
|
64
|
+
prevProps.theme !== this.props.theme ||
|
|
65
|
+
prevProps.backgroundColor !== this.props.backgroundColor ||
|
|
66
|
+
prevProps.textColor !== this.props.textColor)
|
|
67
|
+
) {
|
|
68
|
+
this.renderNative();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
componentWillUnmount() {
|
|
73
|
+
this.isOSMViewReady = false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
render() {
|
|
77
|
+
return (
|
|
78
|
+
<RNKlarnaOSMView
|
|
79
|
+
ref={this.osmViewRef}
|
|
80
|
+
style={[
|
|
81
|
+
styles.container,
|
|
82
|
+
this.props.style,
|
|
83
|
+
{ height: this.state.nativeViewHeight },
|
|
84
|
+
]}
|
|
85
|
+
clientId={this.props.clientId}
|
|
86
|
+
placementKey={this.props.placementKey}
|
|
87
|
+
locale={this.props.locale}
|
|
88
|
+
purchaseAmount={this.props.purchaseAmount}
|
|
89
|
+
environment={this.props.environment}
|
|
90
|
+
region={this.props.region}
|
|
91
|
+
theme={this.props.theme ?? KlarnaTheme.Automatic}
|
|
92
|
+
backgroundColor={this.props.backgroundColor ?? ''}
|
|
93
|
+
textColor={this.props.textColor ?? ''}
|
|
94
|
+
returnUrl={this.props.returnUrl ?? ''}
|
|
95
|
+
onError={(
|
|
96
|
+
event: NativeSyntheticEvent<
|
|
97
|
+
Readonly<{
|
|
98
|
+
readonly error: Readonly<{
|
|
99
|
+
readonly isFatal: boolean;
|
|
100
|
+
readonly message: string;
|
|
101
|
+
readonly name: string;
|
|
102
|
+
}>;
|
|
103
|
+
}>
|
|
104
|
+
>
|
|
105
|
+
) => {
|
|
106
|
+
const mobileSdkError: KlarnaMobileSDKError = {
|
|
107
|
+
isFatal: event.nativeEvent.error.isFatal,
|
|
108
|
+
message: event.nativeEvent.error.message,
|
|
109
|
+
name: event.nativeEvent.error.name,
|
|
110
|
+
};
|
|
111
|
+
this.hasError = true;
|
|
112
|
+
this.setState({ nativeViewHeight: 0 });
|
|
113
|
+
this.props.onError?.(mobileSdkError);
|
|
114
|
+
}}
|
|
115
|
+
onResized={(
|
|
116
|
+
event: NativeSyntheticEvent<
|
|
117
|
+
Readonly<{
|
|
118
|
+
readonly height: string;
|
|
119
|
+
}>
|
|
120
|
+
>
|
|
121
|
+
) => {
|
|
122
|
+
if (this.hasError) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const newHeight = Number(event.nativeEvent.height);
|
|
126
|
+
if (
|
|
127
|
+
!Number.isNaN(newHeight) &&
|
|
128
|
+
newHeight !== this.state.nativeViewHeight
|
|
129
|
+
) {
|
|
130
|
+
this.setState({ nativeViewHeight: newHeight });
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
onOSMViewReady={() => {
|
|
134
|
+
this.isOSMViewReady = true;
|
|
135
|
+
setTimeout(() => this.renderNative(), 0);
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private renderNative = () => {
|
|
142
|
+
this.hasError = false;
|
|
143
|
+
const view = this.osmViewRef.current;
|
|
144
|
+
if (view != null) {
|
|
145
|
+
RNKlarnaOSMViewCommands.render(view);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const styles = StyleSheet.create({
|
|
151
|
+
container: {
|
|
152
|
+
width: '100%',
|
|
153
|
+
overflow: 'hidden',
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export default KlarnaOSMView;
|
package/src/index.tsx
CHANGED
|
@@ -2,3 +2,12 @@ export * from './KlarnaPaymentView';
|
|
|
2
2
|
export * from './KlarnaStandaloneWebView';
|
|
3
3
|
export * from './KlarnaCheckoutView';
|
|
4
4
|
export * from './KlarnaSignInSDK';
|
|
5
|
+
export * from './KlarnaExpressCheckoutView';
|
|
6
|
+
export * from './types/common/KlarnaEnvironment';
|
|
7
|
+
export * from './types/common/KlarnaRegion';
|
|
8
|
+
export * from './types/common/KlarnaExpressCheckoutSessionOptions';
|
|
9
|
+
export * from './types/button/KlarnaButtonTheme';
|
|
10
|
+
export * from './types/button/KlarnaButtonShape';
|
|
11
|
+
export * from './types/button/KlarnaButtonStyle';
|
|
12
|
+
export * from './KlarnaOSMView';
|
|
13
|
+
export * from './types/common/KlarnaTheme';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import type { HostComponent } from 'react-native';
|
|
4
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
5
|
+
|
|
6
|
+
export interface RNKlarnaExpressCheckoutViewProps extends ViewProps {
|
|
7
|
+
// Session configuration
|
|
8
|
+
readonly sessionType: string;
|
|
9
|
+
readonly clientId: string;
|
|
10
|
+
readonly clientToken: string;
|
|
11
|
+
|
|
12
|
+
// Required configuration
|
|
13
|
+
readonly locale: string;
|
|
14
|
+
readonly environment: string;
|
|
15
|
+
readonly region: string;
|
|
16
|
+
readonly returnUrl: string;
|
|
17
|
+
|
|
18
|
+
// Style props
|
|
19
|
+
readonly theme: string;
|
|
20
|
+
readonly shape: string;
|
|
21
|
+
readonly buttonStyle: string;
|
|
22
|
+
|
|
23
|
+
// Optional configuration
|
|
24
|
+
readonly autoFinalize: boolean;
|
|
25
|
+
readonly collectShippingAddress: boolean;
|
|
26
|
+
readonly sessionData: string;
|
|
27
|
+
|
|
28
|
+
// Events
|
|
29
|
+
readonly onAuthorized: DirectEventHandler<
|
|
30
|
+
Readonly<{
|
|
31
|
+
readonly authorizationResponse: Readonly<{
|
|
32
|
+
readonly showForm: boolean;
|
|
33
|
+
readonly approved: boolean;
|
|
34
|
+
readonly finalizedRequired: boolean;
|
|
35
|
+
readonly clientToken: string;
|
|
36
|
+
readonly authorizationToken: string;
|
|
37
|
+
readonly sessionId: string;
|
|
38
|
+
readonly collectedShippingAddress: string;
|
|
39
|
+
readonly merchantReference1: string;
|
|
40
|
+
readonly merchantReference2: string;
|
|
41
|
+
}>;
|
|
42
|
+
}>
|
|
43
|
+
>;
|
|
44
|
+
readonly onError: DirectEventHandler<
|
|
45
|
+
Readonly<{
|
|
46
|
+
readonly error: Readonly<{
|
|
47
|
+
readonly isFatal: boolean;
|
|
48
|
+
readonly message: string;
|
|
49
|
+
readonly name: string;
|
|
50
|
+
}>;
|
|
51
|
+
}>
|
|
52
|
+
>;
|
|
53
|
+
readonly onResized: DirectEventHandler<
|
|
54
|
+
Readonly<{
|
|
55
|
+
// number not supported for events
|
|
56
|
+
readonly height: string;
|
|
57
|
+
}>
|
|
58
|
+
>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type KlarnaExpressCheckoutViewNativeComponentType =
|
|
62
|
+
HostComponent<RNKlarnaExpressCheckoutViewProps>;
|
|
63
|
+
|
|
64
|
+
export default codegenNativeComponent<RNKlarnaExpressCheckoutViewProps>(
|
|
65
|
+
'RNKlarnaExpressCheckoutView'
|
|
66
|
+
) as KlarnaExpressCheckoutViewNativeComponentType;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import type { HostComponent } from 'react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
|
|
8
|
+
export interface RNKlarnaOSMViewProps extends ViewProps {
|
|
9
|
+
readonly clientId: string;
|
|
10
|
+
readonly placementKey: string;
|
|
11
|
+
readonly locale: string;
|
|
12
|
+
readonly purchaseAmount: string;
|
|
13
|
+
readonly environment: string;
|
|
14
|
+
readonly region: string;
|
|
15
|
+
readonly theme: string;
|
|
16
|
+
readonly backgroundColor: string;
|
|
17
|
+
readonly textColor: string;
|
|
18
|
+
readonly returnUrl?: string;
|
|
19
|
+
readonly onError: DirectEventHandler<
|
|
20
|
+
Readonly<{
|
|
21
|
+
readonly error: Readonly<{
|
|
22
|
+
readonly isFatal: boolean;
|
|
23
|
+
readonly message: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
}>;
|
|
26
|
+
}>
|
|
27
|
+
>;
|
|
28
|
+
readonly onResized: DirectEventHandler<
|
|
29
|
+
Readonly<{
|
|
30
|
+
// number not supported for events
|
|
31
|
+
readonly height: string;
|
|
32
|
+
}>
|
|
33
|
+
>;
|
|
34
|
+
readonly onOSMViewReady?: DirectEventHandler<{}>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type KlarnaOSMViewNativeComponentType = HostComponent<RNKlarnaOSMViewProps>;
|
|
38
|
+
|
|
39
|
+
interface RNKlarnaOSMViewNativeCommands {
|
|
40
|
+
render: (viewRef: React.ElementRef<KlarnaOSMViewNativeComponentType>) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Commands: RNKlarnaOSMViewNativeCommands =
|
|
44
|
+
codegenNativeCommands<RNKlarnaOSMViewNativeCommands>({
|
|
45
|
+
supportedCommands: ['render'],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default codegenNativeComponent<RNKlarnaOSMViewProps>(
|
|
49
|
+
'RNKlarnaOSMView'
|
|
50
|
+
) as KlarnaOSMViewNativeComponentType;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export namespace KlarnaExpressCheckoutSessionOptions {
|
|
2
|
+
export interface ClientSideSession {
|
|
3
|
+
readonly clientId: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface ServerSideSession {
|
|
7
|
+
readonly clientToken: string;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type KlarnaExpressCheckoutSessionOptions =
|
|
12
|
+
| KlarnaExpressCheckoutSessionOptions.ClientSideSession
|
|
13
|
+
| KlarnaExpressCheckoutSessionOptions.ServerSideSession;
|