@pisell/private-materials 6.8.83 → 6.8.84

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 (134) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +10 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +9 -9
  11. package/es/components/booking/components/footer/index.d.ts +1 -0
  12. package/es/components/booking/info/index.d.ts +1 -0
  13. package/es/components/checkout/PaymentModal.js +4 -2
  14. package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
  15. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  16. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +120 -0
  17. package/es/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  18. package/es/components/eftposPay/aggregatePayment/index.js +3 -0
  19. package/es/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  20. package/es/components/eftposPay/aggregatePayment/service.js +69 -0
  21. package/es/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  22. package/es/components/eftposPay/aggregatePayment/types.js +65 -0
  23. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  24. package/es/components/eftposPay/aggregatePayment/utils/logs.js +371 -0
  25. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  26. package/es/components/eftposPay/aggregatePayment/utils/payment.js +1138 -0
  27. package/es/components/eftposPay/amount.d.ts +1 -1
  28. package/es/components/eftposPay/app.d.ts +1 -1
  29. package/es/components/eftposPay/app.js +5 -0
  30. package/es/components/eftposPay/component/fail/failCustom.js +16 -12
  31. package/es/components/eftposPay/component/fail/index.js +12 -5
  32. package/es/components/eftposPay/const.d.ts +6 -1
  33. package/es/components/eftposPay/const.js +3 -0
  34. package/es/components/eftposPay/device.d.ts +1 -1
  35. package/es/components/eftposPay/hooks.d.ts +3 -2
  36. package/es/components/eftposPay/hooks.js +12 -0
  37. package/es/components/eftposPay/huifu/Action.d.ts +8 -0
  38. package/es/components/eftposPay/huifu/Action.js +146 -0
  39. package/es/components/eftposPay/huifu/const.d.ts +5 -0
  40. package/es/components/eftposPay/huifu/const.js +70 -0
  41. package/es/components/eftposPay/huifu/hooks.d.ts +25 -0
  42. package/es/components/eftposPay/huifu/hooks.js +184 -0
  43. package/es/components/eftposPay/huifu/index.d.ts +5 -0
  44. package/es/components/eftposPay/huifu/index.js +196 -0
  45. package/es/components/eftposPay/huifu/index.less +180 -0
  46. package/es/components/eftposPay/huifu/types.d.ts +14 -0
  47. package/es/components/eftposPay/huifu/types.js +1 -0
  48. package/es/components/eftposPay/index.js +5 -1
  49. package/es/components/eftposPay/locales.d.ts +36 -0
  50. package/es/components/eftposPay/locales.js +42 -3
  51. package/es/components/eftposPay/manufacturer.d.ts +1 -0
  52. package/es/components/eftposPay/manufacturer.js +5 -0
  53. package/es/components/eftposPay/pay.js +6 -2
  54. package/es/components/eftposPay/store/index.d.ts +11 -4
  55. package/es/components/kioskSkuDetail/index.d.ts +3 -0
  56. package/es/components/kioskSkuDetail/index.js +266 -173
  57. package/es/components/kioskSkuDetail/index.less +49 -7
  58. package/es/components/kioskSkuDetail/locales.d.ts +6 -0
  59. package/es/components/kioskSkuDetail/locales.js +9 -3
  60. package/es/components/pay/toB/components/Cache/index.d.ts +1 -0
  61. package/es/components/pay/toB/components/EFTPOS/index.js +8 -1
  62. package/es/components/pay/toB/types/index.d.ts +1 -0
  63. package/es/components/pay/toC/PaymentList/serve.js +14 -0
  64. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  65. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  66. package/es/components/ticketBooking/index.d.ts +16 -0
  67. package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
  68. package/es/plus/skuOptionsSelection/locales.d.ts +3 -0
  69. package/es/plus/skuOptionsSelection/locales.js +3 -0
  70. package/es/pro/Login2.0/components/LoginCodeInput.js +36 -3
  71. package/es/pro/Login2.0/steps/CodeInput.js +37 -7
  72. package/lib/components/booking/components/footer/index.d.ts +1 -0
  73. package/lib/components/booking/info/index.d.ts +1 -0
  74. package/lib/components/checkout/PaymentModal.js +5 -2
  75. package/lib/components/checkout/components/PaymentOptionsModule/index.js +2 -1
  76. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +7 -0
  77. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +133 -0
  78. package/lib/components/eftposPay/aggregatePayment/index.d.ts +3 -0
  79. package/lib/components/eftposPay/aggregatePayment/index.js +42 -0
  80. package/lib/components/eftposPay/aggregatePayment/service.d.ts +24 -0
  81. package/lib/components/eftposPay/aggregatePayment/service.js +81 -0
  82. package/lib/components/eftposPay/aggregatePayment/types.d.ts +106 -0
  83. package/lib/components/eftposPay/aggregatePayment/types.js +74 -0
  84. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +110 -0
  85. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +294 -0
  86. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +139 -0
  87. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +752 -0
  88. package/lib/components/eftposPay/amount.d.ts +1 -1
  89. package/lib/components/eftposPay/app.d.ts +1 -1
  90. package/lib/components/eftposPay/app.js +5 -0
  91. package/lib/components/eftposPay/component/fail/failCustom.js +15 -9
  92. package/lib/components/eftposPay/component/fail/index.js +4 -1
  93. package/lib/components/eftposPay/const.d.ts +6 -1
  94. package/lib/components/eftposPay/const.js +3 -0
  95. package/lib/components/eftposPay/device.d.ts +1 -1
  96. package/lib/components/eftposPay/hooks.d.ts +3 -2
  97. package/lib/components/eftposPay/hooks.js +16 -0
  98. package/lib/components/eftposPay/huifu/Action.d.ts +8 -0
  99. package/lib/components/eftposPay/huifu/Action.js +174 -0
  100. package/lib/components/eftposPay/huifu/const.d.ts +5 -0
  101. package/lib/components/eftposPay/huifu/const.js +86 -0
  102. package/lib/components/eftposPay/huifu/hooks.d.ts +25 -0
  103. package/lib/components/eftposPay/huifu/hooks.js +186 -0
  104. package/lib/components/eftposPay/huifu/index.d.ts +5 -0
  105. package/lib/components/eftposPay/huifu/index.js +200 -0
  106. package/lib/components/eftposPay/huifu/index.less +180 -0
  107. package/lib/components/eftposPay/huifu/types.d.ts +14 -0
  108. package/lib/components/eftposPay/huifu/types.js +17 -0
  109. package/lib/components/eftposPay/index.js +5 -1
  110. package/lib/components/eftposPay/locales.d.ts +36 -0
  111. package/lib/components/eftposPay/locales.js +42 -3
  112. package/lib/components/eftposPay/manufacturer.d.ts +1 -0
  113. package/lib/components/eftposPay/manufacturer.js +7 -0
  114. package/lib/components/eftposPay/pay.js +3 -2
  115. package/lib/components/eftposPay/store/index.d.ts +11 -4
  116. package/lib/components/kioskSkuDetail/index.d.ts +3 -0
  117. package/lib/components/kioskSkuDetail/index.js +180 -113
  118. package/lib/components/kioskSkuDetail/index.less +49 -7
  119. package/lib/components/kioskSkuDetail/locales.d.ts +6 -0
  120. package/lib/components/kioskSkuDetail/locales.js +9 -3
  121. package/lib/components/pay/toB/components/Cache/index.d.ts +1 -0
  122. package/lib/components/pay/toB/components/EFTPOS/index.js +8 -1
  123. package/lib/components/pay/toB/types/index.d.ts +1 -0
  124. package/lib/components/pay/toC/PaymentList/serve.js +15 -0
  125. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +7 -6
  126. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  127. package/lib/components/ticketBooking/index.d.ts +16 -0
  128. package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +2 -0
  129. package/lib/plus/skuOptionsSelection/locales.d.ts +3 -0
  130. package/lib/plus/skuOptionsSelection/locales.js +3 -0
  131. package/lib/pro/Login2.0/components/LoginCodeInput.js +26 -4
  132. package/lib/pro/Login2.0/steps/CodeInput.js +27 -5
  133. package/lowcode/kiosk-sku-detail/meta.ts +229 -94
  134. package/package.json +1 -1
@@ -1,5 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
3
8
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
9
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
10
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -13,14 +18,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
18
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
19
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
15
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useEffect, useMemo, useState } from 'react';
21
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
17
22
  import Decimal from 'decimal.js';
18
23
  import classNames from 'classnames';
19
24
  import { Button } from '@pisell/materials';
20
25
  import dayjs from 'dayjs';
21
26
  import { locales } from '@pisell/utils';
22
27
  import SKUOptionsSelection from "../../plus/skuOptionsSelection";
23
- import PisellNumberSelector from "../../pro/pisellNumberSelector";
28
+ // import PisellNumberSelector from '../../pro/pisellNumberSelector';
24
29
  import useEngineContext from "../../hooks/useEngineContext";
25
30
  import { getProductDetail } from "../booking/info/service/serve";
26
31
  import localeTexts from "./locales";
@@ -34,10 +39,9 @@ import { request } from "../booking/utils";
34
39
  * - 底部用 PisellNumberSelector 做数量编辑
35
40
  */
36
41
  function KioskSkuDetail(props) {
37
- var _context$appHelper, _context$engine, _context$appHelper2, _store$getState, _store$getState2, _store$getState3;
42
+ var _ref, _context$appHelper, _context$engine, _context$appHelper2, _store$getState, _store$getState2, _store$getState3;
38
43
  var className = props.className,
39
44
  style = props.style,
40
- onBack = props.onBack,
41
45
  onAddToCart = props.onAddToCart;
42
46
 
43
47
  /**
@@ -49,13 +53,7 @@ function KioskSkuDetail(props) {
49
53
  keys: ['productId', 'product_id', 'id']
50
54
  });
51
55
  }, []);
52
-
53
- /**
54
- * @description 最终使用的商品 id
55
- * - 以 URL 为准(方便 kiosk 场景通过路由跳转直接带参)
56
- * - props.productId 作为兜底,兼容老用法
57
- */
58
- var resolvedProductId = productIdFromUrl !== null && productIdFromUrl !== void 0 ? productIdFromUrl : props.productId;
56
+ var initialProductId = (_ref = productIdFromUrl !== null && productIdFromUrl !== void 0 ? productIdFromUrl : props.productId) !== null && _ref !== void 0 ? _ref : null;
59
57
 
60
58
  /**
61
59
  * @description 目前 scheduleDate 暂时固定成“当天”
@@ -64,33 +62,22 @@ function KioskSkuDetail(props) {
64
62
  var scheduleDate = useMemo(function () {
65
63
  return dayjs().format('YYYY-MM-DD');
66
64
  }, []);
65
+ var stageScale = useDesignStageScale({
66
+ designWidth: 1080,
67
+ designHeight: 1800
68
+ });
67
69
  var context = useEngineContext();
68
- var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
69
- interaction = _ref.interaction;
70
+ var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
71
+ interaction = _ref2.interaction;
70
72
  locales.init(localeTexts, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || 'en');
71
73
  request.setRequest(context.appHelper.utils.request);
72
- var _ref2 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
73
- store = _ref2.store,
74
- getData = _ref2.getData;
74
+ var _ref3 = ((_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
75
+ store = _ref3.store,
76
+ getData = _ref3.getData,
77
+ Toast = _ref3.Toast;
75
78
  var state = store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : _store$getState.call(store);
76
79
  var symbol = (store === null || store === void 0 || (_store$getState2 = store.getState) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.call(store)) === null || _store$getState2 === void 0 || (_store$getState2 = _store$getState2.global) === null || _store$getState2 === void 0 ? void 0 : _store$getState2.symbol) || '$';
77
80
  var currency_code = (store === null || store === void 0 || (_store$getState3 = store.getState) === null || _store$getState3 === void 0 || (_store$getState3 = _store$getState3.call(store)) === null || _store$getState3 === void 0 || (_store$getState3 = _store$getState3.global) === null || _store$getState3 === void 0 ? void 0 : _store$getState3.currency_code) || 'AUD';
78
- useEffect(function () {
79
- var _interaction$utils, _interaction$utils$po;
80
- // 通知原生初始化
81
- interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
82
- module: 'tickets',
83
- key: 'page_load'
84
- });
85
- // 原生初始化调用-新购流程
86
- interaction.utils.mountFunction('tickets', 'restore_buy_wallet_pass', function (data) {
87
- console.log('重置状态', data);
88
- });
89
- // 原生初始化调用-购物车编辑
90
- interaction.utils.mountFunction('tickets', 'edit_buy_wallet_pass', function (data) {
91
- console.log('编辑状态', data);
92
- });
93
- }, []);
94
81
  var _useState = useState(false),
95
82
  _useState2 = _slicedToArray(_useState, 2),
96
83
  isLoading = _useState2[0],
@@ -125,90 +112,193 @@ function KioskSkuDetail(props) {
125
112
  _useState12 = _slicedToArray(_useState11, 2),
126
113
  skuDefaultValue = _useState12[0],
127
114
  setSkuDefaultValue = _useState12[1];
128
- useEffect(function () {
129
- var isCancelled = false;
130
- function load() {
131
- return _load.apply(this, arguments);
132
- }
133
- function _load() {
134
- _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
135
- var open_deposit, _params, res, apiData, normalizedProductId, minNumUnit, initialSkuValue;
136
- return _regeneratorRuntime().wrap(function _callee$(_context) {
137
- while (1) switch (_context.prev = _context.next) {
138
- case 0:
139
- if (resolvedProductId) {
140
- _context.next = 2;
141
- break;
142
- }
143
- return _context.abrupt("return");
144
- case 2:
145
- setIsLoading(true);
146
- setErrorText(null);
147
- _context.prev = 4;
148
- open_deposit = (getData === null || getData === void 0 ? void 0 : getData('bookingv2_deposit')) || 0;
149
- _params = {
150
- open_deposit: open_deposit
151
- };
152
- _params.schedule_date = scheduleDate;
153
- _context.next = 10;
154
- return getProductDetail(String(resolvedProductId), _params);
155
- case 10:
156
- res = _context.sent;
157
- apiData = (res === null || res === void 0 ? void 0 : res.data) || {};
158
- if (!isCancelled) {
159
- _context.next = 14;
160
- break;
161
- }
162
- return _context.abrupt("return");
163
- case 14:
164
- setProductData(apiData);
165
- normalizedProductId = Number((apiData === null || apiData === void 0 ? void 0 : apiData.product_id) || (apiData === null || apiData === void 0 ? void 0 : apiData.id) || resolvedProductId || 0);
166
- minNumUnit = Number((apiData === null || apiData === void 0 ? void 0 : apiData.min_num_unit) || 1);
115
+ var _useState13 = useState(false),
116
+ _useState14 = _slicedToArray(_useState13, 2),
117
+ isEdit = _useState14[0],
118
+ setIsEdit = _useState14[1];
119
+ var skuOptionsSelectionRef = useRef(null);
120
+ /**
121
+ * @description 防止“原生多次初始化/快速切换”导致请求乱序覆盖
122
+ */
123
+ var requestSeqRef = useRef(0);
124
+ var resetForInit = useCallback(function () {
125
+ setProductData(null);
126
+ setErrorText(null);
127
+ setQuantity(1);
128
+ setSkuValue({
129
+ product_id: 0,
130
+ product_variant_id: 0,
131
+ bundle: [],
132
+ option: []
133
+ });
134
+ setSkuDefaultValue({
135
+ product_id: 0,
136
+ product_variant_id: 0,
137
+ bundle: [],
138
+ option: []
139
+ });
140
+ }, []);
141
+ var loadByProductId = useCallback( /*#__PURE__*/function () {
142
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(productId) {
143
+ var options,
144
+ reqId,
145
+ open_deposit,
146
+ _params,
147
+ res,
148
+ apiData,
149
+ normalizedProductId,
150
+ minNumUnit,
151
+ defaultVariantId,
152
+ initialSkuValue,
153
+ _args = arguments;
154
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
155
+ while (1) switch (_context.prev = _context.next) {
156
+ case 0:
157
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
158
+ console.log('准备 load', productId);
159
+ if (!(productId === null || typeof productId === 'undefined' || productId === '')) {
160
+ _context.next = 4;
161
+ break;
162
+ }
163
+ return _context.abrupt("return");
164
+ case 4:
165
+ reqId = ++requestSeqRef.current;
166
+ setIsLoading(true);
167
+ setErrorText(null);
168
+ _context.prev = 7;
169
+ open_deposit = (getData === null || getData === void 0 ? void 0 : getData('bookingv2_deposit')) || 0;
170
+ _params = {
171
+ open_deposit: open_deposit
172
+ };
173
+ _params.schedule_date = scheduleDate;
174
+ _context.next = 13;
175
+ return getProductDetail(String(productId), _params);
176
+ case 13:
177
+ res = _context.sent;
178
+ console.log('详情接口');
179
+ console.log(JSON.stringify(res));
180
+ apiData = (res !== null && res !== void 0 && res.id ? res : res === null || res === void 0 ? void 0 : res.data) || {};
181
+ if (!(reqId !== requestSeqRef.current)) {
182
+ _context.next = 19;
183
+ break;
184
+ }
185
+ return _context.abrupt("return");
186
+ case 19:
187
+ setProductData(apiData);
188
+ console.log('已设置 productData');
189
+ normalizedProductId = Number((apiData === null || apiData === void 0 ? void 0 : apiData.product_id) || (apiData === null || apiData === void 0 ? void 0 : apiData.id) || productId || 0);
190
+ minNumUnit = Number((apiData === null || apiData === void 0 ? void 0 : apiData.min_num_unit) || 1);
191
+ if (options.shouldInitQuantity !== false) {
167
192
  setQuantity(minNumUnit > 0 ? minNumUnit : 1);
168
- initialSkuValue = {
169
- product_id: normalizedProductId,
170
- product_variant_id: 0,
171
- bundle: [],
172
- option: []
173
- };
193
+ }
194
+
195
+ /**
196
+ * @description 默认选中第一个 variant(如果接口返回了 variant 且有数据)
197
+ * 注意:本组件内部用 variant 的 `id` 来匹配 `skuValue.product_variant_id`
198
+ */
199
+ defaultVariantId = function (_apiData$variant) {
200
+ var firstVariantId = Array.isArray(apiData === null || apiData === void 0 ? void 0 : apiData.variant) ? Number((apiData === null || apiData === void 0 || (_apiData$variant = apiData.variant) === null || _apiData$variant === void 0 || (_apiData$variant = _apiData$variant[0]) === null || _apiData$variant === void 0 ? void 0 : _apiData$variant.id) || 0) : 0;
201
+ return Number.isFinite(firstVariantId) ? firstVariantId : 0;
202
+ }();
203
+ initialSkuValue = {
204
+ product_id: normalizedProductId,
205
+ product_variant_id: defaultVariantId,
206
+ bundle: [],
207
+ option: []
208
+ };
209
+ if (options.shouldInitSku !== false) {
174
210
  setSkuValue(initialSkuValue);
175
211
  setSkuDefaultValue(initialSkuValue);
176
- _context.next = 29;
212
+ setTimeout(function () {
213
+ if (initialSkuValue.product_variant_id) {
214
+ var _skuOptionsSelectionR;
215
+ (_skuOptionsSelectionR = skuOptionsSelectionRef.current) === null || _skuOptionsSelectionR === void 0 || _skuOptionsSelectionR.validate();
216
+ }
217
+ }, 0);
218
+ }
219
+ _context.next = 33;
220
+ break;
221
+ case 29:
222
+ _context.prev = 29;
223
+ _context.t0 = _context["catch"](7);
224
+ console.error(_context.t0);
225
+ setErrorText('Failed to load product detail');
226
+ case 33:
227
+ _context.prev = 33;
228
+ if (!(reqId !== requestSeqRef.current)) {
229
+ _context.next = 36;
177
230
  break;
178
- case 23:
179
- _context.prev = 23;
180
- _context.t0 = _context["catch"](4);
181
- console.error(_context.t0);
182
- if (!isCancelled) {
183
- _context.next = 28;
184
- break;
185
- }
186
- return _context.abrupt("return");
187
- case 28:
188
- setErrorText('Failed to load product detail');
189
- case 29:
190
- _context.prev = 29;
191
- if (!isCancelled) {
192
- _context.next = 32;
193
- break;
194
- }
195
- return _context.abrupt("return");
196
- case 32:
197
- setIsLoading(false);
198
- return _context.finish(29);
199
- case 34:
200
- case "end":
201
- return _context.stop();
202
- }
203
- }, _callee, null, [[4, 23, 29, 34]]);
204
- }));
205
- return _load.apply(this, arguments);
206
- }
207
- load();
208
- return function () {
209
- isCancelled = true;
231
+ }
232
+ return _context.abrupt("return");
233
+ case 36:
234
+ setIsLoading(false);
235
+ return _context.finish(33);
236
+ case 38:
237
+ case "end":
238
+ return _context.stop();
239
+ }
240
+ }, _callee, null, [[7, 29, 33, 38]]);
241
+ }));
242
+ return function (_x) {
243
+ return _ref4.apply(this, arguments);
210
244
  };
211
- }, [getData, resolvedProductId, scheduleDate]);
245
+ }(), [getData, scheduleDate]);
246
+
247
+ // 避免 mountFunction 回调捕获旧的 loadByProductId(不用额外 useEffect)
248
+ var loadRef = useRef(loadByProductId);
249
+ loadRef.current = loadByProductId;
250
+ useEffect(function () {
251
+ var _interaction$utils, _interaction$utils$po, _interaction$utils2, _interaction$utils2$m, _interaction$utils3, _interaction$utils3$m;
252
+ // 通知原生初始化
253
+ interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
254
+ module: 'wallet_pass',
255
+ key: 'page_load'
256
+ });
257
+ // 原生初始化调用-新购流程
258
+ interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$m = _interaction$utils2.mountFunction) === null || _interaction$utils2$m === void 0 || _interaction$utils2$m.call(_interaction$utils2, 'wallet_pass', 'restore_buy_wallet_pass', function (id) {
259
+ console.log('重置状态', id);
260
+ console.log('宽', window.innerWidth);
261
+ console.log('高', window.innerHeight);
262
+ console.log('设备像素比', window.devicePixelRatio);
263
+ // 原生会预渲染页面,真正展示时再调用这里;该方法可能被多次调用
264
+ resetForInit();
265
+
266
+ // 原生回调入参就是 productId:直接触发加载(不走“state→effect”链)
267
+ if (id || id === 0) loadRef.current(id);
268
+ setIsEdit(false);
269
+ });
270
+ // 原生初始化调用-购物车编辑
271
+ interaction === null || interaction === void 0 || (_interaction$utils3 = interaction.utils) === null || _interaction$utils3 === void 0 || (_interaction$utils3$m = _interaction$utils3.mountFunction) === null || _interaction$utils3$m === void 0 || _interaction$utils3$m.call(_interaction$utils3, 'wallet_pass', 'edit_buy_wallet_pass', function (data) {
272
+ console.log('编辑状态', data);
273
+ var productData = JSON.parse(data);
274
+ /**
275
+ * @description 编辑态原生只会触发 edit_buy_wallet_pass
276
+ * - 这里需要主动 load 一次拿到最新详情(尤其是 variant 列表/价格)
277
+ * - 但不能覆盖原生传入的 variantId / quantity
278
+ */
279
+ setProductData(productData.productDetail);
280
+ loadRef.current(productData.productDetail.id, {
281
+ shouldInitSku: false,
282
+ shouldInitQuantity: false
283
+ });
284
+ setSkuValue({
285
+ product_id: productData.productDetail.id,
286
+ product_variant_id: Number(productData.variantId),
287
+ bundle: [],
288
+ option: []
289
+ });
290
+ setSkuDefaultValue({
291
+ product_id: productData.productDetail.id,
292
+ product_variant_id: Number(productData.variantId),
293
+ bundle: [],
294
+ option: []
295
+ });
296
+ setIsEdit(true);
297
+ });
298
+
299
+ // URL 有 productId:挂载时只加载一次
300
+ if (initialProductId || initialProductId === 0) loadRef.current(initialProductId);
301
+ }, []);
212
302
  var coverUrl = useMemo(function () {
213
303
  return (productData === null || productData === void 0 ? void 0 : productData.cover) || (productData === null || productData === void 0 ? void 0 : productData.image) || '';
214
304
  }, [productData]);
@@ -263,65 +353,50 @@ function KioskSkuDetail(props) {
263
353
  return "".concat(priceSign).concat(symbol).concat(deTotal.abs().toNumber().toFixed(2));
264
354
  }, [itemTotal, symbol]);
265
355
  var handleAddToCart = function handleAddToCart() {
356
+ var _skuOptionsSelectionR2;
266
357
  if (!productData) return;
267
- // onAddToCart?.({
268
- // product: productData,
269
- // skuValue,
270
- // quantity,
271
- // unitPrice,
272
- // total: itemTotal,
273
- // currencySymbol: symbol,
274
- // bookingConfig: state?.bookingConfig,
275
- // });
276
- var productBundle = [];
277
- skuValue.bundle.forEach(function (item) {
278
- if (!item.num || item.num < 1) return;
279
- var targetBundleData;
280
- var bundle_group_id;
281
- for (var i = 0; i < productData.bundle_group.length; i++) {
282
- var _productData$bundle_g = productData.bundle_group[i],
283
- id = _productData$bundle_g.id,
284
- _productData$bundle_g2 = _productData$bundle_g.bundle_item,
285
- bundle_item = _productData$bundle_g2 === void 0 ? [] : _productData$bundle_g2;
286
- for (var j = 0; j < bundle_item.length; j++) {
287
- if (item.id === bundle_item[j].bundle_product_id) {
288
- bundle_group_id = id;
289
- targetBundleData = bundle_item[j];
290
- break;
291
- }
292
- }
293
- }
294
- productBundle.push({
295
- bundle_group_id: bundle_group_id,
296
- bundle_id: targetBundleData.id,
297
- bundle_product_id: item.id,
298
- bundle_variant_id: targetBundleData.bundle_variant_id,
299
- num: item.num,
300
- extension_id: targetBundleData.extension_id,
301
- extension_type: targetBundleData.extension_type
302
- });
303
- });
304
- productData.option_group = [];
305
- productData.variant_group = [];
358
+ (_skuOptionsSelectionR2 = skuOptionsSelectionRef.current) === null || _skuOptionsSelectionR2 === void 0 || _skuOptionsSelectionR2.validate();
359
+ if (!skuValue.product_variant_id) {
360
+ Toast.info(locales.getText('pisell2.text.kiosk.sku.detail.toast.select.variant'));
361
+ return;
362
+ }
363
+ ;
306
364
  var obj = {
307
365
  productDetail: productData,
308
366
  quantity: quantity,
367
+ variantId: skuValue.product_variant_id,
309
368
  pricePerUnit: unitPrice,
310
- bundlePrice: productData.price,
311
- productBundle: productBundle
369
+ isWebBuyWalletPass: true
312
370
  };
313
371
  interaction.utils.postMessageToApp({
314
- module: 'tickets',
372
+ module: 'wallet_pass',
315
373
  key: 'buy_wallet_pass',
316
374
  data: {
317
375
  // 把洗好的数据放这里
318
- productData: [obj]
376
+ productData: obj,
377
+ isEdit: isEdit
319
378
  }
320
379
  });
321
380
  };
381
+ var onBack = function onBack() {
382
+ interaction.utils.postMessageToApp({
383
+ module: "wallet_pass",
384
+ key: "back"
385
+ });
386
+ };
387
+ var stageStyle = useMemo(function () {
388
+ return _objectSpread(_objectSpread({}, style || {}), {}, {
389
+ width: 1080,
390
+ height: 1800,
391
+ transform: "translateX(-50%) scale(".concat(stageScale, ")"),
392
+ transformOrigin: 'top center'
393
+ });
394
+ }, [stageScale, style]);
322
395
  return /*#__PURE__*/React.createElement("div", {
396
+ className: "pisell-kiosk-sku-detail-viewport"
397
+ }, /*#__PURE__*/React.createElement("div", {
323
398
  className: classNames('pisell-kiosk-sku-detail', className),
324
- style: style
399
+ style: stageStyle
325
400
  }, /*#__PURE__*/React.createElement("div", {
326
401
  className: "pisell-kiosk-sku-detail__content"
327
402
  }, /*#__PURE__*/React.createElement("div", {
@@ -349,7 +424,8 @@ function KioskSkuDetail(props) {
349
424
  className: "pisell-kiosk-sku-detail__error"
350
425
  }, errorText)), /*#__PURE__*/React.createElement("div", {
351
426
  className: "pisell-kiosk-sku-detail__options-card"
352
- }, productData ? /*#__PURE__*/React.createElement(SKUOptionsSelection, {
427
+ }, productData && Array.isArray(productData === null || productData === void 0 ? void 0 : productData.variant) && productData.variant.length > 0 ? /*#__PURE__*/React.createElement(SKUOptionsSelection, {
428
+ ref: skuOptionsSelectionRef,
353
429
  dataSource: productData,
354
430
  value: skuDefaultValue,
355
431
  skuCardConfig: {
@@ -374,27 +450,13 @@ function KioskSkuDetail(props) {
374
450
  className: "pisell-kiosk-sku-detail__footer-center"
375
451
  }, /*#__PURE__*/React.createElement("div", {
376
452
  className: "pisell-kiosk-sku-detail__item-total"
377
- }, locales.getText('pisell2.text.kiosk.sku.detail.item.total'), ":", ' ', itemTotalText), /*#__PURE__*/React.createElement("div", {
378
- className: "pisell-kiosk-sku-detail__qty"
379
- }, /*#__PURE__*/React.createElement(PisellNumberSelector, {
380
- value: quantity,
381
- width: "140px",
382
- onChange: function onChange(v) {
383
- if (!v) return;
384
- setQuantity(v);
385
- },
386
- min: 1,
387
- max: 99999,
388
- step: 1,
389
- size: "large",
390
- enablePriceAdjust: false
391
- }))), /*#__PURE__*/React.createElement(Button, {
453
+ }, locales.getText('pisell2.text.kiosk.sku.detail.item.total'), ":", ' ', itemTotalText)), /*#__PURE__*/React.createElement(Button, {
392
454
  type: "primary",
393
455
  className: "pisell-kiosk-sku-detail__add-btn",
394
456
  size: "large",
395
457
  onClick: handleAddToCart,
396
458
  disabled: !productData || isLoading
397
- }, locales.getText('pisell2.text.kiosk.sku.detail.btn.add.to.cart'))));
459
+ }, locales.getText(isEdit ? 'pisell2.text.kiosk.sku.detail.btn.update' : 'pisell2.text.kiosk.sku.detail.btn.add.to.cart')))));
398
460
  }
399
461
  export default KioskSkuDetail;
400
462
 
@@ -433,4 +495,35 @@ function getQueryFirstMatch(params) {
433
495
  var queryIndex = hash.indexOf('?');
434
496
  if (queryIndex === -1) return null;
435
497
  return tryRead(hash.slice(queryIndex + 1));
436
- }
498
+ }
499
+
500
+ /**
501
+ * @description 按设计稿基准尺寸(默认 1080x1800)计算页面缩放比例
502
+ * - scale = min(viewportW/designW, viewportH/designH, 1)
503
+ */
504
+ function useDesignStageScale(params) {
505
+ var designWidth = params.designWidth;
506
+ var designHeight = params.designHeight;
507
+ var _useState15 = useState(1),
508
+ _useState16 = _slicedToArray(_useState15, 2),
509
+ scale = _useState16[0],
510
+ setScale = _useState16[1];
511
+ useEffect(function () {
512
+ var update = function update() {
513
+ var viewportWidth = window.innerWidth || designWidth;
514
+ var viewportHeight = window.innerHeight || designHeight;
515
+ var nextScale = Math.min(viewportWidth / designWidth, viewportHeight / designHeight, 1);
516
+ setScale(nextScale);
517
+ };
518
+ update();
519
+ window.addEventListener('resize', update);
520
+ return function () {
521
+ return window.removeEventListener('resize', update);
522
+ };
523
+ }, [designHeight, designWidth]);
524
+ return scale;
525
+ }
526
+
527
+ /**
528
+ * @description 从原生回调 payload 中提取 productId
529
+ */
@@ -1,7 +1,17 @@
1
- .pisell-kiosk-sku-detail {
1
+ .pisell-kiosk-sku-detail-viewport {
2
2
  position: relative;
3
- width: 100%;
3
+ width: 100vw;
4
4
  height: 100vh;
5
+ overflow: hidden;
6
+ background: #f2f4f7;
7
+ }
8
+
9
+ .pisell-kiosk-sku-detail {
10
+ position: absolute;
11
+ top: 0;
12
+ left: 50%;
13
+ width: 1080px;
14
+ height: 1800px;
5
15
  overflow-y: auto;
6
16
  background: #f2f4f7;
7
17
  background-size: cover;
@@ -11,12 +21,40 @@
11
21
  }
12
22
 
13
23
  .pisell-kiosk-sku-detail__content {
14
- max-width: 1000px;
24
+ width: 100%;
15
25
  margin: 0 auto;
16
26
  display: flex;
17
27
  flex-direction: column;
18
28
  gap: 40px;
19
29
  padding-bottom: 220px; // avoid overlap with footer
30
+ .pisell-pro-selector_header-content {
31
+ .pisell-pro-selector_header-content-title {
32
+ color: #101828;
33
+ font-size: 36px !important;
34
+ }
35
+ .pisell-lowcode-tag {
36
+ font-size: 22px !important;
37
+ margin-left: 20px !important;
38
+ padding-top: 5px !important;
39
+ padding-bottom: 5px !important;
40
+ }
41
+ }
42
+ .pisell-pro-selector_tip {
43
+ font-size: 36px !important;
44
+ color: #667085;
45
+ }
46
+ .pisell-sku-options-selection-variant-card__title {
47
+ font-size: 36px !important;
48
+ font-weight: 600 !important;
49
+ color: #101828;
50
+ }
51
+ .pisell-sku-options-selection-variant-card__price {
52
+ font-size: 30px !important;
53
+ }
54
+ .pisell-sku-options-selection-variant-card {
55
+ padding-top: 30px !important;
56
+ padding-bottom: 30px !important;
57
+ }
20
58
  }
21
59
 
22
60
  .pisell-kiosk-sku-detail__hero {
@@ -55,7 +93,6 @@
55
93
  }
56
94
 
57
95
  .pisell-kiosk-sku-detail__desc {
58
- max-width: 860px;
59
96
  font-size: 36px;
60
97
  line-height: 44px;
61
98
  font-weight: 400;
@@ -91,11 +128,13 @@
91
128
  }
92
129
 
93
130
  .pisell-kiosk-sku-detail__footer {
131
+ // 注意:父容器有 transform(scale),fixed 会相对该容器定位(适配小分辨率缩放舞台)
94
132
  position: fixed;
95
- left: 50%;
133
+ left: 30px;
134
+ right: 30px;
96
135
  bottom: 30px;
97
- transform: translateX(-50%);
98
- width: min(1020px, calc(100% - 60px));
136
+ transform: none;
137
+ width: auto;
99
138
  display: flex;
100
139
  align-items: center;
101
140
  justify-content: space-between;
@@ -125,6 +164,9 @@
125
164
  display: flex;
126
165
  align-items: center;
127
166
  gap: 20px;
167
+ // 靠右,并与右侧主按钮保持 20px 间距
168
+ margin-left: auto;
169
+ margin-right: 20px;
128
170
  }
129
171
 
130
172
  .pisell-kiosk-sku-detail__item-total {
@@ -3,19 +3,25 @@ declare const _default: {
3
3
  'pisell2.text.kiosk.sku.detail.btn.back': string;
4
4
  'pisell2.text.kiosk.sku.detail.item.total': string;
5
5
  'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
6
+ 'pisell2.text.kiosk.sku.detail.btn.update': string;
6
7
  'pisell2.text.kiosk.sku.detail.loading.options': string;
8
+ 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
7
9
  };
8
10
  'zh-CN': {
9
11
  'pisell2.text.kiosk.sku.detail.btn.back': string;
10
12
  'pisell2.text.kiosk.sku.detail.item.total': string;
11
13
  'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
14
+ 'pisell2.text.kiosk.sku.detail.btn.update': string;
12
15
  'pisell2.text.kiosk.sku.detail.loading.options': string;
16
+ 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
13
17
  };
14
18
  'zh-TW': {
15
19
  'pisell2.text.kiosk.sku.detail.btn.back': string;
16
20
  'pisell2.text.kiosk.sku.detail.item.total': string;
17
21
  'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
22
+ 'pisell2.text.kiosk.sku.detail.btn.update': string;
18
23
  'pisell2.text.kiosk.sku.detail.loading.options': string;
24
+ 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
19
25
  };
20
26
  };
21
27
  export default _default;