@pisell/private-materials 6.12.436 → 6.12.438

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 (54) 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 +1 -0
  8. package/es/components/bigSale/components/ProductList/index.js +1 -0
  9. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  10. package/es/components/bigSale/dialog.js +1 -0
  11. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  12. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  13. package/es/components/bigSale/index.js +1 -0
  14. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  15. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  16. package/es/components/venueBookingSales/availability/catalogPreview.js +112 -69
  17. package/es/components/venueBookingSales/checkout/VenueBookingHolderStep.js +1 -0
  18. package/es/components/venueBookingSales/checkout/useVenueBookingCheckout.js +1 -0
  19. package/es/components/venueBookingSales/checkout/useVenueCustomerAccess.js +1 -0
  20. package/es/components/venueBookingSales/checkout/useVenueKioskCheckout.js +1 -0
  21. package/es/components/venueBookingSales/extras/VenueExtraDetailModal.js +1 -0
  22. package/es/components/venueBookingSales/previewPolicy.js +36 -21
  23. package/es/components/venueBookingSales/useVenueBookingSession.js +1 -0
  24. package/es/components/venueBookingSales/useVenueCatalog.js +2 -0
  25. package/es/components/venueBookingSales/useVenueDates.js +4 -1
  26. package/es/index.js +2 -0
  27. package/es/plus/multiCurrencySettlement/index.js +1 -1
  28. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  29. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  30. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  31. package/es/plus/pisellReservation/index.js +17 -0
  32. package/es/plus/saleDetail/Base.js +1 -0
  33. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  34. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  35. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  36. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  37. package/es/plus/saleDetail/index.js +1 -0
  38. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  39. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  40. package/es/plus/salesSdk/hooks/useSalesSettings.js +10 -5
  41. package/es/plus/salesSdk/index.js +54 -0
  42. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  43. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  44. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  45. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  46. package/es/pro/Login2.0/index.d.ts +2 -2
  47. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  48. package/lib/components/venueBookingSales/availability/catalogPreview.js +112 -69
  49. package/lib/components/venueBookingSales/previewPolicy.js +36 -21
  50. package/lib/components/venueBookingSales/useVenueCatalog.js +2 -0
  51. package/lib/components/venueBookingSales/useVenueDates.js +4 -1
  52. package/lib/plus/salesSdk/hooks/useSalesSettings.js +12 -6
  53. package/package.json +4 -4
  54. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -1,6 +1,7 @@
1
1
  import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
2
  import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { useMemoizedFn } from "ahooks";
4
+ import isEqual from "lodash/isEqual";
4
5
  //#region src/plus/salesSdk/hooks/useSalesSettings.ts
5
6
  /** A failed or superseded OpenData request must never enable Board defaults. */
6
7
  function useSalesSettings({ bookingTicket, solution, scopeKey, syncModuleOtherParams }) {
@@ -44,18 +45,22 @@ function useSalesSettings({ bookingTicket, solution, scopeKey, syncModuleOtherPa
44
45
  const value = yield bookingTicket.getSalesSettings();
45
46
  assertCurrent();
46
47
  if (!value) throw new Error("PiCoding 销售配置加载失败。");
47
- requestScope.value = value;
48
- requestScope.platform = String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform) || "").trim().toLowerCase();
48
+ const platform = String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform) || "").trim().toLowerCase();
49
+ const settingsChanged = !isEqual(requestScope.value, value);
50
+ const changed = settingsChanged || requestScope.platform !== platform || requestScope.error !== null;
51
+ if (settingsChanged) requestScope.value = value;
52
+ requestScope.platform = platform;
49
53
  requestScope.error = null;
50
- render((revision) => revision + 1);
51
- return value;
54
+ if (changed) render((revision) => revision + 1);
55
+ return requestScope.value;
52
56
  } catch (cause) {
53
57
  const error = cause instanceof Error ? cause : new Error(String(cause));
54
58
  if (isCurrent()) {
59
+ const changed = requestScope.value !== null || requestScope.platform !== void 0 || requestScope.error !== error;
55
60
  requestScope.value = null;
56
61
  requestScope.platform = void 0;
57
62
  requestScope.error = error;
58
- render((revision) => revision + 1);
63
+ if (changed) render((revision) => revision + 1);
59
64
  }
60
65
  throw error;
61
66
  } finally {
@@ -0,0 +1,54 @@
1
+ import "./hosts/createInstanceHostBridge.js";
2
+ import "./holderConfirm/createHolderConfirmBridge.js";
3
+ import "./giftSelect/createGiftSelectBridge.js";
4
+ import "./context/SalesSdkHostBridgesContext.js";
5
+ import "./utils/formatHolderOptions.js";
6
+ import "./utils/enrichCartLineHolderDisplay.js";
7
+ import "./context/SalesSdkHolderContext.js";
8
+ import "../multiCurrencySettlement/index.js";
9
+ import "./utils/customerAuthGate.js";
10
+ import "./context/SalesSdkBusinessAvailabilityContext.js";
11
+ import "./utils/appendPromotionTags.js";
12
+ import "./utils/productSkuOptions.js";
13
+ import "./context/SalesSdkUIHostsContext.js";
14
+ import "./utils/runAddProductFlow.js";
15
+ import "./components/showAddToCartToast.js";
16
+ import "./utils/resolveAddProductDebounceKey.js";
17
+ import "./utils/identity.js";
18
+ import "./utils/resolveInCartQuantityForAddToast.js";
19
+ import "./utils/addProductWithFlowDebounced.js";
20
+ import "./utils/bookingDate.js";
21
+ import "./utils/holderSubmitValidation.js";
22
+ import "./utils/removeOrderProducts.js";
23
+ import "./selectors.js";
24
+ import "./utils/enrich.js";
25
+ import "./giftSelect/createOpenGiftSelectHost.js";
26
+ import "./utils/ensureHoldersBeforeSubmit.js";
27
+ import "./hooks/useSalesSdk.js";
28
+ import "./bookingEditService/BookingEditServiceDrawer.js";
29
+ import "./hosts/BookingEditHostRenderer.js";
30
+ import "./hosts/CustomerAuthHostRenderer.js";
31
+ import "./hooks/useSalesSdkCart.js";
32
+ import "./hooks/useSalesSdkCustomer.js";
33
+ import "./normalProductDetail/NormalProductDetailHostRenderer.js";
34
+ import "./hosts/createOpenBookingEditHost.js";
35
+ import "./hosts/createOpenMultiDaySelectHost.js";
36
+ import "./hosts/createOpenHolderSelectHost.js";
37
+ import "./hosts/createOpenCustomerAuthHost.js";
38
+ import "./demo/hosts/legacyOpenProductDetail.js";
39
+ import "./hosts/createCompositeOpenProductDetailHost.js";
40
+ import "./normalProductDetail/createOpenNormalProductDetailHost.js";
41
+ import "./normalProductDetail/createOpenBookingSelectionFlowHost.js";
42
+ import "./giftSelect/GiftSelectModal.js";
43
+ import "./giftSelect/GiftSelectHostRenderer.js";
44
+ import "./allergy/AllergySelectionModal.js";
45
+ import "./context/SalesSdkProvider.js";
46
+ import "./context/SalesSdkDishContext.js";
47
+ import "./context/SalesSdkBookingContext.js";
48
+ import "./hooks/useSalesSdkSummary.js";
49
+ import "./hooks/useSalesSdkProducts.js";
50
+ import "./demo/index.js";
51
+ import "./hooks/useSalesSdkDish.js";
52
+ import "./hooks/useCurrentSalesSdkDish.js";
53
+ import "./hooks/useSyncOsModule.js";
54
+ export {};
@@ -407,4 +407,4 @@ function createAddProductWithFlowDebounced(deps) {
407
407
  };
408
408
  }
409
409
  //#endregion
410
- export { createAddProductWithFlowDebounced };
410
+ export { createAddProductWithFlowDebounced, shouldBypassAddProductDebounce };
@@ -31,4 +31,4 @@ function subscribeBookingDateChange(bookingTicket, callback) {
31
31
  return typeof off === "function" ? off : () => {};
32
32
  }
33
33
  //#endregion
34
- export { formatBookingDateTime, subscribeBookingDateChange };
34
+ export { BOOKING_CONTEXT_DATE_EVENT, formatBookingDateTime, subscribeBookingDateChange };
@@ -102,4 +102,4 @@ function buildHolderListRequestKey(params) {
102
102
  });
103
103
  }
104
104
  //#endregion
105
- export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, resolveHolderDisplayConfig };
105
+ export { buildHolderListRequestKey, buildHolderListRequestParams, enrichCartBookingHolderDisplay, enrichCartProductHolderDisplay, pickHolderIdFromBooking, resolveHolderDisplayConfig };
@@ -14,4 +14,4 @@ interface AuthModalProps {
14
14
  */
15
15
  declare const AuthModal: React.FC<AuthModalProps>;
16
16
  //#endregion
17
- export { AuthModal, AuthModalProps };
17
+ export { AuthModal };
@@ -1,4 +1,4 @@
1
- import { AuthMethodType, VerificationMethod } from "./shared/types.js";
1
+ import { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LoginFormData, OAuthConfig, PhoneAuthConfig, RegisterFormData, UIConfig, VerificationMethod } from "./shared/types.js";
2
2
  import { Login2, Login2Config, Login2Events, Login2Props } from "./Login2.js";
3
3
  import { Register2, Register2Config, Register2Events, Register2Props } from "./Register2.js";
4
- import { AuthModal, AuthModalProps } from "./AuthModal.js";
4
+ import { AuthModal } from "./AuthModal.js";
@@ -226,4 +226,4 @@ interface RegisterFormData {
226
226
  verification_token?: string;
227
227
  }
228
228
  //#endregion
229
- export { AuthMethodType, EmailAuthConfig, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
229
+ export { AuthMethodType, EmailAuthConfig, EmailRegistrationVerification, LegalTermsConfig, LoginFormData, LoginMethodItem, OAuthConfig, PhoneAuthConfig, RegisterFormData, RegistrationMethodItem, UIConfig, VerificationMethod };
@@ -357,94 +357,137 @@ function prepareCatalogPreview(detail, policy) {
357
357
  }
358
358
  }
359
359
  /** Resolve products locally from the session pool; date OR can stop at its first real witness. */
360
- function queryCatalogPreview(_x, _x2) {
360
+ function queryCatalogPreview(_x2, _x3) {
361
361
  return _queryCatalogPreview.apply(this, arguments);
362
362
  }
363
363
  function _queryCatalogPreview() {
364
364
  _queryCatalogPreview = require_asyncToGenerator._asyncToGenerator(function* (os, input) {
365
+ var _input$resolvePolicy$, _input$resolvePolicy$2, _input$resolvePolicy;
365
366
  const result = {
366
367
  available: false,
367
368
  availability: {}
368
369
  };
370
+ let failed = false;
369
371
  const current = () => {
370
372
  var _input$isCurrent;
371
- return ((_input$isCurrent = input.isCurrent) === null || _input$isCurrent === void 0 ? void 0 : _input$isCurrent.call(input)) !== false;
373
+ return !failed && ((_input$isCurrent = input.isCurrent) === null || _input$isCurrent === void 0 ? void 0 : _input$isCurrent.call(input)) !== false;
372
374
  };
373
- for (const listed of input.products) {
374
- var _listed$id, _detail$id2;
375
- if (!current()) break;
376
- const id = (_listed$id = listed.id) !== null && _listed$id !== void 0 ? _listed$id : listed.product_id;
377
- if (!Number.isSafeInteger(Number(id)) || Number(id) <= 0) {
378
- result.availability[String(id)] = {
379
- available: false,
380
- reasons: ["INVALID_PRODUCT_ID"]
375
+ const resolvePolicy = (_input$resolvePolicy$ = (_input$resolvePolicy$2 = (_input$resolvePolicy = input.resolvePolicy).createBatch) === null || _input$resolvePolicy$2 === void 0 ? void 0 : _input$resolvePolicy$2.call(_input$resolvePolicy)) !== null && _input$resolvePolicy$ !== void 0 ? _input$resolvePolicy$ : input.resolvePolicy;
376
+ const checkProduct = function() {
377
+ var _ref = require_asyncToGenerator._asyncToGenerator(function* (listed) {
378
+ var _listed$id, _detail$id2;
379
+ if (!current()) return;
380
+ const id = (_listed$id = listed.id) !== null && _listed$id !== void 0 ? _listed$id : listed.product_id;
381
+ if (!Number.isSafeInteger(Number(id)) || Number(id) <= 0) return {
382
+ id: String(id),
383
+ state: {
384
+ available: false,
385
+ reasons: ["INVALID_PRODUCT_ID"]
386
+ }
381
387
  };
382
- continue;
383
- }
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), {}, {
386
- product_id: Number(id),
387
- schedule_date: input.date,
388
- with_count: ["bundleGroup", "optionGroup"],
389
- with_schedule: 1
390
- }));
391
- if (!current()) break;
392
- if (!detail) {
393
- result.availability[String(id)] = {
394
- available: false,
395
- reasons: ["PRODUCT_NOT_IN_MENU"]
388
+ if (!input.catalogParams.menu_list_ids.length) throw new PreviewError("PREVIEW_MENU_CONFIGURATION_REQUIRED");
389
+ const detail = input.productsFromSessionSnapshot ? listed : yield input.queries.queryCatalogProductDetail(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, input.catalogParams), {}, {
390
+ product_id: Number(id),
391
+ schedule_date: input.date,
392
+ with_count: ["bundleGroup", "optionGroup"],
393
+ with_schedule: 1
394
+ }));
395
+ if (!current()) return;
396
+ if (!detail) return {
397
+ id: String(id),
398
+ state: {
399
+ available: false,
400
+ reasons: ["PRODUCT_NOT_IN_MENU"]
401
+ }
396
402
  };
397
- continue;
398
- }
399
- if (String((_detail$id2 = detail.id) !== null && _detail$id2 !== void 0 ? _detail$id2 : detail.product_id) !== String(id)) {
400
- result.availability[String(id)] = {
403
+ if (String((_detail$id2 = detail.id) !== null && _detail$id2 !== void 0 ? _detail$id2 : detail.product_id) !== String(id)) return {
404
+ id: String(id),
405
+ state: {
406
+ available: false,
407
+ reasons: ["PRODUCT_MISMATCH"]
408
+ }
409
+ };
410
+ const preview = prepareCatalogPreview(detail, yield resolvePolicy(detail));
411
+ if (!current()) return;
412
+ const state = {
401
413
  available: false,
402
- reasons: ["PRODUCT_MISMATCH"]
414
+ reasons: [...preview.reasonCodes]
403
415
  };
404
- continue;
405
- }
406
- const preview = prepareCatalogPreview(detail, yield input.resolvePolicy(detail));
407
- if (!current()) break;
408
- const state = {
409
- available: false,
410
- reasons: [...preview.reasonCodes]
411
- };
412
- result.availability[String(id)] = state;
413
- if (preview.status !== "ready" && preview.status !== "requires-configuration") continue;
414
- for (const candidate of preview.candidates) {
415
- let projection;
416
- try {
417
- projection = yield require_queries.prepareBookingProjection({
418
- os,
419
- mode: input.mode || "ticket",
420
- date: input.date,
421
- product: candidate.product,
422
- quantity: 1
423
- }, { projectionDateRange: input.projectionDateRange });
416
+ if (preview.status !== "ready" && preview.status !== "requires-configuration") return {
417
+ id: String(id),
418
+ state
419
+ };
420
+ for (const candidate of preview.candidates) {
424
421
  if (!current()) break;
425
- const usable = projection.times.filter((time) => require_queries.selectable(time, candidate.partySize));
426
- if (usable.some((time) => {
427
- const groups = time.requirementGroups || [];
428
- return groups.every((group) => Math.max(group.required ? 1 : 0, group.min || 0) <= 1 && (!(group.required || group.min > 0) || group.max >= 1 && group.options.some((option) => require_queries.selectable(option, candidate.partySize)))) && (input.mode !== "party" || groups.some((group) => group.max >= 1 && group.options.some((option) => require_queries.selectable(option, candidate.partySize))));
429
- })) {
430
- if (preview.status === "requires-configuration") state.requiresConfiguration = true;
431
- else state.available = true;
432
- state.reasons = [];
433
- break;
422
+ let projection;
423
+ try {
424
+ projection = yield require_queries.prepareBookingProjection({
425
+ os,
426
+ mode: input.mode || "ticket",
427
+ date: input.date,
428
+ product: candidate.product,
429
+ quantity: 1
430
+ }, { projectionDateRange: input.projectionDateRange });
431
+ if (!current()) break;
432
+ const usable = projection.times.filter((time) => require_queries.selectable(time, candidate.partySize));
433
+ if (usable.some((time) => {
434
+ const groups = time.requirementGroups || [];
435
+ return groups.every((group) => Math.max(group.required ? 1 : 0, group.min || 0) <= 1 && (!(group.required || group.min > 0) || group.max >= 1 && group.options.some((option) => require_queries.selectable(option, candidate.partySize)))) && (input.mode !== "party" || groups.some((group) => group.max >= 1 && group.options.some((option) => require_queries.selectable(option, candidate.partySize))));
436
+ })) {
437
+ if (preview.status === "requires-configuration") state.requiresConfiguration = true;
438
+ else state.available = true;
439
+ state.reasons = [];
440
+ break;
441
+ }
442
+ state.reasons.push(...projection.times.flatMap((time) => time.reasonCodes || []));
443
+ if (!state.reasons.length) state.reasons.push(usable.length ? "UNSUPPORTED_RESOURCE_GROUP" : "NO_AVAILABLE_BOOKING");
444
+ } catch (error) {
445
+ if (error instanceof require_queries.BookingSelectionError) state.reasons.push(...error.reasonCodes);
446
+ else throw error;
447
+ } finally {
448
+ require_queries.releaseProjection(os, projection);
434
449
  }
435
- state.reasons.push(...projection.times.flatMap((time) => time.reasonCodes || []));
436
- if (!state.reasons.length) state.reasons.push(usable.length ? "UNSUPPORTED_RESOURCE_GROUP" : "NO_AVAILABLE_BOOKING");
437
- } catch (error) {
438
- if (error instanceof require_queries.BookingSelectionError) state.reasons.push(...error.reasonCodes);
439
- else throw error;
440
- } finally {
441
- require_queries.releaseProjection(os, projection);
442
450
  }
451
+ state.reasons = [...new Set(state.reasons)];
452
+ return {
453
+ id: String(id),
454
+ state,
455
+ evaluated: true
456
+ };
457
+ });
458
+ return function checkProduct(_x) {
459
+ return _ref.apply(this, arguments);
460
+ };
461
+ }();
462
+ const states = new Array(input.products.length);
463
+ let nextIndex = 0;
464
+ const worker = function() {
465
+ var _ref2 = require_asyncToGenerator._asyncToGenerator(function* () {
466
+ while (current() && nextIndex < input.products.length) {
467
+ const index = nextIndex++;
468
+ try {
469
+ const entry = yield checkProduct(input.products[index]);
470
+ states[index] = entry;
471
+ if (input.stopAtFirstAvailable && ((entry === null || entry === void 0 ? void 0 : entry.state.available) || (entry === null || entry === void 0 ? void 0 : entry.state.requiresConfiguration))) return;
472
+ } catch (error) {
473
+ failed = true;
474
+ throw error;
475
+ }
476
+ }
477
+ });
478
+ return function worker() {
479
+ return _ref2.apply(this, arguments);
480
+ };
481
+ }();
482
+ const concurrency = !input.stopAtFirstAvailable && input.concurrency === 2 ? 2 : 1;
483
+ yield Promise.all(Array.from({ length: Math.min(concurrency, input.products.length) }, () => worker()));
484
+ for (const entry of states) {
485
+ if (!entry) continue;
486
+ result.availability[entry.id] = entry.state;
487
+ if (entry.evaluated) {
488
+ result.available || (result.available = entry.state.available);
489
+ result.requiresConfiguration || (result.requiresConfiguration = entry.state.requiresConfiguration);
443
490
  }
444
- state.reasons = [...new Set(state.reasons)];
445
- result.available || (result.available = state.available);
446
- result.requiresConfiguration || (result.requiresConfiguration = state.requiresConfiguration);
447
- if ((result.available || result.requiresConfiguration) && input.stopAtFirstAvailable) break;
448
491
  }
449
492
  return result;
450
493
  });
@@ -8,36 +8,51 @@ function previewSalesSettingsKey(settings) {
8
8
  return Object.fromEntries(Object.keys(value).sort().map((key) => [key, value[key]]));
9
9
  });
10
10
  }
11
- /** Share concurrent reads, while later preview actions still read the current OS policy. */
11
+ /** Independent actions stay fresh; a directory/calendar request owns one snapshot. */
12
12
  function createPreviewPolicyResolver(input) {
13
13
  let pending;
14
- return function() {
14
+ const readSnapshot = () => {
15
+ if (pending) return pending;
16
+ const request = Promise.resolve().then(require_asyncToGenerator._asyncToGenerator(function* () {
17
+ const settings = yield input.ensureSalesSettings();
18
+ if (!settings) throw new Error("The booking sales settings are unavailable.");
19
+ return {
20
+ settings,
21
+ platform: input.getPlatform()
22
+ };
23
+ }));
24
+ pending = request;
25
+ const clear = () => {
26
+ if (pending === request) pending = void 0;
27
+ };
28
+ request.then(clear, clear);
29
+ return request;
30
+ };
31
+ const resolver = (read) => function() {
15
32
  var _ref = require_asyncToGenerator._asyncToGenerator(function* (product) {
16
- const request = pending || (pending = Promise.resolve().then(() => input.ensureSalesSettings()));
17
- try {
18
- const settings = yield request;
19
- if (!settings) throw new Error("The booking sales settings are unavailable.");
20
- const runtimePolicy = {
21
- source: "picoding",
22
- settings,
23
- platform: input.getPlatform()
24
- };
25
- return {
26
- requiredOptionValidation: settings.product.checkRequiredOptions,
27
- overSold: require_salesSettingsPolicy.resolveSkuSelectionOverSold({
28
- productOverSold: product.over_sold,
29
- runtimePolicy
30
- }) === 1,
33
+ const { settings, platform } = yield read();
34
+ const runtimePolicy = {
35
+ source: "picoding",
36
+ settings,
37
+ platform
38
+ };
39
+ return {
40
+ requiredOptionValidation: settings.product.checkRequiredOptions,
41
+ overSold: require_salesSettingsPolicy.resolveSkuSelectionOverSold({
42
+ productOverSold: product.over_sold,
31
43
  runtimePolicy
32
- };
33
- } finally {
34
- if (pending === request) pending = void 0;
35
- }
44
+ }) === 1,
45
+ runtimePolicy
46
+ };
36
47
  });
37
48
  return function(_x) {
38
49
  return _ref.apply(this, arguments);
39
50
  };
40
51
  }();
52
+ return Object.assign(resolver(readSnapshot), { createBatch() {
53
+ let snapshot;
54
+ return resolver(() => snapshot || (snapshot = readSnapshot()));
55
+ } });
41
56
  }
42
57
  //#endregion
43
58
  exports.createPreviewPolicyResolver = createPreviewPolicyResolver;
@@ -111,6 +111,8 @@ 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,
115
+ concurrency: 2,
114
116
  date,
115
117
  mode,
116
118
  resolvePolicy,
@@ -76,6 +76,7 @@ function useVenueDates(input) {
76
76
  const inFlight = (0, react.useRef)(0);
77
77
  const currentPump = (0, react.useRef)();
78
78
  (0, react.useEffect)(() => {
79
+ var _request$resolvePolic, _request$resolvePolic2, _request$resolvePolic3;
79
80
  let active = true;
80
81
  const isCurrent = () => active && currentRequest.current === request;
81
82
  setSnapshot({
@@ -85,6 +86,7 @@ function useVenueDates(input) {
85
86
  if (!request.ready || !request.menuIds.length) return () => {
86
87
  active = false;
87
88
  };
89
+ const resolvePolicy = (_request$resolvePolic = (_request$resolvePolic2 = (_request$resolvePolic3 = request.resolvePolicy).createBatch) === null || _request$resolvePolic2 === void 0 ? void 0 : _request$resolvePolic2.call(_request$resolvePolic3)) !== null && _request$resolvePolic !== void 0 ? _request$resolvePolic : request.resolvePolicy;
88
90
  const publish = (date, state) => {
89
91
  if (!isCurrent()) return;
90
92
  work.states[date] = state;
@@ -107,12 +109,13 @@ function useVenueDates(input) {
107
109
  if (products.length) {
108
110
  const result = yield require_catalogPreview.queryCatalogPreview(request.os, {
109
111
  products,
112
+ productsFromSessionSnapshot: true,
110
113
  date,
111
114
  mode: request.mode,
112
115
  queries: request.queries,
113
116
  projectionDateRange: require_queries.resolvePreviewProjectionDateRange(date, projectionDates),
114
117
  catalogParams: require_objectSpread2._objectSpread2({ menu_list_ids: request.menuIds }, request.customerId ? { customer_id: request.customerId } : {}),
115
- resolvePolicy: request.resolvePolicy,
118
+ resolvePolicy,
116
119
  isCurrent,
117
120
  stopAtFirstAvailable: true
118
121
  });
@@ -1,7 +1,9 @@
1
- require("../../../_virtual/_rolldown/runtime.js");
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
2
2
  const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
3
  let react = require("react");
4
4
  let ahooks = require("ahooks");
5
+ let lodash_isEqual = require("lodash/isEqual");
6
+ lodash_isEqual = require_runtime.__toESM(lodash_isEqual);
5
7
  //#region src/plus/salesSdk/hooks/useSalesSettings.ts
6
8
  /** A failed or superseded OpenData request must never enable Board defaults. */
7
9
  function useSalesSettings({ bookingTicket, solution, scopeKey, syncModuleOtherParams }) {
@@ -45,18 +47,22 @@ function useSalesSettings({ bookingTicket, solution, scopeKey, syncModuleOtherPa
45
47
  const value = yield bookingTicket.getSalesSettings();
46
48
  assertCurrent();
47
49
  if (!value) throw new Error("PiCoding 销售配置加载失败。");
48
- requestScope.value = value;
49
- requestScope.platform = String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform) || "").trim().toLowerCase();
50
+ const platform = String((otherParams === null || otherParams === void 0 ? void 0 : otherParams.platform) || "").trim().toLowerCase();
51
+ const settingsChanged = !(0, lodash_isEqual.default)(requestScope.value, value);
52
+ const changed = settingsChanged || requestScope.platform !== platform || requestScope.error !== null;
53
+ if (settingsChanged) requestScope.value = value;
54
+ requestScope.platform = platform;
50
55
  requestScope.error = null;
51
- render((revision) => revision + 1);
52
- return value;
56
+ if (changed) render((revision) => revision + 1);
57
+ return requestScope.value;
53
58
  } catch (cause) {
54
59
  const error = cause instanceof Error ? cause : new Error(String(cause));
55
60
  if (isCurrent()) {
61
+ const changed = requestScope.value !== null || requestScope.platform !== void 0 || requestScope.error !== error;
56
62
  requestScope.value = null;
57
63
  requestScope.platform = void 0;
58
64
  requestScope.error = error;
59
- render((revision) => revision + 1);
65
+ if (changed) render((revision) => revision + 1);
60
66
  }
61
67
  throw error;
62
68
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.436",
3
+ "version": "6.12.438",
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
- "@pisell/materials": "6.12.97",
80
78
  "@pisell/utils": "3.0.7",
81
- "@pisell/date-picker": "3.0.12"
79
+ "@pisell/date-picker": "3.0.12",
80
+ "@pisell/icon": "0.0.11",
81
+ "@pisell/materials": "6.12.97"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": "^18.0.0",
@@ -1 +0,0 @@
1
- export { };