@pisell/private-materials 6.12.157 → 6.12.158

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 (34) 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/meta.js +1 -1
  5. package/build/lowcode/preview.js +1 -1
  6. package/build/lowcode/render/default/view.js +6 -6
  7. package/build/lowcode/view.js +6 -6
  8. package/es/components/checkout/PaymentModal.js +552 -392
  9. package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +16 -8
  10. package/es/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  11. package/es/components/checkout/components/SearchAndClientModule/index.js +12 -4
  12. package/es/components/checkout/hooks/useCheckoutPaymentScanActivity.js +80 -0
  13. package/es/components/checkout/hooks/useSharedWalletPass.js +54 -7
  14. package/es/components/checkout/hooks/useWalletPass.js +45 -7
  15. package/es/components/checkout/locales.js +15 -0
  16. package/es/components/checkout/paymentRuntime/PaymentMethodRuntime.js +35 -6
  17. package/es/components/pay/toB/components/EFTPOS/index.js +44 -7
  18. package/es/components/pay/toB/components/MX51/index.js +11 -1
  19. package/es/components/pay/toB/paymentMethods/index.js +31 -17
  20. package/es/plus/salesSdk/demo/hosts/legacyOpenProductDetail.js +1 -7
  21. package/lib/components/checkout/PaymentModal.js +552 -392
  22. package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +16 -8
  23. package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  24. package/lib/components/checkout/components/SearchAndClientModule/index.js +12 -4
  25. package/lib/components/checkout/hooks/useCheckoutPaymentScanActivity.js +81 -0
  26. package/lib/components/checkout/hooks/useSharedWalletPass.js +54 -7
  27. package/lib/components/checkout/hooks/useWalletPass.js +45 -7
  28. package/lib/components/checkout/locales.js +15 -0
  29. package/lib/components/checkout/paymentRuntime/PaymentMethodRuntime.js +35 -6
  30. package/lib/components/pay/toB/components/EFTPOS/index.js +44 -7
  31. package/lib/components/pay/toB/components/MX51/index.js +11 -1
  32. package/lib/components/pay/toB/paymentMethods/index.js +31 -17
  33. package/lib/plus/salesSdk/demo/hosts/legacyOpenProductDetail.js +1 -7
  34. package/package.json +3 -3
@@ -14,7 +14,7 @@ const MX51 = (props, ref) => {
14
14
  const logger = require_useLogger.default();
15
15
  const context = require_useEngineContext.default();
16
16
  const action = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.action;
17
- const onOpen = ({ data, payCallback }) => {
17
+ const onOpen = ({ data, payCallback, isActive }) => {
18
18
  const { params, mode } = data;
19
19
  const uniquePaymentNumber = getUuid();
20
20
  const newData = {
@@ -32,6 +32,15 @@ const MX51 = (props, ref) => {
32
32
  title: "ToB_MX51_onOpen 开始调用",
33
33
  metadata: { params: newData }
34
34
  });
35
+ if (isActive && !isActive()) return false;
36
+ if (typeof action !== "function") {
37
+ logger === null || logger === void 0 || logger.addLog({
38
+ type: "error",
39
+ title: "ToB_MX51_onOpen 支付能力不可用",
40
+ metadata: { params: newData }
41
+ });
42
+ return false;
43
+ }
35
44
  action({
36
45
  type: "webpos.handleMX51Pay",
37
46
  data: newData,
@@ -65,6 +74,7 @@ const MX51 = (props, ref) => {
65
74
  });
66
75
  }
67
76
  });
77
+ return true;
68
78
  };
69
79
  (0, react.useImperativeHandle)(ref, () => ({ open: onOpen }));
70
80
  return null;
@@ -1,5 +1,6 @@
1
1
  const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
+ const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
4
  const require_objectWithoutProperties = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
4
5
  const require_useLogger = require("../../../../hooks/useLogger.js");
5
6
  const require_index = require("../components/EFTPOS/index.js");
@@ -12,25 +13,38 @@ const PaymentMethods = (props, ref) => {
12
13
  const eftposRef = (0, react.useRef)(null);
13
14
  const mx51Ref = (0, react.useRef)(null);
14
15
  const logger = require_useLogger.default();
15
- const onPay = (type, params) => {
16
- const { callback } = params, otherParams = require_objectWithoutProperties._objectWithoutProperties(params, _excluded);
17
- console.log("onPay_params>>>>", type, params);
18
- logger === null || logger === void 0 || logger.addLog({
19
- type: "info",
20
- title: "ToB_PaymentMethods_onPay 开始调用",
21
- metadata: {
22
- type,
23
- params
16
+ const onPay = function() {
17
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* (type, params) {
18
+ const { callback } = params, otherParams = require_objectWithoutProperties._objectWithoutProperties(params, _excluded);
19
+ console.log("onPay_params>>>>", type, params);
20
+ logger === null || logger === void 0 || logger.addLog({
21
+ type: "info",
22
+ title: "ToB_PaymentMethods_onPay 开始调用",
23
+ metadata: {
24
+ type,
25
+ params
26
+ }
27
+ });
28
+ const paymentRef = type === "eftpos" ? eftposRef.current : mx51Ref.current;
29
+ if (!(paymentRef === null || paymentRef === void 0 ? void 0 : paymentRef.open)) return false;
30
+ try {
31
+ return (yield paymentRef.open(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherParams), {}, { payCallback: (res) => type === "eftpos" ? _eftpcallback(res, callback) : _mx51callback(res, callback) }))) === true;
32
+ } catch (error) {
33
+ logger === null || logger === void 0 || logger.addLog({
34
+ type: "error",
35
+ title: "ToB_PaymentMethods_onPay 启动失败",
36
+ metadata: {
37
+ type,
38
+ error: error instanceof Error ? error.message : String(error)
39
+ }
40
+ });
41
+ return false;
24
42
  }
25
43
  });
26
- if (type === "eftpos") {
27
- var _eftposRef$current, _eftposRef$current$op;
28
- (_eftposRef$current = eftposRef.current) === null || _eftposRef$current === void 0 || (_eftposRef$current$op = _eftposRef$current.open) === null || _eftposRef$current$op === void 0 || _eftposRef$current$op.call(_eftposRef$current, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherParams), {}, { payCallback: (res) => _eftpcallback(res, callback) }));
29
- } else if (type === "mx51") {
30
- var _mx51Ref$current, _mx51Ref$current$open;
31
- (_mx51Ref$current = mx51Ref.current) === null || _mx51Ref$current === void 0 || (_mx51Ref$current$open = _mx51Ref$current.open) === null || _mx51Ref$current$open === void 0 || _mx51Ref$current$open.call(_mx51Ref$current, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherParams), {}, { payCallback: (res) => _mx51callback(res, callback) }));
32
- }
33
- };
44
+ return function onPay(_x, _x2) {
45
+ return _ref.apply(this, arguments);
46
+ };
47
+ }();
34
48
  const _eftpcallback = (res, callback) => {
35
49
  const params = {
36
50
  status: res.status,
@@ -3,8 +3,6 @@ const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtim
3
3
  let dayjs = require("dayjs");
4
4
  dayjs = require_runtime.__toESM(dayjs);
5
5
  //#region src/plus/salesSdk/demo/hosts/legacyOpenProductDetail.ts
6
- /** 商品详情弹窗未回调时的兜底超时(避免 addProductWithFlow 永久 pending) */
7
- const OPEN_PRODUCT_DETAIL_TIMEOUT_MS = 12e4;
8
6
  const formatBundle = (bundle) => {
9
7
  if (!Array.isArray(bundle)) return [];
10
8
  return bundle.map((item) => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { bundle_product_id: item._bundle_product_id }));
@@ -31,12 +29,8 @@ function createLegacyOpenProductDetailHost(deps) {
31
29
  const settle = (fn) => {
32
30
  if (settled) return;
33
31
  settled = true;
34
- clearTimeout(timer);
35
32
  fn();
36
33
  };
37
- const timer = setTimeout(() => {
38
- settle(() => reject(/* @__PURE__ */ new Error("[SalesSdk] openProductDetail 超时:页面未响应 pisell1.handleOpenProductModal(请确认低代码页已注册该 action,且场次弹窗能正常打开)")));
39
- }, OPEN_PRODUCT_DETAIL_TIMEOUT_MS);
40
34
  action({
41
35
  type: "pisell1.handleOpenProductModal",
42
36
  data: {
@@ -54,7 +48,7 @@ function createLegacyOpenProductDetailHost(deps) {
54
48
  callback: (e, extension_type, detail) => {
55
49
  console.log(e, extension_type, detail, "detail1234");
56
50
  settle(() => resolve({
57
- e: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, e), {}, { bundle: formatBundle(e.bundle) }),
51
+ e: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, e), {}, { bundle: formatBundle(e === null || e === void 0 ? void 0 : e.bundle) }),
58
52
  extension_type,
59
53
  detail
60
54
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.157",
3
+ "version": "6.12.158",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -70,9 +70,9 @@
70
70
  "styled-components": "^6.0.0-rc.3",
71
71
  "use-sync-external-store": "^1.6.0",
72
72
  "@pisell/pi-payment-sdk": "0.0.3",
73
- "@pisell/utils": "3.0.4",
74
- "@pisell/materials": "6.12.44",
73
+ "@pisell/materials": "6.12.45",
75
74
  "@pisell/icon": "0.0.11",
75
+ "@pisell/utils": "3.0.4",
76
76
  "@pisell/date-picker": "3.0.10"
77
77
  },
78
78
  "peerDependencies": {