@pisell/private-materials 6.12.228 → 6.12.230

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 (109) 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.css +1 -1
  6. package/build/lowcode/render/default/view.js +2 -2
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +2 -2
  9. package/es/components/HDLKiosk/app/manifest.js +16 -1
  10. package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +2 -2
  11. package/es/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +15 -31
  12. package/es/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +1 -1
  13. package/es/components/HDLKiosk/kernel/application/defineApplication.js +24 -10
  14. package/es/components/HDLKiosk/kernel/application/defineSlice.js +3 -1
  15. package/es/components/HDLKiosk/kernel/application/runtime.js +16 -12
  16. package/es/components/HDLKiosk/kernel/workflow/actor.js +11 -2
  17. package/es/components/HDLKiosk/locales.js +30 -0
  18. package/es/components/HDLKiosk/runtime/admissionPolicy.js +2 -2
  19. package/es/components/HDLKiosk/runtime/application.js +2 -1
  20. package/es/components/HDLKiosk/runtime/devices/scannerSessionPort.js +2 -1
  21. package/es/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +36 -8
  22. package/es/components/HDLKiosk/runtime/operations/writes.js +4 -1
  23. package/es/components/HDLKiosk/runtime/session/createSession.js +24 -3
  24. package/es/components/HDLKiosk/slices/catalog/Screen/index.js +4 -8
  25. package/es/components/HDLKiosk/slices/catalog/slice.js +2 -2
  26. package/es/components/HDLKiosk/slices/customization/Screen/index.js +24 -20
  27. package/es/components/HDLKiosk/slices/customization/Screen/index.less +0 -18
  28. package/es/components/HDLKiosk/slices/identity/Screen/index.js +16 -2
  29. package/es/components/HDLKiosk/slices/identity/slice.js +2 -0
  30. package/es/components/HDLKiosk/slices/identity/view.js +9 -6
  31. package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +3 -3
  32. package/es/components/HDLKiosk/ui/HDLKioskWorkflowView.js +18 -0
  33. package/es/components/HDLKiosk/ui/controllers/useHDLKioskCustomerController.js +2 -7
  34. package/es/components/HDLKiosk/utils.js +6 -11
  35. package/es/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.js +1 -0
  36. package/es/components/bigSale/components/TimeBar/index.js +1 -0
  37. package/es/components/bigSale/dialog.js +1 -0
  38. package/es/components/bigSale/hooks/useBigSaleContext.js +1 -0
  39. package/es/components/bigSale/hooks/useSelectFloorMapResourceForBigSale.js +1 -0
  40. package/es/components/bigSale/index.js +1 -0
  41. package/es/components/bigSale/templates/HDLKiosk/adapter/createHost.js +2 -1
  42. package/es/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +6 -2
  43. package/es/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +4 -14
  44. package/es/components/bigSale/templates/HDLKiosk/hooks/useBigSaleHDLKioskAdapter.js +28 -4
  45. package/es/components/bigSale/templates/HDLKiosk/index.js +1 -1
  46. package/es/components/bigSale/templates/HDLKiosk/utils/transactionState.js +12 -12
  47. package/es/components/bigSale/templates/Kiosk/index.js +1 -0
  48. package/es/components/sharedSecondaryBigSale/SharedSecondaryBigSaleReceiver.js +1 -0
  49. package/es/index.js +2 -0
  50. package/es/plus/multiCurrencySettlement/index.js +1 -1
  51. package/es/plus/pisellReservation/data/bookingToReservationTables.js +1 -1
  52. package/es/plus/pisellReservation/floorMap/floorPlanApi.js +1 -1
  53. package/es/plus/pisellReservation/floorMap/reservationMock.js +1 -1
  54. package/es/plus/pisellReservation/index.js +17 -0
  55. package/es/plus/saasDevice/devicePasscodes/model.js +4 -4
  56. package/es/plus/saleDetail/Base.js +1 -0
  57. package/es/plus/saleDetail/components/Client/hooks/useClientSelectorProps.js +1 -0
  58. package/es/plus/saleDetail/components/DetailActions/PrintAction.js +1 -0
  59. package/es/plus/saleDetail/components/DetailActions/index.js +1 -0
  60. package/es/plus/saleDetail/components/SummaryFinancialSections/index.js +1 -0
  61. package/es/plus/saleDetail/index.js +1 -0
  62. package/es/plus/saleDetail/tmpl/B/components/Dish/index.js +1 -0
  63. package/es/plus/saleDetail/tmpl/B/index.js +1 -0
  64. package/es/plus/salesSdk/context/SalesSdkProvider.js +20 -1
  65. package/es/plus/salesSdk/hooks/useSalesSdkTempOrderSync.js +117 -27
  66. package/es/plus/salesSdk/index.js +53 -0
  67. package/es/plus/salesSdk/utils/addProductWithFlowDebounced.js +1 -1
  68. package/es/plus/salesSdk/utils/bookingDate.js +1 -1
  69. package/es/plus/salesSdk/utils/enrichCartLineHolderDisplay.js +1 -1
  70. package/es/plus/walletPassGallery/components/timelineSection/index.js +4 -4
  71. package/es/pro/Login2.0/AuthModal.d.ts +1 -1
  72. package/es/pro/Login2.0/index.d.ts +2 -2
  73. package/es/pro/Login2.0/shared/types.d.ts +1 -1
  74. package/lib/components/HDLKiosk/app/manifest.js +16 -1
  75. package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +2 -2
  76. package/lib/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +15 -31
  77. package/lib/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +1 -1
  78. package/lib/components/HDLKiosk/kernel/application/defineApplication.js +24 -10
  79. package/lib/components/HDLKiosk/kernel/application/defineSlice.js +3 -0
  80. package/lib/components/HDLKiosk/kernel/application/runtime.js +16 -12
  81. package/lib/components/HDLKiosk/kernel/workflow/actor.js +11 -2
  82. package/lib/components/HDLKiosk/locales.js +30 -0
  83. package/lib/components/HDLKiosk/runtime/admissionPolicy.js +2 -2
  84. package/lib/components/HDLKiosk/runtime/application.js +2 -1
  85. package/lib/components/HDLKiosk/runtime/devices/scannerSessionPort.js +2 -1
  86. package/lib/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +36 -8
  87. package/lib/components/HDLKiosk/runtime/operations/writes.js +4 -1
  88. package/lib/components/HDLKiosk/runtime/session/createSession.js +24 -3
  89. package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +4 -8
  90. package/lib/components/HDLKiosk/slices/catalog/slice.js +1 -1
  91. package/lib/components/HDLKiosk/slices/customization/Screen/index.js +24 -20
  92. package/lib/components/HDLKiosk/slices/customization/Screen/index.less +0 -18
  93. package/lib/components/HDLKiosk/slices/identity/Screen/index.js +16 -2
  94. package/lib/components/HDLKiosk/slices/identity/slice.js +2 -0
  95. package/lib/components/HDLKiosk/slices/identity/view.js +9 -6
  96. package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
  97. package/lib/components/HDLKiosk/ui/HDLKioskWorkflowView.js +20 -2
  98. package/lib/components/HDLKiosk/ui/controllers/useHDLKioskCustomerController.js +2 -7
  99. package/lib/components/HDLKiosk/utils.js +8 -13
  100. package/lib/components/bigSale/templates/HDLKiosk/adapter/createHost.js +2 -1
  101. package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/cart.js +6 -2
  102. package/lib/components/bigSale/templates/HDLKiosk/adapter/sales/index.js +4 -14
  103. package/lib/components/bigSale/templates/HDLKiosk/hooks/useBigSaleHDLKioskAdapter.js +28 -4
  104. package/lib/components/bigSale/templates/HDLKiosk/index.js +1 -1
  105. package/lib/components/bigSale/templates/HDLKiosk/utils/transactionState.js +12 -12
  106. package/lib/plus/salesSdk/context/SalesSdkProvider.js +20 -1
  107. package/lib/plus/salesSdk/hooks/useSalesSdkTempOrderSync.js +117 -27
  108. package/package.json +2 -2
  109. package/es/private-materials/lowcode/authmodal/meta.d.ts +0 -1
@@ -1,10 +1,12 @@
1
1
  const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
2
2
  const require_asyncToGenerator = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
3
+ const require_selectors = require("../../../../../../plus/salesSdk/selectors.js");
3
4
  const require_transactionState = require("../../utils/transactionState.js");
4
5
  const require_normalize = require("../../utils/normalize.js");
5
6
  const require_cart = require("./cart.js");
6
7
  const require_weightedOperations = require("./weightedOperations.js");
7
8
  //#region src/components/bigSale/templates/HDLKiosk/adapter/sales/index.ts
9
+ /** BigSale 对 HDLSalesPort 的集中实现;复杂购物车与称重算法保留在独立模块。 */
8
10
  const PAYMENT_WRITE_FROZEN_STATUSES = new Set(["payment_pending", "processing"]);
9
11
  function readPaymentStatus(order) {
10
12
  var _order$payment_status;
@@ -17,18 +19,6 @@ function isCommittedCompletedOrder(order) {
17
19
  function isWritableSessionOrder(order) {
18
20
  return Boolean(order) && !isCommittedCompletedOrder(order) && !PAYMENT_WRITE_FROZEN_STATUSES.has(readPaymentStatus(order));
19
21
  }
20
- function projectConfirmedCustomer(customer) {
21
- var _customer$id;
22
- if (!customer || [
23
- "0",
24
- "1",
25
- ""
26
- ].includes(String((_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : ""))) return;
27
- return Object.freeze({
28
- customerId: String(customer.id),
29
- member: true
30
- });
31
- }
32
22
  function cancelled(reason) {
33
23
  return {
34
24
  status: "cancelled",
@@ -110,12 +100,12 @@ function createBigSaleSalesPort(dependencies) {
110
100
  }
111
101
  const currentCustomer = context.customer.selected;
112
102
  const selected = (_getAuthenticatedCust = getAuthenticatedCustomer === null || getAuthenticatedCustomer === void 0 ? void 0 : getAuthenticatedCustomer(customerId)) !== null && _getAuthenticatedCust !== void 0 ? _getAuthenticatedCust : String((_currentCustomer$id = currentCustomer === null || currentCustomer === void 0 ? void 0 : currentCustomer.id) !== null && _currentCustomer$id !== void 0 ? _currentCustomer$id : "") === customerId ? currentCustomer : void 0;
113
- if (!projectConfirmedCustomer(selected)) return require_normalize.failed("authenticatedCustomerUnavailable", "back");
103
+ if (require_selectors.isWalkInCustomer(selected)) return require_normalize.failed("authenticatedCustomerUnavailable", "back");
114
104
  context.customer.select(selected);
115
105
  if (signal.aborted) return require_normalize.unknown("identityAbortedAfterDispatch");
116
106
  return {
117
107
  status: "succeeded",
118
- data: { customer: projectConfirmedCustomer(selected) }
108
+ data: { customer: selected }
119
109
  };
120
110
  } catch (error) {
121
111
  return require_normalize.partialFailure("identitySelectionFailed", error);
@@ -109,19 +109,43 @@ function useBigSaleHDLKioskAdapter({ context, businessCode, isActive, nativeScal
109
109
  const hostRef = (0, react.useRef)(null);
110
110
  if (!hostRef.current) hostRef.current = require_createHost.createBigSaleHDLKioskHost({
111
111
  getContext: () => contextRef.current,
112
+ resolveScan: function() {
113
+ var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (code, signal) {
114
+ if (signal.aborted) return null;
115
+ const ticket = contextRef.current.sales.bookingTicket;
116
+ if (typeof (ticket === null || ticket === void 0 ? void 0 : ticket.getGlobalScanCodeType) !== "function") {
117
+ ToastRef.current.fail(_pisell_utils.locales.getText("pisell2.hdl-kiosk.scan-service-unavailable"));
118
+ return null;
119
+ }
120
+ try {
121
+ const type = yield ticket.getGlobalScanCodeType(code);
122
+ if (signal.aborted) return null;
123
+ if (!type) ToastRef.current.fail(_pisell_utils.locales.getText("pisell2.text.scan-global-failed"));
124
+ return type;
125
+ } catch (_unused) {
126
+ if (!signal.aborted) ToastRef.current.fail(_pisell_utils.locales.getText("pisell2.hdl-kiosk.scan-request-failed"));
127
+ return null;
128
+ }
129
+ });
130
+ return function resolveScan(_x, _x2) {
131
+ return _ref9.apply(this, arguments);
132
+ };
133
+ }(),
112
134
  executeScan: function() {
113
- var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (code) {
114
- var _execution$scanResult, _execution$scanResult2, _execution$scanResult3;
135
+ var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (code) {
136
+ var _execution$scanResult, _execution$scanResult2, _execution$scanResult3, _execution$scanResult4;
137
+ ToastRef.current.loading(_pisell_utils.locales.getText("pisell2.hdl-kiosk.processing"), 1500);
115
138
  const beforeProducts = snapshotProductQuantityEvidence(readLiveProducts());
116
139
  let selectionToastShown = false;
117
140
  const execution = yield scanRef.current(code, { onProductAdded: ({ product, products }) => {
118
141
  selectionToastShown = notifyScannedProductAdded(beforeProducts, products, product);
119
142
  } });
120
143
  if (!selectionToastShown && ((_execution$scanResult = execution.scanResult) === null || _execution$scanResult === void 0 ? void 0 : _execution$scanResult.status) === "success" && Number((_execution$scanResult2 = (_execution$scanResult3 = execution.scanResult.meta) === null || _execution$scanResult3 === void 0 ? void 0 : _execution$scanResult3.count) !== null && _execution$scanResult2 !== void 0 ? _execution$scanResult2 : 0) > 0) notifyScannedProductAdded(beforeProducts, readLiveProducts());
144
+ if (((_execution$scanResult4 = execution.scanResult) === null || _execution$scanResult4 === void 0 ? void 0 : _execution$scanResult4.status) === "success" && execution.scanResult.kind === "promotion") ToastRef.current.success(_pisell_utils.locales.getText("pisell2.hdl-kiosk.code-applied"));
121
145
  return execution;
122
146
  });
123
- return function executeScan(_x) {
124
- return _ref9.apply(this, arguments);
147
+ return function executeScan(_x3) {
148
+ return _ref10.apply(this, arguments);
125
149
  };
126
150
  }(),
127
151
  hasScanExecutionSource: () => typeof scanRef.current === "function",
@@ -2,8 +2,8 @@ const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
2
2
  const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
3
3
  const require_useEngineContext = require("../../../../hooks/useEngineContext.js");
4
4
  const require_locales = require("../../../HDLKiosk/locales.js");
5
- const require_index = require("../../../HDLKiosk/index.js");
6
5
  const require_config = require("../../../HDLKiosk/app/contracts/config.js");
6
+ const require_index = require("../../../HDLKiosk/index.js");
7
7
  const require_transactionState = require("./utils/transactionState.js");
8
8
  const require_useBigSaleHDLKioskAdapter = require("./hooks/useBigSaleHDLKioskAdapter.js");
9
9
  const require_useHDLKioskEntryPreparationToast = require("./hooks/useHDLKioskEntryPreparationToast.js");
@@ -113,7 +113,7 @@ function normalizePayment(context, cartLineCount, amountDue) {
113
113
  return Object.freeze({ status: "idle" });
114
114
  }
115
115
  function projectBigSaleTransactionState(context, observationId = 0) {
116
- var _context$cart$display, _liveOrder$currency_c, _liveOrder$currency_s, _context$customer$sel, _context$sales$tempOr, _context$sales$tempOr2, _customer$customerId, _summary$product_quan;
116
+ var _context$cart$display, _liveOrder$currency_c, _liveOrder$currency_s, _context$sales$bookin3, _context$sales$tempOr, _context$sales$tempOr2, _customer$id, _summary$product_quan;
117
117
  const rawLines = (_context$cart$display = context.cart.displayLines) !== null && _context$cart$display !== void 0 ? _context$cart$display : context.cart.items;
118
118
  const lines = Object.freeze(rawLines.map(projectBigSaleCartLine).filter((line) => line !== null));
119
119
  const summary = context.summary.summary;
@@ -126,19 +126,12 @@ function projectBigSaleTransactionState(context, observationId = 0) {
126
126
  total: String(summary.total_amount),
127
127
  due: amountDue.toFixed(2)
128
128
  }) : context.sales.status === "loading" ? Object.freeze({ status: "calculating" }) : Object.freeze({ status: "missing" });
129
- const customer = context.customer.selected ? Object.freeze({
130
- customerId: String(context.customer.selected.id),
131
- member: ![
132
- "0",
133
- "1",
134
- ""
135
- ].includes(String((_context$customer$sel = context.customer.selected.id) !== null && _context$customer$sel !== void 0 ? _context$customer$sel : ""))
136
- }) : void 0;
129
+ const customer = typeof ((_context$sales$bookin3 = context.sales.bookingTicket) === null || _context$sales$bookin3 === void 0 ? void 0 : _context$sales$bookin3.getOrderCustomerSnapshot) === "function" ? context.sales.bookingTicket.getOrderCustomerSnapshot() : context.customer.selected;
137
130
  const fingerprintValue = [
138
131
  (_context$sales$tempOr = (_context$sales$tempOr2 = context.sales.tempOrder) === null || _context$sales$tempOr2 === void 0 ? void 0 : _context$sales$tempOr2.order_id) !== null && _context$sales$tempOr !== void 0 ? _context$sales$tempOr : "",
139
132
  ...lines.map((line) => `${line.lineId}:${line.quantity}`),
140
133
  normalizedSummary.status === "ready" ? normalizedSummary.due : "",
141
- (_customer$customerId = customer === null || customer === void 0 ? void 0 : customer.customerId) !== null && _customer$customerId !== void 0 ? _customer$customerId : ""
134
+ (_customer$id = customer === null || customer === void 0 ? void 0 : customer.id) !== null && _customer$id !== void 0 ? _customer$id : ""
142
135
  ].join("|");
143
136
  return Object.freeze({
144
137
  observationId,
@@ -163,9 +156,16 @@ function createBigSaleTransactionStateReader(getContext) {
163
156
  let previousKey = "";
164
157
  let previousSnapshot = projectBigSaleTransactionState(getContext(), observationId);
165
158
  return () => {
159
+ var _candidate$customer$i, _candidate$customer;
166
160
  const candidate = projectBigSaleTransactionState(getContext(), observationId + 1);
167
- const semanticKey = JSON.stringify(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, candidate), {}, { observationId: 0 }));
168
- if (semanticKey === previousKey) return previousSnapshot;
161
+ const semanticKey = JSON.stringify(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, candidate), {}, {
162
+ observationId: 0,
163
+ customer: String((_candidate$customer$i = (_candidate$customer = candidate.customer) === null || _candidate$customer === void 0 ? void 0 : _candidate$customer.id) !== null && _candidate$customer$i !== void 0 ? _candidate$customer$i : "")
164
+ }));
165
+ if (semanticKey === previousKey) {
166
+ if (candidate.customer !== previousSnapshot.customer) previousSnapshot = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, candidate), {}, { observationId }));
167
+ return previousSnapshot;
168
+ }
169
169
  observationId += 1;
170
170
  previousKey = semanticKey;
171
171
  previousSnapshot = Object.freeze(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, candidate), {}, { observationId }));
@@ -166,7 +166,7 @@ function runAfterNextPaint(task) {
166
166
  * - 新建态:按 OS persist 开关走 createNew 或 restore → initBookingContext
167
167
  * 须位于 SalesSdkSummaryProvider 内,以便 summaryProviderRef 已通过 useImperativeHandle 注入。
168
168
  */
169
- function SalesSdkBootstrap({ autoRestoreOnInit, autoBootstrap, autoInitBookingContext, orderId, preloadedSalesDetail, initBookingContext, prepareModule, prepareCatalog, catalogKey, lifecycleOwner }) {
169
+ function SalesSdkBootstrap({ bootstrapKey, onSettled, autoRestoreOnInit, autoBootstrap, autoInitBookingContext, orderId, preloadedSalesDetail, initBookingContext, prepareModule, prepareCatalog, catalogKey, lifecycleOwner }) {
170
170
  const sales = (0, react.useContext)(require_SalesSdkContext.SalesSdkContext);
171
171
  const cart = require_useSalesSdkCart.useSalesSdkCart();
172
172
  (0, react.useEffect)(() => {
@@ -205,6 +205,8 @@ function SalesSdkBootstrap({ autoRestoreOnInit, autoBootstrap, autoInitBookingCo
205
205
  yield initBookingContext(bookingIds.length ? bookingIds : void 0, { loadResources: !(autoBootstrap && orderId) });
206
206
  } catch (e) {
207
207
  if (!cancelled) console.warn("[SalesSdk] bootstrap 失败", e);
208
+ } finally {
209
+ if (!cancelled) onSettled(bootstrapKey);
208
210
  }
209
211
  });
210
212
  return function runBootstrap() {
@@ -218,6 +220,8 @@ function SalesSdkBootstrap({ autoRestoreOnInit, autoBootstrap, autoInitBookingCo
218
220
  cancelBootstrapStart === null || cancelBootstrapStart === void 0 || cancelBootstrapStart();
219
221
  };
220
222
  }, [
223
+ bootstrapKey,
224
+ onSettled,
221
225
  sales === null || sales === void 0 ? void 0 : sales.bookingTicket,
222
226
  sales === null || sales === void 0 ? void 0 : sales.osKey,
223
227
  sales === null || sales === void 0 ? void 0 : sales.createNew,
@@ -386,6 +390,18 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
386
390
  moduleOtherParams.channel,
387
391
  productLoadChannel
388
392
  ]);
393
+ const bootstrapKey = (0, react.useMemo)(() => Symbol("sales-sdk-bootstrap"), [
394
+ bookingTicket,
395
+ osKey,
396
+ catalogKey,
397
+ lifecycleOwner,
398
+ autoBootstrap,
399
+ autoRestoreOnInit,
400
+ autoInitBookingContext,
401
+ orderId,
402
+ preloadedSalesDetail
403
+ ]);
404
+ const [settledBootstrapKey, setSettledBootstrapKey] = (0, react.useState)(null);
389
405
  const moduleParamsSyncRef = (0, react.useRef)(null);
390
406
  const syncModuleOtherParams = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
391
407
  var _moduleParamsSyncRef$;
@@ -486,6 +502,7 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
486
502
  });
487
503
  const { publishTempOrder } = require_useSalesSdkTempOrderSync.useSalesSdkTempOrderSync({
488
504
  enabled: enableTempOrderSync,
505
+ ready: !(lifecycleOwner === "provider" && (autoRestoreOnInit || Boolean(autoBootstrap && orderId)) && settledBootstrapKey !== bootstrapKey),
489
506
  isActive,
490
507
  osKey: (osKey === null || osKey === void 0 || (_osKey$replace = osKey.replace) === null || _osKey$replace === void 0 ? void 0 : _osKey$replace.call(osKey, "bookingTicket-", "")) || osKey,
491
508
  bookingTicket,
@@ -1512,6 +1529,8 @@ const SalesSdkProvider = ({ osKey, enableMultiCurrencySettlement = false, soluti
1512
1529
  onPromotionScanComplete: handlePromotionScanComplete,
1513
1530
  promotionScanSuccessMessageKey: promotionItemIncreaseMessageKey ? void 0 : promotionScanSuccessMessageKey
1514
1531
  }), /* @__PURE__ */ react.default.createElement(SalesSdkBootstrap, {
1532
+ bootstrapKey,
1533
+ onSettled: setSettledBootstrapKey,
1515
1534
  autoRestoreOnInit,
1516
1535
  autoBootstrap,
1517
1536
  autoInitBookingContext,
@@ -48,7 +48,7 @@ function isWalletSnapshotAlignedWithCurrentOrder(bookingTicket, snapshot) {
48
48
  * 两端都可发布本地变更、接收同 osKey 快照;页面激活时向更早激活的对端补拉。
49
49
  * 远端快照应用期间禁止再次发布,避免 replaceTempOrder 触发 refresh 后形成回环。
50
50
  */
51
- function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTicket, refreshRootSnapshot }) {
51
+ function useSalesSdkTempOrderSync({ enabled, ready = true, isActive = true, osKey, bookingTicket, refreshRootSnapshot }) {
52
52
  var _context$appHelper, _context$appHelper$ge, _app$getPlugin, _unifiedCommunication;
53
53
  const context = require_useEngineContext.default();
54
54
  const app = context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$ge = _context$appHelper.getApp) === null || _context$appHelper$ge === void 0 ? void 0 : _context$appHelper$ge.call(_context$appHelper);
@@ -61,17 +61,24 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
61
61
  const sourceIdRef = (0, react.useRef)(createSourceId());
62
62
  const revisionRef = (0, react.useRef)(0);
63
63
  const activeSinceRef = (0, react.useRef)(0);
64
+ const pendingActiveSinceRef = (0, react.useRef)(null);
64
65
  const isActiveRef = (0, react.useRef)(isActive);
66
+ const readyRef = (0, react.useRef)(ready);
65
67
  const remoteApplyingRef = (0, react.useRef)(false);
66
68
  const activationKeyRef = (0, react.useRef)(null);
67
69
  const activationEpochRef = (0, react.useRef)(0);
68
70
  const pendingRequestIdsRef = (0, react.useRef)(/* @__PURE__ */ new Set());
71
+ const deferredRequestsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
72
+ const deferredPayloadsRef = (0, react.useRef)(/* @__PURE__ */ new Map());
73
+ const needsBootstrapRecoveryRef = (0, react.useRef)(!ready);
74
+ const bootstrapRecoveryRequestRef = (0, react.useRef)(null);
69
75
  const lastRevisionBySourceRef = (0, react.useRef)(/* @__PURE__ */ new Map());
70
76
  const lastTimestampBySourceRef = (0, react.useRef)(/* @__PURE__ */ new Map());
71
77
  const latestOfferedRevisionBySourceRef = (0, react.useRef)(/* @__PURE__ */ new Map());
72
78
  const applyQueueRef = (0, react.useRef)(Promise.resolve());
73
79
  const lastAppliedRemoteOriginRef = (0, react.useRef)(null);
74
80
  isActiveRef.current = isActive;
81
+ readyRef.current = ready;
75
82
  const getPeerTarget = (0, ahooks.useMemoizedFn)((role) => require_tempOrderSync.resolveTempOrderSyncPeerTarget(role, endpoints));
76
83
  /** 在触发发布时一次性深拷贝订单与折扣上下文,避免防抖期间 OS 原地修改造成版本错配。 */
77
84
  const captureRuntimeSnapshot = (0, ahooks.useMemoizedFn)((tempOrder, causalOrigin) => {
@@ -101,7 +108,7 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
101
108
  });
102
109
  const sendTempOrderSnapshot = (0, ahooks.useMemoizedFn)(function() {
103
110
  var _ref = require_asyncToGenerator._asyncToGenerator(function* (snapshot, options = {}) {
104
- if (!enabled || !screenRole || !isActiveRef.current) return;
111
+ if (!enabled || !ready || !screenRole || !isActiveRef.current) return;
105
112
  if (remoteApplyingRef.current && !options.responseToRequestId) return;
106
113
  if (options.incrementRevision !== false) revisionRef.current += 1;
107
114
  try {
@@ -152,15 +159,23 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
152
159
  });
153
160
  const publishTempOrder = (0, ahooks.useMemoizedFn)((tempOrder, options = {}) => {
154
161
  var _lastAppliedRemoteOri;
155
- if (!enabled || !screenRole || !isActiveRef.current || remoteApplyingRef.current) return;
162
+ if (!enabled || !ready || !screenRole || !isActiveRef.current || remoteApplyingRef.current) return;
156
163
  const causalOrigin = options.preserveRemoteOrigin ? (_lastAppliedRemoteOri = lastAppliedRemoteOriginRef.current) !== null && _lastAppliedRemoteOri !== void 0 ? _lastAppliedRemoteOri : void 0 : void 0;
157
- if (!options.preserveRemoteOrigin) lastAppliedRemoteOriginRef.current = null;
164
+ if (!options.preserveRemoteOrigin) {
165
+ lastAppliedRemoteOriginRef.current = null;
166
+ needsBootstrapRecoveryRef.current = false;
167
+ bootstrapRecoveryRequestRef.current = null;
168
+ }
158
169
  debouncedPublish(captureRuntimeSnapshot(tempOrder, causalOrigin));
159
170
  });
160
171
  const requestPeerSnapshot = (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
161
- if (!enabled || !screenRole || !bookingTicket || !isActiveRef.current) return;
172
+ if (!enabled || !ready || !screenRole || !bookingTicket || !isActiveRef.current) return;
162
173
  const requestId = createRequestId();
163
174
  pendingRequestIdsRef.current.add(requestId);
175
+ if (needsBootstrapRecoveryRef.current) bootstrapRecoveryRequestRef.current = {
176
+ requestId,
177
+ localRevision: revisionRef.current
178
+ };
164
179
  try {
165
180
  var _unifiedCommunication4, _unifiedCommunication5;
166
181
  yield unifiedCommunication === null || unifiedCommunication === void 0 || (_unifiedCommunication4 = unifiedCommunication.sdk) === null || _unifiedCommunication4 === void 0 || (_unifiedCommunication5 = _unifiedCommunication4.publishData) === null || _unifiedCommunication5 === void 0 ? void 0 : _unifiedCommunication5.call(_unifiedCommunication4, {
@@ -181,19 +196,24 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
181
196
  console.warn("[SalesSdk] 请求对端 tempOrder 快照失败", error);
182
197
  }
183
198
  }));
199
+ const isBootstrapRecoveryResponse = (0, ahooks.useMemoizedFn)((payload) => {
200
+ const recovery = bootstrapRecoveryRequestRef.current;
201
+ return Boolean(recovery && payload.responseToRequestId === recovery.requestId && pendingRequestIdsRef.current.has(recovery.requestId) && revisionRef.current === recovery.localRevision);
202
+ });
184
203
  const shouldAcceptPayload = (0, ahooks.useMemoizedFn)((payload) => {
185
204
  var _lastTimestampBySourc;
186
205
  const sourceKey = getPayloadSourceKey(payload);
187
206
  const revision = getPayloadRevision(payload);
188
207
  if (revision !== null) {
189
208
  var _lastRevisionBySource, _latestOfferedRevisio;
190
- if (revision <= ((_lastRevisionBySource = lastRevisionBySourceRef.current.get(sourceKey)) !== null && _lastRevisionBySource !== void 0 ? _lastRevisionBySource : -1)) return false;
209
+ const lastRevision = (_lastRevisionBySource = lastRevisionBySourceRef.current.get(sourceKey)) !== null && _lastRevisionBySource !== void 0 ? _lastRevisionBySource : -1;
210
+ if (revision < lastRevision || revision === lastRevision && !isBootstrapRecoveryResponse(payload)) return false;
191
211
  if (revision < ((_latestOfferedRevisio = latestOfferedRevisionBySourceRef.current.get(sourceKey)) !== null && _latestOfferedRevisio !== void 0 ? _latestOfferedRevisio : -1)) return false;
192
212
  latestOfferedRevisionBySourceRef.current.set(sourceKey, revision);
193
213
  return true;
194
214
  }
195
215
  const lastTimestamp = (_lastTimestampBySourc = lastTimestampBySourceRef.current.get(sourceKey)) !== null && _lastTimestampBySourc !== void 0 ? _lastTimestampBySourc : 0;
196
- return payload.timestamp > lastTimestamp;
216
+ return payload.timestamp > lastTimestamp || payload.timestamp === lastTimestamp && isBootstrapRecoveryResponse(payload);
197
217
  });
198
218
  const applyPayload = (0, ahooks.useMemoizedFn)((payload) => {
199
219
  const requestId = payload.responseToRequestId;
@@ -203,13 +223,16 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
203
223
  }
204
224
  const activationEpoch = activationEpochRef.current;
205
225
  applyQueueRef.current = applyQueueRef.current.then(require_asyncToGenerator._asyncToGenerator(function* () {
206
- if (!isActiveRef.current || activationEpochRef.current !== activationEpoch || activationKeyRef.current !== `${screenRole}:${payload.osKey}`) return;
226
+ const isCurrentActivation = () => readyRef.current && isActiveRef.current && activationEpochRef.current === activationEpoch && activationKeyRef.current === `${screenRole}:${payload.osKey}`;
227
+ if (!isCurrentActivation()) return;
207
228
  const sourceKey = getPayloadSourceKey(payload);
208
229
  const revision = getPayloadRevision(payload);
209
230
  const isRequestedResponse = Boolean(requestId && pendingRequestIdsRef.current.has(requestId));
231
+ const isRecoveryResponse = isBootstrapRecoveryResponse(payload);
210
232
  if (revision !== null) {
211
233
  var _lastRevisionBySource2, _latestOfferedRevisio2;
212
- if (revision <= ((_lastRevisionBySource2 = lastRevisionBySourceRef.current.get(sourceKey)) !== null && _lastRevisionBySource2 !== void 0 ? _lastRevisionBySource2 : -1)) {
234
+ const lastApplied = (_lastRevisionBySource2 = lastRevisionBySourceRef.current.get(sourceKey)) !== null && _lastRevisionBySource2 !== void 0 ? _lastRevisionBySource2 : -1;
235
+ if (revision < lastApplied || revision === lastApplied && !isRecoveryResponse) {
213
236
  if (requestId) pendingRequestIdsRef.current.delete(requestId);
214
237
  return;
215
238
  }
@@ -220,12 +243,12 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
220
243
  } else {
221
244
  var _lastTimestampBySourc2;
222
245
  const lastAppliedTimestamp = (_lastTimestampBySourc2 = lastTimestampBySourceRef.current.get(sourceKey)) !== null && _lastTimestampBySourc2 !== void 0 ? _lastTimestampBySourc2 : 0;
223
- if (payload.timestamp <= lastAppliedTimestamp) {
246
+ if (payload.timestamp < lastAppliedTimestamp || payload.timestamp === lastAppliedTimestamp && !isRecoveryResponse) {
224
247
  if (requestId) pendingRequestIdsRef.current.delete(requestId);
225
248
  return;
226
249
  }
227
250
  }
228
- if (payload.originSourceId === sourceIdRef.current && Number.isSafeInteger(payload.originRevision) && payload.originRevision <= revisionRef.current) {
251
+ if (payload.originSourceId === sourceIdRef.current && Number.isSafeInteger(payload.originRevision) && payload.originRevision <= revisionRef.current && !isRecoveryResponse) {
229
252
  lastAppliedRemoteOriginRef.current = null;
230
253
  if (requestId) pendingRequestIdsRef.current.delete(requestId);
231
254
  if (revision !== null) lastRevisionBySourceRef.current.set(sourceKey, revision);
@@ -244,6 +267,7 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
244
267
  try {
245
268
  var _bookingTicket$getWal;
246
269
  if (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.replaceDiscountStoreLists) yield bookingTicket.replaceDiscountStoreLists(resolvePayloadDiscountState(payload));
270
+ if (!isCurrentActivation()) return;
247
271
  if (payload.tempOrder) {
248
272
  if (!(bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.replaceTempOrder)) {
249
273
  console.warn("[SalesSdk] 当前 BookingTicket 不支持 replaceTempOrder,已跳过双屏同步");
@@ -254,12 +278,17 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
254
278
  var _bookingTicket$restor;
255
279
  yield bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$restor = bookingTicket.restoreOrder) === null || _bookingTicket$restor === void 0 ? void 0 : _bookingTicket$restor.call(bookingTicket);
256
280
  }
281
+ if (!isCurrentActivation()) return;
257
282
  if (payload.walletAssetsSnapshot && (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.importWalletAssetsSnapshot)) yield bookingTicket.importWalletAssetsSnapshot((0, lodash.cloneDeep)(payload.walletAssetsSnapshot));
283
+ if (!isCurrentActivation()) return;
258
284
  const importedWalletSnapshotIsAligned = payload.walletAssetsSnapshot ? isWalletSnapshotAlignedWithCurrentOrder(bookingTicket, payload.walletAssetsSnapshot) : false;
259
285
  const currentWalletState = bookingTicket === null || bookingTicket === void 0 || (_bookingTicket$getWal = bookingTicket.getWalletAssetsState) === null || _bookingTicket$getWal === void 0 ? void 0 : _bookingTicket$getWal.call(bookingTicket);
260
286
  const hasWalletRuntimeState = Boolean(currentWalletState && (currentWalletState.items.length > 0 || currentWalletState.selectedIds.length > 0 || currentWalletState.committedIds.length > 0));
261
287
  if (payload.tempOrder && (bookingTicket === null || bookingTicket === void 0 ? void 0 : bookingTicket.refreshWalletAssets) && hasWalletRuntimeState && !importedWalletSnapshotIsAligned) yield bookingTicket.refreshWalletAssets({ preserveSelection: true });
288
+ if (!isCurrentActivation()) return;
262
289
  refreshRootSnapshot();
290
+ needsBootstrapRecoveryRef.current = false;
291
+ bootstrapRecoveryRequestRef.current = null;
263
292
  if (isRequestedResponse) pendingRequestIdsRef.current.delete(requestId);
264
293
  if (revision !== null) lastRevisionBySourceRef.current.set(sourceKey, revision);
265
294
  else lastTimestampBySourceRef.current.set(sourceKey, payload.timestamp);
@@ -273,6 +302,32 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
273
302
  console.warn("[SalesSdk] tempOrder 同步队列失败", error);
274
303
  });
275
304
  });
305
+ const respondToSnapshotRequest = (0, ahooks.useMemoizedFn)((request) => {
306
+ if (!enabled || !screenRole || !bookingTicket || !isActiveRef.current) return;
307
+ if (request.sourceId === sourceIdRef.current) return;
308
+ if (request.osKey !== void 0 && request.osKey !== osKey) return;
309
+ if (!ready || activationKeyRef.current !== `${screenRole}:${osKey}`) {
310
+ deferredRequestsRef.current.set(request.requestId, request);
311
+ return;
312
+ }
313
+ if (!require_tempOrderSync.shouldRespondToTempOrderSyncRequest(request, {
314
+ ownRole: screenRole,
315
+ ownActiveSince: activeSinceRef.current
316
+ })) return;
317
+ const queue = applyQueueRef.current;
318
+ const activationEpoch = activationEpochRef.current;
319
+ queue.then(() => {
320
+ var _bookingTicket$getTem, _bookingTicket$getTem2, _lastAppliedRemoteOri2;
321
+ if (queue !== applyQueueRef.current || activationEpoch !== activationEpochRef.current || !readyRef.current || !isActiveRef.current) {
322
+ respondToSnapshotRequest(request);
323
+ return;
324
+ }
325
+ sendTempOrderSnapshot(captureRuntimeSnapshot((_bookingTicket$getTem = (_bookingTicket$getTem2 = bookingTicket.getTempOrder) === null || _bookingTicket$getTem2 === void 0 ? void 0 : _bookingTicket$getTem2.call(bookingTicket)) !== null && _bookingTicket$getTem !== void 0 ? _bookingTicket$getTem : null, (_lastAppliedRemoteOri2 = lastAppliedRemoteOriginRef.current) !== null && _lastAppliedRemoteOri2 !== void 0 ? _lastAppliedRemoteOri2 : void 0), {
326
+ incrementRevision: false,
327
+ responseToRequestId: request.requestId
328
+ });
329
+ });
330
+ });
276
331
  (0, react.useEffect)(() => {
277
332
  var _unifiedCommunication6, _unifiedCommunication7;
278
333
  if (!enabled || !screenRole || !bookingTicket) return;
@@ -280,17 +335,7 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
280
335
  if (!isActiveRef.current) return;
281
336
  const request = require_tempOrderSync.getTempOrderSyncRequestPayload(event);
282
337
  if (request) {
283
- var _bookingTicket$getTem, _bookingTicket$getTem2;
284
- if (request.sourceId === sourceIdRef.current) return;
285
- if (request.osKey !== void 0 && request.osKey !== osKey) return;
286
- if (!require_tempOrderSync.shouldRespondToTempOrderSyncRequest(request, {
287
- ownRole: screenRole,
288
- ownActiveSince: activeSinceRef.current
289
- })) return;
290
- sendTempOrderSnapshot(captureRuntimeSnapshot((_bookingTicket$getTem = (_bookingTicket$getTem2 = bookingTicket.getTempOrder) === null || _bookingTicket$getTem2 === void 0 ? void 0 : _bookingTicket$getTem2.call(bookingTicket)) !== null && _bookingTicket$getTem !== void 0 ? _bookingTicket$getTem : null), {
291
- incrementRevision: false,
292
- responseToRequestId: request.requestId
293
- });
338
+ respondToSnapshotRequest(request);
294
339
  return;
295
340
  }
296
341
  const payload = require_tempOrderSync.getTempOrderSyncPayload(event);
@@ -299,6 +344,17 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
299
344
  if (payload.sourceId === sourceIdRef.current) return;
300
345
  if (payload.isActive === false) return;
301
346
  if (payload.sourceRole === screenRole) return;
347
+ if (!readyRef.current) {
348
+ if (payload.responseToRequestId) return;
349
+ const sourceKey = getPayloadSourceKey(payload);
350
+ const previous = deferredPayloadsRef.current.get(sourceKey);
351
+ const revision = getPayloadRevision(payload);
352
+ const previousRevision = previous ? getPayloadRevision(previous) : null;
353
+ if (previous && (revision !== null && previousRevision !== null ? revision < previousRevision || revision === previousRevision && payload.timestamp <= previous.timestamp : payload.timestamp <= previous.timestamp)) return;
354
+ deferredPayloadsRef.current.delete(sourceKey);
355
+ deferredPayloadsRef.current.set(sourceKey, payload);
356
+ return;
357
+ }
302
358
  applyPayload(payload);
303
359
  };
304
360
  const listenerHandle = unifiedCommunication === null || unifiedCommunication === void 0 || (_unifiedCommunication6 = unifiedCommunication.sdk) === null || _unifiedCommunication6 === void 0 || (_unifiedCommunication7 = _unifiedCommunication6.onMessage) === null || _unifiedCommunication7 === void 0 ? void 0 : _unifiedCommunication7.call(_unifiedCommunication6, handleMessage);
@@ -318,17 +374,30 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
318
374
  bookingTicket,
319
375
  osKey,
320
376
  applyPayload,
321
- captureRuntimeSnapshot,
322
- sendTempOrderSnapshot,
377
+ respondToSnapshotRequest,
323
378
  unifiedCommunication
324
379
  ]);
325
380
  (0, react.useEffect)(() => {
326
- if (!enabled || !screenRole || !bookingTicket || !isActive) {
381
+ var _pendingActiveSinceRe2;
382
+ if (!ready) {
383
+ needsBootstrapRecoveryRef.current = true;
384
+ lastAppliedRemoteOriginRef.current = null;
385
+ }
386
+ if (!enabled || !screenRole || !bookingTicket || !isActive || !ready) {
327
387
  if (activationKeyRef.current !== null) {
328
388
  activationEpochRef.current += 1;
329
389
  activationKeyRef.current = null;
330
390
  }
331
391
  pendingRequestIdsRef.current.clear();
392
+ bootstrapRecoveryRequestRef.current = null;
393
+ if (!enabled || !screenRole || !bookingTicket || !isActive) {
394
+ deferredRequestsRef.current.clear();
395
+ deferredPayloadsRef.current.clear();
396
+ pendingActiveSinceRef.current = null;
397
+ } else {
398
+ var _pendingActiveSinceRe;
399
+ (_pendingActiveSinceRe = pendingActiveSinceRef.current) !== null && _pendingActiveSinceRe !== void 0 || (pendingActiveSinceRef.current = Date.now());
400
+ }
332
401
  cancelDebouncedPublish();
333
402
  return;
334
403
  }
@@ -337,21 +406,42 @@ function useSalesSdkTempOrderSync({ enabled, isActive = true, osKey, bookingTick
337
406
  activationEpochRef.current += 1;
338
407
  pendingRequestIdsRef.current.clear();
339
408
  activationKeyRef.current = activationKey;
340
- activeSinceRef.current = Date.now();
341
- requestPeerSnapshot();
409
+ activeSinceRef.current = (_pendingActiveSinceRe2 = pendingActiveSinceRef.current) !== null && _pendingActiveSinceRe2 !== void 0 ? _pendingActiveSinceRe2 : Date.now();
410
+ pendingActiveSinceRef.current = null;
411
+ const activationEpoch = activationEpochRef.current;
412
+ const resumeSync = () => {
413
+ if (!readyRef.current || !isActiveRef.current || activationEpochRef.current !== activationEpoch) return;
414
+ requestPeerSnapshot();
415
+ const deferredRequests = [...deferredRequestsRef.current.values()];
416
+ deferredRequestsRef.current.clear();
417
+ deferredRequests.forEach(respondToSnapshotRequest);
418
+ };
419
+ const deferredPayloads = [...deferredPayloadsRef.current.values()];
420
+ deferredPayloadsRef.current.clear();
421
+ if (deferredPayloads.length) {
422
+ deferredPayloads.forEach(applyPayload);
423
+ applyQueueRef.current.then(resumeSync);
424
+ } else resumeSync();
342
425
  }, [
343
426
  enabled,
427
+ ready,
344
428
  screenRole,
345
429
  bookingTicket,
346
430
  isActive,
347
431
  osKey,
348
432
  requestPeerSnapshot,
433
+ respondToSnapshotRequest,
434
+ applyPayload,
349
435
  cancelDebouncedPublish
350
436
  ]);
351
437
  (0, react.useEffect)(() => () => {
352
438
  activationEpochRef.current += 1;
353
439
  activationKeyRef.current = null;
354
440
  pendingRequestIdsRef.current.clear();
441
+ bootstrapRecoveryRequestRef.current = null;
442
+ deferredRequestsRef.current.clear();
443
+ deferredPayloadsRef.current.clear();
444
+ pendingActiveSinceRef.current = null;
355
445
  cancelDebouncedPublish();
356
446
  }, [cancelDebouncedPublish]);
357
447
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.12.228",
3
+ "version": "6.12.230",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -70,8 +70,8 @@
70
70
  "styled-components": "^6.0.0-rc.3",
71
71
  "use-sync-external-store": "^1.6.0",
72
72
  "@pisell/pi-payment-sdk": "0.0.3",
73
- "@pisell/icon": "0.0.11",
74
73
  "@pisell/utils": "3.0.4",
74
+ "@pisell/icon": "0.0.11",
75
75
  "@pisell/materials": "6.12.61",
76
76
  "@pisell/date-picker": "3.0.10"
77
77
  },
@@ -1 +0,0 @@
1
- export { };