react-native-klarna-inapp-sdk 2.1.11 → 2.1.13

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/.gitattributes CHANGED
@@ -1,3 +1,3 @@
1
- # Windows files should use crlf line endings
2
- # https://help.github.com/articles/dealing-with-line-endings/
1
+ *.pbxproj -text
2
+ # specific for windows script files
3
3
  *.bat text eol=crlf
@@ -0,0 +1 @@
1
+ {}
package/.yarnrc ADDED
@@ -0,0 +1,5 @@
1
+ # Override Yarn command so we can automatically setup the repo on running `yarn`
2
+
3
+ yarn-path "scripts/bootstrap.js"
4
+
5
+ registry "https://registry.yarnpkg.com"
package/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
  All notable changes to React Native Klarna In-App SDK will be documented in this file.
3
3
 
4
+ ### [2.1.13] - 2023-09-19
5
+ - Update Android native SDK version to 2.6.8
6
+ - Update iOS native SDK version to 2.6.10
7
+ - Applied dependabot version updates
8
+
9
+ ### [2.1.12] - 2023-05-11
10
+ - Update Android native SDK version to 2.6.2
11
+ - Applied dependabot version updates
12
+
4
13
  ### [2.1.11] - 2023-05-09
5
14
  - Update iOS native SDK version to 2.6.4
6
15
 
@@ -8,8 +8,8 @@ buildscript {
8
8
  }
9
9
 
10
10
  dependencies {
11
- // Matches recent template from React Native (0.60)
12
- // https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16
11
+ // Matches recent template from React Native (0.64)
12
+ // https://github.com/facebook/react-native/blob/0.64-stable/template/android/build.gradle#L16
13
13
  classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '4.2.0')}")
14
14
  }
15
15
  }
@@ -17,11 +17,11 @@ buildscript {
17
17
  apply plugin: 'com.android.library'
18
18
  apply plugin: 'maven-publish'
19
19
 
20
- // Matches values in recent template from React Native (0.59)
21
- // https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L5-L9
20
+ // Matches or updates values in template from React Native (0.64)
21
+ // https://github.com/facebook/react-native/blob/0.64-stable/template/android/build.gradle#L5-L9
22
22
  def DEFAULT_COMPILE_SDK_VERSION = 30
23
23
  def DEFAULT_BUILD_TOOLS_VERSION = "30.0.2"
24
- def DEFAULT_MIN_SDK_VERSION = 19
24
+ def DEFAULT_MIN_SDK_VERSION = 21
25
25
  def DEFAULT_TARGET_SDK_VERSION = 30
26
26
 
27
27
  android {
@@ -55,7 +55,7 @@ repositories {
55
55
 
56
56
  dependencies {
57
57
  implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
58
- implementation 'com.klarna.mobile:sdk:2.5.0'
58
+ implementation 'com.klarna.mobile:sdk:2.6.8'
59
59
 
60
60
  testImplementation "junit:junit:4.13"
61
61
  testImplementation 'androidx.test:core:1.2.0'
@@ -115,7 +115,7 @@ afterEvaluate { project ->
115
115
  }
116
116
 
117
117
  task androidSourcesJar(type: Jar) {
118
- classifier = 'sources'
118
+ archiveClassifier = 'sources'
119
119
  from android.sourceSets.main.java.srcDirs
120
120
  include '**/*.java'
121
121
  }
@@ -25,6 +25,7 @@ class MappableKlarnaPaymentsSDKError implements Mappable {
25
25
  .put("message", klarnaPaymentsSDKError.getMessage())
26
26
  .put("name", klarnaPaymentsSDKError.getName())
27
27
  .put("invalidFields", klarnaPaymentsSDKError.getInvalidFields())
28
+ .put("sessionId", klarnaPaymentsSDKError.getSessionId())
28
29
  .build();
29
30
  }
30
31
  }
@@ -19,7 +19,8 @@ public class MappableKlarnaPaymentsSDKErrorTest {
19
19
  "testMessage",
20
20
  false,
21
21
  "testAction",
22
- Collections.singletonList("testInvalidField")
22
+ Collections.singletonList("testInvalidField"),
23
+ "testSessionId"
23
24
  );
24
25
 
25
26
  MappableKlarnaPaymentsSDKError writableError = new MappableKlarnaPaymentsSDKError(error);
@@ -39,5 +40,6 @@ public class MappableKlarnaPaymentsSDKErrorTest {
39
40
  Assert.assertEquals(1, invalidFields.size());
40
41
  Assert.assertEquals("testInvalidField", new ArrayList(invalidFields).get(0));
41
42
 
43
+ Assert.assertEquals("testSessionId", map.get("sessionId"));
42
44
  }
43
45
  }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ presets: ['module:metro-react-native-babel-preset'],
3
+ };
package/ios/Podfile CHANGED
@@ -8,7 +8,7 @@ target 'KlarnaInAppSDK' do
8
8
  # use_frameworks!
9
9
 
10
10
  # Pods for KlarnaInAppSDK
11
- pod 'KlarnaMobileSDK', '2.6.4'
11
+ pod 'KlarnaMobileSDK', '2.6.10'
12
12
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
13
13
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/React/FBReactNativeSpec"
14
14
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "react-native-klarna-inapp-sdk",
3
- "title": "React Native Klarna In-App SDK",
4
- "version": "2.1.11",
5
- "description": "This library wraps Klarna’s In-App SDK and exposes its functionality as React Native components. It currently supports Klarna Payments via a Payment View component.",
6
- "main": "index.js",
3
+ "title": "Klarna Mobile SDK React Native",
4
+ "version": "2.1.13",
5
+ "description": "This library wraps Klarna Mobile SDK and exposes its functionality as React Native components.",
6
+ "main": "src/index",
7
+ "source": "src/index",
7
8
  "scripts": {},
8
9
  "repository": {
9
10
  "type": "git",
@@ -30,5 +31,8 @@
30
31
  "react": "17.0.1",
31
32
  "react-native": "0.64.4"
32
33
  },
33
- "dependencies": {}
34
+ "dependencies": {},
35
+ "engines": {
36
+ "node": ">= 16.0.0"
37
+ }
34
38
  }
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
25
25
  end
26
26
 
27
27
  s.dependency "React"
28
- s.dependency 'KlarnaMobileSDK', '2.6.4'
28
+ s.dependency 'KlarnaMobileSDK', '2.6.10'
29
29
  # s.dependency "..."
30
30
 
31
31
  end
@@ -0,0 +1,29 @@
1
+ const os = require('os');
2
+ const path = require('path');
3
+ const child_process = require('child_process');
4
+
5
+ const root = path.resolve(__dirname, '..');
6
+ const args = process.argv.slice(2);
7
+ const options = {
8
+ cwd: process.cwd(),
9
+ env: process.env,
10
+ stdio: 'inherit',
11
+ encoding: 'utf-8',
12
+ };
13
+
14
+ if (os.type() === 'Windows_NT') {
15
+ options.shell = true;
16
+ }
17
+
18
+ let result;
19
+
20
+ if (process.cwd() !== root || args.length) {
21
+ // We're not in the root of the project, or additional arguments were passed
22
+ // In this case, forward the command to `yarn`
23
+ result = child_process.spawnSync('yarn', args, options);
24
+ } else {
25
+ // If `yarn` is run without arguments, perform bootstrap
26
+ result = child_process.spawnSync('yarn', ['bootstrap'], options);
27
+ }
28
+
29
+ process.exitCode = result.status;
package/Jenkinsfile DELETED
@@ -1,156 +0,0 @@
1
- def currentSdkVersion = ""
2
- def gitCommit = ""
3
-
4
- pipeline {
5
-
6
- agent {
7
- label 'mac-mini'
8
- }
9
-
10
- stages {
11
- stage('Initialize') {
12
- steps {
13
- script {
14
- gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
15
- echo "gitCommit: ${gitCommit}"
16
- currentSdkVersion = sdkVersion()
17
- echo "currentSdkVersion: ${currentSdkVersion}"
18
- }
19
- withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'msdk-aws-mac-user', usernameVariable: 'MSDK_USER', passwordVariable: 'MSDK_PASSWORD']]) {
20
- sh 'security unlock-keychain -p $MSDK_PASSWORD login.keychain'
21
- }
22
- }
23
- }
24
-
25
- stage('Yarn Install Lib') {
26
- steps {
27
- sh "yarn install"
28
- }
29
- }
30
-
31
- stage('Bundle Install Lib') {
32
- steps {
33
- bash 'bundle install'
34
- }
35
- }
36
-
37
- stage('Pod Install Lib') {
38
- steps {
39
- sh "cd ios && pod install && cd .."
40
- }
41
- }
42
-
43
- stage('Android Native Unit Tests') {
44
- steps {
45
- sh 'cd android && ./gradlew clean && ./gradlew testDebugUnitTest && cd ..'
46
- junit 'android/build/test-results/testDebugUnitTest/*.xml'
47
- }
48
- }
49
-
50
- stage('iOS Native Unit Tests') {
51
- steps {
52
- bash 'bundle exec fastlane ios run_lib_tests'
53
- }
54
- }
55
-
56
- stage('Yarn Install TestApp') {
57
- steps {
58
- sh 'cd TestApp && yarn install && cd ..'
59
- }
60
- }
61
-
62
- stage('Pod Install TestApp') {
63
- steps {
64
- bash 'cd TestApp/ios && pod install --repo-update && pod update KlarnaMobileSDK && cd ../..'
65
- }
66
- }
67
-
68
- stage('Build Android TestApp') {
69
- steps {
70
- sh 'cd TestApp/android && ./gradlew clean && ./gradlew app:assembleDebug && cd ../..'
71
- // apk location: TestApp/android/app/build/outputs/apk/debug/app-debug.apk
72
- // TODO : Upload apk
73
- }
74
- }
75
-
76
- stage('Build iOS TestApp') {
77
- steps {
78
- bash 'bundle exec fastlane ios build_test_app_release'
79
- }
80
- }
81
-
82
- stage('Upload Test Apps') {
83
- when {
84
- expression { isPullRequest() }
85
- }
86
- steps {
87
- script {
88
- withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'BrowserStack', usernameVariable: 'BROWSERSTACK_USER', passwordVariable: 'BROWSERSTACK_PASSWORD']]) {
89
- sh 'curl -u ' + "$BROWSERSTACK_USER" + ":" + "$BROWSERSTACK_PASSWORD" + ' -X POST https://api-cloud.browserstack.com/app-automate/upload -F file=@TestApp/android/app/build/outputs/apk/debug/app-debug.apk -F "data={\\"custom_id\\":\\"INAPP_RN_SDK_ANDROID_TEST_APP\\"}"'
90
- sh 'curl -u ' + "$BROWSERSTACK_USER" + ":" + "$BROWSERSTACK_PASSWORD" + ' -X POST https://api-cloud.browserstack.com/app-automate/upload -F file=@TestApp/build/TestApp.ipa -F "data={\\"custom_id\\":\\"INAPP_RN_SDK_IOS_TEST_APP\\"}"'
91
- }
92
- }
93
- }
94
- }
95
-
96
- stage('Android Integration Tests') {
97
- when {
98
- expression { isPullRequest() }
99
- }
100
- steps {
101
- script {
102
- try {
103
- withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'BrowserStack', usernameVariable: 'BROWSERSTACK_USER', passwordVariable: 'BROWSERSTACK_PASSWORD']]) {
104
- sh './integration-tests/gradlew -p integration-tests :test --tests TestSuite -Dbrowserstack.username="' + "$BROWSERSTACK_USER" + '" -Dbrowserstack.password="' + "$BROWSERSTACK_PASSWORD" + '" -Dbuild.name="' + "${env.BRANCH_NAME}@${gitCommit}" + '" -Dbuild.platform="Android"'
105
- }
106
- } finally {
107
- // Add the test results for statistics
108
- junit 'integration-tests/build/test-results/test/*.xml'
109
- }
110
- }
111
- }
112
- }
113
-
114
- // Enable after iOS tests are fixed
115
- /* stage('iOS Integration Tests') {
116
- when {
117
- expression { isPullRequest() }
118
- }
119
- steps {
120
- script {
121
- try {
122
- withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'BrowserStack', usernameVariable: 'BROWSERSTACK_USER', passwordVariable: 'BROWSERSTACK_PASSWORD']]) {
123
- sh './integration-tests/gradlew -p integration-tests :test --tests TestSuite -Dbrowserstack.username="' + "$BROWSERSTACK_USER" + '" -Dbrowserstack.password="' + "$BROWSERSTACK_PASSWORD" + '" -Dbuild.name="' + "${env.BRANCH_NAME}@${gitCommit}" + '" -Dbuild.platform="iOS"'
124
- }
125
- } finally {
126
- // Add the test results for statistics
127
- junit 'integration-tests/build/test-results/test *//*.xml'
128
- }
129
- }
130
- }
131
- } */
132
-
133
- stage('Reset Directory') {
134
- steps {
135
- script {
136
- sh 'git reset --hard'
137
- //sh 'git clean -d -x -f'
138
- }
139
- }
140
- }
141
-
142
- }
143
- }
144
-
145
- String sdkVersion() {
146
- return sh(returnStdout: true, script: "sed -n -e '/\"version\"/ s/.*\\: *//p' package.json").trim().replaceAll("\"", "").replaceAll(",", "")
147
- }
148
-
149
- def bash(custom) {
150
- sh '''#!/bin/bash -l
151
- ''' + custom
152
- }
153
-
154
- boolean isPullRequest() {
155
- return env.JOB_BASE_NAME.startsWith('PR') && env.JOB_BASE_NAME.endsWith('merge')
156
- }
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /*
4
- * Using libraries within examples and linking them within packages.json like:
5
- * "react-native-library-name": "file:../"
6
- * will cause problems with the metro bundler if the example will run via
7
- * `react-native run-[ios|android]`. This will result in an error as the metro
8
- * bundler will find multiple versions for the same module while resolving it.
9
- * The reason for that is that if the library is installed it also copies in the
10
- * example folder itself as well as the node_modules folder of the library
11
- * although their are defined in .npmignore and should be ignored in theory.
12
- *
13
- * This postinstall script removes the node_modules folder as well as all
14
- * entries from the libraries .npmignore file within the examples node_modules
15
- * folder after the library was installed. This should resolve the metro
16
- * bundler issue mentioned above.
17
- *
18
- * It is expected this scripts lives in the libraries root folder within a
19
- * scripts folder. As first parameter the relative path to the libraries
20
- * folder within the example's node_modules folder may be provided.
21
- * This script will determine the path from this project's package.json file
22
- * if no such relative path is provided.
23
- * An example's package.json entry could look like:
24
- * "postinstall": "node ../scripts/examples_postinstall.js node_modules/react-native-library-name/"
25
- */
26
-
27
- 'use strict';
28
-
29
- const fs = require('fs');
30
- const path = require('path');
31
-
32
- /// Delete all files and directories for the given path
33
- const removeFileDirectoryRecursively = fileDirPath => {
34
- // Remove file
35
- if (!fs.lstatSync(fileDirPath).isDirectory()) {
36
- fs.unlinkSync(fileDirPath);
37
- return;
38
- }
39
-
40
- // Go down the directory an remove each file / directory recursively
41
- fs.readdirSync(fileDirPath).forEach(entry => {
42
- const entryPath = path.join(fileDirPath, entry);
43
- removeFileDirectoryRecursively(entryPath);
44
- });
45
- fs.rmdirSync(fileDirPath);
46
- };
47
-
48
- /// Remove TestApp/node_modules/react-native-library-name/node_modules directory
49
- const removeLibraryNodeModulesPath = (libraryNodeModulesPath) => {
50
- const nodeModulesPath = path.resolve(libraryNodeModulesPath, 'node_modules')
51
-
52
- if (!fs.existsSync(nodeModulesPath)) {
53
- console.log(`No node_modules path found at ${nodeModulesPath}. Skipping delete.`)
54
- return;
55
- }
56
-
57
- console.log(`Deleting: ${nodeModulesPath}`)
58
- try {
59
- removeFileDirectoryRecursively(nodeModulesPath);
60
- console.log(`Successfully deleted: ${nodeModulesPath}`)
61
- } catch (err) {
62
- console.log(`Error deleting ${nodeModulesPath}: ${err.message}`);
63
- }
64
- };
65
-
66
- /// Remove all entries from the .npmignore within TestApp/node_modules/react-native-library-name/
67
- const removeLibraryNpmIgnorePaths = (npmIgnorePath, libraryNodeModulesPath) => {
68
- if (!fs.existsSync(npmIgnorePath)) {
69
- console.log(`No .npmignore path found at ${npmIgnorePath}. Skipping deleting content.`);
70
- return;
71
- }
72
-
73
- fs.readFileSync(npmIgnorePath, 'utf8').split(/\r?\n/).forEach(entry => {
74
- if (entry.length === 0) {
75
- return
76
- }
77
-
78
- const npmIgnoreLibraryNodeModulesEntryPath = path.resolve(libraryNodeModulesPath, entry);
79
- if (!fs.existsSync(npmIgnoreLibraryNodeModulesEntryPath)) {
80
- return;
81
- }
82
-
83
- console.log(`Deleting: ${npmIgnoreLibraryNodeModulesEntryPath}`)
84
- try {
85
- removeFileDirectoryRecursively(npmIgnoreLibraryNodeModulesEntryPath);
86
- console.log(`Successfully deleted: ${npmIgnoreLibraryNodeModulesEntryPath}`)
87
- } catch (err) {
88
- console.log(`Error deleting ${npmIgnoreLibraryNodeModulesEntryPath}: ${err.message}`);
89
- }
90
- });
91
- };
92
-
93
- // Main start sweeping process
94
- (() => {
95
- // Read out dir of example project
96
- const exampleDir = process.cwd();
97
-
98
- console.log(`Starting postinstall cleanup for ${exampleDir}`);
99
-
100
- // Resolve the React Native library's path within the example's node_modules directory
101
- const libraryNodeModulesPath = process.argv.length > 2
102
- ? path.resolve(exampleDir, process.argv[2])
103
- : path.resolve(exampleDir, 'node_modules', require('../package.json').name);
104
-
105
- console.log(`Removing unwanted artifacts for ${libraryNodeModulesPath}`);
106
-
107
- removeLibraryNodeModulesPath(libraryNodeModulesPath);
108
-
109
- const npmIgnorePath = path.resolve(__dirname, '../.npmignore');
110
- removeLibraryNpmIgnorePaths(npmIgnorePath, libraryNodeModulesPath);
111
- })();
File without changes