@appboxo/react-native-sdk 1.0.34 → 1.0.35

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
@@ -26,7 +26,7 @@ import { StyleSheet, View, Button } from 'react-native';
26
26
  export default function App() {
27
27
 
28
28
  React.useEffect(() => {
29
- appboxo.setConfig('[client_id]', false); //set your Appboxo client_id and specify multitask mode (by default is "true")
29
+ appboxo.setConfig('[client_id]', false, false); //set your Appboxo client_id, sandbox mode (by default is "false") and specify multitask mode (by default is "true")
30
30
  }, [])
31
31
 
32
32
  const handleOpenMiniapp = () => {
@@ -69,13 +69,14 @@ import { StyleSheet, View, Button } from 'react-native';
69
69
  export default function App() {
70
70
 
71
71
  React.useEffect(() => {
72
- appboxo.setConfig('[client_id]', false); //set your Appboxo client_id and specify multitask mode (by default is "true")
72
+ appboxo.setConfig('[client_id]', false, false); //set your Appboxo client_id, sandbox mode and specify multitask mode (by default is "true")
73
73
 
74
74
  const subscription = appboxo.lifecycleHooksListener({
75
75
  onLaunch: (appId: string) => console.log('onLaunch', appId), // called when the miniapp will launch with openMiniapp(...)
76
76
  onResume: (appId: string) => console.log('onResume', appId), // called when the miniapp will start interacting with the user
77
77
  onPause: (appId: string) => console.log('onPause', appId), // called when clicked close button in miniapp or when destroyed miniapp activity
78
78
  onClose: (appId: string) => console.log('onClose', appId), // called when the miniapp loses foreground state
79
+ onAuth: (appId: string) => console.log('onAuth', appId), // called when authorization flow starts
79
80
  onError: (appId: string, error: string) => console.log('onError', appId, error), // handle error
80
81
  });
81
82
 
@@ -64,7 +64,7 @@ public class RnappboxosdkModule extends ReactContextBaseJavaModule
64
64
  }
65
65
 
66
66
  @ReactMethod
67
- public void setConfig(String clientId, boolean enableMultitaskMode, String theme) {
67
+ public void setConfig(String clientId, boolean sandboxMode, boolean enableMultitaskMode, String theme) {
68
68
  Config.Theme globalTheme;
69
69
  switch (theme) {
70
70
  case "light":
@@ -79,6 +79,7 @@ public class RnappboxosdkModule extends ReactContextBaseJavaModule
79
79
  Appboxo.INSTANCE
80
80
  .setConfig(new Config.Builder()
81
81
  .setClientId(clientId)
82
+ .sandboxMode(sandboxMode)
82
83
  .multitaskMode(enableMultitaskMode)
83
84
  .setTheme(globalTheme)
84
85
  .build());
package/index.d.ts CHANGED
@@ -21,22 +21,21 @@ declare module '@appboxo/react-native-sdk' {
21
21
  /**
22
22
  * Set Appboxo clientId
23
23
  * @param {string} clientId Appboxo clientId
24
+ * @param {boolean} sandboxMode (by default false)
24
25
  * @param {boolean} enableMultitaskMode Enable multiscreen mode (by default true)
25
26
  * @param {'dark' | 'light'} theme Miniapp theme (by default 'system')
26
27
  * */
27
- export function setConfig(clientId: string, enableMultitaskMode?: boolean, theme?: 'dark' | 'light'): void
28
+ export function setConfig(clientId: string, sandboxMode?: boolean, enableMultitaskMode?: boolean, theme?: 'dark' | 'light'): void
28
29
 
29
30
  /**
30
31
  * Launch miniapp by id with payload and custom data
31
32
  * @param {string} miniAppId Appboxo miniAppId
32
- * @param {string} payload Appboxo payload for Appboxo miniapp
33
33
  * @param {{ data?: object, theme?: 'dark' | 'light' | 'system', extraUrlParams?: object }} options Appboxo options: data for send to miniapp,
34
34
  * theme Miniapp theme (by default is value of "theme" argument in setConfig function)
35
35
  * */
36
36
 
37
37
  export function openMiniapp(
38
38
  miniAppId: string,
39
- payload: string,
40
39
  options?: {
41
40
  data?: object,
42
41
  theme?: 'dark' | 'light' | 'system',
@@ -31,7 +31,7 @@ limitations under the License.
31
31
  RCT_EXPORT_MODULE()
32
32
 
33
33
 
34
- RCT_EXPORT_METHOD(setConfig:(NSString *)clientId multitaskMode:(BOOL)multitaskMode theme:(NSString *)theme)
34
+ RCT_EXPORT_METHOD(setConfig:(NSString *)clientId sandboxMode:(BOOL)sandboxMode multitaskMode:(BOOL)multitaskMode theme:(NSString *)theme)
35
35
  {
36
36
  NSArray *themes = @[@"dark", @"light", @"system"];
37
37
 
@@ -41,7 +41,10 @@ RCT_EXPORT_METHOD(setConfig:(NSString *)clientId multitaskMode:(BOOL)multitaskMo
41
41
  globalTheme = (Theme) [themes indexOfObject:theme];
42
42
  };
43
43
 
44
- [[Appboxo shared] setConfig: [[Config alloc] initWithClientId: clientId theme: globalTheme]];
44
+ Config *config = [[Config alloc] initWithClientId: clientId theme: globalTheme];
45
+ config.sandboxMode = sandboxMode;
46
+
47
+ [[Appboxo shared] setConfig: config];
45
48
  }
46
49
 
47
50
  RCT_EXPORT_METHOD(openMiniapp:(NSString *)appId data:(nullable NSDictionary<NSString *,id> *)data theme:(nullable NSString *)theme customUrlParams:(nullable NSDictionary<NSString *,id> *)customUrlParams)
package/js/mSetConfig.js CHANGED
@@ -3,8 +3,8 @@ import { NativeModules } from 'react-native'
3
3
  /**
4
4
  * Miniapp theme (by default 'system')
5
5
  * */
6
- const mSetConfig = (clientId, enableMultitaskMode = true, theme = 'system') => {
7
- NativeModules.Rnappboxosdk.setConfig(clientId, enableMultitaskMode, theme === 'dark' || theme === 'light' ? theme : 'system')
6
+ const mSetConfig = (clientId, sandboxMode = false, enableMultitaskMode = true, theme = 'system') => {
7
+ NativeModules.Rnappboxosdk.setConfig(clientId, sandboxMode, enableMultitaskMode, theme === 'dark' || theme === 'light' ? theme : 'system')
8
8
  }
9
9
 
10
10
  export default mSetConfig
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@appboxo/react-native-sdk",
3
3
  "title": "Appboxo react native sdk",
4
- "version": "1.0.34",
4
+ "version": "1.0.35",
5
5
  "description": "Appboxo react native sdk",
6
6
  "main": "index.js",
7
7
  "files": [
package/types.ts CHANGED
@@ -66,5 +66,6 @@ export interface LifecycleHooksCallbacks {
66
66
  onResume: (appId: string) => void
67
67
  onPause: (appId: string) => void
68
68
  onClose: (appId: string) => void
69
+ onAuth: (appId: string) => void
69
70
  onError: (appId: string, error: string) => void
70
71
  }