@foundbyte/uni-libs 1.1.0 → 1.1.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.
Files changed (24) hide show
  1. package/README.md +26 -11
  2. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/asyncToGenerator.js +1 -1
  3. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/defineProperty.js +1 -1
  4. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/objectSpread2.js +1 -1
  5. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/objectWithoutProperties.js +1 -1
  6. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/objectWithoutPropertiesLoose.js +1 -1
  7. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/toPrimitive.js +1 -1
  8. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/toPropertyKey.js +1 -1
  9. package/es/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.135.0/helpers/esm}/typeof.js +1 -1
  10. package/es/configs/app/app.hwtest.js +7 -1
  11. package/es/configs/app/app.prod.js +7 -1
  12. package/es/configs/app/index.js +4 -4
  13. package/es/constants/routes/index.js +36 -0
  14. package/es/entry.js +6 -6
  15. package/es/enums/business-line/index.d.ts +10 -3
  16. package/es/enums/business-line/index.js +39 -32
  17. package/es/index.d.ts +2 -2
  18. package/es/index.js +2 -2
  19. package/es/services/goods/service.js +40 -26
  20. package/es/utils/obs/image.d.ts +1 -1
  21. package/es/utils/obs/image.js +4 -4
  22. package/es/utils/web-view/index.d.ts +9 -1
  23. package/es/utils/web-view/index.js +64 -28
  24. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # 一码游贵州SDK包
2
2
 
3
- ## 一、服务
4
- ### 1.初始化
3
+ ## 服务
4
+ ### 初始化
5
5
  如需使用服务api,必须进行初始化,所有服务方法都需要依赖该方法生成的实例对象进行调用
6
6
  ```typescript
7
7
  import { OneTravelSDK, EAppEnv, ECaller } from '@foundbyte/uni-libs'
@@ -22,10 +22,10 @@ const oneTravelSdk = new OneTravelSDK({
22
22
  | appEnv | 环境变量 | EAppEnv | 否 | EAppEnv.PROD |
23
23
  | caller | 调用者 | ECaller | 否 | ECaller.WEB |
24
24
 
25
- ### 2.goodsService
25
+ ### goodsService
26
26
  商品服务
27
27
 
28
- #### 2.1跳转商品详情页
28
+ #### 跳转商品详情页
29
29
  ```typescript
30
30
  oneTravelSdk.goodsService.jumpToProductDetailPage({
31
31
  ...
@@ -39,8 +39,8 @@ oneTravelSdk.goodsService.jumpToProductDetailPage({
39
39
 
40
40
 
41
41
 
42
- ## 二、工具
43
- ### 1.navigateTo
42
+ ## 工具
43
+ ### navigateTo
44
44
  原生路由跳转
45
45
  ```typescript
46
46
  import { navigateTo } from '@foundbyte/uni-libs'
@@ -50,9 +50,16 @@ navigateTo({
50
50
  id: 1
51
51
  }
52
52
  })
53
+
54
+ /**
55
+ * 去登录,并返回刷新
56
+ */
57
+ export const toLogin = () => {
58
+ navigateTo({ src: `/pages/sign-in/index?url=${encodeURIComponent(window.location.href)}&delta=1` })
59
+ }
53
60
  ```
54
61
 
55
- ### 2.redirectTo
62
+ ### redirectTo
56
63
  原生路由重定向
57
64
  ```typescript
58
65
  import { redirectTo } from '@foundbyte/uni-libs'
@@ -64,8 +71,7 @@ redirectTo({
64
71
  })
65
72
  ```
66
73
 
67
-
68
- ### 3.navigateBack
74
+ ### navigateBack
69
75
  原生路由返回
70
76
  ```typescript
71
77
  import { navigateBack } from '@foundbyte/uni-libs'
@@ -74,7 +80,7 @@ navigateBack({
74
80
  })
75
81
  ```
76
82
 
77
- ### 4.setShareParam
83
+ ### setShareParam
78
84
  设置页面分享内容
79
85
  ```typescript
80
86
  import { setShareParam, EBusinessLine } from '@foundbyte/uni-libs'
@@ -92,7 +98,16 @@ businessType: EBusinessLine.Foods
92
98
  )
93
99
  ```
94
100
 
95
- ### 5.环境判断
101
+ ### downLoadFile
102
+ 下载文件
103
+ ```typescript
104
+ import { downLoadFile } from '@foundbyte/uni-libs'
105
+
106
+ // 传入要下载的文件链接
107
+ downLoadFile('https://xxx.pdf')
108
+ ```
109
+
110
+ ### 环境判断
96
111
  ```typescript
97
112
  import { isAlipay, isWeixin, isHarmony, isAndroid, isiOS } from '@foundbyte/uni-libs'
98
113
 
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.122.0/helpers/asyncToGenerator.js
1
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/asyncToGenerator.js
2
2
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
3
3
  try {
4
4
  var i = n[a](c), u = i.value;
@@ -1,5 +1,5 @@
1
1
  import { toPropertyKey } from "./toPropertyKey.js";
2
- //#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
2
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/defineProperty.js
3
3
  function _defineProperty(e, r, t) {
4
4
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5
5
  value: t,
@@ -1,5 +1,5 @@
1
1
  import { _defineProperty } from "./defineProperty.js";
2
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectSpread2.js
2
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectSpread2.js
3
3
  function ownKeys(e, r) {
4
4
  var t = Object.keys(e);
5
5
  if (Object.getOwnPropertySymbols) {
@@ -1,5 +1,5 @@
1
1
  import { _objectWithoutPropertiesLoose } from "./objectWithoutPropertiesLoose.js";
2
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectWithoutProperties.js
2
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectWithoutProperties.js
3
3
  function _objectWithoutProperties(e, t) {
4
4
  if (null == e) return {};
5
5
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.122.0/helpers/objectWithoutPropertiesLoose.js
1
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/objectWithoutPropertiesLoose.js
2
2
  function _objectWithoutPropertiesLoose(r, e) {
3
3
  if (null == r) return {};
4
4
  var t = {};
@@ -1,5 +1,5 @@
1
1
  import { _typeof } from "./typeof.js";
2
- //#region \0@oxc-project+runtime@0.122.0/helpers/toPrimitive.js
2
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPrimitive.js
3
3
  function toPrimitive(t, r) {
4
4
  if ("object" != _typeof(t) || !t) return t;
5
5
  var e = t[Symbol.toPrimitive];
@@ -1,6 +1,6 @@
1
1
  import { _typeof } from "./typeof.js";
2
2
  import { toPrimitive } from "./toPrimitive.js";
3
- //#region \0@oxc-project+runtime@0.122.0/helpers/toPropertyKey.js
3
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/toPropertyKey.js
4
4
  function toPropertyKey(t) {
5
5
  var i = toPrimitive(t, "string");
6
6
  return "symbol" == _typeof(i) ? i : i + "";
@@ -1,4 +1,4 @@
1
- //#region \0@oxc-project+runtime@0.122.0/helpers/typeof.js
1
+ //#region \0@oxc-project+runtime@0.135.0/helpers/esm/typeof.js
2
2
  function _typeof(o) {
3
3
  "@babel/helpers - typeof";
4
4
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -1,8 +1,14 @@
1
1
  //#region src/configs/app/app.hwtest.ts
2
- const config = { domain: {
2
+ const config = {
3
+ /** 域名 */
4
+ domain: {
5
+ /** 购物(老版本) */
3
6
  shopping: "https://shopping-h5.onetravelgz.cn/#/",
7
+ /** 美食 */
4
8
  food: "https://food-h5.onetravelgz.cn/#/",
9
+ /** 一码贵州购物(新版) */
5
10
  onebuygz: "https://testb2ch5-travel.gcongo.cn/#/",
11
+ /** 电影票 */
6
12
  movie: "https://147gn9gm.life.mczjk.cn/#/"
7
13
  } };
8
14
  //#endregion
@@ -1,8 +1,14 @@
1
1
  //#region src/configs/app/app.prod.ts
2
- const config = { domain: {
2
+ const config = {
3
+ /** 域名 */
4
+ domain: {
5
+ /** 购物(老版本) */
3
6
  shopping: "https://shopping-h5.onetravelgz.com/#/",
7
+ /** 美食 */
4
8
  food: "https://home.onetravelgz.com/food/index.html#/",
9
+ /** 一码贵州购物(新版) */
5
10
  onebuygz: "https://travel.onebuygz.com/#/",
11
+ /** 电影票 */
6
12
  movie: "https://147gn9gm.life.mczjk.cn/#/"
7
13
  } };
8
14
  //#endregion
@@ -1,5 +1,5 @@
1
- import { EAppEnv } from "../../enums/environment/index.js";
2
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
1
+ import "../../enums/environment/index.js";
2
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
3
3
  import config from "./app.hwtest.js";
4
4
  import config$1 from "./app.prod.js";
5
5
  //#region src/configs/app/index.ts
@@ -10,10 +10,10 @@ import config$1 from "./app.prod.js";
10
10
  function getAppConfig(appEnv) {
11
11
  let config$2;
12
12
  switch (appEnv) {
13
- case EAppEnv.test:
13
+ case "test":
14
14
  config$2 = config;
15
15
  break;
16
- case EAppEnv.prod:
16
+ case "prod":
17
17
  config$2 = config$1;
18
18
  break;
19
19
  }
@@ -1,44 +1,80 @@
1
1
  //#region src/constants/routes/index.ts
2
2
  /** 一些默认路由跳转 */
3
3
  const routes = Object.freeze({
4
+ /** 首页 */
4
5
  home: "/pages/index/index",
6
+ /** 我的 */
5
7
  mine: "/pages/mine/index",
8
+ /** 消息 */
6
9
  message: "sub/message/pages/index",
10
+ /** 登录 */
7
11
  signIn: "/pages/sign-in/index",
12
+ /** 手机号登录 */
8
13
  signInByMobile: "/pages/sign-in/by-mobile/index",
14
+ /** webView */
9
15
  webView: "/pages/web-view/index",
16
+ /** 设备定位权限 */
10
17
  permission: "/pages/permission/index",
18
+ /** 支付成功页 */
11
19
  paySuccess: "/pages/pay-success/index",
20
+ /** 微信支付页 */
12
21
  wxpay: "/pages/wxpay/wxpay",
22
+ /** 授权页面 */
13
23
  oauth2: "/pages/oauth2/index",
24
+ /** 音频转文字 */
14
25
  voice: "/pages/voice/index",
26
+ /** 请求错误页 */
15
27
  error: "/",
28
+ /** 装修专题页 */
16
29
  renovationSpecial: "/pages/index/special",
30
+ /** ai助手 */
17
31
  aiAssistant: "/pages/ai-assistant/index"
18
32
  });
19
33
  /** 路由地址前缀 */
20
34
  const routePrefix = Object.freeze({
35
+ /** 首页/搜索 */
21
36
  search: "/sub/home/pages/search",
37
+ /** 首页/装修 */
22
38
  renovation: "/sub/home/pages/renovation",
39
+ /** 景区/门票 */
23
40
  ticket: "/sub/ticket/pages",
41
+ /** 同程景区 */
24
42
  scene: "/sub/scene",
43
+ /** 路线 */
25
44
  road: "/sub/road/pages",
45
+ /** 出行 */
26
46
  travel: "/sub/travel/pages",
47
+ /** 酒店 */
27
48
  hotel: "/sub/hotel/pages",
49
+ /** 美食 */
28
50
  food: "/sub/food/pages",
51
+ /** 文娱 */
29
52
  enjoy: "/sub/enjoy/pages",
53
+ /** 种草 */
30
54
  show: "/sub/show/pages",
55
+ /** 视频 */
31
56
  living: "/sub/living/pages",
57
+ /** 实名认证 */
32
58
  realName: "/sub/real-name/pages",
59
+ /** 社保卡 */
33
60
  socialSecurity: "/sub/social-security/pages",
61
+ /** 攻略 */
34
62
  strategy: "/sub/strategy/pages",
63
+ /** 消息 */
35
64
  message: "/sub/message/pages",
65
+ /** 我的 */
36
66
  mine: "/sub/mine/pages",
67
+ /** 活动足迹 */
37
68
  footprint: "/sub/footprint/pages",
69
+ /** 新闻 */
38
70
  news: "/sub/message/pages",
71
+ /** 活动日历 */
39
72
  activityCalendar: "/sub/activity-calendar/pages",
73
+ /** 项目库 */
40
74
  projectLibrary: "/sub/project-library/pages",
75
+ /** 目的地 */
41
76
  destination: "/sub/destination/pages",
77
+ /** 智能行程 */
42
78
  smartRoute: "/sub/smart-route/pages"
43
79
  });
44
80
  //#endregion
package/es/entry.js CHANGED
@@ -1,7 +1,7 @@
1
- import { EAppEnv } from "./enums/environment/index.js";
2
- import { ECaller } from "./enums/sdk/index.js";
3
- import { _defineProperty } from "./_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js";
4
- import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
1
+ import "./enums/environment/index.js";
2
+ import "./enums/sdk/index.js";
3
+ import { _defineProperty } from "./_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/defineProperty.js";
4
+ import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
5
5
  import { getAppConfig } from "./configs/app/index.js";
6
6
  import { GoodsService } from "./services/goods/service.js";
7
7
  //#region src/entry.ts
@@ -13,8 +13,8 @@ var OneTravelSDK = class {
13
13
  _defineProperty(this, "sdkConfig", void 0);
14
14
  _defineProperty(this, "goodsService", void 0);
15
15
  const value = _objectSpread2(_objectSpread2({}, {
16
- appEnv: EAppEnv.prod,
17
- caller: ECaller.web
16
+ appEnv: "prod",
17
+ caller: "web"
18
18
  }), config || {});
19
19
  this.sdkConfig = value;
20
20
  this.goodsService = new GoodsService({ sdkConfig: value });
@@ -3,8 +3,10 @@
3
3
  * 业务线
4
4
  */
5
5
  declare enum EBusinessLine {
6
- /** 景区/门票 */
6
+ /** 景区/门票(景区) */
7
7
  Scenic = 1,
8
+ /** 景区/门票(商品) */
9
+ ScenicGoods = 111,
8
10
  /** 酒店 */
9
11
  Hotel = 2,
10
12
  /** 民宿 */
@@ -83,12 +85,16 @@ declare enum EBusinessLine {
83
85
  UniqueCredentialQuestion = 25,
84
86
  /** ai客服页面 */
85
87
  AiCustomerService = 26,
86
- /** 徒旅贵州 */
88
+ /** 徒旅贵州-首页 */
87
89
  Tulv = 27,
88
- /** 徒旅贵州-签到 */
90
+ /** 徒旅贵州-每日签到 */
89
91
  TulvCheckIn = 271,
90
92
  /** 徒旅贵州-自由行 */
91
93
  TulvFreeWalker = 272,
94
+ /** 徒旅贵州-活动列表 */
95
+ TulvIndexFilter = 273,
96
+ /** 徒旅贵州-兑换记录 */
97
+ TulvExchangeRecords = 274,
92
98
  /** 权益中心 */
93
99
  BenefitsCenter = 28,
94
100
  /** ai助手页面(问道贵州,后端无定义) */
@@ -99,6 +105,7 @@ declare enum EBusinessLine {
99
105
  */
100
106
  declare const BusinessLineDict: Readonly<{
101
107
  1: "景区";
108
+ 111: "景区/门票(商品)";
102
109
  2: "酒店";
103
110
  3: "民宿";
104
111
  "2,3": "酒店/民宿";
@@ -3,8 +3,10 @@
3
3
  * 业务线
4
4
  */
5
5
  let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
6
- /** 景区/门票 */
6
+ /** 景区/门票(景区) */
7
7
  EBusinessLine[EBusinessLine["Scenic"] = 1] = "Scenic";
8
+ /** 景区/门票(商品) */
9
+ EBusinessLine[EBusinessLine["ScenicGoods"] = 111] = "ScenicGoods";
8
10
  /** 酒店 */
9
11
  EBusinessLine[EBusinessLine["Hotel"] = 2] = "Hotel";
10
12
  /** 民宿 */
@@ -83,12 +85,16 @@ let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
83
85
  EBusinessLine[EBusinessLine["UniqueCredentialQuestion"] = 25] = "UniqueCredentialQuestion";
84
86
  /** ai客服页面 */
85
87
  EBusinessLine[EBusinessLine["AiCustomerService"] = 26] = "AiCustomerService";
86
- /** 徒旅贵州 */
88
+ /** 徒旅贵州-首页 */
87
89
  EBusinessLine[EBusinessLine["Tulv"] = 27] = "Tulv";
88
- /** 徒旅贵州-签到 */
90
+ /** 徒旅贵州-每日签到 */
89
91
  EBusinessLine[EBusinessLine["TulvCheckIn"] = 271] = "TulvCheckIn";
90
92
  /** 徒旅贵州-自由行 */
91
93
  EBusinessLine[EBusinessLine["TulvFreeWalker"] = 272] = "TulvFreeWalker";
94
+ /** 徒旅贵州-活动列表 */
95
+ EBusinessLine[EBusinessLine["TulvIndexFilter"] = 273] = "TulvIndexFilter";
96
+ /** 徒旅贵州-兑换记录 */
97
+ EBusinessLine[EBusinessLine["TulvExchangeRecords"] = 274] = "TulvExchangeRecords";
92
98
  /** 权益中心 */
93
99
  EBusinessLine[EBusinessLine["BenefitsCenter"] = 28] = "BenefitsCenter";
94
100
  /** ai助手页面(问道贵州,后端无定义) */
@@ -99,35 +105,36 @@ let EBusinessLine = /* @__PURE__ */ function(EBusinessLine) {
99
105
  * 业务线名称映射
100
106
  */
101
107
  const BusinessLineDict = Object.freeze({
102
- [EBusinessLine.Scenic]: "景区",
103
- [EBusinessLine.Hotel]: "酒店",
104
- [EBusinessLine.Homestay]: "民宿",
105
- [EBusinessLine.HotelAndHomestay]: "酒店/民宿",
106
- [EBusinessLine.Route]: "路线",
107
- [EBusinessLine.Travel]: "出行",
108
- [EBusinessLine.Foods]: "团购",
109
- [EBusinessLine.Buy]: "购物",
110
- [EBusinessLine.Entertainment]: "文娱",
111
- [EBusinessLine.Strategy]: "攻略",
112
- [EBusinessLine.Recommend]: "种草",
113
- [EBusinessLine.Activity]: "活动",
114
- [EBusinessLine.SoundGuizhou]: "声入贵州",
115
- [EBusinessLine.ExcitingVideo]: "精彩视频",
116
- [EBusinessLine.Spot]: "吐槽建议",
117
- [EBusinessLine.SameCityScenic]: "同城景区",
118
- [EBusinessLine.News]: "新闻",
119
- [EBusinessLine.ScenicDestination]: "景区目的地",
120
- [EBusinessLine.Live]: "直播",
121
- [EBusinessLine.HomeActivity]: "HomeActivity",
122
- [EBusinessLine.Convenientervice]: "按钮",
123
- [EBusinessLine.TourGuideService]: "导游服务",
124
- [EBusinessLine.SmartRoute]: "智能行程",
125
- [EBusinessLine.AiAssistant]: "AI旅游小助手",
126
- [EBusinessLine.Onebuygz]: "购物",
127
- [EBusinessLine.ConsumerCoupon]: "消费券",
128
- [EBusinessLine.Living]: "直播",
129
- [EBusinessLine.RealName]: "实名认证",
130
- [EBusinessLine.Movie]: "电影票"
108
+ [1]: "景区",
109
+ [111]: "景区/门票(商品)",
110
+ [2]: "酒店",
111
+ [3]: "民宿",
112
+ ["2,3"]: "酒店/民宿",
113
+ [4]: "路线",
114
+ [5]: "出行",
115
+ [6]: "团购",
116
+ [7]: "购物",
117
+ [8]: "文娱",
118
+ [9]: "攻略",
119
+ [10]: "种草",
120
+ [11]: "活动",
121
+ [12]: "声入贵州",
122
+ [13]: "精彩视频",
123
+ [14]: "吐槽建议",
124
+ [15]: "同城景区",
125
+ [16]: "新闻",
126
+ [17]: "景区目的地",
127
+ [18]: "直播",
128
+ [19]: "HomeActivity",
129
+ [20]: "按钮",
130
+ [21]: "导游服务",
131
+ [22]: "智能行程",
132
+ [23]: "AI旅游小助手",
133
+ [101]: "购物",
134
+ [901]: "消费券",
135
+ [907]: "直播",
136
+ [908]: "实名认证",
137
+ [81]: "电影票"
131
138
  });
132
139
  /** 子业务线 */
133
140
  let ESubBizType = /* @__PURE__ */ function(ESubBizType) {
package/es/index.d.ts CHANGED
@@ -13,9 +13,9 @@ import { ActivityCalendarDetailPageParams, getActivityCalendarDetailPage } from
13
13
  import { WebviewPageParams, getWebviewPage } from "./utils/pages/webview/index.js";
14
14
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
15
15
  import { getMoviePage } from "./utils/pages/movie/index.js";
16
- import { EMessagesType, IShareParam, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
16
+ import { EMessagesType, IShareParam, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
17
17
  import { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv } from "./utils/uni-env/index.js";
18
18
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
19
19
  import { CompressOptions, EObsSource, compressHuaweiObsImg, compressObsImg } from "./utils/obs/image.js";
20
20
  import { OneTravelSDK } from "./entry.js";
21
- export { ActivityCalendarDetailPageParams, BusinessLineDict, CompressOptions, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, IShareParam, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
21
+ export { ActivityCalendarDetailPageParams, BusinessLineDict, CompressOptions, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, IOneTravelSDKConfig, IShareParam, OneTravelSDK, WebviewPageParams, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, downLoadFile, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
package/es/index.js CHANGED
@@ -12,9 +12,9 @@ import { getActivityCalendarDetailPage } from "./utils/pages/activity-calendar/i
12
12
  import { getWebviewPage } from "./utils/pages/webview/index.js";
13
13
  import { getFoodPackagePage, getFoodStorePage } from "./utils/pages/food/index.js";
14
14
  import { getMoviePage } from "./utils/pages/movie/index.js";
15
- import { EMessagesType, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
15
+ import { EMessagesType, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay } from "./utils/web-view/index.js";
16
16
  import { isAlipayEnv, isAndroidEnv, isAppEnv, isH5Env, isHarmonyEnv, isToutiaoEnv, isWeixinEnv, isiOSEnv } from "./utils/uni-env/index.js";
17
17
  import { checkAndRequestNativeAppPermission } from "./utils/native-app/index.js";
18
18
  import { EObsSource, compressHuaweiObsImg, compressObsImg } from "./utils/obs/image.js";
19
19
  import { OneTravelSDK } from "./entry.js";
20
- export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
20
+ export { BusinessLineDict, EAppEnv, EBusinessLine, ECaller, EFoodPackageType, EFoodsModuleType, EHotelType, EMessagesType, EObsSource, ESubBizType, EUniPlatform, EVenueSimpleTypes, EVenueTypes, OneTravelSDK, app_permission, checkAndRequestNativeAppPermission, compressHuaweiObsImg, compressObsImg, downLoadFile, getActivityCalendarDetailPage, getFoodPackagePage, getFoodStorePage, getMoviePage, getQueryParameters, getWebViewEnv, getWebviewPage, isAlipay, isAlipayEnv, isAndroid, isAndroidEnv, isAppEnv, isEmpty, isH5Env, isHarmony, isHarmonyEnv, isIOSOrAndroid, isToutiaoEnv, isWeixin, isWeixinEnv, isiOS, isiOSEnv, navigateBack, navigateTo, postMessage, query2url, redirectTo, routePrefix, routes, setShareParam, toPay };
@@ -1,13 +1,13 @@
1
1
  import { routePrefix } from "../../constants/routes/index.js";
2
- import { EBusinessLine, ESubBizType } from "../../enums/business-line/index.js";
3
- import { ECaller } from "../../enums/sdk/index.js";
4
- import { EVenueSimpleTypes } from "../../enums/sub/enjoy/index.js";
5
- import { EFoodsModuleType } from "../../enums/sub/foods/index.js";
6
- import { EHotelType } from "../../enums/sub/hotel/index.js";
2
+ import "../../enums/business-line/index.js";
3
+ import "../../enums/sdk/index.js";
4
+ import "../../enums/sub/enjoy/index.js";
5
+ import "../../enums/sub/foods/index.js";
6
+ import "../../enums/sub/hotel/index.js";
7
7
  import { getWebviewPage } from "../../utils/pages/webview/index.js";
8
8
  import { getFoodPackagePage, getFoodStorePage } from "../../utils/pages/food/index.js";
9
9
  import { getMoviePage } from "../../utils/pages/movie/index.js";
10
- import { _defineProperty } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js";
10
+ import { _defineProperty } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/defineProperty.js";
11
11
  import { navigateTo } from "../../utils/web-view/index.js";
12
12
  import { getAppConfig } from "../../configs/app/index.js";
13
13
  //#region src/services/goods/service.ts
@@ -29,21 +29,24 @@ var GoodsService = class {
29
29
  const businessLine = (item === null || item === void 0 ? void 0 : item.businessLine) || (item === null || item === void 0 || (_item$common = item.common) === null || _item$common === void 0 ? void 0 : _item$common.bizType) || (item === null || item === void 0 || (_item$common2 = item.common) === null || _item$common2 === void 0 ? void 0 : _item$common2.linkBusinessLine) || (item === null || item === void 0 || (_item$common3 = item.common) === null || _item$common3 === void 0 ? void 0 : _item$common3.businessType);
30
30
  const extInfo = (item === null || item === void 0 || (_item$common4 = item.common) === null || _item$common4 === void 0 ? void 0 : _item$common4.extInfoMap) || (item === null || item === void 0 || (_item$common5 = item.common) === null || _item$common5 === void 0 ? void 0 : _item$common5.extInfo);
31
31
  switch (businessLine) {
32
- case EBusinessLine.Scenic:
32
+ /** 景区/门票 */
33
+ case 1:
33
34
  var _item$scenic, _item$common6, _item$common7, _item$scenic2, _item$common8, _item$scenic3;
34
35
  const scenicId = (item === null || item === void 0 || (_item$scenic = item.scenic) === null || _item$scenic === void 0 ? void 0 : _item$scenic.id) || (item === null || item === void 0 || (_item$common6 = item.common) === null || _item$common6 === void 0 ? void 0 : _item$common6.spuId) || (item === null || item === void 0 || (_item$common7 = item.common) === null || _item$common7 === void 0 ? void 0 : _item$common7.id) || "";
35
36
  const scenicReservationId = (item === null || item === void 0 || (_item$scenic2 = item.scenic) === null || _item$scenic2 === void 0 ? void 0 : _item$scenic2.reservationId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.reservationId) || (item === null || item === void 0 || (_item$common8 = item.common) === null || _item$common8 === void 0 ? void 0 : _item$common8.reservationId) || "";
36
37
  const scenicIsOld = (item === null || item === void 0 || (_item$scenic3 = item.scenic) === null || _item$scenic3 === void 0 ? void 0 : _item$scenic3.isOld) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.isOld);
37
38
  page = `${routePrefix.ticket}/detail/index?scenicId=${scenicId}&reservationId=${scenicReservationId}&isOld=${scenicIsOld}`;
38
39
  break;
39
- case EBusinessLine.Hotel:
40
+ /** 酒店 */
41
+ case 2:
40
42
  var _item$hotel, _item$common9;
41
43
  const hotelId = (item === null || item === void 0 || (_item$hotel = item.hotel) === null || _item$hotel === void 0 ? void 0 : _item$hotel.id) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common9 = item.common) === null || _item$common9 === void 0 ? void 0 : _item$common9.storeId) || "";
42
44
  page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
43
45
  break;
44
- case EBusinessLine.Homestay:
46
+ /** 民宿 */
47
+ case 3:
45
48
  var _item$homestay, _item$common10;
46
- if (((item === null || item === void 0 || (_item$homestay = item.homestay) === null || _item$homestay === void 0 ? void 0 : _item$homestay.type) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.type) || (item === null || item === void 0 || (_item$common10 = item.common) === null || _item$common10 === void 0 ? void 0 : _item$common10.type) || "") === EHotelType.hotel) {
49
+ if (((item === null || item === void 0 || (_item$homestay = item.homestay) === null || _item$homestay === void 0 ? void 0 : _item$homestay.type) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.type) || (item === null || item === void 0 || (_item$common10 = item.common) === null || _item$common10 === void 0 ? void 0 : _item$common10.type) || "") === "hotel") {
47
50
  var _item$homestay2, _item$common11;
48
51
  /** 酒店 (天下房仓酒店详情页) */
49
52
  const id = (item === null || item === void 0 || (_item$homestay2 = item.homestay) === null || _item$homestay2 === void 0 ? void 0 : _item$homestay2.id) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common11 = item.common) === null || _item$common11 === void 0 ? void 0 : _item$common11.storeId) || "";
@@ -53,56 +56,63 @@ var GoodsService = class {
53
56
  const subBizType = (item === null || item === void 0 || (_item$homestay3 = item.homestay) === null || _item$homestay3 === void 0 ? void 0 : _item$homestay3.subBizType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.subBizType);
54
57
  const id = (item === null || item === void 0 || (_item$homestay4 = item.homestay) === null || _item$homestay4 === void 0 ? void 0 : _item$homestay4.id) || (item === null || item === void 0 || (_item$common12 = item.common) === null || _item$common12 === void 0 ? void 0 : _item$common12.spuId) || (item === null || item === void 0 || (_item$common13 = item.common) === null || _item$common13 === void 0 ? void 0 : _item$common13.id) || "";
55
58
  /** 民宿 */
56
- if (`${subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
57
- else if (`${subBizType}` === `${ESubBizType.HomestayHot}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
59
+ if (`${subBizType}` === `32`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
60
+ else if (`${subBizType}` === `31`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
58
61
  else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
59
62
  }
60
63
  break;
61
- case EBusinessLine.Route:
64
+ /** 路线/定制 */
65
+ case 4:
62
66
  var _item$route, _item$common14, _item$common15;
63
67
  const routeId = (item === null || item === void 0 || (_item$route = item.route) === null || _item$route === void 0 ? void 0 : _item$route.id) || (item === null || item === void 0 || (_item$common14 = item.common) === null || _item$common14 === void 0 ? void 0 : _item$common14.spuId) || (item === null || item === void 0 || (_item$common15 = item.common) === null || _item$common15 === void 0 ? void 0 : _item$common15.id);
64
68
  page = `${routePrefix.road}/product-detail/index?id=${routeId}`;
65
69
  break;
66
- case EBusinessLine.Travel:
70
+ /** 出行 TODO 不知道数据怎么取 */
71
+ case 5:
67
72
  var _item$travel, _item$common16, _item$common17;
68
73
  const travelId = (item === null || item === void 0 || (_item$travel = item.travel) === null || _item$travel === void 0 ? void 0 : _item$travel.id) || (item === null || item === void 0 || (_item$common16 = item.common) === null || _item$common16 === void 0 ? void 0 : _item$common16.spuId) || (item === null || item === void 0 || (_item$common17 = item.common) === null || _item$common17 === void 0 ? void 0 : _item$common17.id);
69
74
  page = `${routePrefix.travel}/charter/detail?routeId=${travelId}`;
70
75
  break;
71
- case EBusinessLine.Buy:
76
+ /** 购物 */
77
+ case 7:
72
78
  var _item$buy, _item$common18, _item$common19;
73
79
  const buySpuId = (item === null || item === void 0 || (_item$buy = item.buy) === null || _item$buy === void 0 ? void 0 : _item$buy.spuId) || (item === null || item === void 0 || (_item$common18 = item.common) === null || _item$common18 === void 0 ? void 0 : _item$common18.spuId) || (item === null || item === void 0 || (_item$common19 = item.common) === null || _item$common19 === void 0 ? void 0 : _item$common19.id);
74
80
  page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${buySpuId}` });
75
81
  break;
76
- case EBusinessLine.Onebuygz:
82
+ /** 新购物 */
83
+ case 101:
77
84
  var _item$onebuygz, _item$common20, _item$common21, _item$onebuygz2, _item$common22;
78
85
  const onebuySpuId = (item === null || item === void 0 || (_item$onebuygz = item.onebuygz) === null || _item$onebuygz === void 0 ? void 0 : _item$onebuygz.spuId) || (item === null || item === void 0 || (_item$common20 = item.common) === null || _item$common20 === void 0 ? void 0 : _item$common20.spuId) || (item === null || item === void 0 || (_item$common21 = item.common) === null || _item$common21 === void 0 ? void 0 : _item$common21.id);
79
86
  const onebuySkuId = (item === null || item === void 0 || (_item$onebuygz2 = item.onebuygz) === null || _item$onebuygz2 === void 0 ? void 0 : _item$onebuygz2.skuId) || (item === null || item === void 0 || (_item$common22 = item.common) === null || _item$common22 === void 0 ? void 0 : _item$common22.skuId);
80
87
  page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${onebuySpuId}&skuId=${onebuySkuId}` });
81
88
  break;
82
- case EBusinessLine.Foods:
89
+ /** 美食 */
90
+ case 6:
83
91
  var _item$food, _item$food2, _item$common23, _item$food3, _item$common24, _item$common25, _item$food4;
84
92
  const moduleType = (item === null || item === void 0 || (_item$food = item.food) === null || _item$food === void 0 ? void 0 : _item$food.moduleType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.moduleType);
85
93
  const storeId = (item === null || item === void 0 || (_item$food2 = item.food) === null || _item$food2 === void 0 ? void 0 : _item$food2.storeId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common23 = item.common) === null || _item$common23 === void 0 ? void 0 : _item$common23.storeId) || "";
86
94
  const spuId = (item === null || item === void 0 || (_item$food3 = item.food) === null || _item$food3 === void 0 ? void 0 : _item$food3.spuId) || (item === null || item === void 0 || (_item$common24 = item.common) === null || _item$common24 === void 0 ? void 0 : _item$common24.spuId) || (item === null || item === void 0 || (_item$common25 = item.common) === null || _item$common25 === void 0 ? void 0 : _item$common25.id) || "";
87
95
  const storePrecedentType = (item === null || item === void 0 || (_item$food4 = item.food) === null || _item$food4 === void 0 ? void 0 : _item$food4.storePrecedentType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storePrecedentType) || void 0;
88
- if (moduleType === EFoodsModuleType.store)
96
+ if (moduleType === "store")
89
97
  /** 收藏跳店铺 */
90
98
  page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, storeId) });
91
99
  else
92
100
  /** 跳转套餐 */
93
101
  page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, storeId, spuId, storePrecedentType) });
94
102
  break;
95
- case EBusinessLine.Entertainment:
103
+ /** 文娱 */
104
+ case 8:
96
105
  var _item$entertainment, _item$common26, _item$common27, _item$entertainment2, _item$common28, _item$entertainment3, _item$entertainment4, _item$common29, _item$entertainment5, _item$common30;
97
106
  const entertainmentId = (item === null || item === void 0 || (_item$entertainment = item.entertainment) === null || _item$entertainment === void 0 ? void 0 : _item$entertainment.id) || (item === null || item === void 0 || (_item$common26 = item.common) === null || _item$common26 === void 0 ? void 0 : _item$common26.spuId) || (item === null || item === void 0 || (_item$common27 = item.common) === null || _item$common27 === void 0 ? void 0 : _item$common27.id);
98
107
  const entertainmentStoreId = (item === null || item === void 0 || (_item$entertainment2 = item.entertainment) === null || _item$entertainment2 === void 0 ? void 0 : _item$entertainment2.storeId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.storeId) || (item === null || item === void 0 || (_item$common28 = item.common) === null || _item$common28 === void 0 ? void 0 : _item$common28.storeId) || "";
99
108
  const entertainmentSubBizType = (item === null || item === void 0 || (_item$entertainment3 = item.entertainment) === null || _item$entertainment3 === void 0 ? void 0 : _item$entertainment3.subBizType) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.subBizType);
100
109
  const entertainmentType = (item === null || item === void 0 || (_item$entertainment4 = item.entertainment) === null || _item$entertainment4 === void 0 ? void 0 : _item$entertainment4.type) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.type) || (item === null || item === void 0 || (_item$common29 = item.common) === null || _item$common29 === void 0 ? void 0 : _item$common29.type);
101
110
  const entertainmentReservationId = (item === null || item === void 0 || (_item$entertainment5 = item.entertainment) === null || _item$entertainment5 === void 0 ? void 0 : _item$entertainment5.reservationId) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.reservationId) || (item === null || item === void 0 || (_item$common30 = item.common) === null || _item$common30 === void 0 ? void 0 : _item$common30.reservationId);
102
- if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
111
+ if (`${entertainmentType}` === "3" || `${entertainmentSubBizType}` === `81`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
103
112
  else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
104
113
  break;
105
- case EBusinessLine.Movie:
114
+ /** 电影 */
115
+ case 81:
106
116
  var _item$movie;
107
117
  let movieId = (item === null || item === void 0 || (_item$movie = item.movie) === null || _item$movie === void 0 ? void 0 : _item$movie.id) || "";
108
118
  try {
@@ -111,18 +121,22 @@ var GoodsService = class {
111
121
  } catch (_unused) {}
112
122
  page = getMoviePage(appConfig.domain.movie, movieId);
113
123
  break;
114
- case EBusinessLine.Strategy:
124
+ /** 攻略 */
125
+ case 9:
115
126
  var _item$strategy, _item$common31, _item$common32;
116
127
  const strategyId = (item === null || item === void 0 || (_item$strategy = item.strategy) === null || _item$strategy === void 0 ? void 0 : _item$strategy.id) || (item === null || item === void 0 || (_item$common31 = item.common) === null || _item$common31 === void 0 ? void 0 : _item$common31.spuId) || (item === null || item === void 0 || (_item$common32 = item.common) === null || _item$common32 === void 0 ? void 0 : _item$common32.id);
117
128
  page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
118
129
  break;
119
- case EBusinessLine.Recommend:
130
+ /** 种草 */
131
+ case 10:
120
132
  var _item$recommend, _item$common33, _item$common34, _item$recommend2;
121
133
  const recommendId = (item === null || item === void 0 || (_item$recommend = item.recommend) === null || _item$recommend === void 0 ? void 0 : _item$recommend.id) || (item === null || item === void 0 || (_item$common33 = item.common) === null || _item$common33 === void 0 ? void 0 : _item$common33.spuId) || (item === null || item === void 0 || (_item$common34 = item.common) === null || _item$common34 === void 0 ? void 0 : _item$common34.id);
122
134
  const recommendMoreParameter = (item === null || item === void 0 || (_item$recommend2 = item.recommend) === null || _item$recommend2 === void 0 ? void 0 : _item$recommend2.moreParameter) || (extInfo === null || extInfo === void 0 ? void 0 : extInfo.moreParameter) || "";
123
135
  page = `${routePrefix.show}/details/index?id=${recommendId}${recommendMoreParameter}`;
124
136
  break;
125
- case EBusinessLine.ExcitingVideo:
137
+ /** 活动 */
138
+ /** 精彩视频 */
139
+ case 13:
126
140
  var _item$excitingVideo, _item$common35, _item$common36;
127
141
  const excitingVideoId = (item === null || item === void 0 || (_item$excitingVideo = item.excitingVideo) === null || _item$excitingVideo === void 0 ? void 0 : _item$excitingVideo.id) || (item === null || item === void 0 || (_item$common35 = item.common) === null || _item$common35 === void 0 ? void 0 : _item$common35.spuId) || (item === null || item === void 0 || (_item$common36 = item.common) === null || _item$common36 === void 0 ? void 0 : _item$common36.id);
128
142
  page = `${routePrefix.living}/wonderful-video/index?vid=${excitingVideoId}`;
@@ -130,8 +144,8 @@ var GoodsService = class {
130
144
  default: break;
131
145
  }
132
146
  if (!page) return;
133
- if (configOptions.caller === ECaller.web) navigateTo({ src: page });
134
- else if (configOptions.caller === ECaller.host) uni.navigateTo({ url: page });
147
+ if (configOptions.caller === "web") navigateTo({ src: page });
148
+ else if (configOptions.caller === "host") uni.navigateTo({ url: page });
135
149
  }
136
150
  );
137
151
  this.goodsServiceConfig = config;
@@ -5,7 +5,7 @@ declare enum EObsSource {
5
5
  /** 腾讯 */
6
6
  Tencent = 2,
7
7
  /** 阿里 */
8
- Ali = 2,
8
+ Ali = 3,
9
9
  }
10
10
  /**
11
11
  * 参考 https://support.huaweicloud.com/intl/zh-cn/fg-obs/obs_01_0430.html
@@ -1,4 +1,4 @@
1
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
1
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
2
2
  //#region src/utils/obs/image.ts
3
3
  let EObsSource = /* @__PURE__ */ function(EObsSource) {
4
4
  /** 华为 */
@@ -6,7 +6,7 @@ let EObsSource = /* @__PURE__ */ function(EObsSource) {
6
6
  /** 腾讯 */
7
7
  EObsSource[EObsSource["Tencent"] = 2] = "Tencent";
8
8
  /** 阿里 */
9
- EObsSource[EObsSource["Ali"] = 2] = "Ali";
9
+ EObsSource[EObsSource["Ali"] = 3] = "Ali";
10
10
  return EObsSource;
11
11
  }({});
12
12
  function filterEmptyValue(obj) {
@@ -100,8 +100,8 @@ function compressTencentObsImg(url, opts) {
100
100
  }
101
101
  function compressObsImg(url, opts) {
102
102
  switch (opts.source) {
103
- case EObsSource.Huawei: return compressHuaweiObsImg(url, opts);
104
- case EObsSource.Ali: return compressHuaweiObsImg(url, opts);
103
+ case 1: return compressHuaweiObsImg(url, opts);
104
+ case 3: return compressHuaweiObsImg(url, opts);
105
105
  default: return compressTencentObsImg(url, opts);
106
106
  }
107
107
  }
@@ -1,6 +1,7 @@
1
1
  import { EBusinessLine } from "../../enums/business-line/index.js";
2
2
 
3
3
  //#region src/utils/web-view/index.d.ts
4
+ sideEffect();
4
5
  /** 判断是否是iOS还是安卓 */
5
6
  declare const isIOSOrAndroid: boolean;
6
7
  /** 判断是否支付宝小程序 */
@@ -13,6 +14,8 @@ declare const isHarmony: boolean;
13
14
  declare const isAndroid: boolean;
14
15
  /** 判断是否苹果APP */
15
16
  declare const isiOS: boolean;
17
+ /** 当前 web-view 环境 */
18
+ declare const getWebViewEnv: () => Record<string, unknown>;
16
19
  declare enum EMessagesType {
17
20
  /** app直接调用分享 */
18
21
  share = "share",
@@ -77,5 +80,10 @@ declare const toPay: (data: {
77
80
  cashStageUrl: string;
78
81
  orderNo: string;
79
82
  }) => void;
83
+ /**
84
+ * 下载文件
85
+ * @param url
86
+ */
87
+ declare const downLoadFile: (url: string) => void;
80
88
  //#endregion
81
- export { EMessagesType, IShareParam, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
89
+ export { EMessagesType, IShareParam, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
@@ -1,6 +1,6 @@
1
- import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
3
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
1
+ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/asyncToGenerator.js";
2
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectWithoutProperties.js";
3
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.135.0/helpers/esm/objectSpread2.js";
4
4
  import wx from "weixin-js-sdk";
5
5
  //#region src/utils/web-view/index.ts
6
6
  const _excluded = ["shareUrl"];
@@ -17,14 +17,18 @@ const isHarmony = !userAgent.includes("miniprogram") && !userAgent.includes("and
17
17
  const isAndroid = !userAgent.includes("miniprogram") && userAgent.includes("android");
18
18
  /** 判断是否苹果APP */
19
19
  const isiOS = !userAgent.includes("miniprogram") && (userAgent.includes("iphone") || userAgent.includes("ipad"));
20
- let uni = {};
21
20
  function loadWebview() {
22
21
  return _loadWebview.apply(this, arguments);
23
22
  }
24
23
  function _loadWebview() {
25
24
  _loadWebview = _asyncToGenerator(function* () {
26
- if (isIOSOrAndroid) uni = (yield import("../../assets/js/webview/uni.webview.1.5.6.js")).default;
27
- else uni = (yield import("../../assets/js/webview/uni.webview.1.5.5.js")).default;
25
+ if (isIOSOrAndroid) {
26
+ const res = yield import("../../assets/js/webview/uni.webview.1.5.6.js");
27
+ if (res === null || res === void 0 ? void 0 : res.default) window.uni = res.default;
28
+ } else {
29
+ const res = yield import("../../assets/js/webview/uni.webview.1.5.5.js");
30
+ if (res === null || res === void 0 ? void 0 : res.default) window.uni = res === null || res === void 0 ? void 0 : res.default;
31
+ }
28
32
  if (isAlipay) {
29
33
  const scriptTag = document.createElement("script");
30
34
  scriptTag.src = "https://appx/web-view.min.js";
@@ -34,9 +38,14 @@ function _loadWebview() {
34
38
  return _loadWebview.apply(this, arguments);
35
39
  }
36
40
  loadWebview();
41
+ let env = {};
37
42
  document.addEventListener("UniAppJSBridgeReady", function() {
38
- uni.webView.getEnv(function(_) {});
43
+ uni.webView.getEnv(function(res) {
44
+ env = res;
45
+ });
39
46
  });
47
+ /** 当前 web-view 环境 */
48
+ const getWebViewEnv = () => env;
40
49
  let EMessagesType = /* @__PURE__ */ function(EMessagesType) {
41
50
  /** app直接调用分享 */
42
51
  EMessagesType["share"] = "share";
@@ -54,11 +63,11 @@ const navigateTo = (parameters) => {
54
63
  const { src, params } = parameters;
55
64
  const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
56
65
  try {
57
- var _uni$webView, _uni$webView$navigate, _my;
58
- uni === null || uni === void 0 || (_uni$webView = uni.webView) === null || _uni$webView === void 0 || (_uni$webView$navigate = _uni$webView.navigateTo) === null || _uni$webView$navigate === void 0 || _uni$webView$navigate.call(_uni$webView, { url });
66
+ var _uni, _uni$navigateTo, _my;
67
+ (_uni = uni) === null || _uni === void 0 || (_uni = _uni.webView) === null || _uni === void 0 || (_uni$navigateTo = _uni.navigateTo) === null || _uni$navigateTo === void 0 || _uni$navigateTo.call(_uni, { url });
59
68
  /** 不兼容上面的方法会自动往下执行 */
60
69
  wx === null || wx === void 0 || wx.miniProgram.navigateTo({ url });
61
- (_my = my) === null || _my === void 0 || _my.navigateTo({ url });
70
+ if (typeof my !== "undefined") (_my = my) === null || _my === void 0 || _my.navigateTo({ url });
62
71
  } catch (error) {
63
72
  console.error(error);
64
73
  }
@@ -71,11 +80,11 @@ const redirectTo = (parameters) => {
71
80
  const { src, params } = parameters;
72
81
  const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
73
82
  try {
74
- var _uni$webView2, _uni$webView2$redirec, _my2;
75
- uni === null || uni === void 0 || (_uni$webView2 = uni.webView) === null || _uni$webView2 === void 0 || (_uni$webView2$redirec = _uni$webView2.redirectTo) === null || _uni$webView2$redirec === void 0 || _uni$webView2$redirec.call(_uni$webView2, { url });
83
+ var _uni2, _uni2$redirectTo, _my2;
84
+ (_uni2 = uni) === null || _uni2 === void 0 || (_uni2 = _uni2.webView) === null || _uni2 === void 0 || (_uni2$redirectTo = _uni2.redirectTo) === null || _uni2$redirectTo === void 0 || _uni2$redirectTo.call(_uni2, { url });
76
85
  /** 不兼容上面的方法会自动往下执行 */
77
86
  wx === null || wx === void 0 || wx.miniProgram.redirectTo({ url });
78
- (_my2 = my) === null || _my2 === void 0 || _my2.redirectTo({ url });
87
+ if (typeof my !== "undefined") (_my2 = my) === null || _my2 === void 0 || _my2.redirectTo({ url });
79
88
  } catch (error) {
80
89
  console.error(error);
81
90
  }
@@ -86,11 +95,11 @@ const redirectTo = (parameters) => {
86
95
  */
87
96
  const navigateBack = (parameters) => {
88
97
  try {
89
- var _uni$webView3, _uni$webView3$navigat, _my3;
90
- uni === null || uni === void 0 || (_uni$webView3 = uni.webView) === null || _uni$webView3 === void 0 || (_uni$webView3$navigat = _uni$webView3.navigateBack) === null || _uni$webView3$navigat === void 0 || _uni$webView3$navigat.call(_uni$webView3, parameters);
98
+ var _uni3, _uni3$navigateBack, _my3;
99
+ (_uni3 = uni) === null || _uni3 === void 0 || (_uni3 = _uni3.webView) === null || _uni3 === void 0 || (_uni3$navigateBack = _uni3.navigateBack) === null || _uni3$navigateBack === void 0 || _uni3$navigateBack.call(_uni3, parameters);
91
100
  /** 不兼容上面的方法会自动往下执行 */
92
101
  wx === null || wx === void 0 || wx.miniProgram.navigateBack(parameters);
93
- (_my3 = my) === null || _my3 === void 0 || _my3.navigateBack(parameters);
102
+ if (typeof my !== "undefined") (_my3 = my) === null || _my3 === void 0 || _my3.navigateBack(parameters);
94
103
  } catch (error) {
95
104
  console.error(error);
96
105
  }
@@ -100,7 +109,7 @@ const navigateBack = (parameters) => {
100
109
  * @param data
101
110
  */
102
111
  const postMessage = (data) => {
103
- if (data.type === EMessagesType.pay) {
112
+ if (data.type === "pay") {
104
113
  if (isWeixin || isAlipay) {
105
114
  redirectTo({
106
115
  src: "/pages/web-view/index",
@@ -110,10 +119,10 @@ const postMessage = (data) => {
110
119
  }
111
120
  }
112
121
  try {
113
- var _uni$webView4, _my4;
114
- uni === null || uni === void 0 || (_uni$webView4 = uni.webView) === null || _uni$webView4 === void 0 || _uni$webView4.postMessage({ data });
122
+ var _uni4, _my4;
123
+ (_uni4 = uni) === null || _uni4 === void 0 || (_uni4 = _uni4.webView) === null || _uni4 === void 0 || _uni4.postMessage({ data });
115
124
  wx === null || wx === void 0 || wx.miniProgram.postMessage({ data });
116
- (_my4 = my) === null || _my4 === void 0 || _my4.postMessage({ data });
125
+ if (typeof my !== "undefined") (_my4 = my) === null || _my4 === void 0 || _my4.postMessage({ data });
117
126
  } catch (error) {
118
127
  var _message;
119
128
  if (error === null || error === void 0 || (_message = error.message) === null || _message === void 0 ? void 0 : _message.includes("my is not defined")) return;
@@ -126,13 +135,12 @@ const postMessage = (data) => {
126
135
  */
127
136
  const setShareParam = (data, businessType) => {
128
137
  const { shareUrl } = data;
129
- const params = { data: _objectSpread2(_objectSpread2({}, _objectWithoutProperties(data, _excluded)), {}, {
130
- businessType,
131
- shareUrl: encodeURIComponent(shareUrl || "")
132
- }) };
133
138
  postMessage({
134
- type: EMessagesType.shareParam,
135
- params
139
+ type: "shareParam",
140
+ params: { data: _objectSpread2(_objectSpread2({}, _objectWithoutProperties(data, _excluded)), {}, {
141
+ businessType,
142
+ shareUrl: encodeURIComponent(shareUrl || "")
143
+ }) }
136
144
  });
137
145
  };
138
146
  /**
@@ -141,13 +149,41 @@ const setShareParam = (data, businessType) => {
141
149
  */
142
150
  const toPay = (data) => {
143
151
  postMessage({
144
- type: EMessagesType.pay,
152
+ type: "pay",
145
153
  params: {
146
154
  url: encodeURIComponent(data.cashStageUrl),
147
155
  orderId: data.orderNo
148
156
  }
149
157
  });
150
158
  };
159
+ /**
160
+ * 下载文件
161
+ * @param url
162
+ */
163
+ const downLoadFile = (url) => {
164
+ if (isWeixin || isAlipay) navigateTo({
165
+ src: "/pages/web-view/download-file/index",
166
+ params: { url }
167
+ });
168
+ else {
169
+ const fileName = url.split("/").pop() || "download";
170
+ if (isiOS) {
171
+ var _appBridge;
172
+ if ((_appBridge = window.appBridge) === null || _appBridge === void 0 ? void 0 : _appBridge.downloadFile) window.appBridge.downloadFile({
173
+ url,
174
+ fileName
175
+ });
176
+ else window.open(url, "_blank");
177
+ } else {
178
+ const link = document.createElement("a");
179
+ link.href = url;
180
+ link.download = fileName;
181
+ document.body.appendChild(link);
182
+ link.click();
183
+ document.body.removeChild(link);
184
+ }
185
+ }
186
+ };
151
187
  function objectToQueryString(obj) {
152
188
  return Object.entries(obj).map(([key, value]) => {
153
189
  if (Array.isArray(value)) return value.map((val) => `${encodeURI(key)}[]=${encodeURI(val)}`).join("&");
@@ -155,4 +191,4 @@ function objectToQueryString(obj) {
155
191
  }).join("&");
156
192
  }
157
193
  //#endregion
158
- export { EMessagesType, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
194
+ export { EMessagesType, downLoadFile, getWebViewEnv, isAlipay, isAndroid, isHarmony, isIOSOrAndroid, isWeixin, isiOS, navigateBack, navigateTo, postMessage, redirectTo, setShareParam, toPay };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@foundbyte/uni-libs",
3
3
  "description": "FoundByte Uni Libs",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.1.0",
5
+ "version": "1.1.2",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",