@pisell/private-materials 6.8.76 → 6.8.77

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 (124) 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 +7 -7
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +9 -9
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/checkout/PaymentModal.js +32 -8
  12. package/es/components/checkout/components/PaymentOptionsModule/index.js +1 -1
  13. package/es/components/eftposPay/amount.d.ts +1 -1
  14. package/es/components/eftposPay/app.d.ts +1 -1
  15. package/es/components/eftposPay/app.js +0 -5
  16. package/es/components/eftposPay/component/fail/failCustom.js +12 -16
  17. package/es/components/eftposPay/component/fail/index.js +5 -12
  18. package/es/components/eftposPay/const.d.ts +1 -6
  19. package/es/components/eftposPay/const.js +0 -3
  20. package/es/components/eftposPay/device.d.ts +1 -1
  21. package/es/components/eftposPay/hooks.d.ts +2 -3
  22. package/es/components/eftposPay/hooks.js +0 -12
  23. package/es/components/eftposPay/index.js +1 -5
  24. package/es/components/eftposPay/locales.d.ts +0 -36
  25. package/es/components/eftposPay/locales.js +3 -42
  26. package/es/components/eftposPay/manufacturer.d.ts +0 -1
  27. package/es/components/eftposPay/manufacturer.js +0 -5
  28. package/es/components/eftposPay/pay.js +2 -6
  29. package/es/components/eftposPay/store/index.d.ts +5 -12
  30. package/es/components/kioskSkuDetail/index.d.ts +0 -3
  31. package/es/components/kioskSkuDetail/index.js +173 -266
  32. package/es/components/kioskSkuDetail/index.less +7 -49
  33. package/es/components/kioskSkuDetail/locales.d.ts +0 -6
  34. package/es/components/kioskSkuDetail/locales.js +3 -9
  35. package/es/components/pay/toB/components/EFTPOS/index.js +1 -8
  36. package/es/components/pay/toB/types/index.d.ts +0 -1
  37. package/es/components/pay/toC/PaymentList/serve.js +0 -14
  38. package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -7
  39. package/es/plus/skuOptionsSelection/components/VariantCard/index.js +1 -1
  40. package/es/plus/skuOptionsSelection/locales.d.ts +0 -3
  41. package/es/plus/skuOptionsSelection/locales.js +0 -3
  42. package/es/pro/Login2.0/components/LoginCodeInput.js +3 -36
  43. package/es/pro/Login2.0/steps/CodeInput.js +7 -37
  44. package/lib/components/checkout/PaymentModal.js +41 -24
  45. package/lib/components/checkout/components/PaymentOptionsModule/index.js +1 -2
  46. package/lib/components/eftposPay/amount.d.ts +1 -1
  47. package/lib/components/eftposPay/app.d.ts +1 -1
  48. package/lib/components/eftposPay/app.js +0 -5
  49. package/lib/components/eftposPay/component/fail/failCustom.js +9 -15
  50. package/lib/components/eftposPay/component/fail/index.js +1 -4
  51. package/lib/components/eftposPay/const.d.ts +1 -6
  52. package/lib/components/eftposPay/const.js +0 -3
  53. package/lib/components/eftposPay/device.d.ts +1 -1
  54. package/lib/components/eftposPay/hooks.d.ts +2 -3
  55. package/lib/components/eftposPay/hooks.js +0 -16
  56. package/lib/components/eftposPay/index.js +1 -5
  57. package/lib/components/eftposPay/locales.d.ts +0 -36
  58. package/lib/components/eftposPay/locales.js +3 -42
  59. package/lib/components/eftposPay/manufacturer.d.ts +0 -1
  60. package/lib/components/eftposPay/manufacturer.js +0 -7
  61. package/lib/components/eftposPay/pay.js +2 -3
  62. package/lib/components/eftposPay/store/index.d.ts +5 -12
  63. package/lib/components/kioskSkuDetail/index.d.ts +0 -3
  64. package/lib/components/kioskSkuDetail/index.js +113 -180
  65. package/lib/components/kioskSkuDetail/index.less +7 -49
  66. package/lib/components/kioskSkuDetail/locales.d.ts +0 -6
  67. package/lib/components/kioskSkuDetail/locales.js +3 -9
  68. package/lib/components/pay/toB/components/EFTPOS/index.js +1 -8
  69. package/lib/components/pay/toB/types/index.d.ts +0 -1
  70. package/lib/components/pay/toC/PaymentList/serve.js +0 -15
  71. package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -7
  72. package/lib/plus/skuOptionsSelection/components/VariantCard/index.js +0 -2
  73. package/lib/plus/skuOptionsSelection/locales.d.ts +0 -3
  74. package/lib/plus/skuOptionsSelection/locales.js +0 -3
  75. package/lib/pro/Login2.0/components/LoginCodeInput.js +4 -26
  76. package/lib/pro/Login2.0/steps/CodeInput.js +5 -27
  77. package/lowcode/kiosk-sku-detail/meta.ts +94 -229
  78. package/package.json +8 -2
  79. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +0 -7
  80. package/es/components/eftposPay/aggregatePayment/hooks/useMicropay.js +0 -120
  81. package/es/components/eftposPay/aggregatePayment/index.d.ts +0 -3
  82. package/es/components/eftposPay/aggregatePayment/index.js +0 -3
  83. package/es/components/eftposPay/aggregatePayment/service.d.ts +0 -24
  84. package/es/components/eftposPay/aggregatePayment/service.js +0 -69
  85. package/es/components/eftposPay/aggregatePayment/types.d.ts +0 -106
  86. package/es/components/eftposPay/aggregatePayment/types.js +0 -65
  87. package/es/components/eftposPay/aggregatePayment/utils/logs.d.ts +0 -110
  88. package/es/components/eftposPay/aggregatePayment/utils/logs.js +0 -371
  89. package/es/components/eftposPay/aggregatePayment/utils/payment.d.ts +0 -139
  90. package/es/components/eftposPay/aggregatePayment/utils/payment.js +0 -1138
  91. package/es/components/eftposPay/huifu/Action.d.ts +0 -8
  92. package/es/components/eftposPay/huifu/Action.js +0 -146
  93. package/es/components/eftposPay/huifu/const.d.ts +0 -5
  94. package/es/components/eftposPay/huifu/const.js +0 -70
  95. package/es/components/eftposPay/huifu/hooks.d.ts +0 -25
  96. package/es/components/eftposPay/huifu/hooks.js +0 -184
  97. package/es/components/eftposPay/huifu/index.d.ts +0 -5
  98. package/es/components/eftposPay/huifu/index.js +0 -196
  99. package/es/components/eftposPay/huifu/index.less +0 -180
  100. package/es/components/eftposPay/huifu/types.d.ts +0 -14
  101. package/es/components/eftposPay/huifu/types.js +0 -1
  102. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.d.ts +0 -7
  103. package/lib/components/eftposPay/aggregatePayment/hooks/useMicropay.js +0 -133
  104. package/lib/components/eftposPay/aggregatePayment/index.d.ts +0 -3
  105. package/lib/components/eftposPay/aggregatePayment/index.js +0 -42
  106. package/lib/components/eftposPay/aggregatePayment/service.d.ts +0 -24
  107. package/lib/components/eftposPay/aggregatePayment/service.js +0 -81
  108. package/lib/components/eftposPay/aggregatePayment/types.d.ts +0 -106
  109. package/lib/components/eftposPay/aggregatePayment/types.js +0 -74
  110. package/lib/components/eftposPay/aggregatePayment/utils/logs.d.ts +0 -110
  111. package/lib/components/eftposPay/aggregatePayment/utils/logs.js +0 -294
  112. package/lib/components/eftposPay/aggregatePayment/utils/payment.d.ts +0 -139
  113. package/lib/components/eftposPay/aggregatePayment/utils/payment.js +0 -752
  114. package/lib/components/eftposPay/huifu/Action.d.ts +0 -8
  115. package/lib/components/eftposPay/huifu/Action.js +0 -174
  116. package/lib/components/eftposPay/huifu/const.d.ts +0 -5
  117. package/lib/components/eftposPay/huifu/const.js +0 -86
  118. package/lib/components/eftposPay/huifu/hooks.d.ts +0 -25
  119. package/lib/components/eftposPay/huifu/hooks.js +0 -186
  120. package/lib/components/eftposPay/huifu/index.d.ts +0 -5
  121. package/lib/components/eftposPay/huifu/index.js +0 -200
  122. package/lib/components/eftposPay/huifu/index.less +0 -180
  123. package/lib/components/eftposPay/huifu/types.d.ts +0 -14
  124. package/lib/components/eftposPay/huifu/types.js +0 -17
@@ -1,10 +1,5 @@
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); }
8
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
4
  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."); }
10
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -18,14 +13,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
18
13
  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; }
19
14
  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; } }
20
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
16
+ import React, { useEffect, useMemo, useState } from 'react';
22
17
  import Decimal from 'decimal.js';
23
18
  import classNames from 'classnames';
24
19
  import { Button } from '@pisell/materials';
25
20
  import dayjs from 'dayjs';
26
21
  import { locales } from '@pisell/utils';
27
22
  import SKUOptionsSelection from "../../plus/skuOptionsSelection";
28
- // import PisellNumberSelector from '../../pro/pisellNumberSelector';
23
+ import PisellNumberSelector from "../../pro/pisellNumberSelector";
29
24
  import useEngineContext from "../../hooks/useEngineContext";
30
25
  import { getProductDetail } from "../booking/info/service/serve";
31
26
  import localeTexts from "./locales";
@@ -39,9 +34,10 @@ import { request } from "../booking/utils";
39
34
  * - 底部用 PisellNumberSelector 做数量编辑
40
35
  */
41
36
  function KioskSkuDetail(props) {
42
- var _ref, _context$appHelper, _context$engine, _context$appHelper2, _store$getState, _store$getState2, _store$getState3;
37
+ var _context$appHelper, _context$engine, _context$appHelper2, _store$getState, _store$getState2, _store$getState3;
43
38
  var className = props.className,
44
39
  style = props.style,
40
+ onBack = props.onBack,
45
41
  onAddToCart = props.onAddToCart;
46
42
 
47
43
  /**
@@ -53,7 +49,13 @@ function KioskSkuDetail(props) {
53
49
  keys: ['productId', 'product_id', 'id']
54
50
  });
55
51
  }, []);
56
- var initialProductId = (_ref = productIdFromUrl !== null && productIdFromUrl !== void 0 ? productIdFromUrl : props.productId) !== null && _ref !== void 0 ? _ref : null;
52
+
53
+ /**
54
+ * @description 最终使用的商品 id
55
+ * - 以 URL 为准(方便 kiosk 场景通过路由跳转直接带参)
56
+ * - props.productId 作为兜底,兼容老用法
57
+ */
58
+ var resolvedProductId = productIdFromUrl !== null && productIdFromUrl !== void 0 ? productIdFromUrl : props.productId;
57
59
 
58
60
  /**
59
61
  * @description 目前 scheduleDate 暂时固定成“当天”
@@ -62,22 +64,33 @@ function KioskSkuDetail(props) {
62
64
  var scheduleDate = useMemo(function () {
63
65
  return dayjs().format('YYYY-MM-DD');
64
66
  }, []);
65
- var stageScale = useDesignStageScale({
66
- designWidth: 1080,
67
- designHeight: 1800
68
- });
69
67
  var context = useEngineContext();
70
- var _ref2 = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
71
- interaction = _ref2.interaction;
68
+ var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
69
+ interaction = _ref.interaction;
72
70
  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');
73
71
  request.setRequest(context.appHelper.utils.request);
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;
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;
78
75
  var state = store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : _store$getState.call(store);
79
76
  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) || '$';
80
77
  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
+ }, []);
81
94
  var _useState = useState(false),
82
95
  _useState2 = _slicedToArray(_useState, 2),
83
96
  isLoading = _useState2[0],
@@ -112,193 +125,90 @@ function KioskSkuDetail(props) {
112
125
  _useState12 = _slicedToArray(_useState11, 2),
113
126
  skuDefaultValue = _useState12[0],
114
127
  setSkuDefaultValue = _useState12[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) {
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);
192
167
  setQuantity(minNumUnit > 0 ? minNumUnit : 1);
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) {
168
+ initialSkuValue = {
169
+ product_id: normalizedProductId,
170
+ product_variant_id: 0,
171
+ bundle: [],
172
+ option: []
173
+ };
210
174
  setSkuValue(initialSkuValue);
211
175
  setSkuDefaultValue(initialSkuValue);
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;
176
+ _context.next = 29;
230
177
  break;
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);
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;
244
210
  };
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
- }, []);
211
+ }, [getData, resolvedProductId, scheduleDate]);
302
212
  var coverUrl = useMemo(function () {
303
213
  return (productData === null || productData === void 0 ? void 0 : productData.cover) || (productData === null || productData === void 0 ? void 0 : productData.image) || '';
304
214
  }, [productData]);
@@ -353,50 +263,65 @@ function KioskSkuDetail(props) {
353
263
  return "".concat(priceSign).concat(symbol).concat(deTotal.abs().toNumber().toFixed(2));
354
264
  }, [itemTotal, symbol]);
355
265
  var handleAddToCart = function handleAddToCart() {
356
- var _skuOptionsSelectionR2;
357
266
  if (!productData) return;
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
- ;
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 = [];
364
306
  var obj = {
365
307
  productDetail: productData,
366
308
  quantity: quantity,
367
- variantId: skuValue.product_variant_id,
368
309
  pricePerUnit: unitPrice,
369
- isWebBuyWalletPass: true
310
+ bundlePrice: productData.price,
311
+ productBundle: productBundle
370
312
  };
371
313
  interaction.utils.postMessageToApp({
372
- module: 'wallet_pass',
314
+ module: 'tickets',
373
315
  key: 'buy_wallet_pass',
374
316
  data: {
375
317
  // 把洗好的数据放这里
376
- productData: obj,
377
- isEdit: isEdit
318
+ productData: [obj]
378
319
  }
379
320
  });
380
321
  };
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]);
395
322
  return /*#__PURE__*/React.createElement("div", {
396
- className: "pisell-kiosk-sku-detail-viewport"
397
- }, /*#__PURE__*/React.createElement("div", {
398
323
  className: classNames('pisell-kiosk-sku-detail', className),
399
- style: stageStyle
324
+ style: style
400
325
  }, /*#__PURE__*/React.createElement("div", {
401
326
  className: "pisell-kiosk-sku-detail__content"
402
327
  }, /*#__PURE__*/React.createElement("div", {
@@ -424,8 +349,7 @@ function KioskSkuDetail(props) {
424
349
  className: "pisell-kiosk-sku-detail__error"
425
350
  }, errorText)), /*#__PURE__*/React.createElement("div", {
426
351
  className: "pisell-kiosk-sku-detail__options-card"
427
- }, productData && Array.isArray(productData === null || productData === void 0 ? void 0 : productData.variant) && productData.variant.length > 0 ? /*#__PURE__*/React.createElement(SKUOptionsSelection, {
428
- ref: skuOptionsSelectionRef,
352
+ }, productData ? /*#__PURE__*/React.createElement(SKUOptionsSelection, {
429
353
  dataSource: productData,
430
354
  value: skuDefaultValue,
431
355
  skuCardConfig: {
@@ -450,13 +374,27 @@ function KioskSkuDetail(props) {
450
374
  className: "pisell-kiosk-sku-detail__footer-center"
451
375
  }, /*#__PURE__*/React.createElement("div", {
452
376
  className: "pisell-kiosk-sku-detail__item-total"
453
- }, locales.getText('pisell2.text.kiosk.sku.detail.item.total'), ":", ' ', itemTotalText)), /*#__PURE__*/React.createElement(Button, {
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, {
454
392
  type: "primary",
455
393
  className: "pisell-kiosk-sku-detail__add-btn",
456
394
  size: "large",
457
395
  onClick: handleAddToCart,
458
396
  disabled: !productData || isLoading
459
- }, locales.getText(isEdit ? 'pisell2.text.kiosk.sku.detail.btn.update' : 'pisell2.text.kiosk.sku.detail.btn.add.to.cart')))));
397
+ }, locales.getText('pisell2.text.kiosk.sku.detail.btn.add.to.cart'))));
460
398
  }
461
399
  export default KioskSkuDetail;
462
400
 
@@ -495,35 +433,4 @@ function getQueryFirstMatch(params) {
495
433
  var queryIndex = hash.indexOf('?');
496
434
  if (queryIndex === -1) return null;
497
435
  return tryRead(hash.slice(queryIndex + 1));
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
- */
436
+ }
@@ -1,17 +1,7 @@
1
- .pisell-kiosk-sku-detail-viewport {
1
+ .pisell-kiosk-sku-detail {
2
2
  position: relative;
3
- width: 100vw;
3
+ width: 100%;
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;
15
5
  overflow-y: auto;
16
6
  background: #f2f4f7;
17
7
  background-size: cover;
@@ -21,40 +11,12 @@
21
11
  }
22
12
 
23
13
  .pisell-kiosk-sku-detail__content {
24
- width: 100%;
14
+ max-width: 1000px;
25
15
  margin: 0 auto;
26
16
  display: flex;
27
17
  flex-direction: column;
28
18
  gap: 40px;
29
19
  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
- }
58
20
  }
59
21
 
60
22
  .pisell-kiosk-sku-detail__hero {
@@ -93,6 +55,7 @@
93
55
  }
94
56
 
95
57
  .pisell-kiosk-sku-detail__desc {
58
+ max-width: 860px;
96
59
  font-size: 36px;
97
60
  line-height: 44px;
98
61
  font-weight: 400;
@@ -128,13 +91,11 @@
128
91
  }
129
92
 
130
93
  .pisell-kiosk-sku-detail__footer {
131
- // 注意:父容器有 transform(scale),fixed 会相对该容器定位(适配小分辨率缩放舞台)
132
94
  position: fixed;
133
- left: 30px;
134
- right: 30px;
95
+ left: 50%;
135
96
  bottom: 30px;
136
- transform: none;
137
- width: auto;
97
+ transform: translateX(-50%);
98
+ width: min(1020px, calc(100% - 60px));
138
99
  display: flex;
139
100
  align-items: center;
140
101
  justify-content: space-between;
@@ -164,9 +125,6 @@
164
125
  display: flex;
165
126
  align-items: center;
166
127
  gap: 20px;
167
- // 靠右,并与右侧主按钮保持 20px 间距
168
- margin-left: auto;
169
- margin-right: 20px;
170
128
  }
171
129
 
172
130
  .pisell-kiosk-sku-detail__item-total {
@@ -3,25 +3,19 @@ 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;
7
6
  'pisell2.text.kiosk.sku.detail.loading.options': string;
8
- 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
9
7
  };
10
8
  'zh-CN': {
11
9
  'pisell2.text.kiosk.sku.detail.btn.back': string;
12
10
  'pisell2.text.kiosk.sku.detail.item.total': string;
13
11
  'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
14
- 'pisell2.text.kiosk.sku.detail.btn.update': string;
15
12
  'pisell2.text.kiosk.sku.detail.loading.options': string;
16
- 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
17
13
  };
18
14
  'zh-TW': {
19
15
  'pisell2.text.kiosk.sku.detail.btn.back': string;
20
16
  'pisell2.text.kiosk.sku.detail.item.total': string;
21
17
  'pisell2.text.kiosk.sku.detail.btn.add.to.cart': string;
22
- 'pisell2.text.kiosk.sku.detail.btn.update': string;
23
18
  'pisell2.text.kiosk.sku.detail.loading.options': string;
24
- 'pisell2.text.kiosk.sku.detail.toast.select.variant': string;
25
19
  };
26
20
  };
27
21
  export default _default;