@appboxo/expo-boxo-sdk 0.6.0 → 0.6.2
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/CHANGELOG.md +6 -0
- package/android/src/main/java/io/boxo/expo/ExpoBoxoSdkModule.kt +4 -0
- package/android/src/main/java/io/boxo/expo/MiniappOptions.kt +3 -0
- package/build/ExpoBoxoSdk.types.d.ts +7 -3
- package/build/ExpoBoxoSdk.types.d.ts.map +1 -1
- package/build/ExpoBoxoSdk.types.js.map +1 -1
- package/ios/ExpoBoxoSdk.podspec +1 -1
- package/ios/ExpoBoxoSdkModule.swift +25 -10
- package/ios/MiniappOptions.swift +3 -0
- package/package.json +1 -1
- package/src/ExpoBoxoSdk.types.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,7 @@ package io.boxo.expo
|
|
|
3
3
|
import android.os.Handler
|
|
4
4
|
import android.os.Looper
|
|
5
5
|
import io.boxo.data.models.MiniappData
|
|
6
|
+
import io.boxo.data.models.PageAnimation
|
|
6
7
|
import io.boxo.js.params.CustomEvent
|
|
7
8
|
import io.boxo.js.params.PaymentData
|
|
8
9
|
import expo.modules.kotlin.modules.Module
|
|
@@ -155,6 +156,9 @@ class ExpoBoxoSdkModule : Module() {
|
|
|
155
156
|
colors["tertiaryColor"] ?: "",
|
|
156
157
|
)
|
|
157
158
|
}
|
|
159
|
+
val pageAnimation = runCatching { PageAnimation.valueOf(options.pageAnimation ?: "") }
|
|
160
|
+
.getOrDefault(PageAnimation.BOTTOM_TO_TOP)
|
|
161
|
+
configBuilder.pageAnimation(pageAnimation)
|
|
158
162
|
configBuilder.enableSplash(options.enableSplash)
|
|
159
163
|
configBuilder.saveState(options.saveState)
|
|
160
164
|
miniapp.setConfig(configBuilder.build())
|
|
@@ -21,7 +21,7 @@ export type CustomEventData = {
|
|
|
21
21
|
export type LifecycleData = {
|
|
22
22
|
appId: string;
|
|
23
23
|
/**
|
|
24
|
-
* onLaunch - Called when the miniapp will launch with
|
|
24
|
+
* onLaunch - Called when the miniapp will launch with Boxo.open(...)
|
|
25
25
|
* onResume - Called when the miniapp will start interacting with the user
|
|
26
26
|
* onPause - Called when the miniapp loses foreground state
|
|
27
27
|
* onClose - Called when clicked close button in miniapp or when destroyed miniapp page
|
|
@@ -84,9 +84,9 @@ export type MiniappOptions = {
|
|
|
84
84
|
*/
|
|
85
85
|
data?: Record<string, any>;
|
|
86
86
|
/**
|
|
87
|
-
* (optional) miniapp theme
|
|
87
|
+
* (optional) miniapp theme 'dark' | 'light' | 'system' (by default is system theme)
|
|
88
88
|
*/
|
|
89
|
-
theme?:
|
|
89
|
+
theme?: 'light' | 'dark' | 'system';
|
|
90
90
|
/**
|
|
91
91
|
* (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test)
|
|
92
92
|
*/
|
|
@@ -107,6 +107,10 @@ export type MiniappOptions = {
|
|
|
107
107
|
* (optional) use to save state on close miniapp
|
|
108
108
|
*/
|
|
109
109
|
saveState?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* (optional) use to change launch animation for miniapp.
|
|
112
|
+
*/
|
|
113
|
+
pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN';
|
|
110
114
|
};
|
|
111
115
|
export type MiniappListResult = {
|
|
112
116
|
miniapps?: Array<MiniappData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoBoxoSdk.types.d.ts","sourceRoot":"","sources":["../src/ExpoBoxoSdk.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,M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IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoBoxoSdk.types.js","sourceRoot":"","sources":["../src/ExpoBoxoSdk.types.ts"],"names":[],"mappings":"","sourcesContent":["export type AuthEventPayload = {\n appId: string;\n};\n\nexport type PaymentData = {\n appId: string;\n transactionToken?: string;\n miniappOrderId?: string;\n amount?: number;\n currency?: string;\n extraParams?: Record<string, any>;\n hostappOrderId?: string;\n status?: string;\n};\n\nexport type CustomEventData = {\n appId: string;\n requestId?: number;\n type?: string;\n errorType?: string;\n payload?: Record<string, any>;\n};\n\nexport type LifecycleData = {\n appId: string;\n /**\n * onLaunch - Called when the miniapp will launch with
|
|
1
|
+
{"version":3,"file":"ExpoBoxoSdk.types.js","sourceRoot":"","sources":["../src/ExpoBoxoSdk.types.ts"],"names":[],"mappings":"","sourcesContent":["export type AuthEventPayload = {\n appId: string;\n};\n\nexport type PaymentData = {\n appId: string;\n transactionToken?: string;\n miniappOrderId?: string;\n amount?: number;\n currency?: string;\n extraParams?: Record<string, any>;\n hostappOrderId?: string;\n status?: string;\n};\n\nexport type CustomEventData = {\n appId: string;\n requestId?: number;\n type?: string;\n errorType?: string;\n payload?: Record<string, any>;\n};\n\nexport type LifecycleData = {\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 */\n lifecycle: string;\n error?: string\n};\n\nexport type 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 multitaskMode?: 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 /**\n * use it to hide \"About Page\" from Miniapp menu\n */\n showAboutPage?: boolean;\n};\n\nexport type MiniappOptions = {\n /**\n * miniapp id\n */\n appId: string;\n /**\n * (optional) data as Map that is sent to miniapp\n */\n data?: Record<string, any>;\n /**\n * (optional) miniapp theme 'dark' | 'light' | 'system' (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?: Record<string, string>;\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?: Record<string, string>;\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 type MiniappListResult = {\n miniapps?: Array<MiniappData>;\n error?: string;\n}\n\nexport type MiniappData = {\n appId: string;\n name: string;\n category: string;\n description: string;\n logo: string;\n}\n\n"]}
|
package/ios/ExpoBoxoSdk.podspec
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
|
-
import
|
|
2
|
+
import BoxoSDK
|
|
3
3
|
|
|
4
4
|
public class ExpoBoxoSdkModule: Module {
|
|
5
5
|
|
|
@@ -27,11 +27,11 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
27
27
|
config.showClearCache = options.showClearCache
|
|
28
28
|
config.showAboutPage = options.showAboutPage
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Boxo.shared.setConfig(config: config)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
Function("openMiniapp") { (options : MiniappOptions) in
|
|
34
|
-
let miniApp =
|
|
34
|
+
let miniApp = Boxo.shared.getMiniapp(appId: options.appId)
|
|
35
35
|
miniApp.setData(data: options.data)
|
|
36
36
|
miniApp.delegate = self
|
|
37
37
|
|
|
@@ -41,6 +41,21 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
41
41
|
miniappConfig.setExtraParams(extraParams: options.extraUrlParams)
|
|
42
42
|
miniappConfig.urlSuffix = options.urlSuffix ?? ""
|
|
43
43
|
|
|
44
|
+
switch options.pageAnimation {
|
|
45
|
+
case "BOTTOM_TO_TOP":
|
|
46
|
+
miniappConfig.pageAnimation = .BOTTOM_TO_TOP
|
|
47
|
+
case "TOP_TO_BOTTOM":
|
|
48
|
+
miniappConfig.pageAnimation = .TOP_TO_BOTTOM
|
|
49
|
+
case "LEFT_TO_RIGHT":
|
|
50
|
+
miniappConfig.pageAnimation = .LEFT_TO_RIGHT
|
|
51
|
+
case "RIGHT_TO_LEFT":
|
|
52
|
+
miniappConfig.pageAnimation = .RIGHT_TO_LEFT
|
|
53
|
+
case "FADE_IN":
|
|
54
|
+
miniappConfig.pageAnimation = .FADE_IN
|
|
55
|
+
default:
|
|
56
|
+
miniappConfig.pageAnimation = .BOTTOM_TO_TOP
|
|
57
|
+
}
|
|
58
|
+
|
|
44
59
|
if let theme = options.theme {
|
|
45
60
|
switch theme {
|
|
46
61
|
case "dark":
|
|
@@ -66,7 +81,7 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
66
81
|
|
|
67
82
|
Function("setAuthCode") { (appId : String, authCode: String) in
|
|
68
83
|
DispatchQueue.main.async {
|
|
69
|
-
|
|
84
|
+
Boxo.shared.getMiniapp(appId: appId).setAuthCode(authCode: authCode)
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
87
|
|
|
@@ -78,7 +93,7 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
78
93
|
event.payload = customEvent.payload
|
|
79
94
|
|
|
80
95
|
DispatchQueue.main.async {
|
|
81
|
-
|
|
96
|
+
Boxo.shared.getMiniapp(appId: customEvent.appId).sendCustomEvent(customEvent: event)
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
99
|
|
|
@@ -93,12 +108,12 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
93
108
|
paymentData.extraParams = paymentEvent.extraParams
|
|
94
109
|
|
|
95
110
|
DispatchQueue.main.async {
|
|
96
|
-
|
|
111
|
+
Boxo.shared.getMiniapp(appId: paymentEvent.appId).sendPaymentEvent(paymentData: paymentData)
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
114
|
|
|
100
115
|
Function("closeMiniapp") { (appId : String) in
|
|
101
|
-
if let miniapp =
|
|
116
|
+
if let miniapp = Boxo.shared.getExistingMiniapp(appId: appId) {
|
|
102
117
|
DispatchQueue.main.async {
|
|
103
118
|
miniapp.close()
|
|
104
119
|
}
|
|
@@ -107,18 +122,18 @@ public class ExpoBoxoSdkModule: Module {
|
|
|
107
122
|
|
|
108
123
|
Function("hideMiniapps") {
|
|
109
124
|
DispatchQueue.main.async {
|
|
110
|
-
|
|
125
|
+
Boxo.shared.hideMiniapps()
|
|
111
126
|
}
|
|
112
127
|
}
|
|
113
128
|
|
|
114
129
|
Function("logout") {
|
|
115
130
|
DispatchQueue.main.async {
|
|
116
|
-
|
|
131
|
+
Boxo.shared.logout()
|
|
117
132
|
}
|
|
118
133
|
}
|
|
119
134
|
|
|
120
135
|
Function("getMiniapps") {
|
|
121
|
-
|
|
136
|
+
Boxo.shared.getMiniapps { miniapps, error in
|
|
122
137
|
if let error = error {
|
|
123
138
|
self.sendEvent("miniappList", ["error" : error])
|
|
124
139
|
} else {
|
package/ios/MiniappOptions.swift
CHANGED
package/package.json
CHANGED
package/src/ExpoBoxoSdk.types.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type CustomEventData = {
|
|
|
24
24
|
export type LifecycleData = {
|
|
25
25
|
appId: string;
|
|
26
26
|
/**
|
|
27
|
-
* onLaunch - Called when the miniapp will launch with
|
|
27
|
+
* onLaunch - Called when the miniapp will launch with Boxo.open(...)
|
|
28
28
|
* onResume - Called when the miniapp will start interacting with the user
|
|
29
29
|
* onPause - Called when the miniapp loses foreground state
|
|
30
30
|
* onClose - Called when clicked close button in miniapp or when destroyed miniapp page
|
|
@@ -90,9 +90,9 @@ export type MiniappOptions = {
|
|
|
90
90
|
*/
|
|
91
91
|
data?: Record<string, any>;
|
|
92
92
|
/**
|
|
93
|
-
* (optional) miniapp theme
|
|
93
|
+
* (optional) miniapp theme 'dark' | 'light' | 'system' (by default is system theme)
|
|
94
94
|
*/
|
|
95
|
-
theme?:
|
|
95
|
+
theme?: 'light' | 'dark' | 'system';
|
|
96
96
|
/**
|
|
97
97
|
* (optional) extra query params to append to miniapp URL (like: http://miniapp-url.com/?param=test)
|
|
98
98
|
*/
|
|
@@ -113,6 +113,10 @@ export type MiniappOptions = {
|
|
|
113
113
|
* (optional) use to save state on close miniapp
|
|
114
114
|
*/
|
|
115
115
|
saveState?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* (optional) use to change launch animation for miniapp.
|
|
118
|
+
*/
|
|
119
|
+
pageAnimation?: 'BOTTOM_TO_TOP' | 'TOP_TO_BOTTOM' | 'LEFT_TO_RIGHT' | 'RIGHT_TO_LEFT' | 'FADE_IN';
|
|
116
120
|
};
|
|
117
121
|
|
|
118
122
|
export type MiniappListResult = {
|