react-native-smallcase-gateway 1.7.1 → 2.0.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +2 -3
  3. package/android/build.gradle +130 -63
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/java/com/{smallcase/gateway/reactnative → reactnativesmallcasegateway}/SmallcaseGatewayModule.kt +5 -4
  7. package/android/src/main/java/com/{smallcase/gateway/reactnative → reactnativesmallcasegateway}/SmallcaseGatewayPackage.kt +4 -6
  8. package/ios/SmallcaseGateway-Bridging-Header.h +2 -0
  9. package/ios/SmallcaseGateway.m +3 -11
  10. package/ios/SmallcaseGateway.swift +3 -0
  11. package/ios/SmallcaseGateway.xcodeproj/project.pbxproj +21 -29
  12. package/lib/commonjs/SmallcaseGateway.js +235 -0
  13. package/lib/commonjs/SmallcaseGateway.js.map +1 -0
  14. package/lib/commonjs/constants.js +43 -0
  15. package/lib/commonjs/constants.js.map +1 -0
  16. package/lib/commonjs/index.js +17 -0
  17. package/lib/commonjs/index.js.map +1 -0
  18. package/lib/commonjs/util.js +26 -0
  19. package/lib/commonjs/util.js.map +1 -0
  20. package/lib/module/SmallcaseGateway.js +228 -0
  21. package/lib/module/SmallcaseGateway.js.map +1 -0
  22. package/lib/module/constants.js +34 -0
  23. package/lib/module/constants.js.map +1 -0
  24. package/lib/module/index.js +9 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/util.js +18 -0
  27. package/lib/module/util.js.map +1 -0
  28. package/lib/typescript/react-native.d.ts +10 -0
  29. package/package.json +130 -39
  30. package/react-native-smallcase-gateway.podspec +24 -15
  31. package/src/index.js +4 -0
  32. package/src/util.js +1 -1
  33. package/android/README.md +0 -14
  34. package/index.js +0 -4
  35. package/ios/SmallcaseGateway.h +0 -5
  36. package/ios/SmallcaseGateway.xcworkspace/contents.xcworkspacedata +0 -7
  37. package/ios/SmallcaseGateway.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ENV","STAG","DEV","PROD","TRANSACTION_TYPE","connect","sipSetup","fetchFunds","transaction","holdingsImport","authorizeHoldings","mfHoldingsImport","ERROR_MSG","init_sdk","no_order","no_broker","invalid_jwt","market_closed","user_mismatch","order_pending","internal_error","user_cancelled","consent_denied","order_in_queue","invalid_gateway","transaction_expired","invalid_transactionId","insufficient_holdings","transaction_in_process","no_compatible_browser"],"sources":["constants.js"],"sourcesContent":["export const ENV = {\n STAG: \"staging\",\n DEV: \"development\",\n PROD: \"production\",\n};\n\nexport const TRANSACTION_TYPE = {\n connect: \"CONNECT\",\n sipSetup: \"SIP_SETUP\",\n fetchFunds: \"FETCH_FUNDS\",\n transaction: \"TRANSACTION\",\n holdingsImport: \"HOLDINGS_IMPORT\",\n authorizeHoldings: \"AUTHORISE_HOLDINGS\",\n mfHoldingsImport: \"MF_HOLDINGS_IMPORT\"\n};\n\nexport const ERROR_MSG = {\n init_sdk: \"init_sdk\",\n no_order: \"no_order\",\n no_broker: \"no_broker\",\n invalid_jwt: \"invalid_jwt\",\n market_closed: \"market_closed\",\n user_mismatch: \"user_mismatch\",\n order_pending: \"order_pending\",\n internal_error: \"internal_error\",\n user_cancelled: \"user_cancelled\",\n consent_denied: \"consent_denied\",\n order_in_queue: \"order_in_queue\",\n invalid_gateway: \"invalid_gateway\",\n transaction_expired: \"transaction_expired\",\n invalid_transactionId: \"invalid_transactionId\",\n insufficient_holdings: \"insufficient_holdings\",\n transaction_in_process: \"transaction_in_process\",\n no_compatible_browser: \"no_compatible_browser\"\n};\n"],"mappings":"AAAA,OAAO,MAAMA,GAAG,GAAG;EACjBC,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,aAAa;EAClBC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC9BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE,iBAAiB;EACjCC,iBAAiB,EAAE,oBAAoB;EACvCC,gBAAgB,EAAE;AACpB,CAAC;AAED,OAAO,MAAMC,SAAS,GAAG;EACvBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,UAAU;EACpBC,SAAS,EAAE,WAAW;EACtBC,WAAW,EAAE,aAAa;EAC1BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,cAAc,EAAE,gBAAgB;EAChCC,eAAe,EAAE,iBAAiB;EAClCC,mBAAmB,EAAE,qBAAqB;EAC1CC,qBAAqB,EAAE,uBAAuB;EAC9CC,qBAAqB,EAAE,uBAAuB;EAC9CC,sBAAsB,EAAE,wBAAwB;EAChDC,qBAAqB,EAAE;AACzB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import SmallcaseGateway from "./SmallcaseGateway";
2
+ import { ENV, TRANSACTION_TYPE, ERROR_MSG } from "./constants";
3
+ export default {
4
+ ...SmallcaseGateway,
5
+ ENV,
6
+ ERROR_MSG,
7
+ TRANSACTION_TYPE
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SmallcaseGateway","ENV","TRANSACTION_TYPE","ERROR_MSG"],"sources":["index.js"],"sourcesContent":["import SmallcaseGateway from \"./SmallcaseGateway\";\nimport { ENV, TRANSACTION_TYPE, ERROR_MSG } from \"./constants\";\n\nexport default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };\n"],"mappings":"AAAA,OAAOA,gBAAgB,MAAM,oBAAoB;AACjD,SAASC,GAAG,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,aAAa;AAE9D,eAAe;EAAE,GAAGH,gBAAgB;EAAEC,GAAG;EAAEE,SAAS;EAAED;AAAiB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * check if value is a valid object.
3
+ *
4
+ *
5
+ * (Native modules expect objects to not include `null`. wtf js)
6
+ * @param {*} obj
7
+ * @returns {Object} same object if its valid, else returns `{}`
8
+ */
9
+ export const safeObject = obj => {
10
+ return obj && typeof obj === "object" ? obj : {};
11
+ };
12
+ export function platformSpecificColorHex(hex) {
13
+ if (Platform.OS === 'android') {
14
+ return `#${hex}`;
15
+ }
16
+ return hex;
17
+ }
18
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["safeObject","obj","platformSpecificColorHex","hex","Platform","OS"],"sources":["util.js"],"sourcesContent":["/**\n * check if value is a valid object.\n *\n *\n * (Native modules expect objects to not include `null`. wtf js)\n * @param {*} obj\n * @returns {Object} same object if its valid, else returns `{}`\n */\n export const safeObject = (obj) => {\n return obj && typeof obj === \"object\" ? obj : {};\n};\n\nexport function platformSpecificColorHex(hex) {\n if (Platform.OS === 'android') {\n return `#${hex}`\n }\n return hex\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACC,OAAO,MAAMA,UAAU,GAAIC,GAAG,IAAK;EAClC,OAAOA,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,GAAGA,GAAG,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,OAAO,SAASC,wBAAwB,CAACC,GAAG,EAAE;EAC5C,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,OAAQ,IAAGF,GAAI,EAAC;EAClB;EACA,OAAOA,GAAG;AACZ"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="jest" />
2
+ export declare const NativeModules: {
3
+ SmallcaseGateway: {
4
+ init: jest.Mock<any, any>;
5
+ triggerLeadGen: jest.Mock<any, any>;
6
+ triggerTransaction: jest.Mock<any, any>;
7
+ setConfigEnvironment: jest.Mock<any, any>;
8
+ setHybridSdkVersion: jest.Mock<any, any>;
9
+ };
10
+ };
package/package.json CHANGED
@@ -1,61 +1,152 @@
1
1
  {
2
2
  "name": "react-native-smallcase-gateway",
3
3
  "title": "React Native Smallcase Gateway",
4
- "version": "1.7.1",
4
+ "version": "2.0.1",
5
5
  "description": "smallcase gateway bindings for react native",
6
- "main": "index.js",
6
+ "main": "src/index.js",
7
7
  "files": [
8
8
  "src",
9
- "index.js",
10
- "android/src",
11
- "android/build.gradle",
9
+ "lib",
10
+ "android",
12
11
  "ios",
13
- "react-native-smallcase-gateway.podspec"
12
+ "cpp",
13
+ "react-native-smallcase-gateway.podspec",
14
+ "!lib/typescript/example",
15
+ "!android/build",
16
+ "!ios/build",
17
+ "!**/__tests__",
18
+ "!**/__fixtures__",
19
+ "!**/__mocks__"
14
20
  ],
15
21
  "scripts": {
22
+ "test": "jest",
23
+ "typescript": "tsc --noEmit",
24
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
25
+ "prepare": "bob build",
26
+ "release": "release-it",
27
+ "example": "yarn --cwd example",
28
+ "bootstrap": "yarn example && yarn && yarn example pods",
16
29
  "commit": "yarn cz",
17
- "test": "jest --coverage",
18
30
  "release:minor": "standard-version --release-as minor",
19
31
  "release:patch": "standard-version --release-as patch",
20
32
  "release:major": "standard-version --release-as major"
21
33
  },
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/smallcase/react-native-smallcase-gateway.git",
25
- "baseUrl": "https://github.com/smallcase/react-native-smallcase-gateway.git"
26
- },
27
34
  "keywords": [
28
- "react-native"
35
+ "react-native",
36
+ "ios",
37
+ "android"
29
38
  ],
30
- "homepage": "https://developers.gateway.smallcase.com/docs/react-native-integration",
31
- "author": {
32
- "name": "smallcase",
33
- "email": "mobile@smallcase.com"
34
- },
39
+ "repository": "https://github.com/smallcase/react-native-smallcase-gateway",
40
+ "author": "smallcase mobile <mobile@smallcase.com> (https://github.com/smallcase)",
35
41
  "license": "MIT",
36
- "licenseFilename": "LICENSE",
37
- "readmeFilename": "README.md",
38
- "peerDependencies": {
39
- "react": "^16.8.1",
40
- "react-native": ">=0.60.0-rc.0 <1.0.x"
42
+ "bugs": {
43
+ "url": "https://github.com/smallcase/react-native-smallcase-gateway/issues"
44
+ },
45
+ "homepage": "https://github.com/smallcase/react-native-smallcase-gateway#readme",
46
+ "publishConfig": {
47
+ "registry": "https://registry.npmjs.org/"
41
48
  },
42
49
  "devDependencies": {
43
- "@babel/core": "^7.12.3",
44
- "@babel/preset-env": "^7.12.1",
45
- "@commitlint/cli": "^11.0.0",
46
- "@commitlint/config-conventional": "^11.0.0",
47
- "babel-jest": "^26.6.3",
48
- "commitizen": "^4.2.2",
49
- "cz-conventional-changelog": "^3.3.0",
50
- "jest": "^26.6.3",
51
- "jest-junit": "^12.0.0",
52
- "react": "^16.9.0",
53
- "react-native": "^0.61.5",
54
- "standard-version": "^9.0.0"
55
- },
56
- "config": {
57
- "commitizen": {
58
- "path": "./node_modules/cz-conventional-changelog"
50
+ "@arkweid/lefthook": "^0.7.7",
51
+ "@babel/eslint-parser": "^7.18.2",
52
+ "@commitlint/config-conventional": "^17.0.2",
53
+ "@react-native-community/eslint-config": "^3.0.2",
54
+ "@release-it/conventional-changelog": "^5.0.0",
55
+ "@types/jest": "^28.1.2",
56
+ "@types/react": "~17.0.21",
57
+ "@types/react-native": "0.68.0",
58
+ "commitlint": "^17.0.2",
59
+ "eslint": "^8.4.1",
60
+ "eslint-config-prettier": "^8.5.0",
61
+ "eslint-plugin-prettier": "^4.0.0",
62
+ "jest": "^28.1.1",
63
+ "pod-install": "^0.1.0",
64
+ "prettier": "^2.0.5",
65
+ "react": "17.0.2",
66
+ "react-native": "0.68.2",
67
+ "react-native-builder-bob": "^0.18.3",
68
+ "release-it": "^15.0.0",
69
+ "typescript": "^4.5.2"
70
+ },
71
+ "resolutions": {
72
+ "@types/react": "17.0.21"
73
+ },
74
+ "peerDependencies": {
75
+ "react": "*",
76
+ "react-native": "*"
77
+ },
78
+ "jest": {
79
+ "preset": "react-native",
80
+ "modulePathIgnorePatterns": [
81
+ "<rootDir>/example/node_modules",
82
+ "<rootDir>/lib/"
83
+ ]
84
+ },
85
+ "commitlint": {
86
+ "extends": [
87
+ "@commitlint/config-conventional"
88
+ ]
89
+ },
90
+ "release-it": {
91
+ "git": {
92
+ "commitMessage": "chore: release ${version}",
93
+ "tagName": "v${version}"
94
+ },
95
+ "npm": {
96
+ "publish": true
97
+ },
98
+ "github": {
99
+ "release": true
100
+ },
101
+ "plugins": {
102
+ "@release-it/conventional-changelog": {
103
+ "preset": "angular"
104
+ }
105
+ }
106
+ },
107
+ "eslintConfig": {
108
+ "root": true,
109
+ "parser": "@babel/eslint-parser",
110
+ "extends": [
111
+ "@react-native-community",
112
+ "prettier"
113
+ ],
114
+ "rules": {
115
+ "prettier/prettier": [
116
+ "error",
117
+ {
118
+ "quoteProps": "consistent",
119
+ "singleQuote": true,
120
+ "tabWidth": 2,
121
+ "trailingComma": "es5",
122
+ "useTabs": false
123
+ }
124
+ ]
59
125
  }
126
+ },
127
+ "eslintIgnore": [
128
+ "node_modules/",
129
+ "lib/"
130
+ ],
131
+ "prettier": {
132
+ "quoteProps": "consistent",
133
+ "singleQuote": true,
134
+ "tabWidth": 2,
135
+ "trailingComma": "es5",
136
+ "useTabs": false
137
+ },
138
+ "react-native-builder-bob": {
139
+ "source": "src",
140
+ "output": "lib",
141
+ "targets": [
142
+ "commonjs",
143
+ "module",
144
+ [
145
+ "typescript",
146
+ {
147
+ "project": "tsconfig.build.json"
148
+ }
149
+ ]
150
+ ]
60
151
  }
61
152
  }
@@ -1,28 +1,37 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = "react-native-smallcase-gateway"
7
8
  s.version = package["version"]
8
9
  s.summary = package["description"]
9
- s.description = <<-DESC
10
- react-native-smallcase-gateway
11
- DESC
12
- s.homepage = "https://github.com/mobile/react-native-smallcase-gateway"
13
- # brief license entry:
14
- s.license = "MIT"
15
- # optional - use expanded license entry instead:
16
- # s.license = { :type => "MIT", :file => "LICENSE" }
17
- s.authors = { "smallcase" => "mobile@smallcase.com" }
18
- s.platforms = { :ios => "11.0" }
19
- # s.source = { :git => "https://github.com/mobile/react-native-smallcase-gateway.git", :tag => "#{s.version}" }
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "10.0" }
20
15
  s.source = { :git => "https://github.com/smallcase/react-native-smallcase-gateway.git", :tag => "#{s.version}" }
21
16
  s.vendored_frameworks = 'SCGateway.xcframework'
22
- s.source_files = "ios/**/*.{h,c,m,swift}"
23
- s.requires_arc = true
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
24
18
 
25
19
  s.dependency "React-Core"
26
- s.dependency 'SCGateway', '3.8.3'
27
- end
28
20
 
21
+ # Don't install the dependencies when we run `pod install` in the old architecture.
22
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
24
+ s.pod_target_xcconfig = {
25
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
26
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
27
+ }
28
+
29
+ s.dependency "React-Codegen"
30
+ s.dependency "RCT-Folly"
31
+ s.dependency "RCTRequired"
32
+ s.dependency "RCTTypeSafety"
33
+ s.dependency "ReactCommon/turbomodule/core"
34
+ end
35
+
36
+ s.dependency 'SCGateway', '3.9.4'
37
+ end
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import SmallcaseGateway from "./SmallcaseGateway";
2
+ import { ENV, TRANSACTION_TYPE, ERROR_MSG } from "./constants";
3
+
4
+ export default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };
package/src/util.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * @param {*} obj
7
7
  * @returns {Object} same object if its valid, else returns `{}`
8
8
  */
9
- export const safeObject = (obj) => {
9
+ export const safeObject = (obj) => {
10
10
  return obj && typeof obj === "object" ? obj : {};
11
11
  };
12
12
 
package/android/README.md DELETED
@@ -1,14 +0,0 @@
1
- README
2
- ======
3
-
4
- If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5
-
6
- 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7
- 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8
- ```
9
- ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10
- sdk.dir=/Users/{username}/Library/Android/sdk
11
- ```
12
- 3. Delete the `maven` folder
13
- 4. Run `./gradlew installArchives`
14
- 5. Verify that latest set of generated files is in the maven folder with the correct version number
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- import SmallcaseGateway from "./src/SmallcaseGateway";
2
- import { ENV, TRANSACTION_TYPE, ERROR_MSG } from "./src/constants";
3
-
4
- export default { ...SmallcaseGateway, ENV, ERROR_MSG, TRANSACTION_TYPE };
@@ -1,5 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- @interface SmallcaseGateway : NSObject <RCTBridgeModule>
4
-
5
- @end
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "group:SmallcaseGateway.xcodeproj">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>