@pisell/private-materials 6.12.440 → 6.12.441

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 (59) 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 +10 -10
  6. package/build/lowcode/view.js +10 -10
  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/useSelectFloorMapResourceForBigSale.js +0 -1
  13. package/es/components/bigSale/index.js +0 -1
  14. package/es/components/bigSale/templates/Kiosk/index.js +0 -1
  15. package/es/components/kiosk/components/Shell/useKioskMemberAction.js +0 -1
  16. package/es/components/kiosk/sales/KioskSaleSession.js +0 -1
  17. package/es/components/kiosk/sales/useCheckout.js +0 -1
  18. package/es/components/kiosk/sales/useSaleSessionExit.js +0 -1
  19. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +0 -1
  20. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +8 -2
  21. package/es/components/venueBookingSales/checkout/VenueHolderCreateModal.js +5 -1
  22. package/es/components/venueBookingSales/checkout/VenueKioskHolderCreateModal.js +155 -0
  23. package/es/components/venueBookingSales/checkout/kioskHolderForm.js +124 -0
  24. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +0 -1
  25. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +0 -1
  26. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +0 -1
  27. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +0 -1
  28. package/es/components/venueBookingSales/useVenueBookingSession.js +0 -1
  29. package/es/index.js +0 -2
  30. package/es/plus/multiCurrencySettlement/index.js +1 -1
  31. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  32. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  33. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  34. package/es/plus/pisellReservation/utils/calendarBookingSelection.js +4 -4
  35. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  36. package/es/plus/saleDetail/Base.js +0 -1
  37. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +0 -1
  38. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +0 -1
  39. package/es/plus/saleDetail/components/DetailActions/index.js +0 -1
  40. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +0 -1
  41. package/es/plus/saleDetail/index.js +0 -1
  42. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +0 -1
  43. package/es/plus/saleDetail/tmpl/B/index.js +0 -1
  44. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  45. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  46. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  47. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  48. package/es/private-materials/lowcode/authmodal/meta.d.ts +1 -0
  49. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  50. package/es/pro/Login2.0/index.d.ts +2 -2
  51. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  52. package/es/pro/skuDetailModal/flow/calendarEntry.js +2 -2
  53. package/lib/components/venueBookingSales/checkout/VenueBookingHolderStep.js +7 -0
  54. package/lib/components/venueBookingSales/checkout/VenueHolderCreateModal.js +5 -1
  55. package/lib/components/venueBookingSales/checkout/VenueKioskHolderCreateModal.js +157 -0
  56. package/lib/components/venueBookingSales/checkout/kioskHolderForm.js +124 -0
  57. package/package.json +3 -3
  58. package/es/plus/pisellReservation/index.js +0 -17
  59. package/es/plus/salesSdk/index.js +0 -54
@@ -5,7 +5,6 @@ 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";
9
8
  import { resolveSaleDetailTempOrder } from "../../utils.js";
10
9
  import React, { memo, useMemo } from "react";
11
10
  import { formatAmount, locales } from "@pisell/utils";
@@ -5,7 +5,6 @@ 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";
9
8
  import Base_default from "./Base.js";
10
9
  import { resolveSaleDetailOsProps } from "./osProps.js";
11
10
  import React, { forwardRef, useImperativeHandle } from "react";
@@ -1,7 +1,6 @@
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";
5
4
  import { SaleDetailStatusOverview } from "../shared/StatusOverview.js";
6
5
  import { DishGroupView } from "./DishGroupView.js";
7
6
  import dayjs from "dayjs";
@@ -1,7 +1,6 @@
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";
5
4
  import { getInternalNotesByScheduleEvent } from "../../serve.js";
6
5
  import { TEMPLATE_B_PAY_ACTIONS, TEMPLATE_B_SUMMARY_ACTIONS } from "../../components/DetailActions/configs/index.js";
7
6
  import { DetailActions } from "../../components/DetailActions/index.js";
@@ -407,4 +407,4 @@ function createAddProductWithFlowDebounced(deps) {
407
407
  };
408
408
  }
409
409
  //#endregion
410
- export { createAddProductWithFlowDebounced, shouldBypassAddProductDebounce };
410
+ export { createAddProductWithFlowDebounced };
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
31
31
  return typeof off === "function" ? off : () => {};
32
32
  }
33
33
  //#endregion
34
- export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
34
+ export { formatBookingDateTime, subscribeBookingDateChange };
@@ -102,4 +102,4 @@ function buildHolderListRequestKey(params) {
102
102
  });
103
103
  }
104
104
  //#endregion
105
- export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
105
+ export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, 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 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);
@@ -605,6 +605,13 @@ const VenueBookingHolderStep = (0, react.forwardRef)((props, ref) => {
605
605
  }, contents.map((child) => /* @__PURE__ */ react.default.createElement("li", { key: child.key }, /* @__PURE__ */ react.default.createElement("span", null, child.name || text("Included item", "套餐子商品")), /* @__PURE__ */ react.default.createElement("span", null, "× ", child.quantity))))), /* @__PURE__ */ react.default.createElement("div", { className: "child-assignments" }, assignments));
606
606
  }), props.afterAssignments), creating && current(creating.identity) && /* @__PURE__ */ react.default.createElement(require_VenueHolderCreateModal.default, {
607
607
  formId: creating.formId,
608
+ key: require_customer.isVenueKioskRuntime(handle) ? JSON.stringify([
609
+ creating.identity,
610
+ creating.uid,
611
+ creating.index,
612
+ creating.base
613
+ ]) : void 0,
614
+ kiosk: require_customer.isVenueKioskRuntime(handle),
608
615
  customerId: require_buildBookingEditDrawerState.resolveBookingEditCustomerId(handle === null || handle === void 0 || (_handle$getTempOrder7 = handle.getTempOrder) === null || _handle$getTempOrder7 === void 0 ? void 0 : _handle$getTempOrder7.call(handle), void 0, handle === null || handle === void 0 || (_handle$getOrderCusto = handle.getOrderCustomerSnapshot) === null || _handle$getOrderCusto === void 0 || (_handle$getOrderCusto = _handle$getOrderCusto.call(handle)) === null || _handle$getOrderCusto === void 0 ? void 0 : _handle$getOrderCusto.id),
609
616
  locale,
610
617
  isCurrent: () => current(creating.identity),
@@ -9,12 +9,16 @@ const require_Controls = require("../../../plus/venueBookingDesign/shared/Contro
9
9
  const require_Dialog = require("../../../plus/venueBookingDesign/Dialog.js");
10
10
  const require_errorMessage = require("./errorMessage.js");
11
11
  const require_holderCreateResult = require("./holderCreateResult.js");
12
+ const require_VenueKioskHolderCreateModal = require("./VenueKioskHolderCreateModal.js");
12
13
  let react = require("react");
13
14
  react = require_runtime.__toESM(react);
14
15
  let antd = require("antd");
15
16
  //#region src/components/venueBookingSales/checkout/VenueHolderCreateModal.tsx
17
+ function VenueHolderCreateModal(props) {
18
+ return props.kiosk ? /* @__PURE__ */ react.default.createElement(require_VenueKioskHolderCreateModal.default, props) : /* @__PURE__ */ react.default.createElement(VenueWebHolderCreateModal, props);
19
+ }
16
20
  /** Same FormCard and customer binding as the host FormPlugin, scoped to the new booking theme. */
17
- function VenueHolderCreateModal({ formId, customerId, locale, onClose, onCreated, onUnconfirmed, isCurrent }) {
21
+ function VenueWebHolderCreateModal({ formId, customerId, locale, onClose, onCreated, onUnconfirmed, isCurrent }) {
18
22
  const platform = require_useEngineContext.usePlatform();
19
23
  const [FormCard] = require_useComponents.default({ components: ["FormCard"] });
20
24
  const [config, setConfig] = (0, react.useState)();
@@ -0,0 +1,157 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
2
+ const require_useEngineContext = require("../../../hooks/useEngineContext.js");
3
+ const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
4
+ const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
5
+ const require_utils = require("../../booking/utils.js");
6
+ const require_waiverFormDetailCache = require("../../booking/utils/waiverFormDetailCache.js");
7
+ const require_productHolderFormDetailCache = require("../../../plus/salesSdk/utils/productHolderFormDetailCache.js");
8
+ const require_Controls = require("../../../plus/venueBookingDesign/shared/Controls.js");
9
+ const require_kioskHolderForm = require("./kioskHolderForm.js");
10
+ let react = require("react");
11
+ react = require_runtime.__toESM(react);
12
+ let antd = require("antd");
13
+ //#region src/components/venueBookingSales/checkout/VenueKioskHolderCreateModal.tsx
14
+ /** The real Kiosk owns its existing form popup. Only loading/error feedback stays
15
+ * in this page; it never mounts the PC/H5 FormCard or a second Dialog. */
16
+ function VenueKioskHolderCreateModal(props) {
17
+ const { formId, customerId, locale } = props;
18
+ const engine = require_useEngineContext.default();
19
+ const latest = (0, react.useRef)(props);
20
+ latest.current = props;
21
+ const controller = (0, react.useRef)();
22
+ if (!controller.current) controller.current = require_kioskHolderForm.createKioskHolderFormController();
23
+ const generation = (0, react.useRef)(0);
24
+ const mounted = (0, react.useRef)(true);
25
+ const submitted = (0, react.useRef)(false);
26
+ const notified = (0, react.useRef)(false);
27
+ const [error, setError] = (0, react.useState)();
28
+ const [uncertain, setUncertain] = (0, react.useState)(false);
29
+ const [working, setWorking] = (0, react.useState)(true);
30
+ const [attempt, setAttempt] = (0, react.useState)(0);
31
+ const chinese = String(locale || "").startsWith("zh");
32
+ const text = (en, zh) => chinese ? zh : en;
33
+ (0, react.useEffect)(() => {
34
+ var _controller$current;
35
+ mounted.current = true;
36
+ const owner = ++generation.current;
37
+ const current = () => {
38
+ var _latest$current$custo;
39
+ return mounted.current && generation.current === owner && String(latest.current.formId) === String(formId) && String((_latest$current$custo = latest.current.customerId) !== null && _latest$current$custo !== void 0 ? _latest$current$custo : "") === String(customerId !== null && customerId !== void 0 ? customerId : "") && latest.current.isCurrent();
40
+ };
41
+ (_controller$current = controller.current) === null || _controller$current === void 0 || _controller$current.close();
42
+ submitted.current = false;
43
+ setWorking(true);
44
+ setError(void 0);
45
+ const unconfirmed = () => {
46
+ if (!notified.current) {
47
+ notified.current = true;
48
+ latest.current.onUnconfirmed();
49
+ }
50
+ };
51
+ (function() {
52
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
53
+ var _detail$form_field, _detail$form_type, _detail$form, _fields$find, _engine$appHelper;
54
+ const detail = yield require_productHolderFormDetailCache.getCachedProductHolderFormDetail(Number(formId), "kiosk");
55
+ if (!current()) return;
56
+ if (!detail) throw new Error("Holder form unavailable");
57
+ const fields = (_detail$form_field = detail.form_field) !== null && _detail$form_field !== void 0 ? _detail$form_field : detail.field;
58
+ const linked = ((_detail$form_type = detail.form_type) !== null && _detail$form_type !== void 0 ? _detail$form_type : (_detail$form = detail.form) === null || _detail$form === void 0 ? void 0 : _detail$form.form_type) === "minors" ? fields === null || fields === void 0 || (_fields$find = fields.find((field) => field.filed_type === "form_to_form" && field.status === "hide")) === null || _fields$find === void 0 || (_fields$find = _fields$find.setting) === null || _fields$find === void 0 ? void 0 : _fields$find.linkedTable : void 0;
59
+ const targetId = Number(linked || formId);
60
+ const source = linked ? yield require_waiverFormDetailCache.getCachedWaiverFormDetail(targetId, "kiosk") : detail;
61
+ if (!current()) return;
62
+ if (!source) throw new Error("Linked holder form unavailable");
63
+ const boundCustomerId = require_utils.isWalkIn(customerId !== null && customerId !== void 0 ? customerId : void 0) ? void 0 : customerId;
64
+ const formDataConfig = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, source), {}, {
65
+ form_id: targetId,
66
+ is_franchisor: detail.is_franchisor
67
+ });
68
+ delete formDataConfig.customer_id;
69
+ if (boundCustomerId != null) formDataConfig.customer_id = boundCustomerId;
70
+ controller.current.open({
71
+ action: typeof (engine === null || engine === void 0 || (_engine$appHelper = engine.appHelper) === null || _engine$appHelper === void 0 || (_engine$appHelper = _engine$appHelper.utils) === null || _engine$appHelper === void 0 ? void 0 : _engine$appHelper.action) === "function" ? (payload) => engine.appHelper.utils.action(payload) : void 0,
72
+ request: {
73
+ formId: targetId,
74
+ formDataConfig,
75
+ customerId: boundCustomerId,
76
+ zIndex: 1101
77
+ },
78
+ isCurrent: current,
79
+ onOpened: () => {
80
+ if (current()) setWorking(false);
81
+ },
82
+ onSaved: (event) => {
83
+ if (!current() || submitted.current) return;
84
+ submitted.current = true;
85
+ setWorking(true);
86
+ require_asyncToGenerator._asyncToGenerator(function* () {
87
+ try {
88
+ yield latest.current.onCreated({
89
+ record: event.record,
90
+ linkedWaiver: !!linked
91
+ });
92
+ if (current()) latest.current.onClose();
93
+ } catch (_unused) {
94
+ if (current()) {
95
+ setUncertain(true);
96
+ unconfirmed();
97
+ setError(text("The profile was saved. Refresh the list to select it.", "档案已保存,请刷新列表后选择,勿重复创建。"));
98
+ }
99
+ } finally {
100
+ if (current()) setWorking(false);
101
+ }
102
+ })();
103
+ },
104
+ onCancelled: () => {
105
+ if (current()) latest.current.onClose();
106
+ },
107
+ onError: (reason) => {
108
+ if (!current()) return;
109
+ setWorking(false);
110
+ if (reason.uncertain) {
111
+ setUncertain(true);
112
+ unconfirmed();
113
+ setError(text("The save result is unknown. Close this form and refresh the profile list before trying again.", "保存结果尚未确认,请关闭表单并刷新档案列表后核对,勿重复创建。"));
114
+ } else setError(reason.code === "HOST_UNAVAILABLE" ? text("The kiosk holder form service is unavailable. Please update this terminal and retry.", "终端持有人表单服务不可用,请更新终端后重试。") : text("Unable to load the holder form. Please retry.", "无法加载持有人表单,请重试。"));
115
+ }
116
+ });
117
+ });
118
+ return function run() {
119
+ return _ref.apply(this, arguments);
120
+ };
121
+ })()().catch(() => {
122
+ if (current()) {
123
+ setWorking(false);
124
+ setError(text("Unable to load the holder form. Please retry.", "无法加载持有人表单,请重试。"));
125
+ }
126
+ });
127
+ return () => {
128
+ var _controller$current2;
129
+ mounted.current = false;
130
+ ++generation.current;
131
+ (_controller$current2 = controller.current) === null || _controller$current2 === void 0 || _controller$current2.close();
132
+ };
133
+ }, [
134
+ formId,
135
+ customerId,
136
+ attempt
137
+ ]);
138
+ return /* @__PURE__ */ react.default.createElement("div", {
139
+ className: "venue-holder-create-feedback",
140
+ "aria-busy": working
141
+ }, working && /* @__PURE__ */ react.default.createElement(antd.Spin, null), error && /* @__PURE__ */ react.default.createElement(antd.Alert, {
142
+ type: "error",
143
+ showIcon: true,
144
+ message: error,
145
+ action: /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, !uncertain && !submitted.current && /* @__PURE__ */ react.default.createElement(require_Controls.Button, { onClick: () => setAttempt((value) => value + 1) }, text("Retry", "重试")), /* @__PURE__ */ react.default.createElement(require_Controls.Button, {
146
+ disabled: working && submitted.current,
147
+ onClick: () => {
148
+ var _controller$current3;
149
+ if (working && submitted.current) return;
150
+ (_controller$current3 = controller.current) === null || _controller$current3 === void 0 || _controller$current3.close();
151
+ latest.current.onClose();
152
+ }
153
+ }, text("Close", "关闭")))
154
+ }));
155
+ }
156
+ //#endregion
157
+ exports.default = VenueKioskHolderCreateModal;
@@ -0,0 +1,124 @@
1
+ const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
2
+ //#region src/components/venueBookingSales/checkout/kioskHolderForm.ts
3
+ var KioskHolderFormError = class extends Error {
4
+ constructor(message, code, uncertain = false) {
5
+ super(message);
6
+ this.code = code;
7
+ this.uncertain = uncertain;
8
+ }
9
+ };
10
+ const recordValue = (value) => !!value && Object.prototype.toString.call(value) === "[object Object]";
11
+ const validHandle = (value) => {
12
+ if (!value || typeof value !== "object") return false;
13
+ const handle = value;
14
+ return handle.kind === "booking-holder-form" && handle.version === 1 && typeof handle.close === "function";
15
+ };
16
+ /** Holder creation can return linked waiver records without a top-level ID.
17
+ * Keep its contract separate from the resource form's saved-record contract. */
18
+ function createKioskHolderFormController() {
19
+ let active;
20
+ const closeHandle = (handle) => {
21
+ try {
22
+ handle === null || handle === void 0 || handle.close();
23
+ } catch (_unused) {}
24
+ };
25
+ const close = () => {
26
+ const previous = active;
27
+ active = void 0;
28
+ if (!previous) return;
29
+ previous.done = true;
30
+ closeHandle(previous.handle);
31
+ };
32
+ return {
33
+ close,
34
+ isOpen: () => Boolean(active && !active.done),
35
+ open(options) {
36
+ close();
37
+ if (!options.isCurrent()) return;
38
+ const owner = { done: false };
39
+ active = owner;
40
+ const current = () => active === owner && !owner.done && options.isCurrent();
41
+ const finish = () => {
42
+ owner.done = true;
43
+ if (active === owner) active = void 0;
44
+ };
45
+ const fail = (error) => {
46
+ if (!current()) return;
47
+ finish();
48
+ closeHandle(owner.handle);
49
+ options.onError(error);
50
+ };
51
+ const unavailable = () => new KioskHolderFormError("The kiosk holder form service is unavailable.", "HOST_UNAVAILABLE");
52
+ const formId = options.request.formId;
53
+ const customerId = options.request.customerId;
54
+ if (!Number.isSafeInteger(formId) || formId <= 0 || !recordValue(options.request.formDataConfig) || customerId != null && (!Number.isSafeInteger(Number(customerId)) || Number(customerId) <= 1) || !options.action) {
55
+ fail(unavailable());
56
+ return;
57
+ }
58
+ const receive = (event) => {
59
+ if (!current()) return;
60
+ try {
61
+ if (!event || Number(event.formId) !== formId) {
62
+ fail(new KioskHolderFormError("The holder form does not match this request.", "FORM_MISMATCH", true));
63
+ return;
64
+ }
65
+ if (event.status === "opened") options.onOpened(event);
66
+ else if (event.status === "saved") {
67
+ if (!recordValue(event.record)) {
68
+ fail(new KioskHolderFormError("The holder form did not return a confirmed save.", "SAVED_RESULT_INVALID", true));
69
+ return;
70
+ }
71
+ const record = JSON.parse(JSON.stringify(event.record));
72
+ if (!recordValue(record)) {
73
+ fail(new KioskHolderFormError("The holder form returned invalid records.", "SAVED_RESULT_INVALID", true));
74
+ return;
75
+ }
76
+ finish();
77
+ options.onSaved(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, event), {}, { record }));
78
+ } else if (event.status === "cancelled") {
79
+ finish();
80
+ options.onCancelled();
81
+ } else if (event.status === "error") fail(new KioskHolderFormError(event.message || "Unable to load the holder form.", event.code || "HOST_ERROR", !!event.uncertain));
82
+ else fail(new KioskHolderFormError("The holder form service returned an invalid response.", "HOST_RESPONSE_INVALID"));
83
+ } catch (reason) {
84
+ fail(new KioskHolderFormError(reason instanceof Error ? reason.message : "Invalid holder form response.", "HOST_RESPONSE_INVALID", true));
85
+ }
86
+ };
87
+ let dispatching = true;
88
+ const buffered = [];
89
+ try {
90
+ const handle = options.action({
91
+ type: "pisell1.goBookingHolderForm",
92
+ data: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, options.request), {}, {
93
+ formDataConfig: JSON.parse(JSON.stringify(options.request.formDataConfig)),
94
+ isCurrent: current
95
+ }),
96
+ callback(event) {
97
+ if (dispatching) buffered.push(event);
98
+ else receive(event);
99
+ }
100
+ });
101
+ dispatching = false;
102
+ if (!current()) {
103
+ buffered.length = 0;
104
+ if (validHandle(handle)) closeHandle(handle);
105
+ return;
106
+ }
107
+ if (!validHandle(handle)) {
108
+ if (handle && typeof handle.then === "function") Promise.resolve(handle).catch(() => {});
109
+ buffered.length = 0;
110
+ fail(unavailable());
111
+ return;
112
+ }
113
+ owner.handle = handle;
114
+ buffered.splice(0).forEach(receive);
115
+ } catch (reason) {
116
+ dispatching = false;
117
+ buffered.length = 0;
118
+ fail(new KioskHolderFormError(reason instanceof Error ? reason.message : "Unable to open the holder form.", "HOST_ERROR"));
119
+ }
120
+ }
121
+ };
122
+ }
123
+ //#endregion
124
+ exports.createKioskHolderFormController = createKioskHolderFormController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.440",
3
+ "version": "6.12.441",
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/icon": "0.0.11",
79
78
  "@pisell/utils": "3.0.7",
79
+ "@pisell/materials": "6.12.98",
80
80
  "@pisell/date-picker": "3.0.12",
81
- "@pisell/materials": "6.12.98"
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 {};