@appboxo/capacitor-boxo-sdk 0.11.0 → 0.12.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/README.md CHANGED
@@ -158,7 +158,6 @@ hideMiniapps() => Promise<void>
158
158
  ```
159
159
 
160
160
  Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.
161
- To use this function need to enable 'enableMultitaskMode: true' in Boxo.setConfig()
162
161
 
163
162
  --------------------
164
163
 
@@ -227,20 +226,19 @@ logout() => Promise<void>
227
226
 
228
227
  #### ConfigOptions
229
228
 
230
- | Prop | Type | Description |
231
- | ----------------------------------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
232
- | **`clientId`** | <code>string</code> | your client id from dashboard |
233
- | **`userId`** | <code>string</code> | hostapp userId, will be used for the Consent Management |
234
- | **`language`** | <code>string</code> | language value will be passed to the miniapp |
235
- | **`sandboxMode`** | <code>boolean</code> | switch to sandbox mode |
236
- | **`enableMultitaskMode`** | <code>boolean</code> | Each miniapp appears as a task in the Recents screen. !It works only on android devices. |
237
- | **`theme`** | <code>'light' \| 'dark' \| 'system'</code> | theme for splash screen and other native components used inside miniapp. |
238
- | **`isDebug`** | <code>boolean</code> | enables webview debugging |
239
- | **`showPermissionsPage`** | <code>boolean</code> | use it to hide "Settings" from Miniapp menu |
240
- | **`showClearCache`** | <code>boolean</code> | use it to hide "Clear cache" from Miniapp menu |
241
- | **`showAboutPage`** | <code>boolean</code> | use it to hide "About Page" from Miniapp menu |
242
- | **`miniappSettingsExpirationTime`** | <code>number</code> | use it to change miniapp settings cache time in sec. By default is 60 sec |
243
- | **`splashScreenOptions`** | <code><a href="#splashscreenoptions">SplashScreenOptions</a></code> | (optional) setup splash screen configs |
229
+ | Prop | Type | Description |
230
+ | ----------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------- |
231
+ | **`clientId`** | <code>string</code> | your client id from dashboard |
232
+ | **`userId`** | <code>string</code> | hostapp userId, will be used for the Consent Management |
233
+ | **`language`** | <code>string</code> | language value will be passed to the miniapp |
234
+ | **`sandboxMode`** | <code>boolean</code> | switch to sandbox mode |
235
+ | **`theme`** | <code>'light' \| 'dark' \| 'system'</code> | theme for splash screen and other native components used inside miniapp. |
236
+ | **`isDebug`** | <code>boolean</code> | enables webview debugging |
237
+ | **`showPermissionsPage`** | <code>boolean</code> | use it to hide "Settings" from Miniapp menu |
238
+ | **`showClearCache`** | <code>boolean</code> | use it to hide "Clear cache" from Miniapp menu |
239
+ | **`showAboutPage`** | <code>boolean</code> | use it to hide "About Page" from Miniapp menu |
240
+ | **`miniappSettingsExpirationTime`** | <code>number</code> | use it to change miniapp settings cache time in sec. By default is 60 sec |
241
+ | **`splashScreenOptions`** | <code><a href="#splashscreenoptions">SplashScreenOptions</a></code> | (optional) setup splash screen configs |
244
242
 
245
243
 
246
244
  #### SplashScreenOptions
@@ -56,9 +56,7 @@ dependencies {
56
56
  implementation fileTree(dir: 'libs', include: ['*.jar'])
57
57
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
58
58
  implementation project(':capacitor-android')
59
- implementation('io.boxo.sdk:boxo-android:1.39.0') {
60
- exclude group: 'com.google.android.gms', module: 'play-services-location'
61
- }
59
+ implementation('io.boxo.sdk:boxo-android:1.40.2')
62
60
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
63
61
  testImplementation "junit:junit:$junitVersion"
64
62
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -3,6 +3,7 @@ package io.boxo.sdk.capacitor
3
3
  import android.os.Handler
4
4
  import android.os.Looper
5
5
  import android.graphics.Color
6
+ import androidx.fragment.app.FragmentActivity
6
7
  import io.boxo.data.models.MiniappData
7
8
  import io.boxo.data.models.PageAnimation
8
9
  import io.boxo.js.params.CustomEvent
@@ -12,7 +13,7 @@ import io.boxo.sdk.Config
12
13
  import io.boxo.sdk.Miniapp
13
14
  import io.boxo.sdk.MiniappConfig
14
15
  import io.boxo.sdk.MiniappListCallback
15
- import io.boxo.ui.main.BoxoActivity
16
+ import io.boxo.ui.main.BoxoFragment
16
17
  import com.getcapacitor.JSArray
17
18
  import com.getcapacitor.JSObject
18
19
  import com.getcapacitor.Plugin
@@ -39,7 +40,6 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
39
40
  val userId = call.getString("userId") ?: ""
40
41
  val language = call.getString("language") ?: "en"
41
42
  val sandboxMode = call.getBoolean("sandboxMode", false)!!
42
- val enableMultitaskMode = call.getBoolean("enableMultitaskMode", true)!!
43
43
  val theme = call.getString("theme", "system")!!
44
44
  val isDebug = call.getBoolean("isDebug", false)!!
45
45
  val showPermissionsPage = call.getBoolean("showPermissionsPage", true)!!
@@ -57,7 +57,6 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
57
57
  .setClientId(clientId)
58
58
  .setUserId(userId)
59
59
  .sandboxMode(sandboxMode)
60
- .multitaskMode(enableMultitaskMode)
61
60
  .setTheme(globalTheme)
62
61
  .setLanguage(language)
63
62
  .permissionsPage(showPermissionsPage)
@@ -137,7 +136,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
137
136
  configBuilder.saveState(saveState)
138
137
  configBuilder.pageAnimation(pageAnimation)
139
138
  miniapp.setConfig(configBuilder.build())
140
- miniapp.open(bridge.activity)
139
+ miniapp.open(bridge.activity as FragmentActivity)
141
140
  }
142
141
  }
143
142
 
@@ -164,7 +163,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
164
163
  }
165
164
 
166
165
  override fun handle(
167
- miniAppActivity: BoxoActivity,
166
+ fragment: BoxoFragment,
168
167
  miniapp: Miniapp,
169
168
  customEvent: CustomEvent
170
169
  ) {
@@ -224,7 +223,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
224
223
  sendEvent(MINIAPP_LIFECYCLE_EVENT_NAME, params)
225
224
  }
226
225
 
227
- override fun onAuth(boxoActivity: BoxoActivity, miniapp: Miniapp) {
226
+ override fun onAuth(fragment: BoxoFragment, miniapp: Miniapp) {
228
227
  val params = JSObject()
229
228
  params.put("appId", miniapp.appId)
230
229
  params.put("lifecycle", "onAuth")
@@ -313,7 +312,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
313
312
  }
314
313
 
315
314
  override fun handle(
316
- boxoActivity: BoxoActivity,
315
+ fragment: BoxoFragment,
317
316
  miniapp: Miniapp,
318
317
  paymentData: PaymentData
319
318
  ) {
package/dist/docs.json CHANGED
@@ -143,7 +143,7 @@
143
143
  "parameters": [],
144
144
  "returns": "Promise<void>",
145
145
  "tags": [],
146
- "docs": "Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.\nTo use this function need to enable 'enableMultitaskMode: true' in Boxo.setConfig()",
146
+ "docs": "Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.",
147
147
  "complexTypes": [],
148
148
  "slug": "hideminiapps"
149
149
  },
@@ -268,13 +268,6 @@
268
268
  "complexTypes": [],
269
269
  "type": "boolean | undefined"
270
270
  },
271
- {
272
- "name": "enableMultitaskMode",
273
- "tags": [],
274
- "docs": "Each miniapp appears as a task in the Recents screen.\n!It works only on android devices.",
275
- "complexTypes": [],
276
- "type": "boolean | undefined"
277
- },
278
271
  {
279
272
  "name": "theme",
280
273
  "tags": [],
@@ -44,7 +44,6 @@ export interface AppboxoPlugin {
44
44
  getMiniapps(): Promise<MiniappListResult>;
45
45
  /**
46
46
  * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.
47
- * To use this function need to enable 'enableMultitaskMode: true' in Boxo.setConfig()
48
47
  */
49
48
  hideMiniapps(): Promise<void>;
50
49
  /**
@@ -72,11 +71,6 @@ export interface ConfigOptions {
72
71
  * switch to sandbox mode
73
72
  */
74
73
  sandboxMode?: boolean;
75
- /**
76
- * Each miniapp appears as a task in the Recents screen.
77
- * !It works only on android devices.
78
- */
79
- enableMultitaskMode?: boolean;
80
74
  /**
81
75
  * theme for splash screen and other native components used inside miniapp.
82
76
  */
@@ -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 * get AuthTokens from hostapp backend and send it to miniapp\n */\n setAuthTokens(options: { appId: string; tokens: { [key: string]: 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 Boxo.setConfig()\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 * use it to hide \"About Page\" from Miniapp menu\n */\n showAboutPage?: boolean;\n /**\n * use it to change miniapp settings cache time in sec. By default is 60 sec\n */\n miniappSettingsExpirationTime?: number;\n /**\n * (optional) setup splash screen configs\n */\n splashScreenOptions?: SplashScreenOptions;\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 * (optional) use to change launch animation for miniapp.\n */\n pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN';\n}\nexport interface SplashScreenOptions {\n lightBackground: string;\n darkBackground: string;\n lightProgressIndicator: string;\n lightProgressTrack: string;\n darkProgressIndicator: string;\n darkProgressTrack: string;\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 Boxo.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 * get AuthTokens from hostapp backend and send it to miniapp\n */\n setAuthTokens(options: { appId: string; tokens: { [key: string]: 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 */\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 * 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 * use it to hide \"About Page\" from Miniapp menu\n */\n showAboutPage?: boolean;\n /**\n * use it to change miniapp settings cache time in sec. By default is 60 sec\n */\n miniappSettingsExpirationTime?: number;\n /**\n * (optional) setup splash screen configs\n */\n splashScreenOptions?: SplashScreenOptions;\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 * (optional) use to change launch animation for miniapp.\n */\n pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN';\n}\nexport interface SplashScreenOptions {\n lightBackground: string;\n darkBackground: string;\n lightProgressIndicator: string;\n lightProgressTrack: string;\n darkProgressIndicator: string;\n darkProgressTrack: string;\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 Boxo.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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appboxo/capacitor-boxo-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
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",