react-native-klarna-inapp-sdk 2.2.1 → 2.2.3
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 +8 -167
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/standalonewebview/KlarnaStandaloneWebViewEventSender.java +11 -1
- package/android/src/main/java/com/klarna/mobile/sdk/reactnative/standalonewebview/KlarnaStandaloneWebViewManager.java +2 -2
- package/ios/RNKlarnaMobileSDK.xcodeproj/project.pbxproj +1 -1
- package/ios/Sources/view/newarch/KlarnaStandaloneWebViewWrapper.mm +19 -6
- package/ios/Sources/view/oldarch/KlarnaStandaloneWebViewWrapper.mm +15 -1
- package/lib/commonjs/KlarnaStandaloneWebView.js +9 -1
- package/lib/commonjs/KlarnaStandaloneWebView.js.map +1 -1
- package/lib/commonjs/specs/KlarnaStandaloneWebViewNativeComponent.js.map +1 -1
- package/lib/module/KlarnaStandaloneWebView.js +9 -1
- package/lib/module/KlarnaStandaloneWebView.js.map +1 -1
- package/lib/module/specs/KlarnaStandaloneWebViewNativeComponent.js.map +1 -1
- package/lib/typescript/KlarnaStandaloneWebView.d.ts +4 -1
- package/lib/typescript/KlarnaStandaloneWebView.d.ts.map +1 -1
- package/lib/typescript/specs/KlarnaStandaloneWebViewNativeComponent.d.ts +2 -1
- package/lib/typescript/specs/KlarnaStandaloneWebViewNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-klarna-inapp-sdk.podspec +1 -1
- package/src/KlarnaStandaloneWebView.tsx +12 -6
- package/src/specs/KlarnaStandaloneWebViewNativeComponent.ts +2 -3
package/README.md
CHANGED
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
[![NPM][npm-badge]][npm-url]
|
|
4
4
|
[![React Native][dependency-badge]][dependency-url]
|
|
5
|
-
[![
|
|
5
|
+
[![Platform][platform-badge]][platform-url]
|
|
6
6
|
[![License][license-badge]][license-url]
|
|
7
7
|
[![Developed at Klarna][klarna-badge]][klarna-url]
|
|
8
8
|
|
|
9
9
|
This library wraps Klarna Mobile SDK and exposes its functionality as React Native components. It
|
|
10
|
-
currently
|
|
10
|
+
currently has the following components:
|
|
11
|
+
- `KlarnaPaymentView` to integrate Klarna Payments,
|
|
12
|
+
- `KlarnaStandaloneWebView` to integrate Klarna Standalone WebView.
|
|
11
13
|
|
|
12
14
|
This repository also includes a test application that you can use to see how it works.
|
|
13
15
|
|
|
14
16
|
### SDK for Other Platforms
|
|
15
17
|
|
|
16
|
-
* [Android](https://github.com/klarna/klarna-mobile-sdk)
|
|
18
|
+
* [Android](https://github.com/klarna/klarna-mobile-sdk-android)
|
|
17
19
|
* [iOS](https://github.com/klarna/klarna-mobile-sdk)
|
|
18
20
|
* [Flutter](https://github.com/klarna/klarna-mobile-sdk-flutter)
|
|
19
21
|
|
|
@@ -24,9 +26,7 @@ This repository also includes a test application that you can use to see how it
|
|
|
24
26
|
### Documentations
|
|
25
27
|
|
|
26
28
|
* [Overview](https://docs.klarna.com/mobile-sdk/)
|
|
27
|
-
* [
|
|
28
|
-
* [iOS](https://docs.klarna.com/mobile-sdk/ios/)
|
|
29
|
-
* [React Native](https://docs.klarna.com/mobile-sdk/reactnative/)
|
|
29
|
+
* [Using the Mobile SDK on React Native](https://docs.klarna.com/mobile-sdk/reactnative/)
|
|
30
30
|
|
|
31
31
|
## Getting started
|
|
32
32
|
|
|
@@ -65,165 +65,6 @@ allprojects {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Usage
|
|
72
|
-
|
|
73
|
-
You can import the `KlarnaPaymentView` from the library. You'll then be able to add it as a
|
|
74
|
-
component to your app. This component exposes callbacks as props and methods you can call via the
|
|
75
|
-
component's ref.
|
|
76
|
-
|
|
77
|
-
The view will self-size height-wise and grow it fill it containing view's width.
|
|
78
|
-
|
|
79
|
-
### Props
|
|
80
|
-
|
|
81
|
-
It has the following props:
|
|
82
|
-
|
|
83
|
-
| Name | Type | Description |
|
|
84
|
-
|-------------------------| --- |-------------------------------------------------------------------------------|
|
|
85
|
-
| `category` | `String` | The payment method category you want to render in your view. |
|
|
86
|
-
| `returnUrl` | `String` | An app-defined URL scheme the component uses to return customers to your app. |
|
|
87
|
-
| `onInitialized` | `() => {}` | The initialize call completed. |
|
|
88
|
-
| `onLoaded` | `() => {}` | The load call completed. |
|
|
89
|
-
| `onLoadedPaymentReview` | `() => {}` | The load payment review call completed. |
|
|
90
|
-
| `onAuthorized` | `(approved, authToken, finalizeRequired) => {}` | The authorize call completed. |
|
|
91
|
-
| `onReauthorized` | `(approved, authToken) => {}` | The reauthorize call completed. |
|
|
92
|
-
| `onFinalized` | `(approved, authToken) => {}` | The finalize call completed. |
|
|
93
|
-
| `onError` | `(error) => {}` | An error occurred. |
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
#### Return URL
|
|
98
|
-
|
|
99
|
-
You can read more about how the return URL works and how to add it tou your iOS application [here](https://developers.klarna.com/documentation/in-app/ios/getting-started/#return-url) and for your Android application [here](https://developers.klarna.com/documentation/in-app/android/getting-started/#return-url).
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
### Prop callback parameters
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
#### approved: `boolean`
|
|
108
|
-
|
|
109
|
-
Determines whether the previous operation was successful and yielded an authorization token.
|
|
110
|
-
|
|
111
|
-
##### Available on:
|
|
112
|
-
- `onAuthorized`
|
|
113
|
-
- `onReauthorized`
|
|
114
|
-
- `onFinalized`
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
#### authToken: `string | null`
|
|
119
|
-
|
|
120
|
-
If `authorize()`, `reauthorize()` or `finalize()` succeeded, they will return a token you can submit
|
|
121
|
-
to your backend.
|
|
122
|
-
|
|
123
|
-
##### Available on:
|
|
124
|
-
- `onAuthorized`
|
|
125
|
-
- `onReauthorized`
|
|
126
|
-
- `onFinalized`
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
#### finalizeRequired: `boolean | null`
|
|
131
|
-
|
|
132
|
-
If `authorize()` requires that you additionally call `finalize()`, .
|
|
133
|
-
|
|
134
|
-
##### Available on:
|
|
135
|
-
- `onAuthorized`
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
#### error: `KlarnaPaymentsSDKError`
|
|
140
|
-
|
|
141
|
-
If a method failed, `onError()` will let you know via an error object. Contains `name`, `message`,
|
|
142
|
-
`action`, `isFatal`, `sessionId` properties.
|
|
143
|
-
|
|
144
|
-
##### Available on:
|
|
145
|
-
- `onError`
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
### View methods
|
|
151
|
-
|
|
152
|
-
Each payment view exposes a set of methods via a view's ref. You can see in the test app or in the
|
|
153
|
-
below example how these can be called. The methods are the following:
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
#### initialize()
|
|
158
|
-
Initializes the view with a session token. You have to have added the view to your application and
|
|
159
|
-
supplied a payment method category.
|
|
160
|
-
|
|
161
|
-
##### Parameters
|
|
162
|
-
|
|
163
|
-
| Name | Type | Description |
|
|
164
|
-
|---------|----------|--------------------------------------------------|
|
|
165
|
-
| clientToken | `string` | The client token you get from Klarna Payments API. |
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
#### load()
|
|
170
|
-
Loads the view. This will render content in the view.
|
|
171
|
-
|
|
172
|
-
##### Parameters
|
|
173
|
-
|
|
174
|
-
| Name | Type | Description |
|
|
175
|
-
| ---- |-----------------------|------------|
|
|
176
|
-
| sessionData | `string \| undefined` | A JSON object with updated session data serialized into a string.|
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
#### loadPaymentReview()
|
|
181
|
-
Renders a description of the payment terms your customer has agreed to.
|
|
182
|
-
|
|
183
|
-
Once a session is authorized, you can then either render a payment review in the existing
|
|
184
|
-
payment view or `initialize()` a new payment view with the same session token and call this method.
|
|
185
|
-
|
|
186
|
-
##### Note:
|
|
187
|
-
This only works with specific payment methods and countries.
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
#### authorize()
|
|
192
|
-
Authorizes the payment session.
|
|
193
|
-
|
|
194
|
-
##### Parameters
|
|
195
|
-
|
|
196
|
-
| Name | Type | Description |
|
|
197
|
-
| ---- |------------------------|----------------------------------------------------------------------|
|
|
198
|
-
| autoFinalize | `boolean \| undefined` | A flag used to turn on/off auto-finalization for direct bank transfer. |
|
|
199
|
-
| sessionData | `string \| undefined` | A JSON object with updated session data serialized into a string.|
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
#### reauthorize()
|
|
204
|
-
If the details of the session (e.g. cart contents, customer data) have changed, call this to update
|
|
205
|
-
the session and get a new authorization token.
|
|
206
|
-
|
|
207
|
-
##### Parameters
|
|
208
|
-
|
|
209
|
-
| Name | Type | Description |
|
|
210
|
-
| ---- |-----------------------| ----------- |
|
|
211
|
-
| sessionData | `string \| undefined` | A JSON object with updated session data serialized into a string.|
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
#### finalize()
|
|
216
|
-
If a specific payment method needs you to trigger a second authorization, call finalize when you're
|
|
217
|
-
ready.
|
|
218
|
-
|
|
219
|
-
##### Parameters
|
|
220
|
-
|
|
221
|
-
| Name | Type | Description |
|
|
222
|
-
| ---- |-----------------------|------------|
|
|
223
|
-
| sessionData | `String \| undefined` | A JSON object with updated session data serialized into a string.|
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
68
|
## Support
|
|
228
69
|
|
|
229
70
|
If you are having any issues using the SDK in your project or if you think that something is wrong with the SDK itself, please follow our [support guide](https://github.com/klarna/react-native-klarna-inapp-sdk/blob/master/SUPPORT.md).
|
|
@@ -242,8 +83,8 @@ This project is licensed under
|
|
|
242
83
|
[npm-url]: https://www.npmjs.com/package/react-native-klarna-inapp-sdk
|
|
243
84
|
[dependency-badge]: https://img.shields.io/npm/dependency-version/react-native-klarna-inapp-sdk/peer/react-native?style=flat-square
|
|
244
85
|
[dependency-url]: https://www.npmjs.com/package/react-native-klarna-inapp-sdk?activeTab=dependencies
|
|
245
|
-
[
|
|
246
|
-
[
|
|
86
|
+
[platform-badge]: https://img.shields.io/badge/platform-React%20Native-lightgrey?style=flat-square
|
|
87
|
+
[platform-url]: https://reactnative.dev
|
|
247
88
|
[license-badge]: https://img.shields.io/github/license/klarna/react-native-klarna-inapp-sdk?style=flat-square
|
|
248
89
|
[license-url]: https://github.com/klarna/react-native-klarna-inapp-sdk/blob/master/LICENSE
|
|
249
90
|
[klarna-badge]: https://img.shields.io/badge/%20-Developed%20at%20Klarna-black?labelColor=ffb3c7&style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAALQAAAAAQAAAtAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAABCgAwAEAAAAAQAAAA4AAAAA0LMKiwAAAAlwSFlzAABuugAAbroB1t6xFwAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAVBJREFUKBVtkz0vREEUhsdXgo5qJXohkUgQ0fgFNFpR2V5ClP6CQu9PiB6lEL1I7B9A4/treZ47c252s97k2ffMmZkz5869m1JKL/AFbzAHaiRbmsIf4BdaMAZqMFsOXNxXkroKbxCPV5l8yHOJLVipn9/vEreLa7FguSN3S2ynA/ATeQuI8tTY6OOY34DQaQnq9mPCDtxoBwuRxPfAvPMWnARlB12KAi6eLTPruOOP4gcl33O6+Sjgc83DJkRH+h2MgorLzaPy68W48BG2S+xYnmAa1L+nOxEduMH3fgjGFvZeVkANZau68B6CrgJxWosFFpF7iG+h5wKZqwt42qIJtARu/ix+gqsosEq8D35o6R3c7OL4lAnTDljEe9B3Qa2BYzmHemDCt6Diwo6JY7E+A82OnN9HuoBruAQvUQ1nSxP4GVzBDRyBfygf6RW2/gD3NmEv+K/DZgAAAABJRU5ErkJggg==
|
package/android/build.gradle
CHANGED
|
@@ -108,7 +108,7 @@ dependencies {
|
|
|
108
108
|
//noinspection GradleDynamicVersion
|
|
109
109
|
implementation "com.facebook.react:react-native:${getExtOrFallback('reactnativeVersion', '+')}"
|
|
110
110
|
|
|
111
|
-
implementation 'com.klarna.mobile:sdk:2.6.
|
|
111
|
+
implementation 'com.klarna.mobile:sdk:2.6.14'
|
|
112
112
|
|
|
113
113
|
testImplementation "junit:junit:4.13"
|
|
114
114
|
testImplementation 'androidx.test:core:1.2.0'
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
8
8
|
import com.facebook.react.bridge.WritableMap;
|
|
9
9
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
10
10
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
11
|
+
import com.google.gson.Gson;
|
|
11
12
|
import com.klarna.mobile.sdk.api.KlarnaProductEvent;
|
|
12
13
|
import com.klarna.mobile.sdk.api.standalonewebview.KlarnaStandaloneWebView;
|
|
13
14
|
import com.klarna.mobile.sdk.reactnative.common.ArgumentsUtil;
|
|
@@ -35,8 +36,10 @@ public class KlarnaStandaloneWebViewEventSender {
|
|
|
35
36
|
private static final String PARAM_NAME_PROGRESS = "progress";
|
|
36
37
|
private static final String PARAM_NAME_LOADING = "loading";
|
|
37
38
|
private static final String PARAM_NAME_ACTION = "action";
|
|
39
|
+
private static final String PARAM_NAME_PARAMS = "params";
|
|
38
40
|
private static final String PARAM_NAME_DID_CRASH = "didCrash";
|
|
39
41
|
|
|
42
|
+
private final Gson gson = new Gson();
|
|
40
43
|
private final Map<WeakReference<KlarnaStandaloneWebView>, EventDispatcher> viewToDispatcher;
|
|
41
44
|
|
|
42
45
|
KlarnaStandaloneWebViewEventSender(@NonNull final Map<WeakReference<KlarnaStandaloneWebView>, EventDispatcher> viewToDispatcher) {
|
|
@@ -52,7 +55,7 @@ public class KlarnaStandaloneWebViewEventSender {
|
|
|
52
55
|
postEventForView(KlarnaStandaloneWebViewEvent.Event.ON_LOAD_PROGRESS, params, view);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
public void
|
|
58
|
+
public void sendNavigationErrorEvent(@Nullable KlarnaStandaloneWebView view, int code, String description) {
|
|
56
59
|
WritableMap webViewMap = buildWebViewMap(view, null);
|
|
57
60
|
webViewMap.putDouble(PARAM_NAME_CODE, code);
|
|
58
61
|
webViewMap.putString(PARAM_NAME_DESCRIPTION, description);
|
|
@@ -71,8 +74,15 @@ public class KlarnaStandaloneWebViewEventSender {
|
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
public void sendKlarnaMessageEvent(@Nullable KlarnaStandaloneWebView view, @NonNull KlarnaProductEvent klarnaProductEvent) {
|
|
77
|
+
String paramsJson = "{}";
|
|
78
|
+
try {
|
|
79
|
+
paramsJson = gson.toJson(klarnaProductEvent.getParams());
|
|
80
|
+
} catch (Exception ignored) {
|
|
81
|
+
}
|
|
82
|
+
String finalParamsJson = paramsJson;
|
|
74
83
|
ReadableMap eventMap = ArgumentsUtil.createMap(new HashMap<String, Object>() {{
|
|
75
84
|
put(PARAM_NAME_ACTION, klarnaProductEvent.getAction());
|
|
85
|
+
put(PARAM_NAME_PARAMS, finalParamsJson);
|
|
76
86
|
}});
|
|
77
87
|
WritableMap params = ArgumentsUtil.createMap(new HashMap<String, Object>() {{
|
|
78
88
|
put(PARAM_NAME_KLARNA_MESSAGE_EVENT, eventMap);
|
|
@@ -71,13 +71,13 @@ public class KlarnaStandaloneWebViewManager extends RNKlarnaStandaloneWebViewSpe
|
|
|
71
71
|
@Override
|
|
72
72
|
public void onReceivedError(@Nullable KlarnaStandaloneWebView view, @Nullable WebResourceRequest request, @Nullable WebResourceError error) {
|
|
73
73
|
if (error != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
74
|
-
klarnaStandaloneWebViewEventSender.
|
|
74
|
+
klarnaStandaloneWebViewEventSender.sendNavigationErrorEvent(view, error.getErrorCode(), error.getDescription().toString());
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
@Override
|
|
79
79
|
public void onReceivedError(@Nullable KlarnaStandaloneWebView view, int errorCode, @Nullable String description, @Nullable String failingUrl) {
|
|
80
|
-
klarnaStandaloneWebViewEventSender.
|
|
80
|
+
klarnaStandaloneWebViewEventSender.sendNavigationErrorEvent(view, errorCode, description);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
@Override
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
"${PODS_ROOT}/Target Support Files/Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests/Pods-RNKlarnaMobileSDK-RNKlarnaMobileSDKTests-frameworks.sh",
|
|
317
317
|
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework/double-conversion",
|
|
318
318
|
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework/glog",
|
|
319
|
-
"${PODS_XCFRAMEWORKS_BUILD_DIR}/KlarnaMobileSDK/
|
|
319
|
+
"${PODS_XCFRAMEWORKS_BUILD_DIR}/KlarnaMobileSDK/basic/KlarnaMobileSDK.framework/KlarnaMobileSDK",
|
|
320
320
|
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL",
|
|
321
321
|
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
|
|
322
322
|
);
|
|
@@ -17,14 +17,14 @@ using namespace facebook::react;
|
|
|
17
17
|
|
|
18
18
|
@interface KlarnaStandaloneWebViewWrapper () <KlarnaStandaloneWebViewDelegate, KlarnaEventHandler, RCTRNKlarnaStandaloneWebViewViewProtocol>
|
|
19
19
|
|
|
20
|
-
@property (nonatomic, strong) KlarnaStandaloneWebView*
|
|
20
|
+
@property (nonatomic, strong) KlarnaStandaloneWebView *klarnaStandaloneWebView;
|
|
21
21
|
|
|
22
22
|
@end
|
|
23
23
|
|
|
24
24
|
@implementation KlarnaStandaloneWebViewWrapper
|
|
25
25
|
|
|
26
26
|
// The property name in KlarnaStandaloneWebView that we want to observe for changes
|
|
27
|
-
NSString *
|
|
27
|
+
NSString *const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
28
28
|
|
|
29
29
|
- (id)init {
|
|
30
30
|
self = [super init];
|
|
@@ -43,7 +43,7 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
43
43
|
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
|
44
44
|
if ([keyPath isEqualToString:PROPERTY_NAME_ESTIMATED_PROGRESS]) {
|
|
45
45
|
// newProgress is a value in range [0..1].
|
|
46
|
-
NSNumber *
|
|
46
|
+
NSNumber *newProgress = [change objectForKey:NSKeyValueChangeNewKey];
|
|
47
47
|
// We need to convert it to an int value in range [0..100]
|
|
48
48
|
int progress = [NSNumber numberWithDouble:(newProgress.doubleValue * 100)].intValue;
|
|
49
49
|
[self sendLoadProgressEvent:progress];
|
|
@@ -55,8 +55,8 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
55
55
|
- (void)sendLoadProgressEvent:(int)progress {
|
|
56
56
|
if (_eventEmitter) {
|
|
57
57
|
RCTLogInfo(@"Sending onLoadProgress event");
|
|
58
|
-
NSString *
|
|
59
|
-
NSString *
|
|
58
|
+
NSString *url = self.klarnaStandaloneWebView.url == nil ? @"" : self.klarnaStandaloneWebView.url.absoluteString;
|
|
59
|
+
NSString *title = self.klarnaStandaloneWebView.title == nil ? @"" : self.klarnaStandaloneWebView.title;
|
|
60
60
|
std::dynamic_pointer_cast<const RNKlarnaStandaloneWebViewEventEmitter>(_eventEmitter)
|
|
61
61
|
->onLoadProgress(RNKlarnaStandaloneWebViewEventEmitter::OnLoadProgress{
|
|
62
62
|
.progressEvent = {
|
|
@@ -124,7 +124,7 @@ Class<RCTComponentViewProtocol>RNKlarnaStandaloneWebViewCls(void)
|
|
|
124
124
|
const auto &newViewProps = *std::static_pointer_cast<RNKlarnaStandaloneWebViewProps const>(props);
|
|
125
125
|
|
|
126
126
|
if (oldViewProps.returnUrl != newViewProps.returnUrl) {
|
|
127
|
-
NSString *
|
|
127
|
+
NSString *newReturnUrl = [[NSString alloc] initWithUTF8String: newViewProps.returnUrl.c_str()];
|
|
128
128
|
self.klarnaStandaloneWebView.returnURL = [NSURL URLWithString:newReturnUrl];
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -226,6 +226,7 @@ Class<RCTComponentViewProtocol>RNKlarnaStandaloneWebViewCls(void)
|
|
|
226
226
|
->onKlarnaMessage(RNKlarnaStandaloneWebViewEventEmitter::OnKlarnaMessage{
|
|
227
227
|
.klarnaMessageEvent = {
|
|
228
228
|
.action = std::string([[event action] UTF8String]),
|
|
229
|
+
.params = std::string([[self serializeDictionaryToJsonString: [event getParams]] UTF8String])
|
|
229
230
|
}
|
|
230
231
|
});
|
|
231
232
|
} else {
|
|
@@ -260,6 +261,18 @@ Class<RCTComponentViewProtocol>RNKlarnaStandaloneWebViewCls(void)
|
|
|
260
261
|
[self.klarnaStandaloneWebView reload];
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
- (NSString *)serializeDictionaryToJsonString:(NSDictionary<NSString *, id<NSCoding>> *)dictionary {
|
|
265
|
+
NSError *error;
|
|
266
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:&error];
|
|
267
|
+
|
|
268
|
+
if (!jsonData) {
|
|
269
|
+
return @"{}";
|
|
270
|
+
} else {
|
|
271
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
272
|
+
return jsonString;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
263
276
|
@end
|
|
264
277
|
|
|
265
278
|
#endif
|
|
@@ -166,9 +166,11 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
166
166
|
RCTLog(@"Missing 'onKlarnaMessage' callback prop.");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
+
|
|
169
170
|
self.onKlarnaMessage(@{
|
|
170
171
|
@"klarnaMessageEvent": @{
|
|
171
|
-
@"action": event.action
|
|
172
|
+
@"action": event.action,
|
|
173
|
+
@"params": [self serializeDictionaryToJsonString: [event getParams]]
|
|
172
174
|
}
|
|
173
175
|
});
|
|
174
176
|
}
|
|
@@ -179,6 +181,18 @@ NSString * const PROPERTY_NAME_ESTIMATED_PROGRESS = @"estimatedProgress";
|
|
|
179
181
|
|
|
180
182
|
#pragma mark - Events
|
|
181
183
|
|
|
184
|
+
- (NSString *)serializeDictionaryToJsonString:(NSDictionary<NSString *, id<NSCoding>> *)dictionary {
|
|
185
|
+
NSError *error;
|
|
186
|
+
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictionary options:NSJSONWritingPrettyPrinted error:&error];
|
|
187
|
+
|
|
188
|
+
if (!jsonData) {
|
|
189
|
+
return @"{}";
|
|
190
|
+
} else {
|
|
191
|
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
192
|
+
return jsonString;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
182
196
|
- (NSMutableDictionary<NSString *, id> *)webViewDict:(KlarnaStandaloneWebView * _Nonnull)webView {
|
|
183
197
|
NSDictionary *event = @{
|
|
184
198
|
@"url": webView.url.absoluteString ?: @"",
|
|
@@ -40,7 +40,15 @@ class KlarnaStandaloneWebView extends _react.Component {
|
|
|
40
40
|
},
|
|
41
41
|
onKlarnaMessage: event => {
|
|
42
42
|
if (this.props.onKlarnaMessage != null) {
|
|
43
|
-
|
|
43
|
+
const klarnaMessageEvent = event.nativeEvent.klarnaMessageEvent;
|
|
44
|
+
let params = {};
|
|
45
|
+
try {
|
|
46
|
+
params = JSON.parse(klarnaMessageEvent.params);
|
|
47
|
+
} catch (e) {}
|
|
48
|
+
this.props.onKlarnaMessage({
|
|
49
|
+
action: klarnaMessageEvent.action,
|
|
50
|
+
params: params
|
|
51
|
+
});
|
|
44
52
|
}
|
|
45
53
|
},
|
|
46
54
|
onRenderProcessGone: event => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_KlarnaStandaloneWebViewNativeComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","KlarnaStandaloneWebView","Component","constructor","props","standaloneWebViewRef","React","createRef","render","createElement","ref","style","returnUrl","onLoadStart","event","nativeEvent","navigationEvent","onLoadEnd","onError","error","onLoadProgress","progressEvent","onKlarnaMessage","klarnaMessageEvent","onRenderProcessGone","renderProcessGoneEvent","load","url","view","current","RNKlarnaStandaloneWebViewCommands","goForward","goBack","reload","exports","_default"],"sourceRoot":"../../src","sources":["KlarnaStandaloneWebView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAMA,IAAAC,uCAAA,GAAAF,uBAAA,CAAAC,OAAA;AAGwD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GA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CAACV,KAAK,CAACgB,cAAc,IAAI,IAAI,EAAE;UACrC,IAAI,CAAChB,KAAK,CAACgB,cAAc,CAACN,KAAK,CAACC,WAAW,CAACM,aAAa,CAAC;QAC5D;MACF,CAAE;MACFC,eAAe,EACbR,
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_KlarnaStandaloneWebViewNativeComponent","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","KlarnaStandaloneWebView","Component","constructor","props","standaloneWebViewRef","React","createRef","render","createElement","ref","style","returnUrl","onLoadStart","event","nativeEvent","navigationEvent","onLoadEnd","onError","error","onLoadProgress","progressEvent","onKlarnaMessage","klarnaMessageEvent","params","JSON","parse","e","action","onRenderProcessGone","renderProcessGoneEvent","load","url","view","current","RNKlarnaStandaloneWebViewCommands","goForward","goBack","reload","exports","_default"],"sourceRoot":"../../src","sources":["KlarnaStandaloneWebView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAMA,IAAAC,uCAAA,GAAAF,uBAAA,CAAAC,OAAA;AAGwD,SAAAE,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,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;QACH;MACF;IAAE,CACH,CAAC;EAEN;EAEAC,IAAI,GAAIC,GAAW,IAAK;IACtB,MAAMC,IAAI,GAAG,IAAI,CAAC5B,oBAAoB,CAAC6B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChBE,yEAAiC,CAACJ,IAAI,CAACE,IAAI,EAAED,GAAG,CAAC;IACnD;EACF,CAAC;EAEDI,SAAS,GAAGA,CAAA,KAAM;IAChB,MAAMH,IAAI,GAAG,IAAI,CAAC5B,oBAAoB,CAAC6B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChBE,yEAAiC,CAACC,SAAS,CAACH,IAAI,CAAC;IACnD;EACF,CAAC;EAEDI,MAAM,GAAGA,CAAA,KAAM;IACb,MAAMJ,IAAI,GAAG,IAAI,CAAC5B,oBAAoB,CAAC6B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChBE,yEAAiC,CAACE,MAAM,CAACJ,IAAI,CAAC;IAChD;EACF,CAAC;EAEDK,MAAM,GAAGA,CAAA,KAAM;IACb,MAAML,IAAI,GAAG,IAAI,CAAC5B,oBAAoB,CAAC6B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChBE,yEAAiC,CAACG,MAAM,CAACL,IAAI,CAAC;IAChD;EACF,CAAC;AACH;AAACM,OAAA,CAAAtC,uBAAA,GAAAA,uBAAA;AAAA,IAAAuC,QAAA,GAiCcvC,uBAAuB;AAAAsC,OAAA,CAAArD,OAAA,GAAAsD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","obj","__esModule","default","RNKlarnaStandaloneWebViewCommands","codegenNativeCommands","supportedCommands","exports","_default","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/KlarnaStandaloneWebViewNativeComponent.ts"],"mappings":";;;;;;AAEA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2F,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","obj","__esModule","default","RNKlarnaStandaloneWebViewCommands","codegenNativeCommands","supportedCommands","exports","_default","codegenNativeComponent"],"sourceRoot":"../../../src","sources":["specs/KlarnaStandaloneWebViewNativeComponent.ts"],"mappings":";;;;;;AAEA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2F,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAoFpF,MAAMG,iCAA0E,GACrF,IAAAC,8BAAqB,EAA0C;EAC7DC,iBAAiB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ;AAC7D,CAAC,CAAC;AAACC,OAAA,CAAAH,iCAAA,GAAAA,iCAAA;AAAA,IAAAI,QAAA,GAEU,IAAAC,+BAAsB,EACnC,2BACF,CAAC;AAAAF,OAAA,CAAAJ,OAAA,GAAAK,QAAA"}
|
|
@@ -32,7 +32,15 @@ export class KlarnaStandaloneWebView extends Component {
|
|
|
32
32
|
},
|
|
33
33
|
onKlarnaMessage: event => {
|
|
34
34
|
if (this.props.onKlarnaMessage != null) {
|
|
35
|
-
|
|
35
|
+
const klarnaMessageEvent = event.nativeEvent.klarnaMessageEvent;
|
|
36
|
+
let params = {};
|
|
37
|
+
try {
|
|
38
|
+
params = JSON.parse(klarnaMessageEvent.params);
|
|
39
|
+
} catch (e) {}
|
|
40
|
+
this.props.onKlarnaMessage({
|
|
41
|
+
action: klarnaMessageEvent.action,
|
|
42
|
+
params: params
|
|
43
|
+
});
|
|
36
44
|
}
|
|
37
45
|
},
|
|
38
46
|
onRenderProcessGone: event => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Component","RNKlarnaStandaloneWebView","RNKlarnaStandaloneWebViewCommands","KlarnaStandaloneWebView","constructor","props","standaloneWebViewRef","createRef","render","createElement","ref","style","returnUrl","onLoadStart","event","nativeEvent","navigationEvent","onLoadEnd","onError","error","onLoadProgress","progressEvent","onKlarnaMessage","klarnaMessageEvent","onRenderProcessGone","renderProcessGoneEvent","load","url","view","current","goForward","goBack","reload"],"sourceRoot":"../../src","sources":["KlarnaStandaloneWebView.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAwB,OAAO;AAMxD,OAAOC,yBAAyB,IAC9BC,iCAAiC,QAE5B,gDAAgD;AAsBvD,OAAO,MAAMC,uBAAuB,SAASH,SAAS,CAGpD;EAKAI,WAAWA,CAACC,KAAyB,EAAE;IACrC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,oBAAoB,gBAAGP,KAAK,CAACQ,SAAS,CAAC,CAAC;EAC/C;EAEAC,MAAMA,CAAA,EAAG;IACP,oBACET,KAAA,CAAAU,aAAA,CAACR,yBAAyB;MACxBS,GAAG,EAAE,IAAI,CAACJ,oBAAqB;MAC/BK,KAAK,EAAE,IAAI,CAACN,KAAK,CAACM,KAAM;MACxBC,SAAS,EAAE,IAAI,CAACP,KAAK,CAACO,SAAS,IAAI,EAAG;MACtCC,WAAW,EACTC,KAUC,IACE;QACH,IAAI,IAAI,CAACT,KAAK,CAACQ,WAAW,IAAI,IAAI,EAAE;UAClC,IAAI,CAACR,KAAK,CAACQ,WAAW,CAACC,KAAK,CAACC,WAAW,CAACC,eAAe,CAAC;QAC3D;MACF,CAAE;MACFC,SAAS,EACPH,KAUC,IACE;QACH,IAAI,IAAI,CAACT,KAAK,CAACY,SAAS,IAAI,IAAI,EAAE;UAChC,IAAI,CAACZ,KAAK,CAACY,SAAS,CAACH,KAAK,CAACC,WAAW,CAACC,eAAe,CAAC;QACzD;MACF,CAAE;MACFE,OAAO,EACLJ,KAYC,IACE;QACH,IAAI,IAAI,CAACT,KAAK,CAACa,OAAO,IAAI,IAAI,EAAE;UAC9B,IAAI,CAACb,KAAK,CAACa,OAAO,CAACJ,KAAK,CAACC,WAAW,CAACI,KAAK,CAAC;QAC7C;MACF,CAAE;MACFC,cAAc,EACZN,KAWC,IACE;QACH,IAAI,IAAI,CAACT,KAAK,CAACe,cAAc,IAAI,IAAI,EAAE;UACrC,IAAI,CAACf,KAAK,CAACe,cAAc,CAACN,KAAK,CAACC,WAAW,CAACM,aAAa,CAAC;QAC5D;MACF,CAAE;MACFC,eAAe,EACbR,
|
|
1
|
+
{"version":3,"names":["React","Component","RNKlarnaStandaloneWebView","RNKlarnaStandaloneWebViewCommands","KlarnaStandaloneWebView","constructor","props","standaloneWebViewRef","createRef","render","createElement","ref","style","returnUrl","onLoadStart","event","nativeEvent","navigationEvent","onLoadEnd","onError","error","onLoadProgress","progressEvent","onKlarnaMessage","klarnaMessageEvent","params","JSON","parse","e","action","onRenderProcessGone","renderProcessGoneEvent","load","url","view","current","goForward","goBack","reload"],"sourceRoot":"../../src","sources":["KlarnaStandaloneWebView.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAwB,OAAO;AAMxD,OAAOC,yBAAyB,IAC9BC,iCAAiC,QAE5B,gDAAgD;AAsBvD,OAAO,MAAMC,uBAAuB,SAASH,SAAS,CAGpD;EAKAI,WAAWA,CAACC,KAAyB,EAAE;IACrC,KAAK,CAACA,KAAK,CAAC;IACZ,IAAI,CAACC,oBAAoB,gBAAGP,KAAK,CAACQ,SAAS,CAAC,CAAC;EAC/C;EAEAC,MAAMA,CAAA,EAAG;IACP,oBACET,KAAA,CAAAU,aAAA,CAACR,yBAAyB;MACxBS,GAAG,EAAE,IAAI,CAACJ,oBAAqB;MAC/BK,KAAK,EAAE,IAAI,CAACN,KA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,EAAEA;UACV,CAAC,CAAC;QACJ;MACF,CAAE;MACFK,mBAAmB,EACjBf,KAMC,IACE;QACH,IAAI,IAAI,CAACT,KAAK,CAACwB,mBAAmB,IAAI,IAAI,EAAE;UAC1C,IAAI,CAACxB,KAAK,CAACwB,mBAAmB,CAC5Bf,KAAK,CAACC,WAAW,CAACe,sBACpB,CAAC;QACH;MACF;IAAE,CACH,CAAC;EAEN;EAEAC,IAAI,GAAIC,GAAW,IAAK;IACtB,MAAMC,IAAI,GAAG,IAAI,CAAC3B,oBAAoB,CAAC4B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChB/B,iCAAiC,CAAC6B,IAAI,CAACE,IAAI,EAAED,GAAG,CAAC;IACnD;EACF,CAAC;EAEDG,SAAS,GAAGA,CAAA,KAAM;IAChB,MAAMF,IAAI,GAAG,IAAI,CAAC3B,oBAAoB,CAAC4B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChB/B,iCAAiC,CAACiC,SAAS,CAACF,IAAI,CAAC;IACnD;EACF,CAAC;EAEDG,MAAM,GAAGA,CAAA,KAAM;IACb,MAAMH,IAAI,GAAG,IAAI,CAAC3B,oBAAoB,CAAC4B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChB/B,iCAAiC,CAACkC,MAAM,CAACH,IAAI,CAAC;IAChD;EACF,CAAC;EAEDI,MAAM,GAAGA,CAAA,KAAM;IACb,MAAMJ,IAAI,GAAG,IAAI,CAAC3B,oBAAoB,CAAC4B,OAAO;IAC9C,IAAID,IAAI,IAAI,IAAI,EAAE;MAChB/B,iCAAiC,CAACmC,MAAM,CAACJ,IAAI,CAAC;IAChD;EACF,CAAC;AACH;AAiCA,eAAe9B,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent","codegenNativeCommands","RNKlarnaStandaloneWebViewCommands","supportedCommands"],"sourceRoot":"../../../src","sources":["specs/KlarnaStandaloneWebViewNativeComponent.ts"],"mappings":"AAEA,OAAOA,sBAAsB,MAAM,yDAAyD;AAC5F,OAAOC,qBAAqB,MAAM,wDAAwD;
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent","codegenNativeCommands","RNKlarnaStandaloneWebViewCommands","supportedCommands"],"sourceRoot":"../../../src","sources":["specs/KlarnaStandaloneWebViewNativeComponent.ts"],"mappings":"AAEA,OAAOA,sBAAsB,MAAM,yDAAyD;AAC5F,OAAOC,qBAAqB,MAAM,wDAAwD;AAoF1F,OAAO,MAAMC,iCAA0E,GACrFD,qBAAqB,CAA0C;EAC7DE,iBAAiB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ;AAC7D,CAAC,CAAC;AAEJ,eAAeH,sBAAsB,CACnC,2BACF,CAAC"}
|
|
@@ -20,7 +20,7 @@ export declare class KlarnaStandaloneWebView extends Component<KlarnaWebViewProp
|
|
|
20
20
|
goBack: () => void;
|
|
21
21
|
reload: () => void;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface KlarnaWebViewNativeEvent {
|
|
24
24
|
readonly url: string;
|
|
25
25
|
readonly loading: boolean;
|
|
26
26
|
readonly title: string;
|
|
@@ -38,6 +38,9 @@ export interface KlarnaWebViewProgressEvent extends KlarnaWebViewNativeEvent {
|
|
|
38
38
|
}
|
|
39
39
|
export interface KlarnaWebViewKlarnaMessageEvent {
|
|
40
40
|
readonly action: string;
|
|
41
|
+
readonly params: {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
};
|
|
41
44
|
}
|
|
42
45
|
export interface KlarnaWebViewRenderProcessGoneEvent {
|
|
43
46
|
readonly didCrash: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlarnaStandaloneWebView.d.ts","sourceRoot":"","sources":["../../src/KlarnaStandaloneWebView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM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,wBAAwB;CAAG;AAErC,MAAM,WAAW,kBAAmB,SAAQ,wBAAwB;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA2B,SAAQ,wBAAwB;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAGzC;AAED,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -12,7 +12,7 @@ export interface RNKlarnaStandaloneWebViewProps extends ViewProps {
|
|
|
12
12
|
onKlarnaMessage: DirectEventHandler<KlarnaWebViewKlarnaMessageEvent>;
|
|
13
13
|
onRenderProcessGone: DirectEventHandler<KlarnaWebViewRenderProcessGoneEvent>;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
type KlarnaWebViewNavigationEvent = Readonly<{
|
|
16
16
|
navigationEvent: Readonly<{
|
|
17
17
|
url: string;
|
|
18
18
|
loading: boolean;
|
|
@@ -45,6 +45,7 @@ type KlarnaWebViewProgressEvent = Readonly<{
|
|
|
45
45
|
type KlarnaWebViewKlarnaMessageEvent = Readonly<{
|
|
46
46
|
klarnaMessageEvent: Readonly<{
|
|
47
47
|
action: string;
|
|
48
|
+
params: string;
|
|
48
49
|
}>;
|
|
49
50
|
}>;
|
|
50
51
|
type KlarnaWebViewRenderProcessGoneEvent = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlarnaStandaloneWebViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/specs/KlarnaStandaloneWebViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,WAAW,8BAA+B,SAAQ,SAAS;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IAC9D,SAAS,EAAE,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IAC5D,OAAO,EAAE,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;IAChD,cAAc,EAAE,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;IAC/D,eAAe,EAAE,kBAAkB,CAAC,+BAA+B,CAAC,CAAC;IAErE,mBAAmB,EAAE,kBAAkB,CAAC,mCAAmC,CAAC,CAAC;CAE9E;AAED,
|
|
1
|
+
{"version":3,"file":"KlarnaStandaloneWebViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/specs/KlarnaStandaloneWebViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sDAAsD,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE/E,MAAM,WAAW,8BAA+B,SAAQ,SAAS;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;IAC9D,S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C;QACf,MAAM,EAAE,MAAM,CAAC;KAGhB,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,KAAK,mCAAmC,GAAG,QAAQ,CAAC;IAClD,sBAAsB,EAAE,QAAQ,CAAC;QAC/B,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ,CAAC,CAAC;AAEH,KAAK,0CAA0C,GAC7C,aAAa,CAAC,8BAA8B,CAAC,CAAC;AAEhD,UAAU,uCAAuC;IAC/C,IAAI,EAAE,CACJ,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,0CAA0C,CAAC,EACrE,GAAG,EAAE,MAAM,KACR,IAAI,CAAC;IACV,MAAM,EAAE,CACN,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,0CAA0C,CAAC,KAClE,IAAI,CAAC;IACV,SAAS,EAAE,CACT,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,0CAA0C,CAAC,KAClE,IAAI,CAAC;IACV,MAAM,EAAE,CACN,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,0CAA0C,CAAC,KAClE,IAAI,CAAC;CACX;AAED,eAAO,MAAM,iCAAiC,EAAE,uCAG5C,CAAC;;AAEL,wBAEgD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-klarna-inapp-sdk",
|
|
3
3
|
"title": "Klarna Mobile SDK React Native",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.3",
|
|
5
5
|
"description": "This library wraps Klarna Mobile SDK and exposes its functionality as React Native components.",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
7
7
|
"module": "lib/module/index",
|
|
@@ -124,14 +124,21 @@ export class KlarnaStandaloneWebView extends Component<
|
|
|
124
124
|
Readonly<{
|
|
125
125
|
readonly klarnaMessageEvent: Readonly<{
|
|
126
126
|
readonly action: string;
|
|
127
|
-
|
|
128
|
-
// readonly params: { [key: string]: any };
|
|
127
|
+
readonly params: string;
|
|
129
128
|
}>;
|
|
130
129
|
}>
|
|
131
130
|
>
|
|
132
131
|
) => {
|
|
133
132
|
if (this.props.onKlarnaMessage != null) {
|
|
134
|
-
|
|
133
|
+
const klarnaMessageEvent = event.nativeEvent.klarnaMessageEvent;
|
|
134
|
+
let params = {};
|
|
135
|
+
try {
|
|
136
|
+
params = JSON.parse(klarnaMessageEvent.params);
|
|
137
|
+
} catch (e) {}
|
|
138
|
+
this.props.onKlarnaMessage({
|
|
139
|
+
action: klarnaMessageEvent.action,
|
|
140
|
+
params: params,
|
|
141
|
+
});
|
|
135
142
|
}
|
|
136
143
|
}}
|
|
137
144
|
onRenderProcessGone={(
|
|
@@ -182,7 +189,7 @@ export class KlarnaStandaloneWebView extends Component<
|
|
|
182
189
|
};
|
|
183
190
|
}
|
|
184
191
|
|
|
185
|
-
|
|
192
|
+
interface KlarnaWebViewNativeEvent {
|
|
186
193
|
readonly url: string;
|
|
187
194
|
readonly loading: boolean;
|
|
188
195
|
readonly title: string;
|
|
@@ -204,8 +211,7 @@ export interface KlarnaWebViewProgressEvent extends KlarnaWebViewNativeEvent {
|
|
|
204
211
|
|
|
205
212
|
export interface KlarnaWebViewKlarnaMessageEvent {
|
|
206
213
|
readonly action: string;
|
|
207
|
-
|
|
208
|
-
// readonly params: { [key: string]: any };
|
|
214
|
+
readonly params: { [key: string]: any };
|
|
209
215
|
// TODO What is a KlarnaWebViewComponent?
|
|
210
216
|
// readonly component: KlarnaWebViewComponent;
|
|
211
217
|
}
|
|
@@ -18,7 +18,7 @@ export interface RNKlarnaStandaloneWebViewProps extends ViewProps {
|
|
|
18
18
|
/* End of Android only */
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
type KlarnaWebViewNavigationEvent = Readonly<{
|
|
22
22
|
navigationEvent: Readonly<{
|
|
23
23
|
url: string;
|
|
24
24
|
loading: boolean;
|
|
@@ -54,8 +54,7 @@ type KlarnaWebViewProgressEvent = Readonly<{
|
|
|
54
54
|
type KlarnaWebViewKlarnaMessageEvent = Readonly<{
|
|
55
55
|
klarnaMessageEvent: Readonly<{
|
|
56
56
|
action: string;
|
|
57
|
-
|
|
58
|
-
// params: { [key: string]: any };
|
|
57
|
+
params: string;
|
|
59
58
|
// TODO What is a KlarnaWebViewComponent?
|
|
60
59
|
// component: KlarnaWebViewComponent;
|
|
61
60
|
}>;
|