@castleio/react-native-castle 1.0.8 → 1.1.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 CHANGED
@@ -35,6 +35,26 @@ yarn add @castleio/react-native-castle
35
35
  npm install --save @castleio/react-native-castle
36
36
  ```
37
37
 
38
+ ### Linking Native Code on iOS
39
+ Run `pod install` in the `ios` directory in order to link to the native iOS project. A shortcut for doing this without switching directories is to run
40
+
41
+ ```bash
42
+ npx pod-install
43
+ ```
44
+
45
+ Once completed, re-build the app binary and start using the library
46
+
47
+ ```bash
48
+ npx react-native run-ios
49
+ ```
50
+
51
+ ### Liking Native Code on Android
52
+ In order to start using the library you'll need to re-build the app binary
53
+
54
+ ```bash
55
+ npx react-native run-android
56
+ ```
57
+
38
58
  ## Usage
39
59
 
40
60
  Please see the [Mobile Integration Guide](https://docs.castle.io).
File without changes
File without changes
@@ -9,7 +9,7 @@ buildscript {
9
9
  }
10
10
 
11
11
  dependencies {
12
- classpath 'com.android.tools.build:gradle:3.2.1'
12
+ classpath 'com.android.tools.build:gradle:7.0.2'
13
13
  // noinspection DifferentKotlinGradleVersion
14
14
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15
15
  }
@@ -32,9 +32,6 @@ android {
32
32
  defaultConfig {
33
33
  minSdkVersion 21
34
34
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
35
- versionCode 1
36
- versionName "1.0"
37
-
38
35
  }
39
36
 
40
37
  buildTypes {
@@ -128,5 +125,5 @@ dependencies {
128
125
  // noinspection GradleDynamicVersion
129
126
  api 'com.facebook.react:react-native:+'
130
127
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
131
- api 'io.castle.android:castle:2.0.3'
128
+ api 'io.castle.android:castle:2.1.3'
132
129
  }
@@ -1,4 +1,4 @@
1
- Castle_kotlinVersion=1.3.50
2
- Castle_compileSdkVersion=29
3
- Castle_buildToolsVersion=29.0.2
4
- Castle_targetSdkVersion=29
1
+ Castle_kotlinVersion=1.5.10
2
+ Castle_compileSdkVersion=30
3
+ Castle_buildToolsVersion=30.0.2
4
+ Castle_targetSdkVersion=30
@@ -12,13 +12,13 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
12
12
  }
13
13
 
14
14
  @ReactMethod
15
- fun clientIdHeaderName(promise: Promise) {
16
- promise.resolve(Castle.clientIdHeaderName)
15
+ fun requestTokenHeaderName(promise: Promise) {
16
+ promise.resolve(Castle.requestTokenHeaderName)
17
17
  }
18
18
 
19
19
  @ReactMethod
20
- fun versionString(promise: Promise) {
21
- promise.resolve(BuildConfig.VERSION_NAME)
20
+ fun clientIdHeaderName(promise: Promise) {
21
+ promise.resolve(Castle.clientIdHeaderName)
22
22
  }
23
23
 
24
24
  @ReactMethod
@@ -129,7 +129,12 @@ class CastleModule(reactContext: ReactApplicationContext) : ReactContextBaseJava
129
129
 
130
130
  @ReactMethod
131
131
  fun clientId(promise: Promise) {
132
- promise.resolve(Castle.clientId())
132
+ promise.resolve(Castle.createRequestToken())
133
+ }
134
+
135
+ @ReactMethod
136
+ fun createRequestToken(promise: Promise) {
137
+ promise.resolve(Castle.createRequestToken())
133
138
  }
134
139
 
135
140
  @ReactMethod
package/ios/RCTCastle.m CHANGED
@@ -21,6 +21,16 @@ RCT_EXPORT_METHOD(clientIdHeaderName
21
21
  resolver(CastleClientIdHeaderName);
22
22
  }
23
23
 
24
+ /**
25
+ Get request token header name
26
+ */
27
+ RCT_EXPORT_METHOD(requestTokenHeaderName
28
+ :(RCTPromiseResolveBlock)resolver
29
+ :(RCTPromiseRejectBlock)rejecter)
30
+ {
31
+ resolver(CastleRequestTokenHeaderName);
32
+ }
33
+
24
34
  #pragma mark - Configuration
25
35
 
26
36
  /**
@@ -180,15 +190,28 @@ RCT_EXPORT_METHOD(baseUrl
180
190
  #pragma mark - Metadata
181
191
 
182
192
  /**
183
- Get client identifier if set, otherwise returns nil
184
-
185
- @return client identifier
193
+ Get client id
194
+
195
+ @return request token
186
196
  */
187
197
  RCT_EXPORT_METHOD(clientId
188
198
  :(RCTPromiseResolveBlock)resolver
189
199
  :(RCTPromiseRejectBlock)rejecter)
190
200
  {
191
- NSString *clientId = [Castle clientId];
201
+ NSString *clientId = [Castle createRequestToken];
202
+ return resolver(clientId);
203
+ }
204
+
205
+ /**
206
+ Create request token
207
+
208
+ @return request token
209
+ */
210
+ RCT_EXPORT_METHOD(createRequestToken
211
+ :(RCTPromiseResolveBlock)resolver
212
+ :(RCTPromiseRejectBlock)rejecter)
213
+ {
214
+ NSString *clientId = [Castle createRequestToken];
192
215
  return resolver(clientId);
193
216
  }
194
217
 
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["Castle","NativeModules","Error"],"mappings":";;;;;;;AAAA;;AAsCO,MAAM;AAAEA,EAAAA;AAAF,IAAaC,0BAAnB;;;AAEP,IAAI,CAACD,MAAL,EAAa;AACX,QAAM,IAAIE,KAAJ,CAAU,sCAAV,CAAN;AACD;;eAEcF,M","sourcesContent":["import { NativeModules } from 'react-native';\n\nexport interface Configuration {\n publishableKey: string;\n debugLoggingEnabled?: boolean;\n maxQueueLimit?: number;\n flushLimit?: number;\n useCloudflareApp?: boolean;\n apiDomain?: string;\n apiPath?: string;\n baseURLAllowList?: string[];\n}\n\nexport type JsonValue = boolean | number | string | null | JsonList | JsonMap;\nexport interface JsonMap {\n [key: string]: JsonValue;\n [index: number]: JsonValue;\n}\nexport interface JsonList extends Array<JsonValue> {}\n\ntype CastleType = {\n configure(configuration: Configuration): Promise<void>;\n configureWithPublishableKey(publishableKey: string): Promise<void>;\n identify(userId: string, traits: JsonMap): Promise<void>;\n secure(identifier: string): Promise<string>;\n screen(name: string): Promise<void>;\n flush(): Promise<void>;\n flushIfNeeded(url: string): Promise<boolean>;\n reset(): Promise<void>;\n baseUrl(): Promise<string>;\n clientId(): Promise<string>;\n clientIdHeaderName(): Promise<string>;\n userId(): Promise<string>;\n userSignature(): Promise<string>;\n userAgent(): Promise<string>;\n queueSize(): Promise<number>;\n};\n\nexport const { Castle } = NativeModules;\n\nif (!Castle) {\n throw new Error('Failed to load Castle native module.');\n}\n\nexport default Castle as CastleType;\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["Castle","NativeModules","Error"],"mappings":";;;;;;;AAAA;;AAwCO,MAAM;AAAEA,EAAAA;AAAF,IAAaC,0BAAnB;;;AAEP,IAAI,CAACD,MAAL,EAAa;AACX,QAAM,IAAIE,KAAJ,CAAU,sCAAV,CAAN;AACD;;eAEcF,M","sourcesContent":["import { NativeModules } from 'react-native';\n\nexport interface Configuration {\n publishableKey: string;\n debugLoggingEnabled?: boolean;\n maxQueueLimit?: number;\n flushLimit?: number;\n useCloudflareApp?: boolean;\n apiDomain?: string;\n apiPath?: string;\n baseURLAllowList?: string[];\n}\n\nexport type JsonValue = boolean | number | string | null | JsonList | JsonMap;\nexport interface JsonMap {\n [key: string]: JsonValue;\n [index: number]: JsonValue;\n}\nexport interface JsonList extends Array<JsonValue> {}\n\ntype CastleType = {\n configure(configuration: Configuration): Promise<void>;\n configureWithPublishableKey(publishableKey: string): Promise<void>;\n identify(userId: string, traits: JsonMap): Promise<void>;\n secure(identifier: string): Promise<string>;\n screen(name: string): Promise<void>;\n flush(): Promise<void>;\n flushIfNeeded(url: string): Promise<boolean>;\n reset(): Promise<void>;\n baseUrl(): Promise<string>;\n clientId(): Promise<string>;\n clientIdHeaderName(): Promise<string>;\n createRequestToken(): Promise<string>;\n requestTokenHeaderName(): Promise<string>;\n userId(): Promise<string>;\n userSignature(): Promise<string>;\n userAgent(): Promise<string>;\n queueSize(): Promise<number>;\n};\n\nexport const { Castle } = NativeModules;\n\nif (!Castle) {\n throw new Error('Failed to load Castle native module.');\n}\n\nexport default Castle as CastleType;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["NativeModules","Castle","Error"],"mappings":"AAAA,SAASA,aAAT,QAA8B,cAA9B;AAsCA,OAAO,MAAM;AAAEC,EAAAA;AAAF,IAAaD,aAAnB;;AAEP,IAAI,CAACC,MAAL,EAAa;AACX,QAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,eAAeD,MAAf","sourcesContent":["import { NativeModules } from 'react-native';\n\nexport interface Configuration {\n publishableKey: string;\n debugLoggingEnabled?: boolean;\n maxQueueLimit?: number;\n flushLimit?: number;\n useCloudflareApp?: boolean;\n apiDomain?: string;\n apiPath?: string;\n baseURLAllowList?: string[];\n}\n\nexport type JsonValue = boolean | number | string | null | JsonList | JsonMap;\nexport interface JsonMap {\n [key: string]: JsonValue;\n [index: number]: JsonValue;\n}\nexport interface JsonList extends Array<JsonValue> {}\n\ntype CastleType = {\n configure(configuration: Configuration): Promise<void>;\n configureWithPublishableKey(publishableKey: string): Promise<void>;\n identify(userId: string, traits: JsonMap): Promise<void>;\n secure(identifier: string): Promise<string>;\n screen(name: string): Promise<void>;\n flush(): Promise<void>;\n flushIfNeeded(url: string): Promise<boolean>;\n reset(): Promise<void>;\n baseUrl(): Promise<string>;\n clientId(): Promise<string>;\n clientIdHeaderName(): Promise<string>;\n userId(): Promise<string>;\n userSignature(): Promise<string>;\n userAgent(): Promise<string>;\n queueSize(): Promise<number>;\n};\n\nexport const { Castle } = NativeModules;\n\nif (!Castle) {\n throw new Error('Failed to load Castle native module.');\n}\n\nexport default Castle as CastleType;\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["NativeModules","Castle","Error"],"mappings":"AAAA,SAASA,aAAT,QAA8B,cAA9B;AAwCA,OAAO,MAAM;AAAEC,EAAAA;AAAF,IAAaD,aAAnB;;AAEP,IAAI,CAACC,MAAL,EAAa;AACX,QAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,eAAeD,MAAf","sourcesContent":["import { NativeModules } from 'react-native';\n\nexport interface Configuration {\n publishableKey: string;\n debugLoggingEnabled?: boolean;\n maxQueueLimit?: number;\n flushLimit?: number;\n useCloudflareApp?: boolean;\n apiDomain?: string;\n apiPath?: string;\n baseURLAllowList?: string[];\n}\n\nexport type JsonValue = boolean | number | string | null | JsonList | JsonMap;\nexport interface JsonMap {\n [key: string]: JsonValue;\n [index: number]: JsonValue;\n}\nexport interface JsonList extends Array<JsonValue> {}\n\ntype CastleType = {\n configure(configuration: Configuration): Promise<void>;\n configureWithPublishableKey(publishableKey: string): Promise<void>;\n identify(userId: string, traits: JsonMap): Promise<void>;\n secure(identifier: string): Promise<string>;\n screen(name: string): Promise<void>;\n flush(): Promise<void>;\n flushIfNeeded(url: string): Promise<boolean>;\n reset(): Promise<void>;\n baseUrl(): Promise<string>;\n clientId(): Promise<string>;\n clientIdHeaderName(): Promise<string>;\n createRequestToken(): Promise<string>;\n requestTokenHeaderName(): Promise<string>;\n userId(): Promise<string>;\n userSignature(): Promise<string>;\n userAgent(): Promise<string>;\n queueSize(): Promise<number>;\n};\n\nexport const { Castle } = NativeModules;\n\nif (!Castle) {\n throw new Error('Failed to load Castle native module.');\n}\n\nexport default Castle as CastleType;\n"]}
@@ -27,6 +27,8 @@ declare type CastleType = {
27
27
  baseUrl(): Promise<string>;
28
28
  clientId(): Promise<string>;
29
29
  clientIdHeaderName(): Promise<string>;
30
+ createRequestToken(): Promise<string>;
31
+ requestTokenHeaderName(): Promise<string>;
30
32
  userId(): Promise<string>;
31
33
  userSignature(): Promise<string>;
32
34
  userAgent(): Promise<string>;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@castleio/react-native-castle",
3
- "version": "1.0.8",
3
+ "version": "1.1.3",
4
4
  "description": "Castle SDK for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
7
- "types": "lib/typescript/src/index.d.ts",
7
+ "types": "lib/typescript/index.d.ts",
8
8
  "react-native": "src/index",
9
9
  "source": "src/index",
10
10
  "files": [
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "Castle", "2.0.0"
19
+ s.dependency "Castle", "2.1.6"
20
20
  end
package/src/index.tsx CHANGED
@@ -30,6 +30,8 @@ type CastleType = {
30
30
  baseUrl(): Promise<string>;
31
31
  clientId(): Promise<string>;
32
32
  clientIdHeaderName(): Promise<string>;
33
+ createRequestToken(): Promise<string>;
34
+ requestTokenHeaderName(): Promise<string>;
33
35
  userId(): Promise<string>;
34
36
  userSignature(): Promise<string>;
35
37
  userAgent(): Promise<string>;
package/CHANGELOG.md DELETED
@@ -1,49 +0,0 @@
1
- # Changelog
2
-
3
- ## 1.0.8 (2021-05-06)
4
- **Bug fixes:**
5
-
6
- - [#31](https://github.com/castle/castle-react-native/pull/31) Update to Castle Android 2.0.3
7
- - [#30](https://github.com/castle/castle-react-native/pull/30) remove package-lock.json from the example
8
-
9
- ## 1.0.7 (2021-05-03)
10
- **Bug fixes:**
11
-
12
- - [#28](https://github.com/castle/castle-react-native/pull/28) iOS call native module on main thread
13
- - [#27](https://github.com/castle/castle-react-native/pull/27) update to Castle Android 2.0.2
14
-
15
-
16
- ## 1.0.6 (2021-04-28)
17
- **Bug fixes:**
18
-
19
- - [#24](https://github.com/castle/castle-react-native/pull/24) update to Castle Android 2.0.1
20
- - [#23](https://github.com/castle/castle-react-native/pull/23) update to Castle iOS 2.0.0
21
-
22
- ## 1.0.5 (2021-03-29)
23
- **Bug fixes:**
24
-
25
- - [#20](https://github.com/castle/castle-react-native/pull/20) update Castle type
26
-
27
- ## 1.0.4 (2021-03-12)
28
- **Enhancements:**
29
-
30
- - [#17](https://github.com/castle/castle-react-native/pull/17) update supported Android version
31
- - [#16](https://github.com/castle/castle-react-native/pull/16) link to Castle Docs
32
-
33
- ## 1.0.3 (2021-03-11)
34
- **Enhancements:**
35
-
36
- - [#14](https://github.com/castle/castle-react-native/pull/14) update example
37
-
38
- ## 1.0.2 (2021-03-11)
39
- **Enhancements:**
40
-
41
- - add release instructions
42
-
43
- ## 1.0.1 (2021-03-11)
44
- **Enhancements:**
45
-
46
- - [#11](https://github.com/castle/castle-react-native/pull/11) update badges and instructions
47
-
48
- ## 1.0.0 (2021-03-11)
49
- Initial public release