@pisell/private-materials 6.12.312 → 6.12.314

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.
@@ -245,6 +245,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
245
245
  const app = (_utils$getApp = utils.getApp) === null || _utils$getApp === void 0 ? void 0 : _utils$getApp.call(utils);
246
246
  const hostChannel = String((engineContext === null || engineContext === void 0 || (_engineContext$appHel2 = engineContext.appHelper) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.constants) === null || _engineContext$appHel2 === void 0 || (_engineContext$appHel2 = _engineContext$appHel2.config) === null || _engineContext$appHel2 === void 0 ? void 0 : _engineContext$appHel2.channel) || "").trim().toLowerCase();
247
247
  const shouldUseConsumerPayment = hostChannel === "pc" || hostChannel === "h5";
248
+ const shouldUseFulfillmentCheckout = shouldUseConsumerPayment || platform === "kiosk";
248
249
  const shouldRequireLogin = require_useSalesUserLogin.isRequireLoginChannel(hostChannel);
249
250
  const { isLoggedIn, openLoginModal } = require_useSalesUserLogin.default();
250
251
  const [view, setView] = (0, react.useState)(() => require_layout.normalizeKioskNavigableView(kioskShellLayout, readKioskSessionView(context.sales.bookingTicket)));
@@ -265,8 +266,8 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
265
266
  const fulfillmentOpeningRef = (0, react.useRef)(false);
266
267
  const fulfillmentCheckout = require_useKioskFulfillmentCheckout.default({
267
268
  context,
268
- enabled: shouldUseConsumerPayment,
269
- scopeKey: `${osKey || ""}:${businessCode || ""}:${hostChannel}`,
269
+ enabled: shouldUseFulfillmentCheckout,
270
+ scopeKey: `${osKey || ""}:${businessCode || ""}:${hostChannel}:${platform}`,
270
271
  isActive,
271
272
  mobile: hostChannel === "h5"
272
273
  });
@@ -418,7 +419,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
418
419
  ...((_saleDetailModuleConf = saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.hidden) !== null && _saleDetailModuleConf !== void 0 ? _saleDetailModuleConf : []).filter((moduleKey) => !KIOSK_REQUIRED_MODULES.has(moduleKey))
419
420
  ])],
420
421
  cartItems: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 ? void 0 : saleDetailModuleConfig.cartItems), {}, {
421
- beforeContent: shouldUseConsumerPayment ? saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 || (_saleDetailModuleConf2 = saleDetailModuleConfig.cartItems) === null || _saleDetailModuleConf2 === void 0 ? void 0 : _saleDetailModuleConf2.beforeContent : /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(require_KioskPickupTiming.default, {
422
+ beforeContent: shouldUseFulfillmentCheckout ? saleDetailModuleConfig === null || saleDetailModuleConfig === void 0 || (_saleDetailModuleConf2 = saleDetailModuleConfig.cartItems) === null || _saleDetailModuleConf2 === void 0 ? void 0 : _saleDetailModuleConf2.beforeContent : /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(require_KioskPickupTiming.default, {
422
423
  key: `${osKey || ""}:${businessCode || ""}:${hostChannel}:${String(((_context$sales$tempOr = context.sales.tempOrder) === null || _context$sales$tempOr === void 0 || (_context$sales$tempOr = _context$sales$tempOr._extend) === null || _context$sales$tempOr === void 0 ? void 0 : _context$sales$tempOr.localId) || ((_context$sales$tempOr2 = context.sales.tempOrder) === null || _context$sales$tempOr2 === void 0 ? void 0 : _context$sales$tempOr2.external_sale_number) || ((_context$sales$tempOr3 = context.sales.tempOrder) === null || _context$sales$tempOr3 === void 0 ? void 0 : _context$sales$tempOr3.order_id) || orderId || "draft")}`,
423
424
  context,
424
425
  mobile: variant === "phone",
@@ -464,7 +465,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
464
465
  orderId,
465
466
  osKey,
466
467
  pickupTimingError,
467
- shouldUseConsumerPayment,
468
+ shouldUseFulfillmentCheckout,
468
469
  saleDetailModuleConfig,
469
470
  requestRemoveItemConfirmation,
470
471
  variant
@@ -646,7 +647,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
646
647
  };
647
648
  const performCheckout = function() {
648
649
  var _ref22 = require_asyncToGenerator._asyncToGenerator(function* () {
649
- if (checkoutOpeningRef.current || !shouldUseConsumerPayment && isPickupTimingPending || cartItemCount === 0) return;
650
+ if (checkoutOpeningRef.current || !shouldUseFulfillmentCheckout && isPickupTimingPending || cartItemCount === 0) return;
650
651
  checkoutOpeningRef.current = true;
651
652
  const openingScope = fulfillmentCheckout.captureScope();
652
653
  const isCurrentCheckoutRequest = () => {
@@ -670,15 +671,15 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
670
671
  setPickupTimingError(void 0);
671
672
  try {
672
673
  var _context$sales$bookin4, _context$sales$bookin5;
673
- if (shouldUseConsumerPayment && !(yield fulfillmentCheckout.request(true))) {
674
+ if (shouldUseFulfillmentCheckout && !(yield fulfillmentCheckout.request(true))) {
674
675
  setNavigableView("cart");
675
676
  return;
676
677
  }
677
- if (shouldUseConsumerPayment && !fulfillmentCheckout.isCurrent(openingScope)) return;
678
+ if (shouldUseFulfillmentCheckout && !fulfillmentCheckout.isCurrent(openingScope)) return;
678
679
  yield context.cart.waitForCartConsistency();
679
- if (shouldUseConsumerPayment && !fulfillmentCheckout.isCurrent(openingScope)) return;
680
+ if (shouldUseFulfillmentCheckout && !fulfillmentCheckout.isCurrent(openingScope)) return;
680
681
  yield (_context$sales$bookin4 = context.sales.bookingTicket) === null || _context$sales$bookin4 === void 0 || (_context$sales$bookin5 = _context$sales$bookin4.preparePickupTimingForCheckout) === null || _context$sales$bookin5 === void 0 ? void 0 : _context$sales$bookin5.call(_context$sales$bookin4);
681
- if (shouldUseConsumerPayment && !fulfillmentCheckout.isCurrent(openingScope)) return;
682
+ if (shouldUseFulfillmentCheckout && !fulfillmentCheckout.isCurrent(openingScope)) return;
682
683
  context.cart.refreshCartSnapshot();
683
684
  if (!isCurrentCheckoutRequest()) return;
684
685
  } catch (reason) {
@@ -941,7 +942,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
941
942
  const beginCheckoutWithFulfillment = function() {
942
943
  var _ref25 = require_asyncToGenerator._asyncToGenerator(function* () {
943
944
  if (!(yield businessAvailability.ensureCanShop())) return;
944
- if (!shouldUseConsumerPayment) {
945
+ if (!shouldUseFulfillmentCheckout) {
945
946
  continueCheckout();
946
947
  return;
947
948
  }
@@ -997,9 +998,9 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
997
998
  openCustomerAuth: (payload) => salesHostBridges.customerAuth.request(payload),
998
999
  setOrderCustomer: (_context$sales$bookin31 = context.sales.bookingTicket) === null || _context$sales$bookin31 === void 0 || (_context$sales$bookin31 = _context$sales$bookin31.setOrderCustomer) === null || _context$sales$bookin31 === void 0 ? void 0 : _context$sales$bookin31.bind(context.sales.bookingTicket),
999
1000
  loadDiscountConfig: () => context.cart.loadDiscountConfig(),
1000
- isActive: () => isActiveRef.current && (!shouldUseConsumerPayment || fulfillmentCheckout.isCurrent(openingScope))
1001
+ isActive: () => isActiveRef.current && (!shouldUseFulfillmentCheckout || fulfillmentCheckout.isCurrent(openingScope))
1001
1002
  }).then((canProceed) => {
1002
- if (canProceed && isActiveRef.current && (!shouldUseConsumerPayment || fulfillmentCheckout.isCurrent(openingScope))) return beginCheckoutWithFulfillment();
1003
+ if (canProceed && isActiveRef.current && (!shouldUseFulfillmentCheckout || fulfillmentCheckout.isCurrent(openingScope))) return beginCheckoutWithFulfillment();
1003
1004
  }).catch((error) => {
1004
1005
  console.warn("[KioskBigSale] Login2 登录后同步下单客户失败", error);
1005
1006
  }).finally(() => {
@@ -1016,7 +1017,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
1016
1017
  },
1017
1018
  callback: createKioskLoginContinuationHandler({
1018
1019
  continueCheckout: beginCheckoutWithFulfillment,
1019
- isActive: () => isActiveRef.current && (!shouldUseConsumerPayment || fulfillmentCheckout.isCurrent(openingScope)),
1020
+ isActive: () => isActiveRef.current && (!shouldUseFulfillmentCheckout || fulfillmentCheckout.isCurrent(openingScope)),
1020
1021
  syncAuthenticatedOrderCustomer: () => syncKioskAuthenticatedOrderCustomer({
1021
1022
  bookingTicket: context.sales.bookingTicket,
1022
1023
  loadDiscountConfig: () => context.cart.loadDiscountConfig()
@@ -1148,8 +1149,8 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
1148
1149
  })) : null, layoutState.showCart ? /* @__PURE__ */ react.default.createElement("section", {
1149
1150
  "aria-label": _pisell_utils.locales.getText("pisell2.big-sale.kiosk.your-order"),
1150
1151
  className: "pisell-kiosk-sale__screen pisell-kiosk-sale__cart-screen",
1151
- "data-fulfillment": !shouldUseConsumerPayment && isPickupTimingVisible ? "true" : "false"
1152
- }, shouldUseConsumerPayment || !isPickupTimingVisible ? /* @__PURE__ */ react.default.createElement("header", { className: "pisell-kiosk-sale__cart-header" }, /* @__PURE__ */ react.default.createElement("h1", null, _pisell_utils.locales.getText("pisell2.big-sale.kiosk.your-order"), " ", "(", cartItemCount, ")")) : null, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-kiosk-sale__cart-body" }, shouldUseConsumerPayment && pickupTimingError ? /* @__PURE__ */ react.default.createElement(antd.Alert, {
1152
+ "data-fulfillment": !shouldUseFulfillmentCheckout && isPickupTimingVisible ? "true" : "false"
1153
+ }, shouldUseFulfillmentCheckout || !isPickupTimingVisible ? /* @__PURE__ */ react.default.createElement("header", { className: "pisell-kiosk-sale__cart-header" }, /* @__PURE__ */ react.default.createElement("h1", null, _pisell_utils.locales.getText("pisell2.big-sale.kiosk.your-order"), " ", "(", cartItemCount, ")")) : null, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-kiosk-sale__cart-body" }, shouldUseFulfillmentCheckout && pickupTimingError ? /* @__PURE__ */ react.default.createElement(antd.Alert, {
1153
1154
  type: "error",
1154
1155
  showIcon: true,
1155
1156
  message: pickupTimingError,
@@ -1177,7 +1178,7 @@ function KioskBigSaleTemplate({ isActive = true, osKey, productListPreferencesCh
1177
1178
  promotionAppliedCount: selectedCustomerVoucherCount,
1178
1179
  onAddNote: openOrderNoteModal,
1179
1180
  onBack: handleCapsuleBack,
1180
- checkoutLoading: isCheckoutLoading || !shouldUseConsumerPayment && view === "cart" && isPickupTimingPending,
1181
+ checkoutLoading: isCheckoutLoading || !shouldUseFulfillmentCheckout && view === "cart" && isPickupTimingPending,
1181
1182
  checkoutDisabled: shoppingBlocked,
1182
1183
  onCheckout: handleCheckout,
1183
1184
  onTogglePromotion: isVirtualSettlementOrder ? void 0 : handleToggleFloatingPromotion,
@@ -65,7 +65,7 @@ function KioskSale(props) {
65
65
  const { menu_list_ids: _ignoredMenuListIds } = productLoadParams;
66
66
  return require_objectWithoutProperties._objectWithoutProperties(productLoadParams, _excluded2);
67
67
  }, [productLoadParams]);
68
- const resolvedOtherParams = (0, react.useMemo)(() => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherParams || {}), channel ? { channel } : {}), {}, { enableBusinessAvailability: Boolean(kioskPresentation.platform) }, kioskPresentation.platform ? { platform: kioskPresentation.platform } : {}), [
68
+ const resolvedOtherParams = (0, react.useMemo)(() => require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, otherParams || {}), {}, { enforceSingleBookingStartDate: true }, channel ? { channel } : {}), {}, { enableBusinessAvailability: Boolean(kioskPresentation.platform) }, kioskPresentation.platform ? { platform: kioskPresentation.platform } : {}), [
69
69
  channel,
70
70
  kioskPresentation.platform,
71
71
  otherParams
@@ -986,7 +986,8 @@ const SalesSdkCartProvider = ({ children, normalProductDetailConfig, deferHolder
986
986
  }
987
987
  return products;
988
988
  }
989
- const products = yield bookingTicket.addProductToOrder(productToAdd, booking, Object.keys(addOptions).length > 0 ? addOptions : void 0);
989
+ let products = yield bookingTicket.addProductToOrder(productToAdd, booking, Object.keys(addOptions).length > 0 ? addOptions : void 0);
990
+ if (booking && bookingTicket.removeBookingProductsOutsideStartDate) products = yield bookingTicket.removeBookingProductsOutsideStartDate(booking.start_date);
990
991
  const deferredConsistencyRefresh = scheduleDeferredAddConsistencyRefresh();
991
992
  refreshCartSnapshot(deferredConsistencyRefresh.refreshVersion);
992
993
  yield deferredConsistencyRefresh.promise;
@@ -1028,6 +1028,7 @@ interface BookingTicketHandle extends PickupTimingHandle {
1028
1028
  setSalesNote?: (input: SalesSdkSetSalesNoteInput) => Promise<SalesSdkSalesNote>;
1029
1029
  removeSalesNote?: (uuid: string) => Promise<void>;
1030
1030
  getOrderProducts: () => ScanOrderOrderProduct[];
1031
+ removeBookingProductsOutsideStartDate?: (startDate: unknown) => Promise<ScanOrderOrderProduct[]>;
1031
1032
  getDiscountList: () => any[];
1032
1033
  getOriginalDiscountList?: () => any[];
1033
1034
  replaceDiscountStoreLists?: (params: {
@@ -583,6 +583,7 @@ function _editCartLineBooking() {
583
583
  }, allowBookingReprice ? { allow_booking_reprice: true } : {}));
584
584
  }
585
585
  commitLifecycle === null || commitLifecycle === void 0 || commitLifecycle.beforeCommit();
586
+ if (bookingTicket.removeBookingProductsOutsideStartDate) yield bookingTicket.removeBookingProductsOutsideStartDate(bookingPatch === null || bookingPatch === void 0 ? void 0 : bookingPatch.start_date);
586
587
  products = input.syncQuantityByRows ? yield input.syncQuantityByRows({
587
588
  sources: targets,
588
589
  targetQuantity,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.312",
3
+ "version": "6.12.314",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -74,8 +74,8 @@
74
74
  "@pisell/pi-payment-sdk": "0.0.3",
75
75
  "@pisell/utils": "3.0.7",
76
76
  "@pisell/icon": "0.0.11",
77
- "@pisell/date-picker": "3.0.12",
78
- "@pisell/materials": "6.12.79"
77
+ "@pisell/materials": "6.12.79",
78
+ "@pisell/date-picker": "3.0.12"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "react": "^18.0.0",