@foundbyte/uni-libs 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ //#region \0@oxc-project+runtime@0.103.0/helpers/asyncToGenerator.js
2
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
3
+ try {
4
+ var i = n[a](c), u = i.value;
5
+ } catch (n$1) {
6
+ e(n$1);
7
+ return;
8
+ }
9
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
10
+ }
11
+ function _asyncToGenerator(n) {
12
+ return function() {
13
+ var t = this, e = arguments;
14
+ return new Promise(function(r, o) {
15
+ var a = n.apply(t, e);
16
+ function _next(n$1) {
17
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n$1);
18
+ }
19
+ function _throw(n$1) {
20
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n$1);
21
+ }
22
+ _next(void 0);
23
+ });
24
+ };
25
+ }
26
+
27
+ //#endregion
28
+ export { _asyncToGenerator };
@@ -0,0 +1,14 @@
1
+ import { toPropertyKey } from "./toPropertyKey.js";
2
+
3
+ //#region \0@oxc-project+runtime@0.103.0/helpers/defineProperty.js
4
+ function _defineProperty(e, r, t) {
5
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
6
+ value: t,
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0
10
+ }) : e[r] = t, e;
11
+ }
12
+
13
+ //#endregion
14
+ export { _defineProperty };
@@ -0,0 +1,27 @@
1
+ import { _defineProperty } from "./defineProperty.js";
2
+
3
+ //#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
4
+ function ownKeys(e, r) {
5
+ var t = Object.keys(e);
6
+ if (Object.getOwnPropertySymbols) {
7
+ var o = Object.getOwnPropertySymbols(e);
8
+ r && (o = o.filter(function(r$1) {
9
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
10
+ })), t.push.apply(t, o);
11
+ }
12
+ return t;
13
+ }
14
+ function _objectSpread2(e) {
15
+ for (var r = 1; r < arguments.length; r++) {
16
+ var t = null != arguments[r] ? arguments[r] : {};
17
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
18
+ _defineProperty(e, r$1, t[r$1]);
19
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
20
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
21
+ });
22
+ }
23
+ return e;
24
+ }
25
+
26
+ //#endregion
27
+ export { _objectSpread2 };
@@ -0,0 +1,15 @@
1
+ import { _objectWithoutPropertiesLoose } from "./objectWithoutPropertiesLoose.js";
2
+
3
+ //#region \0@oxc-project+runtime@0.103.0/helpers/objectWithoutProperties.js
4
+ function _objectWithoutProperties(e, t) {
5
+ if (null == e) return {};
6
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
7
+ if (Object.getOwnPropertySymbols) {
8
+ var s = Object.getOwnPropertySymbols(e);
9
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
10
+ }
11
+ return i;
12
+ }
13
+
14
+ //#endregion
15
+ export { _objectWithoutProperties };
@@ -0,0 +1,13 @@
1
+ //#region \0@oxc-project+runtime@0.103.0/helpers/objectWithoutPropertiesLoose.js
2
+ function _objectWithoutPropertiesLoose(r, e) {
3
+ if (null == r) return {};
4
+ var t = {};
5
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
6
+ if (e.includes(n)) continue;
7
+ t[n] = r[n];
8
+ }
9
+ return t;
10
+ }
11
+
12
+ //#endregion
13
+ export { _objectWithoutPropertiesLoose };
@@ -0,0 +1,16 @@
1
+ import { _typeof } from "./typeof.js";
2
+
3
+ //#region \0@oxc-project+runtime@0.103.0/helpers/toPrimitive.js
4
+ function toPrimitive(t, r) {
5
+ if ("object" != _typeof(t) || !t) return t;
6
+ var e = t[Symbol.toPrimitive];
7
+ if (void 0 !== e) {
8
+ var i = e.call(t, r || "default");
9
+ if ("object" != _typeof(i)) return i;
10
+ throw new TypeError("@@toPrimitive must return a primitive value.");
11
+ }
12
+ return ("string" === r ? String : Number)(t);
13
+ }
14
+
15
+ //#endregion
16
+ export { toPrimitive };
@@ -0,0 +1,11 @@
1
+ import { _typeof } from "./typeof.js";
2
+ import { toPrimitive } from "./toPrimitive.js";
3
+
4
+ //#region \0@oxc-project+runtime@0.103.0/helpers/toPropertyKey.js
5
+ function toPropertyKey(t) {
6
+ var i = toPrimitive(t, "string");
7
+ return "symbol" == _typeof(i) ? i : i + "";
8
+ }
9
+
10
+ //#endregion
11
+ export { toPropertyKey };
@@ -0,0 +1,12 @@
1
+ //#region \0@oxc-project+runtime@0.103.0/helpers/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
5
+ return typeof o$1;
6
+ } : function(o$1) {
7
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
8
+ }, _typeof(o);
9
+ }
10
+
11
+ //#endregion
12
+ export { _typeof };
@@ -2,7 +2,7 @@
2
2
  const config = { domain: {
3
3
  shopping: "https://shopping-h5.onetravelgz.cn/#/",
4
4
  food: "https://food-h5.onetravelgz.cn/#/",
5
- onebuygz: "https://testb2ch5-travel.gcongo.com.cn/#/",
5
+ onebuygz: "https://testb2ch5-travel.gcongo.cn/#/",
6
6
  movie: "https://147gn9gm.life.mczjk.cn/#/"
7
7
  } };
8
8
  var app_hwtest_default = config;
@@ -1,4 +1,5 @@
1
1
  import { EAppEnv } from "../../enums/environment/index.js";
2
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
2
3
  import app_hwtest_default from "./app.hwtest.js";
3
4
  import app_prod_default from "./app.prod.js";
4
5
 
@@ -17,15 +18,12 @@ function getAppConfig(appEnv) {
17
18
  config = app_prod_default;
18
19
  break;
19
20
  }
20
- return {
21
- domain: {
22
- shopping: "",
23
- food: "",
24
- onebuygz: "",
25
- movie: ""
26
- },
27
- ...config
28
- };
21
+ return _objectSpread2({ domain: {
22
+ shopping: "",
23
+ food: "",
24
+ onebuygz: "",
25
+ movie: ""
26
+ } }, config);
29
27
  }
30
28
 
31
29
  //#endregion
package/es/entry.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { EAppEnv } from "./enums/environment/index.js";
2
2
  import { ECaller } from "./enums/sdk/index.js";
3
+ import { _defineProperty } from "./_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.js";
4
+ import { _objectSpread2 } from "./_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
3
5
  import { getAppConfig } from "./configs/app/index.js";
4
6
  import { GoodsService } from "./services/goods/service.js";
5
7
 
@@ -8,14 +10,13 @@ import { GoodsService } from "./services/goods/service.js";
8
10
  * 一码游SDK
9
11
  */
10
12
  var OneTravelSDK = class {
11
- sdkConfig;
12
- goodsService;
13
13
  constructor(config) {
14
- const value = {
14
+ _defineProperty(this, "sdkConfig", void 0);
15
+ _defineProperty(this, "goodsService", void 0);
16
+ const value = _objectSpread2(_objectSpread2({}, {
15
17
  appEnv: EAppEnv.prod,
16
- caller: ECaller.web,
17
- ...config || {}
18
- };
18
+ caller: ECaller.web
19
+ }), config || {});
19
20
  this.sdkConfig = value;
20
21
  this.goodsService = new GoodsService({ sdkConfig: value });
21
22
  }
@@ -7,118 +7,141 @@ import { EHotelType } from "../../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.103.0/helpers/defineProperty.js";
10
11
  import { navigateTo } from "../../utils/web-view/index.js";
11
12
  import { getAppConfig } from "../../configs/app/index.js";
12
13
 
13
14
  //#region src/services/goods/service.ts
14
15
  var GoodsService = class {
15
- goodsServiceConfig;
16
16
  constructor(config) {
17
- this.goodsServiceConfig = config;
18
- }
19
- /**
20
- * 跳转商品详情页面
21
- * @param item 商品数据
22
- */
23
- jumpToProductDetailPage = (item) => {
24
- const configOptions = this.goodsServiceConfig.sdkConfig;
25
- const appConfig = getAppConfig(configOptions.appEnv);
26
- let page = "";
27
- const businessLine = item?.businessLine || item?.common?.bizType || item?.common?.linkBusinessLine || item?.common?.businessType;
28
- const extInfo = item?.common?.extInfoMap || item?.common?.extInfo;
29
- switch (businessLine) {
30
- case EBusinessLine.Scenic:
31
- const scenicId = item?.scenic?.id || item?.common?.spuId || item?.common?.id || "";
32
- const scenicReservationId = item?.scenic?.reservationId || extInfo?.reservationId || item?.common?.reservationId || "";
33
- const scenicIsOld = item?.scenic?.isOld || extInfo?.isOld;
34
- page = `${routePrefix.ticket}/detail/index?scenicId=${scenicId}&reservationId=${scenicReservationId}&isOld=${scenicIsOld}`;
35
- break;
36
- case EBusinessLine.Hotel:
37
- const hotelId = item?.hotel?.id || extInfo?.storeId || item?.common?.storeId || "";
38
- page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
39
- break;
40
- case EBusinessLine.Homestay:
41
- if ((item?.homestay?.type || extInfo?.type || item?.common?.type || "") === EHotelType.hotel) {
42
- /** 酒店 (天下房仓酒店详情页) */
43
- const id = item?.homestay?.id || extInfo?.storeId || item?.common?.storeId || "";
44
- page = `${routePrefix.hotel}/home/details/index?id=${id}`;
45
- } else {
46
- const subBizType = item?.homestay?.subBizType || extInfo?.subBizType;
47
- const id = item?.homestay?.id || item?.common?.spuId || item?.common?.id || "";
48
- /** 民宿 */
49
- if (`${subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
50
- else if (`${subBizType}` === `${ESubBizType.HomestayHot}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
51
- else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
52
- }
53
- break;
54
- case EBusinessLine.Route:
55
- const routeId = item?.route?.id || item?.common?.spuId || item?.common?.id;
56
- page = `${routePrefix.road}/product-detail/index?id=${routeId}`;
57
- break;
58
- case EBusinessLine.Travel:
59
- const travelId = item?.travel?.id || item?.common?.spuId || item?.common?.id;
60
- page = `${routePrefix.travel}/charter/detail?routeId=${travelId}`;
61
- break;
62
- case EBusinessLine.Buy:
63
- const buySpuId = item?.buy?.spuId || item?.common?.spuId || item?.common?.id;
64
- page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${buySpuId}` });
65
- break;
66
- case EBusinessLine.Onebuygz:
67
- const onebuySpuId = item?.onebuygz?.spuId || item?.common?.spuId || item?.common?.id;
68
- const onebuySkuId = item?.onebuygz?.skuId || item?.common?.skuId;
69
- page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${onebuySpuId}&skuId=${onebuySkuId}` });
70
- break;
71
- case EBusinessLine.Foods:
72
- const moduleType = item?.food?.moduleType || extInfo?.moduleType;
73
- const storeId = item?.food?.storeId || extInfo?.storeId || item?.common?.storeId || "";
74
- const spuId = item?.food?.spuId || item?.common?.spuId || item?.common?.id || "";
75
- const storePrecedentType = item?.food?.storePrecedentType || extInfo?.storePrecedentType || void 0;
76
- if (moduleType === EFoodsModuleType.store)
17
+ _defineProperty(this, "goodsServiceConfig", void 0);
18
+ _defineProperty(
19
+ this,
20
+ /**
21
+ * 跳转商品详情页面
22
+ * @param item 商品数据
23
+ */
24
+ "jumpToProductDetailPage",
25
+ (item) => {
26
+ var _item$common, _item$common2, _item$common3, _item$common4, _item$common5;
27
+ const configOptions = this.goodsServiceConfig.sdkConfig;
28
+ const appConfig = getAppConfig(configOptions.appEnv);
29
+ let page = "";
30
+ 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);
31
+ 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);
32
+ switch (businessLine) {
33
+ case EBusinessLine.Scenic:
34
+ var _item$scenic, _item$common6, _item$common7, _item$scenic2, _item$common8, _item$scenic3;
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) || "";
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) || "";
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);
38
+ page = `${routePrefix.ticket}/detail/index?scenicId=${scenicId}&reservationId=${scenicReservationId}&isOld=${scenicIsOld}`;
39
+ break;
40
+ case EBusinessLine.Hotel:
41
+ var _item$hotel, _item$common9;
42
+ 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) || "";
43
+ page = `${routePrefix.hotel}/home/details/index?id=${hotelId}`;
44
+ break;
45
+ case EBusinessLine.Homestay:
46
+ var _item$homestay, _item$common10;
47
+ 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) {
48
+ var _item$homestay2, _item$common11;
49
+ /** 酒店 (天下房仓酒店详情页) */
50
+ 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) || "";
51
+ page = `${routePrefix.hotel}/home/details/index?id=${id}`;
52
+ } else {
53
+ var _item$homestay3, _item$homestay4, _item$common12, _item$common13;
54
+ 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);
55
+ 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) || "";
56
+ /** 民宿 */
57
+ if (`${subBizType}` === `${ESubBizType.HomestayHotel}`) page = `${routePrefix.hotel}/home/details/index?id=${id}`;
58
+ else if (`${subBizType}` === `${ESubBizType.HomestayHot}`) page = `${routePrefix.hotel}/home/hot-sale-details/index?id=${id}`;
59
+ else page = `${routePrefix.hotel}/home/pms-details/index?id=${id}`;
60
+ }
61
+ break;
62
+ case EBusinessLine.Route:
63
+ var _item$route, _item$common14, _item$common15;
64
+ 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);
65
+ page = `${routePrefix.road}/product-detail/index?id=${routeId}`;
66
+ break;
67
+ case EBusinessLine.Travel:
68
+ var _item$travel, _item$common16, _item$common17;
69
+ 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);
70
+ page = `${routePrefix.travel}/charter/detail?routeId=${travelId}`;
71
+ break;
72
+ case EBusinessLine.Buy:
73
+ var _item$buy, _item$common18, _item$common19;
74
+ 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);
75
+ page = getWebviewPage({ url: appConfig.domain.shopping + `goods?itemId=${buySpuId}` });
76
+ break;
77
+ case EBusinessLine.Onebuygz:
78
+ var _item$onebuygz, _item$common20, _item$common21, _item$onebuygz2, _item$common22;
79
+ 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);
80
+ 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);
81
+ page = getWebviewPage({ url: appConfig.domain.onebuygz + `pages/commodity-detail/index?itemId=${onebuySpuId}&skuId=${onebuySkuId}` });
82
+ break;
83
+ case EBusinessLine.Foods:
84
+ var _item$food, _item$food2, _item$common23, _item$food3, _item$common24, _item$common25, _item$food4;
85
+ 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);
86
+ 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) || "";
87
+ 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) || "";
88
+ 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;
89
+ if (moduleType === EFoodsModuleType.store)
77
90
  /** 收藏跳店铺 */
78
- page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, storeId) });
79
- else
91
+ page = getWebviewPage({ url: getFoodStorePage(appConfig.domain.food, storeId) });
92
+ else
80
93
  /** 跳转套餐 */
81
- page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, storeId, spuId, storePrecedentType) });
82
- break;
83
- case EBusinessLine.Entertainment:
84
- const entertainmentId = item?.entertainment?.id || item?.common?.spuId || item?.common?.id;
85
- const entertainmentStoreId = item?.entertainment?.storeId || extInfo?.storeId || item?.common?.storeId || "";
86
- const entertainmentSubBizType = item?.entertainment?.subBizType || extInfo?.subBizType;
87
- const entertainmentType = item?.entertainment?.type || extInfo?.type || item?.common?.type;
88
- const entertainmentReservationId = item?.entertainment?.reservationId || extInfo?.reservationId || item?.common?.reservationId;
89
- if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
90
- else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
91
- break;
92
- case EBusinessLine.Movie:
93
- let movieId = item?.movie?.id || "";
94
- try {
95
- movieId = JSON.parse(extInfo?.extInfo || "{}")?.thirdMovieId || "";
96
- } catch {}
97
- page = getMoviePage(appConfig.domain.movie, movieId);
98
- break;
99
- case EBusinessLine.Strategy:
100
- const strategyId = item?.strategy?.id || item?.common?.spuId || item?.common?.id;
101
- page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
102
- break;
103
- case EBusinessLine.Recommend:
104
- const recommendId = item?.recommend?.id || item?.common?.spuId || item?.common?.id;
105
- const recommendMoreParameter = item?.recommend?.moreParameter || extInfo?.moreParameter || "";
106
- page = `${routePrefix.show}/details/index?id=${recommendId}${recommendMoreParameter}`;
107
- break;
108
- case EBusinessLine.SoundGuizhou:
109
- const soundGuizhouId = item?.soundGuizhou?.id || item?.common?.spuId || item?.common?.id;
110
- page = `${routePrefix.soundGuizhou}/detail?audioLibId=${soundGuizhouId}`;
111
- break;
112
- case EBusinessLine.ExcitingVideo:
113
- const excitingVideoId = item?.excitingVideo?.id || item?.common?.spuId || item?.common?.id;
114
- page = `${routePrefix.living}/wonderful-video/index?vid=${excitingVideoId}`;
115
- break;
116
- default: break;
117
- }
118
- if (!page) return;
119
- if (configOptions.caller === ECaller.web) navigateTo({ src: page });
120
- else if (configOptions.caller === ECaller.host) uni.navigateTo({ url: page });
121
- };
94
+ page = getWebviewPage({ url: getFoodPackagePage(appConfig.domain.food, storeId, spuId, storePrecedentType) });
95
+ break;
96
+ case EBusinessLine.Entertainment:
97
+ var _item$entertainment, _item$common26, _item$common27, _item$entertainment2, _item$common28, _item$entertainment3, _item$entertainment4, _item$common29, _item$entertainment5, _item$common30;
98
+ 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);
99
+ 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) || "";
100
+ 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);
101
+ 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);
102
+ 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);
103
+ if (`${entertainmentType}` === EVenueSimpleTypes.Activity || `${entertainmentSubBizType}` === `${ESubBizType.EntertainmentPerform}`) page = `${routePrefix.enjoy}/g-activity/detail?id=` + entertainmentId + "&mchId=" + entertainmentStoreId;
104
+ else page = `${routePrefix.enjoy}/g-venue/detail?id=${entertainmentId}&reservationId=${entertainmentReservationId}`;
105
+ break;
106
+ case EBusinessLine.Movie:
107
+ var _item$movie;
108
+ let movieId = (item === null || item === void 0 || (_item$movie = item.movie) === null || _item$movie === void 0 ? void 0 : _item$movie.id) || "";
109
+ try {
110
+ var _JSON$parse;
111
+ movieId = ((_JSON$parse = JSON.parse((extInfo === null || extInfo === void 0 ? void 0 : extInfo.extInfo) || "{}")) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.thirdMovieId) || "";
112
+ } catch (_unused) {}
113
+ page = getMoviePage(appConfig.domain.movie, movieId);
114
+ break;
115
+ case EBusinessLine.Strategy:
116
+ var _item$strategy, _item$common31, _item$common32;
117
+ 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);
118
+ page = `${routePrefix.strategy}/strategy-detail/index?id=` + strategyId;
119
+ break;
120
+ case EBusinessLine.Recommend:
121
+ var _item$recommend, _item$common33, _item$common34, _item$recommend2;
122
+ 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);
123
+ 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) || "";
124
+ page = `${routePrefix.show}/details/index?id=${recommendId}${recommendMoreParameter}`;
125
+ break;
126
+ case EBusinessLine.SoundGuizhou:
127
+ var _item$soundGuizhou, _item$common35, _item$common36;
128
+ const soundGuizhouId = (item === null || item === void 0 || (_item$soundGuizhou = item.soundGuizhou) === null || _item$soundGuizhou === void 0 ? void 0 : _item$soundGuizhou.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);
129
+ page = `${routePrefix.soundGuizhou}/detail?audioLibId=${soundGuizhouId}`;
130
+ break;
131
+ case EBusinessLine.ExcitingVideo:
132
+ var _item$excitingVideo, _item$common37, _item$common38;
133
+ 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$common37 = item.common) === null || _item$common37 === void 0 ? void 0 : _item$common37.spuId) || (item === null || item === void 0 || (_item$common38 = item.common) === null || _item$common38 === void 0 ? void 0 : _item$common38.id);
134
+ page = `${routePrefix.living}/wonderful-video/index?vid=${excitingVideoId}`;
135
+ break;
136
+ default: break;
137
+ }
138
+ if (!page) return;
139
+ if (configOptions.caller === ECaller.web) navigateTo({ src: page });
140
+ else if (configOptions.caller === ECaller.host) uni.navigateTo({ url: page });
141
+ }
142
+ );
143
+ this.goodsServiceConfig = config;
144
+ }
122
145
  };
123
146
 
124
147
  //#endregion
@@ -33,7 +33,7 @@ function getQueryParameters(url) {
33
33
  let value = decodeURIComponent(pair[1] || "");
34
34
  try {
35
35
  value = JSON.parse(value);
36
- } catch {}
36
+ } catch (_unused) {}
37
37
  params[key] = value;
38
38
  }
39
39
  }
@@ -62,7 +62,7 @@ const showAndroidTip = (options) => {
62
62
  const checkAndRequestNativeAppPermission = (options) => {
63
63
  const { type, success, fail } = options || {};
64
64
  if (isWeixinEnv() || isH5Env() || isHarmonyEnv() || isiOSEnv()) {
65
- success?.();
65
+ success === null || success === void 0 || success();
66
66
  return;
67
67
  }
68
68
  const ActivityCompat = plus.android.importClass("androidx.core.app.ActivityCompat");
@@ -77,19 +77,19 @@ const checkAndRequestNativeAppPermission = (options) => {
77
77
  }
78
78
  });
79
79
  if (!hasPermission) {
80
- success?.();
80
+ success === null || success === void 0 || success();
81
81
  return;
82
82
  }
83
83
  showAndroidTip(detail);
84
84
  plus.android.requestPermissions(detail.permissionId, function(resultObj) {
85
85
  if (resultObj.granted.length > 0) {
86
86
  closeAndroidTip();
87
- success?.();
87
+ success === null || success === void 0 || success();
88
88
  return;
89
89
  }
90
90
  if (resultObj.deniedPresent.length > 0) {
91
91
  closeAndroidTip();
92
- fail?.();
92
+ fail === null || fail === void 0 || fail();
93
93
  return;
94
94
  }
95
95
  if (resultObj.deniedAlways.length > 0) {
@@ -99,15 +99,15 @@ const checkAndRequestNativeAppPermission = (options) => {
99
99
  confirmText: "去设置",
100
100
  success: function(res) {
101
101
  closeAndroidTip();
102
- if (res.confirm) uni.openAppAuthorizeSetting({ success: () => fail?.() });
103
- if (res.cancel) fail?.();
102
+ if (res.confirm) uni.openAppAuthorizeSetting({ success: () => fail === null || fail === void 0 ? void 0 : fail() });
103
+ if (res.cancel) fail === null || fail === void 0 || fail();
104
104
  }
105
105
  });
106
106
  return;
107
107
  }
108
108
  }, function() {
109
109
  closeAndroidTip();
110
- fail?.();
110
+ fail === null || fail === void 0 || fail();
111
111
  });
112
112
  };
113
113
 
@@ -1,4 +1,5 @@
1
1
  import { EUniPlatform } from "../../enums/platform/index.js";
2
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
2
3
 
3
4
  //#region src/utils/uni-env/index.ts
4
5
  /**
@@ -54,10 +55,7 @@ const isiOSEnv = () => {
54
55
  return false;
55
56
  };
56
57
  function getSystemInfoSync() {
57
- return {
58
- ...uni.getDeviceInfo(),
59
- ...uni.getWindowInfo()
60
- };
58
+ return _objectSpread2(_objectSpread2({}, uni.getDeviceInfo()), uni.getWindowInfo());
61
59
  }
62
60
 
63
61
  //#endregion
@@ -1,6 +1,10 @@
1
+ import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/asyncToGenerator.js";
2
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.js";
3
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.js";
1
4
  import wx from "weixin-js-sdk";
2
5
 
3
6
  //#region src/utils/web-view/index.ts
7
+ const _excluded = ["shareUrl"];
4
8
  const userAgent = navigator.userAgent.toLowerCase();
5
9
  /** 判断是否是iOS还是安卓 */
6
10
  const isIOSOrAndroid = !userAgent.includes("miniprogram") && (userAgent.includes("android") || userAgent.includes("iphone") || userAgent.includes("ipad"));
@@ -15,14 +19,20 @@ const isAndroid = !userAgent.includes("miniprogram") && userAgent.includes("andr
15
19
  /** 判断是否苹果APP */
16
20
  const isiOS = !userAgent.includes("miniprogram") && (userAgent.includes("iphone") || userAgent.includes("ipad"));
17
21
  let uni = {};
18
- async function loadWebview() {
19
- if (isIOSOrAndroid) uni = (await import("../../assets/js/webview/uni.webview.1.5.6.js")).default;
20
- else uni = (await import("../../assets/js/webview/uni.webview.1.5.5.js")).default;
21
- if (isAlipay) {
22
- const scriptTag = document.createElement("script");
23
- scriptTag.src = "https://appx/web-view.min.js";
24
- document.head.appendChild(scriptTag);
25
- }
22
+ function loadWebview() {
23
+ return _loadWebview.apply(this, arguments);
24
+ }
25
+ function _loadWebview() {
26
+ _loadWebview = _asyncToGenerator(function* () {
27
+ if (isIOSOrAndroid) uni = (yield import("../../assets/js/webview/uni.webview.1.5.6.js")).default;
28
+ else uni = (yield import("../../assets/js/webview/uni.webview.1.5.5.js")).default;
29
+ if (isAlipay) {
30
+ const scriptTag = document.createElement("script");
31
+ scriptTag.src = "https://appx/web-view.min.js";
32
+ document.head.appendChild(scriptTag);
33
+ }
34
+ });
35
+ return _loadWebview.apply(this, arguments);
26
36
  }
27
37
  loadWebview();
28
38
  document.addEventListener("UniAppJSBridgeReady", function() {
@@ -45,10 +55,11 @@ const navigateTo = (parameters) => {
45
55
  const { src, params } = parameters;
46
56
  const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
47
57
  try {
48
- uni?.webView?.navigateTo?.({ url });
58
+ var _uni$webView, _uni$webView$navigate, _my;
59
+ 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 });
49
60
  /** 不兼容上面的方法会自动往下执行 */
50
- wx.miniProgram.navigateTo({ url });
51
- my?.navigateTo({ url });
61
+ wx === null || wx === void 0 || wx.miniProgram.navigateTo({ url });
62
+ (_my = my) === null || _my === void 0 || _my.navigateTo({ url });
52
63
  } catch (error) {
53
64
  console.error(error);
54
65
  }
@@ -61,10 +72,11 @@ const redirectTo = (parameters) => {
61
72
  const { src, params } = parameters;
62
73
  const url = `${src}${params ? `?${objectToQueryString(params)}` : ""}`;
63
74
  try {
64
- uni?.webView?.redirectTo?.({ url });
75
+ var _uni$webView2, _uni$webView2$redirec, _my2;
76
+ 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 });
65
77
  /** 不兼容上面的方法会自动往下执行 */
66
- wx.miniProgram.redirectTo({ url });
67
- my?.redirectTo({ url });
78
+ wx === null || wx === void 0 || wx.miniProgram.redirectTo({ url });
79
+ (_my2 = my) === null || _my2 === void 0 || _my2.redirectTo({ url });
68
80
  } catch (error) {
69
81
  console.error(error);
70
82
  }
@@ -75,10 +87,11 @@ const redirectTo = (parameters) => {
75
87
  */
76
88
  const navigateBack = (parameters) => {
77
89
  try {
78
- uni?.webView?.navigateBack?.(parameters);
90
+ var _uni$webView3, _uni$webView3$navigat, _my3;
91
+ 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);
79
92
  /** 不兼容上面的方法会自动往下执行 */
80
- wx.miniProgram.navigateBack(parameters);
81
- my?.navigateBack(parameters);
93
+ wx === null || wx === void 0 || wx.miniProgram.navigateBack(parameters);
94
+ (_my3 = my) === null || _my3 === void 0 || _my3.navigateBack(parameters);
82
95
  } catch (error) {
83
96
  console.error(error);
84
97
  }
@@ -98,11 +111,13 @@ const postMessage = (data) => {
98
111
  }
99
112
  }
100
113
  try {
101
- uni?.webView?.postMessage({ data });
102
- wx.miniProgram.postMessage({ data });
103
- my?.postMessage({ data });
114
+ var _uni$webView4, _my4;
115
+ uni === null || uni === void 0 || (_uni$webView4 = uni.webView) === null || _uni$webView4 === void 0 || _uni$webView4.postMessage({ data });
116
+ wx === null || wx === void 0 || wx.miniProgram.postMessage({ data });
117
+ (_my4 = my) === null || _my4 === void 0 || _my4.postMessage({ data });
104
118
  } catch (error) {
105
- if (error?.message?.includes("my is not defined")) return;
119
+ var _message;
120
+ if (error === null || error === void 0 || (_message = error.message) === null || _message === void 0 ? void 0 : _message.includes("my is not defined")) return;
106
121
  console.error(error);
107
122
  }
108
123
  };
@@ -111,12 +126,11 @@ const postMessage = (data) => {
111
126
  * @param data
112
127
  */
113
128
  const setShareParam = (data, businessType) => {
114
- const { shareUrl, ...res } = data;
115
- const params = { data: {
116
- ...res,
129
+ const { shareUrl } = data;
130
+ const params = { data: _objectSpread2(_objectSpread2({}, _objectWithoutProperties(data, _excluded)), {}, {
117
131
  businessType,
118
132
  shareUrl: encodeURIComponent(shareUrl || "")
119
- } };
133
+ }) };
120
134
  postMessage({
121
135
  type: EMessagesType.shareParam,
122
136
  params
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.0.3",
5
+ "version": "1.0.4",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",