@pisell/private-materials 3.0.151-gray → 3.0.152-gray

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 (29) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +5 -5
  7. package/build/lowcode/render/default/view.js +8 -8
  8. package/build/lowcode/view.js +6 -6
  9. package/es/components/booking/addons/model.d.ts +1 -1
  10. package/es/components/booking/info/service/addService/index.js +1 -1
  11. package/es/components/booking/info/service/editService/index.js +6 -6
  12. package/es/components/eftposPay/index.js +2 -0
  13. package/es/components/eftposPay/tyro/index.js +11 -8
  14. package/es/components/pay/toC/PaymentMethods/ApplePay/index.js +2 -1
  15. package/es/components/pay/toC/PaymentMethods/BankDeposit/index.js +5 -4
  16. package/es/components/pay/toC/PaymentMethods/GooglePay/index.js +2 -1
  17. package/es/components/pay/toC/utils.d.ts +11 -0
  18. package/es/components/pay/toC/utils.js +27 -0
  19. package/lib/components/booking/addons/model.d.ts +1 -1
  20. package/lib/components/booking/info/service/addService/index.js +0 -1
  21. package/lib/components/booking/info/service/editService/index.js +5 -5
  22. package/lib/components/eftposPay/index.js +2 -0
  23. package/lib/components/eftposPay/tyro/index.js +7 -6
  24. package/lib/components/pay/toC/PaymentMethods/ApplePay/index.js +5 -1
  25. package/lib/components/pay/toC/PaymentMethods/BankDeposit/index.js +6 -3
  26. package/lib/components/pay/toC/PaymentMethods/GooglePay/index.js +5 -1
  27. package/lib/components/pay/toC/utils.d.ts +11 -0
  28. package/lib/components/pay/toC/utils.js +26 -2
  29. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -267,7 +267,7 @@ var Info = function Info(props) {
267
267
  }
268
268
  // 渲染到当前位置模式时,默认无资源 时间默认取顶部设置的时间
269
269
  if (renderMode === 'current') {
270
- cacheItem._extend.resource = 0;
270
+ // cacheItem._extend.resource = 0;
271
271
  cacheItem.currentDefaultTime = state.date.value.format('HH:mm');
272
272
  }
273
273
  cacheItem._extend = getProductExtend({
@@ -155,7 +155,7 @@ var Info = function Info(_, ref) {
155
155
  * @Date: 2024-01-09 13:38
156
156
  */
157
157
  var getResources = /*#__PURE__*/function () {
158
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(cacheItem) {
158
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(cacheItem, open) {
159
159
  var _list, _cacheItem, autoClose;
160
160
  return _regeneratorRuntime().wrap(function _callee$(_context) {
161
161
  while (1) switch (_context.prev = _context.next) {
@@ -189,7 +189,7 @@ var Info = function Info(_, ref) {
189
189
  }, 200);
190
190
  } else {
191
191
  setTimeout(function () {
192
- if (selectOpen === undefined) {
192
+ if (selectOpen === undefined || open) {
193
193
  setSelectOpen(true);
194
194
  }
195
195
  }, 500);
@@ -206,7 +206,7 @@ var Info = function Info(_, ref) {
206
206
  }
207
207
  }, _callee, null, [[1, 11]]);
208
208
  }));
209
- return function getResources(_x2) {
209
+ return function getResources(_x2, _x3) {
210
210
  return _ref.apply(this, arguments);
211
211
  };
212
212
  }();
@@ -401,13 +401,13 @@ var Info = function Info(_, ref) {
401
401
  }
402
402
  });
403
403
  });
404
- var setEditData = useMemoizedFn(function (_cacheItem) {
404
+ var setEditData = useMemoizedFn(function (_cacheItem, open) {
405
405
  var cacheItem = _cacheItem || state.service.cacheItem;
406
406
  var values = cacheItem._extend;
407
407
  form.setFieldsValue(values);
408
408
  if (state.renderType !== 'eventBooking') {
409
409
  // 获取资源列表
410
- getResources(cacheItem);
410
+ getResources(cacheItem, open);
411
411
  }
412
412
  });
413
413
 
@@ -458,7 +458,7 @@ var Info = function Info(_, ref) {
458
458
  useEffect(function () {
459
459
  // 预约创建页面并且打开了编辑弹窗
460
460
  if (state.isBookingCreatePage && state.service.editModal) {
461
- setEditData();
461
+ setEditData(null, true);
462
462
  }
463
463
  }, [state.service.editModal, state.isBookingCreatePage]);
464
464
 
@@ -277,6 +277,8 @@ export default (function (props) {
277
277
  onChangeParams: props.onChangeParams,
278
278
  action: action,
279
279
  source: props.source,
280
+ tyroUrl: props.tyroUrl,
281
+ tyroVersion: props.tyroVersion,
280
282
  device_number: props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.device_number
281
283
  }));
282
284
  });
@@ -235,12 +235,12 @@ export default (function (_ref) {
235
235
  merchantReceipt = _ref3.merchantReceipt;
236
236
  console.log('商家小票 客户端是否打印小票 = ', signatureRequired);
237
237
  console.log('商家小票 小票内容 = \n', merchantReceipt);
238
- if (signatureRequired) {
239
- var receipt = [merchantReceipt].filter(function (item) {
240
- return typeof item === 'string';
241
- }).filter(Boolean);
242
- onChange('print', receipt);
243
- }
238
+ // if (signatureRequired) {
239
+ var receipt = [merchantReceipt].filter(function (item) {
240
+ return typeof item === 'string';
241
+ }).filter(Boolean);
242
+ onChange('print', receipt);
243
+ // }
244
244
  merchantReceiptRef.current = {
245
245
  signatureRequired: signatureRequired,
246
246
  merchantReceipt: merchantReceipt
@@ -344,7 +344,7 @@ export default (function (_ref) {
344
344
  card_reader_id: (_deviceRef$current5 = deviceRef.current) === null || _deviceRef$current5 === void 0 ? void 0 : _deviceRef$current5.id,
345
345
  card_reader_type: eftpos,
346
346
  amount: requestParams.current.amount,
347
- action: modeRef.current,
347
+ action: modeRef.current === ModeEnum.FullPay ? ModeEnum.Pay : modeRef.current,
348
348
  status: response.result === 'APPROVED' ? 'succeed' : 'failed',
349
349
  request: requestParams.current,
350
350
  response: _objectSpread(_objectSpread({}, response), {}, {
@@ -413,7 +413,8 @@ export default (function (_ref) {
413
413
  failCustom: {
414
414
  isPosNetworkError: false,
415
415
  status: 'fail',
416
- fail: locales.getText('page.eftpos-pay.text.transaction.fail'),
416
+ fail: response.result,
417
+ //locales.getText('page.eftpos-pay.text.transaction.fail'),
417
418
  warn: null,
418
419
  title: locales.getText('page.eftpos-pay.text.failed')(modeRef.current)
419
420
  }
@@ -427,7 +428,9 @@ export default (function (_ref) {
427
428
  if (load && TyroRef.current) {
428
429
  var _IClient = TyroRef.current.IClient;
429
430
  if (_IClient) {
431
+ console.log('apiKey = ', apiKey, 'posProductData = ', posProductData);
430
432
  var iclient = new _IClient(apiKey, posProductData);
433
+ console.log(iclient.posProductData);
431
434
  iClientRef.current = iclient;
432
435
  if (isCancelRef.current) {
433
436
  return;
@@ -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
  };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
4
  state: FormState;
5
5
  } & {
6
6
  dispatch: (params: {
@@ -217,7 +217,6 @@ var Info = (props) => {
217
217
  cacheItem.new = 0;
218
218
  }
219
219
  if (renderMode === "current") {
220
- cacheItem._extend.resource = 0;
221
220
  cacheItem.currentDefaultTime = state.date.value.format("HH:mm");
222
221
  }
223
222
  cacheItem._extend = (0, import_utils2.getProductExtend)({ cacheItem, state });
@@ -117,7 +117,7 @@ var Info = (_, ref) => {
117
117
  } catch (err) {
118
118
  }
119
119
  }, [useDuration, flexibleOption]);
120
- const getResources = async (cacheItem) => {
120
+ const getResources = async (cacheItem, open) => {
121
121
  console.log("getResources2");
122
122
  try {
123
123
  let _list = state.service.resourcesOrigin || [];
@@ -142,7 +142,7 @@ var Info = (_, ref) => {
142
142
  }, 200);
143
143
  } else {
144
144
  setTimeout(() => {
145
- if (selectOpen === void 0) {
145
+ if (selectOpen === void 0 || open) {
146
146
  setSelectOpen(true);
147
147
  }
148
148
  }, 500);
@@ -265,12 +265,12 @@ var Info = (_, ref) => {
265
265
  }
266
266
  });
267
267
  });
268
- const setEditData = (0, import_ahooks.useMemoizedFn)((_cacheItem) => {
268
+ const setEditData = (0, import_ahooks.useMemoizedFn)((_cacheItem, open) => {
269
269
  let cacheItem = _cacheItem || state.service.cacheItem;
270
270
  let values = cacheItem._extend;
271
271
  form.setFieldsValue(values);
272
272
  if (state.renderType !== "eventBooking") {
273
- getResources(cacheItem);
273
+ getResources(cacheItem, open);
274
274
  }
275
275
  });
276
276
  const isReason = (0, import_react.useMemo)(() => {
@@ -298,7 +298,7 @@ var Info = (_, ref) => {
298
298
  ]);
299
299
  (0, import_react.useEffect)(() => {
300
300
  if (state.isBookingCreatePage && state.service.editModal) {
301
- setEditData();
301
+ setEditData(null, true);
302
302
  }
303
303
  }, [state.service.editModal, state.isBookingCreatePage]);
304
304
  (0, import_react.useEffect)(() => {
@@ -241,6 +241,8 @@ var eftposPay_default = (props) => {
241
241
  onChangeParams: props.onChangeParams,
242
242
  action,
243
243
  source: props.source,
244
+ tyroUrl: props.tyroUrl,
245
+ tyroVersion: props.tyroVersion,
244
246
  device_number: (_f = props == null ? void 0 : props.params) == null ? void 0 : _f.device_number
245
247
  }
246
248
  ));
@@ -197,10 +197,8 @@ var tyro_default = ({
197
197
  const receiptCallbackImpl = ({ signatureRequired, merchantReceipt }) => {
198
198
  console.log("商家小票 客户端是否打印小票 = ", signatureRequired);
199
199
  console.log("商家小票 小票内容 = \n", merchantReceipt);
200
- if (signatureRequired) {
201
- const receipt = [merchantReceipt].filter((item) => typeof item === "string").filter(Boolean);
202
- onChange("print", receipt);
203
- }
200
+ const receipt = [merchantReceipt].filter((item) => typeof item === "string").filter(Boolean);
201
+ onChange("print", receipt);
204
202
  merchantReceiptRef.current = { signatureRequired, merchantReceipt };
205
203
  };
206
204
  const statusMessageCallbackImpl = (message) => {
@@ -308,7 +306,7 @@ var tyro_default = ({
308
306
  card_reader_id: (_a = deviceRef.current) == null ? void 0 : _a.id,
309
307
  card_reader_type: eftpos,
310
308
  amount: requestParams.current.amount,
311
- action: modeRef.current,
309
+ action: modeRef.current === import_const.ModeEnum.FullPay ? import_const.ModeEnum.Pay : modeRef.current,
312
310
  status: response.result === "APPROVED" ? "succeed" : "failed",
313
311
  request: requestParams.current,
314
312
  response: { ...response, merchantReceipt: merchantReceiptRef.current },
@@ -382,7 +380,8 @@ var tyro_default = ({
382
380
  failCustom: {
383
381
  isPosNetworkError: false,
384
382
  status: "fail",
385
- fail: import_utils.locales.getText("page.eftpos-pay.text.transaction.fail"),
383
+ fail: response.result,
384
+ //locales.getText('page.eftpos-pay.text.transaction.fail'),
386
385
  warn: null,
387
386
  title: import_utils.locales.getText("page.eftpos-pay.text.failed")(
388
387
  modeRef.current
@@ -398,7 +397,9 @@ var tyro_default = ({
398
397
  if (load && TyroRef.current) {
399
398
  const IClient = TyroRef.current.IClient;
400
399
  if (IClient) {
400
+ console.log("apiKey = ", apiKey, "posProductData = ", posProductData);
401
401
  const iclient = new IClient(apiKey, posProductData);
402
+ console.log(iclient.posProductData);
402
403
  iClientRef.current = iclient;
403
404
  if (isCancelRef.current) {
404
405
  return;
@@ -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.151-gray",
3
+ "version": "3.0.152-gray",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
- "@pisell/materials": "3.0.49-gray",
63
+ "@pisell/date-picker": "1.0.100",
64
64
  "@pisell/icon": "0.0.11",
65
- "@pisell/date-picker": "1.0.100"
65
+ "@pisell/materials": "3.0.49-gray"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",