@appboxo/capacitor-boxo-sdk 0.12.0 → 0.13.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.
@@ -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 = '14.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'BoxoSDK', '1.25.0'
16
+ s.dependency 'BoxoSDK', '1.27.4'
17
17
  s.swift_version = '5.1'
18
18
  end
package/README.md CHANGED
@@ -226,19 +226,20 @@ logout() => Promise<void>
226
226
 
227
227
  #### ConfigOptions
228
228
 
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 |
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 |
242
+ | **`lottieProgressOptions`** | <code><a href="#lottieprogressoptions">LottieProgressOptions</a></code> | (optional) setup lottie progress indicator configs |
242
243
 
243
244
 
244
245
  #### SplashScreenOptions
@@ -253,6 +254,16 @@ logout() => Promise<void>
253
254
  | **`darkProgressTrack`** | <code>string</code> |
254
255
 
255
256
 
257
+ #### LottieProgressOptions
258
+
259
+ | Prop | Type |
260
+ | ------------ | ------------------- |
261
+ | **`light`** | <code>string</code> |
262
+ | **`dark`** | <code>string</code> |
263
+ | **`width`** | <code>number</code> |
264
+ | **`height`** | <code>number</code> |
265
+
266
+
256
267
  #### OpenMiniappOptions
257
268
 
258
269
  | Prop | Type | Description |
@@ -56,7 +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.40.2')
59
+ implementation('io.boxo.sdk:boxo-android:1.41.0')
60
60
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
61
61
  testImplementation "junit:junit:$junitVersion"
62
62
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -52,6 +52,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
52
52
  else -> Config.Theme.SYSTEM
53
53
  }
54
54
  val splashOptions = call.getObject("splashScreenOptions")
55
+ val lottieProgressOptions = call.getObject("lottieProgressOptions")
55
56
  Boxo.setConfig(
56
57
  Config.Builder()
57
58
  .setClientId(clientId)
@@ -80,6 +81,15 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
80
81
  dark = Color.parseColor(splashOptions.getString("darkBackground"))
81
82
  )
82
83
  }
84
+
85
+ lottieProgressOptions?.also { options ->
86
+ setProgressBarLottieFromAssets(
87
+ lightAssetPath = options.getString("light") ?: "",
88
+ darkAssetPath = options.getString("dark"),
89
+ widthDp = options.optDouble("width")?.toInt(),
90
+ heightDp = options.optDouble("height")?.toInt()
91
+ )
92
+ }
83
93
  }
84
94
  .build()
85
95
  )
package/dist/docs.json CHANGED
@@ -318,6 +318,15 @@
318
318
  "SplashScreenOptions"
319
319
  ],
320
320
  "type": "SplashScreenOptions"
321
+ },
322
+ {
323
+ "name": "lottieProgressOptions",
324
+ "tags": [],
325
+ "docs": "(optional) setup lottie progress indicator configs",
326
+ "complexTypes": [
327
+ "LottieProgressOptions"
328
+ ],
329
+ "type": "LottieProgressOptions"
321
330
  }
322
331
  ]
323
332
  },
@@ -372,6 +381,43 @@
372
381
  }
373
382
  ]
374
383
  },
384
+ {
385
+ "name": "LottieProgressOptions",
386
+ "slug": "lottieprogressoptions",
387
+ "docs": "",
388
+ "tags": [],
389
+ "methods": [],
390
+ "properties": [
391
+ {
392
+ "name": "light",
393
+ "tags": [],
394
+ "docs": "",
395
+ "complexTypes": [],
396
+ "type": "string"
397
+ },
398
+ {
399
+ "name": "dark",
400
+ "tags": [],
401
+ "docs": "",
402
+ "complexTypes": [],
403
+ "type": "string | undefined"
404
+ },
405
+ {
406
+ "name": "width",
407
+ "tags": [],
408
+ "docs": "",
409
+ "complexTypes": [],
410
+ "type": "number | undefined"
411
+ },
412
+ {
413
+ "name": "height",
414
+ "tags": [],
415
+ "docs": "",
416
+ "complexTypes": [],
417
+ "type": "number | undefined"
418
+ }
419
+ ]
420
+ },
375
421
  {
376
422
  "name": "OpenMiniappOptions",
377
423
  "slug": "openminiappoptions",
@@ -99,6 +99,10 @@ export interface ConfigOptions {
99
99
  * (optional) setup splash screen configs
100
100
  */
101
101
  splashScreenOptions?: SplashScreenOptions;
102
+ /**
103
+ * (optional) setup lottie progress indicator configs
104
+ */
105
+ lottieProgressOptions?: LottieProgressOptions;
102
106
  }
103
107
  export interface OpenMiniappOptions {
104
108
  /**
@@ -146,6 +150,12 @@ export interface SplashScreenOptions {
146
150
  darkProgressIndicator: string;
147
151
  darkProgressTrack: string;
148
152
  }
153
+ export interface LottieProgressOptions {
154
+ light: string;
155
+ dark?: string;
156
+ width?: number;
157
+ height?: number;
158
+ }
149
159
  export interface ColorOptions {
150
160
  primaryColor?: string;
151
161
  secondaryColor?: 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 * 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"]}
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 * (optional) setup lottie progress indicator configs\n */\n lottieProgressOptions?: LottieProgressOptions;\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}\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 LottieProgressOptions {\n light: string;\n dark?: string;\n width?: number;\n height?: number;\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"]}
@@ -81,6 +81,20 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
81
81
  }
82
82
  }
83
83
 
84
+ if let lottieOptions = call.getObject("lottieProgressOptions"),
85
+ let lightPath = lottieOptions["light"] as? String,
86
+ !lightPath.isEmpty {
87
+ let darkPath = (lottieOptions["dark"] as? String) ?? ""
88
+ let width = lottieOptions.double(forKey: "width") ?? 100
89
+ let height = lottieOptions.double(forKey: "height") ?? 100
90
+ config.progressBarLottieAssets = .init(
91
+ lightAssetPath: lightPath,
92
+ darkAssetPath: darkPath,
93
+ width: width,
94
+ height: height
95
+ )
96
+ }
97
+
84
98
  Boxo.shared.setConfig(config: config)
85
99
  }
86
100
 
@@ -339,6 +353,13 @@ extension AppboxoPlugin : MiniappDelegate {
339
353
  }
340
354
 
341
355
  extension JSObject {
356
+ func double(forKey key: String) -> Double? {
357
+ if let d = self[key] as? Double { return d }
358
+ if let i = self[key] as? Int { return Double(i) }
359
+ if let n = self[key] as? NSNumber { return n.doubleValue }
360
+ return nil
361
+ }
362
+
342
363
  func toMap() -> [String : Any] {
343
364
  var dict = [String : Any]()
344
365
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appboxo/capacitor-boxo-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.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",