@appboxo/expo-boxo-sdk 0.5.0 → 0.6.1

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 CHANGED
@@ -1,4 +1,14 @@
1
1
  # Changelog
2
+ ## [0.6.1]
3
+ - add miniapp page animation
4
+
5
+ ## [0.6.0]
6
+ - add new menu style
7
+ - Added list of user fields to consent screen
8
+ - add native pull to refresh
9
+ - add camera option to file picker
10
+ - other improvements in native sdk
11
+
2
12
  ## [0.5.0]
3
13
  - Added list of user fields to consent screen
4
14
  - LTR/RTL support by language
@@ -42,7 +42,7 @@ android {
42
42
  }
43
43
  }
44
44
  dependencies {
45
- implementation('com.appboxo:sdk:1.16.3') {
45
+ implementation('io.boxo.sdk:boxo-android:1.23.0') {
46
46
  exclude group: 'com.google.android.gms', module: 'play-services-location'
47
47
  }
48
48
  }
@@ -2,13 +2,14 @@ package io.boxo.expo
2
2
 
3
3
  import android.os.Handler
4
4
  import android.os.Looper
5
- import com.appboxo.data.models.MiniappData
6
- import com.appboxo.js.params.CustomEvent
7
- import com.appboxo.js.params.PaymentData
5
+ import io.boxo.data.models.MiniappData
6
+ import io.boxo.data.models.PageAnimation
7
+ import io.boxo.js.params.CustomEvent
8
+ import io.boxo.js.params.PaymentData
8
9
  import expo.modules.kotlin.modules.Module
9
10
  import expo.modules.kotlin.modules.ModuleDefinition
10
11
  import expo.modules.kotlin.Promise
11
- import com.appboxo.sdk.*
12
+ import io.boxo.sdk.*
12
13
 
13
14
  class ExpoBoxoSdkModule : Module() {
14
15
  private var handler: Handler? = null
@@ -26,7 +27,7 @@ class ExpoBoxoSdkModule : Module() {
26
27
  "dark" -> Config.Theme.DARK
27
28
  else -> Config.Theme.SYSTEM
28
29
  }
29
- Appboxo.init(appContext.activityProvider!!.currentActivity.application)
30
+ Boxo.init(appContext.activityProvider!!.currentActivity.application)
30
31
  .setConfig(
31
32
  Config.Builder()
32
33
  .setClientId(options.clientId)
@@ -44,7 +45,7 @@ class ExpoBoxoSdkModule : Module() {
44
45
  }
45
46
 
46
47
  Function("openMiniapp") { options: MiniappOptions ->
47
- val miniapp: Miniapp = Appboxo.getMiniapp(options.appId)
48
+ val miniapp: Miniapp = Boxo.getMiniapp(options.appId)
48
49
  .setCustomEventListener { _, miniapp, customEvent ->
49
50
  sendEvent(
50
51
  "customEvent", mapOf(
@@ -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())
@@ -162,13 +166,13 @@ class ExpoBoxoSdkModule : Module() {
162
166
  }
163
167
 
164
168
  Function("setAuthCode") { appId: String, authCode: String ->
165
- Appboxo.getMiniapp(appId)
169
+ Boxo.getMiniapp(appId)
166
170
  .setAuthCode(authCode)
167
171
  }
168
172
 
169
173
  Function("sendCustomEvent") { customEvent: CustomEventData ->
170
174
  handler?.post {
171
- Appboxo.getMiniapp(customEvent.appId)
175
+ Boxo.getMiniapp(customEvent.appId)
172
176
  .sendEvent(
173
177
  CustomEvent(
174
178
  requestId = customEvent.requestId,
@@ -182,7 +186,7 @@ class ExpoBoxoSdkModule : Module() {
182
186
 
183
187
  Function("sendPaymentEvent") { paymentEvent: PaymentEventData ->
184
188
  handler?.post {
185
- Appboxo.getMiniapp(paymentEvent.appId)
189
+ Boxo.getMiniapp(paymentEvent.appId)
186
190
  .sendPaymentResult(
187
191
  PaymentData(
188
192
  transactionToken = paymentEvent.transactionToken ?: "",
@@ -198,19 +202,19 @@ class ExpoBoxoSdkModule : Module() {
198
202
  }
199
203
 
200
204
  Function("closeMiniapp") { appId: String ->
201
- Appboxo.getExistingMiniapp(appId)?.close()
205
+ Boxo.getExistingMiniapp(appId)?.close()
202
206
  }
203
207
 
204
208
  Function("hideMiniapps") {
205
- Appboxo.hideMiniapps()
209
+ Boxo.hideMiniapps()
206
210
  }
207
211
 
208
212
  Function("logout") {
209
- Appboxo.logout()
213
+ Boxo.logout()
210
214
  }
211
215
 
212
216
  Function("getMiniapps") {
213
- Appboxo.getMiniapps(object : MiniappListCallback {
217
+ Boxo.getMiniapps(object : MiniappListCallback {
214
218
  override fun onFailure(e: Exception) {
215
219
  sendEvent("miniappList", mapOf("error" to e.toString()))
216
220
  }
@@ -27,4 +27,7 @@ class MiniappOptions : Record {
27
27
 
28
28
  @Field
29
29
  val saveState: Boolean = true
30
+
31
+ @Field
32
+ val pageAnimation: String? = null
30
33
  }
@@ -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 Appboxo.open(...)
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 "dark" | "light" (by default is system theme)
87
+ * (optional) miniapp theme 'dark' | 'light' | 'system' (by default is system theme)
88
88
  */
89
- theme?: string;
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,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,WAAW,CAAC,EAAE,O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/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 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 */\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\" (by default is system theme)\n */\n theme?: string;\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\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"]}
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/build/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare function sendCustomEvent(event: CustomEventData): void;
26
26
  export declare function logout(): void;
27
27
  /**
28
28
  * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.
29
- * To use this function need to enable 'multitaskMode: true' in Appboxo.setConfigs()
29
+ * To use this function need to enable 'multitaskMode: true' in Boxo.setConfig()
30
30
  */
31
31
  export declare function hideMiniapps(): void;
32
32
  /**
package/build/index.js CHANGED
@@ -38,7 +38,7 @@ export function logout() {
38
38
  }
39
39
  /**
40
40
  * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.
41
- * To use this function need to enable 'multitaskMode: true' in Appboxo.setConfigs()
41
+ * To use this function need to enable 'multitaskMode: true' in Boxo.setConfig()
42
42
  */
43
43
  export function hideMiniapps() {
44
44
  ExpoBoxoSdkModule.hideMiniapps();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAEnF,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAGpD;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAsB;IAC9C,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAuB;IACjD,iBAAiB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAAgB;IACzD,iBAAiB,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAwB;IACvD,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAsB;IACpD,iBAAiB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM;IACpB,iBAAiB,CAAC,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,iBAAiB,CAAC,YAAY,EAAE,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,iBAAiB,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,iBAAiB,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtF,MAAM,UAAU,eAAe,CAAC,QAA2C;IACzE,OAAO,OAAO,CAAC,WAAW,CAAmB,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA0C;IAC/E,OAAO,OAAO,CAAC,WAAW,CAAkB,aAAa,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAsC;IAC5E,OAAO,OAAO,CAAC,WAAW,CAAc,cAAc,EAAE,QAAQ,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAgD;IAC1F,OAAO,OAAO,CAAC,WAAW,CAAgB,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA6C;IAClF,OAAO,OAAO,CAAC,WAAW,CAAoB,aAAa,EAAE,QAAQ,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';\n\nimport ExpoBoxoSdkModule from './ExpoBoxoSdkModule';\nimport { MiniappListResult, MiniappData, LifecycleData, CustomEventData, PaymentData, AuthEventPayload, ConfigOptions, MiniappOptions } from './ExpoBoxoSdk.types';\n\n/**\n * Set global configs\n */\nexport function setConfig(options: ConfigOptions) {\n ExpoBoxoSdkModule.setConfig(options);\n}\n\n/**\n * Open miniapp with options\n */\nexport function openMiniapp(options: MiniappOptions) {\n ExpoBoxoSdkModule.openMiniapp(options);\n}\n\n/**\n * get AuthCode from hostapp backend and send it to miniapp\n */\nexport function setAuthCode(appId: string, authCode: string) {\n ExpoBoxoSdkModule.setAuthCode(appId, authCode);\n}\n\n/**\n * send payment event to miniapp\n */\nexport function sendPaymentEvent(paymentData: PaymentData) {\n ExpoBoxoSdkModule.sendPaymentEvent(paymentData);\n}\n\n/**\n * send custom event to miniapp\n */\nexport function sendCustomEvent(event: CustomEventData) {\n ExpoBoxoSdkModule.sendCustomEvent(event);\n}\n\n/**\n * When host app user logs out, it is highly important to clear all miniapp storage data.\n */\nexport function logout() {\n ExpoBoxoSdkModule.logout();\n}\n\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 'multitaskMode: true' in Appboxo.setConfigs()\n */\nexport function hideMiniapps() {\n ExpoBoxoSdkModule.hideMiniapps();\n}\n\n/**\n * close miniapp by appId\n */\nexport function closeMiniapp(appId: string) {\n ExpoBoxoSdkModule.closeMiniapp(appId);\n}\n\n/**\n * Get list of miniapps\n */\nexport function getMiniapps() {\n ExpoBoxoSdkModule.getMiniapps();\n}\n\nconst emitter = new EventEmitter(ExpoBoxoSdkModule ?? NativeModulesProxy.ExpoBoxoSdk);\n\nexport function addAuthListener(listener: (event: AuthEventPayload) => void): Subscription {\n return emitter.addListener<AuthEventPayload>('onAuth', listener);\n}\n\nexport function addCustomEventListener(listener: (event: CustomEventData) => void): Subscription {\n return emitter.addListener<CustomEventData>('customEvent', listener);\n}\n\nexport function addPaymentEventListener(listener: (event: PaymentData) => void): Subscription {\n return emitter.addListener<PaymentData>('paymentEvent', listener);\n}\n\nexport function addMiniappLifecycleListener(listener: (lifecycleData: LifecycleData) => void): Subscription {\n return emitter.addListener<LifecycleData>('miniappLifecycle', listener);\n}\n\nexport function addMiniappListListener(listener: (result: MiniappListResult) => void): Subscription {\n return emitter.addListener<MiniappListResult>('miniappList', listener);\n}\n\nexport { MiniappListResult, MiniappData, LifecycleData, CustomEventData, PaymentData, AuthEventPayload, ConfigOptions, MiniappOptions };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":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AO,CAAC,WAAW,CAAmB,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA0C;IAC/E,OAAO,OAAO,CAAC,WAAW,CAAkB,aAAa,EAAE,QAAQ,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAsC;IAC5E,OAAO,OAAO,CAAC,WAAW,CAAc,cAAc,EAAE,QAAQ,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAgD;IAC1F,OAAO,OAAO,CAAC,WAAW,CAAgB,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAA6C;IAClF,OAAO,OAAO,CAAC,WAAW,CAAoB,aAAa,EAAE,QAAQ,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';\n\nimport ExpoBoxoSdkModule from './ExpoBoxoSdkModule';\nimport { MiniappListResult, MiniappData, LifecycleData, CustomEventData, PaymentData, AuthEventPayload, ConfigOptions, MiniappOptions } from './ExpoBoxoSdk.types';\n\n/**\n * Set global configs\n */\nexport function setConfig(options: ConfigOptions) {\n ExpoBoxoSdkModule.setConfig(options);\n}\n\n/**\n * Open miniapp with options\n */\nexport function openMiniapp(options: MiniappOptions) {\n ExpoBoxoSdkModule.openMiniapp(options);\n}\n\n/**\n * get AuthCode from hostapp backend and send it to miniapp\n */\nexport function setAuthCode(appId: string, authCode: string) {\n ExpoBoxoSdkModule.setAuthCode(appId, authCode);\n}\n\n/**\n * send payment event to miniapp\n */\nexport function sendPaymentEvent(paymentData: PaymentData) {\n ExpoBoxoSdkModule.sendPaymentEvent(paymentData);\n}\n\n/**\n * send custom event to miniapp\n */\nexport function sendCustomEvent(event: CustomEventData) {\n ExpoBoxoSdkModule.sendCustomEvent(event);\n}\n\n/**\n * When host app user logs out, it is highly important to clear all miniapp storage data.\n */\nexport function logout() {\n ExpoBoxoSdkModule.logout();\n}\n\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 'multitaskMode: true' in Boxo.setConfig()\n */\nexport function hideMiniapps() {\n ExpoBoxoSdkModule.hideMiniapps();\n}\n\n/**\n * close miniapp by appId\n */\nexport function closeMiniapp(appId: string) {\n ExpoBoxoSdkModule.closeMiniapp(appId);\n}\n\n/**\n * Get list of miniapps\n */\nexport function getMiniapps() {\n ExpoBoxoSdkModule.getMiniapps();\n}\n\nconst emitter = new EventEmitter(ExpoBoxoSdkModule ?? NativeModulesProxy.ExpoBoxoSdk);\n\nexport function addAuthListener(listener: (event: AuthEventPayload) => void): Subscription {\n return emitter.addListener<AuthEventPayload>('onAuth', listener);\n}\n\nexport function addCustomEventListener(listener: (event: CustomEventData) => void): Subscription {\n return emitter.addListener<CustomEventData>('customEvent', listener);\n}\n\nexport function addPaymentEventListener(listener: (event: PaymentData) => void): Subscription {\n return emitter.addListener<PaymentData>('paymentEvent', listener);\n}\n\nexport function addMiniappLifecycleListener(listener: (lifecycleData: LifecycleData) => void): Subscription {\n return emitter.addListener<LifecycleData>('miniappLifecycle', listener);\n}\n\nexport function addMiniappListListener(listener: (result: MiniappListResult) => void): Subscription {\n return emitter.addListener<MiniappListResult>('miniappList', listener);\n}\n\nexport { MiniappListResult, MiniappData, LifecycleData, CustomEventData, PaymentData, AuthEventPayload, ConfigOptions, MiniappOptions };\n"]}
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.static_framework = true
17
17
 
18
18
  s.dependency 'ExpoModulesCore'
19
- s.dependency 'AppBoxoSDK', '1.8.2'
19
+ s.dependency 'BoxoSDK', '1.10.0'
20
20
 
21
21
  # Swift/Objective-C compatibility
22
22
  s.pod_target_xcconfig = {
@@ -1,5 +1,5 @@
1
1
  import ExpoModulesCore
2
- import AppBoxoSDK
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
- Appboxo.shared.setConfig(config: config)
30
+ Boxo.shared.setConfig(config: config)
31
31
  }
32
32
 
33
33
  Function("openMiniapp") { (options : MiniappOptions) in
34
- let miniApp = Appboxo.shared.getMiniapp(appId: options.appId)
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
- Appboxo.shared.getMiniapp(appId: appId).setAuthCode(authCode: authCode)
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
- Appboxo.shared.getMiniapp(appId: customEvent.appId).sendCustomEvent(customEvent: event)
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
- Appboxo.shared.getMiniapp(appId: paymentEvent.appId).sendPaymentEvent(paymentData: paymentData)
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 = Appboxo.shared.getExistingMiniapp(appId: appId) {
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
- Appboxo.shared.hideMiniapps()
125
+ Boxo.shared.hideMiniapps()
111
126
  }
112
127
  }
113
128
 
114
129
  Function("logout") {
115
130
  DispatchQueue.main.async {
116
- Appboxo.shared.logout()
131
+ Boxo.shared.logout()
117
132
  }
118
133
  }
119
134
 
120
135
  Function("getMiniapps") {
121
- Appboxo.shared.getMiniapps { miniapps, error in
136
+ Boxo.shared.getMiniapps { miniapps, error in
122
137
  if let error = error {
123
138
  self.sendEvent("miniappList", ["error" : error])
124
139
  } else {
@@ -31,4 +31,7 @@ struct MiniappOptions: Record {
31
31
 
32
32
  @Field
33
33
  var saveState: Bool = true
34
+
35
+ @Field
36
+ var pageAnimation: String?
34
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appboxo/expo-boxo-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Expo wrapper over Appboxo SDK for IOS and Android.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -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 Appboxo.open(...)
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 "dark" | "light" (by default is system theme)
93
+ * (optional) miniapp theme 'dark' | 'light' | 'system' (by default is system theme)
94
94
  */
95
- theme?: string;
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 = {
package/src/index.ts CHANGED
@@ -47,7 +47,7 @@ export function logout() {
47
47
 
48
48
  /**
49
49
  * Miniapp opens on a native screen. To show payment processing page need to hide miniapp screen.
50
- * To use this function need to enable 'multitaskMode: true' in Appboxo.setConfigs()
50
+ * To use this function need to enable 'multitaskMode: true' in Boxo.setConfig()
51
51
  */
52
52
  export function hideMiniapps() {
53
53
  ExpoBoxoSdkModule.hideMiniapps();
package/app.plugin.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./plugins/withBoxoBuildGradle');
@@ -1,23 +0,0 @@
1
- const { withProjectBuildGradle } = require('@expo/config-plugins');
2
-
3
- const boxo_allprojects_block = `
4
- allprojects {
5
- repositories {
6
- maven { url "https://jitpack.io" }
7
- maven {
8
- url "https://maven.pkg.github.com/Appboxo/android-sdk-packages"
9
- credentials {
10
- username = "appboxoandroidsdk"
11
- password = "\u0037\u0039\u0064\u0031\u0065\u0064\u0061\u0036\u0030\u0034\u0063\u0061\u0031\u0066\u0030\u0032\u0066\u0031\u0037\u0066\u0032\u0061\u0039\u0033\u0064\u0035\u0039\u0039\u0061\u0035\u0035\u0062\u0066\u0065\u0031\u0064\u0066\u0064\u0038\u0038"
12
- }
13
- }
14
- }
15
- }
16
- `;
17
-
18
- module.exports = (config) => {
19
- return withProjectBuildGradle(config, (config) => {
20
- config.modResults.contents += boxo_allprojects_block;
21
- return config;
22
- });
23
- };