@pisell/private-materials 6.12.160 → 6.12.161

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 (72) 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 +18 -18
  7. package/build/lowcode/view.js +18 -18
  8. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  9. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  10. package/es/components/bigSale/dialog.js +1 -0
  11. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  12. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  13. package/es/components/bigSale/index.js +3 -2
  14. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  15. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  16. package/es/index.js +2 -0
  17. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  18. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  19. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  20. package/es/plus/pisellReservation/index.js +17 -0
  21. package/es/plus/saleDetail/Base.js +1 -0
  22. package/es/plus/saleDetail/components/CartItems/Editable/index.js +1 -0
  23. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  24. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  25. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  26. package/es/plus/saleDetail/index.js +1 -0
  27. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  28. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  29. package/es/plus/salesSdk/context/SalesSdkCartContext.js +25 -12
  30. package/es/plus/salesSdk/context/SalesSdkProvider.js +9 -5
  31. package/es/plus/salesSdk/hosts/BookingEditHostRenderer.js +12 -7
  32. package/es/plus/salesSdk/index.js +51 -0
  33. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  34. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  35. package/es/plus/salesSdk/utils/customerAuthGate.js +1 -1
  36. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  37. package/es/plus/salesSdk/utils/resolvePreviousService.js +28 -0
  38. package/es/plus/skuOptionsSelection/components/NormalCard/index.js +18 -12
  39. package/es/plus/skuOptionsSelection/docs/skuOptionsSelection.$tab-dev.md +66 -2
  40. package/es/plus/skuOptionsSelection/types.d.ts +50 -1
  41. package/es/plus/skuOptionsSelection/utils/normalizers.js +17 -0
  42. package/es/plus/skuOptionsSelection/utils/transformOptionGroup.js +17 -7
  43. package/es/plus/skuOptionsSelection/utils/transformSelectorValueToValue.js +89 -15
  44. package/es/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +31 -19
  45. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  46. package/es/pro/Login2.0/index.d.ts +2 -1
  47. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  48. package/es/pro/Selector/Selector.js +11 -6
  49. package/es/pro/Selector/hooks/useSelectionController.js +54 -61
  50. package/es/pro/Selector/locales.js +10 -0
  51. package/es/pro/Selector/types.d.ts +5 -0
  52. package/es/pro/skuDetailModal/types.d.ts +1 -0
  53. package/lib/components/bigSale/index.js +2 -2
  54. package/lib/plus/saleDetail/components/CartItems/Editable/index.js +1 -0
  55. package/lib/plus/salesSdk/context/SalesSdkCartContext.js +25 -12
  56. package/lib/plus/salesSdk/context/SalesSdkProvider.js +9 -5
  57. package/lib/plus/salesSdk/hosts/BookingEditHostRenderer.js +12 -7
  58. package/lib/plus/salesSdk/utils/resolvePreviousService.js +30 -0
  59. package/lib/plus/skuOptionsSelection/components/NormalCard/index.js +18 -12
  60. package/lib/plus/skuOptionsSelection/docs/skuOptionsSelection.$tab-dev.md +66 -2
  61. package/lib/plus/skuOptionsSelection/types.d.ts +50 -1
  62. package/lib/plus/skuOptionsSelection/utils/normalizers.js +19 -0
  63. package/lib/plus/skuOptionsSelection/utils/transformOptionGroup.js +17 -7
  64. package/lib/plus/skuOptionsSelection/utils/transformSelectorValueToValue.js +89 -15
  65. package/lib/plus/skuOptionsSelection/utils/transformValueToSelectorValue.js +31 -19
  66. package/lib/pro/Selector/Selector.js +11 -6
  67. package/lib/pro/Selector/hooks/useSelectionController.js +54 -61
  68. package/lib/pro/Selector/locales.js +10 -0
  69. package/lib/pro/Selector/types.d.ts +5 -0
  70. package/lib/pro/skuDetailModal/types.d.ts +1 -0
  71. package/package.json +4 -4
  72. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -1,4 +1,5 @@
1
1
  import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
+ import { hasOwnProductionCode, normalizeNonNegativeInteger, resolveProductionCode } from "./normalizers.js";
2
3
  import Decimal from "decimal.js";
3
4
  //#region src/plus/skuOptionsSelection/utils/transformValueToSelectorValue.ts
4
5
  /** 接口详情与订单行可能分别返回 number/string,SKU 回填按业务 ID 比较。 */
@@ -13,16 +14,17 @@ const transformValueToSelectorValue = (value, dataSource) => {
13
14
  if (value === null || value === void 0 ? void 0 : value.bundle) {
14
15
  var _value$bundle, _newBundle$forEach;
15
16
  const newBundle = value === null || value === void 0 || (_value$bundle = value.bundle) === null || _value$bundle === void 0 ? void 0 : _value$bundle.reduce((acc, v) => {
16
- const _bundleItemId = v === null || v === void 0 ? void 0 : v.id;
17
+ var _v$id;
18
+ const _bundleItemId = (_v$id = v === null || v === void 0 ? void 0 : v.id) !== null && _v$id !== void 0 ? _v$id : v === null || v === void 0 ? void 0 : v.bundle_id;
17
19
  const idx = acc === null || acc === void 0 ? void 0 : acc.findIndex((v1) => (v1 === null || v1 === void 0 ? void 0 : v1.id) === _bundleItemId);
18
20
  if (idx !== -1) {
19
21
  var _acc$idx, _acc$idx$push;
20
22
  (_acc$idx = acc[idx]) === null || _acc$idx === void 0 || (_acc$idx = _acc$idx.bundleOptions) === null || _acc$idx === void 0 || (_acc$idx$push = _acc$idx.push) === null || _acc$idx$push === void 0 || _acc$idx$push.call(_acc$idx, v);
21
23
  } else {
22
- var _acc$push;
24
+ var _acc$push, _v$group_id;
23
25
  acc === null || acc === void 0 || (_acc$push = acc.push) === null || _acc$push === void 0 || _acc$push.call(acc, {
24
26
  id: _bundleItemId,
25
- groupId: v === null || v === void 0 ? void 0 : v.group_id,
27
+ groupId: (_v$group_id = v === null || v === void 0 ? void 0 : v.group_id) !== null && _v$group_id !== void 0 ? _v$group_id : v === null || v === void 0 ? void 0 : v.bundle_group_id,
26
28
  bundleOptions: [v]
27
29
  });
28
30
  }
@@ -31,6 +33,7 @@ const transformValueToSelectorValue = (value, dataSource) => {
31
33
  newBundle === null || newBundle === void 0 || (_newBundle$forEach = newBundle.forEach) === null || _newBundle$forEach === void 0 || _newBundle$forEach.call(newBundle, (v1) => {
32
34
  const _bundleGroupId = v1 === null || v1 === void 0 ? void 0 : v1.groupId;
33
35
  const _bundleValue = createBundleValue(v1, dataSource);
36
+ if (!_bundleValue) return;
34
37
  if (transformValue[_bundleGroupId]) transformValue[_bundleGroupId] = [...transformValue[_bundleGroupId] || [], _bundleValue];
35
38
  else transformValue[_bundleGroupId] = [_bundleValue];
36
39
  });
@@ -77,7 +80,7 @@ const transformValueToSelectorValue = (value, dataSource) => {
77
80
  * 创建套餐商品数据
78
81
  */
79
82
  const createBundleValue = (v, dataSource) => {
80
- var _dataSource$bundle_gr, _v$bundleOptions, _v$bundleOptions$forE;
83
+ var _dataSource$bundle_gr, _v$bundleOptions2, _v$bundleOptions2$for;
81
84
  let _createdValue = null;
82
85
  const bundleGroupItem = dataSource === null || dataSource === void 0 || (_dataSource$bundle_gr = dataSource.bundle_group) === null || _dataSource$bundle_gr === void 0 ? void 0 : _dataSource$bundle_gr.find((v1) => {
83
86
  return isSameId(v1 === null || v1 === void 0 ? void 0 : v1.id, v === null || v === void 0 ? void 0 : v.groupId);
@@ -88,29 +91,34 @@ const createBundleValue = (v, dataSource) => {
88
91
  findedBundleItem = bundleGroupItem === null || bundleGroupItem === void 0 || (_bundleGroupItem$bund = bundleGroupItem.bundle_item) === null || _bundleGroupItem$bund === void 0 ? void 0 : _bundleGroupItem$bund.find((v1) => {
89
92
  return isSameId(v1 === null || v1 === void 0 ? void 0 : v1.id, v === null || v === void 0 ? void 0 : v.id);
90
93
  });
91
- if (!!findedBundleItem) _createdValue = {
92
- value: findedBundleItem === null || findedBundleItem === void 0 ? void 0 : findedBundleItem.id,
93
- data: _objectSpread2({}, findedBundleItem || {})
94
- };
94
+ if (!!findedBundleItem) {
95
+ var _v$bundleOptions;
96
+ const bundleSnapshot = v === null || v === void 0 || (_v$bundleOptions = v.bundleOptions) === null || _v$bundleOptions === void 0 ? void 0 : _v$bundleOptions.find((item) => hasOwnProductionCode(item));
97
+ _createdValue = {
98
+ value: findedBundleItem === null || findedBundleItem === void 0 ? void 0 : findedBundleItem.id,
99
+ data: _objectSpread2(_objectSpread2({}, findedBundleItem || {}), {}, { production_code: resolveProductionCode(bundleSnapshot, findedBundleItem) })
100
+ };
101
+ }
95
102
  }
96
103
  if (!_createdValue) return null;
97
104
  let totalQuantity = 0;
98
- v === null || v === void 0 || (_v$bundleOptions = v.bundleOptions) === null || _v$bundleOptions === void 0 || (_v$bundleOptions$forE = _v$bundleOptions.forEach) === null || _v$bundleOptions$forE === void 0 || _v$bundleOptions$forE.call(_v$bundleOptions, (v1) => {
99
- var _v1$option;
105
+ v === null || v === void 0 || (_v$bundleOptions2 = v.bundleOptions) === null || _v$bundleOptions2 === void 0 || (_v$bundleOptions2$for = _v$bundleOptions2.forEach) === null || _v$bundleOptions2$for === void 0 || _v$bundleOptions2$for.call(_v$bundleOptions2, (v1) => {
106
+ var _v1$option, _v1$quantity2;
100
107
  if (v1 === null || v1 === void 0 || (_v1$option = v1.option) === null || _v1$option === void 0 ? void 0 : _v1$option.length) {
101
- var _createdValue$data;
108
+ var _createdValue$data, _v1$quantity;
102
109
  const _data = (_createdValue === null || _createdValue === void 0 || (_createdValue$data = _createdValue.data) === null || _createdValue$data === void 0 ? void 0 : _createdValue$data._data) || [];
103
110
  const _createdValueData = createOptionValue({}, v1, findedBundleItem);
104
111
  _data.push({
105
- value: v1 === null || v1 === void 0 ? void 0 : v1.id,
112
+ value: findedBundleItem === null || findedBundleItem === void 0 ? void 0 : findedBundleItem.id,
106
113
  data: _createdValueData,
107
- quantity: (v1 === null || v1 === void 0 ? void 0 : v1.quantity) || 1
114
+ quantity: normalizeNonNegativeInteger((_v1$quantity = v1 === null || v1 === void 0 ? void 0 : v1.quantity) !== null && _v1$quantity !== void 0 ? _v1$quantity : v1 === null || v1 === void 0 ? void 0 : v1.num, 1)
108
115
  });
109
116
  _createdValue.data._data = _data;
110
117
  }
111
- totalQuantity = totalQuantity + ((v1 === null || v1 === void 0 ? void 0 : v1.quantity) || (v1 === null || v1 === void 0 ? void 0 : v1.num) || 1);
118
+ const itemQuantity = normalizeNonNegativeInteger((_v1$quantity2 = v1 === null || v1 === void 0 ? void 0 : v1.quantity) !== null && _v1$quantity2 !== void 0 ? _v1$quantity2 : v1 === null || v1 === void 0 ? void 0 : v1.num, 1);
119
+ totalQuantity = totalQuantity + itemQuantity;
112
120
  const _price = (v1 === null || v1 === void 0 ? void 0 : v1.price) || (findedBundleItem === null || findedBundleItem === void 0 ? void 0 : findedBundleItem.price) || 0;
113
- _createdValue.totalPrice = new Decimal(_createdValue.totalPrice || 0).plus(new Decimal(_price).times((v1 === null || v1 === void 0 ? void 0 : v1.quantity) || (v1 === null || v1 === void 0 ? void 0 : v1.num) || 1)).toNumber();
121
+ _createdValue.totalPrice = new Decimal(_createdValue.totalPrice || 0).plus(new Decimal(_price).times(itemQuantity)).toNumber();
114
122
  });
115
123
  _createdValue.quantity = totalQuantity;
116
124
  _createdValue.data.quantity = totalQuantity;
@@ -124,21 +132,25 @@ const createOptionValue = (initValue, value, dataSource) => {
124
132
  var _value$option, _value$option$forEach;
125
133
  let _createdValue = initValue || {};
126
134
  value === null || value === void 0 || (_value$option = value.option) === null || _value$option === void 0 || (_value$option$forEach = _value$option.forEach) === null || _value$option$forEach === void 0 || _value$option$forEach.call(_value$option, (v1) => {
127
- var _dataSource$option_gr, _matchedGroup$option_;
135
+ var _v1$id, _dataSource$option_gr, _matchedGroup$option_, _v1$quantity3;
128
136
  const _optionGroupId = v1 === null || v1 === void 0 ? void 0 : v1.option_group_id;
137
+ const optionItemId = (_v1$id = v1 === null || v1 === void 0 ? void 0 : v1.id) !== null && _v1$id !== void 0 ? _v1$id : v1 === null || v1 === void 0 ? void 0 : v1.product_option_item_id;
129
138
  const matchedGroup = dataSource === null || dataSource === void 0 || (_dataSource$option_gr = dataSource.option_group) === null || _dataSource$option_gr === void 0 ? void 0 : _dataSource$option_gr.find((v2) => isSameId(v2 === null || v2 === void 0 ? void 0 : v2.id, _optionGroupId));
130
- const matchedOptionItem = matchedGroup === null || matchedGroup === void 0 || (_matchedGroup$option_ = matchedGroup.option_item) === null || _matchedGroup$option_ === void 0 ? void 0 : _matchedGroup$option_.find((v3) => isSameId(v3 === null || v3 === void 0 ? void 0 : v3.id, v1 === null || v1 === void 0 ? void 0 : v1.id));
131
- const _num = (v1 === null || v1 === void 0 ? void 0 : v1.quantity) || (v1 === null || v1 === void 0 ? void 0 : v1.num) || 1;
139
+ const matchedOptionItem = matchedGroup === null || matchedGroup === void 0 || (_matchedGroup$option_ = matchedGroup.option_item) === null || _matchedGroup$option_ === void 0 ? void 0 : _matchedGroup$option_.find((v3) => isSameId(v3 === null || v3 === void 0 ? void 0 : v3.id, optionItemId));
140
+ const _num = normalizeNonNegativeInteger((_v1$quantity3 = v1 === null || v1 === void 0 ? void 0 : v1.quantity) !== null && _v1$quantity3 !== void 0 ? _v1$quantity3 : v1 === null || v1 === void 0 ? void 0 : v1.num, 1);
132
141
  const _price = (matchedOptionItem === null || matchedOptionItem === void 0 ? void 0 : matchedOptionItem.add_price) || 0;
133
142
  const _tempOptionValue = {
134
143
  data: _objectSpread2(_objectSpread2(_objectSpread2({}, matchedOptionItem || {}), v1 || {}), {}, {
144
+ id: optionItemId,
145
+ product_option_item_id: optionItemId,
146
+ production_code: matchedOptionItem ? resolveProductionCode(v1, matchedOptionItem) : "",
135
147
  num: _num,
136
148
  price: _price,
137
149
  original_price: _price,
138
150
  original_total: _price
139
151
  }),
140
152
  quantity: _num,
141
- value: v1 === null || v1 === void 0 ? void 0 : v1.id,
153
+ value: optionItemId,
142
154
  totalPrice: new Decimal((matchedOptionItem === null || matchedOptionItem === void 0 ? void 0 : matchedOptionItem.add_price) || 0).times(_num).toNumber()
143
155
  };
144
156
  if (_createdValue[_optionGroupId]) _createdValue[_optionGroupId] = [..._createdValue[_optionGroupId] || [], _tempOptionValue];
@@ -14,4 +14,4 @@ interface AuthModalProps {
14
14
  */
15
15
  declare const AuthModal: React.FC<AuthModalProps>;
16
16
  //#endregion
17
- export { AuthModal, AuthModalProps };
17
+ export { AuthModal };
@@ -1,3 +1,4 @@
1
+ import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
1
2
  import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
2
3
  import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
3
- import { AuthModal, AuthModalProps } from "./AuthModal.js";
4
+ import { AuthModal } from "./AuthModal.js";
@@ -226,4 +226,4 @@ interface RegisterFormData {
226
226
  verification_token?: string;
227
227
  }
228
228
  //#endregion
229
- export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig };
229
+ export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
@@ -91,23 +91,28 @@ const Selector = forwardRef((props, ref) => {
91
91
  if (props.showStepper === false) return null;
92
92
  if ((props.showStepper === "auto" || props.showStepper === void 0) && !showQuantity) return null;
93
93
  return /* @__PURE__ */ React.createElement(NumericStepper, _objectSpread2(_objectSpread2({}, props.stepperProps || {}), {}, {
94
- min: option.effectiveMin,
94
+ min: 0,
95
95
  max: option.effectiveMax,
96
96
  value: option.quantity,
97
97
  disabled: disabled || option.disabled,
98
- onChange: (value) => {
99
- actions.update(option._key, { quantity: value });
98
+ onChange: (value, meta) => {
99
+ const initialQuantity = Math.max(1, Number((option === null || option === void 0 ? void 0 : option.effectiveMin) || 0));
100
+ let nextQuantity = value;
101
+ if ((meta === null || meta === void 0 ? void 0 : meta.action) === "increase" && option.quantity <= 0) nextQuantity = initialQuantity;
102
+ else if ((meta === null || meta === void 0 ? void 0 : meta.action) === "decrease" && initialQuantity > 1 && option.quantity === initialQuantity && value < initialQuantity) nextQuantity = 0;
103
+ actions.update(option._key, { quantity: nextQuantity });
100
104
  }
101
105
  }));
102
106
  };
103
107
  const renderOption = (option) => {
104
- var _option$ruleConfig$mi, _option$ruleConfig, _ruleConfig$min, _option$ruleConfig$ma, _option$ruleConfig2;
108
+ var _option$ruleConfig$mi, _option$ruleConfig, _ruleConfig$min, _option$ruleConfig2;
105
109
  const optionItemValue = Array.isArray(state.values) ? state.values.find((item) => (item === null || item === void 0 ? void 0 : item.value) === option._key) : [state.values].find((item) => (item === null || item === void 0 ? void 0 : item.value) === option._key);
106
110
  if (React.isValidElement(renderItem)) return renderItem;
107
111
  const configMin = (_option$ruleConfig$mi = option === null || option === void 0 || (_option$ruleConfig = option.ruleConfig) === null || _option$ruleConfig === void 0 ? void 0 : _option$ruleConfig.min) !== null && _option$ruleConfig$mi !== void 0 ? _option$ruleConfig$mi : 0;
108
112
  const groupMin = (_ruleConfig$min = ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.min) !== null && _ruleConfig$min !== void 0 ? _ruleConfig$min : 0;
109
113
  const effectiveMin = options.length < 2 && groupMin > 0 ? groupMin : configMin;
110
- const configMax = (_option$ruleConfig$ma = option === null || option === void 0 || (_option$ruleConfig2 = option.ruleConfig) === null || _option$ruleConfig2 === void 0 ? void 0 : _option$ruleConfig2.max) !== null && _option$ruleConfig$ma !== void 0 ? _option$ruleConfig$ma : Number.MAX_SAFE_INTEGER;
114
+ const configuredMax = option === null || option === void 0 || (_option$ruleConfig2 = option.ruleConfig) === null || _option$ruleConfig2 === void 0 ? void 0 : _option$ruleConfig2.max;
115
+ const configMax = typeof configuredMax === "number" && configuredMax > 0 ? configuredMax : Number.MAX_SAFE_INTEGER;
111
116
  const effectiveMax = remainingCount !== void 0 ? Math.min(remainingCount + (option.quantity || 0), configMax) : configMax;
112
117
  option.effectiveMin = effectiveMin;
113
118
  option.effectiveMax = effectiveMax;
@@ -159,7 +164,7 @@ const Selector = forwardRef((props, ref) => {
159
164
  const { required = false } = ruleConfig || {};
160
165
  if (!required) return null;
161
166
  const style = { borderRadius: 16 };
162
- if (errors.find((item) => item.type === "required" || item.type === "min")) return /* @__PURE__ */ React.createElement(ATag, {
167
+ if (errors.find((item) => item.type === "required" || item.type === "min" || item.type === "minTypes")) return /* @__PURE__ */ React.createElement(ATag, {
163
168
  className: "pisell-pro-selector_required-tag",
164
169
  icon: /* @__PURE__ */ React.createElement(ExclamationCircleOutlined, null),
165
170
  color: "error",
@@ -4,6 +4,24 @@ import { useCallback, useMemo, useRef, useState } from "react";
4
4
  import { locales } from "@pisell/utils";
5
5
  import { useControllableValue } from "ahooks";
6
6
  //#region src/pro/Selector/hooks/useSelectionController.ts
7
+ const normalizeSelectionQuantity = (quantity) => {
8
+ if (quantity === null || quantity === void 0) return 1;
9
+ const normalizedQuantity = Number(quantity);
10
+ return Number.isFinite(normalizedQuantity) ? normalizedQuantity : 1;
11
+ };
12
+ const normalizeSelectionValues = (values) => {
13
+ if (values === null || values === void 0) return [];
14
+ return (Array.isArray(values) ? values : [values]).map((item) => {
15
+ if (typeof item === "object" && item !== null) return _objectSpread2(_objectSpread2({}, item), {}, {
16
+ value: item.value,
17
+ quantity: normalizeSelectionQuantity(item.quantity)
18
+ });
19
+ return {
20
+ value: item,
21
+ quantity: 1
22
+ };
23
+ });
24
+ };
7
25
  function useSelectionController(props) {
8
26
  const { dataSource = [], ruleConfig, fieldNames, mode = "single", valueType = "primitive" } = props || {};
9
27
  const [values, setValues] = useControllableValue(props);
@@ -38,48 +56,34 @@ function useSelectionController(props) {
38
56
  return map;
39
57
  }, [mutexGroups]);
40
58
  const normalizedValues = useMemo(() => {
41
- if (!values) return [];
42
- if (Array.isArray(values)) return values.map((item) => {
43
- if (typeof item === "object" && item !== null) return _objectSpread2(_objectSpread2({}, item), {}, {
44
- value: item.value,
45
- quantity: item.quantity || 1
46
- });
47
- return {
48
- value: item,
49
- quantity: 1
50
- };
51
- });
52
- if (typeof values === "object" && values !== null) {
53
- const objValue = values;
54
- return [_objectSpread2(_objectSpread2({}, objValue), {}, {
55
- value: objValue.value,
56
- quantity: objValue.quantity || 1
57
- })];
58
- }
59
- return [{
60
- value: values,
61
- quantity: 1
62
- }];
59
+ return normalizeSelectionValues(values);
63
60
  }, [values]);
64
61
  const quantityInfo = useMemo(() => {
65
- const selectedCount = normalizedValues.reduce((sum, item) => sum + (item.quantity || 0), 0);
62
+ const positiveValues = normalizedValues.filter((item) => Number(item.quantity) > 0);
63
+ const selectedCount = positiveValues.reduce((sum, item) => sum + Number(item.quantity), 0);
64
+ const selectedTypeCount = new Set(positiveValues.map((item) => item.value)).size;
66
65
  const showQuantity = (Array.isArray(dataSource) ? dataSource : dataSource || []).some((opt) => {
67
66
  var _opt$ruleConfig, _opt$ruleConfig2;
68
- return typeof (opt === null || opt === void 0 || (_opt$ruleConfig = opt.ruleConfig) === null || _opt$ruleConfig === void 0 ? void 0 : _opt$ruleConfig.max) === "number" && opt.ruleConfig.max > 1 || typeof (opt === null || opt === void 0 || (_opt$ruleConfig2 = opt.ruleConfig) === null || _opt$ruleConfig2 === void 0 ? void 0 : _opt$ruleConfig2.min) === "number" && opt.ruleConfig.min > 1;
67
+ return typeof (opt === null || opt === void 0 || (_opt$ruleConfig = opt.ruleConfig) === null || _opt$ruleConfig === void 0 ? void 0 : _opt$ruleConfig.max) === "number" && (opt.ruleConfig.max === 0 || opt.ruleConfig.max > 1) || typeof (opt === null || opt === void 0 || (_opt$ruleConfig2 = opt.ruleConfig) === null || _opt$ruleConfig2 === void 0 ? void 0 : _opt$ruleConfig2.min) === "number" && opt.ruleConfig.min > 1;
69
68
  });
70
69
  return {
71
70
  maxReached: typeof (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max) === "number" && ruleConfig.max > 0 && selectedCount >= ruleConfig.max,
72
71
  showQuantity,
73
72
  remainingCount: typeof (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max) === "number" && ruleConfig.max > 0 ? Math.max(0, ruleConfig.max - selectedCount) : Infinity,
74
- selectedCount
73
+ selectedCount,
74
+ selectedTypeCount,
75
+ typeMaxReached: mode === "multiple" && typeof (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.maxTypes) === "number" && ruleConfig.maxTypes > 0 && selectedTypeCount >= ruleConfig.maxTypes,
76
+ remainingTypeCount: typeof (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.maxTypes) === "number" && ruleConfig.maxTypes > 0 ? Math.max(0, ruleConfig.maxTypes - selectedTypeCount) : Infinity
75
77
  };
76
78
  }, [
77
79
  normalizedValues,
78
80
  dataSource,
79
- ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max
81
+ mode,
82
+ ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max,
83
+ ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.maxTypes
80
84
  ]);
81
85
  const getOptionState = useCallback((optionKey) => {
82
- const found = normalizedValues.find((item) => item.value === optionKey);
86
+ const found = normalizedValues.find((item) => item.value === optionKey && Number(item.quantity) > 0);
83
87
  return {
84
88
  selected: !!found,
85
89
  quantity: (found === null || found === void 0 ? void 0 : found.quantity) || 0
@@ -88,59 +92,51 @@ function useSelectionController(props) {
88
92
  const options = useMemo(() => {
89
93
  return normalizedOptions.map((option) => {
90
94
  const state = getOptionState(option._key);
91
- const disabled = quantityInfo.maxReached && !(mode === "single" && (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max) === 1) && !state.selected;
95
+ const disabledByTotalLimit = quantityInfo.maxReached && !(mode === "single" && (ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max) === 1) && !state.selected;
96
+ const disabledByTypeLimit = mode === "multiple" && quantityInfo.typeMaxReached && !state.selected;
92
97
  return _objectSpread2(_objectSpread2({}, option), {}, {
93
98
  selected: state.selected,
94
99
  quantity: state.quantity,
95
- disabled: option.disabled || disabled
100
+ disabled: option.disabled || disabledByTotalLimit || disabledByTypeLimit
96
101
  });
97
102
  });
98
103
  }, [
99
104
  normalizedOptions,
100
105
  getOptionState,
101
106
  quantityInfo.maxReached,
107
+ quantityInfo.typeMaxReached,
102
108
  mode,
103
109
  ruleConfig === null || ruleConfig === void 0 ? void 0 : ruleConfig.max
104
110
  ]);
105
111
  const validate = function() {
106
112
  var _ref = _asyncToGenerator(function* () {
107
113
  const errors = [];
108
- const { required, min, max, customValidator } = ruleConfig || {};
114
+ const { required, min, max, minTypes, maxTypes, customValidator } = ruleConfig || {};
109
115
  const values = valuesRef.current;
110
- let currentNormalizedValues = [];
111
- if (values) if (Array.isArray(values)) currentNormalizedValues = values.map((item) => {
112
- if (typeof item === "object" && item !== null) return _objectSpread2(_objectSpread2({}, item), {}, {
113
- value: item.value,
114
- quantity: item.quantity || 1
115
- });
116
- return {
117
- value: item,
118
- quantity: 1
119
- };
120
- });
121
- else if (typeof values === "object" && values !== null) {
122
- const objValue = values;
123
- currentNormalizedValues = [_objectSpread2(_objectSpread2({}, objValue), {}, {
124
- value: objValue.value,
125
- quantity: objValue.quantity || 1
126
- })];
127
- } else currentNormalizedValues = [{
128
- value: values,
129
- quantity: 1
130
- }];
131
- const totalQuantity = currentNormalizedValues.reduce((sum, item) => sum + (item.quantity || 0), 0);
116
+ const currentNormalizedValues = normalizeSelectionValues(values);
117
+ const positiveValues = currentNormalizedValues.filter((item) => Number(item.quantity) > 0);
118
+ const totalQuantity = positiveValues.reduce((sum, item) => sum + Number(item.quantity), 0);
119
+ const selectedTypeCount = new Set(positiveValues.map((item) => item.value)).size;
132
120
  if (required && totalQuantity < 1) errors.push({
133
121
  type: "required",
134
122
  message: locales.getText("pisell2.pro.selector.validate.required-msg")
135
123
  });
136
- if (typeof min === "number" && totalQuantity < min) errors.push({
124
+ if (typeof min === "number" && min > 0 && totalQuantity < min) errors.push({
137
125
  type: "min",
138
126
  message: locales.getText("pisell2.pro.selector.validate.min-selection")(min)
139
127
  });
140
- if (typeof max === "number" && totalQuantity > max) errors.push({
128
+ if (typeof max === "number" && max > 0 && totalQuantity > max) errors.push({
141
129
  type: "max",
142
130
  message: locales.getText("pisell2.pro.selector.validate.max-selection")(max)
143
131
  });
132
+ if (typeof minTypes === "number" && minTypes > 0 && selectedTypeCount < minTypes) errors.push({
133
+ type: "minTypes",
134
+ message: locales.getText("pisell2.pro.selector.validate.min-types")(minTypes)
135
+ });
136
+ if (typeof maxTypes === "number" && maxTypes > 0 && selectedTypeCount > maxTypes) errors.push({
137
+ type: "maxTypes",
138
+ message: locales.getText("pisell2.pro.selector.validate.max-types")(maxTypes)
139
+ });
144
140
  options.forEach((option) => {
145
141
  var _option$ruleConfig, _option$ruleConfig2;
146
142
  const _optionVal = currentNormalizedValues.find((item) => item.value === option._key);
@@ -148,19 +144,19 @@ function useSelectionController(props) {
148
144
  const { _label } = option;
149
145
  const _min = option === null || option === void 0 || (_option$ruleConfig = option.ruleConfig) === null || _option$ruleConfig === void 0 ? void 0 : _option$ruleConfig.min;
150
146
  const _max = option === null || option === void 0 || (_option$ruleConfig2 = option.ruleConfig) === null || _option$ruleConfig2 === void 0 ? void 0 : _option$ruleConfig2.max;
151
- if (typeof _min === "number" && quantity < _min) errors.push({
147
+ if (quantity > 0 && typeof _min === "number" && _min > 0 && quantity < _min) errors.push({
152
148
  type: "optionMin",
153
149
  message: locales.getText("pisell2.pro.selector.validate.min-selection")(_min, _label),
154
150
  _key: option._key
155
151
  });
156
- if (typeof _max === "number" && quantity > _max) errors.push({
152
+ if (typeof _max === "number" && _max > 0 && quantity > _max) errors.push({
157
153
  type: "optionMax",
158
154
  message: locales.getText("pisell2.pro.selector.validate.max-selection")(_max, _label),
159
155
  _key: option._key
160
156
  });
161
157
  });
162
158
  if (mutexGroups.length > 0) {
163
- const selectedKeys = (Array.isArray(values) ? values : values ? [values] : []).map((v) => typeof v === "object" && v !== null ? v.value : v);
159
+ const selectedKeys = positiveValues.map((item) => item.value);
164
160
  mutexGroups.forEach((group) => {
165
161
  if (selectedKeys.filter((k) => group.includes(k)).length > 1) errors.push({
166
162
  type: "mutex",
@@ -210,10 +206,7 @@ function useSelectionController(props) {
210
206
  } else {
211
207
  if (existingIndex >= 0) newNormalizedValues[existingIndex] = _objectSpread2(_objectSpread2({}, newNormalizedValues[existingIndex]), data);
212
208
  else {
213
- const newItem = _objectSpread2({
214
- value: optionKey,
215
- quantity: data.quantity || 1
216
- }, data);
209
+ const newItem = _objectSpread2(_objectSpread2({ value: optionKey }, data), {}, { quantity: normalizeSelectionQuantity(data === null || data === void 0 ? void 0 : data.quantity) });
217
210
  if (mode === "single") newNormalizedValues = [newItem];
218
211
  else newNormalizedValues.push(newItem);
219
212
  }
@@ -8,6 +8,8 @@ var locales_default = {
8
8
  "pisell2.pro.selector.required-tag": "Required",
9
9
  "pisell2.pro.selector.validate.min-selection": (min, label) => `Select at least ${min}${label ? " " + label : ""}`,
10
10
  "pisell2.pro.selector.validate.max-selection": (max, label) => `Select at most ${max}${label ? " " + label : ""}`,
11
+ "pisell2.pro.selector.validate.min-types": (min) => `Select at least ${min} option types`,
12
+ "pisell2.pro.selector.validate.max-types": (max) => `Select at most ${max} option types`,
11
13
  "pisell2.pro.selector.tip.require-one-option": "Choose 1",
12
14
  "pisell2.pro.selector.tip.min-max-selection": (min, max) => {
13
15
  if (min === max && min > 0) return `Choose ${min}`;
@@ -25,6 +27,8 @@ var locales_default = {
25
27
  "pisell2.pro.selector.required-tag": "必选",
26
28
  "pisell2.pro.selector.validate.min-selection": (min, label) => `至少选 ${min} 个${label ? " " + label : ""}`,
27
29
  "pisell2.pro.selector.validate.max-selection": (max, label) => `最多选 ${max} 个${label ? " " + label : ""}`,
30
+ "pisell2.pro.selector.validate.min-types": (min) => `至少选择 ${min} 种选项`,
31
+ "pisell2.pro.selector.validate.max-types": (max) => `最多选择 ${max} 种选项`,
28
32
  "pisell2.pro.selector.tip.require-one-option": "需选 1 项",
29
33
  "pisell2.pro.selector.tip.min-max-selection": (min, max) => {
30
34
  if (min === max && min > 0) return `需选 ${min} 个`;
@@ -42,6 +46,8 @@ var locales_default = {
42
46
  "pisell2.pro.selector.required-tag": "必選",
43
47
  "pisell2.pro.selector.validate.min-selection": (min, label) => `至少選 ${min} 個${label ? " " + label : ""}`,
44
48
  "pisell2.pro.selector.validate.max-selection": (max, label) => `最多選 ${max} 個${label ? " " + label : ""}`,
49
+ "pisell2.pro.selector.validate.min-types": (min) => `至少選擇 ${min} 種選項`,
50
+ "pisell2.pro.selector.validate.max-types": (max) => `最多選擇 ${max} 種選項`,
45
51
  "pisell2.pro.selector.tip.require-one-option": "需選 1 項",
46
52
  "pisell2.pro.selector.tip.min-max-selection": (min, max) => {
47
53
  if (min === max && min > 0) return `需選 ${min} 個`;
@@ -59,6 +65,8 @@ var locales_default = {
59
65
  "pisell2.pro.selector.required-tag": "必須",
60
66
  "pisell2.pro.selector.validate.min-selection": (min, label) => `少なくとも${min}${label ? " " + label : ""}を選択`,
61
67
  "pisell2.pro.selector.validate.max-selection": (max, label) => `最大${max}${label ? " " + label : ""}を選択`,
68
+ "pisell2.pro.selector.validate.min-types": (min) => `少なくとも${min}種類のオプションを選択してください`,
69
+ "pisell2.pro.selector.validate.max-types": (max) => `選択できるオプションは最大${max}種類です`,
62
70
  "pisell2.pro.selector.tip.require-one-option": "1つ選択",
63
71
  "pisell2.pro.selector.tip.min-max-selection": (min, max) => {
64
72
  if (min === max && min > 0) return `${min}つ選択`;
@@ -76,6 +84,8 @@ var locales_default = {
76
84
  "pisell2.pro.selector.required-tag": "Obrigatório",
77
85
  "pisell2.pro.selector.validate.min-selection": (min, label) => `Selecione pelo menos ${min}${label ? " " + label : ""}`,
78
86
  "pisell2.pro.selector.validate.max-selection": (max, label) => `Selecione no máximo ${max}${label ? " " + label : ""}`,
87
+ "pisell2.pro.selector.validate.min-types": (min) => `Selecione pelo menos ${min} tipos de opção`,
88
+ "pisell2.pro.selector.validate.max-types": (max) => `Selecione no máximo ${max} tipos de opção`,
79
89
  "pisell2.pro.selector.tip.require-one-option": "Escolha 1",
80
90
  "pisell2.pro.selector.tip.min-max-selection": (min, max) => {
81
91
  if (min === max && min > 0) return `Escolha ${min}`;
@@ -8,6 +8,8 @@ interface RuleConfig {
8
8
  required?: 0 | 1;
9
9
  min?: number;
10
10
  max?: number;
11
+ minTypes?: number;
12
+ maxTypes?: number;
11
13
  mutex?: Array<Array<OptionKey>>;
12
14
  customValidator?: (value: SelectionValue) => Promise<void>;
13
15
  }
@@ -63,6 +65,9 @@ type RenderItemProps = {
63
65
  maxReached: boolean;
64
66
  remainingCount: number;
65
67
  selectedCount: number;
68
+ selectedTypeCount: number;
69
+ typeMaxReached: boolean;
70
+ remainingTypeCount: number;
66
71
  };
67
72
  };
68
73
  type ItemProps = {
@@ -315,6 +315,7 @@ interface ProductData {
315
315
  over_sold: number;
316
316
  is_gst: number;
317
317
  code: string;
318
+ production_code?: string;
318
319
  barcode: string;
319
320
  is_delivery: number;
320
321
  weight_unit: WeightUnitName;
@@ -50,7 +50,7 @@ const BigSaleHostRuntimeBridge = ({ runtimeRef }) => {
50
50
  /**
51
51
  * BigSale 入口:只创建 SalesSdkProvider 运行环境,UI 由 ResponsiveBigSaleBase 承载。
52
52
  */
53
- const BigSale = ({ osKey = DEFAULT_OS_KEY, osModuleName, selectionFlowScene, lifecycleOwner, orderId, autoBootstrap, autoRestoreOnInit, restoreOrderAfterPaidCheckout, destroyOnUnmount, businessCode, bookingConfigParams, otherParams, rulesHooks, uiHosts, normalProductDetailConfig, mergeBookingLinesForDisplay, mode = "ticket", variant, tmpl, template, secondaryScreenDisplay, productLoadParams, productDisplayConfig, hideSelectFloorMapResourceAction, productCatalogSessionKey, productCatalogReady, saleDetailTemplate, saleDetailModuleConfig, autoCreate = true, enableTempOrderPersist, enableTempOrderSync = true, isActive = true, preserveProductCatalogOnInactiveCustomerClear, enableGlobalScanListener = false, promotionScanSuccessMessageKey, promotionItemIncreaseMessageKey, className, style, bootstrapSlot, saleDetailHeaderSlot, rightActionBarClose, overlaySlot, onOrderComplete, externalActionRequest, onExternalActionAccepted, onExternalPaymentSettled }) => {
53
+ const BigSale = ({ osKey = DEFAULT_OS_KEY, osModuleName, selectionFlowScene, lifecycleOwner, orderId, autoBootstrap, autoRestoreOnInit, restoreOrderAfterPaidCheckout, destroyOnUnmount, businessCode, bookingConfigParams, autoInitBookingContext, otherParams, rulesHooks, uiHosts, normalProductDetailConfig, mergeBookingLinesForDisplay, mode = "ticket", variant, tmpl, template, secondaryScreenDisplay, productLoadParams, productDisplayConfig, hideSelectFloorMapResourceAction, productCatalogSessionKey, productCatalogReady, saleDetailTemplate, saleDetailModuleConfig, autoCreate = true, enableTempOrderPersist, enableTempOrderSync = true, isActive = true, preserveProductCatalogOnInactiveCustomerClear, enableGlobalScanListener = false, promotionScanSuccessMessageKey, promotionItemIncreaseMessageKey, className, style, bootstrapSlot, saleDetailHeaderSlot, rightActionBarClose, overlaySlot, onOrderComplete, externalActionRequest, onExternalActionAccepted, onExternalPaymentSettled }) => {
54
54
  var _context$appHelper, _context$appHelper2, _context$appHelper3, _ref;
55
55
  const context = require_useEngineContext.default();
56
56
  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;
@@ -132,7 +132,7 @@ const BigSale = ({ osKey = DEFAULT_OS_KEY, osModuleName, selectionFlowScene, lif
132
132
  restoreOrderAfterPaidCheckout,
133
133
  businessCode,
134
134
  bookingConfigParams,
135
- autoInitBookingContext: false,
135
+ autoInitBookingContext,
136
136
  otherParams,
137
137
  shouldMergeProductLines,
138
138
  rulesHooks,
@@ -109,6 +109,7 @@ function useCartLineRowActions({ item, quantityLoading, cardAction, isShowRightA
109
109
  text: /* @__PURE__ */ react.default.createElement(require_index$2.default, {
110
110
  enablePriceAdjust: true,
111
111
  min: 1,
112
+ width: "max-content",
112
113
  className: "pisell-sale-detail-cart-items__quantity-selector",
113
114
  value: getBookingQuantity(item),
114
115
  disabled: quantityLoading,
@@ -29,6 +29,7 @@ const require_bookingDate = require("../utils/bookingDate.js");
29
29
  const require_assignHolderToCartLine = require("../utils/assignHolderToCartLine.js");
30
30
  const require_holderSubmitValidation = require("../utils/holderSubmitValidation.js");
31
31
  const require_removeOrderProducts = require("../utils/removeOrderProducts.js");
32
+ const require_resolvePreviousService = require("../utils/resolvePreviousService.js");
32
33
  const require_locales = require("../../../components/ticketBooking/locales.js");
33
34
  const require_editCartLine = require("../utils/editCartLine.js");
34
35
  const require_syncBookingLineQuantityByRows = require("../utils/syncBookingLineQuantityByRows.js");
@@ -796,6 +797,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
796
797
  const customerId = require_buildBookingEditDrawerState.resolveAddFlowCustomerId(liveTempOrder, void 0, bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getOrd2 = bookingTicket.getOrderCustomerSnapshot) === null || _bookingTicket$getOrd2 === void 0 || (_bookingTicket$getOrd2 = _bookingTicket$getOrd2.call(bookingTicket)) === null || _bookingTicket$getOrd2 === void 0 ? void 0 : _bookingTicket$getOrd2.id);
797
798
  return {
798
799
  bookingConfig: (_bookingTicket$getBoo5 = bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getBoo6 = bookingTicket.getBookingConfig) === null || _bookingTicket$getBoo6 === void 0 ? void 0 : _bookingTicket$getBoo6.call(bookingTicket)) !== null && _bookingTicket$getBoo5 !== void 0 ? _bookingTicket$getBoo5 : null,
800
+ previousService: require_resolvePreviousService.resolvePreviousService(liveTempOrder),
799
801
  customerId,
800
802
  tempOrder: liveTempOrder,
801
803
  isFranchisee: Boolean(bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getOth = bookingTicket.getOtherParams) === null || _bookingTicket$getOth === void 0 || (_bookingTicket$getOth = _bookingTicket$getOth.call(bookingTicket)) === null || _bookingTicket$getOth === void 0 ? void 0 : _bookingTicket$getOth.isFranchisee),
@@ -858,7 +860,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
858
860
  });
859
861
  const addProductToOrderFromCacheImpl = (0, ahooks.useMemoizedFn)(function() {
860
862
  var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (item, cacheItem, options) {
861
- var _flowCtx$date, _ref8, _cacheItemForTransfor, _cacheItemForTransfor2;
863
+ var _flowCtx$date, _flowCtx$bookingConfi, _ref8, _cacheItemForTransfor, _cacheItemForTransfor2;
862
864
  if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
863
865
  if (typeof bookingTicket.transformDetailToProductAndBooking !== "function") throw new Error("[SalesSdk] Cart: bookingTicket.transformDetailToProductAndBooking 不可用");
864
866
  const flowCtx = getAddFlowContext();
@@ -868,7 +870,9 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
868
870
  cacheItem: cacheItemForTransform,
869
871
  options: {
870
872
  quantity: options === null || options === void 0 ? void 0 : options.quantity,
871
- date: (_flowCtx$date = flowCtx.date) !== null && _flowCtx$date !== void 0 ? _flowCtx$date : void 0
873
+ date: (_flowCtx$date = flowCtx.date) !== null && _flowCtx$date !== void 0 ? _flowCtx$date : void 0,
874
+ bookingConfig: (_flowCtx$bookingConfi = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi !== void 0 ? _flowCtx$bookingConfi : void 0,
875
+ previousService: flowCtx.previousService
872
876
  }
873
877
  });
874
878
  orderLine.note = (_ref8 = (_cacheItemForTransfor = cacheItemForTransform === null || cacheItemForTransform === void 0 || (_cacheItemForTransfor2 = cacheItemForTransform._extend) === null || _cacheItemForTransfor2 === void 0 ? void 0 : _cacheItemForTransfor2.note) !== null && _cacheItemForTransfor !== void 0 ? _cacheItemForTransfor : orderLine.note) !== null && _ref8 !== void 0 ? _ref8 : "";
@@ -920,7 +924,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
920
924
  */
921
925
  const addProduct = (0, ahooks.useMemoizedFn)(function() {
922
926
  var _ref13 = require_asyncToGenerator._asyncToGenerator(function* (product, options) {
923
- var _flowCtx$date2;
927
+ var _flowCtx$date2, _flowCtx$bookingConfi2;
924
928
  if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
925
929
  if (typeof bookingTicket.decideAddProduct !== "function") throw new Error("[SalesSdk] Cart: bookingTicket.decideAddProduct 不可用,请升级 pisellos");
926
930
  const flowCtx = getAddFlowContext();
@@ -969,7 +973,9 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
969
973
  type: (options === null || options === void 0 ? void 0 : options.type) || "select",
970
974
  quantity: options === null || options === void 0 ? void 0 : options.quantity,
971
975
  date: (_flowCtx$date2 = flowCtx.date) !== null && _flowCtx$date2 !== void 0 ? _flowCtx$date2 : void 0,
972
- customerId: flowCtx.customerId
976
+ customerId: flowCtx.customerId,
977
+ bookingConfig: (_flowCtx$bookingConfi2 = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi2 !== void 0 ? _flowCtx$bookingConfi2 : void 0,
978
+ previousService: flowCtx.previousService
973
979
  });
974
980
  if (decision.action === "reloadCatalog") {
975
981
  yield reloadProductCatalogForStaleSession();
@@ -989,14 +995,16 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
989
995
  };
990
996
  }
991
997
  if (decision.action === "requiresDetail") {
992
- var _decision$payload, _bookingTicket$buildR, _flowCtx$date4;
998
+ var _decision$payload, _bookingTicket$buildR, _flowCtx$date4, _flowCtx$bookingConfi3;
993
999
  return {
994
1000
  status: "requiresDetail",
995
1001
  payload: (_decision$payload = decision.payload) !== null && _decision$payload !== void 0 ? _decision$payload : (_bookingTicket$buildR = bookingTicket.buildRequiresDetailPayload) === null || _bookingTicket$buildR === void 0 ? void 0 : _bookingTicket$buildR.call(bookingTicket, product, {
996
1002
  type: (options === null || options === void 0 ? void 0 : options.type) || "select",
997
1003
  quantity: options === null || options === void 0 ? void 0 : options.quantity,
998
1004
  date: (_flowCtx$date4 = flowCtx.date) !== null && _flowCtx$date4 !== void 0 ? _flowCtx$date4 : void 0,
999
- customerId: flowCtx.customerId
1005
+ customerId: flowCtx.customerId,
1006
+ bookingConfig: (_flowCtx$bookingConfi3 = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi3 !== void 0 ? _flowCtx$bookingConfi3 : void 0,
1007
+ previousService: flowCtx.previousService
1000
1008
  })
1001
1009
  };
1002
1010
  }
@@ -1022,7 +1030,7 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
1022
1030
  */
1023
1031
  const confirmDetail = (0, ahooks.useMemoizedFn)(function() {
1024
1032
  var _ref15 = require_asyncToGenerator._asyncToGenerator(function* (input) {
1025
- var _flowCtx$date7, _input$options, _input$options3;
1033
+ var _flowCtx$date7, _flowCtx$bookingConfi4, _input$options, _input$options3;
1026
1034
  if (!bookingTicket) throw new Error("[SalesSdk] Cart: bookingTicket 未初始化");
1027
1035
  if (typeof bookingTicket.transformDetailToProductAndBooking !== "function") throw new Error("[SalesSdk] Cart: bookingTicket.transformDetailToProductAndBooking 不可用");
1028
1036
  const confirmQuantity = require_resolveConfirmDetailQuantity.resolveConfirmDetailQuantity(input);
@@ -1033,7 +1041,9 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
1033
1041
  options: {
1034
1042
  quantity: confirmQuantity,
1035
1043
  date: (_flowCtx$date7 = flowCtx.date) !== null && _flowCtx$date7 !== void 0 ? _flowCtx$date7 : void 0,
1036
- customerId: flowCtx.customerId
1044
+ customerId: flowCtx.customerId,
1045
+ bookingConfig: (_flowCtx$bookingConfi4 = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi4 !== void 0 ? _flowCtx$bookingConfi4 : void 0,
1046
+ previousService: flowCtx.previousService
1037
1047
  }
1038
1048
  });
1039
1049
  const catalogItem = input.item;
@@ -1041,12 +1051,13 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
1041
1051
  if ((_input$options = input.options) === null || _input$options === void 0 ? void 0 : _input$options.multiDayRange) cacheItem = require_patchCacheItemDateRange.patchCacheItemDateRange(cacheItem, input.options.multiDayRange);
1042
1052
  else cacheItem = require_patchCacheItemDateRange.applyDefaultMultiDayRangeIfNeeded(cacheItem, catalogItem, flowCtx.date);
1043
1053
  if (typeof bookingTicket.decideAfterDetail === "function") {
1044
- var _flowCtx$date8, _flowCtx$bookingConfi, _input$options2;
1054
+ var _flowCtx$date8, _flowCtx$bookingConfi5, _input$options2;
1045
1055
  const decision = bookingTicket.decideAfterDetail(cacheItem, {
1046
1056
  quantity: confirmQuantity,
1047
1057
  customerId: flowCtx.customerId,
1048
1058
  date: (_flowCtx$date8 = flowCtx.date) !== null && _flowCtx$date8 !== void 0 ? _flowCtx$date8 : void 0,
1049
- bookingConfig: (_flowCtx$bookingConfi = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi !== void 0 ? _flowCtx$bookingConfi : void 0
1059
+ bookingConfig: (_flowCtx$bookingConfi5 = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi5 !== void 0 ? _flowCtx$bookingConfi5 : void 0,
1060
+ previousService: flowCtx.previousService
1050
1061
  });
1051
1062
  if (decision.action === "requiresBookingEdit") {
1052
1063
  var _decision$payload5, _ref14, _flowCtx$date9, _decision$payload6, _flowCtx$customerId2, _decision$payload7;
@@ -1165,13 +1176,15 @@ const SalesSdkCartProvider = ({ children, shouldMergeProductLines, mergeBookingL
1165
1176
  };
1166
1177
  }(),
1167
1178
  decideAddProduct: (product, opts) => {
1168
- var _flowCtx$date11;
1179
+ var _flowCtx$date11, _flowCtx$bookingConfi6;
1169
1180
  const ticket = bookingTicketRef.current;
1170
1181
  if (!ticket || typeof ticket.decideAddProduct !== "function") return { action: "requiresDetail" };
1171
1182
  const flowCtx = getAddFlowContextRef.current();
1172
1183
  return ticket.decideAddProduct(product, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, opts), {}, {
1173
1184
  date: (_flowCtx$date11 = flowCtx.date) !== null && _flowCtx$date11 !== void 0 ? _flowCtx$date11 : void 0,
1174
- customerId: flowCtx.customerId
1185
+ customerId: flowCtx.customerId,
1186
+ bookingConfig: (_flowCtx$bookingConfi6 = flowCtx.bookingConfig) !== null && _flowCtx$bookingConfi6 !== void 0 ? _flowCtx$bookingConfi6 : void 0,
1187
+ previousService: flowCtx.previousService
1175
1188
  }));
1176
1189
  },
1177
1190
  runAddProductFlow: (product, opts) => runFlowRef.current(product, opts),