@feedmepos/mf-order-setting 0.0.75-dev.20260721T080807Z.29812992895 → 0.0.75-prod

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.
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./KioskDevicesView.vue_vue_type_script_setup_true_lang-DZkir0K_.js";
1
+ import { _ as f } from "./KioskDevicesView.vue_vue_type_script_setup_true_lang-BmCrSZnS.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,10 +1,10 @@
1
1
  import { ref as P, defineComponent as ee, resolveComponent as S, openBlock as l, createElementBlock as u, createElementVNode as a, toDisplayString as i, unref as s, createVNode as m, computed as T, watch as pe, createCommentVNode as D, withCtx as H, Fragment as W, renderList as Z, normalizeClass as we, createBlock as L, createTextVNode as X, renderSlot as Ae } from "vue";
2
2
  import { useI18n as le } from "@feedmepos/mf-common";
3
3
  import { defineStore as Pe } from "pinia";
4
- import { r as Y, g as ve } from "./lineman-settings.dto-C8boe82Z.js";
4
+ import { r as Y, g as ve } from "./lineman-settings.dto-BMG_DnTF.js";
5
5
  import { useDialog as De, useSnackbar as Se } from "@feedmepos/ui-library";
6
- import { d as ie } from "./dayjs.min-D_adqybn.js";
7
- import { g as Ce, c as Fe, a as fe } from "./app-11No87EZ.js";
6
+ import { d as ie } from "./dayjs.min-BNHTbbaJ.js";
7
+ import { g as Ce, c as Fe, a as fe } from "./app-DzO7wZsC.js";
8
8
  async function Me() {
9
9
  const n = await Y().get("/kiosk/otp");
10
10
  return ve(n);
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as oe, computed as A, ref as L, onMounted as me, resolveComponent as w, openBlock as R, createBlock as G, withCtx as k, createVNode as s, unref as l, createElementVNode as r, withDirectives as E, vShow as N, watch as pe, createElementBlock as j, toDisplayString as g, createCommentVNode as ce } from "vue";
2
- import { e as ae, b as re, s as se, d as ye, r as le, f as te, h as fe } from "./app-11No87EZ.js";
3
- import { b as m, c as ve } from "./lineman-settings.dto-C8boe82Z.js";
4
- import { _ as be, u as ge, a as Ie } from "./index-JbCnNX9Q.js";
2
+ import { e as ae, b as re, s as se, d as ye, r as le, f as te, h as fe } from "./app-DzO7wZsC.js";
3
+ import { b as m, c as ve } from "./lineman-settings.dto-BMG_DnTF.js";
4
+ import { _ as be, u as ge, a as Ie } from "./index-DQA37h5T.js";
5
5
  import { useI18n as de, FeedMeAuth as ie, useCoreStore as Pe } from "@feedmepos/mf-common";
6
6
  import { useSnackbar as Se } from "@feedmepos/ui-library";
7
7
  const xe = { class: "ml-7" }, we = { class: "ml-7" }, _e = { class: "flex flex-row gap-9" }, Ve = /* @__PURE__ */ oe({
@@ -239,7 +239,7 @@ function Ce(i) {
239
239
  }
240
240
  function ke() {
241
241
  var e;
242
- return (((e = Te.firebase) == null ? void 0 : e.storageBucket) ?? he.firebase.storageBucket ?? "image.feedmedev.cc").replace(/^https?:\/\//, "").replace(/\/+$/, "");
242
+ return (((e = Te.firebase) == null ? void 0 : e.storageBucket) ?? he.firebase.storageBucket ?? "image.feedme.cc").replace(/^https?:\/\//, "").replace(/\/+$/, "");
243
243
  }
244
244
  function Ae(i) {
245
245
  const p = i.replace(/^\/+/, "");
@@ -0,0 +1,362 @@
1
+ import { defineComponent as B, openBlock as P, createElementBlock as E, createElementVNode as m, toDisplayString as w, unref as d, ref as v, defineAsyncComponent as O, computed as x, onMounted as g, watch as S, resolveComponent as K, createVNode as T, createBlock as V, createCommentVNode as L } from "vue";
2
+ import { u as k, _ as ee } from "./KioskDevicesView.vue_vue_type_script_setup_true_lang-BmCrSZnS.js";
3
+ import { useDialog as ae, useSnackbar as te } from "@feedmepos/ui-library";
4
+ import { useI18n as H, useCoreStore as ne } from "@feedmepos/mf-common";
5
+ import { F as le, a as ue, S as M } from "./lineman-settings.dto-BMG_DnTF.js";
6
+ import { defineStore as oe } from "pinia";
7
+ import { O as N, c as re } from "./index-BP0fOlVh.js";
8
+ import { u as ce } from "./app-DzO7wZsC.js";
9
+ const se = { class: "flex flex-col gap-5 pb-6" }, pe = { class: "fm-typo-en-body-md-400 block" }, de = { class: "fm-typo-en-title-md-600" }, me = /* @__PURE__ */ B({
10
+ __name: "KioskOtpDialog",
11
+ props: {
12
+ otp: {}
13
+ },
14
+ setup(e) {
15
+ const { t: a } = H();
16
+ return (u, c) => (P(), E("div", se, [
17
+ m("span", pe, w(d(a)("order.bindDeviceMessage")), 1),
18
+ m("div", de, w(e.otp), 1)
19
+ ]));
20
+ }
21
+ }), W = {
22
+ enabled: !1,
23
+ prefix: null,
24
+ padDigit: 0,
25
+ standSlotRange: {
26
+ min: 1,
27
+ max: 10
28
+ },
29
+ enablePaxDialog: !1,
30
+ submitOrderInstruction: {
31
+ payAtCounter: null,
32
+ paid: null
33
+ }
34
+ }, ie = {
35
+ enabled: !1,
36
+ submitOrderInstruction: {
37
+ payAtCounter: null,
38
+ paid: null
39
+ }
40
+ }, Q = {
41
+ enabled: !1,
42
+ submitOrderInstruction: {
43
+ payAtCounter: null,
44
+ paid: null
45
+ },
46
+ enablePaxDialog: !1
47
+ }, ye = {
48
+ dineIn: {
49
+ enabled: !1,
50
+ pickUp: Q,
51
+ sequenceNumber: le.parse({}),
52
+ displayStand: W
53
+ },
54
+ takeaway: ie,
55
+ paymentSetting: {
56
+ paymentTypes: [],
57
+ offlinePaymentTypes: [],
58
+ ePaymentTypes: {
59
+ terminal: !1,
60
+ card: {
61
+ terminal: !1,
62
+ nfc: !1
63
+ },
64
+ eWallet: {
65
+ terminalQrPay: !1,
66
+ terminalScanPay: !1,
67
+ qrPay: !1,
68
+ scanPay: !1
69
+ }
70
+ }
71
+ },
72
+ menuItem: {
73
+ showAllOnly: !1
74
+ },
75
+ coverImageLandscape: null,
76
+ coverImagePortrait: null,
77
+ otaChannel: ""
78
+ }, U = {
79
+ payAtCounter: null,
80
+ paid: null
81
+ }, fe = (e) => {
82
+ var a;
83
+ return {
84
+ kiosk: ve(e.kioskSettings, (a = e.sequenceSettings) == null ? void 0 : a.kioskDineIn)
85
+ };
86
+ }, ve = (e, a) => {
87
+ var u, c, t, l, o, p, r, s, b, f, i;
88
+ return {
89
+ dineIn: be(
90
+ a ?? {
91
+ current: 0,
92
+ prefix: "#K"
93
+ },
94
+ (e == null ? void 0 : e.dineIn) ?? void 0
95
+ ),
96
+ takeaway: {
97
+ enabled: (e == null ? void 0 : e.canTakeaway) ?? !1,
98
+ submitOrderInstruction: (u = e == null ? void 0 : e.takeaway) != null && u.submitOrderInstruction ? {
99
+ payAtCounter: ((l = (t = (c = e == null ? void 0 : e.takeaway) == null ? void 0 : c.submitOrderInstruction) == null ? void 0 : t.payAtCounter) == null ? void 0 : l.en) ?? null,
100
+ paid: ((r = (p = (o = e == null ? void 0 : e.takeaway) == null ? void 0 : o.submitOrderInstruction) == null ? void 0 : p.paid) == null ? void 0 : r.en) ?? null
101
+ } : U
102
+ },
103
+ paymentSetting: {
104
+ paymentTypes: ((s = e == null ? void 0 : e.paymentSetting) == null ? void 0 : s.paymentTypes) ?? [],
105
+ offlinePaymentTypes: ((b = e == null ? void 0 : e.paymentSetting) == null ? void 0 : b.offlinePaymentTypes) ?? [],
106
+ ePaymentTypes: ((f = e == null ? void 0 : e.paymentSetting) == null ? void 0 : f.ePaymentTypes) ?? ue.parse({
107
+ card: {
108
+ terminal: !1,
109
+ nfc: !1
110
+ },
111
+ eWallet: {
112
+ qrPay: !1,
113
+ scanPay: !1
114
+ }
115
+ })
116
+ },
117
+ menuItem: {
118
+ showAllOnly: ((i = e == null ? void 0 : e.menuItem) == null ? void 0 : i.showAllOnly) ?? !1
119
+ },
120
+ otaChannel: (e == null ? void 0 : e.otaChannel) ?? "",
121
+ coverImageLandscape: (e == null ? void 0 : e.coverImageLandscape) ?? null,
122
+ coverImagePortrait: (e == null ? void 0 : e.coverImagePortrait) ?? null
123
+ };
124
+ }, be = (e, a) => {
125
+ var u, c, t, l, o, p, r, s;
126
+ return {
127
+ enabled: !!a,
128
+ sequenceNumber: e,
129
+ pickUp: a != null && a.pickUp ? {
130
+ ...a.pickUp,
131
+ submitOrderInstruction: a.pickUp.submitOrderInstruction ? {
132
+ payAtCounter: ((c = (u = a.pickUp.submitOrderInstruction) == null ? void 0 : u.payAtCounter) == null ? void 0 : c.en) ?? null,
133
+ paid: ((l = (t = a.pickUp.submitOrderInstruction) == null ? void 0 : t.paid) == null ? void 0 : l.en) ?? null
134
+ } : U,
135
+ enablePaxDialog: a.pickUp.enablePaxDialog ? a.pickUp.enablePaxDialog : !1
136
+ } : Q,
137
+ displayStand: a != null && a.displayStand ? {
138
+ enabled: a.displayStand.enabled,
139
+ standSlotRange: a.displayStand.standSlotRange,
140
+ prefix: a.displayStand.prefix,
141
+ padDigit: a.displayStand.padDigit,
142
+ enablePaxDialog: a.displayStand.enablePaxDialog ?? !1,
143
+ submitOrderInstruction: a.displayStand.submitOrderInstruction ? {
144
+ payAtCounter: ((p = (o = a.displayStand.submitOrderInstruction) == null ? void 0 : o.payAtCounter) == null ? void 0 : p.en) ?? null,
145
+ paid: ((s = (r = a.displayStand.submitOrderInstruction) == null ? void 0 : r.paid) == null ? void 0 : s.en) ?? null
146
+ } : U
147
+ } : W
148
+ };
149
+ }, _e = (e) => {
150
+ const a = (t) => {
151
+ var l, o, p, r;
152
+ return {
153
+ requiredSlot: !!t.displayStand,
154
+ displayStand: {
155
+ ...t.displayStand,
156
+ submitOrderInstruction: {
157
+ payAtCounter: (l = t.displayStand.submitOrderInstruction) != null && l.payAtCounter ? {
158
+ en: t.displayStand.submitOrderInstruction.payAtCounter
159
+ } : null,
160
+ paid: (o = t.displayStand.submitOrderInstruction) != null && o.paid ? {
161
+ en: t.displayStand.submitOrderInstruction.paid
162
+ } : null
163
+ }
164
+ },
165
+ pickUp: {
166
+ ...t.pickUp,
167
+ submitOrderInstruction: {
168
+ payAtCounter: (p = t.pickUp.submitOrderInstruction) != null && p.payAtCounter ? {
169
+ en: t.pickUp.submitOrderInstruction.payAtCounter
170
+ } : null,
171
+ paid: (r = t.pickUp.submitOrderInstruction) != null && r.paid ? {
172
+ en: t.pickUp.submitOrderInstruction.paid
173
+ } : null
174
+ }
175
+ }
176
+ };
177
+ }, u = (t) => ({
178
+ canTakeaway: e.takeaway.enabled,
179
+ dineIn: t,
180
+ menuItem: e.menuItem,
181
+ coverImageLandscape: e.coverImageLandscape,
182
+ coverImagePortrait: e.coverImagePortrait,
183
+ otaChannel: e.otaChannel || void 0,
184
+ paymentSetting: c(e.paymentSetting),
185
+ takeaway: e.takeaway.submitOrderInstruction ? {
186
+ submitOrderInstruction: {
187
+ payAtCounter: e.takeaway.submitOrderInstruction.payAtCounter ? {
188
+ en: e.takeaway.submitOrderInstruction.payAtCounter
189
+ } : null,
190
+ paid: e.takeaway.submitOrderInstruction.paid ? {
191
+ en: e.takeaway.submitOrderInstruction.paid
192
+ } : null
193
+ }
194
+ } : void 0
195
+ }), c = (t) => ({
196
+ paymentTypes: t.paymentTypes,
197
+ offlinePaymentTypes: t.offlinePaymentTypes,
198
+ ePaymentTypes: t.ePaymentTypes
199
+ });
200
+ return e.dineIn.enabled ? {
201
+ kioskSettings: u(a(e.dineIn)),
202
+ kioskDineIn: e.dineIn.sequenceNumber
203
+ } : {
204
+ kioskSettings: u()
205
+ };
206
+ }, $ = {
207
+ convertOrderSettingDto: fe,
208
+ toOrderKioskSettingsDto: _e
209
+ }, Pe = oe("orderSetting", () => {
210
+ const e = v({});
211
+ async function a() {
212
+ const l = await N.getOrderSetting();
213
+ c(l);
214
+ }
215
+ async function u() {
216
+ if (e.value.orderSetting && e.value.kiosk) {
217
+ const { _id: l, ...o } = e.value.orderSetting, p = $.toOrderKioskSettingsDto(e.value.kiosk), r = {
218
+ ...o,
219
+ kioskSettings: p.kioskSettings
220
+ }, s = await N.updateOrderSetting(r);
221
+ c(s);
222
+ }
223
+ }
224
+ function c(l) {
225
+ e.value.orderSetting = l, e.value.kiosk = $.convertOrderSettingDto(l).kiosk;
226
+ }
227
+ function t(l) {
228
+ e.value.kiosk = l;
229
+ }
230
+ return {
231
+ state: e.value,
232
+ getSetting: a,
233
+ updateKioskSetting: u,
234
+ setKioskOrderSetting: t
235
+ };
236
+ }), we = { class: "py-[1.5rem]" }, Ce = { class: "px-[1.5rem]" }, Ie = { class: "pt-[1.5rem]" }, he = { class: "flex flex-col gap-10" }, Ae = { class: "flex flex-col gap-2" }, xe = { class: "fm-typo-en-title-sm-600" }, Ke = { class: "fm-typo-en-title-sm-400" }, Me = /* @__PURE__ */ B({
237
+ __name: "KioskView",
238
+ setup(e) {
239
+ var R, D;
240
+ const { t: a } = H(), { canManageOrderSetting: u } = ce(), c = O(
241
+ () => import("./KioskSettingView-DUUr39PJ.js")
242
+ ), t = v("device"), l = k(), o = Pe(), p = ae(), { currentRestaurant: r, restaurants: s, changeRestaurant: b } = ne(), f = te(), i = v(((R = r.value) == null ? void 0 : R._id) ?? void 0), C = v(null), j = x(() => s.value.map((n) => ({
243
+ label: n.profile.name,
244
+ value: n._id
245
+ }))), _ = v(((D = r.value) == null ? void 0 : D._id) ?? "");
246
+ async function F(n) {
247
+ const y = s.value.find((h) => h._id == n);
248
+ await b(y), await q(), i.value = n, _.value = n;
249
+ }
250
+ async function q() {
251
+ if (u.value)
252
+ try {
253
+ await o.getSetting();
254
+ } catch {
255
+ }
256
+ await I();
257
+ }
258
+ async function I() {
259
+ C.value = null;
260
+ try {
261
+ await l.getDevices();
262
+ } catch (n) {
263
+ C.value = n instanceof M && n.status === 403 ? "forbidden" : "error";
264
+ }
265
+ }
266
+ const z = x(() => {
267
+ const n = [{ label: a("order.deviceBinding"), value: "device" }];
268
+ return u.value && n.push({ label: a("order.settings"), value: "setting" }), n;
269
+ }), G = x(() => l.state.devices);
270
+ async function J() {
271
+ try {
272
+ await l.requestOtp();
273
+ } catch (n) {
274
+ f.open({
275
+ title: n instanceof M && n.status === 403 ? a("order.bindDevicePermissionDenied") : a("order.bindDeviceFailed"),
276
+ type: "error"
277
+ });
278
+ return;
279
+ }
280
+ p.open({
281
+ title: re(a("order.bindDevice")),
282
+ contentComponent: me,
283
+ contentComponentProps: {
284
+ otp: l.state.otp
285
+ }
286
+ }).onClose(async () => {
287
+ await I();
288
+ });
289
+ }
290
+ async function X(n) {
291
+ try {
292
+ o.setKioskOrderSetting(n), await o.updateKioskSetting(), f.open({
293
+ title: a("order.kioskSettingSuccess"),
294
+ type: "success"
295
+ });
296
+ } catch {
297
+ f.open({
298
+ title: a("order.kioskSettingFailed"),
299
+ type: "error"
300
+ });
301
+ }
302
+ }
303
+ return g(async () => {
304
+ var n;
305
+ (n = r.value) != null && n._id && (_.value = r.value._id, await q());
306
+ }), S(
307
+ () => s.value.length,
308
+ async (n) => {
309
+ i.value === void 0 && s.value.length > 0 && await F(s.value[0]._id);
310
+ },
311
+ { immediate: !0 }
312
+ ), (n, y) => {
313
+ const h = K("FmPageHead"), Y = K("FmTabs"), Z = K("FmSelect");
314
+ return P(), E("div", we, [
315
+ T(h, {
316
+ title: d(a)("order.kiosk")
317
+ }, null, 8, ["title"]),
318
+ m("div", Ce, [
319
+ T(Y, {
320
+ "model-value": t.value,
321
+ "onUpdate:modelValue": y[0] || (y[0] = (A) => t.value = A),
322
+ items: z.value
323
+ }, null, 8, ["model-value", "items"]),
324
+ m("div", Ie, [
325
+ m("div", he, [
326
+ m("div", Ae, [
327
+ m("span", xe, w(d(a)("order.activateLocation")), 1),
328
+ m("span", Ke, w(d(a)("order.selectRestaurant")) + ": ", 1),
329
+ T(Z, {
330
+ class: "w-1/2",
331
+ modelValue: i.value,
332
+ "onUpdate:modelValue": [
333
+ y[1] || (y[1] = (A) => i.value = A),
334
+ F
335
+ ],
336
+ items: j.value,
337
+ placeholder: d(a)("order.selectItem")
338
+ }, null, 8, ["modelValue", "items", "placeholder"])
339
+ ]),
340
+ t.value == "device" ? (P(), V(ee, {
341
+ key: 0,
342
+ devices: G.value,
343
+ "load-error": C.value,
344
+ onRequestOtp: J,
345
+ onRetry: I
346
+ }, null, 8, ["devices", "load-error"])) : L("", !0),
347
+ t.value == "setting" && d(u) ? (P(), V(d(c), {
348
+ key: `KioskSettingView-${_.value}`,
349
+ "restaurant-id": _.value,
350
+ onUpdateKioskOrderSetting: X,
351
+ form: d(o).state.kiosk ?? d(ye)
352
+ }, null, 8, ["restaurant-id", "form"])) : L("", !0)
353
+ ])
354
+ ])
355
+ ])
356
+ ]);
357
+ };
358
+ }
359
+ });
360
+ export {
361
+ Me as default
362
+ };