@pisell/private-materials 6.12.435 → 6.12.437

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 (68) 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/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
  17. package/es/components/ticketBooking/components/ProductDisplayAdapter/index.js +3 -0
  18. package/es/components/ticketBooking/components/addServiceVariant/addService.js +1 -0
  19. package/es/components/venueBookingSales/VenueBookingShared.js +3 -2
  20. package/es/components/venueBookingSales/availability/catalogPreview.js +1 -1
  21. package/es/components/venueBookingSales/catalogPresentation.js +1 -0
  22. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +0 -1
  23. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
  24. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +0 -1
  25. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +0 -1
  26. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +0 -1
  27. package/es/components/venueBookingSales/presentation.js +27 -1
  28. package/es/components/venueBookingSales/useVenueBookingSession.js +0 -1
  29. package/es/components/venueBookingSales/useVenueCatalog.js +1 -0
  30. package/es/components/venueBookingSales/useVenueDates.js +1 -0
  31. package/es/index.js +0 -2
  32. package/es/plus/multiCurrencySettlement/index.js +1 -1
  33. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  34. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  35. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  36. package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
  37. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  38. package/es/plus/saleDetail/Base.js +0 -1
  39. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
  40. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
  41. package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
  42. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
  43. package/es/plus/saleDetail/index.js +0 -1
  44. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
  45. package/es/plus/saleDetail/tmpl/B/index.js +0 -1
  46. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  47. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  48. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  49. package/es/plus/venueBookingDesign/shared/CheckoutBenefits.js +2 -27
  50. package/es/plus/venueBookingDesign/shared/Layout.js +3 -33
  51. package/es/plus/venueBookingDesign/shared/kiosk-viewport.js +60 -7
  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/lib/components/venueBookingSales/VenueBookingShared.js +2 -1
  59. package/lib/components/venueBookingSales/availability/catalogPreview.js +1 -1
  60. package/lib/components/venueBookingSales/presentation.js +27 -0
  61. package/lib/components/venueBookingSales/useVenueCatalog.js +1 -0
  62. package/lib/components/venueBookingSales/useVenueDates.js +1 -0
  63. package/lib/plus/venueBookingDesign/shared/CheckoutBenefits.js +1 -26
  64. package/lib/plus/venueBookingDesign/shared/Layout.js +2 -32
  65. package/lib/plus/venueBookingDesign/shared/kiosk-viewport.js +60 -7
  66. package/package.json +3 -3
  67. package/es/plus/pisellReservation/index.js +0 -17
  68. package/es/plus/salesSdk/index.js +0 -54
@@ -16,11 +16,64 @@ function getKioskBodyScaleY(preferTarget = true) {
16
16
  function kioskLogicalElementHeight(element) {
17
17
  return element.getBoundingClientRect().height / getKioskBodyScaleY(false);
18
18
  }
19
+ /** Reserve layout space without re-reading transformed geometry on every animation. */
20
+ function observeReservedElementHeight(element, property, kiosk) {
21
+ var _window$visualViewpor;
22
+ const scope = element.closest(".booking-ui");
23
+ if (!scope) return () => {};
24
+ let frame = 0;
25
+ let lastHeight = 0;
26
+ let borderBoxHeight;
27
+ const measure = () => {
28
+ frame = 0;
29
+ const height = kiosk && borderBoxHeight !== void 0 ? borderBoxHeight : kiosk ? kioskLogicalElementHeight(element) : element.getBoundingClientRect().height;
30
+ const next = Math.round(height * 64) / 64;
31
+ if (next > 0 && next !== lastHeight) {
32
+ lastHeight = next;
33
+ scope.style.setProperty(property, `${next}px`);
34
+ }
35
+ };
36
+ const schedule = () => {
37
+ if (!frame) frame = requestAnimationFrame(measure);
38
+ };
39
+ const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver((entries) => {
40
+ if (kiosk) {
41
+ const entry = entries.find((item) => item.target === element);
42
+ const box = entry === null || entry === void 0 ? void 0 : entry.borderBoxSize;
43
+ const size = Array.isArray(box) ? box[0] : box;
44
+ if (size && Number.isFinite(size.blockSize)) borderBoxHeight = size.blockSize;
45
+ }
46
+ schedule();
47
+ });
48
+ observer === null || observer === void 0 || observer.observe(element, { box: "border-box" });
49
+ const bodyObserver = kiosk ? new MutationObserver(schedule) : void 0;
50
+ bodyObserver === null || bodyObserver === void 0 || bodyObserver.observe(document.body, {
51
+ attributes: true,
52
+ attributeFilter: ["style", "class"]
53
+ });
54
+ const finishScaleTransition = (event) => {
55
+ if (event.target === document.body && event.propertyName === "transform") schedule();
56
+ };
57
+ window.addEventListener("resize", schedule);
58
+ if (kiosk) (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.addEventListener("resize", schedule);
59
+ if (kiosk) document.body.addEventListener("transitionend", finishScaleTransition);
60
+ measure();
61
+ return () => {
62
+ var _window$visualViewpor2;
63
+ cancelAnimationFrame(frame);
64
+ observer === null || observer === void 0 || observer.disconnect();
65
+ bodyObserver === null || bodyObserver === void 0 || bodyObserver.disconnect();
66
+ window.removeEventListener("resize", schedule);
67
+ (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.removeEventListener("resize", schedule);
68
+ document.body.removeEventListener("transitionend", finishScaleTransition);
69
+ scope.style.removeProperty(property);
70
+ };
71
+ }
19
72
  /** Read the host's logical viewport; never add a second page scale or keyboard deduction. */
20
73
  function useKioskViewportHeight(root, enabled) {
21
74
  const [height, setHeight] = useState();
22
75
  useLayoutEffect(() => {
23
- var _window$visualViewpor2;
76
+ var _window$visualViewpor4;
24
77
  if (!enabled || !root) {
25
78
  setHeight(void 0);
26
79
  return;
@@ -28,9 +81,9 @@ function useKioskViewportHeight(root, enabled) {
28
81
  let frame = 0;
29
82
  const container = root.parentElement;
30
83
  const measure = () => {
31
- var _window$visualViewpor;
84
+ var _window$visualViewpor3;
32
85
  const scale = getKioskBodyScaleY();
33
- const visibleHeight = ((_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 ? void 0 : _window$visualViewpor.height) || window.innerHeight;
86
+ const visibleHeight = ((_window$visualViewpor3 = window.visualViewport) === null || _window$visualViewpor3 === void 0 ? void 0 : _window$visualViewpor3.height) || window.innerHeight;
34
87
  const logicalHeight = visibleHeight / scale;
35
88
  const containerHeight = (container === null || container === void 0 ? void 0 : container.clientHeight) || window.innerHeight;
36
89
  const next = Math.abs(scale - 1) < .001 ? `min(var(--app-content-height, ${containerHeight}px), ${visibleHeight}px)` : `${logicalHeight}px`;
@@ -51,20 +104,20 @@ function useKioskViewportHeight(root, enabled) {
51
104
  const containerObserver = typeof ResizeObserver === "undefined" || !container ? void 0 : new ResizeObserver(schedule);
52
105
  containerObserver === null || containerObserver === void 0 || containerObserver.observe(container);
53
106
  window.addEventListener("resize", schedule);
54
- (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.addEventListener("resize", schedule);
107
+ (_window$visualViewpor4 = window.visualViewport) === null || _window$visualViewpor4 === void 0 || _window$visualViewpor4.addEventListener("resize", schedule);
55
108
  document.body.addEventListener("transitionend", finishScaleTransition);
56
109
  measure();
57
110
  return () => {
58
- var _window$visualViewpor3;
111
+ var _window$visualViewpor5;
59
112
  cancelAnimationFrame(frame);
60
113
  bodyObserver.disconnect();
61
114
  containerObserver === null || containerObserver === void 0 || containerObserver.disconnect();
62
115
  window.removeEventListener("resize", schedule);
63
- (_window$visualViewpor3 = window.visualViewport) === null || _window$visualViewpor3 === void 0 || _window$visualViewpor3.removeEventListener("resize", schedule);
116
+ (_window$visualViewpor5 = window.visualViewport) === null || _window$visualViewpor5 === void 0 || _window$visualViewpor5.removeEventListener("resize", schedule);
64
117
  document.body.removeEventListener("transitionend", finishScaleTransition);
65
118
  };
66
119
  }, [enabled, root]);
67
120
  return enabled ? height : void 0;
68
121
  }
69
122
  //#endregion
70
- export { kioskLogicalElementHeight, useKioskViewportHeight };
123
+ export { observeReservedElementHeight, useKioskViewportHeight };
@@ -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 utc from "dayjs/plugin/utc";
11
- import timezone from "dayjs/plugin/timezone";
10
+ import utcPlugin from "dayjs/plugin/utc";
11
+ import timezonePlugin from "dayjs/plugin/timezone";
12
12
  import "./index.less";
13
13
  //#region src/plus/walletPassGallery/components/timelineSection/index.tsx
14
- dayjs.extend(timezone);
15
- dayjs.extend(utc);
14
+ dayjs.extend(timezonePlugin);
15
+ dayjs.extend(utcPlugin);
16
16
  const stateTimeUnix = 1723255863;
17
17
  const POLL_INTERVAL = 2e3;
18
18
  const POLL_MAX_TIMES = 5;
@@ -0,0 +1 @@
1
+ export { };
@@ -14,4 +14,4 @@ interface AuthModalProps {
14
14
  */
15
15
  declare const AuthModal: React.FC<AuthModalProps>;
16
16
  //#endregion
17
- export { AuthModal };
17
+ export { AuthModal, AuthModalProps };
@@ -1,4 +1,4 @@
1
- import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
1
+ import { AuthMethodType, 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 } from "./AuthModal.js";
4
+ import { AuthModal, AuthModalProps } from "./AuthModal.js";
@@ -226,4 +226,4 @@ interface RegisterFormData {
226
226
  verification_token?: string;
227
227
  }
228
228
  //#endregion
229
- export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
229
+ export { AuthMethodType, EmailAuthConfig, 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 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);
@@ -233,6 +233,7 @@ function VenuePreviewCatalog({ runtime, preview, showFilters }) {
233
233
  function VenueCatalog({ runtime, showFilters = true, formatAmount = runtime.amount }) {
234
234
  var _runtime$engine;
235
235
  const { mode, locale, context, variant, scopeKey, date, main, props, productQuantities, disabled, text, partyMain, composer, run, openProduct } = runtime;
236
+ const descriptionPreview = (0, react.useMemo)(() => require_presentation.createDescriptionTextResolver(locale), [scopeKey, locale]);
236
237
  const displayProducts = require_useVenueCatalogPromotions.useVenueCatalogPromotions(main.products, runtime.sales.bookingTicket, (_runtime$engine = runtime.engine) === null || _runtime$engine === void 0 || (_runtime$engine = _runtime$engine.appHelper) === null || _runtime$engine === void 0 || (_runtime$engine = _runtime$engine.utils) === null || _runtime$engine === void 0 ? void 0 : _runtime$engine.promotionEvaluator, locale);
237
238
  const renderCard = (0, react.useMemo)(() => require_catalogPresentation.createVenueCatalogCardRenderer({
238
239
  mode,
@@ -297,7 +298,7 @@ function VenueCatalog({ runtime, showFilters = true, formatAmount = runtime.amou
297
298
  const selected = mode === "party" && Number((_composer$detail$id = composer === null || composer === void 0 ? void 0 : composer.detail.id) !== null && _composer$detail$id !== void 0 ? _composer$detail$id : partyMain === null || partyMain === void 0 ? void 0 : partyMain.line.product_id) === Number(product.id);
298
299
  return {
299
300
  disabled: disabled || main.loading || !!main.error || !canOpen,
300
- description: require_presentation.descriptionText(product.description, locale),
301
+ description: descriptionPreview(product.description),
301
302
  businessInfo: mode === "party" && capacity.partySize || capacity.durationMinutes ? /* @__PURE__ */ react.default.createElement("div", { className: "party-meta venue-booking-sales__facts" }, mode === "party" && capacity.partySize && /* @__PURE__ */ react.default.createElement("span", null, /* @__PURE__ */ react.default.createElement(_phosphor_icons_react.Users, {
302
303
  size: 15,
303
304
  "aria-hidden": "true"
@@ -382,7 +382,7 @@ function _queryCatalogPreview() {
382
382
  continue;
383
383
  }
384
384
  if (!input.catalogParams.menu_list_ids.length) throw new PreviewError("PREVIEW_MENU_CONFIGURATION_REQUIRED");
385
- const detail = yield input.queries.queryCatalogProductDetail(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, input.catalogParams), {}, {
385
+ const detail = input.productsFromSessionSnapshot ? listed : yield input.queries.queryCatalogProductDetail(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, input.catalogParams), {}, {
386
386
  product_id: Number(id),
387
387
  schedule_date: input.date,
388
388
  with_count: ["bundleGroup", "optionGroup"],
@@ -14,12 +14,38 @@ function localizedText(value, locale) {
14
14
  function descriptionText(value, locale) {
15
15
  const text = localizedText(value, locale);
16
16
  if (typeof DOMParser === "undefined") return text.replace(/<br\s*\/?\s*>|<\/(?:p|div|li|h[1-6])>/gi, "\n").replace(/<[^>]*>/g, "").trim();
17
+ if (!/[<&\r\0]/.test(text)) return text.replace(/\n{3,}/g, "\n\n").trim();
17
18
  const body = new DOMParser().parseFromString(text, "text/html").body;
18
19
  body.querySelectorAll("script, style, template").forEach((node) => node.remove());
19
20
  body.querySelectorAll("br").forEach((node) => node.replaceWith("\n"));
20
21
  body.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, blockquote, tr").forEach((node) => node.append("\n"));
21
22
  return (body.textContent || "").replace(/\n{3,}/g, "\n\n").trim();
22
23
  }
24
+ /** One catalog owns this cache; retain strings only, never parsed Documents.
25
+ * Key the actual localized copy so updates to an existing product are visible. */
26
+ function createDescriptionTextResolver(locale) {
27
+ const previews = /* @__PURE__ */ new Map();
28
+ const maxEntries = 64;
29
+ const maxCharacters = 256e3;
30
+ let characters = 0;
31
+ return (value) => {
32
+ const text = localizedText(value, locale);
33
+ if (typeof DOMParser === "undefined" || !/[<&\r\0]/.test(text)) return descriptionText(text, locale);
34
+ const cached = previews.get(text);
35
+ if (cached !== void 0) return cached;
36
+ const preview = descriptionText(text, locale);
37
+ const size = text.length + preview.length;
38
+ if (size > maxCharacters) return preview;
39
+ while (previews.size >= maxEntries || characters + size > maxCharacters) {
40
+ const oldest = previews.keys().next().value;
41
+ characters -= oldest.length + previews.get(oldest).length;
42
+ previews.delete(oldest);
43
+ }
44
+ previews.set(text, preview);
45
+ characters += size;
46
+ return preview;
47
+ };
48
+ }
23
49
  const emptyConfiguration = (productId) => ({
24
50
  skuValue: {
25
51
  product_id: productId,
@@ -48,6 +74,7 @@ function dateInTimezone(timezone) {
48
74
  return `${part("year")}-${part("month")}-${part("day")}`;
49
75
  }
50
76
  //#endregion
77
+ exports.createDescriptionTextResolver = createDescriptionTextResolver;
51
78
  exports.dateInTimezone = dateInTimezone;
52
79
  exports.descriptionText = descriptionText;
53
80
  exports.emptyConfiguration = emptyConfiguration;
@@ -111,6 +111,7 @@ function useVenueCatalog({ os, ready, catalog, date, datetime, customerId, scope
111
111
  if (!resolvePolicy) throw new Error("The booking sales settings are unavailable.");
112
112
  const preview = yield require_catalogPreview.queryCatalogPreview(os, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({
113
113
  products,
114
+ productsFromSessionSnapshot: true,
114
115
  date,
115
116
  mode,
116
117
  resolvePolicy,
@@ -107,6 +107,7 @@ function useVenueDates(input) {
107
107
  if (products.length) {
108
108
  const result = yield require_catalogPreview.queryCatalogPreview(request.os, {
109
109
  products,
110
+ productsFromSessionSnapshot: true,
110
111
  date,
111
112
  mode: request.mode,
112
113
  queries: request.queries,
@@ -66,34 +66,9 @@ function CheckoutBenefits({ status, needsAttention = false, hidden = false, disa
66
66
  const currentStatus = status !== null && status !== void 0 ? status : t("benefitsTitle");
67
67
  const inviteAttention = !noticed && !disabled && !needsAttention;
68
68
  (0, react.useLayoutEffect)(() => {
69
- var _window$visualViewpor;
70
69
  const element = trigger.current;
71
70
  if (!element) return;
72
- const scope = element.closest(".booking-ui");
73
- const measure = () => {
74
- const height = kiosk ? require_kiosk_viewport.kioskLogicalElementHeight(element) : element.getBoundingClientRect().height;
75
- if (height > 0) scope === null || scope === void 0 || scope.style.setProperty("--checkout-benefits-height", `${height}px`);
76
- };
77
- const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(measure);
78
- observer === null || observer === void 0 || observer.observe(element);
79
- const bodyObserver = kiosk ? new MutationObserver(measure) : void 0;
80
- bodyObserver === null || bodyObserver === void 0 || bodyObserver.observe(document.body, {
81
- attributes: true,
82
- attributeFilter: ["style", "class"]
83
- });
84
- window.addEventListener("resize", measure);
85
- if (kiosk) (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.addEventListener("resize", measure);
86
- if (kiosk) document.body.addEventListener("transitionend", measure);
87
- measure();
88
- return () => {
89
- var _window$visualViewpor2;
90
- observer === null || observer === void 0 || observer.disconnect();
91
- bodyObserver === null || bodyObserver === void 0 || bodyObserver.disconnect();
92
- window.removeEventListener("resize", measure);
93
- (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.removeEventListener("resize", measure);
94
- document.body.removeEventListener("transitionend", measure);
95
- scope === null || scope === void 0 || scope.style.removeProperty("--checkout-benefits-height");
96
- };
71
+ return require_kiosk_viewport.observeReservedElementHeight(element, "--checkout-benefits-height", kiosk);
97
72
  }, [kiosk]);
98
73
  const close = () => {
99
74
  setOpen(false);
@@ -10,39 +10,9 @@ function MobileActionBar({ lang, children, className = "" }) {
10
10
  const kiosk = ((_useOptionalBookingUI = require_context.useOptionalBookingUI()) === null || _useOptionalBookingUI === void 0 ? void 0 : _useOptionalBookingUI.presentationPlatform) === "kiosk";
11
11
  const ref = (0, react.useRef)(null);
12
12
  (0, react.useLayoutEffect)(() => {
13
- var _window$visualViewpor;
14
13
  const bar = ref.current;
15
- const scope = bar.closest(".booking-ui");
16
- let frame = 0;
17
- const measure = () => {
18
- const height = kiosk ? require_kiosk_viewport.kioskLogicalElementHeight(bar) : bar.getBoundingClientRect().height;
19
- if (height > 0) scope === null || scope === void 0 || scope.style.setProperty("--mobile-action-bar-height", `${height}px`);
20
- };
21
- const schedule = () => {
22
- cancelAnimationFrame(frame);
23
- frame = requestAnimationFrame(measure);
24
- };
25
- const observer = new ResizeObserver(schedule);
26
- observer.observe(bar);
27
- const bodyObserver = kiosk ? new MutationObserver(schedule) : void 0;
28
- bodyObserver === null || bodyObserver === void 0 || bodyObserver.observe(document.body, {
29
- attributes: true,
30
- attributeFilter: ["style", "class"]
31
- });
32
- window.addEventListener("resize", schedule);
33
- if (kiosk) (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.addEventListener("resize", schedule);
34
- if (kiosk) document.body.addEventListener("transitionend", schedule);
35
- measure();
36
- return () => {
37
- var _window$visualViewpor2;
38
- cancelAnimationFrame(frame);
39
- observer.disconnect();
40
- bodyObserver === null || bodyObserver === void 0 || bodyObserver.disconnect();
41
- window.removeEventListener("resize", schedule);
42
- (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.removeEventListener("resize", schedule);
43
- document.body.removeEventListener("transitionend", schedule);
44
- scope === null || scope === void 0 || scope.style.removeProperty("--mobile-action-bar-height");
45
- };
14
+ if (!bar) return;
15
+ return require_kiosk_viewport.observeReservedElementHeight(bar, "--mobile-action-bar-height", kiosk);
46
16
  }, [kiosk]);
47
17
  return /* @__PURE__ */ react.default.createElement("div", {
48
18
  ref,
@@ -17,11 +17,64 @@ function getKioskBodyScaleY(preferTarget = true) {
17
17
  function kioskLogicalElementHeight(element) {
18
18
  return element.getBoundingClientRect().height / getKioskBodyScaleY(false);
19
19
  }
20
+ /** Reserve layout space without re-reading transformed geometry on every animation. */
21
+ function observeReservedElementHeight(element, property, kiosk) {
22
+ var _window$visualViewpor;
23
+ const scope = element.closest(".booking-ui");
24
+ if (!scope) return () => {};
25
+ let frame = 0;
26
+ let lastHeight = 0;
27
+ let borderBoxHeight;
28
+ const measure = () => {
29
+ frame = 0;
30
+ const height = kiosk && borderBoxHeight !== void 0 ? borderBoxHeight : kiosk ? kioskLogicalElementHeight(element) : element.getBoundingClientRect().height;
31
+ const next = Math.round(height * 64) / 64;
32
+ if (next > 0 && next !== lastHeight) {
33
+ lastHeight = next;
34
+ scope.style.setProperty(property, `${next}px`);
35
+ }
36
+ };
37
+ const schedule = () => {
38
+ if (!frame) frame = requestAnimationFrame(measure);
39
+ };
40
+ const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver((entries) => {
41
+ if (kiosk) {
42
+ const entry = entries.find((item) => item.target === element);
43
+ const box = entry === null || entry === void 0 ? void 0 : entry.borderBoxSize;
44
+ const size = Array.isArray(box) ? box[0] : box;
45
+ if (size && Number.isFinite(size.blockSize)) borderBoxHeight = size.blockSize;
46
+ }
47
+ schedule();
48
+ });
49
+ observer === null || observer === void 0 || observer.observe(element, { box: "border-box" });
50
+ const bodyObserver = kiosk ? new MutationObserver(schedule) : void 0;
51
+ bodyObserver === null || bodyObserver === void 0 || bodyObserver.observe(document.body, {
52
+ attributes: true,
53
+ attributeFilter: ["style", "class"]
54
+ });
55
+ const finishScaleTransition = (event) => {
56
+ if (event.target === document.body && event.propertyName === "transform") schedule();
57
+ };
58
+ window.addEventListener("resize", schedule);
59
+ if (kiosk) (_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 || _window$visualViewpor.addEventListener("resize", schedule);
60
+ if (kiosk) document.body.addEventListener("transitionend", finishScaleTransition);
61
+ measure();
62
+ return () => {
63
+ var _window$visualViewpor2;
64
+ cancelAnimationFrame(frame);
65
+ observer === null || observer === void 0 || observer.disconnect();
66
+ bodyObserver === null || bodyObserver === void 0 || bodyObserver.disconnect();
67
+ window.removeEventListener("resize", schedule);
68
+ (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.removeEventListener("resize", schedule);
69
+ document.body.removeEventListener("transitionend", finishScaleTransition);
70
+ scope.style.removeProperty(property);
71
+ };
72
+ }
20
73
  /** Read the host's logical viewport; never add a second page scale or keyboard deduction. */
21
74
  function useKioskViewportHeight(root, enabled) {
22
75
  const [height, setHeight] = (0, react.useState)();
23
76
  (0, react.useLayoutEffect)(() => {
24
- var _window$visualViewpor2;
77
+ var _window$visualViewpor4;
25
78
  if (!enabled || !root) {
26
79
  setHeight(void 0);
27
80
  return;
@@ -29,9 +82,9 @@ function useKioskViewportHeight(root, enabled) {
29
82
  let frame = 0;
30
83
  const container = root.parentElement;
31
84
  const measure = () => {
32
- var _window$visualViewpor;
85
+ var _window$visualViewpor3;
33
86
  const scale = getKioskBodyScaleY();
34
- const visibleHeight = ((_window$visualViewpor = window.visualViewport) === null || _window$visualViewpor === void 0 ? void 0 : _window$visualViewpor.height) || window.innerHeight;
87
+ const visibleHeight = ((_window$visualViewpor3 = window.visualViewport) === null || _window$visualViewpor3 === void 0 ? void 0 : _window$visualViewpor3.height) || window.innerHeight;
35
88
  const logicalHeight = visibleHeight / scale;
36
89
  const containerHeight = (container === null || container === void 0 ? void 0 : container.clientHeight) || window.innerHeight;
37
90
  const next = Math.abs(scale - 1) < .001 ? `min(var(--app-content-height, ${containerHeight}px), ${visibleHeight}px)` : `${logicalHeight}px`;
@@ -52,21 +105,21 @@ function useKioskViewportHeight(root, enabled) {
52
105
  const containerObserver = typeof ResizeObserver === "undefined" || !container ? void 0 : new ResizeObserver(schedule);
53
106
  containerObserver === null || containerObserver === void 0 || containerObserver.observe(container);
54
107
  window.addEventListener("resize", schedule);
55
- (_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 || _window$visualViewpor2.addEventListener("resize", schedule);
108
+ (_window$visualViewpor4 = window.visualViewport) === null || _window$visualViewpor4 === void 0 || _window$visualViewpor4.addEventListener("resize", schedule);
56
109
  document.body.addEventListener("transitionend", finishScaleTransition);
57
110
  measure();
58
111
  return () => {
59
- var _window$visualViewpor3;
112
+ var _window$visualViewpor5;
60
113
  cancelAnimationFrame(frame);
61
114
  bodyObserver.disconnect();
62
115
  containerObserver === null || containerObserver === void 0 || containerObserver.disconnect();
63
116
  window.removeEventListener("resize", schedule);
64
- (_window$visualViewpor3 = window.visualViewport) === null || _window$visualViewpor3 === void 0 || _window$visualViewpor3.removeEventListener("resize", schedule);
117
+ (_window$visualViewpor5 = window.visualViewport) === null || _window$visualViewpor5 === void 0 || _window$visualViewpor5.removeEventListener("resize", schedule);
65
118
  document.body.removeEventListener("transitionend", finishScaleTransition);
66
119
  };
67
120
  }, [enabled, root]);
68
121
  return enabled ? height : void 0;
69
122
  }
70
123
  //#endregion
71
- exports.kioskLogicalElementHeight = kioskLogicalElementHeight;
124
+ exports.observeReservedElementHeight = observeReservedElementHeight;
72
125
  exports.useKioskViewportHeight = useKioskViewportHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.435",
3
+ "version": "6.12.437",
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.4",
78
+ "@pisell/date-picker": "3.0.12",
78
79
  "@pisell/utils": "3.0.7",
79
- "@pisell/icon": "0.0.11",
80
80
  "@pisell/materials": "6.12.97",
81
- "@pisell/date-picker": "3.0.12"
81
+ "@pisell/icon": "0.0.11"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^18.0.0",
@@ -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 {};