@pisell/private-materials 6.12.486 → 6.12.488

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 (71) 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/render/default/view.js +3 -3
  6. package/build/lowcode/view.js +3 -3
  7. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  8. package/es/components/bigSale/components/ProductList/index.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/useBigSaleProductListConfig.js +1 -0
  13. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  14. package/es/components/bigSale/index.js +1 -0
  15. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  16. package/es/components/kiosk/components/Shell/useKioskMemberAction.js +1 -0
  17. package/es/components/kiosk/sales/KioskSaleSession.js +1 -0
  18. package/es/components/kiosk/sales/useCheckout.js +1 -0
  19. package/es/components/kiosk/sales/useSaleSessionExit.js +1 -0
  20. package/es/components/scanOrder/components/Check/index.js +33 -34
  21. package/es/components/scanOrder/utils/freePayment.test.cjs +21 -8
  22. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  23. package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
  24. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
  25. package/es/components/venueBookingSales/BookingComposer.js +5 -4
  26. package/es/components/venueBookingSales/availability/controller.js +1 -1
  27. package/es/components/venueBookingSales/catalogPresentation.js +1 -0
  28. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +1 -0
  29. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +1 -0
  30. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +1 -0
  31. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +1 -0
  32. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -0
  33. package/es/components/venueBookingSales/useBookingComposer.js +38 -7
  34. package/es/components/venueBookingSales/useVenueBookingSession.js +1 -0
  35. package/es/index.js +2 -0
  36. package/es/plus/multiCurrencySettlement/index.js +1 -1
  37. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  38. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  39. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  40. package/es/plus/pisellReservation/floorRoomCard/endingSoonHighlight.js +4 -4
  41. package/es/plus/pisellReservation/index.js +17 -0
  42. package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
  43. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  44. package/es/plus/saleDetail/Base.js +1 -0
  45. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  46. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  47. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  48. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  49. package/es/plus/saleDetail/index.js +1 -0
  50. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  51. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  52. package/es/plus/salesSdk/index.js +54 -0
  53. package/es/plus/salesSdk/types.d.ts +3 -1
  54. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  55. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  56. package/es/plus/salesSdk/utils/discountCard.js +2 -0
  57. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  58. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  59. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  60. package/es/pro/Login2.0/index.d.ts +2 -2
  61. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  62. package/es/pro/skuDetailModal/flow/calendarEntry.js +2 -2
  63. package/lib/components/scanOrder/components/Check/index.js +33 -34
  64. package/lib/components/scanOrder/utils/freePayment.test.cjs +21 -8
  65. package/lib/components/venueBookingSales/BookingComposer.js +5 -4
  66. package/lib/components/venueBookingSales/availability/controller.js +1 -1
  67. package/lib/components/venueBookingSales/useBookingComposer.js +38 -7
  68. package/lib/plus/salesSdk/types.d.ts +3 -1
  69. package/lib/plus/salesSdk/utils/discountCard.js +2 -0
  70. package/package.json +4 -4
  71. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -1,10 +1,10 @@
1
1
  import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import dayjs from "dayjs";
3
- import utcPlugin from "dayjs/plugin/utc";
4
- import timezonePlugin from "dayjs/plugin/timezone";
3
+ import utc from "dayjs/plugin/utc";
4
+ import timezone from "dayjs/plugin/timezone";
5
5
  //#region src/plus/saasDevice/devicePasscodes/model.ts
6
- dayjs.extend(utcPlugin);
7
- dayjs.extend(timezonePlugin);
6
+ dayjs.extend(utc);
7
+ dayjs.extend(timezone);
8
8
  const INITIAL_DEVICE_PASSCODE_STATE = {
9
9
  deviceIds: [],
10
10
  devicesById: {}
@@ -13,6 +13,7 @@ import { useSalesSdkCustomer } from "../salesSdk/hooks/useSalesSdkCustomer.js";
13
13
  import locales_default from "./locales.js";
14
14
  import { useSalesSdkBookingContext } from "../salesSdk/context/SalesSdkBookingContext.js";
15
15
  import { useSalesSdkSummary } from "../salesSdk/hooks/useSalesSdkSummary.js";
16
+ import "../salesSdk/index.js";
16
17
  import locales_default$1 from "./components/LineItem/locales.js";
17
18
  import { SaleOrderActionBoundary } from "./actions/index.js";
18
19
  import { SaleDetailTemplateRenderer } from "./tmpl/index.js";
@@ -2,6 +2,7 @@ import useEngineContext from "../../../../../hooks/useEngineContext.js";
2
2
  import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
3
3
  import { resolveContactsInfo } from "../utils.js";
4
4
  import { useSalesSdkBookingContext } from "../../../../salesSdk/context/SalesSdkBookingContext.js";
5
+ import "../../../../salesSdk/index.js";
5
6
  import { useMemo } from "react";
6
7
  import { useMemoizedFn } from "ahooks";
7
8
  //#region src/plus/saleDetail/components/Client/hooks/useClientSelectorProps.ts
@@ -4,6 +4,7 @@ import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.
4
4
  import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
5
5
  import useLogger from "../../../../hooks/useLogger.js";
6
6
  import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
7
+ import "../../../salesSdk/index.js";
7
8
  import { invokeLocalReceiptPrint, resolveLocalReceiptPrintModule, resolveSaleDetailOrderIdFromSales } from "./utils.js";
8
9
  import { getRemotePrintActions, getWristbandList } from "../../serve.js";
9
10
  import { EBizPrintType } from "./types.js";
@@ -10,6 +10,7 @@ import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
10
10
  import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
11
11
  import { useSalesSdkGlobalScanActivity } from "../../../salesSdk/context/SalesSdkGlobalScanActivityContext.js";
12
12
  import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
13
+ import "../../../salesSdk/index.js";
13
14
  import { resolveSaleDetailTempOrder } from "../../utils.js";
14
15
  import { getNumericAmount, getSalesHostModule, resolveSaleDetailOrderIdFromSales, resolveSaleDetailOrderIdFromSalesResult, shouldCloseDialogAfterCheckout, updateLocalOrder } from "./utils.js";
15
16
  import { deriveSaleOrderSubmitState } from "../../actions/state.js";
@@ -5,6 +5,7 @@ import { isAppliedPaymentRecord } from "../../../salesSdk/utils/paymentStatus.js
5
5
  import { useSalesSdk } from "../../../salesSdk/hooks/useSalesSdk.js";
6
6
  import { useSalesSdkCart } from "../../../salesSdk/hooks/useSalesSdkCart.js";
7
7
  import { useSalesSdkSummary } from "../../../salesSdk/hooks/useSalesSdkSummary.js";
8
+ import "../../../salesSdk/index.js";
8
9
  import { resolveSaleDetailTempOrder } from "../../utils.js";
9
10
  import React, { memo, useMemo } from "react";
10
11
  import { formatAmount, locales } from "@pisell/utils";
@@ -5,6 +5,7 @@ import { useSalesSdk } from "../salesSdk/hooks/useSalesSdk.js";
5
5
  import { SalesSdkProvider } from "../salesSdk/context/SalesSdkProvider.js";
6
6
  import { SalesSdkDishProvider } from "../salesSdk/context/SalesSdkDishContext.js";
7
7
  import { SalesSdkBookingContextProvider } from "../salesSdk/context/SalesSdkBookingContext.js";
8
+ import "../salesSdk/index.js";
8
9
  import Base_default from "./Base.js";
9
10
  import { resolveSaleDetailOsProps } from "./osProps.js";
10
11
  import React, { forwardRef, useImperativeHandle } from "react";
@@ -1,6 +1,7 @@
1
1
  import useStableInstanceId from "../../../../../../hooks/useStableInstanceId.js";
2
2
  import { useSalesSdkDish } from "../../../../../salesSdk/hooks/useSalesSdkDish.js";
3
3
  import { useCurrentSalesSdkDish } from "../../../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
4
+ import "../../../../../salesSdk/index.js";
4
5
  import { SaleDetailStatusOverview } from "../shared/StatusOverview.js";
5
6
  import { DishGroupView } from "./DishGroupView.js";
6
7
  import dayjs from "dayjs";
@@ -1,6 +1,7 @@
1
1
  import useEngineContext from "../../../../hooks/useEngineContext.js";
2
2
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
3
3
  import { useCurrentSalesSdkDish } from "../../../salesSdk/hooks/useCurrentSalesSdkDish.js";
4
+ import "../../../salesSdk/index.js";
4
5
  import { getInternalNotesByScheduleEvent } from "../../serve.js";
5
6
  import { TEMPLATE_B_PAY_ACTIONS, TEMPLATE_B_SUMMARY_ACTIONS } from "../../components/DetailActions/configs/index.js";
6
7
  import { DetailActions } from "../../components/DetailActions/index.js";
@@ -0,0 +1,54 @@
1
+ import "./hosts/createInstanceHostBridge.js";
2
+ import "./holderConfirm/createHolderConfirmBridge.js";
3
+ import "./giftSelect/createGiftSelectBridge.js";
4
+ import "./context/SalesSdkHostBridgesContext.js";
5
+ import "./utils/formatHolderOptions.js";
6
+ import "./utils/enrichCartLineHolderDisplay.js";
7
+ import "./context/SalesSdkHolderContext.js";
8
+ import "../multiCurrencySettlement/index.js";
9
+ import "./utils/customerAuthGate.js";
10
+ import "./context/SalesSdkBusinessAvailabilityContext.js";
11
+ import "./utils/appendPromotionTags.js";
12
+ import "./utils/productSkuOptions.js";
13
+ import "./context/SalesSdkUIHostsContext.js";
14
+ import "./utils/runAddProductFlow.js";
15
+ import "./components/showAddToCartToast.js";
16
+ import "./utils/resolveAddProductDebounceKey.js";
17
+ import "./utils/identity.js";
18
+ import "./utils/resolveInCartQuantityForAddToast.js";
19
+ import "./utils/addProductWithFlowDebounced.js";
20
+ import "./utils/bookingDate.js";
21
+ import "./utils/holderSubmitValidation.js";
22
+ import "./utils/removeOrderProducts.js";
23
+ import "./selectors.js";
24
+ import "./utils/enrich.js";
25
+ import "./giftSelect/createOpenGiftSelectHost.js";
26
+ import "./utils/ensureHoldersBeforeSubmit.js";
27
+ import "./hooks/useSalesSdk.js";
28
+ import "./bookingEditService/BookingEditServiceDrawer.js";
29
+ import "./hosts/BookingEditHostRenderer.js";
30
+ import "./hosts/CustomerAuthHostRenderer.js";
31
+ import "./hooks/useSalesSdkCart.js";
32
+ import "./hooks/useSalesSdkCustomer.js";
33
+ import "./normalProductDetail/NormalProductDetailHostRenderer.js";
34
+ import "./hosts/createOpenBookingEditHost.js";
35
+ import "./hosts/createOpenMultiDaySelectHost.js";
36
+ import "./hosts/createOpenHolderSelectHost.js";
37
+ import "./hosts/createOpenCustomerAuthHost.js";
38
+ import "./demo/hosts/legacyOpenProductDetail.js";
39
+ import "./hosts/createCompositeOpenProductDetailHost.js";
40
+ import "./normalProductDetail/createOpenNormalProductDetailHost.js";
41
+ import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
42
+ import "./giftSelect/GiftSelectModal.js";
43
+ import "./giftSelect/GiftSelectHostRenderer.js";
44
+ import "./allergy/AllergySelectionModal.js";
45
+ import "./context/SalesSdkProvider.js";
46
+ import "./context/SalesSdkDishContext.js";
47
+ import "./context/SalesSdkBookingContext.js";
48
+ import "./hooks/useSalesSdkSummary.js";
49
+ import "./hooks/useSalesSdkProducts.js";
50
+ import "./demo/index.js";
51
+ import "./hooks/useSalesSdkDish.js";
52
+ import "./hooks/useCurrentSalesSdkDish.js";
53
+ import "./hooks/useSyncOsModule.js";
54
+ export {};
@@ -1145,8 +1145,10 @@ interface BookingTicketHandle extends PickupTimingHandle {
1145
1145
  getOpenData?: () => Promise<Record<string, any> | null>;
1146
1146
  getContactInfoConfig?: () => Promise<SalesContactInfoConfig>;
1147
1147
  validateContactInfo?: () => Promise<void>;
1148
- /** Online venue-ticket checkout: reject missing configured required products. */
1148
+ /** Online checkout: reject missing required products and online venue-ticket upper bounds. */
1149
1149
  validateRequiredProducts?: () => Promise<void>;
1150
+ /** Remaining online venue-ticket quantity, or undefined when no upper bound applies. */
1151
+ getVenueTicketRemainingQuantity?: (productId: number) => Promise<number | undefined>;
1150
1152
  /** Fetch bundle relations for catalog cards when revealing a missing required product. */
1151
1153
  queryRequiredProductBundles?: (productIds: number[]) => Promise<ProductData[]>;
1152
1154
  /** 写入当前临时订单根字段 tempOrder.buzzer。 */
@@ -407,4 +407,4 @@ function createAddProductWithFlowDebounced(deps) {
407
407
  };
408
408
  }
409
409
  //#endregion
410
- export { createAddProductWithFlowDebounced };
410
+ export { createAddProductWithFlowDebounced, shouldBypassAddProductDebounce };
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
31
31
  return typeof off === "function" ? off : () => {};
32
32
  }
33
33
  //#endregion
34
- export { formatBookingDateTime, subscribeBookingDateChange };
34
+ export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
@@ -141,6 +141,8 @@ function buildMachineCodeHolderPayload(context, options) {
141
141
  };
142
142
  }
143
143
  function shouldSkipCustomerRepriceForDiscountedLine(line) {
144
+ var _line$metadata;
145
+ if ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata._giftInfo) return true;
144
146
  return Array.isArray(line.discount_list) && line.discount_list.some(isDiscountCardApplied);
145
147
  }
146
148
  //#endregion
@@ -102,4 +102,4 @@ function buildHolderListRequestKey(params) {
102
102
  });
103
103
  }
104
104
  //#endregion
105
- export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, resolveHolderDisplayConfig };
105
+ export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
@@ -7,12 +7,12 @@ import React, { useCallback, useEffect, useMemo, useRef } from "react";
7
7
  import { locales } from "@pisell/utils";
8
8
  import { Button, PisellEmpty, PisellModal, PisellStatisticList, Skeleton, Timeline, usePisellConfig } from "@pisell/materials";
9
9
  import { useRequest } from "ahooks";
10
- import utcPlugin from "dayjs/plugin/utc";
11
- import timezonePlugin from "dayjs/plugin/timezone";
10
+ import utc from "dayjs/plugin/utc";
11
+ import timezone from "dayjs/plugin/timezone";
12
12
  import "./index.less";
13
13
  //#region src/plus/walletPassGallery/components/timelineSection/index.tsx
14
- dayjs.extend(timezonePlugin);
15
- dayjs.extend(utcPlugin);
14
+ dayjs.extend(timezone);
15
+ dayjs.extend(utc);
16
16
  const stateTimeUnix = 1723255863;
17
17
  const POLL_INTERVAL = 2e3;
18
18
  const POLL_MAX_TIMES = 5;
@@ -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,4 +1,4 @@
1
- import { AuthMethodType, VerificationMethod } from "./shared/types.js";
1
+ import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
2
2
  import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
3
3
  import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
4
- 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, VerificationMethod };
229
+ export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
@@ -1,9 +1,9 @@
1
1
  import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { isMultiDayProduct } from "../../../components/booking/info2/service/addService/utils.js";
3
3
  import dayjs from "dayjs";
4
- import utcPlugin from "dayjs/plugin/utc";
4
+ import utc from "dayjs/plugin/utc";
5
5
  //#region src/pro/skuDetailModal/flow/calendarEntry.ts
6
- dayjs.extend(utcPlugin);
6
+ dayjs.extend(utc);
7
7
  /** Calendar timestamps belong to the shop clock, rather than the browser clock. */
8
8
  function calendarDateTime(value) {
9
9
  const matched = value.match(/(Z|([+-])(\d{2}):(\d{2}))$/i);
@@ -178,43 +178,42 @@ function Check() {
178
178
  paymentAmount,
179
179
  paymentAmountType: typeof paymentAmount,
180
180
  amountSource: (res === null || res === void 0 || (_res$data11 = res.data) === null || _res$data11 === void 0 ? void 0 : _res$data11.order_wait_pay_amount) != null ? "response.order_wait_pay_amount" : "viewModel.summary.total_amount",
181
- branch: shouldPayOnSubmit ? require_freePayment.isZeroPaymentAmount(paymentAmount) ? "free-pay" : "pisell1.payment" : "order-details",
181
+ branch: !isAdditionalOrder && require_freePayment.isZeroPaymentAmount(paymentAmount) ? "free-pay" : shouldPayOnSubmit ? "pisell1.payment" : "order-details",
182
182
  hasFreePayBranch: true
183
183
  });
184
- if (shouldPayOnSubmit) {
185
- if (yield require_freePayment.handleScanOrderFreePayment({
186
- orderId,
187
- amount: paymentAmount,
188
- utils,
189
- restoreOrder: () => runModuleAction("restoreOrder"),
190
- showFailure: showSubmitFailedTip
191
- })) return;
192
- utils.action({
193
- type: "pisell1.payment",
194
- data: {
195
- order_id: orderId,
196
- total_amount: paymentAmount,
197
- sale_channel: saleChannel
198
- },
199
- callback: function() {
200
- var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (_e) {
201
- require_paymentLog.logScanOrder(utils, "支付回调", {
202
- orderId,
203
- type: _e === null || _e === void 0 ? void 0 : _e.type,
204
- status: _e === null || _e === void 0 ? void 0 : _e.status
205
- });
206
- try {
207
- yield runModuleAction("restoreOrder");
208
- } catch (error) {
209
- require_paymentLog.logScanOrder(utils, "restoreOrder after payment failed", require_paymentLog.scanOrderError(error), "error");
210
- }
184
+ if (!isAdditionalOrder && (yield require_freePayment.handleScanOrderFreePayment({
185
+ orderId,
186
+ amount: paymentAmount,
187
+ utils,
188
+ restoreOrder: () => runModuleAction("restoreOrder"),
189
+ showFailure: showSubmitFailedTip
190
+ }))) return;
191
+ if (shouldPayOnSubmit) utils.action({
192
+ type: "pisell1.payment",
193
+ data: {
194
+ order_id: orderId,
195
+ total_amount: paymentAmount,
196
+ sale_channel: saleChannel
197
+ },
198
+ callback: function() {
199
+ var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (_e) {
200
+ require_paymentLog.logScanOrder(utils, "支付回调", {
201
+ orderId,
202
+ type: _e === null || _e === void 0 ? void 0 : _e.type,
203
+ status: _e === null || _e === void 0 ? void 0 : _e.status
211
204
  });
212
- return function callback(_x2) {
213
- return _ref2.apply(this, arguments);
214
- };
215
- }()
216
- });
217
- } else {
205
+ try {
206
+ yield runModuleAction("restoreOrder");
207
+ } catch (error) {
208
+ require_paymentLog.logScanOrder(utils, "restoreOrder after payment failed", require_paymentLog.scanOrderError(error), "error");
209
+ }
210
+ });
211
+ return function callback(_x2) {
212
+ return _ref2.apply(this, arguments);
213
+ };
214
+ }()
215
+ });
216
+ else {
218
217
  var _utils$history, _utils$history2;
219
218
  try {
220
219
  yield runModuleAction("restoreOrder");
@@ -35,12 +35,17 @@ function visit(node) {
35
35
  }
36
36
  visit(parsed);
37
37
 
38
- test('scan order zero bypasses modal, positive preserves channel, failed free payment keeps order', async () => {
39
- for (const [amount, success, payOnSubmit] of [[0, true, true], ['0.00', true, true], [5, true, true], [0, false, true], [0, true, false]]) {
38
+ test('scan order zero pays regardless of pay-on-submit; positive and additional orders preserve their flow', async () => {
39
+ for (const [amount, success, payOnSubmit, isAdditionalOrder = false] of [
40
+ [0, true, true], ['0.00', true, true], [5, true, true], [0, false, true],
41
+ [0, true, false], ['0.00', true, false], [0, false, false], [5, true, false],
42
+ [0, true, undefined], [0, false, undefined], [5, true, undefined],
43
+ [0, true, true, true], [0, true, false, true],
44
+ ]) {
40
45
  const events = [];
41
46
  const ctx = {
42
47
  logScanOrder: logger.logScanOrder, scanOrderError: logger.scanOrderError,
43
- viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: 'default', isAdditionalOrder: false,
48
+ viewModel: { cartItems: [{}], summary: { total_amount: 99 } }, note: '', channel: 'scan_to_order', entryMode: isAdditionalOrder ? 'additional_order' : 'default', isAdditionalOrder,
44
49
  dineInConfig: { 'sale.require_payment_on_submit': payOnSubmit },
45
50
  runModuleAction: async (name) => { events.push(name); return name === 'submitScanOrder' ? { status: true, data: { order_id: 123, order_wait_pay_amount: amount } } : undefined; },
46
51
  clearStepCache() {}, refreshViewModel: async () => {},
@@ -51,12 +56,20 @@ test('scan order zero bypasses modal, positive preserves channel, failed free pa
51
56
  handleScanOrderFreePayment: api.handleScanOrderFreePayment,
52
57
  };
53
58
  await vm.runInNewContext(transpile('const run = ' + submit + '; run();'), ctx);
54
- if (!payOnSubmit) { assert(!events.includes('free-pay')); assert(events.includes('/order/details?id=123')); }
55
- else if (Number(amount) > 0) { assert(events.includes('modal')); assert(!events.includes('free-pay')); }
56
- else {
57
- assert(events.includes('free-pay')); assert(!events.includes('modal'));
59
+ if (!isAdditionalOrder && api.isZeroPaymentAmount(amount)) {
60
+ assert.equal(events.filter(event => event === 'free-pay').length, 1);
61
+ assert(!events.includes('modal'));
62
+ assert(!events.includes('/order/details?id=123'));
58
63
  if (success) assert(events.includes('/payment-finish/success?amount=0&order_id=123'));
59
- else { assert(events.includes('failure')); assert(!events.includes('restoreOrder')); }
64
+ else {
65
+ assert(events.includes('failure')); assert(!events.includes('restoreOrder'));
66
+ assert(!events.includes('/payment-finish/success?amount=0&order_id=123'));
67
+ }
68
+ } else if (payOnSubmit && !isAdditionalOrder) {
69
+ assert(events.includes('modal')); assert(!events.includes('free-pay'));
70
+ } else {
71
+ assert(!events.includes('free-pay')); assert(!events.includes('modal'));
72
+ assert(events.includes('/order/details?id=123'));
60
73
  }
61
74
  }
62
75
  });
@@ -25,7 +25,7 @@ function BookingComposer(props) {
25
25
  const text = (en, zh) => locale === "zh" ? zh : en;
26
26
  const model = require_useBookingComposer.useBookingComposer(props);
27
27
  const bookingUI = require_context.useOptionalBookingUI();
28
- const { configuration, setConfiguration, quantity, setQuantity, quote, error, working, revision, commit } = model;
28
+ const { configuration, setConfiguration, quantity, setQuantity, maxQuantity, quantityDisabled, quote, error, working, revision, commit } = model;
29
29
  const configurationDetail = mode === "tickets" && ((_draft$plan = draft.plan) === null || _draft$plan === void 0 ? void 0 : _draft$plan.hasConfiguration) ? draft.plan.productDetail : void 0;
30
30
  const overSold = require_skuSemantics.isSkuFlagSet((_props$skuOptions$con = (_props$skuOptions = props.skuOptions) === null || _props$skuOptions === void 0 || (_props$skuOptions = _props$skuOptions.config) === null || _props$skuOptions === void 0 ? void 0 : _props$skuOptions.overSold) !== null && _props$skuOptions$con !== void 0 ? _props$skuOptions$con : draft.detail.over_sold);
31
31
  const configurationComplete = (0, react.useMemo)(() => Boolean(configurationDetail && require_prepare.validateBookingProductConfiguration(configurationDetail, configuration.skuValue, {
@@ -70,7 +70,7 @@ function BookingComposer(props) {
70
70
  return (scrollContainer === null || scrollContainer === void 0 || (_scrollContainer$clos = scrollContainer.closest("[role=\"dialog\"]")) === null || _scrollContainer$clos === void 0 ? void 0 : _scrollContainer$clos.querySelector(".booking-config-actions .booking-primary-action")) || null;
71
71
  }
72
72
  }));
73
- const quantityControl = (busy = false) => mode === "tickets" && !draft.lineUid ? /* @__PURE__ */ react.default.createElement("div", {
73
+ const quantityControl = (busy = false) => mode === "tickets" && !draft.lineUid && maxQuantity !== 0 ? /* @__PURE__ */ react.default.createElement("div", {
74
74
  className: "reservation-quantity",
75
75
  role: "group",
76
76
  "aria-label": text("Number", "数量")
@@ -78,15 +78,16 @@ function BookingComposer(props) {
78
78
  className: "booking-ticket-quantity",
79
79
  variant: "capsule",
80
80
  min: 1,
81
+ max: maxQuantity,
81
82
  step: 1,
82
83
  value: quantity,
83
- disabled: busy || working || props.disabled,
84
+ disabled: busy || working || props.disabled || quantityDisabled,
84
85
  commitInputOnClose: false,
85
86
  selectAllInputOnOpen: true,
86
87
  clearSelectedInputOnDelete: true,
87
88
  ignoreEmptyInputConfirm: true,
88
89
  onChange: (value) => {
89
- if (!busy && !working && !props.disabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
90
+ if (!busy && !working && !props.disabled && !quantityDisabled && Number.isSafeInteger(value) && value >= 1) setQuantity(value);
90
91
  }
91
92
  })) : null;
92
93
  const footer = /* @__PURE__ */ react.default.createElement("div", { className: "venue-booking-sales__booking-footer" }, quantityControl(), /* @__PURE__ */ react.default.createElement("div", {
@@ -181,7 +181,7 @@ var BookingAvailabilityController = class {
181
181
  });
182
182
  return result;
183
183
  } catch (error) {
184
- const rejectedBeforeWrite = !!error && typeof error === "object" && "code" in error && error.code === "BUSINESS_UNAVAILABLE";
184
+ const rejectedBeforeWrite = !!error && typeof error === "object" && "code" in error && (error.code === "BUSINESS_UNAVAILABLE" || error.code === "ITEM_QUANTITY_LIMIT");
185
185
  _this.publish({
186
186
  status: "error",
187
187
  ready: false,
@@ -17,10 +17,11 @@ let react = require("react");
17
17
  * Start a new keyed hook owner for a new draft/openId, as the existing Composer does.
18
18
  */
19
19
  function useBookingComposer(props) {
20
- var _draft$openId, _draft$plan, _draft$detail$product, _selection$candidate, _os$otherParams, _context$sales$salesS, _selection$requiremen2, _selection$selectedRe;
20
+ var _draft$detail$product, _draft$openId, _draft$plan, _draft$detail$product2, _selection$candidate, _os$otherParams, _context$sales$salesS, _selection$requiremen2, _selection$selectedRe;
21
21
  const { mode, draft, context, date, scopeKey, locale, priceSource } = props;
22
22
  const text = (en, zh) => locale === "zh" ? zh : en;
23
- const os = context.sales.bookingTicket;
23
+ const ticket = context.sales.bookingTicket;
24
+ const os = ticket;
24
25
  const businessAvailability = require_SalesSdkBusinessAvailabilityContext.useSalesSdkBusinessAvailability();
25
26
  const panel = (0, react.useRef)(null);
26
27
  const [configuration, setConfiguration] = (0, react.useState)(draft.configuration);
@@ -28,6 +29,33 @@ function useBookingComposer(props) {
28
29
  const initialQuantity = Number(draft.quantity);
29
30
  return Number.isSafeInteger(initialQuantity) && initialQuantity > 0 ? initialQuantity : 1;
30
31
  });
32
+ const productId = Number((_draft$detail$product = draft.detail.product_id) !== null && _draft$detail$product !== void 0 ? _draft$detail$product : draft.detail.id);
33
+ const checkQuantityLimit = mode === "tickets" && !draft.lineUid && !!(ticket === null || ticket === void 0 ? void 0 : ticket.getVenueTicketRemainingQuantity);
34
+ const [quantityLimit, setQuantityLimit] = (0, react.useState)();
35
+ (0, react.useEffect)(() => {
36
+ if (!checkQuantityLimit || !(ticket === null || ticket === void 0 ? void 0 : ticket.getVenueTicketRemainingQuantity)) return;
37
+ let active = true;
38
+ setQuantityLimit(void 0);
39
+ ticket.getVenueTicketRemainingQuantity(productId).then((remaining) => {
40
+ if (!active) return;
41
+ if (remaining !== void 0 && remaining > 0) setQuantity((current) => Math.min(current, remaining));
42
+ setQuantityLimit({ remaining });
43
+ }, () => {
44
+ if (active) setQuantityLimit({ failed: true });
45
+ });
46
+ return () => {
47
+ active = false;
48
+ };
49
+ }, [
50
+ checkQuantityLimit,
51
+ ticket,
52
+ productId,
53
+ scopeKey
54
+ ]);
55
+ const maxQuantity = checkQuantityLimit ? quantityLimit === null || quantityLimit === void 0 ? void 0 : quantityLimit.remaining : void 0;
56
+ const quantityDisabled = checkQuantityLimit && (!quantityLimit || !!quantityLimit.failed || maxQuantity === 0);
57
+ const quantityValid = !quantityDisabled && (maxQuantity === void 0 || quantity <= maxQuantity);
58
+ const quantityError = checkQuantityLimit && (quantityLimit === null || quantityLimit === void 0 ? void 0 : quantityLimit.failed) ? text("Unable to check the ticket limit. Reopen this ticket to try again.", "无法核对门票限购数量,请重新打开门票。") : maxQuantity === 0 ? text("You have reached the limit for this ticket.", "已达到该门票的购买上限。") : void 0;
31
59
  const [selection, setSelection] = (0, react.useState)();
32
60
  const lastDraftIntent = (0, react.useRef)(draft.initialSelection);
33
61
  const [quote, setQuote] = (0, react.useState)();
@@ -66,7 +94,7 @@ function useBookingComposer(props) {
66
94
  scopeKey,
67
95
  mode,
68
96
  (_draft$openId = draft.openId) !== null && _draft$openId !== void 0 ? _draft$openId : (_draft$plan = draft.plan) === null || _draft$plan === void 0 ? void 0 : _draft$plan.openId,
69
- (_draft$detail$product = draft.detail.product_id) !== null && _draft$detail$product !== void 0 ? _draft$detail$product : draft.detail.id,
97
+ (_draft$detail$product2 = draft.detail.product_id) !== null && _draft$detail$product2 !== void 0 ? _draft$detail$product2 : draft.detail.id,
70
98
  draft.lineUid,
71
99
  date,
72
100
  quantity,
@@ -92,7 +120,7 @@ function useBookingComposer(props) {
92
120
  (0, react.useEffect)(() => {
93
121
  let active = true;
94
122
  setQuote(void 0);
95
- if (!(selection === null || selection === void 0 ? void 0 : selection.candidate) || !["selecting", "ready"].includes(selection.status) || mode !== "tickets" && !selection.ready || selection.requiresOrderReconciliation || selection.candidate.date !== date || selection.candidate.availabilityContextId !== selection.contextId || !selection.times.some((time) => require_queries.sameContextualTime(time, selection.candidate) && require_queries.selectable(time, (selection.partySize || 0) * selection.bookingCount))) return;
123
+ if (!quantityValid || !(selection === null || selection === void 0 ? void 0 : selection.candidate) || !["selecting", "ready"].includes(selection.status) || mode !== "tickets" && !selection.ready || selection.requiresOrderReconciliation || selection.candidate.date !== date || selection.candidate.availabilityContextId !== selection.contextId || !selection.times.some((time) => require_queries.sameContextualTime(time, selection.candidate) && require_queries.selectable(time, (selection.partySize || 0) * selection.bookingCount))) return;
96
124
  setError(void 0);
97
125
  require_price.quoteBookingProduct({
98
126
  os: priceSource,
@@ -116,6 +144,7 @@ function useBookingComposer(props) {
116
144
  draft,
117
145
  prepared.product,
118
146
  revision,
147
+ quantityValid,
119
148
  selection === null || selection === void 0 ? void 0 : selection.ready,
120
149
  selection === null || selection === void 0 ? void 0 : selection.status,
121
150
  selection === null || selection === void 0 ? void 0 : selection.contextId,
@@ -124,7 +153,7 @@ function useBookingComposer(props) {
124
153
  const commit = function() {
125
154
  var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
126
155
  var _busyCallback$current2, _os$getTempOrder, _props$operationLog, _prepared$product$pro, _selection$requiremen;
127
- if (lock.current || props.disabled || !quote || !(selection === null || selection === void 0 ? void 0 : selection.ready) || !selection.candidate || !panel.current) return false;
156
+ if (lock.current || props.disabled || !quantityValid || !quote || !(selection === null || selection === void 0 ? void 0 : selection.ready) || !selection.candidate || !panel.current) return false;
128
157
  lock.current = true;
129
158
  setWorking(true);
130
159
  (_busyCallback$current2 = busyCallback.current) === null || _busyCallback$current2 === void 0 || _busyCallback$current2.call(busyCallback, true);
@@ -272,7 +301,7 @@ function useBookingComposer(props) {
272
301
  resourceSettingsFailed: Boolean(context.sales.salesSettingsError),
273
302
  onRetryResourceSettings: context.sales.ensureSalesSettings
274
303
  };
275
- const bookingReady = Boolean((selection === null || selection === void 0 ? void 0 : selection.ready) && quote && !selection.requiresOrderReconciliation);
304
+ const bookingReady = Boolean(quantityValid && (selection === null || selection === void 0 ? void 0 : selection.ready) && quote && !selection.requiresOrderReconciliation);
276
305
  const cancel = () => {
277
306
  if (!lock.current) props.onCancel();
278
307
  };
@@ -281,10 +310,12 @@ function useBookingComposer(props) {
281
310
  setConfiguration,
282
311
  quantity,
283
312
  setQuantity,
313
+ maxQuantity,
314
+ quantityDisabled,
284
315
  prepared,
285
316
  selection,
286
317
  quote,
287
- error,
318
+ error: quantityError !== null && quantityError !== void 0 ? quantityError : error,
288
319
  working,
289
320
  revision,
290
321
  panelRef: panel,
@@ -1145,8 +1145,10 @@ interface BookingTicketHandle extends PickupTimingHandle {
1145
1145
  getOpenData?: () => Promise<Record<string, any> | null>;
1146
1146
  getContactInfoConfig?: () => Promise<SalesContactInfoConfig>;
1147
1147
  validateContactInfo?: () => Promise<void>;
1148
- /** Online venue-ticket checkout: reject missing configured required products. */
1148
+ /** Online checkout: reject missing required products and online venue-ticket upper bounds. */
1149
1149
  validateRequiredProducts?: () => Promise<void>;
1150
+ /** Remaining online venue-ticket quantity, or undefined when no upper bound applies. */
1151
+ getVenueTicketRemainingQuantity?: (productId: number) => Promise<number | undefined>;
1150
1152
  /** Fetch bundle relations for catalog cards when revealing a missing required product. */
1151
1153
  queryRequiredProductBundles?: (productIds: number[]) => Promise<ProductData[]>;
1152
1154
  /** 写入当前临时订单根字段 tempOrder.buzzer。 */
@@ -141,6 +141,8 @@ function buildMachineCodeHolderPayload(context, options) {
141
141
  };
142
142
  }
143
143
  function shouldSkipCustomerRepriceForDiscountedLine(line) {
144
+ var _line$metadata;
145
+ if ((_line$metadata = line.metadata) === null || _line$metadata === void 0 ? void 0 : _line$metadata._giftInfo) return true;
144
146
  return Array.isArray(line.discount_list) && line.discount_list.some(isDiscountCardApplied);
145
147
  }
146
148
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.486",
3
+ "version": "6.12.488",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -75,10 +75,10 @@
75
75
  "styled-components": "^6.0.0-rc.3",
76
76
  "use-sync-external-store": "^1.6.0",
77
77
  "@pisell/pi-payment-sdk": "0.0.5",
78
- "@pisell/utils": "3.0.7",
79
78
  "@pisell/icon": "0.0.11",
80
- "@pisell/materials": "6.12.107",
81
- "@pisell/date-picker": "3.0.12"
79
+ "@pisell/utils": "3.0.7",
80
+ "@pisell/date-picker": "3.0.12",
81
+ "@pisell/materials": "6.12.107"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^18.0.0",
@@ -1 +0,0 @@
1
- export { };