@appboxo/capacitor-boxo-sdk 0.9.1 → 0.11.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.19.0'
16
+ s.dependency 'BoxoSDK', '1.25.0'
17
17
  s.swift_version = '5.1'
18
18
  end
package/README.md CHANGED
@@ -227,19 +227,32 @@ logout() => Promise<void>
227
227
 
228
228
  #### ConfigOptions
229
229
 
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 |
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 |
244
+
245
+
246
+ #### SplashScreenOptions
247
+
248
+ | Prop | Type |
249
+ | ---------------------------- | ------------------- |
250
+ | **`lightBackground`** | <code>string</code> |
251
+ | **`darkBackground`** | <code>string</code> |
252
+ | **`lightProgressIndicator`** | <code>string</code> |
253
+ | **`lightProgressTrack`** | <code>string</code> |
254
+ | **`darkProgressIndicator`** | <code>string</code> |
255
+ | **`darkProgressTrack`** | <code>string</code> |
243
256
 
244
257
 
245
258
  #### OpenMiniappOptions
@@ -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.33.1') {
59
+ implementation('io.boxo.sdk:boxo-android:1.39.0') {
60
60
  exclude group: 'com.google.android.gms', module: 'play-services-location'
61
61
  }
62
62
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
@@ -2,6 +2,7 @@ package io.boxo.sdk.capacitor
2
2
 
3
3
  import android.os.Handler
4
4
  import android.os.Looper
5
+ import android.graphics.Color
5
6
  import io.boxo.data.models.MiniappData
6
7
  import io.boxo.data.models.PageAnimation
7
8
  import io.boxo.js.params.CustomEvent
@@ -37,8 +38,8 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
37
38
  val clientId = call.getString("clientId")!!
38
39
  val userId = call.getString("userId") ?: ""
39
40
  val language = call.getString("language") ?: "en"
40
- val sandboxMode = call.getBoolean("sandboxMde", false)!!
41
- val enableMultitaskMode = call.getBoolean("enableMultitaskMode", false)!!
41
+ val sandboxMode = call.getBoolean("sandboxMode", false)!!
42
+ val enableMultitaskMode = call.getBoolean("enableMultitaskMode", true)!!
42
43
  val theme = call.getString("theme", "system")!!
43
44
  val isDebug = call.getBoolean("isDebug", false)!!
44
45
  val showPermissionsPage = call.getBoolean("showPermissionsPage", true)!!
@@ -50,22 +51,39 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
50
51
  "dark" -> Config.Theme.DARK
51
52
  else -> Config.Theme.SYSTEM
52
53
  }
53
- Boxo
54
- .setConfig(
55
- Config.Builder()
56
- .setClientId(clientId)
57
- .setUserId(userId)
58
- .sandboxMode(sandboxMode)
59
- .multitaskMode(enableMultitaskMode)
60
- .setTheme(globalTheme)
61
- .setLanguage(language)
62
- .permissionsPage(showPermissionsPage)
63
- .showClearCache(showClearCache)
64
- .showAboutPage(showAboutPage)
65
- .setMiniappSettingsExpirationTime(miniappSettingsExpirationTime)
66
- .debug(isDebug)
67
- .build()
68
- )
54
+ val splashOptions = call.getObject("splashScreenOptions")
55
+ Boxo.setConfig(
56
+ Config.Builder()
57
+ .setClientId(clientId)
58
+ .setUserId(userId)
59
+ .sandboxMode(sandboxMode)
60
+ .multitaskMode(enableMultitaskMode)
61
+ .setTheme(globalTheme)
62
+ .setLanguage(language)
63
+ .permissionsPage(showPermissionsPage)
64
+ .showClearCache(showClearCache)
65
+ .showAboutPage(showAboutPage)
66
+ .setMiniappSettingsExpirationTime(miniappSettingsExpirationTime)
67
+ .debug(isDebug).apply {
68
+ if (splashOptions != null) {
69
+ setProgressBarColors(
70
+ lightIndicator =
71
+ Color.parseColor(splashOptions.getString("lightProgressIndicator")),
72
+ lightTrack =
73
+ Color.parseColor(splashOptions.getString("lightProgressTrack")),
74
+ darkIndicator =
75
+ Color.parseColor(splashOptions.getString("darkProgressIndicator")),
76
+ darkTrack =
77
+ Color.parseColor(splashOptions.getString("darkProgressTrack"))
78
+ )
79
+ setSplashBackgroundColors(
80
+ light = Color.parseColor(splashOptions.getString("lightBackground")),
81
+ dark = Color.parseColor(splashOptions.getString("darkBackground"))
82
+ )
83
+ }
84
+ }
85
+ .build()
86
+ )
69
87
  }
70
88
 
71
89
  @PluginMethod
@@ -80,7 +98,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
80
98
  val pageAnimation =
81
99
  runCatching { PageAnimation.valueOf(call.getString("pageAnimation") ?: "") }
82
100
  .getOrDefault(PageAnimation.BOTTOM_TO_TOP)
83
- val saveState = call.getBoolean("saveState") ?: true
101
+ val saveState = call.getBoolean("saveState") ?: false
84
102
  handler?.post {
85
103
  val miniapp: Miniapp = Boxo.getMiniapp(appId)
86
104
  .setCustomEventListener(this)
package/dist/docs.json CHANGED
@@ -316,6 +316,66 @@
316
316
  "docs": "use it to change miniapp settings cache time in sec. By default is 60 sec",
317
317
  "complexTypes": [],
318
318
  "type": "number | undefined"
319
+ },
320
+ {
321
+ "name": "splashScreenOptions",
322
+ "tags": [],
323
+ "docs": "(optional) setup splash screen configs",
324
+ "complexTypes": [
325
+ "SplashScreenOptions"
326
+ ],
327
+ "type": "SplashScreenOptions"
328
+ }
329
+ ]
330
+ },
331
+ {
332
+ "name": "SplashScreenOptions",
333
+ "slug": "splashscreenoptions",
334
+ "docs": "",
335
+ "tags": [],
336
+ "methods": [],
337
+ "properties": [
338
+ {
339
+ "name": "lightBackground",
340
+ "tags": [],
341
+ "docs": "",
342
+ "complexTypes": [],
343
+ "type": "string"
344
+ },
345
+ {
346
+ "name": "darkBackground",
347
+ "tags": [],
348
+ "docs": "",
349
+ "complexTypes": [],
350
+ "type": "string"
351
+ },
352
+ {
353
+ "name": "lightProgressIndicator",
354
+ "tags": [],
355
+ "docs": "",
356
+ "complexTypes": [],
357
+ "type": "string"
358
+ },
359
+ {
360
+ "name": "lightProgressTrack",
361
+ "tags": [],
362
+ "docs": "",
363
+ "complexTypes": [],
364
+ "type": "string"
365
+ },
366
+ {
367
+ "name": "darkProgressIndicator",
368
+ "tags": [],
369
+ "docs": "",
370
+ "complexTypes": [],
371
+ "type": "string"
372
+ },
373
+ {
374
+ "name": "darkProgressTrack",
375
+ "tags": [],
376
+ "docs": "",
377
+ "complexTypes": [],
378
+ "type": "string"
319
379
  }
320
380
  ]
321
381
  },
@@ -101,6 +101,10 @@ export interface ConfigOptions {
101
101
  * use it to change miniapp settings cache time in sec. By default is 60 sec
102
102
  */
103
103
  miniappSettingsExpirationTime?: number;
104
+ /**
105
+ * (optional) setup splash screen configs
106
+ */
107
+ splashScreenOptions?: SplashScreenOptions;
104
108
  }
105
109
  export interface OpenMiniappOptions {
106
110
  /**
@@ -140,6 +144,14 @@ export interface OpenMiniappOptions {
140
144
  */
141
145
  pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN';
142
146
  }
147
+ export interface SplashScreenOptions {
148
+ lightBackground: string;
149
+ darkBackground: string;
150
+ lightProgressIndicator: string;
151
+ lightProgressTrack: string;
152
+ darkProgressIndicator: string;
153
+ darkProgressTrack: string;
154
+ }
143
155
  export interface ColorOptions {
144
156
  primaryColor?: string;
145
157
  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 * 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\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 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 * 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,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
 
7
5
  const Boxo = core.registerPlugin('Appboxo');
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Boxo = registerPlugin('Appboxo');\nconst Appboxo = registerPlugin('Appboxo');\nexport * from './definitions';\nexport { Appboxo };\nexport { Boxo };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAClC,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Boxo = registerPlugin('Appboxo');\nconst Appboxo = registerPlugin('Appboxo');\nexport * from './definitions';\nexport { Appboxo };\nexport { Boxo };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;;AACK,MAAC,IAAI,GAAGA,mBAAc,CAAC,SAAS;AAChC,MAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS;;;;;"}
package/dist/plugin.js CHANGED
@@ -7,8 +7,6 @@ var capacitorAppboxo = (function (exports, core) {
7
7
  exports.Appboxo = Appboxo;
8
8
  exports.Boxo = Boxo;
9
9
 
10
- Object.defineProperty(exports, '__esModule', { value: true });
11
-
12
10
  return exports;
13
11
 
14
12
  })({}, capacitorExports);
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Boxo = registerPlugin('Appboxo');\nconst Appboxo = registerPlugin('Appboxo');\nexport * from './definitions';\nexport { Appboxo };\nexport { Boxo };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACK,OAAC,IAAI,GAAGA,mBAAc,CAAC,SAAS,EAAE;AAClC,OAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Boxo = registerPlugin('Appboxo');\nconst Appboxo = registerPlugin('Appboxo');\nexport * from './definitions';\nexport { Appboxo };\nexport { Boxo };\n//# sourceMappingURL=index.js.map"],"names":["registerPlugin"],"mappings":";;;AACK,OAAC,IAAI,GAAGA,mBAAc,CAAC,SAAS;AAChC,OAAC,OAAO,GAAGA,mBAAc,CAAC,SAAS;;;;;;;;;;;"}
@@ -1,4 +1,5 @@
1
1
  import Foundation
2
+ import UIKit
2
3
  import Capacitor
3
4
  import BoxoSDK
4
5
 
@@ -31,7 +32,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
31
32
  let clientId = call.getString("clientId") ?? ""
32
33
  let userId = call.getString("userId") ?? ""
33
34
  let language = call.getString("language") ?? "en"
34
- let sandboxMode = call.getBool("sandboxMde", false)
35
+ let sandboxMode = call.getBool("sandboxMode", false)
35
36
  let theme = call.getString("theme", "system")
36
37
  let showPermissionsPage = call.getBool("showPermissionsPage", true)
37
38
  let showClearCache = call.getBool("showClearCache", true)
@@ -56,6 +57,30 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
56
57
  config.setUserId(id: userId)
57
58
  config.miniappSettingsExpirationTime = miniappSettingsExpirationTime
58
59
 
60
+ if let splashOptions = call.getObject("splashScreenOptions") {
61
+ if let lightBg = splashOptions["lightBackground"] as? String,
62
+ let darkBg = splashOptions["darkBackground"] as? String,
63
+ let lightBgColor = UIColor(hex: lightBg),
64
+ let darkBgColor = UIColor(hex: darkBg) {
65
+ config.splashBackgroundColors = SplashBackgroundColors(light: lightBgColor, dark: darkBgColor)
66
+ }
67
+ if let lightIndicator = splashOptions["lightProgressIndicator"] as? String,
68
+ let lightTrack = splashOptions["lightProgressTrack"] as? String,
69
+ let darkIndicator = splashOptions["darkProgressIndicator"] as? String,
70
+ let darkTrack = splashOptions["darkProgressTrack"] as? String,
71
+ let lightIndicatorColor = UIColor(hex: lightIndicator),
72
+ let lightTrackColor = UIColor(hex: lightTrack),
73
+ let darkIndicatorColor = UIColor(hex: darkIndicator),
74
+ let darkTrackColor = UIColor(hex: darkTrack) {
75
+ config.progressBarColors = ProgressBarColors(
76
+ lightIndicator: lightIndicatorColor,
77
+ lightTrack: lightTrackColor,
78
+ darkIndicator: darkIndicatorColor,
79
+ darkTrack: darkTrackColor
80
+ )
81
+ }
82
+ }
83
+
59
84
  Boxo.shared.setConfig(config: config)
60
85
  }
61
86
 
@@ -66,7 +91,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
66
91
  let extraUrlParams = call.getObject("extraUrlParams")?.toMap() ?? nil
67
92
  let colors = call.getObject("colors")?.toMap() ?? nil
68
93
  let enableSplash = call.getBool("enableSplash")
69
- let saveState = call.getBool("saveState", true)
94
+ let saveState = call.getBool("saveState", false)
70
95
  let urlSuffix = call.getString("urlSuffix", "")
71
96
  let pageAnimation = call.getString("pageAnimation", "")
72
97
 
@@ -328,3 +353,45 @@ extension JSObject {
328
353
  return dict
329
354
  }
330
355
  }
356
+
357
+ extension UIColor {
358
+ convenience init?(hex: String) {
359
+ let hex = hex.trimmingCharacters(in: .whitespacesAndNewlines)
360
+ .replacingOccurrences(of: "#", with: "")
361
+
362
+ guard let int = UInt64(hex, radix: 16) else { return nil }
363
+
364
+ switch hex.count {
365
+ case 6: // RRGGBB
366
+ self.init(
367
+ red: CGFloat((int >> 16) & 0xFF) / 255.0,
368
+ green: CGFloat((int >> 8) & 0xFF) / 255.0,
369
+ blue: CGFloat(int & 0xFF) / 255.0,
370
+ alpha: 1.0
371
+ )
372
+
373
+ case 8: // RRGGBBAA
374
+ self.init(
375
+ red: CGFloat((int >> 24) & 0xFF) / 255.0,
376
+ green: CGFloat((int >> 16) & 0xFF) / 255.0,
377
+ blue: CGFloat((int >> 8) & 0xFF) / 255.0,
378
+ alpha: CGFloat(int & 0xFF) / 255.0
379
+ )
380
+
381
+ case 3: // RGB (short form)
382
+ let r = ((int >> 8) & 0xF) * 17
383
+ let g = ((int >> 4) & 0xF) * 17
384
+ let b = (int & 0xF) * 17
385
+
386
+ self.init(
387
+ red: CGFloat(r) / 255.0,
388
+ green: CGFloat(g) / 255.0,
389
+ blue: CGFloat(b) / 255.0,
390
+ alpha: 1.0
391
+ )
392
+
393
+ default:
394
+ return nil
395
+ }
396
+ }
397
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appboxo/capacitor-boxo-sdk",
3
- "version": "0.9.1",
3
+ "version": "0.11.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",
@@ -59,7 +59,7 @@
59
59
  "rimraf": "^6.0.1",
60
60
  "rollup": "^4.30.1",
61
61
  "swiftlint": "^2.0.0",
62
- "typescript": "~4.1.5"
62
+ "typescript": "^5.9.3"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@capacitor/core": ">=7.0.0"