@feedmepos/mf-order-setting 0.0.96 → 0.0.97

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 (34) hide show
  1. package/dist/{DisplaySystemView-BH8SkCOF.js → DisplaySystemView-CxzAm858.js} +4 -4
  2. package/dist/{FoodCourtInvitationsView-3cA0Z-5m.js → FoodCourtInvitationsView-6IJ_90WH.js} +3 -3
  3. package/dist/{FoodCourtOrderSettingsView-DysrLZJD.js → FoodCourtOrderSettingsView-tuN-AjyH.js} +1 -1
  4. package/dist/{FoodCourtOrdersView-CbZqHIXO.js → FoodCourtOrdersView-BZDV86qZ.js} +3 -3
  5. package/dist/{FoodCourtStallsView-CTZzPUQ6.js → FoodCourtStallsView-C81eYjyf.js} +2 -2
  6. package/dist/{FoodCourtStatusView-C71y7ghx.js → FoodCourtStatusView-CIzXFmpX.js} +1 -1
  7. package/dist/{KioskDevicesView-BJpbuSzp.js → KioskDevicesView-B9_5ynuL.js} +1 -1
  8. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-CQFpwn28.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-Bbvhl393.js} +5 -5
  9. package/dist/{KioskSettingView-CJxhMf7N.js → KioskSettingView-BgAH6D4b.js} +3 -3
  10. package/dist/{KioskView-BZsdRID1.js → KioskView-bVLcdUIs.js} +6 -6
  11. package/dist/{OrderSettingsView-gnyXaJjf.js → OrderSettingsView-DFCvkYlF.js} +14891 -14867
  12. package/dist/{app-CeEFBB-w.js → app-CXM7Y8ue.js} +923 -919
  13. package/dist/app.js +1 -1
  14. package/dist/{dayjs.min-zBHHlxAP.js → dayjs.min-BL2ytaWE.js} +1 -1
  15. package/dist/{featureFlag-BTY_R78k.js → featureFlag-DG1avUtJ.js} +1 -1
  16. package/dist/frontend/mf-order/src/app.d.ts +12 -8
  17. package/dist/frontend/mf-order/src/main.d.ts +12 -8
  18. package/dist/frontend/mf-order/src/views/order-settings/queue/auto-cancel-minutes.d.ts +9 -0
  19. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  20. package/dist/{index-D5nv3ncu.js → index-Bkqum66F.js} +2 -2
  21. package/dist/{index-601eG3_R.js → index-BzCugL7s.js} +1 -1
  22. package/dist/{index-BtudnkMi.js → index-C10eL5h0.js} +1 -1
  23. package/dist/{index-DLDihONy.js → index-C6PdYrNb.js} +1 -1
  24. package/dist/{index-CGiWgTn1.js → index-CqjGIBhA.js} +4 -4
  25. package/dist/{index-BeBZTUcq.js → index-DNaVtem4.js} +1 -1
  26. package/dist/{order.dto-JM_fmWnQ.js → order.dto-BVxGQISl.js} +2 -2
  27. package/package.json +1 -1
  28. package/src/locales/en-US.json +3 -2
  29. package/src/locales/ja-JP.json +3 -2
  30. package/src/locales/th-TH.json +3 -2
  31. package/src/locales/zh-CN.json +3 -2
  32. package/src/views/order-settings/queue/QueueSetting.vue +47 -17
  33. package/src/views/order-settings/queue/auto-cancel-minutes.spec.ts +44 -0
  34. package/src/views/order-settings/queue/auto-cancel-minutes.ts +20 -0
@@ -1,5 +1,5 @@
1
- import { g as n, s as a, a as r, r as e } from "./index-601eG3_R.js";
2
- import "./order.dto-JM_fmWnQ.js";
1
+ import { g as n, s as a, a as r, r as e } from "./index-BzCugL7s.js";
2
+ import "./order.dto-BVxGQISl.js";
3
3
  async function i() {
4
4
  const t = await e().get("/order-settings");
5
5
  return n(t);
@@ -1,7 +1,7 @@
1
1
  var dn = Object.defineProperty;
2
2
  var pn = (e, t, n) => t in e ? dn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var je = (e, t, n) => pn(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { e as Ct } from "./app-CeEFBB-w.js";
4
+ import { e as Ct } from "./app-CXM7Y8ue.js";
5
5
  import { useCoreStore as Y } from "@feedmepos/mf-common";
6
6
  function Ut(e, t) {
7
7
  return function() {
@@ -1,4 +1,4 @@
1
- import { g as Kr } from "./app-CeEFBB-w.js";
1
+ import { g as Kr } from "./app-CXM7Y8ue.js";
2
2
  var k = { exports: {} }, se, er;
3
3
  function H() {
4
4
  if (er) return se;
@@ -1,4 +1,4 @@
1
- import { c as Le, j as ea } from "./app-CeEFBB-w.js";
1
+ import { c as Le, j as ea } from "./app-CXM7Y8ue.js";
2
2
  function Ct(me) {
3
3
  throw new Error('Could not dynamically require "' + me + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -1,11 +1,11 @@
1
1
  import { defineComponent as H, ref as V, resolveComponent as R, openBlock as f, createElementBlock as T, createElementVNode as v, toDisplayString as S, createVNode as b, unref as x, createBlock as z, computed as U, watch as oe, onMounted as re, withCtx as N, createTextVNode as se, createCommentVNode as E, Fragment as ie, renderList as le, renderSlot as ae } from "vue";
2
- import { e as g } from "./app-CeEFBB-w.js";
2
+ import { e as g } from "./app-CXM7Y8ue.js";
3
3
  import { useDialog as ue } from "@feedmepos/ui-library";
4
4
  import { useI18n as Y, useCoreStore as ne } from "@feedmepos/mf-common";
5
5
  import { defineStore as de } from "pinia";
6
- import { r as F, g as a, b as O, a as Q } from "./index-601eG3_R.js";
7
- import "./order.dto-JM_fmWnQ.js";
8
- import { a as q } from "./index-DLDihONy.js";
6
+ import { r as F, g as a, b as O, a as Q } from "./index-BzCugL7s.js";
7
+ import "./order.dto-BVxGQISl.js";
8
+ import { a as q } from "./index-C6PdYrNb.js";
9
9
  const ce = /* @__PURE__ */ H({
10
10
  __name: "OfflinePaymentTypeDialogContent",
11
11
  props: {
@@ -1,4 +1,4 @@
1
- import { g as r, b as o } from "./index-601eG3_R.js";
1
+ import { g as r, b as o } from "./index-BzCugL7s.js";
2
2
  const n = (e) => o(`/food-court-v2/${e}`), i = {
3
3
  async getDineIn(e) {
4
4
  return r(await n(e).get("/dine-in"));
@@ -1,5 +1,5 @@
1
- import { k as M, e as _, w as ce, c as E, i as gc, j as Iu } from "./app-CeEFBB-w.js";
2
- import { a as st } from "./index-DLDihONy.js";
1
+ import { k as M, e as _, w as ce, c as E, i as gc, j as Iu } from "./app-CXM7Y8ue.js";
2
+ import { a as st } from "./index-C6PdYrNb.js";
3
3
  var e = M();
4
4
  const pe = e.z.enum([
5
5
  "CREATING",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-order-setting",
3
- "version": "0.0.96",
3
+ "version": "0.0.97",
4
4
  "type": "module",
5
5
  "module": "./dist/app.js",
6
6
  "license": "UNLICENSED",
@@ -289,8 +289,9 @@
289
289
  "externalCatalogRequired": "Select a catalog for {orderTypes} on {platform}.",
290
290
  "auto": "Auto",
291
291
  "autoCalledLimit": "Auto Called Limit",
292
- "autoCancelCalledMinutes": "Auto-cancel called queue after (minutes)",
293
- "autoCancelCalledMinutesHint": "Counts from when the queue is called. A party not seated by then is cancelled. Set it longer than your usual wait between calling and seating. 0 = off.",
292
+ "autoCancelCalledMinutesRule": "Enter whole minutes from 1 to 1440",
293
+ "autoCancelCalledQueue": "Auto-cancel called queue",
294
+ "autoCancelCalledQueueDescription": "Cancel a called queue not seated within the set minutes",
294
295
  "autoCloseBill": "Auto close bill",
295
296
  "autoCloseBillSublabel": "Automatically close the bill once the order is accepted. An unpaid bill stays open until it is settled.",
296
297
  "autoIntegration": "Auto Integration",
@@ -515,8 +515,9 @@
515
515
  "queueSettings": "順番待ち設定",
516
516
  "enableQueueOrder": "順番待ち事前注文を有効にする",
517
517
  "autoCalledLimit": "自動呼び出し制限",
518
- "autoCancelCalledMinutes": "呼び出し後に自動キャンセル(分)",
519
- "autoCancelCalledMinutesHint": "呼び出した時点から数えます。それまでに着席していない順番待ちはキャンセルされます。通常の呼び出しから着席までの時間より長く設定してください。0 = オフ。",
518
+ "autoCancelCalledMinutesRule": "1〜1440の整数で分を入力してください",
519
+ "autoCancelCalledQueue": "呼び出し済みの順番待ちを自動キャンセル",
520
+ "autoCancelCalledQueueDescription": "設定した時間内に着席しない呼び出し済みの順番待ちをキャンセルします",
520
521
  "duration": "時間",
521
522
  "disableRemoteQueue": "リモート順番待ちを無効にする",
522
523
  "allowOverrideQueueCode": "整理番号の上書きを許可",
@@ -617,8 +617,9 @@
617
617
  "queueSettings": "การตั้งค่าคิว",
618
618
  "enableQueueOrder": "เปิดใช้งานการสั่งอาหารล่วงหน้าระหว่างรอคิว",
619
619
  "autoCalledLimit": "จำนวนครั้งในการเรียกคิวอัตโนมัติ",
620
- "autoCancelCalledMinutes": "ยกเลิกคิวอัตโนมัติหลังเรียกคิว (นาที)",
621
- "autoCancelCalledMinutesHint": "เริ่มนับจากเวลาที่เรียกคิว หากลูกค้ายังไม่ได้นั่งโต๊ะภายในเวลานี้ คิวจะถูกยกเลิก ควรตั้งให้นานกว่าเวลาปกติระหว่างการเรียกคิวจนถึงการพาไปนั่ง 0 = ปิด",
620
+ "autoCancelCalledMinutesRule": "กรอกจำนวนนาทีเป็นจำนวนเต็ม 1 ถึง 1440",
621
+ "autoCancelCalledQueue": "ยกเลิกคิวที่เรียกแล้วอัตโนมัติ",
622
+ "autoCancelCalledQueueDescription": "ยกเลิกคิวที่เรียกแล้วแต่ยังไม่ได้นั่งภายในเวลาที่กำหนด",
622
623
  "duration": "ระยะเวลา",
623
624
  "disableRemoteQueue": "ปิดการรับคิวออนไลน์",
624
625
  "allowOverrideQueueCode": "อนุญาตให้แก้ไขรหัสคิว",
@@ -619,8 +619,9 @@
619
619
  "queueSettings": "排队设置",
620
620
  "enableQueueOrder": "启用排队预点单",
621
621
  "autoCalledLimit": "自动呼叫限制",
622
- "autoCancelCalledMinutes": "叫号后自动取消(分钟)",
623
- "autoCancelCalledMinutesHint": "从叫号时开始计算,届时仍未入座的排队将被取消。请设置得比平时叫号到入座的等候时间更长。0 = 关闭。",
622
+ "autoCancelCalledMinutesRule": "请输入 1 到 1440 的整数分钟",
623
+ "autoCancelCalledQueue": "自动取消已叫号排队",
624
+ "autoCancelCalledQueueDescription": "已叫号但在设定时间内未入座的排队将被取消",
624
625
  "duration": "持续时间",
625
626
  "disableRemoteQueue": "禁用远程排队",
626
627
  "allowOverrideQueueCode": "允许覆盖排队号码",
@@ -18,6 +18,13 @@ import { useDialog } from '@feedmepos/ui-library'
18
18
  import PresetRemarksSheet from './PresetRemarksSheet.vue'
19
19
  import { clampPaxBand, isPaxBandValid, MAX_PAX, nextCodeSettingBand } from './code-setting-band'
20
20
  import { autoSendFromSelectValue, autoSendSelectValue } from '../auto-send-kitchen'
21
+ import {
22
+ AUTO_CANCEL_DEFAULT_MINUTES,
23
+ AUTO_CANCEL_MAX_MINUTES,
24
+ AUTO_CANCEL_MIN_MINUTES,
25
+ isAutoCancelMinutesValid,
26
+ isAutoCancelOn
27
+ } from './auto-cancel-minutes'
21
28
 
22
29
  const { t } = useI18n()
23
30
  const { showSuccess, showError } = useSnackbarFunctions()
@@ -33,6 +40,13 @@ const presetRemarks = ref<string[]>([])
33
40
  const allowOverrideQueueCode = ref<boolean>(false)
34
41
  /** Re-mounts the Pax Max fields after a clamp, so a field already at the cap shows it again. */
35
42
  const paxMaxRenderKey = ref(0)
43
+ /** Its own state, so typing 0 or clearing the minutes keeps the field open with an error instead of switching off. */
44
+ const autoCancelEnabled = ref(false)
45
+ const autoCancelRules = [
46
+ () =>
47
+ isAutoCancelMinutesValid(queueSettings.value.autoCancelCalledMinutes) ||
48
+ t('order.autoCancelCalledMinutesRule')
49
+ ]
36
50
 
37
51
  const Dialog = useDialog()
38
52
  const { availability: pushAvailability } = usePushAvailability()
@@ -58,7 +72,7 @@ async function readOrderSetting(): Promise<OrderSettingsDto> {
58
72
 
59
73
  async function updateOrderSetting() {
60
74
  clampPaxBands()
61
- const problem = validatePaxBands() ?? validateEstimates()
75
+ const problem = validatePaxBands() ?? validateEstimates() ?? validateAutoCancel()
62
76
  if (problem) {
63
77
  showError(problem)
64
78
  return
@@ -91,6 +105,7 @@ async function init() {
91
105
  normalizeEstimates()
92
106
  }
93
107
  clampPaxBands()
108
+ autoCancelEnabled.value = isAutoCancelOn(queueSettings.value.autoCancelCalledMinutes)
94
109
 
95
110
  // Load restaurant settings for preset remarks
96
111
  await startAsyncCallWithErr(async () => {
@@ -111,10 +126,17 @@ function updateQueueSetting<K extends keyof FdoOrderQueueSettings>(
111
126
  queueSettings.value[key] = value
112
127
  }
113
128
 
114
- /** Whole minutes in the range the server accepts (0 = off, at most a day). */
115
- function autoCancelMinutes(value: string | number): number {
116
- const minutes = Math.floor(Number(value))
117
- return Number.isFinite(minutes) ? Math.min(1440, Math.max(0, minutes)) : 0
129
+ function enableAutoCancel(on: boolean) {
130
+ autoCancelEnabled.value = on
131
+ // Off is an explicit 0: a save that leaves the field out keeps the stored minutes (queue-field-inherit.ts).
132
+ updateQueueSetting('autoCancelCalledMinutes', on ? AUTO_CANCEL_DEFAULT_MINUTES : 0)
133
+ }
134
+
135
+ function validateAutoCancel(): string | null {
136
+ return autoCancelEnabled.value &&
137
+ !isAutoCancelMinutesValid(queueSettings.value.autoCancelCalledMinutes)
138
+ ? t('order.autoCancelCalledMinutesRule')
139
+ : null
118
140
  }
119
141
 
120
142
  function addCodeSetting() {
@@ -452,18 +474,26 @@ async function saveAllowOverrideQueueCode(value: boolean) {
452
474
  "
453
475
  />
454
476
  </div>
455
- <div class="flex flex-col gap-2">
456
- <span class="fm-typo-en-body-md-600">{{ t('order.autoCancelCalledMinutes') }}</span>
457
- <FmTextField
458
- type="number"
459
- :model-value="queueSettings.autoCancelCalledMinutes ?? 0"
460
- @update:model-value="
461
- (v: string | number) =>
462
- updateQueueSetting('autoCancelCalledMinutes', autoCancelMinutes(v))
463
- "
464
- />
465
- <span class="text-xs text-gray-500">{{ t('order.autoCancelCalledMinutesHint') }}</span>
466
- </div>
477
+ </div>
478
+
479
+ <FmSwitch
480
+ :model-value="autoCancelEnabled"
481
+ @update:model-value="enableAutoCancel"
482
+ :label="t('order.autoCancelCalledQueue')"
483
+ :sublabel="t('order.autoCancelCalledQueueDescription')"
484
+ label-placement="right"
485
+ />
486
+ <div v-if="autoCancelEnabled" class="grid grid-cols-1 md:grid-cols-2 gap-5 ml-5">
487
+ <FmStepperField
488
+ :model-value="queueSettings.autoCancelCalledMinutes ?? null"
489
+ :label="t('order.minutes')"
490
+ @update:model-value="(v: number) => updateQueueSetting('autoCancelCalledMinutes', v)"
491
+ :show-steppers="true"
492
+ :min="AUTO_CANCEL_MIN_MINUTES"
493
+ :max="AUTO_CANCEL_MAX_MINUTES"
494
+ :max-fraction-digits="0"
495
+ :rules="autoCancelRules"
496
+ />
467
497
  </div>
468
498
 
469
499
  <FmSwitch
@@ -0,0 +1,44 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import {
3
+ AUTO_CANCEL_DEFAULT_MINUTES,
4
+ isAutoCancelMinutesValid,
5
+ isAutoCancelOn
6
+ } from './auto-cancel-minutes'
7
+
8
+ /**
9
+ * The portal's on/off switch and minutes field must read the stored value the way
10
+ * queue-backend does (`autoCancelDelayMs`: anything but a positive number is off),
11
+ * and must never let a negative, zero or fractional minute count be saved while on
12
+ * (ITS-002481: a merchant could type -1 into the old number box).
13
+ */
14
+ describe('isAutoCancelOn', () => {
15
+ it('is on only for a positive number of minutes', () => {
16
+ expect(isAutoCancelOn(1)).toBe(true)
17
+ expect(isAutoCancelOn(60)).toBe(true)
18
+ })
19
+
20
+ it('is off for 0, null, absent and negative values', () => {
21
+ expect(isAutoCancelOn(0)).toBe(false)
22
+ expect(isAutoCancelOn(null)).toBe(false)
23
+ expect(isAutoCancelOn(undefined)).toBe(false)
24
+ expect(isAutoCancelOn(-1)).toBe(false)
25
+ })
26
+ })
27
+
28
+ describe('isAutoCancelMinutesValid', () => {
29
+ it('accepts whole minutes from 1 to 1440', () => {
30
+ expect(isAutoCancelMinutesValid(1)).toBe(true)
31
+ expect(isAutoCancelMinutesValid(AUTO_CANCEL_DEFAULT_MINUTES)).toBe(true)
32
+ expect(isAutoCancelMinutesValid(1440)).toBe(true)
33
+ })
34
+
35
+ it('refuses zero, negatives, fractions, values over a day and empty input', () => {
36
+ expect(isAutoCancelMinutesValid(0)).toBe(false)
37
+ expect(isAutoCancelMinutesValid(-1)).toBe(false)
38
+ expect(isAutoCancelMinutesValid(1.5)).toBe(false)
39
+ expect(isAutoCancelMinutesValid(1441)).toBe(false)
40
+ expect(isAutoCancelMinutesValid(null)).toBe(false)
41
+ expect(isAutoCancelMinutesValid(undefined)).toBe(false)
42
+ expect(isAutoCancelMinutesValid(Number.NaN)).toBe(false)
43
+ })
44
+ })
@@ -0,0 +1,20 @@
1
+ /** Minutes a fresh auto-cancel starts at: Gepuklah's calls are usually seated within an hour (ITS-002481). */
2
+ export const AUTO_CANCEL_DEFAULT_MINUTES = 60
3
+ /** The range queue-backend's timer takes: at least a minute, at most a day. */
4
+ export const AUTO_CANCEL_MIN_MINUTES = 1
5
+ export const AUTO_CANCEL_MAX_MINUTES = 1440
6
+
7
+ /** On when a positive number of minutes is stored; 0, null and absent all mean off, as on the server. */
8
+ export function isAutoCancelOn(minutes: number | null | undefined): boolean {
9
+ return typeof minutes === 'number' && minutes > 0
10
+ }
11
+
12
+ /** Whether `minutes` can be saved while auto-cancel is on: a whole number from 1 to 1440. */
13
+ export function isAutoCancelMinutesValid(minutes: number | null | undefined): boolean {
14
+ return (
15
+ typeof minutes === 'number' &&
16
+ Number.isInteger(minutes) &&
17
+ minutes >= AUTO_CANCEL_MIN_MINUTES &&
18
+ minutes <= AUTO_CANCEL_MAX_MINUTES
19
+ )
20
+ }