@appboxo/capacitor-boxo-sdk 0.1.5 → 0.1.6
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/CapacitorBoxoSdk.podspec +1 -1
- package/README.md +1 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/boxo/sdk/capacitor/AppboxoPlugin.kt +38 -34
- package/dist/docs.json +7 -0
- package/dist/esm/definitions.d.ts +4 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/AppboxoPlugin/AppboxoPlugin.swift +4 -0
- package/package.json +1 -1
package/CapacitorBoxoSdk.podspec
CHANGED
package/README.md
CHANGED
|
@@ -222,6 +222,7 @@ logout() => Promise<void>
|
|
|
222
222
|
| **`isDebug`** | <code>boolean</code> | enables webview debugging |
|
|
223
223
|
| **`showPermissionsPage`** | <code>boolean</code> | use it to hide "Settings" from Miniapp menu |
|
|
224
224
|
| **`showClearCache`** | <code>boolean</code> | use it to hide "Clear cache" from Miniapp menu |
|
|
225
|
+
| **`showAboutPage`** | <code>boolean</code> | use it to hide "About Page" from Miniapp menu |
|
|
225
226
|
|
|
226
227
|
|
|
227
228
|
#### OpenMiniappOptions
|
package/android/build.gradle
CHANGED
|
@@ -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.
|
|
76
|
+
implementation('com.appboxo:sdk:1.6.0') {
|
|
77
77
|
exclude group: 'com.google.android.gms', module: 'play-services-location'
|
|
78
78
|
}
|
|
79
79
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
@@ -42,6 +42,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
|
|
|
42
42
|
val isDebug = call.getBoolean("isDebug", false)!!
|
|
43
43
|
val showPermissionsPage = call.getBoolean("showPermissionsPage", true)!!
|
|
44
44
|
val showClearCache = call.getBoolean("showClearCache", true)!!
|
|
45
|
+
val showAboutPage = call.getBoolean("showAboutPage", true)!!
|
|
45
46
|
val globalTheme: Config.Theme = when (theme) {
|
|
46
47
|
"light" -> Config.Theme.LIGHT
|
|
47
48
|
"dark" -> Config.Theme.DARK
|
|
@@ -58,6 +59,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
|
|
|
58
59
|
.setLanguage(language)
|
|
59
60
|
.permissionsPage(showPermissionsPage)
|
|
60
61
|
.showClearCache(showClearCache)
|
|
62
|
+
.showAboutPage(showAboutPage)
|
|
61
63
|
.debug(isDebug)
|
|
62
64
|
.build()
|
|
63
65
|
)
|
|
@@ -73,43 +75,45 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
|
|
|
73
75
|
val colors = call.getObject("colors")
|
|
74
76
|
val enableSplash = call.getBoolean("enableSplash")
|
|
75
77
|
val saveState = call.getBoolean("saveState") ?: true
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
handler?.post {
|
|
79
|
+
val miniapp: Miniapp = Appboxo.getMiniapp(appId)
|
|
80
|
+
.setCustomEventListener(this)
|
|
81
|
+
.setPaymentEventListener(this)
|
|
82
|
+
.setAuthListener(this)
|
|
83
|
+
.setLifecycleListener(this)
|
|
84
|
+
if (data != null) miniapp.setData(data.toMap())
|
|
85
|
+
val configBuilder = MiniappConfig.Builder()
|
|
86
|
+
if (theme != null) {
|
|
87
|
+
val miniappTheme: Config.Theme? = when (theme) {
|
|
88
|
+
"light" -> Config.Theme.LIGHT
|
|
89
|
+
"dark" -> Config.Theme.DARK
|
|
90
|
+
"system" -> Config.Theme.SYSTEM
|
|
91
|
+
else -> null
|
|
92
|
+
}
|
|
93
|
+
if (miniappTheme != null) {
|
|
94
|
+
configBuilder.setTheme(miniappTheme)
|
|
95
|
+
}
|
|
89
96
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
97
|
+
if (extraUrlParams != null) {
|
|
98
|
+
val map: Map<String, Any> = extraUrlParams.toMap()
|
|
99
|
+
val stringMap: MutableMap<String, String> = HashMap()
|
|
100
|
+
for ((key, value) in map) stringMap[key] = value.toString()
|
|
101
|
+
configBuilder.setExtraUrlParams(stringMap)
|
|
92
102
|
}
|
|
103
|
+
urlSuffix?.also { suffix -> configBuilder.setUrlSuffix(suffix) }
|
|
104
|
+
if (colors != null) {
|
|
105
|
+
configBuilder.setColors(
|
|
106
|
+
colors.getString("primaryColor") ?: "",
|
|
107
|
+
colors.getString("secondaryColor") ?: "",
|
|
108
|
+
colors.getString("tertiaryColor") ?: "",
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
if (enableSplash != null)
|
|
112
|
+
configBuilder.enableSplash(enableSplash)
|
|
113
|
+
configBuilder.saveState(saveState)
|
|
114
|
+
miniapp.setConfig(configBuilder.build())
|
|
115
|
+
miniapp.open(bridge.activity)
|
|
93
116
|
}
|
|
94
|
-
if (extraUrlParams != null) {
|
|
95
|
-
val map: Map<String, Any> = extraUrlParams.toMap()
|
|
96
|
-
val stringMap: MutableMap<String, String> = HashMap()
|
|
97
|
-
for ((key, value) in map) stringMap[key] = value.toString()
|
|
98
|
-
configBuilder.setExtraUrlParams(stringMap)
|
|
99
|
-
}
|
|
100
|
-
urlSuffix?.also { suffix -> configBuilder.setUrlSuffix(suffix) }
|
|
101
|
-
if (colors != null) {
|
|
102
|
-
configBuilder.setColors(
|
|
103
|
-
colors.getString("primaryColor") ?: "",
|
|
104
|
-
colors.getString("secondaryColor") ?: "",
|
|
105
|
-
colors.getString("tertiaryColor") ?: "",
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
if (enableSplash != null)
|
|
109
|
-
configBuilder.enableSplash(enableSplash)
|
|
110
|
-
configBuilder.saveState(saveState)
|
|
111
|
-
miniapp.setConfig(configBuilder.build())
|
|
112
|
-
miniapp.open(bridge.activity)
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
@PluginMethod
|
package/dist/docs.json
CHANGED
|
@@ -286,6 +286,13 @@
|
|
|
286
286
|
"docs": "use it to hide \"Clear cache\" from Miniapp menu",
|
|
287
287
|
"complexTypes": [],
|
|
288
288
|
"type": "boolean | undefined"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "showAboutPage",
|
|
292
|
+
"tags": [],
|
|
293
|
+
"docs": "use it to hide \"About Page\" from Miniapp menu",
|
|
294
|
+
"complexTypes": [],
|
|
295
|
+
"type": "boolean | undefined"
|
|
289
296
|
}
|
|
290
297
|
]
|
|
291
298
|
},
|
|
@@ -84,6 +84,10 @@ export interface ConfigOptions {
|
|
|
84
84
|
* use it to hide "Clear cache" from Miniapp menu
|
|
85
85
|
*/
|
|
86
86
|
showClearCache?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* use it to hide "About Page" from Miniapp menu
|
|
89
|
+
*/
|
|
90
|
+
showAboutPage?: boolean;
|
|
87
91
|
}
|
|
88
92
|
export interface OpenMiniappOptions {
|
|
89
93
|
/**
|
|
@@ -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 * 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"]}
|
|
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 * use it to hide \"About Page\" from Miniapp menu\n */\n showAboutPage?: 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"]}
|
|
@@ -34,6 +34,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
34
34
|
let theme = call.getString("theme", "system")
|
|
35
35
|
let showPermissionsPage = call.getBool("showPermissionsPage", true)
|
|
36
36
|
let showClearCache = call.getBool("showClearCache", true)
|
|
37
|
+
let showAboutPage = call.getBool("showAboutPage", true)
|
|
37
38
|
var globalTheme : Theme = .System
|
|
38
39
|
switch (theme) {
|
|
39
40
|
case "dark":
|
|
@@ -49,6 +50,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
49
50
|
config.sandboxMode = sandboxMode
|
|
50
51
|
config.permissionsPage = showPermissionsPage
|
|
51
52
|
config.showClearCache = showClearCache
|
|
53
|
+
config.showAboutPage = showAboutPage
|
|
52
54
|
config.setUserId(id: userId)
|
|
53
55
|
|
|
54
56
|
Appboxo.shared.setConfig(config: config)
|
|
@@ -62,6 +64,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
62
64
|
let colors = call.getObject("colors")?.toMap() ?? nil
|
|
63
65
|
let enableSplash = call.getBool("enableSplash")
|
|
64
66
|
let saveState = call.getBool("saveState", true)
|
|
67
|
+
let urlSuffix = call.getString("urlSuffix", "")
|
|
65
68
|
|
|
66
69
|
let miniApp = Appboxo.shared.getMiniapp(appId: appId)
|
|
67
70
|
miniApp.setData(data: data)
|
|
@@ -69,6 +72,7 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
69
72
|
|
|
70
73
|
let miniappConfig = MiniappConfig()
|
|
71
74
|
miniappConfig.saveState = saveState
|
|
75
|
+
miniappConfig.urlSuffix = urlSuffix
|
|
72
76
|
|
|
73
77
|
if let enableSplash = enableSplash {
|
|
74
78
|
miniappConfig.enableSplash(isSplashEnabled: enableSplash)
|