@mpxjs/api-proxy 2.9.64 → 2.9.65

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/api-proxy",
3
- "version": "2.9.64",
3
+ "version": "2.9.65",
4
4
  "description": "convert miniprogram API at each end",
5
5
  "module": "src/index.js",
6
6
  "types": "@types/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/didi/mpx#readme",
39
39
  "dependencies": {
40
- "@mpxjs/utils": "^2.9.64",
40
+ "@mpxjs/utils": "^2.9.65",
41
41
  "axios": "^1.7.3"
42
42
  },
43
43
  "peerDependencies": {
@@ -80,5 +80,5 @@
80
80
  "optional": true
81
81
  }
82
82
  },
83
- "gitHead": "803334dc0e600f219d514c27461aa7663b7a6653"
83
+ "gitHead": "24efa90e90b4d42c285ca61739cb9e4d0696976c"
84
84
  }
@@ -1,4 +1,4 @@
1
- import { hasOwn, noop, getEnvObj } from '@mpxjs/utils'
1
+ import { hasOwn, noop, getEnvObj, getFocusedNavigation } from '@mpxjs/utils'
2
2
 
3
3
  /**
4
4
  *
@@ -87,14 +87,6 @@ function failHandle (result, fail, complete) {
87
87
  typeof complete === 'function' && complete(result)
88
88
  }
89
89
 
90
- function getFocusedNavigation () {
91
- for (const key in global.__mpxPagesMap) {
92
- const navigation = global.__mpxPagesMap[key]?.[1]
93
- if (navigation && navigation.isFocused()) {
94
- return navigation
95
- }
96
- }
97
- }
98
90
  const ENV_OBJ = getEnvObj()
99
91
 
100
92
  export {
@@ -110,7 +110,8 @@ function reLaunch (options = {}) {
110
110
  routeCount: ++routeCount,
111
111
  replaced: false
112
112
  }
113
- const delta = router.stack.length - 1
113
+ // 宿主环境中没有办法统计到webview中的页面跳转,所有给用户开放个userDelta,由用户根据webview中的页面跳转的个数自行传递控制relaunch跳转正确
114
+ const delta = router.stack.length - 1 + (options.delta || 0)
114
115
  // 在需要操作后退时,先操作后退,在beforeEach中基于当前action通过next()进行replace操作,避免部分浏览器的表现不一致
115
116
  if (delta > 0) {
116
117
  router.go(-delta)
@@ -5,10 +5,10 @@ import { successHandle, failHandle, defineUnsupportedProps, getFocusedNavigation
5
5
 
6
6
  const getWindowInfo = function () {
7
7
  const dimensionsScreen = Dimensions.get('screen')
8
- const navigation = getFocusedNavigation() || {}
8
+ const navigation = getFocusedNavigation()
9
9
  const insets = {
10
- ...(initialWindowMetrics?.insets || {}),
11
- ...(navigation.insets || {})
10
+ ...initialWindowMetrics?.insets,
11
+ ...navigation?.insets
12
12
  }
13
13
  let safeArea = {}
14
14
  let { top = 0, bottom = 0, left = 0, right = 0 } = insets
@@ -17,7 +17,7 @@ const getWindowInfo = function () {
17
17
  }
18
18
  const screenHeight = dimensionsScreen.height
19
19
  const screenWidth = dimensionsScreen.width
20
- const layout = navigation.layout || {}
20
+ const layout = navigation?.layout || {}
21
21
  const layoutHeight = layout.height || 0
22
22
  const layoutWidth = layout.width || 0
23
23
  const windowHeight = layoutHeight || screenHeight