@pisell/private-materials 6.12.487 → 6.12.489

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 (65) 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 +2 -2
  6. package/build/lowcode/view.js +2 -2
  7. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +0 -1
  8. package/es/components/bigSale/components/ProductList/index.js +0 -1
  9. package/es/components/bigSale/components/TimeBar/index.js +0 -1
  10. package/es/components/bigSale/dialog.js +0 -1
  11. package/es/components/bigSale/hooks/useBigSaleContext.js +0 -1
  12. package/es/components/bigSale/hooks/useBigSaleProductListConfig.js +1 -0
  13. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +0 -1
  14. package/es/components/bigSale/index.js +0 -1
  15. package/es/components/bigSale/templates/Kiosk/index.js +0 -1
  16. package/es/components/kiosk/components/Shell/useKioskMemberAction.js +0 -1
  17. package/es/components/kiosk/sales/KioskSaleSession.js +0 -1
  18. package/es/components/kiosk/sales/useCheckout.js +0 -1
  19. package/es/components/kiosk/sales/useSaleSessionExit.js +0 -1
  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 +0 -1
  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/catalogPresentation.js +1 -0
  26. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +0 -1
  27. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
  28. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +0 -1
  29. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +0 -1
  30. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +0 -1
  31. package/es/components/venueBookingSales/useVenueBookingSession.js +0 -1
  32. package/es/index.js +0 -2
  33. package/es/plus/multiCurrencySettlement/index.js +1 -1
  34. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  35. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  36. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  37. package/es/plus/pisellReservation/floorRoomCard/endingSoonHighlight.js +4 -4
  38. package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
  39. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  40. package/es/plus/saleDetail/Base.js +0 -1
  41. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
  42. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
  43. package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
  44. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
  45. package/es/plus/saleDetail/index.js +0 -1
  46. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
  47. package/es/plus/saleDetail/tmpl/B/index.js +0 -1
  48. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  49. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  50. package/es/plus/salesSdk/utils/discountCard.js +2 -0
  51. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  52. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  53. package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
  54. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  55. package/es/pro/Login2.0/index.d.ts +2 -2
  56. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  57. package/es/pro/skuDetailModal/flow/calendarEntry.js +2 -2
  58. package/es/pro/skuDetailModal/flow/registry.d.ts +1 -1
  59. package/lib/components/scanOrder/components/Check/index.js +33 -34
  60. package/lib/components/scanOrder/utils/freePayment.test.cjs +21 -8
  61. package/lib/plus/salesSdk/utils/discountCard.js +2 -0
  62. package/lib/pro/skuDetailModal/flow/registry.d.ts +1 -1
  63. package/package.json +2 -2
  64. package/es/plus/pisellReservation/index.js +0 -17
  65. package/es/plus/salesSdk/index.js +0 -54
@@ -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 utc from "dayjs/plugin/utc";
4
+ import utcPlugin from "dayjs/plugin/utc";
5
5
  //#region src/pro/skuDetailModal/flow/calendarEntry.ts
6
- dayjs.extend(utc);
6
+ dayjs.extend(utcPlugin);
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);
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
19
19
  readonly Component: _$react.FC<FlowModuleProps<string>>;
20
20
  readonly initializeWhileInactive: true;
21
21
  readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
22
- readonly refreshOn: ("quantity" | "productData" | "skuValue" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
22
+ readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
23
23
  readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
24
24
  readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
25
25
  readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
@@ -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
  });
@@ -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
@@ -19,7 +19,7 @@ declare const flowModuleRegistry: {
19
19
  readonly Component: _$react.FC<FlowModuleProps<string>>;
20
20
  readonly initializeWhileInactive: true;
21
21
  readonly hardRequires: ("productData" | "booking.selectedCandidate")[];
22
- readonly refreshOn: ("quantity" | "productData" | "skuValue" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
22
+ readonly refreshOn: ("productData" | "skuValue" | "quantity" | "booking.customerId" | "booking.duration" | "booking.selectedCandidate")[];
23
23
  readonly isApplicable: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
24
24
  readonly canInitialize: (context: _$_pisell_materials_src0.SelectionFlowContextValue<SelectionFlowDraft, SelectionFlowDraftUpdate, SelectionDraftField, string, SelectionFlowServices, unknown>) => boolean;
25
25
  readonly refresh: (context: SelectionFlowContextValue<string>, module: CompiledSelectionFlowModuleConfig<string>) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.487",
3
+ "version": "6.12.489",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -75,8 +75,8 @@
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/materials": "6.12.107",
79
78
  "@pisell/utils": "3.0.7",
79
+ "@pisell/materials": "6.12.107",
80
80
  "@pisell/date-picker": "3.0.12",
81
81
  "@pisell/icon": "0.0.11"
82
82
  },
@@ -1,17 +0,0 @@
1
- import "./serve/formResourcePage.js";
2
- import "./floorRoomCard/mapRowToFloorRoomCardData.js";
3
- import "./floorRoomCard/ReservationFloorRoomCard.js";
4
- import "./floorMap/reservationMock.js";
5
- import "./floorMap/floorPlanApi.js";
6
- import "./reservationConstants.js";
7
- import "./data/bookingToReservationTables.js";
8
- import "./data/formResourceToReservationTables.js";
9
- import "./data/salesEmbeddedResourceToTableRows.js";
10
- import "./floorMap/reservationCards.js";
11
- import "./PisellReservation.js";
12
- import "./PisellReservationBookingPage.js";
13
- import "./PisellVenueControlPage.js";
14
- import "./PisellVenueWallPage.js";
15
- import "./PisellReservationTablePage.js";
16
- import "./components/SelectFloorMapResourceDialog.js";
17
- export {};
@@ -1,54 +0,0 @@
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 {};