@pisell/private-materials 3.0.150 → 3.0.151

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.
@@ -16,6 +16,7 @@ import { locales } from '@pisell/utils';
16
16
  import { getPayGroupParamsFromStorage } from "../../payGroup";
17
17
  import useEngineContext from "../../../../../hooks/useEngineContext";
18
18
  import "./index.less";
19
+ import { formatFranchiseeRoute } from "../../utils";
19
20
  /**
20
21
  * @title: Apple 支付
21
22
  * @description:
@@ -75,7 +76,7 @@ var ApplePay = function ApplePay(props, ref) {
75
76
 
76
77
  // 提取域名
77
78
  shop_domain = linkElement.hostname;
78
- _href = "".concat(config.pay, "/apple-pay?order_id=").concat((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id);
79
+ _href = "".concat(config.pay).concat(formatFranchiseeRoute("/apple-pay?order_id=".concat((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id), state.history));
79
80
  window.location.href = _href;
80
81
  } catch (err) {
81
82
  setOpen(false);
@@ -5,6 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  import { useImperativeHandle, forwardRef, useContext } from 'react';
6
6
  import { Context } from "../../model";
7
7
  import useEngineContext from "../../../../../hooks/useEngineContext";
8
+ import { formatFranchiseeRoute } from "../../utils";
8
9
  import "./index.less";
9
10
  /**
10
11
  * @title: 银行转账
@@ -31,7 +32,7 @@ var BankDeposit = function BankDeposit(props, ref) {
31
32
  var init = /*#__PURE__*/function () {
32
33
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
33
34
  var _context$appHelper, _context$appHelper$co;
34
- var payGroup, platform, _item;
35
+ var payGroup, platform, _item, _href;
35
36
  return _regeneratorRuntime().wrap(function _callee$(_context) {
36
37
  while (1) switch (_context.prev = _context.next) {
37
38
  case 0:
@@ -52,9 +53,9 @@ var BankDeposit = function BankDeposit(props, ref) {
52
53
  });
53
54
  return _context.abrupt("return");
54
55
  case 6:
55
- // h5打开银行转账页面
56
- state.history.push("/pay/manual-transfer?id=".concat((payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id)));
57
- case 7:
56
+ _href = "".concat(formatFranchiseeRoute("/pay/manual-transfer?id=".concat((payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id) || (payGroup === null || payGroup === void 0 ? void 0 : payGroup.order_id)), state.history)); // h5打开银行转账页面
57
+ state.history.push(_href);
58
+ case 8:
58
59
  case "end":
59
60
  return _context.stop();
60
61
  }
@@ -15,6 +15,7 @@ import ThreedsLoading from "../MWCreditCard/TDSPay/ThreedsLoading";
15
15
  import { Context } from "../../model";
16
16
  import { getPayGroupParamsFromStorage } from "../../payGroup";
17
17
  import useEngineContext from "../../../../../hooks/useEngineContext";
18
+ import { formatFranchiseeRoute } from "../../utils";
18
19
  /**
19
20
  * @title: 谷歌支付
20
21
  * @description:
@@ -72,7 +73,7 @@ var GooglePay = function GooglePay(props, ref) {
72
73
 
73
74
  // 提取域名
74
75
  shop_domain = linkElement.hostname;
75
- _href = "".concat(config.pay, "/google-pay?order_id=").concat((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id);
76
+ _href = "".concat(config.pay).concat(formatFranchiseeRoute("/google-pay?order_id=".concat((_state$payGroup = state.payGroup) === null || _state$payGroup === void 0 ? void 0 : _state$payGroup.order_id, "&shop_id=").concat(shopId, "&locale=").concat(locale, "&shop_domain=").concat(shop_domain, "&total_amount=").concat(values.amount, "&payment_group_id=").concat(values.payment_group_id), state.history));
76
77
  window.location.href = _href;
77
78
  } catch (err) {
78
79
  setOpen(false);
@@ -36,3 +36,14 @@ export declare const formatWalletPassParams: (payGroup: PayGroup) => {
36
36
  * @Date: 2024-08-30 10:06:17
37
37
  */
38
38
  export declare const getIsWalletPassAndTripartitePayment: (payGroup: PayGroup) => boolean | 0 | undefined;
39
+ export declare const isFranchiseeShop: (path?: any, history?: any) => any;
40
+ /**
41
+ * @title: 获取当前连锁加盟店铺shopid
42
+ * @description:
43
+ * @param {any} param1
44
+ * @return {*}
45
+ * @Author: chensheng.gu
46
+ * @Date: 2024-08-07 10:04
47
+ */
48
+ export declare const getFranchiseeShopId: (path?: any, history?: any) => number;
49
+ export declare const formatFranchiseeRoute: (url: string, history?: any) => string;
@@ -58,4 +58,31 @@ export var formatWalletPassParams = function formatWalletPassParams(payGroup) {
58
58
  export var getIsWalletPassAndTripartitePayment = function getIsWalletPassAndTripartitePayment(payGroup) {
59
59
  var _payGroup$walletPass, _payGroup$walletPass$, _payGroup$otherPaymen;
60
60
  return (payGroup === null || payGroup === void 0 ? void 0 : (_payGroup$walletPass = payGroup.walletPass) === null || _payGroup$walletPass === void 0 ? void 0 : (_payGroup$walletPass$ = _payGroup$walletPass.cards) === null || _payGroup$walletPass$ === void 0 ? void 0 : _payGroup$walletPass$.length) && isTripartitePayment(payGroup === null || payGroup === void 0 ? void 0 : (_payGroup$otherPaymen = payGroup.otherPayment) === null || _payGroup$otherPaymen === void 0 ? void 0 : _payGroup$otherPaymen.service);
61
+ };
62
+ export var isFranchiseeShop = function isFranchiseeShop(path, history) {
63
+ var pathname = history.location.pathname;
64
+ var _pathname = path || pathname;
65
+ return _pathname && _pathname.includes('/franchisee');
66
+ };
67
+
68
+ /**
69
+ * @title: 获取当前连锁加盟店铺shopid
70
+ * @description:
71
+ * @param {any} param1
72
+ * @return {*}
73
+ * @Author: chensheng.gu
74
+ * @Date: 2024-08-07 10:04
75
+ */
76
+ export var getFranchiseeShopId = function getFranchiseeShopId(path, history) {
77
+ var pathname = history.location.pathname;
78
+ var _pathname = path || pathname;
79
+ var match = _pathname.match(/\/shop_(\d+)\//);
80
+ var shopNumber = match ? match[1] : null;
81
+ return Number(shopNumber);
82
+ };
83
+ export var formatFranchiseeRoute = function formatFranchiseeRoute(url, history) {
84
+ if (isFranchiseeShop(null, history)) {
85
+ return "/franchisee/shop/shop_".concat(getFranchiseeShopId(null, history)).concat(url);
86
+ }
87
+ return url;
61
88
  };
@@ -40,6 +40,7 @@ var import_utils = require("@pisell/utils");
40
40
  var import_payGroup = require("../../payGroup");
41
41
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
42
42
  var import_index = require("./index.less");
43
+ var import_utils2 = require("../../utils");
43
44
  var ApplePay = (props, ref) => {
44
45
  var _a;
45
46
  const { state } = (0, import_react.useContext)(import_model.Context);
@@ -63,7 +64,10 @@ var ApplePay = (props, ref) => {
63
64
  const linkElement = document.createElement("a");
64
65
  linkElement.href = currentURL;
65
66
  const shop_domain = linkElement.hostname;
66
- const _href = `${config.pay}/apple-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`;
67
+ const _href = `${config.pay}${(0, import_utils2.formatFranchiseeRoute)(
68
+ `/apple-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`,
69
+ state.history
70
+ )}`;
67
71
  window.location.href = _href;
68
72
  } catch (err) {
69
73
  setOpen(false);
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(BankDeposit_exports);
35
35
  var import_react = require("react");
36
36
  var import_model = require("../../model");
37
37
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
38
+ var import_utils = require("../../utils");
38
39
  var import_index = require("./index.less");
39
40
  var BankDeposit = (props, ref) => {
40
41
  const { state } = (0, import_react.useContext)(import_model.Context);
@@ -53,9 +54,11 @@ var BankDeposit = (props, ref) => {
53
54
  });
54
55
  return;
55
56
  }
56
- state.history.push(
57
- `/pay/manual-transfer?id=${(payGroup == null ? void 0 : payGroup.order_id) || (payGroup == null ? void 0 : payGroup.order_id)}`
58
- );
57
+ const _href = `${(0, import_utils.formatFranchiseeRoute)(
58
+ `/pay/manual-transfer?id=${(payGroup == null ? void 0 : payGroup.order_id) || (payGroup == null ? void 0 : payGroup.order_id)}`,
59
+ state.history
60
+ )}`;
61
+ state.history.push(_href);
59
62
  };
60
63
  (0, import_react.useImperativeHandle)(
61
64
  ref,
@@ -39,6 +39,7 @@ var import_ThreedsLoading = __toESM(require("../MWCreditCard/TDSPay/ThreedsLoadi
39
39
  var import_model = require("../../model");
40
40
  var import_payGroup = require("../../payGroup");
41
41
  var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
42
+ var import_utils2 = require("../../utils");
42
43
  var GooglePay = (props, ref) => {
43
44
  var _a;
44
45
  const { state } = (0, import_react.useContext)(import_model.Context);
@@ -62,7 +63,10 @@ var GooglePay = (props, ref) => {
62
63
  const linkElement = document.createElement("a");
63
64
  linkElement.href = currentURL;
64
65
  const shop_domain = linkElement.hostname;
65
- const _href = `${config.pay}/google-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`;
66
+ const _href = `${config.pay}${(0, import_utils2.formatFranchiseeRoute)(
67
+ `/google-pay?order_id=${(_g = state.payGroup) == null ? void 0 : _g.order_id}&shop_id=${shopId}&locale=${locale}&shop_domain=${shop_domain}&total_amount=${values.amount}&payment_group_id=${values.payment_group_id}`,
68
+ state.history
69
+ )}`;
66
70
  window.location.href = _href;
67
71
  } catch (err) {
68
72
  setOpen(false);
@@ -36,3 +36,14 @@ export declare const formatWalletPassParams: (payGroup: PayGroup) => {
36
36
  * @Date: 2024-08-30 10:06:17
37
37
  */
38
38
  export declare const getIsWalletPassAndTripartitePayment: (payGroup: PayGroup) => boolean | 0 | undefined;
39
+ export declare const isFranchiseeShop: (path?: any, history?: any) => any;
40
+ /**
41
+ * @title: 获取当前连锁加盟店铺shopid
42
+ * @description:
43
+ * @param {any} param1
44
+ * @return {*}
45
+ * @Author: chensheng.gu
46
+ * @Date: 2024-08-07 10:04
47
+ */
48
+ export declare const getFranchiseeShopId: (path?: any, history?: any) => number;
49
+ export declare const formatFranchiseeRoute: (url: string, history?: any) => string;
@@ -20,9 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
22
  calcWalletPassListAmount: () => calcWalletPassListAmount,
23
+ formatFranchiseeRoute: () => formatFranchiseeRoute,
23
24
  formatWalletPassList2PreparePayments: () => formatWalletPassList2PreparePayments,
24
25
  formatWalletPassParams: () => formatWalletPassParams,
25
- getIsWalletPassAndTripartitePayment: () => getIsWalletPassAndTripartitePayment
26
+ getFranchiseeShopId: () => getFranchiseeShopId,
27
+ getIsWalletPassAndTripartitePayment: () => getIsWalletPassAndTripartitePayment,
28
+ isFranchiseeShop: () => isFranchiseeShop
26
29
  });
27
30
  module.exports = __toCommonJS(utils_exports);
28
31
  var import_decimal = require("decimal.js");
@@ -60,10 +63,31 @@ var getIsWalletPassAndTripartitePayment = (payGroup) => {
60
63
  var _a, _b, _c;
61
64
  return ((_b = (_a = payGroup == null ? void 0 : payGroup.walletPass) == null ? void 0 : _a.cards) == null ? void 0 : _b.length) && (0, import_status.isTripartitePayment)((_c = payGroup == null ? void 0 : payGroup.otherPayment) == null ? void 0 : _c.service);
62
65
  };
66
+ var isFranchiseeShop = (path, history) => {
67
+ const { pathname } = history.location;
68
+ const _pathname = path || pathname;
69
+ return _pathname && _pathname.includes("/franchisee");
70
+ };
71
+ var getFranchiseeShopId = (path, history) => {
72
+ const { pathname } = history.location;
73
+ const _pathname = path || pathname;
74
+ const match = _pathname.match(/\/shop_(\d+)\//);
75
+ const shopNumber = match ? match[1] : null;
76
+ return Number(shopNumber);
77
+ };
78
+ var formatFranchiseeRoute = (url, history) => {
79
+ if (isFranchiseeShop(null, history)) {
80
+ return `/franchisee/shop/shop_${getFranchiseeShopId(null, history)}${url}`;
81
+ }
82
+ return url;
83
+ };
63
84
  // Annotate the CommonJS export names for ESM import in node:
64
85
  0 && (module.exports = {
65
86
  calcWalletPassListAmount,
87
+ formatFranchiseeRoute,
66
88
  formatWalletPassList2PreparePayments,
67
89
  formatWalletPassParams,
68
- getIsWalletPassAndTripartitePayment
90
+ getFranchiseeShopId,
91
+ getIsWalletPassAndTripartitePayment,
92
+ isFranchiseeShop
69
93
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.150",
3
+ "version": "3.0.151",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -59,10 +59,10 @@
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
+ "@pisell/materials": "3.0.48",
62
63
  "@pisell/utils": "1.0.42",
63
- "@pisell/icon": "0.0.11",
64
64
  "@pisell/date-picker": "1.0.100",
65
- "@pisell/materials": "3.0.48"
65
+ "@pisell/icon": "0.0.11"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",