react-native-smallcase-gateway 0.7.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/CHANGELOG.md +130 -0
- package/LICENSE +21 -0
- package/README.md +147 -0
- package/android/README.md +14 -0
- package/android/build.gradle +161 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayModule.kt +260 -0
- package/android/src/main/java/com/smallcase/gateway/reactnative/SmallcaseGatewayPackage.kt +18 -0
- package/index.js +4 -0
- package/ios/SmallcaseGateway.h +5 -0
- package/ios/SmallcaseGateway.m +287 -0
- package/ios/SmallcaseGateway.xcodeproj/project.pbxproj +290 -0
- package/ios/SmallcaseGateway.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/SmallcaseGateway.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/package.json +62 -0
- package/react-native-smallcase-gateway.podspec +28 -0
- package/src/SmallcaseGateway.js +169 -0
- package/src/constants.js +33 -0
- package/src/util.js +11 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
18B09302250F83470012829C /* SmallcaseGateway.m in Sources */ = {isa = PBXBuildFile; fileRef = 18B09300250F83460012829C /* SmallcaseGateway.m */; };
|
|
11
|
+
/* End PBXBuildFile section */
|
|
12
|
+
|
|
13
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
14
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
15
|
+
isa = PBXCopyFilesBuildPhase;
|
|
16
|
+
buildActionMask = 2147483647;
|
|
17
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
18
|
+
dstSubfolderSpec = 16;
|
|
19
|
+
files = (
|
|
20
|
+
);
|
|
21
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
22
|
+
};
|
|
23
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
24
|
+
|
|
25
|
+
/* Begin PBXFileReference section */
|
|
26
|
+
134814201AA4EA6300B7C361 /* libSmallcaseGateway.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSmallcaseGateway.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
27
|
+
18B09300250F83460012829C /* SmallcaseGateway.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SmallcaseGateway.m; sourceTree = "<group>"; };
|
|
28
|
+
18B09301250F83460012829C /* SmallcaseGateway.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmallcaseGateway.h; sourceTree = "<group>"; };
|
|
29
|
+
/* End PBXFileReference section */
|
|
30
|
+
|
|
31
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
32
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
33
|
+
isa = PBXFrameworksBuildPhase;
|
|
34
|
+
buildActionMask = 2147483647;
|
|
35
|
+
files = (
|
|
36
|
+
);
|
|
37
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
38
|
+
};
|
|
39
|
+
/* End PBXFrameworksBuildPhase section */
|
|
40
|
+
|
|
41
|
+
/* Begin PBXGroup section */
|
|
42
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
43
|
+
isa = PBXGroup;
|
|
44
|
+
children = (
|
|
45
|
+
134814201AA4EA6300B7C361 /* libSmallcaseGateway.a */,
|
|
46
|
+
);
|
|
47
|
+
name = Products;
|
|
48
|
+
sourceTree = "<group>";
|
|
49
|
+
};
|
|
50
|
+
58B511D21A9E6C8500147676 = {
|
|
51
|
+
isa = PBXGroup;
|
|
52
|
+
children = (
|
|
53
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
54
|
+
18B09301250F83460012829C /* SmallcaseGateway.h */,
|
|
55
|
+
18B09300250F83460012829C /* SmallcaseGateway.m */,
|
|
56
|
+
);
|
|
57
|
+
sourceTree = "<group>";
|
|
58
|
+
};
|
|
59
|
+
/* End PBXGroup section */
|
|
60
|
+
|
|
61
|
+
/* Begin PBXNativeTarget section */
|
|
62
|
+
58B511DA1A9E6C8500147676 /* SmallcaseGateway */ = {
|
|
63
|
+
isa = PBXNativeTarget;
|
|
64
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "SmallcaseGateway" */;
|
|
65
|
+
buildPhases = (
|
|
66
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
67
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
68
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
69
|
+
);
|
|
70
|
+
buildRules = (
|
|
71
|
+
);
|
|
72
|
+
dependencies = (
|
|
73
|
+
);
|
|
74
|
+
name = SmallcaseGateway;
|
|
75
|
+
productName = RCTDataManager;
|
|
76
|
+
productReference = 134814201AA4EA6300B7C361 /* libSmallcaseGateway.a */;
|
|
77
|
+
productType = "com.apple.product-type.library.static";
|
|
78
|
+
};
|
|
79
|
+
/* End PBXNativeTarget section */
|
|
80
|
+
|
|
81
|
+
/* Begin PBXProject section */
|
|
82
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
83
|
+
isa = PBXProject;
|
|
84
|
+
attributes = {
|
|
85
|
+
LastUpgradeCheck = 0920;
|
|
86
|
+
ORGANIZATIONNAME = Facebook;
|
|
87
|
+
TargetAttributes = {
|
|
88
|
+
58B511DA1A9E6C8500147676 = {
|
|
89
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "SmallcaseGateway" */;
|
|
94
|
+
compatibilityVersion = "Xcode 3.2";
|
|
95
|
+
developmentRegion = en;
|
|
96
|
+
hasScannedForEncodings = 0;
|
|
97
|
+
knownRegions = (
|
|
98
|
+
en,
|
|
99
|
+
Base,
|
|
100
|
+
);
|
|
101
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
102
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
103
|
+
projectDirPath = "";
|
|
104
|
+
projectRoot = "";
|
|
105
|
+
targets = (
|
|
106
|
+
58B511DA1A9E6C8500147676 /* SmallcaseGateway */,
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
/* End PBXProject section */
|
|
110
|
+
|
|
111
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
112
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
113
|
+
isa = PBXSourcesBuildPhase;
|
|
114
|
+
buildActionMask = 2147483647;
|
|
115
|
+
files = (
|
|
116
|
+
18B09302250F83470012829C /* SmallcaseGateway.m in Sources */,
|
|
117
|
+
);
|
|
118
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
119
|
+
};
|
|
120
|
+
/* End PBXSourcesBuildPhase section */
|
|
121
|
+
|
|
122
|
+
/* Begin XCBuildConfiguration section */
|
|
123
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
124
|
+
isa = XCBuildConfiguration;
|
|
125
|
+
buildSettings = {
|
|
126
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
127
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
128
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
129
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
130
|
+
CLANG_ENABLE_MODULES = YES;
|
|
131
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
132
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
133
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
134
|
+
CLANG_WARN_COMMA = YES;
|
|
135
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
136
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
137
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
138
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
139
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
140
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
141
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
142
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
143
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
144
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
145
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
146
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
147
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
148
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
149
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
150
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
151
|
+
COPY_PHASE_STRIP = NO;
|
|
152
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
153
|
+
ENABLE_TESTABILITY = YES;
|
|
154
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
155
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
156
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
157
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
158
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
159
|
+
"DEBUG=1",
|
|
160
|
+
"$(inherited)",
|
|
161
|
+
);
|
|
162
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
163
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
164
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
165
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
166
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
167
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
168
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
169
|
+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
|
170
|
+
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
171
|
+
LIBRARY_SEARCH_PATHS = (
|
|
172
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
173
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
174
|
+
"\"$(inherited)\"",
|
|
175
|
+
);
|
|
176
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
177
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
178
|
+
SDKROOT = iphoneos;
|
|
179
|
+
};
|
|
180
|
+
name = Debug;
|
|
181
|
+
};
|
|
182
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
183
|
+
isa = XCBuildConfiguration;
|
|
184
|
+
buildSettings = {
|
|
185
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
186
|
+
CLANG_ANALYZER_NONNULL = YES;
|
|
187
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
188
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
189
|
+
CLANG_ENABLE_MODULES = YES;
|
|
190
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
191
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
192
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
193
|
+
CLANG_WARN_COMMA = YES;
|
|
194
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
196
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
197
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
198
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
199
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
200
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
201
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
202
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
203
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
204
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
205
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
206
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
207
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
208
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
209
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
210
|
+
COPY_PHASE_STRIP = YES;
|
|
211
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
212
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
213
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
214
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
215
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
216
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
217
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
218
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
219
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
220
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
221
|
+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
|
222
|
+
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
|
|
223
|
+
LIBRARY_SEARCH_PATHS = (
|
|
224
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
|
|
225
|
+
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
226
|
+
"\"$(inherited)\"",
|
|
227
|
+
);
|
|
228
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
229
|
+
SDKROOT = iphoneos;
|
|
230
|
+
VALIDATE_PRODUCT = YES;
|
|
231
|
+
};
|
|
232
|
+
name = Release;
|
|
233
|
+
};
|
|
234
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
235
|
+
isa = XCBuildConfiguration;
|
|
236
|
+
buildSettings = {
|
|
237
|
+
HEADER_SEARCH_PATHS = (
|
|
238
|
+
"$(inherited)",
|
|
239
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
240
|
+
"$(SRCROOT)/../../../React/**",
|
|
241
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
242
|
+
);
|
|
243
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
244
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
245
|
+
PRODUCT_NAME = SmallcaseGateway;
|
|
246
|
+
SKIP_INSTALL = YES;
|
|
247
|
+
};
|
|
248
|
+
name = Debug;
|
|
249
|
+
};
|
|
250
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
251
|
+
isa = XCBuildConfiguration;
|
|
252
|
+
buildSettings = {
|
|
253
|
+
HEADER_SEARCH_PATHS = (
|
|
254
|
+
"$(inherited)",
|
|
255
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
256
|
+
"$(SRCROOT)/../../../React/**",
|
|
257
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
258
|
+
);
|
|
259
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
260
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
261
|
+
PRODUCT_NAME = SmallcaseGateway;
|
|
262
|
+
SKIP_INSTALL = YES;
|
|
263
|
+
};
|
|
264
|
+
name = Release;
|
|
265
|
+
};
|
|
266
|
+
/* End XCBuildConfiguration section */
|
|
267
|
+
|
|
268
|
+
/* Begin XCConfigurationList section */
|
|
269
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "SmallcaseGateway" */ = {
|
|
270
|
+
isa = XCConfigurationList;
|
|
271
|
+
buildConfigurations = (
|
|
272
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
273
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
274
|
+
);
|
|
275
|
+
defaultConfigurationIsVisible = 0;
|
|
276
|
+
defaultConfigurationName = Release;
|
|
277
|
+
};
|
|
278
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "SmallcaseGateway" */ = {
|
|
279
|
+
isa = XCConfigurationList;
|
|
280
|
+
buildConfigurations = (
|
|
281
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
282
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
283
|
+
);
|
|
284
|
+
defaultConfigurationIsVisible = 0;
|
|
285
|
+
defaultConfigurationName = Release;
|
|
286
|
+
};
|
|
287
|
+
/* End XCConfigurationList section */
|
|
288
|
+
};
|
|
289
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
290
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-smallcase-gateway",
|
|
3
|
+
"title": "React Native Smallcase Gateway",
|
|
4
|
+
"version": "0.7.0",
|
|
5
|
+
"description": "smallcase gateway bindings for react native",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"index.js",
|
|
10
|
+
"android/src",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"ios",
|
|
13
|
+
"react-native-smallcase-gateway.podspec"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"commit": "yarn cz",
|
|
17
|
+
"test": "jest --coverage",
|
|
18
|
+
"postinstall": "sh init-githooks.sh 2>/dev/null || :",
|
|
19
|
+
"release:minor": "standard-version --release-as minor",
|
|
20
|
+
"release:patch": "standard-version --release-as patch",
|
|
21
|
+
"release:major": "standard-version --release-as major"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://gitlab.com:scGatewayOS/react-native-smallcase-gateway.git",
|
|
26
|
+
"baseUrl": "https://gitlab.com/scGatewayOS/react-native-smallcase-gateway.git"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"react-native"
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://developers.gateway.smallcase.com/docs/react-native-integration",
|
|
32
|
+
"author": {
|
|
33
|
+
"name": "smallcase",
|
|
34
|
+
"email": "mobile@smallcase.com"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"licenseFilename": "LICENSE",
|
|
38
|
+
"readmeFilename": "README.md",
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^16.8.1",
|
|
41
|
+
"react-native": ">=0.60.0-rc.0 <1.0.x"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@babel/core": "^7.12.3",
|
|
45
|
+
"@babel/preset-env": "^7.12.1",
|
|
46
|
+
"@commitlint/cli": "^11.0.0",
|
|
47
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
48
|
+
"babel-jest": "^26.6.3",
|
|
49
|
+
"commitizen": "^4.2.2",
|
|
50
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
51
|
+
"jest": "^26.6.3",
|
|
52
|
+
"jest-junit": "^12.0.0",
|
|
53
|
+
"react": "^16.9.0",
|
|
54
|
+
"react-native": "^0.61.5",
|
|
55
|
+
"standard-version": "^9.0.0"
|
|
56
|
+
},
|
|
57
|
+
"config": {
|
|
58
|
+
"commitizen": {
|
|
59
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-smallcase-gateway"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
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}" }
|
|
20
|
+
s.source = { :git => "https://github.com/smallcase/react-native-smallcase-gateway.git", :tag => "#{s.version}" }
|
|
21
|
+
|
|
22
|
+
s.source_files = "ios/**/*.{h,c,m,swift}"
|
|
23
|
+
s.requires_arc = true
|
|
24
|
+
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
s.dependency 'SCGateway', '3.0.4'
|
|
27
|
+
end
|
|
28
|
+
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { NativeModules } from "react-native";
|
|
2
|
+
import { ENV } from "./constants";
|
|
3
|
+
import { safeObject } from "./util";
|
|
4
|
+
const { SmallcaseGateway: SmallcaseGatewayNative } = NativeModules;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @typedef {Object} envConfig
|
|
9
|
+
* @property {string} gatewayName - unique name on consumer
|
|
10
|
+
* @property {boolean} isLeprechaun - leprechaun mode toggle
|
|
11
|
+
* @property {boolean} isAmoEnabled - support AMO (subject to broker support)
|
|
12
|
+
* @property {Array<string>} brokerList - list of broker names
|
|
13
|
+
* @property {'production' | 'staging' | 'development'} environmentName - environment name
|
|
14
|
+
*
|
|
15
|
+
* @typedef {Object} transactionRes
|
|
16
|
+
* @property {string} data - response data
|
|
17
|
+
* @property {boolean} success - success flag
|
|
18
|
+
* @property {Number} [errorCode] - error code
|
|
19
|
+
* @property {string} transaction - transaction name
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} userDetails
|
|
22
|
+
* @property {String} name - name of user
|
|
23
|
+
* @property {String} email - email of user
|
|
24
|
+
* @property {String} contact - contact of user
|
|
25
|
+
* @property {String} pinCode - pin-code of user
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
let defaultBrokerList = [];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* configure the sdk with
|
|
32
|
+
* @param {envConfig} envConfig
|
|
33
|
+
*/
|
|
34
|
+
const setConfigEnvironment = async (envConfig) => {
|
|
35
|
+
const safeConfig = safeObject(envConfig);
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
brokerList,
|
|
39
|
+
gatewayName,
|
|
40
|
+
isLeprechaun,
|
|
41
|
+
isAmoEnabled,
|
|
42
|
+
environmentName,
|
|
43
|
+
} = safeConfig;
|
|
44
|
+
|
|
45
|
+
const safeIsLeprechaun = Boolean(isLeprechaun);
|
|
46
|
+
const safeIsAmoEnabled = Boolean(isAmoEnabled);
|
|
47
|
+
const safeBrokerList = Array.isArray(brokerList) ? brokerList : [];
|
|
48
|
+
const safeGatewayName = typeof gatewayName === "string" ? gatewayName : "";
|
|
49
|
+
const safeEnvName =
|
|
50
|
+
typeof environmentName === "string" ? environmentName : ENV.PROD;
|
|
51
|
+
|
|
52
|
+
defaultBrokerList = safeBrokerList;
|
|
53
|
+
|
|
54
|
+
await SmallcaseGatewayNative.setConfigEnvironment(
|
|
55
|
+
safeEnvName,
|
|
56
|
+
safeGatewayName,
|
|
57
|
+
safeIsLeprechaun,
|
|
58
|
+
safeIsAmoEnabled,
|
|
59
|
+
safeBrokerList
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* initialize sdk with a session
|
|
65
|
+
*
|
|
66
|
+
* note: this must be called after `setConfigEnvironment()`
|
|
67
|
+
* @param {string} sdkToken
|
|
68
|
+
*/
|
|
69
|
+
const init = async (sdkToken) => {
|
|
70
|
+
const safeToken = typeof sdkToken === "string" ? sdkToken : "";
|
|
71
|
+
await SmallcaseGatewayNative.init(safeToken);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* triggers a transaction with a transaction id
|
|
76
|
+
*
|
|
77
|
+
* @param {string} transactionId
|
|
78
|
+
* @param {Object} [utmParams]
|
|
79
|
+
* @param {Array<string>} [brokerList]
|
|
80
|
+
* @returns {Promise<transactionRes>}
|
|
81
|
+
*/
|
|
82
|
+
const triggerTransaction = async (transactionId, utmParams, brokerList) => {
|
|
83
|
+
const safeUtm = safeObject(utmParams);
|
|
84
|
+
const safeId = typeof transactionId === "string" ? transactionId : "";
|
|
85
|
+
|
|
86
|
+
const safeBrokerList =
|
|
87
|
+
Array.isArray(brokerList) && brokerList.length
|
|
88
|
+
? brokerList
|
|
89
|
+
: defaultBrokerList;
|
|
90
|
+
|
|
91
|
+
return SmallcaseGatewayNative.triggerTransaction(
|
|
92
|
+
safeId,
|
|
93
|
+
safeUtm,
|
|
94
|
+
safeBrokerList
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Logs the user out and removes the web session.
|
|
100
|
+
*
|
|
101
|
+
* This promise will be rejected if logout was unsuccessful
|
|
102
|
+
*
|
|
103
|
+
* @returns {Promise}
|
|
104
|
+
*/
|
|
105
|
+
const logoutUser = async () => {
|
|
106
|
+
return SmallcaseGatewayNative.logoutUser();
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* triggers the lead gen flow
|
|
111
|
+
*
|
|
112
|
+
* @param {userDetails} [userDetails]
|
|
113
|
+
* @param {Object} [utmParams]
|
|
114
|
+
*/
|
|
115
|
+
const triggerLeadGen = (userDetails, utmParams) => {
|
|
116
|
+
const safeParams = safeObject(userDetails);
|
|
117
|
+
const safeUtm = safeObject(utmParams);
|
|
118
|
+
|
|
119
|
+
return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// /**
|
|
123
|
+
// * triggers the lead gen flow
|
|
124
|
+
// *
|
|
125
|
+
// * @param {userDetails} [userDetails]
|
|
126
|
+
// * @param {Object} [utmParams]
|
|
127
|
+
// * * @returns {Promise}
|
|
128
|
+
// */
|
|
129
|
+
// const triggerLeadGen = async (userDetails, utmParams) => {
|
|
130
|
+
// const safeParams = safeObject(userDetails);
|
|
131
|
+
// const safeUtm = safeObject(utmParams);
|
|
132
|
+
|
|
133
|
+
// return SmallcaseGatewayNative.triggerLeadGen(safeParams, safeUtm)
|
|
134
|
+
// }
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* triggers the lead gen flow
|
|
138
|
+
*
|
|
139
|
+
* @param {userDetails} [userDetails]
|
|
140
|
+
* * @returns {Promise}
|
|
141
|
+
*/
|
|
142
|
+
const triggerLeadGenWithStatus = async (userDetails) => {
|
|
143
|
+
const safeParams = safeObject(userDetails);
|
|
144
|
+
|
|
145
|
+
return SmallcaseGatewayNative.triggerLeadGenWithStatus(safeParams);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Marks a smallcase as archived
|
|
150
|
+
*
|
|
151
|
+
* @param {String} iscid
|
|
152
|
+
*/
|
|
153
|
+
const archiveSmallcase = async (iscid) => {
|
|
154
|
+
const safeIscid = typeof iscid === "string" ? iscid : "";
|
|
155
|
+
|
|
156
|
+
return SmallcaseGatewayNative.archiveSmallcase(safeIscid);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const SmallcaseGateway = {
|
|
160
|
+
init,
|
|
161
|
+
logoutUser,
|
|
162
|
+
triggerLeadGen,
|
|
163
|
+
triggerLeadGenWithStatus,
|
|
164
|
+
archiveSmallcase,
|
|
165
|
+
triggerTransaction,
|
|
166
|
+
setConfigEnvironment,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default SmallcaseGateway;
|
package/src/constants.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const ENV = {
|
|
2
|
+
STAG: "staging",
|
|
3
|
+
DEV: "development",
|
|
4
|
+
PROD: "production",
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const TRANSACTION_TYPE = {
|
|
8
|
+
connect: "CONNECT",
|
|
9
|
+
sipSetup: "SIP_SETUP",
|
|
10
|
+
fetchFunds: "FETCH_FUNDS",
|
|
11
|
+
transaction: "TRANSACTION",
|
|
12
|
+
holdingsImport: "HOLDINGS_IMPORT",
|
|
13
|
+
authorizeHoldings: "AUTHORISE_HOLDINGS",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ERROR_MSG = {
|
|
17
|
+
init_sdk: "init_sdk",
|
|
18
|
+
no_order: "no_order",
|
|
19
|
+
no_broker: "no_broker",
|
|
20
|
+
invalid_jwt: "invalid_jwt",
|
|
21
|
+
market_closed: "market_closed",
|
|
22
|
+
user_mismatch: "user_mismatch",
|
|
23
|
+
order_pending: "order_pending",
|
|
24
|
+
internal_error: "internal_error",
|
|
25
|
+
user_cancelled: "user_cancelled",
|
|
26
|
+
consent_denied: "consent_denied",
|
|
27
|
+
order_in_queue: "order_in_queue",
|
|
28
|
+
invalid_gateway: "invalid_gateway",
|
|
29
|
+
transaction_expired: "transaction_expired",
|
|
30
|
+
invalid_transactionId: "invalid_transactionId",
|
|
31
|
+
insufficient_holdings: "insufficient_holdings",
|
|
32
|
+
transaction_in_process: "transaction_in_process",
|
|
33
|
+
};
|
package/src/util.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|