@appboxo/capacitor-boxo-sdk 0.1.2 → 0.1.4

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.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'AppBoxoSDK', '1.5.8'
16
+ s.dependency 'AppBoxoSDK', '1.5.12'
17
17
  s.swift_version = '5.1'
18
18
  end
package/README.md CHANGED
@@ -215,6 +215,7 @@ logout() => Promise<void>
215
215
  | ------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
216
216
  | **`clientId`** | <code>string</code> | your client id from dashboard |
217
217
  | **`userId`** | <code>string</code> | hostapp userId, will be used for the Consent Management |
218
+ | **`language`** | <code>string</code> | language value will be passed to the miniapp |
218
219
  | **`sandboxMode`** | <code>boolean</code> | switch to sandbox mode |
219
220
  | **`enableMultitaskMode`** | <code>boolean</code> | Each miniapp appears as a task in the Recents screen. !It works only on android devices. |
220
221
  | **`theme`** | <code>'light' \| 'dark' \| 'system'</code> | theme for splash screen and other native components used inside miniapp. |
@@ -234,6 +235,7 @@ logout() => Promise<void>
234
235
  | **`urlSuffix`** | <code>string</code> | (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
235
236
  | **`colors`** | <code><a href="#coloroptions">ColorOptions</a></code> | (optional) provide colors to miniapp if miniapp supports |
236
237
  | **`enableSplash`** | <code>boolean</code> | (optional) use to skip miniapp splash screen |
238
+ | **`saveState`** | <code>boolean</code> | (optional) use to save state on close miniapp |
237
239
 
238
240
 
239
241
  #### ColorOptions
@@ -73,7 +73,7 @@ dependencies {
73
73
  implementation fileTree(dir: 'libs', include: ['*.jar'])
74
74
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
75
75
  implementation project(':capacitor-android')
76
- implementation('com.appboxo:sdk:1.5.11') {
76
+ implementation('com.appboxo:sdk:1.5.18') {
77
77
  exclude group: 'com.google.android.gms', module: 'play-services-location'
78
78
  }
79
79
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
@@ -35,6 +35,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
35
35
  fun setConfig(call: PluginCall) {
36
36
  val clientId = call.getString("clientId")!!
37
37
  val userId = call.getString("userId") ?: ""
38
+ val language = call.getString("language") ?: "en"
38
39
  val sandboxMode = call.getBoolean("sandboxMde", false)!!
39
40
  val enableMultitaskMode = call.getBoolean("enableMultitaskMode", false)!!
40
41
  val theme = call.getString("theme", "system")!!
@@ -54,6 +55,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
54
55
  .sandboxMode(sandboxMode)
55
56
  .multitaskMode(enableMultitaskMode)
56
57
  .setTheme(globalTheme)
58
+ .setLanguage(language)
57
59
  .permissionsPage(showPermissionsPage)
58
60
  .showClearCache(showClearCache)
59
61
  .debug(isDebug)
@@ -70,6 +72,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
70
72
  val urlSuffix = call.getString("urlSuffix")
71
73
  val colors = call.getObject("colors")
72
74
  val enableSplash = call.getBoolean("enableSplash")
75
+ val saveState = call.getBoolean("saveState") ?: true
73
76
  val miniapp: Miniapp = Appboxo.getMiniapp(appId)
74
77
  .setCustomEventListener(this)
75
78
  .setPaymentEventListener(this)
@@ -104,6 +107,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
104
107
  }
105
108
  if (enableSplash != null)
106
109
  configBuilder.enableSplash(enableSplash)
110
+ configBuilder.saveState(saveState)
107
111
  miniapp.setConfig(configBuilder.build())
108
112
  miniapp.open(bridge.activity)
109
113
  }
package/dist/docs.json CHANGED
@@ -238,6 +238,13 @@
238
238
  "complexTypes": [],
239
239
  "type": "string | undefined"
240
240
  },
241
+ {
242
+ "name": "language",
243
+ "tags": [],
244
+ "docs": "language value will be passed to the miniapp",
245
+ "complexTypes": [],
246
+ "type": "string | undefined"
247
+ },
241
248
  {
242
249
  "name": "sandboxMode",
243
250
  "tags": [],
@@ -339,6 +346,13 @@
339
346
  "docs": "(optional) use to skip miniapp splash screen",
340
347
  "complexTypes": [],
341
348
  "type": "boolean | undefined"
349
+ },
350
+ {
351
+ "name": "saveState",
352
+ "tags": [],
353
+ "docs": "(optional) use to save state on close miniapp",
354
+ "complexTypes": [],
355
+ "type": "boolean | undefined"
342
356
  }
343
357
  ]
344
358
  },
@@ -55,6 +55,10 @@ export interface ConfigOptions {
55
55
  * hostapp userId, will be used for the Consent Management
56
56
  */
57
57
  userId?: string;
58
+ /**
59
+ * language value will be passed to the miniapp
60
+ */
61
+ language?: string;
58
62
  /**
59
63
  * switch to sandbox mode
60
64
  */
@@ -110,6 +114,10 @@ export interface OpenMiniappOptions {
110
114
  * (optional) use to skip miniapp splash screen
111
115
  */
112
116
  enableSplash?: boolean;
117
+ /**
118
+ * (optional) use to save state on close miniapp
119
+ */
120
+ saveState?: boolean;
113
121
  }
114
122
  export interface ColorOptions {
115
123
  primaryColor?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface AppboxoPlugin {\n /**\n * Set global configs\n */\n setConfig(options: ConfigOptions): Promise<void>;\n /**\n * Open miniapp with options\n */\n openMiniapp(options: OpenMiniappOptions): Promise<void>;\n /**\n * get AuthCode from hostapp backend and send it to miniapp\n */\n setAuthCode(options: { appId: string; authCode: string }): Promise<void>;\n /**\n * close miniapp by appId\n */\n closeMiniapp(options: { appId: string }): Promise<void>;\n /**\n * send custom event to miniapp\n */\n sendCustomEvent(customEvent: CustomEvent): Promise<void>;\n /**\n * send payment event to miniapp\n */\n sendPaymentEvent(paymentEvent: PaymentEvent): Promise<void>;\n /**\n * Get list of miniapps\n */\n getMiniapps(): Promise<MiniappListResult>;\n /**\n * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.\n * To use this function need to enable 'enableMultitaskMode: true' in Appboxo.setConfigs()\n */\n hideMiniapps(): Promise<void>;\n /**\n * When host app user logs out, it is highly important to clear all miniapp storage data.\n */\n addListener(\n eventName: 'custom_event',\n listenerFunc: (customEvent: CustomEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: 'payment_event',\n listenerFunc: (paymentEvent: PaymentEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: 'miniapp_lifecycle',\n listenerFunc: (lifecycle: LifecycleEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n logout(): Promise<void>;\n}\n\nexport interface ConfigOptions {\n /**\n * your client id from dashboard\n */\n clientId: string;\n /**\n * hostapp userId, will be used for the Consent Management\n */\n userId?: string;\n /**\n * switch to sandbox mode\n */\n sandboxMode?: boolean;\n /**\n * Each miniapp appears as a task in the Recents screen.\n * !It works only on android devices.\n */\n enableMultitaskMode?: boolean;\n /**\n * theme for splash screen and other native components used inside miniapp.\n */\n theme?: 'light' | 'dark' | 'system';\n /**\n * enables webview debugging\n */\n isDebug?: boolean;\n /**\n * use it to hide \"Settings\" from Miniapp menu\n */\n showPermissionsPage?: boolean;\n /**\n * use it to hide \"Clear cache\" from Miniapp menu\n */\n showClearCache?: boolean;\n}\n\nexport interface OpenMiniappOptions {\n /**\n * miniapp id\n */\n appId: string;\n /**\n * (optional) data as Map that is sent to miniapp\n */\n data?: object;\n /**\n * (optional) miniapp theme \"dark\" | \"light\" (by default is system theme)\n */\n theme?: 'light' | 'dark' | 'system';\n /**\n * (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test)\n */\n extraUrlParams?: object;\n /**\n * (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test)\n */\n urlSuffix?: string;\n /**\n * (optional) provide colors to miniapp if miniapp supports\n */\n colors?: ColorOptions;\n /**\n * (optional) use to skip miniapp splash screen\n */\n enableSplash?: boolean;\n}\n\nexport interface ColorOptions {\n primaryColor?: string;\n secondaryColor?: string;\n tertiaryColor?: string;\n}\n\nexport interface CustomEvent {\n appId: string;\n requestId: number;\n type: string;\n errorType?: string;\n payload?: object;\n}\n\nexport interface PaymentEvent {\n appId: string;\n transactionToken?: string;\n miniappOrderId?: string;\n amount: number;\n currency?: string;\n status?: string;\n hostappOrderId?: string;\n extraParams?: object;\n}\n\nexport interface LifecycleEvent {\n appId: string;\n /**\n * onLaunch - Called when the miniapp will launch with Appboxo.open(...)\n * onResume - Called when the miniapp will start interacting with the user\n * onPause - Called when the miniapp loses foreground state\n * onClose - Called when clicked close button in miniapp or when destroyed miniapp page\n * onError - Called when miniapp fails to launch due to internet connection issues\n * onUserInteraction - Called whenever touch event is dispatched to the miniapp page.\n * onAuth - Called when the miniapp starts login and user allows it\n */\n lifecycle: string;\n error?: string;\n}\n\nexport interface MiniappListResult {\n miniapps?: [MiniappData];\n error?: string;\n}\n\nexport interface MiniappData {\n appId: string;\n name: string;\n category: string;\n description: string;\n logo: string;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface AppboxoPlugin {\n /**\n * Set global configs\n */\n setConfig(options: ConfigOptions): Promise<void>;\n /**\n * Open miniapp with options\n */\n openMiniapp(options: OpenMiniappOptions): Promise<void>;\n /**\n * get AuthCode from hostapp backend and send it to miniapp\n */\n setAuthCode(options: { appId: string; authCode: string }): Promise<void>;\n /**\n * close miniapp by appId\n */\n closeMiniapp(options: { appId: string }): Promise<void>;\n /**\n * send custom event to miniapp\n */\n sendCustomEvent(customEvent: CustomEvent): Promise<void>;\n /**\n * send payment event to miniapp\n */\n sendPaymentEvent(paymentEvent: PaymentEvent): Promise<void>;\n /**\n * Get list of miniapps\n */\n getMiniapps(): Promise<MiniappListResult>;\n /**\n * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.\n * To use this function need to enable 'enableMultitaskMode: true' in Appboxo.setConfigs()\n */\n hideMiniapps(): Promise<void>;\n /**\n * When host app user logs out, it is highly important to clear all miniapp storage data.\n */\n addListener(\n eventName: 'custom_event',\n listenerFunc: (customEvent: CustomEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: 'payment_event',\n listenerFunc: (paymentEvent: PaymentEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n addListener(\n eventName: 'miniapp_lifecycle',\n listenerFunc: (lifecycle: LifecycleEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n logout(): Promise<void>;\n}\n\nexport interface ConfigOptions {\n /**\n * your client id from dashboard\n */\n clientId: string;\n /**\n * hostapp userId, will be used for the Consent Management\n */\n userId?: string;\n /**\n * language value will be passed to the miniapp\n */\n language?: string;\n /**\n * switch to sandbox mode\n */\n sandboxMode?: boolean;\n /**\n * Each miniapp appears as a task in the Recents screen.\n * !It works only on android devices.\n */\n enableMultitaskMode?: boolean;\n /**\n * theme for splash screen and other native components used inside miniapp.\n */\n theme?: 'light' | 'dark' | 'system';\n /**\n * enables webview debugging\n */\n isDebug?: boolean;\n /**\n * use it to hide \"Settings\" from Miniapp menu\n */\n showPermissionsPage?: boolean;\n /**\n * use it to hide \"Clear cache\" from Miniapp menu\n */\n showClearCache?: boolean;\n}\n\nexport interface OpenMiniappOptions {\n /**\n * miniapp id\n */\n appId: string;\n /**\n * (optional) data as Map that is sent to miniapp\n */\n data?: object;\n /**\n * (optional) miniapp theme \"dark\" | \"light\" (by default is system theme)\n */\n theme?: 'light' | 'dark' | 'system';\n /**\n * (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test)\n */\n extraUrlParams?: object;\n /**\n * (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test)\n */\n urlSuffix?: string;\n /**\n * (optional) provide colors to miniapp if miniapp supports\n */\n colors?: ColorOptions;\n /**\n * (optional) use to skip miniapp splash screen\n */\n enableSplash?: boolean;\n /**\n * (optional) use to save state on close miniapp\n */\n saveState?: boolean;\n}\n\nexport interface ColorOptions {\n primaryColor?: string;\n secondaryColor?: string;\n tertiaryColor?: string;\n}\n\nexport interface CustomEvent {\n appId: string;\n requestId: number;\n type: string;\n errorType?: string;\n payload?: object;\n}\n\nexport interface PaymentEvent {\n appId: string;\n transactionToken?: string;\n miniappOrderId?: string;\n amount: number;\n currency?: string;\n status?: string;\n hostappOrderId?: string;\n extraParams?: object;\n}\n\nexport interface LifecycleEvent {\n appId: string;\n /**\n * onLaunch - Called when the miniapp will launch with Appboxo.open(...)\n * onResume - Called when the miniapp will start interacting with the user\n * onPause - Called when the miniapp loses foreground state\n * onClose - Called when clicked close button in miniapp or when destroyed miniapp page\n * onError - Called when miniapp fails to launch due to internet connection issues\n * onUserInteraction - Called whenever touch event is dispatched to the miniapp page.\n * onAuth - Called when the miniapp starts login and user allows it\n */\n lifecycle: string;\n error?: string;\n}\n\nexport interface MiniappListResult {\n miniapps?: [MiniappData];\n error?: string;\n}\n\nexport interface MiniappData {\n appId: string;\n name: string;\n category: string;\n description: string;\n logo: string;\n}\n"]}
@@ -29,6 +29,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
29
29
  @objc func setConfig(_ call: CAPPluginCall) {
30
30
  let clientId = call.getString("clientId") ?? ""
31
31
  let userId = call.getString("userId") ?? ""
32
+ let language = call.getString("language") ?? "en"
32
33
  let sandboxMode = call.getBool("sandboxMde", false)
33
34
  let theme = call.getString("theme", "system")
34
35
  let showPermissionsPage = call.getBool("showPermissionsPage", true)
@@ -44,6 +45,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
44
45
  }
45
46
 
46
47
  let config = Config(clientId: clientId, theme: globalTheme)
48
+ config.language = language
47
49
  config.sandboxMode = sandboxMode
48
50
  config.permissionsPage = showPermissionsPage
49
51
  config.showClearCache = showClearCache
@@ -59,12 +61,15 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
59
61
  let extraUrlParams = call.getObject("extraUrlParams")?.toMap() ?? nil
60
62
  let colors = call.getObject("colors")?.toMap() ?? nil
61
63
  let enableSplash = call.getBool("enableSplash")
64
+ let saveState = call.getBool("saveState", true)
62
65
 
63
66
  let miniApp = Appboxo.shared.getMiniapp(appId: appId)
64
67
  miniApp.setData(data: data)
65
68
  miniApp.delegate = self
66
69
 
67
70
  let miniappConfig = MiniappConfig()
71
+ miniappConfig.saveState = saveState
72
+
68
73
  if let enableSplash = enableSplash {
69
74
  miniappConfig.enableSplash(isSplashEnabled: enableSplash)
70
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appboxo/capacitor-boxo-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A capacitor wrapper over Appboxo SDK for IOS and Android.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",