@appboxo/capacitor-boxo-sdk 0.1.3 → 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.
- 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 +2 -0
- 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 +3 -0
- package/package.json +1 -1
package/CapacitorBoxoSdk.podspec
CHANGED
package/README.md
CHANGED
|
@@ -235,6 +235,7 @@ logout() => Promise<void>
|
|
|
235
235
|
| **`urlSuffix`** | <code>string</code> | (optional) suffix to append to miniapp URL (like: http://miniapp-url.com/?param=test) |
|
|
236
236
|
| **`colors`** | <code><a href="#coloroptions">ColorOptions</a></code> | (optional) provide colors to miniapp if miniapp supports |
|
|
237
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 |
|
|
238
239
|
|
|
239
240
|
|
|
240
241
|
#### ColorOptions
|
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.5.
|
|
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"
|
|
@@ -72,6 +72,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
|
|
|
72
72
|
val urlSuffix = call.getString("urlSuffix")
|
|
73
73
|
val colors = call.getObject("colors")
|
|
74
74
|
val enableSplash = call.getBoolean("enableSplash")
|
|
75
|
+
val saveState = call.getBoolean("saveState") ?: true
|
|
75
76
|
val miniapp: Miniapp = Appboxo.getMiniapp(appId)
|
|
76
77
|
.setCustomEventListener(this)
|
|
77
78
|
.setPaymentEventListener(this)
|
|
@@ -106,6 +107,7 @@ class AppboxoPlugin : Plugin(), Miniapp.LifecycleListener,
|
|
|
106
107
|
}
|
|
107
108
|
if (enableSplash != null)
|
|
108
109
|
configBuilder.enableSplash(enableSplash)
|
|
110
|
+
configBuilder.saveState(saveState)
|
|
109
111
|
miniapp.setConfig(configBuilder.build())
|
|
110
112
|
miniapp.open(bridge.activity)
|
|
111
113
|
}
|
package/dist/docs.json
CHANGED
|
@@ -346,6 +346,13 @@
|
|
|
346
346
|
"docs": "(optional) use to skip miniapp splash screen",
|
|
347
347
|
"complexTypes": [],
|
|
348
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"
|
|
349
356
|
}
|
|
350
357
|
]
|
|
351
358
|
},
|
|
@@ -114,6 +114,10 @@ export interface OpenMiniappOptions {
|
|
|
114
114
|
* (optional) use to skip miniapp splash screen
|
|
115
115
|
*/
|
|
116
116
|
enableSplash?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* (optional) use to save state on close miniapp
|
|
119
|
+
*/
|
|
120
|
+
saveState?: boolean;
|
|
117
121
|
}
|
|
118
122
|
export interface ColorOptions {
|
|
119
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 * 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\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"]}
|
|
@@ -61,12 +61,15 @@ public class AppboxoPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
61
61
|
let extraUrlParams = call.getObject("extraUrlParams")?.toMap() ?? nil
|
|
62
62
|
let colors = call.getObject("colors")?.toMap() ?? nil
|
|
63
63
|
let enableSplash = call.getBool("enableSplash")
|
|
64
|
+
let saveState = call.getBool("saveState", true)
|
|
64
65
|
|
|
65
66
|
let miniApp = Appboxo.shared.getMiniapp(appId: appId)
|
|
66
67
|
miniApp.setData(data: data)
|
|
67
68
|
miniApp.delegate = self
|
|
68
69
|
|
|
69
70
|
let miniappConfig = MiniappConfig()
|
|
71
|
+
miniappConfig.saveState = saveState
|
|
72
|
+
|
|
70
73
|
if let enableSplash = enableSplash {
|
|
71
74
|
miniappConfig.enableSplash(isSplashEnabled: enableSplash)
|
|
72
75
|
}
|