@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
@@ -139,15 +139,11 @@ function CatalogScreen({ products, currencySymbol, loading, errorReference, erro
139
139
  }, [errorReference]);
140
140
  const title = normalizedQuery ? locales.getText("pisell2.hdl-kiosk.catalog-search-results") : (activeCategory === null || activeCategory === void 0 ? void 0 : activeCategory.name) || locales.getText("pisell2.hdl-kiosk.catalog-title");
141
141
  const completeCatalog = useCallback(() => {
142
- if (!busy && canReview) send({
142
+ if (!busy) send({
143
143
  kind: "resolution",
144
144
  resolution: "complete"
145
145
  });
146
- }, [
147
- busy,
148
- canReview,
149
- send
150
- ]);
146
+ }, [busy, send]);
151
147
  const primaryActionLabel = locales.getText("pisell2.hdl-kiosk.cart-drawer-next");
152
148
  const { openCart } = useHDLKioskBottomBarController();
153
149
  useHDLKioskBottomBar(useMemo(() => {
@@ -176,7 +172,7 @@ function CatalogScreen({ products, currencySymbol, loading, errorReference, erro
176
172
  trailing: /* @__PURE__ */ React.createElement("button", {
177
173
  type: "button",
178
174
  className: "hdl-floating-bar__button hdl-catalog-next",
179
- disabled: busy || !canReview,
175
+ disabled: busy,
180
176
  onClick: completeCatalog
181
177
  }, /* @__PURE__ */ React.createElement("span", null, primaryActionLabel), /* @__PURE__ */ React.createElement(NextIcon, null)),
182
178
  cartOpenBar: (controller) => ({
@@ -190,7 +186,7 @@ function CatalogScreen({ products, currencySymbol, loading, errorReference, erro
190
186
  trailing: /* @__PURE__ */ React.createElement("button", {
191
187
  type: "button",
192
188
  className: "hdl-floating-bar__button hdl-catalog-next",
193
- disabled: busy || !canReview,
189
+ disabled: busy,
194
190
  onClick: () => {
195
191
  controller.onClose();
196
192
  completeCatalog();
@@ -1,4 +1,4 @@
1
- import { defineSlice, require } from "../../kernel/application/defineSlice.js";
1
+ import { accept, defineSlice } from "../../kernel/application/defineSlice.js";
2
2
  import { cartAddProductOperation, cartRemoveLineOperation, cartUpdateQuantityOperation } from "../../app/operations.js";
3
3
  //#region src/components/HDLKiosk/slices/catalog/slice.ts
4
4
  /** Catalog Slice:声明补充商品加购;商品浏览动作不进入 Workflow。 */
@@ -10,7 +10,7 @@ const catalogSlice = defineSlice({
10
10
  updateQuantity: cartUpdateQuantityOperation,
11
11
  removeLine: cartRemoveLineOperation
12
12
  },
13
- resolutions: { complete: require("cart.notEmpty") }
13
+ resolutions: { complete: accept() }
14
14
  });
15
15
  //#endregion
16
16
  export { catalogSlice };
@@ -165,7 +165,7 @@ function ProductFallback() {
165
165
  })));
166
166
  }
167
167
  function CustomizationScreen({ product, loading, errorReference, errorMessage, busy, syncing, canGoBack, minimumWeightKg, orderBar, send }) {
168
- var _productFacts$product, _orderBar$primaryLine, _orderBar$primaryLine2, _orderBar$primaryLine3, _orderBar$primaryLine4, _orderBar$primaryLine7, _productFacts$unitPri, _orderBar$primaryLine9, _orderBar$primaryLine11;
168
+ var _productFacts$product, _orderBar$primaryLine, _orderBar$primaryLine2, _orderBar$primaryLine3, _orderBar$primaryLine4, _orderBar$primaryLine7, _productFacts$unitPri, _orderBar$primaryLine9;
169
169
  const Toast = useToast();
170
170
  const scaleRuntime = useHDLScaleRuntime();
171
171
  const scale = useHDLScaleSnapshot();
@@ -258,14 +258,21 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
258
258
  syncing,
259
259
  Toast
260
260
  ]);
261
- const omitPrimaryProduct = useCallback(() => {
262
- var _orderBar$primaryLine10;
261
+ const skipCustomization = useCallback(() => {
262
+ if (busy || syncing) return;
263
263
  send({
264
264
  kind: "resolution",
265
265
  resolution: "omit",
266
- operationInput: { lineId: (_orderBar$primaryLine10 = orderBar.primaryLine) === null || _orderBar$primaryLine10 === void 0 ? void 0 : _orderBar$primaryLine10.lineId }
266
+ operationInput: {}
267
267
  });
268
- }, [(_orderBar$primaryLine11 = orderBar.primaryLine) === null || _orderBar$primaryLine11 === void 0 ? void 0 : _orderBar$primaryLine11.lineId, send]);
268
+ }, [
269
+ busy,
270
+ send,
271
+ syncing
272
+ ]);
273
+ const isWeighing = measurement.gross.greaterThan(0);
274
+ const advance = isWeighing ? submit : skipCustomization;
275
+ const advanceLabel = locales.getText(isWeighing ? "pisell2.hdl-kiosk.customization-next" : "pisell2.hdl-kiosk.skip");
269
276
  const { openCart } = useHDLKioskBottomBarController();
270
277
  useHDLKioskBottomBar(useMemo(() => {
271
278
  var _orderBar$cartItemCou;
@@ -292,9 +299,9 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
292
299
  trailing: /* @__PURE__ */ React.createElement("button", {
293
300
  type: "button",
294
301
  className: "hdl-floating-bar__button hdl-customization-next",
295
- disabled: busy || syncing || loading || !productFacts,
296
- onClick: submit
297
- }, /* @__PURE__ */ React.createElement("span", null, busy || syncing ? locales.getText("pisell2.hdl-kiosk.working") : locales.getText("pisell2.hdl-kiosk.customization-next")), /* @__PURE__ */ React.createElement(NextIcon, null)),
302
+ disabled: busy || syncing || isWeighing && (loading || !productFacts),
303
+ onClick: advance
304
+ }, /* @__PURE__ */ React.createElement("span", null, busy || syncing ? locales.getText("pisell2.hdl-kiosk.working") : advanceLabel), /* @__PURE__ */ React.createElement(NextIcon, null)),
298
305
  cartOpenBar: (controller) => ({
299
306
  ariaLabel: locales.getText("pisell2.hdl-kiosk.customization-actions-label"),
300
307
  leading: /* @__PURE__ */ React.createElement("button", {
@@ -306,12 +313,12 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
306
313
  trailing: /* @__PURE__ */ React.createElement("button", {
307
314
  type: "button",
308
315
  className: "hdl-floating-bar__button hdl-customization-next",
309
- disabled: busy || syncing || loading || !productFacts,
316
+ disabled: busy || syncing || isWeighing && (loading || !productFacts),
310
317
  onClick: () => {
311
318
  controller.onClose();
312
- submit();
319
+ advance();
313
320
  }
314
- }, /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.cart-drawer-next")), /* @__PURE__ */ React.createElement(NextIcon, null))
321
+ }, /* @__PURE__ */ React.createElement("span", null, busy || syncing ? locales.getText("pisell2.hdl-kiosk.working") : advanceLabel), /* @__PURE__ */ React.createElement(NextIcon, null))
315
322
  })
316
323
  };
317
324
  }, [
@@ -319,12 +326,14 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
319
326
  canGoBack,
320
327
  syncing,
321
328
  amountText,
329
+ advance,
330
+ advanceLabel,
331
+ isWeighing,
332
+ productFacts,
322
333
  loading,
323
334
  openCart,
324
335
  orderBar.cartLineCount,
325
- productFacts,
326
- send,
327
- submit
336
+ send
328
337
  ]));
329
338
  return /* @__PURE__ */ React.createElement("section", {
330
339
  className: "hdl-customization-screen",
@@ -347,12 +356,7 @@ function CustomizationScreen({ product, loading, errorReference, errorMessage, b
347
356
  }, loading ? locales.getText("pisell2.hdl-kiosk.weighted-product-loading") : locales.getText("pisell2.hdl-kiosk.customization-load-failed")), errorReference ? /* @__PURE__ */ React.createElement("div", {
348
357
  className: "hdl-inline-error",
349
358
  role: "alert"
350
- }, /* @__PURE__ */ React.createElement("strong", null, errorMessage || locales.getText("pisell2.hdl-kiosk.customization-load-failed")), /* @__PURE__ */ React.createElement("small", null, errorReference)) : null), /* @__PURE__ */ React.createElement("button", {
351
- type: "button",
352
- className: "hdl-customization-skip",
353
- disabled: busy || syncing,
354
- onClick: omitPrimaryProduct
355
- }, locales.getText("pisell2.hdl-kiosk.customization-skip")));
359
+ }, /* @__PURE__ */ React.createElement("strong", null, errorMessage || locales.getText("pisell2.hdl-kiosk.customization-load-failed")), /* @__PURE__ */ React.createElement("small", null, errorReference)) : null));
356
360
  }
357
361
  //#endregion
358
362
  export { CustomizationScreen };
@@ -233,24 +233,6 @@
233
233
  margin-top: 26px;
234
234
  }
235
235
 
236
- .hdl-customization-skip {
237
- position: absolute;
238
- bottom: max(166px, calc(env(safe-area-inset-bottom) + 151px));
239
- left: 46px;
240
- z-index: 9;
241
- min-height: 63px;
242
- margin: 0;
243
- border: 0;
244
- border-radius: 1079px;
245
- padding: 0 26px;
246
- background: linear-gradient(180deg, #d51b22, #a6090e);
247
- color: #fff;
248
- box-shadow: 0 15px 32px rgba(178, 13, 18, 0.3);
249
- font-size: 24px;
250
- font-weight: 900;
251
- cursor: pointer;
252
- }
253
-
254
236
  .hdl-customization-next {
255
237
  border: 0;
256
238
  background: linear-gradient(180deg, #20b8aa, #119184);
@@ -5,7 +5,7 @@ import { locales } from "@pisell/utils";
5
5
  //#region src/components/HDLKiosk/slices/identity/Screen/index.tsx
6
6
  const QR_CELLS = Object.freeze(Array.from({ length: 49 }, (_, index) => index * 8 % 5 < 2));
7
7
  /**
8
- * Quick Order 的前置会员提示页。
8
+ * 各 Workflow 共用的会员提示页。
9
9
  *
10
10
  * 宿主可注入认证 UI;未注入时保留 QR / SMS 视觉 fallback。Skip 继续产生
11
11
  * identity.omit Resolution,由本地 Exit Policy 同步访客后进入下一步。
@@ -24,6 +24,18 @@ function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
24
24
  ariaLabel: locales.getText("pisell2.hdl-kiosk.identity-actions-label"),
25
25
  cartEnabled: hasOrder && !busy,
26
26
  variant: "composed",
27
+ leading: /* @__PURE__ */ React.createElement("button", {
28
+ type: "button",
29
+ className: "hdl-floating-bar__button",
30
+ disabled: busy || !model.canGoBack,
31
+ onClick: () => send({
32
+ kind: "navigation",
33
+ direction: "back"
34
+ })
35
+ }, /* @__PURE__ */ React.createElement("svg", {
36
+ viewBox: "0 0 24 24",
37
+ "aria-hidden": "true"
38
+ }, /* @__PURE__ */ React.createElement("path", { d: "m15 5-7 7 7 7M8 12h10" })), /* @__PURE__ */ React.createElement("span", null, locales.getText("pisell2.hdl-kiosk.back"))),
27
39
  summary: orderBar ? /* @__PURE__ */ React.createElement(HDLKioskOrderSummary, {
28
40
  lineCount: (_orderBar$cartItemCou = orderBar.cartItemCount) !== null && _orderBar$cartItemCou !== void 0 ? _orderBar$cartItemCou : orderBar.cartLineCount,
29
41
  totalText: orderBar.totalText,
@@ -48,8 +60,10 @@ function IdentityScreen({ model, orderBar, send, renderIdentityAuth }) {
48
60
  }, [
49
61
  busy,
50
62
  hasOrder,
63
+ model.canGoBack,
51
64
  openCart,
52
- orderBar
65
+ orderBar,
66
+ send
53
67
  ]));
54
68
  const authContent = renderIdentityAuth === null || renderIdentityAuth === void 0 ? void 0 : renderIdentityAuth({
55
69
  busy,
@@ -1,3 +1,4 @@
1
+ import { isWalkInCustomer } from "../../../../plus/salesSdk/selectors.js";
1
2
  import { defineSlice, perform } from "../../kernel/application/defineSlice.js";
2
3
  import { identitySyncOperation } from "../../app/operations.js";
3
4
  //#region src/components/HDLKiosk/slices/identity/slice.ts
@@ -5,6 +6,7 @@ import { identitySyncOperation } from "../../app/operations.js";
5
6
  const identitySlice = defineSlice({
6
7
  id: "identity",
7
8
  surface: { id: "identity" },
9
+ redirect: ({ sales, identity }) => (identity === null || identity === void 0 ? void 0 : identity.scanEntry) || !isWalkInCustomer(sales === null || sales === void 0 ? void 0 : sales.customer) ? "$next" : void 0,
8
10
  resolutions: {
9
11
  complete: perform(identitySyncOperation),
10
12
  omit: perform(identitySyncOperation)
@@ -3,11 +3,14 @@ import { IdentityScreen } from "./Screen/index.js";
3
3
  import React from "react";
4
4
  //#region src/components/HDLKiosk/slices/identity/view.tsx
5
5
  /** Identity 展示装配:把统一 View Context 转为本 Slice Screen props;不决定流程目标。 */
6
- const renderIdentity = ({ node, viewSnapshot, sales, businessMode, renderIdentityAuth, send }) => /* @__PURE__ */ React.createElement(IdentityScreen, {
7
- model: createActivityScreenModel(node.surfaceId, viewSnapshot, node, sales, businessMode),
8
- orderBar: createOrderBarModel(sales),
9
- send,
10
- renderIdentityAuth
11
- });
6
+ const renderIdentity = ({ node, viewSnapshot, sales, businessMode, renderIdentityAuth, send }) => {
7
+ if (viewSnapshot.nodeId !== node.id) return null;
8
+ return /* @__PURE__ */ React.createElement(IdentityScreen, {
9
+ model: createActivityScreenModel(node.surfaceId, viewSnapshot, node, sales, businessMode),
10
+ orderBar: createOrderBarModel(sales),
11
+ send,
12
+ renderIdentityAuth
13
+ });
14
+ };
12
15
  //#endregion
13
16
  export { renderIdentity };
@@ -1,4 +1,4 @@
1
- import { defineSlice, require } from "../../kernel/application/defineSlice.js";
1
+ import { accept, defineSlice } from "../../kernel/application/defineSlice.js";
2
2
  //#region src/components/HDLKiosk/slices/primaryProductPrompt/slice.ts
3
3
  /** 主商品询问 Slice:只表达是否进入称重定制,不承担 Catalog 页面职责。 */
4
4
  const primaryProductPromptSlice = defineSlice({
@@ -6,8 +6,8 @@ const primaryProductPromptSlice = defineSlice({
6
6
  surface: { id: "primaryProductPrompt" },
7
7
  presentation: "modal",
8
8
  resolutions: {
9
- complete: require("cart.notEmpty"),
10
- omit: require("cart.notEmpty")
9
+ complete: accept(),
10
+ omit: accept()
11
11
  }
12
12
  });
13
13
  //#endregion
@@ -1,3 +1,4 @@
1
+ import { isWalkInCustomer } from "../../../plus/salesSdk/selectors.js";
1
2
  import { useHDLKioskCustomerController } from "./controllers/useHDLKioskCustomerController.js";
2
3
  import { useHDLKioskActionDispatcher } from "./controllers/useHDLKioskActionDispatcher.js";
3
4
  import { useHDLKioskExitController } from "./controllers/useHDLKioskExitController.js";
@@ -60,11 +61,28 @@ function HDLKioskWorkflowBlockingSurface({ snapshot, title, description, referen
60
61
  */
61
62
  function HDLKioskWorkflowView({ session, host, sales, config, isActive, exiting, exitError, pendingExit, renderIdentityAuth, renderCartContent, cartOverlayActions, sourceData, paymentResult, onCollaborationStatusChange, back, requestExit, resolveExit, completeOrder, recover }) {
62
63
  var _session$definition$n2, _sourceData$tempOrder3, _customer$error, _activeNode$presentat;
64
+ useEffect(() => {
65
+ session.markPresented();
66
+ }, [session]);
63
67
  const snapshot = useWorkflowSnapshot(session.actor);
64
68
  const navigationSequence = useRef(0);
65
69
  const [memberLoginOpen, setMemberLoginOpen] = useState(false);
66
70
  const [paymentOrderConflict, setPaymentOrderConflict] = useState(false);
67
71
  const activeNode = session.definition.nodes[snapshot.nodeId];
72
+ useEffect(() => {
73
+ if (!isActive || snapshot.status !== "idle" || activeNode.activity !== "identity" || isWalkInCustomer(sales.customer)) return;
74
+ session.actor.navigate({
75
+ kind: "step",
76
+ stepId: snapshot.nodeId
77
+ }, "identity:customer-updated");
78
+ }, [
79
+ isActive,
80
+ session,
81
+ snapshot.nodeId,
82
+ snapshot.status,
83
+ activeNode.activity,
84
+ sales.customer
85
+ ]);
68
86
  const customizationStepId = session.definition.stepOrder.find((stepId) => {
69
87
  var _session$definition$n;
70
88
  return ((_session$definition$n = session.definition.nodes[stepId]) === null || _session$definition$n === void 0 ? void 0 : _session$definition$n.activity) === "customization";
@@ -1,4 +1,5 @@
1
1
  import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
2
+ import { isWalkInCustomer } from "../../../../plus/salesSdk/selectors.js";
2
3
  import { getClientDisplayName, normalizeCustomer } from "../../../../plus/saleDetail/components/Client/utils.js";
3
4
  import { createOperationError } from "../../runtime/operations/errors.js";
4
5
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
@@ -43,17 +44,11 @@ function maskCustomerPhone(phone) {
43
44
  });
44
45
  }
45
46
  function useHDLKioskCustomerController({ session, snapshot, sales, activityId, isActive, loginAvailable, interactionBlocked, sourceCustomer }) {
46
- var _sourceCustomer$id, _sales$customer;
47
47
  const [busy, setBusy] = useState(false);
48
48
  const [error, setError] = useState();
49
49
  const attempt = useRef(0);
50
50
  const inFlight = useRef(false);
51
- const sourceCustomerId = String((_sourceCustomer$id = sourceCustomer === null || sourceCustomer === void 0 ? void 0 : sourceCustomer.id) !== null && _sourceCustomer$id !== void 0 ? _sourceCustomer$id : "");
52
- const member = sourceCustomer ? ![
53
- "0",
54
- "1",
55
- ""
56
- ].includes(sourceCustomerId) : ((_sales$customer = sales.customer) === null || _sales$customer === void 0 ? void 0 : _sales$customer.member) === true;
51
+ const member = !isWalkInCustomer(sourceCustomer !== null && sourceCustomer !== void 0 ? sourceCustomer : sales.customer);
57
52
  const customerName = member ? firstCustomerText(getClientDisplayName(normalizeCustomer(sourceCustomer))) : void 0;
58
53
  const phone = firstCustomerText(sourceCustomer === null || sourceCustomer === void 0 ? void 0 : sourceCustomer.phone);
59
54
  const memberName = phone && customerName === phone ? maskCustomerPhone(phone) : customerName;
@@ -1,5 +1,6 @@
1
1
  import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { resolveSkuValueCandidates } from "../../plus/skuOptionsSelection/utils/resolveSkuValue.js";
3
+ import { isWalkInCustomer } from "../../plus/salesSdk/selectors.js";
3
4
  import { canRequestBack } from "./kernel/workflow/selectors.js";
4
5
  import { formatAmount, locales } from "@pisell/utils";
5
6
  //#region src/components/HDLKiosk/utils.ts
@@ -165,19 +166,14 @@ function createOrderBarModel(sales) {
165
166
  });
166
167
  }
167
168
  function createCartDrawerModel(sales, primaryWeightedProductId, sourceData) {
168
- var _sourceData$customer$, _sourceData$customer, _sales$customer, _sourceData$customer2;
169
+ var _sourceData$customer;
169
170
  const currencySymbol = sales.summary.status === "ready" ? sales.summary.currencySymbol : void 0;
170
171
  const totalText = sales.summary.status === "ready" ? formatCurrencyAmount(sales.summary.due, currencySymbol) : void 0;
171
- const sourceCustomerId = String((_sourceData$customer$ = sourceData === null || sourceData === void 0 || (_sourceData$customer = sourceData.customer) === null || _sourceData$customer === void 0 ? void 0 : _sourceData$customer.id) !== null && _sourceData$customer$ !== void 0 ? _sourceData$customer$ : "");
172
- const sourceMember = (sourceData === null || sourceData === void 0 ? void 0 : sourceData.customer) ? ![
173
- "0",
174
- "1",
175
- ""
176
- ].includes(sourceCustomerId) : void 0;
172
+ const sourceMember = (sourceData === null || sourceData === void 0 ? void 0 : sourceData.customer) ? !isWalkInCustomer(sourceData.customer) : void 0;
177
173
  return Object.freeze({
178
174
  lineCount: sales.cart.lineCount,
179
- member: sourceMember !== null && sourceMember !== void 0 ? sourceMember : ((_sales$customer = sales.customer) === null || _sales$customer === void 0 ? void 0 : _sales$customer.member) === true,
180
- memberName: sourceMember && typeof (sourceData === null || sourceData === void 0 || (_sourceData$customer2 = sourceData.customer) === null || _sourceData$customer2 === void 0 ? void 0 : _sourceData$customer2.name) === "string" ? sourceData.customer.name : void 0,
175
+ member: sourceMember !== null && sourceMember !== void 0 ? sourceMember : !isWalkInCustomer(sales.customer),
176
+ memberName: sourceMember && typeof (sourceData === null || sourceData === void 0 || (_sourceData$customer = sourceData.customer) === null || _sourceData$customer === void 0 ? void 0 : _sourceData$customer.name) === "string" ? sourceData.customer.name : void 0,
181
177
  lines: Object.freeze(sales.cart.lines.map((line) => {
182
178
  const quantity = Number(line.quantity);
183
179
  return Object.freeze({
@@ -228,7 +224,6 @@ function createActivityScreenModel(surfaceId, snapshot, node, sales, businessMod
228
224
  description = locales.getText("pisell2.hdl-kiosk.checkout-title");
229
225
  break;
230
226
  }
231
- const canReviewCatalog = surfaceId !== "catalog" || sales.cart.lineCount > 0;
232
227
  const placeholder = node.readiness === "placeholder";
233
228
  const placeholderBlocked = placeholder && businessMode === "production";
234
229
  const error = resolveHDLKioskErrorPresentation({ error: snapshot.lastError });
@@ -238,7 +233,7 @@ function createActivityScreenModel(surfaceId, snapshot, node, sales, businessMod
238
233
  title,
239
234
  description,
240
235
  busy: snapshot.status === "running",
241
- canContinue: snapshot.status === "idle" && canReviewCatalog && !placeholderBlocked && Boolean(node.on.complete),
236
+ canContinue: snapshot.status === "idle" && !placeholderBlocked && Boolean(node.on.complete),
242
237
  canGoBack: canRequestBack(snapshot),
243
238
  placeholder,
244
239
  placeholderBlocked,
@@ -1,5 +1,6 @@
1
1
  import useEngineContext from "../../../../hooks/useEngineContext.js";
2
2
  import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
3
+ import "../../../../plus/salesSdk/index.js";
3
4
  import dayjs from "dayjs";
4
5
  import { useCallback, useEffect, useState } from "react";
5
6
  //#region src/components/bigSale/components/BookingFloatingPanel/useBookingPanelController.ts
@@ -4,6 +4,7 @@ import withResponsive from "../../../../responsive/withResponsive.js";
4
4
  import useInitLocalesOnce from "../../../../hooks/useInitLocalesOnce.js";
5
5
  import { subscribeBookingDateChange } from "../../../../plus/salesSdk/utils/bookingDate.js";
6
6
  import { useSalesSdkBookingContext } from "../../../../plus/salesSdk/context/SalesSdkBookingContext.js";
7
+ import "../../../../plus/salesSdk/index.js";
7
8
  import locales_default from "../../locales/index.js";
8
9
  import dayjs from "dayjs";
9
10
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -5,6 +5,7 @@ import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from ".
5
5
  import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
6
6
  import { useSalesSdkCart } from "../../plus/salesSdk/hooks/useSalesSdkCart.js";
7
7
  import { SalesSdkPrepareOrderSwitchContext, SalesSdkRootRefreshContext } from "../../plus/salesSdk/context/SalesSdkProvider.js";
8
+ import "../../plus/salesSdk/index.js";
8
9
  import { seedDineInReservationToCart } from "../../plus/pisellReservation/utils/seedDineInReservationToCart.js";
9
10
  import { isPersistedBigSaleOrderId } from "./utils/orderIdentity.js";
10
11
  import BigSale from "./index.js";
@@ -4,6 +4,7 @@ import { useSalesSdkCustomer } from "../../../plus/salesSdk/hooks/useSalesSdkCus
4
4
  import { useSalesSdkBookingContext } from "../../../plus/salesSdk/context/SalesSdkBookingContext.js";
5
5
  import { useSalesSdkSummary } from "../../../plus/salesSdk/hooks/useSalesSdkSummary.js";
6
6
  import { useSalesSdkProducts } from "../../../plus/salesSdk/hooks/useSalesSdkProducts.js";
7
+ import "../../../plus/salesSdk/index.js";
7
8
  import { useMemo } from "react";
8
9
  //#region src/components/bigSale/hooks/useBigSaleContext.ts
9
10
  /**
@@ -3,6 +3,7 @@ import useEngineContext from "../../../hooks/useEngineContext.js";
3
3
  import { buildInitBookingContextParams, collectBookingIdsFromTempOrder } from "../../../plus/salesSdk/utils/buildDefaultLoadProductsParams.js";
4
4
  import { useSalesSdkUIHosts } from "../../../plus/salesSdk/context/SalesSdkUIHostsContext.js";
5
5
  import { SalesSdkRootRefreshContext } from "../../../plus/salesSdk/context/SalesSdkProvider.js";
6
+ import "../../../plus/salesSdk/index.js";
6
7
  import { resolveOrderIdForHostActions } from "../../../plus/pisellReservation/components/bookingDetailModal/bookingDetailHostActions.js";
7
8
  import { usePicoCodingOpenData } from "../../../plus/pisellReservation/hooks/usePicoCodingOpenData.js";
8
9
  import { buildReplacementBookingResourcesFromReservationRow } from "../../../plus/pisellReservation/utils/reservationTicketBookingHostParams.js";
@@ -8,6 +8,7 @@ import { useSalesSdk } from "../../plus/salesSdk/hooks/useSalesSdk.js";
8
8
  import { useSalesSdkCustomer } from "../../plus/salesSdk/hooks/useSalesSdkCustomer.js";
9
9
  import { SalesSdkProvider } from "../../plus/salesSdk/context/SalesSdkProvider.js";
10
10
  import { SalesSdkBookingContextProvider } from "../../plus/salesSdk/context/SalesSdkBookingContext.js";
11
+ import "../../plus/salesSdk/index.js";
11
12
  import { ResponsiveBigSaleBase } from "./Base.js";
12
13
  import { isBigSaleProductSelectionFlowScene, resolveBigSaleSelectionFlowConfig } from "./selectionFlowConfig.js";
13
14
  import { isKioskPresentation } from "./templateCapabilities.js";
@@ -46,13 +46,14 @@ function resolveBigSaleHDLKioskCapabilities(context, options = {}) {
46
46
  customization: { weightedProduct: scaleAvailable && canUpdateCustomizedProduct }
47
47
  };
48
48
  }
49
- function createBigSaleHDLKioskHost({ getContext, executeScan, hasScanExecutionSource, devices, getWriteFulfillment, getAuthenticatedCustomer, getPaymentController, telemetry }) {
49
+ function createBigSaleHDLKioskHost({ getContext, executeScan, resolveScan, hasScanExecutionSource, devices, getWriteFulfillment, getAuthenticatedCustomer, getPaymentController, telemetry }) {
50
50
  const resolveScaleEventSource = () => (devices === null || devices === void 0 ? void 0 : devices.getSubscribeScaleEvents) ? devices.getSubscribeScaleEvents() : devices === null || devices === void 0 ? void 0 : devices.subscribeScaleEvents;
51
51
  return {
52
52
  sales: createBigSaleSalesPort({
53
53
  getContext,
54
54
  readTransactionState: createBigSaleTransactionStateReader(getContext),
55
55
  executeScan,
56
+ resolveScan,
56
57
  getWriteFulfillment,
57
58
  getAuthenticatedCustomer,
58
59
  getPaymentController
@@ -38,8 +38,12 @@ function projectConfirmedQuantityLine(products, line, quantity) {
38
38
  if (!confirmedLine || getMergedBookingSources(line).length === 0) return confirmedLine;
39
39
  return _objectSpread2(_objectSpread2({}, confirmedLine), {}, { quantity: String(quantity) });
40
40
  }
41
- function createBigSaleCartOperations({ getContext, readTransactionState, executeScan }) {
41
+ function createBigSaleCartOperations({ getContext, readTransactionState, executeScan, resolveScan }) {
42
42
  return {
43
+ resolveBarcode: (code, signal) => {
44
+ var _resolveScan;
45
+ return (_resolveScan = resolveScan === null || resolveScan === void 0 ? void 0 : resolveScan(code, signal)) !== null && _resolveScan !== void 0 ? _resolveScan : Promise.resolve(null);
46
+ },
43
47
  consumeBarcode: function() {
44
48
  var _ref = _asyncToGenerator(function* (code, signal) {
45
49
  if (signal.aborted) return { status: "cancelled" };
@@ -58,7 +62,7 @@ function createBigSaleCartOperations({ getContext, readTransactionState, execute
58
62
  return {
59
63
  status: "succeeded",
60
64
  data: {
61
- code: scanResult.status === "pending" ? "requiresSelection" : "added",
65
+ code: scanResult.status === "pending" ? "requiresSelection" : scanResult.kind === "customer" || scanResult.kind === "promotion" ? "handled" : "added",
62
66
  cartChangeConfirmed: scanResult.status === "success" && Number((_scanResult$meta$coun = (_scanResult$meta = scanResult.meta) === null || _scanResult$meta === void 0 ? void 0 : _scanResult$meta.count) !== null && _scanResult$meta$coun !== void 0 ? _scanResult$meta$coun : 0) > 0
63
67
  }
64
68
  };
@@ -1,10 +1,12 @@
1
1
  import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import { _asyncToGenerator } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
3
+ import { isWalkInCustomer } from "../../../../../../plus/salesSdk/selectors.js";
3
4
  import { resolveBigSaleLiveTempOrder } from "../../utils/transactionState.js";
4
5
  import { failed, partialFailure, unknown } from "../../utils/normalize.js";
5
6
  import { createBigSaleCartOperations } from "./cart.js";
6
7
  import { createBigSaleWeightedProductOperations } from "./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 failed("authenticatedCustomerUnavailable", "back");
103
+ if (isWalkInCustomer(selected)) return failed("authenticatedCustomerUnavailable", "back");
114
104
  context.customer.select(selected);
115
105
  if (signal.aborted) return 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 partialFailure("identitySelectionFailed", error);
@@ -108,19 +108,43 @@ function useBigSaleHDLKioskAdapter({ context, businessCode, isActive, nativeScal
108
108
  const hostRef = useRef(null);
109
109
  if (!hostRef.current) hostRef.current = createBigSaleHDLKioskHost({
110
110
  getContext: () => contextRef.current,
111
+ resolveScan: function() {
112
+ var _ref9 = _asyncToGenerator(function* (code, signal) {
113
+ if (signal.aborted) return null;
114
+ const ticket = contextRef.current.sales.bookingTicket;
115
+ if (typeof (ticket === null || ticket === void 0 ? void 0 : ticket.getGlobalScanCodeType) !== "function") {
116
+ ToastRef.current.fail(locales.getText("pisell2.hdl-kiosk.scan-service-unavailable"));
117
+ return null;
118
+ }
119
+ try {
120
+ const type = yield ticket.getGlobalScanCodeType(code);
121
+ if (signal.aborted) return null;
122
+ if (!type) ToastRef.current.fail(locales.getText("pisell2.text.scan-global-failed"));
123
+ return type;
124
+ } catch (_unused) {
125
+ if (!signal.aborted) ToastRef.current.fail(locales.getText("pisell2.hdl-kiosk.scan-request-failed"));
126
+ return null;
127
+ }
128
+ });
129
+ return function resolveScan(_x, _x2) {
130
+ return _ref9.apply(this, arguments);
131
+ };
132
+ }(),
111
133
  executeScan: function() {
112
- var _ref9 = _asyncToGenerator(function* (code) {
113
- var _execution$scanResult, _execution$scanResult2, _execution$scanResult3;
134
+ var _ref10 = _asyncToGenerator(function* (code) {
135
+ var _execution$scanResult, _execution$scanResult2, _execution$scanResult3, _execution$scanResult4;
136
+ ToastRef.current.loading(locales.getText("pisell2.hdl-kiosk.processing"), 1500);
114
137
  const beforeProducts = snapshotProductQuantityEvidence(readLiveProducts());
115
138
  let selectionToastShown = false;
116
139
  const execution = yield scanRef.current(code, { onProductAdded: ({ product, products }) => {
117
140
  selectionToastShown = notifyScannedProductAdded(beforeProducts, products, product);
118
141
  } });
119
142
  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());
143
+ if (((_execution$scanResult4 = execution.scanResult) === null || _execution$scanResult4 === void 0 ? void 0 : _execution$scanResult4.status) === "success" && execution.scanResult.kind === "promotion") ToastRef.current.success(locales.getText("pisell2.hdl-kiosk.code-applied"));
120
144
  return execution;
121
145
  });
122
- return function executeScan(_x) {
123
- return _ref9.apply(this, arguments);
146
+ return function executeScan(_x3) {
147
+ return _ref10.apply(this, arguments);
124
148
  };
125
149
  }(),
126
150
  hasScanExecutionSource: () => typeof scanRef.current === "function",
@@ -1,8 +1,8 @@
1
1
  import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import useEngineContext from "../../../../hooks/useEngineContext.js";
3
3
  import localeTexts from "../../../HDLKiosk/locales.js";
4
- import HDLKiosk from "../../../HDLKiosk/index.js";
5
4
  import { resolveHDLKioskConfig } from "../../../HDLKiosk/app/contracts/config.js";
5
+ import HDLKiosk from "../../../HDLKiosk/index.js";
6
6
  import { resolveBigSaleCurrentAmountDue } from "./utils/transactionState.js";
7
7
  import { useBigSaleHDLKioskAdapter } from "./hooks/useBigSaleHDLKioskAdapter.js";
8
8
  import { useHDLKioskEntryPreparationToast } from "./hooks/useHDLKioskEntryPreparationToast.js";