@pisell/private-materials 6.11.672 → 6.11.674

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.
@@ -3,7 +3,7 @@ import PaymentResultToastV2_default from "../../../../checkout/components/Paymen
3
3
  import { useHDLKioskBottomBar, useHDLKioskBottomBarController } from "../../../components/shell/HDLKioskBottomBarHost/index.js";
4
4
  import { HDLKioskOrderSummary } from "../../../components/shell/HDLKioskOrderSummary/index.js";
5
5
  import { RestartOrderDialog } from "../../../components/overlays/RestartOrderDialog/index.js";
6
- import React, { useCallback, useEffect, useMemo, useState } from "react";
6
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
7
  import { locales } from "@pisell/utils";
8
8
  import { Iconfont } from "@pisell/materials";
9
9
  function BackIcon() {
@@ -47,6 +47,8 @@ function PaymentMethodIcon({ code, type }) {
47
47
  }
48
48
  function CheckoutScreen({ model, orderBar, send }) {
49
49
  var _model$paymentFeedbac;
50
+ const sendRef = useRef(send);
51
+ sendRef.current = send;
50
52
  const goBack = useCallback(() => send({
51
53
  kind: "navigation",
52
54
  direction: "back"
@@ -57,11 +59,11 @@ function CheckoutScreen({ model, orderBar, send }) {
57
59
  const [restartOrderOpen, setRestartOrderOpen] = useState(false);
58
60
  const [dismissedFeedbackKey, setDismissedFeedbackKey] = useState();
59
61
  const [returnCountdown, setReturnCountdown] = useState(10);
60
- const resetOrder = useCallback((source) => send({
62
+ const resetOrder = useCallback((source) => sendRef.current({
61
63
  kind: "session",
62
64
  action: "reset",
63
65
  source
64
- }), [send]);
66
+ }), []);
65
67
  const bottomBar = useMemo(() => {
66
68
  var _orderBar$cartItemCou;
67
69
  return {
@@ -40,6 +40,14 @@ function normalizeMultilingualNoteValue(value, maxLength) {
40
40
  function hasMultilingualNoteValue(value) {
41
41
  return Object.values(value).some((text) => text.trim());
42
42
  }
43
+ function dismissVirtualKeyboard() {
44
+ if (typeof document === "undefined") return;
45
+ try {
46
+ var _activeElement$blur;
47
+ const activeElement = document.activeElement;
48
+ activeElement === null || activeElement === void 0 || (_activeElement$blur = activeElement.blur) === null || _activeElement$blur === void 0 || _activeElement$blur.call(activeElement);
49
+ } catch (_unused) {}
50
+ }
43
51
  const NoteModalContent = ({ open = false, title = "", value = "", maxLength = DEFAULT_NOTE_MAX_LENGTH, onConfirm, onDelete, onCancel, zIndex, variant, modalClassName, multilingual = false }) => {
44
52
  var _context$engine;
45
53
  const context = useEngineContext();
@@ -87,6 +95,7 @@ const NoteModalContent = ({ open = false, title = "", value = "", maxLength = DE
87
95
  saveTemplates(templates.filter((_, templateIndex) => templateIndex !== index));
88
96
  };
89
97
  const handleConfirm = () => {
98
+ dismissVirtualKeyboard();
90
99
  if (multilingual) {
91
100
  onConfirm === null || onConfirm === void 0 || onConfirm(normalizeMultilingualNoteValue(multilingualNoteValue, resolvedMaxLength));
92
101
  return;
@@ -49,6 +49,8 @@ function PaymentMethodIcon({ code, type }) {
49
49
  }
50
50
  function CheckoutScreen({ model, orderBar, send }) {
51
51
  var _model$paymentFeedbac;
52
+ const sendRef = (0, react.useRef)(send);
53
+ sendRef.current = send;
52
54
  const goBack = (0, react.useCallback)(() => send({
53
55
  kind: "navigation",
54
56
  direction: "back"
@@ -59,11 +61,11 @@ function CheckoutScreen({ model, orderBar, send }) {
59
61
  const [restartOrderOpen, setRestartOrderOpen] = (0, react.useState)(false);
60
62
  const [dismissedFeedbackKey, setDismissedFeedbackKey] = (0, react.useState)();
61
63
  const [returnCountdown, setReturnCountdown] = (0, react.useState)(10);
62
- const resetOrder = (0, react.useCallback)((source) => send({
64
+ const resetOrder = (0, react.useCallback)((source) => sendRef.current({
63
65
  kind: "session",
64
66
  action: "reset",
65
67
  source
66
- }), [send]);
68
+ }), []);
67
69
  const bottomBar = (0, react.useMemo)(() => {
68
70
  var _orderBar$cartItemCou;
69
71
  return {
@@ -43,6 +43,14 @@ function normalizeMultilingualNoteValue(value, maxLength) {
43
43
  function hasMultilingualNoteValue(value) {
44
44
  return Object.values(value).some((text) => text.trim());
45
45
  }
46
+ function dismissVirtualKeyboard() {
47
+ if (typeof document === "undefined") return;
48
+ try {
49
+ var _activeElement$blur;
50
+ const activeElement = document.activeElement;
51
+ activeElement === null || activeElement === void 0 || (_activeElement$blur = activeElement.blur) === null || _activeElement$blur === void 0 || _activeElement$blur.call(activeElement);
52
+ } catch (_unused) {}
53
+ }
46
54
  const NoteModalContent = ({ open = false, title = "", value = "", maxLength = DEFAULT_NOTE_MAX_LENGTH, onConfirm, onDelete, onCancel, zIndex, variant, modalClassName, multilingual = false }) => {
47
55
  var _context$engine;
48
56
  const context = require_useEngineContext.default();
@@ -90,6 +98,7 @@ const NoteModalContent = ({ open = false, title = "", value = "", maxLength = DE
90
98
  saveTemplates(templates.filter((_, templateIndex) => templateIndex !== index));
91
99
  };
92
100
  const handleConfirm = () => {
101
+ dismissVirtualKeyboard();
93
102
  if (multilingual) {
94
103
  onConfirm === null || onConfirm === void 0 || onConfirm(normalizeMultilingualNoteValue(multilingualNoteValue, resolvedMaxLength));
95
104
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.11.672",
3
+ "version": "6.11.674",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",