@feedmepos/mf-order-setting 0.0.70-prod → 0.0.71-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.
- package/dist/{KioskDevicesView-6ADPwAez.js → KioskDevicesView-Bc8fuTjT.js} +1 -1
- package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BBoONzyB.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-jWYfHX2m.js} +3 -3
- package/dist/{KioskSettingView-BhqV4Y53.js → KioskSettingView-DEGMTl5F.js} +3 -3
- package/dist/{KioskView-D7BdhS6J.js → KioskView-McbIIcey.js} +4 -4
- package/dist/{OrderSettingsView-DVWn3z4D.js → OrderSettingsView-c2QeY1Fm.js} +10985 -10866
- package/dist/{app-CMmf-Znb.js → app-fjbo1GoG.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-C7u6rs7Y.js → dayjs.min-i2OlzvqK.js} +1 -1
- package/dist/frontend/mf-order/src/api/remoteOrder/index.d.ts +5 -2
- package/dist/frontend/mf-order/src/stores/restaurant/index.d.ts +5 -2
- package/dist/frontend/mf-order/src/views/order-settings/delivery/DeliverySetting.vue.d.ts +2 -2
- package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/delivery/delivery.data.d.ts +3 -1
- package/dist/frontend/mf-order/src/views/order-settings/delivery/integrated-delivery/GoFoodSetting.vue.d.ts +46 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/index-D51wVlZp.js +630 -0
- package/dist/{index-BXju8gUv.js → index-WVZqUcjG.js} +1 -1
- package/dist/{queue-transfer.dto-DTfr17-h.js → queue-transfer.dto-DWb04eFa.js} +1 -1
- package/package.json +1 -1
- package/src/api/remoteOrder/index.ts +14 -1
- package/src/stores/restaurant/index.ts +5 -0
- package/src/views/order-settings/delivery/DeliverySetting.vue +60 -2
- package/src/views/order-settings/delivery/delivery.data.ts +12 -1
- package/src/views/order-settings/delivery/delivery.ts +2 -1
- package/src/views/order-settings/delivery/integrated-delivery/GoFoodSetting.vue +101 -0
- package/vite.config.ts +1 -0
- package/dist/index-DJHJUdYS.js +0 -614
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
import { defineComponent as Q, ref as $, resolveComponent as O, openBlock as g, createElementBlock as _, createElementVNode as h, toDisplayString as C, createVNode as T, unref as R, createBlock as j, computed as A, watch as oe, onMounted as se, withCtx as M, createTextVNode as le, createCommentVNode as S, Fragment as ae, renderList as ue, renderSlot as ie } from "vue";
|
|
2
|
+
import { e as w } from "./app-fjbo1GoG.js";
|
|
3
|
+
import { useDialog as de, useSnackbar as ce } from "@feedmepos/ui-library";
|
|
4
|
+
import { useI18n as B, useCoreStore as ne } from "@feedmepos/mf-common";
|
|
5
|
+
import { defineStore as pe } from "pinia";
|
|
6
|
+
import { r as k, g as n, w as I, S as z, f as q } from "./queue-transfer.dto-DWb04eFa.js";
|
|
7
|
+
const ye = /* @__PURE__ */ Q({
|
|
8
|
+
__name: "OfflinePaymentTypeDialogContent",
|
|
9
|
+
props: {
|
|
10
|
+
name: {},
|
|
11
|
+
instruction: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["update:nameValue", "update:instructionValue"],
|
|
14
|
+
setup(e, { emit: a }) {
|
|
15
|
+
const { t: l } = B(), d = e, m = a, p = $("");
|
|
16
|
+
function o(P) {
|
|
17
|
+
m("update:nameValue", P);
|
|
18
|
+
}
|
|
19
|
+
function y(P) {
|
|
20
|
+
m("update:instructionValue", P);
|
|
21
|
+
}
|
|
22
|
+
return (P, f) => {
|
|
23
|
+
const V = O("FmTextField"), x = O("FmTextarea");
|
|
24
|
+
return g(), _("div", null, [
|
|
25
|
+
h("span", null, C(d.name), 1),
|
|
26
|
+
T(V, {
|
|
27
|
+
"model-value": p.value,
|
|
28
|
+
"onUpdate:modelValue": o,
|
|
29
|
+
placeholder: R(l)("order.enterPaymentName"),
|
|
30
|
+
rules: [(D) => !!D || R(l)("order.fieldCannotBeEmpty")]
|
|
31
|
+
}, null, 8, ["model-value", "placeholder", "rules"]),
|
|
32
|
+
f[0] || (f[0] = h("div", { class: "mb-12" }, null, -1)),
|
|
33
|
+
h("span", null, C(d.instruction), 1),
|
|
34
|
+
T(x, {
|
|
35
|
+
"model-value": p.value,
|
|
36
|
+
"onUpdate:modelValue": y,
|
|
37
|
+
placeholder: R(l)("order.enterPaymentInstruction")
|
|
38
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
39
|
+
]);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}), fe = /* @__PURE__ */ Q({
|
|
43
|
+
__name: "OfflinePaymentTypeDialog",
|
|
44
|
+
emits: ["add:offline-payment-type"],
|
|
45
|
+
setup(e, { emit: a }) {
|
|
46
|
+
const { t: l } = B(), d = de(), m = $(""), p = $(""), o = () => {
|
|
47
|
+
m.value = "", p.value = "", d.open({
|
|
48
|
+
title: l("order.addCustomPayment"),
|
|
49
|
+
contentComponent: ye,
|
|
50
|
+
contentComponentProps: {
|
|
51
|
+
name: l("order.name"),
|
|
52
|
+
instruction: l("order.instruction"),
|
|
53
|
+
"onUpdate:nameValue": (f) => {
|
|
54
|
+
m.value = f;
|
|
55
|
+
},
|
|
56
|
+
"onUpdate:instructionValue": (f) => {
|
|
57
|
+
p.value = f;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
primaryActions: { text: l("order.add"), close: !0 },
|
|
61
|
+
secondaryActions: { text: l("order.cancel"), close: !0 }
|
|
62
|
+
}).onPrimary(async () => {
|
|
63
|
+
const f = {
|
|
64
|
+
name: m.value,
|
|
65
|
+
instruction: p.value
|
|
66
|
+
};
|
|
67
|
+
await y(f);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
async function y(f) {
|
|
71
|
+
P("add:offline-payment-type", f);
|
|
72
|
+
}
|
|
73
|
+
const P = a;
|
|
74
|
+
return (f, V) => {
|
|
75
|
+
const x = O("FmButton");
|
|
76
|
+
return g(), j(x, {
|
|
77
|
+
label: R(l)("order.editOfflinePayment"),
|
|
78
|
+
onClick: o,
|
|
79
|
+
variant: "plain"
|
|
80
|
+
}, null, 8, ["label"]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}), me = { class: "flex flex-col gap-3" }, ve = { class: "flex-grow fm-typo-en-title-sm-600" }, ge = { class: "flex flex-row items-center" }, we = { key: 0 }, he = { key: 0 }, Pe = { class: "font-bold" }, be = { class: "mt-3" }, _e = {
|
|
84
|
+
key: 1,
|
|
85
|
+
class: "text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7"
|
|
86
|
+
}, Te = {
|
|
87
|
+
key: 2,
|
|
88
|
+
class: "ml-7"
|
|
89
|
+
}, De = {
|
|
90
|
+
key: 1,
|
|
91
|
+
class: "text-fm-color-secondary-salmon fm-typo-en-body-sm-600 ml-7"
|
|
92
|
+
}, ke = /* @__PURE__ */ Q({
|
|
93
|
+
__name: "PaymentType",
|
|
94
|
+
props: {
|
|
95
|
+
paymentTypes: {
|
|
96
|
+
type: Array,
|
|
97
|
+
required: !0
|
|
98
|
+
},
|
|
99
|
+
offlinePaymentTypes: {
|
|
100
|
+
type: Array,
|
|
101
|
+
required: !0
|
|
102
|
+
},
|
|
103
|
+
showDisabledOptions: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: !1
|
|
106
|
+
},
|
|
107
|
+
disabledSuffixes: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: () => ({})
|
|
110
|
+
},
|
|
111
|
+
allowEPayment: {
|
|
112
|
+
type: [Boolean, String],
|
|
113
|
+
required: !0
|
|
114
|
+
},
|
|
115
|
+
allowCredit: {
|
|
116
|
+
type: [Boolean, String],
|
|
117
|
+
default: !1
|
|
118
|
+
},
|
|
119
|
+
maxCustomPayment: {
|
|
120
|
+
type: Number,
|
|
121
|
+
default: void 0
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
emits: ["update:paymentTypes", "update:offlinePaymentTypes"],
|
|
125
|
+
setup(e, { emit: a }) {
|
|
126
|
+
const { t: l } = B(), { currentRestaurant: d, namespace: m } = ne(), p = A(() => m.value === "dev"), o = e, y = a;
|
|
127
|
+
async function P(t) {
|
|
128
|
+
y(
|
|
129
|
+
"update:offlinePaymentTypes",
|
|
130
|
+
o.offlinePaymentTypes.filter((r, u) => u !== t)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
const f = A(() => (o.paymentTypes || []).includes(w.F_ORDER_PAYMENT_TYPE.enum.ePayment)), V = A(() => (o.paymentTypes || []).includes(w.F_ORDER_PAYMENT_TYPE.enum.credit)), x = A(() => {
|
|
134
|
+
const t = o.paymentTypes || [], r = o.offlinePaymentTypes || [];
|
|
135
|
+
return t.includes(w.F_ORDER_PAYMENT_TYPE.enum.cash) || r.length > 0;
|
|
136
|
+
}), D = $(!1), c = $([]), i = A(() => [
|
|
137
|
+
{ label: l("order.offlinePayment"), value: "offline" },
|
|
138
|
+
{
|
|
139
|
+
label: l("order.ePayment"),
|
|
140
|
+
value: "e-payment",
|
|
141
|
+
disable: !o.allowEPayment,
|
|
142
|
+
suffix: !o.allowEPayment && o.showDisabledOptions ? {
|
|
143
|
+
text: `(${o.disabledSuffixes["e-payment"] || l("order.notAllowed")})`,
|
|
144
|
+
class: "text-negative t-system"
|
|
145
|
+
} : void 0
|
|
146
|
+
},
|
|
147
|
+
...p.value ? [{
|
|
148
|
+
label: l("order.credit"),
|
|
149
|
+
value: "credit",
|
|
150
|
+
disable: !o.allowCredit,
|
|
151
|
+
suffix: !o.allowCredit && o.showDisabledOptions ? {
|
|
152
|
+
text: `(${o.disabledSuffixes.credit || l("order.notAllowed")})`,
|
|
153
|
+
class: "text-negative t-system"
|
|
154
|
+
} : void 0
|
|
155
|
+
}] : []
|
|
156
|
+
]), N = () => {
|
|
157
|
+
const t = [];
|
|
158
|
+
x.value && t.push("offline"), f.value && t.push("e-payment"), p.value && V.value && t.push("credit"), c.value = t;
|
|
159
|
+
let r = 0;
|
|
160
|
+
o.showDisabledOptions ? r = i.value.length : r = i.value.filter((u) => !(u.value === "e-payment" && !o.allowEPayment || u.value === "credit" && !o.allowCredit)).length, D.value = t.length === r && t.length > 0;
|
|
161
|
+
};
|
|
162
|
+
N();
|
|
163
|
+
const L = (t) => {
|
|
164
|
+
const r = i.value.filter((v) => !(v.value === "e-payment" && !o.allowEPayment || v.value === "credit" && !o.allowCredit));
|
|
165
|
+
c.value = t ? r.map((v) => v.value) : [], D.value = t;
|
|
166
|
+
const u = [], F = t ? o.offlinePaymentTypes || [] : [];
|
|
167
|
+
c.value.includes("e-payment") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.ePayment), c.value.includes("offline") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.cash), c.value.includes("credit") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.credit), y("update:paymentTypes", u), y("update:offlinePaymentTypes", F);
|
|
168
|
+
}, Y = (t) => {
|
|
169
|
+
c.value = t, o.showDisabledOptions ? i.value.length : i.value.filter((v) => !(v.value === "e-payment" && !o.allowEPayment || v.value === "credit" && !o.allowCredit)).length;
|
|
170
|
+
const r = i.value.filter((v) => !(v.value === "e-payment" && !o.allowEPayment || v.value === "credit" && !o.allowCredit)).length;
|
|
171
|
+
D.value = t.length === r && t.length > 0;
|
|
172
|
+
const u = [], F = t.includes("offline") ? o.offlinePaymentTypes || [] : [];
|
|
173
|
+
t.includes("e-payment") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.ePayment), t.includes("offline") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.cash), t.includes("credit") && u.push(w.F_ORDER_PAYMENT_TYPE.enum.credit), y("update:paymentTypes", u), y("update:offlinePaymentTypes", F);
|
|
174
|
+
};
|
|
175
|
+
return oe(
|
|
176
|
+
() => d.value,
|
|
177
|
+
(t) => {
|
|
178
|
+
N();
|
|
179
|
+
},
|
|
180
|
+
{ immediate: !0 }
|
|
181
|
+
), se(() => {
|
|
182
|
+
N();
|
|
183
|
+
}), (t, r) => {
|
|
184
|
+
var W, H, J, K, X, Z, ee;
|
|
185
|
+
const u = O("FmCheckbox"), F = O("FmCardSection"), v = O("FmCard"), re = O("FmButton");
|
|
186
|
+
return g(), _("div", me, [
|
|
187
|
+
h("div", ve, C(R(l)("order.acceptedPayment")), 1),
|
|
188
|
+
T(u, {
|
|
189
|
+
value: "",
|
|
190
|
+
"model-value": D.value,
|
|
191
|
+
label: R(l)("order.all"),
|
|
192
|
+
indeterminate: c.value.length > 0 && !D.value,
|
|
193
|
+
"onUpdate:modelValue": L
|
|
194
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
195
|
+
h("div", ge, [
|
|
196
|
+
T(u, {
|
|
197
|
+
modelValue: c.value,
|
|
198
|
+
"onUpdate:modelValue": [
|
|
199
|
+
r[0] || (r[0] = (b) => c.value = b),
|
|
200
|
+
Y
|
|
201
|
+
],
|
|
202
|
+
label: i.value[0].label,
|
|
203
|
+
value: i.value[0].value
|
|
204
|
+
}, null, 8, ["modelValue", "label", "value"])
|
|
205
|
+
]),
|
|
206
|
+
c.value.includes(i.value[0].value) ? (g(), _("div", we, [
|
|
207
|
+
((W = e.offlinePaymentTypes) == null ? void 0 : W.length) === 0 ? (g(), _("div", he, [
|
|
208
|
+
T(v, { variant: "outlined" }, {
|
|
209
|
+
default: M(() => [
|
|
210
|
+
T(F, null, {
|
|
211
|
+
default: M(() => [
|
|
212
|
+
le(C(R(l)("order.cash")), 1)
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
})
|
|
216
|
+
]),
|
|
217
|
+
_: 1
|
|
218
|
+
})
|
|
219
|
+
])) : S("", !0),
|
|
220
|
+
(g(!0), _(ae, null, ue(e.offlinePaymentTypes, (b, te) => (g(), _("p", { key: te }, [
|
|
221
|
+
T(v, {
|
|
222
|
+
variant: "outlined",
|
|
223
|
+
class: "mb-3"
|
|
224
|
+
}, {
|
|
225
|
+
default: M(() => [
|
|
226
|
+
T(F, { class: "flex items-center justify-between" }, {
|
|
227
|
+
default: M(() => [
|
|
228
|
+
h("div", null, [
|
|
229
|
+
h("span", Pe, C(b.name), 1),
|
|
230
|
+
r[4] || (r[4] = h("br", null, null, -1)),
|
|
231
|
+
h("span", null, C(b.instruction), 1)
|
|
232
|
+
]),
|
|
233
|
+
h("div", null, [
|
|
234
|
+
T(re, {
|
|
235
|
+
"append-icon": "delete",
|
|
236
|
+
variant: "plain",
|
|
237
|
+
onClick: (Ce) => P(te)
|
|
238
|
+
}, null, 8, ["onClick"])
|
|
239
|
+
])
|
|
240
|
+
]),
|
|
241
|
+
_: 2
|
|
242
|
+
}, 1024)
|
|
243
|
+
]),
|
|
244
|
+
_: 2
|
|
245
|
+
}, 1024)
|
|
246
|
+
]))), 128)),
|
|
247
|
+
h("div", be, [
|
|
248
|
+
e.offlinePaymentTypes.length === 0 || e.showDisabledOptions ? (g(), j(fe, {
|
|
249
|
+
key: 0,
|
|
250
|
+
"onAdd:offlinePaymentType": r[1] || (r[1] = (b) => y("update:offlinePaymentTypes", [...o.offlinePaymentTypes, b]))
|
|
251
|
+
})) : S("", !0)
|
|
252
|
+
])
|
|
253
|
+
])) : S("", !0),
|
|
254
|
+
T(u, {
|
|
255
|
+
modelValue: c.value,
|
|
256
|
+
"onUpdate:modelValue": [
|
|
257
|
+
r[2] || (r[2] = (b) => c.value = b),
|
|
258
|
+
Y
|
|
259
|
+
],
|
|
260
|
+
label: i.value[1].label,
|
|
261
|
+
value: i.value[1].value,
|
|
262
|
+
disabled: i.value[1].disable
|
|
263
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
264
|
+
i.value[1].suffix ? (g(), _("div", _e, C((K = (J = (H = i.value) == null ? void 0 : H[1]) == null ? void 0 : J.suffix) == null ? void 0 : K.text), 1)) : S("", !0),
|
|
265
|
+
c.value.includes("e-payment") ? (g(), _("div", Te, [
|
|
266
|
+
ie(t.$slots, "e-payment-content")
|
|
267
|
+
])) : S("", !0),
|
|
268
|
+
p.value ? (g(), _(ae, { key: 3 }, [
|
|
269
|
+
e.allowCredit || e.showDisabledOptions ? (g(), j(u, {
|
|
270
|
+
key: 0,
|
|
271
|
+
modelValue: c.value,
|
|
272
|
+
"onUpdate:modelValue": [
|
|
273
|
+
r[3] || (r[3] = (b) => c.value = b),
|
|
274
|
+
Y
|
|
275
|
+
],
|
|
276
|
+
label: i.value[2].label,
|
|
277
|
+
value: i.value[2].value,
|
|
278
|
+
disabled: i.value[2].disable
|
|
279
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"])) : S("", !0),
|
|
280
|
+
i.value[2].suffix ? (g(), _("div", De, C((ee = (Z = (X = i.value) == null ? void 0 : X[2]) == null ? void 0 : Z.suffix) == null ? void 0 : ee.text), 1)) : S("", !0)
|
|
281
|
+
], 64)) : S("", !0)
|
|
282
|
+
]);
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}), U = {
|
|
286
|
+
async readRestaurantSetting(e) {
|
|
287
|
+
const a = await I().get(`/restaurants/${e}/restaurant-setting`);
|
|
288
|
+
return n(a);
|
|
289
|
+
},
|
|
290
|
+
async updateDineInSetting(e) {
|
|
291
|
+
const a = await k().put("/dine-in", e);
|
|
292
|
+
return n(a);
|
|
293
|
+
},
|
|
294
|
+
async updatePickupSetting(e) {
|
|
295
|
+
const a = await k().put("/pickup", e);
|
|
296
|
+
return n(a);
|
|
297
|
+
},
|
|
298
|
+
async updateDriveThruSetting(e) {
|
|
299
|
+
const a = await k().put("/drive-thru", e);
|
|
300
|
+
return n(a);
|
|
301
|
+
},
|
|
302
|
+
async updateServiceCharge(e) {
|
|
303
|
+
const a = await k().put("/service-charge-setting", e);
|
|
304
|
+
return n(a);
|
|
305
|
+
},
|
|
306
|
+
async getMobileOrderSetting() {
|
|
307
|
+
return await n(await k().get("/order-settings"));
|
|
308
|
+
},
|
|
309
|
+
async updateQueueSetting(e, a) {
|
|
310
|
+
const l = await k().put("/queue", a);
|
|
311
|
+
return n(l);
|
|
312
|
+
}
|
|
313
|
+
}, s = (e) => {
|
|
314
|
+
const a = `/${e}`;
|
|
315
|
+
return I(a, "portal");
|
|
316
|
+
}, G = () => {
|
|
317
|
+
const e = z.getRestaurantId();
|
|
318
|
+
if (!e) throw new Error("Invalid restaurant ID");
|
|
319
|
+
const { linkedDeliveryBackend: a } = z.getBackendUrl(), l = `${a}/restaurants/${e}/linked-deliveries`;
|
|
320
|
+
return I("", "portal", { url: l });
|
|
321
|
+
}, E = {
|
|
322
|
+
async readLinkedDeliveryCompanies() {
|
|
323
|
+
return n(await G().get(""));
|
|
324
|
+
},
|
|
325
|
+
async readLocalDeliveryCompanies() {
|
|
326
|
+
return n(await I().get("/deliveries"));
|
|
327
|
+
},
|
|
328
|
+
async createDeliveryCompany(e) {
|
|
329
|
+
return n(await G().post("", e));
|
|
330
|
+
},
|
|
331
|
+
async updateDeliveryCompany(e) {
|
|
332
|
+
return n(await G().put(`/${e._id}`, e));
|
|
333
|
+
},
|
|
334
|
+
async deleteDeliveryCompany(e) {
|
|
335
|
+
return n(await G().delete(`/${e._id}`));
|
|
336
|
+
},
|
|
337
|
+
integratedDelivery: {
|
|
338
|
+
async updateInhouse(e, a) {
|
|
339
|
+
return n(await I().put(`/restaurants/${e}/in-house-delivery`, a));
|
|
340
|
+
},
|
|
341
|
+
async updateFeedme(e, a) {
|
|
342
|
+
return n(await I().put(`/restaurants/${e}/feedme-delivery`, a));
|
|
343
|
+
},
|
|
344
|
+
async readFoodpanda(e) {
|
|
345
|
+
return n(await s("foodpanda").get(`/setting/${e}`));
|
|
346
|
+
},
|
|
347
|
+
async readFoodpandaOrders(e) {
|
|
348
|
+
return n(await s("foodpanda").get("/order", { params: e }));
|
|
349
|
+
},
|
|
350
|
+
async reflowFoodpandaOrders(e) {
|
|
351
|
+
return n(await s("foodpanda").put(`/order/reflow/${e}`));
|
|
352
|
+
},
|
|
353
|
+
async rejectFoodpandaOrders(e) {
|
|
354
|
+
return n(await s("foodpanda").put(`/order/void/${e}`));
|
|
355
|
+
},
|
|
356
|
+
async updateFoodpanda(e, a) {
|
|
357
|
+
return n(await s("foodpanda").put(`/setting/${e}`, {
|
|
358
|
+
_id: e,
|
|
359
|
+
...a
|
|
360
|
+
}));
|
|
361
|
+
},
|
|
362
|
+
async syncFoodpandaMenu(e) {
|
|
363
|
+
return n(await s("foodpanda").put(`/menu-sync/${e}`));
|
|
364
|
+
},
|
|
365
|
+
async readGrabfood(e) {
|
|
366
|
+
return n(await s("grabfood").get(`/setting/${e}`));
|
|
367
|
+
},
|
|
368
|
+
async readGrabfoodOrders(e) {
|
|
369
|
+
return n(await s("grabfood").get("/order", { params: e }));
|
|
370
|
+
},
|
|
371
|
+
async reflowGrabfoodOrders(e) {
|
|
372
|
+
return n(await s("grabfood").put(`/order/reflow/${e}`));
|
|
373
|
+
},
|
|
374
|
+
async rejectGrabfoodOrders(e) {
|
|
375
|
+
return n(await s("grabfood").put(`/order/void/${e}`));
|
|
376
|
+
},
|
|
377
|
+
async updateGrabfood(e, a) {
|
|
378
|
+
return n(await s("grabfood").put(`/setting/${e}`, {
|
|
379
|
+
_id: e,
|
|
380
|
+
...a
|
|
381
|
+
}));
|
|
382
|
+
},
|
|
383
|
+
async syncGrabfoodMenu(e) {
|
|
384
|
+
return n(await s("grabfood").get(`/menu-sync/${e}`));
|
|
385
|
+
},
|
|
386
|
+
async startSelfServeFlow(e) {
|
|
387
|
+
return n(await s("grabfood").get(`/setting/integration-url/${e}`));
|
|
388
|
+
},
|
|
389
|
+
async readShopeefood(e) {
|
|
390
|
+
return n(await s("shopeefood").get(`/setting/${e}`));
|
|
391
|
+
},
|
|
392
|
+
async readShopeefoodOrders(e) {
|
|
393
|
+
return n(await s("shopeefood").get("/order", { params: e }));
|
|
394
|
+
},
|
|
395
|
+
async reflowShopeefoodOrders(e) {
|
|
396
|
+
return n(await s("shopeefood").put(`/order/reflow/${e}`));
|
|
397
|
+
},
|
|
398
|
+
async rejectShopeefoodOrders(e) {
|
|
399
|
+
return n(await s("shopeefood").put(`/order/void/${e}`));
|
|
400
|
+
},
|
|
401
|
+
async updateShopeefood(e, a) {
|
|
402
|
+
return n(await s("shopeefood").put(`/setting/${e}`, {
|
|
403
|
+
_id: e,
|
|
404
|
+
...a
|
|
405
|
+
}));
|
|
406
|
+
},
|
|
407
|
+
async syncShopeefoodMenu(e) {
|
|
408
|
+
return n(await s("shopeefood").get(`/menu-sync/${e}`));
|
|
409
|
+
},
|
|
410
|
+
async readGofood(e) {
|
|
411
|
+
return n(await s("gofood").get(`/setting/${e}`));
|
|
412
|
+
},
|
|
413
|
+
async updateGofood(e, a) {
|
|
414
|
+
return n(await s("gofood").put(`/setting/${e}`, {
|
|
415
|
+
...a,
|
|
416
|
+
_id: e
|
|
417
|
+
}));
|
|
418
|
+
},
|
|
419
|
+
async syncGofoodMenu(e) {
|
|
420
|
+
return n(await s("gofood").get(`/menu-sync/${e}`));
|
|
421
|
+
},
|
|
422
|
+
async updateDeliveroo(e, a) {
|
|
423
|
+
return n(await s("deliveroo").put(`/setting/${e}`, {
|
|
424
|
+
_id: e,
|
|
425
|
+
...a
|
|
426
|
+
}));
|
|
427
|
+
},
|
|
428
|
+
async readDeliveroo(e) {
|
|
429
|
+
return n(await s("deliveroo").get(`/setting/${e}`));
|
|
430
|
+
},
|
|
431
|
+
async syncDeliverooMernu(e) {
|
|
432
|
+
try {
|
|
433
|
+
return n(await s("deliveroo").get(`/menu-sync/${e}`));
|
|
434
|
+
} catch (a) {
|
|
435
|
+
throw a;
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
async readExternal(e) {
|
|
439
|
+
return n(await s("external").get(`/setting/${e}`));
|
|
440
|
+
},
|
|
441
|
+
async updateExternal(e, a) {
|
|
442
|
+
return n(await s("external").put(`setting/${e}`, {
|
|
443
|
+
...a
|
|
444
|
+
}));
|
|
445
|
+
},
|
|
446
|
+
async syncExternalMenu(e) {
|
|
447
|
+
return n(await s("external").get(`/menu-sync/${e}`));
|
|
448
|
+
},
|
|
449
|
+
async flowTestOrder(e, a) {
|
|
450
|
+
return n(
|
|
451
|
+
await s(a).put(`/test-order/${e}`)
|
|
452
|
+
);
|
|
453
|
+
},
|
|
454
|
+
async cancelTestOrder(e, a) {
|
|
455
|
+
return n(
|
|
456
|
+
await s(a).put(
|
|
457
|
+
`/test-order/cancel/${e}`
|
|
458
|
+
)
|
|
459
|
+
);
|
|
460
|
+
},
|
|
461
|
+
async reflowFpOrderNotInDb(e) {
|
|
462
|
+
return n(
|
|
463
|
+
await s("foodpanda").put("/order/reconcile", e)
|
|
464
|
+
);
|
|
465
|
+
},
|
|
466
|
+
async reflowGfOrderNotInDb(e) {
|
|
467
|
+
return n(
|
|
468
|
+
await s("grabfood").put("/order/reconcile", e)
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
function Se() {
|
|
474
|
+
return {
|
|
475
|
+
restaurantSettings: {}
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
const Ae = pe("restaurant", () => {
|
|
479
|
+
const e = ne(), a = $(Se()), l = A(() => {
|
|
480
|
+
var t;
|
|
481
|
+
return a.value.restaurantSettings[((t = e.currentRestaurant.value) == null ? void 0 : t._id) || ""];
|
|
482
|
+
});
|
|
483
|
+
async function d(t) {
|
|
484
|
+
const r = await U.readRestaurantSetting(t);
|
|
485
|
+
return a.value.restaurantSettings = {
|
|
486
|
+
...a.value.restaurantSettings,
|
|
487
|
+
[t]: r
|
|
488
|
+
}, r;
|
|
489
|
+
}
|
|
490
|
+
async function m(t) {
|
|
491
|
+
await d(t), z.setRestaurantId(t), setRestaurantId(t), q.FeatureFlag.setRestaurant(t || void 0), localStorage.set("feedme_restaurant", t);
|
|
492
|
+
}
|
|
493
|
+
async function p(t) {
|
|
494
|
+
await U.updateServiceCharge(t);
|
|
495
|
+
}
|
|
496
|
+
async function o(t) {
|
|
497
|
+
await U.updateDineInSetting(t);
|
|
498
|
+
}
|
|
499
|
+
async function y(t) {
|
|
500
|
+
await U.updatePickupSetting(t);
|
|
501
|
+
}
|
|
502
|
+
async function P(t) {
|
|
503
|
+
await U.updateDriveThruSetting(t);
|
|
504
|
+
}
|
|
505
|
+
async function f(t, r) {
|
|
506
|
+
await E.integratedDelivery.updateInhouse(t, r);
|
|
507
|
+
}
|
|
508
|
+
async function V(t, r) {
|
|
509
|
+
return await E.integratedDelivery.updateFeedme(t, r);
|
|
510
|
+
}
|
|
511
|
+
async function x(t, r) {
|
|
512
|
+
await E.integratedDelivery.updateFoodpanda(t, r);
|
|
513
|
+
}
|
|
514
|
+
async function D(t, r) {
|
|
515
|
+
await E.integratedDelivery.updateGrabfood(t, r);
|
|
516
|
+
}
|
|
517
|
+
async function c(t, r) {
|
|
518
|
+
await E.integratedDelivery.updateShopeefood(t, r);
|
|
519
|
+
}
|
|
520
|
+
async function i(t, r) {
|
|
521
|
+
await E.integratedDelivery.updateGofood(t, r);
|
|
522
|
+
}
|
|
523
|
+
async function N(t, r) {
|
|
524
|
+
await E.integratedDelivery.updateDeliveroo(t, r);
|
|
525
|
+
}
|
|
526
|
+
async function L(t, r) {
|
|
527
|
+
await E.integratedDelivery.updateExternal(t, r);
|
|
528
|
+
}
|
|
529
|
+
function Y() {
|
|
530
|
+
const { t } = B();
|
|
531
|
+
if (!e.currentRestaurant.value)
|
|
532
|
+
return "getRestaurantEPayment - Invalid restaurant ";
|
|
533
|
+
const r = e.currentRestaurant.value.payoutAccount, u = e.currentRestaurant.value.posVersion;
|
|
534
|
+
return !!u && q.Pos.canUse({
|
|
535
|
+
feature: w.F_FEATURE.enum.qrEPayment,
|
|
536
|
+
posVersion: u
|
|
537
|
+
}) ? !r || !r.enable || r.status !== w.F_PAYOUT_ACCOUNT_STATUS.enum.APPROVED ? t("order.payoutAccountIsRequired") : !0 : t("order.payoutPosVersion", { version: q.Pos.minVersionToUse(w.F_FEATURE.enum.qrEPayment) });
|
|
538
|
+
}
|
|
539
|
+
return {
|
|
540
|
+
state: a.value,
|
|
541
|
+
currentRestaurantSetting: l.value,
|
|
542
|
+
readRestaurantSetting: d,
|
|
543
|
+
selectRestaurant: m,
|
|
544
|
+
updateServiceCharge: p,
|
|
545
|
+
updateDineInSetting: o,
|
|
546
|
+
updatePickupSetting: y,
|
|
547
|
+
updateDriveThruSetting: P,
|
|
548
|
+
updateInhouseDelivery: f,
|
|
549
|
+
updateFeedmeDelivery: V,
|
|
550
|
+
updateIntegratedFoodpandaDelivery: x,
|
|
551
|
+
updateIntegratedGrabfoodDelivery: D,
|
|
552
|
+
updateIntegratedShopeefoodDelivery: c,
|
|
553
|
+
updateIntegratedGofoodDelivery: i,
|
|
554
|
+
updateIntegratedDeliverooDelivery: N,
|
|
555
|
+
updateExternalDelivery: L,
|
|
556
|
+
getRestaurantEPayment: Y
|
|
557
|
+
};
|
|
558
|
+
});
|
|
559
|
+
function Ee() {
|
|
560
|
+
const e = ce();
|
|
561
|
+
function a(o) {
|
|
562
|
+
e.open({
|
|
563
|
+
type: "success",
|
|
564
|
+
message: o,
|
|
565
|
+
position: "bottom"
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
function l(o) {
|
|
569
|
+
e.open({
|
|
570
|
+
type: "error",
|
|
571
|
+
message: o,
|
|
572
|
+
position: "bottom"
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
let d = null;
|
|
576
|
+
function m(o) {
|
|
577
|
+
return d = e.open({
|
|
578
|
+
type: "neutral",
|
|
579
|
+
spinner: !0,
|
|
580
|
+
message: o,
|
|
581
|
+
position: "bottom",
|
|
582
|
+
persistent: !0
|
|
583
|
+
// Ensure the snackbar stays visible until manually closed
|
|
584
|
+
}), d;
|
|
585
|
+
}
|
|
586
|
+
function p() {
|
|
587
|
+
d && (e.close(d), d = null);
|
|
588
|
+
}
|
|
589
|
+
return { showSuccess: a, showError: l, showLoading: m, closeLoadingSnackbar: p };
|
|
590
|
+
}
|
|
591
|
+
const Ie = () => {
|
|
592
|
+
const { showError: e } = Ee(), a = $(!1);
|
|
593
|
+
function l() {
|
|
594
|
+
a.value = !0;
|
|
595
|
+
}
|
|
596
|
+
function d() {
|
|
597
|
+
a.value = !1;
|
|
598
|
+
}
|
|
599
|
+
async function m(o) {
|
|
600
|
+
try {
|
|
601
|
+
return l(), await o();
|
|
602
|
+
} finally {
|
|
603
|
+
d();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
async function p(o) {
|
|
607
|
+
try {
|
|
608
|
+
return l(), await o();
|
|
609
|
+
} catch (y) {
|
|
610
|
+
throw e(`${y}`), y;
|
|
611
|
+
} finally {
|
|
612
|
+
d();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
isLoading: a,
|
|
617
|
+
startLoading: l,
|
|
618
|
+
stopLoading: d,
|
|
619
|
+
startAsyncCall: m,
|
|
620
|
+
startAsyncCallWithErr: p
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
export {
|
|
624
|
+
ke as _,
|
|
625
|
+
Ae as a,
|
|
626
|
+
Ee as b,
|
|
627
|
+
U as c,
|
|
628
|
+
E as r,
|
|
629
|
+
Ie as u
|
|
630
|
+
};
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
FdoExternalSetting,
|
|
8
8
|
FdoFoodpandaOrderOutput,
|
|
9
9
|
FdoFoodpandaSettings,
|
|
10
|
+
FdoGoFoodSettings,
|
|
10
11
|
FdoGrabfoodOrderOutput,
|
|
11
12
|
FdoGrabfoodSettings,
|
|
12
13
|
FdoShopeeFoodOrder,
|
|
@@ -15,7 +16,7 @@ import type {
|
|
|
15
16
|
FdtoGetOrderReq
|
|
16
17
|
} from '@entity';
|
|
17
18
|
|
|
18
|
-
type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood' | 'deliveroo' | 'external'
|
|
19
|
+
type DeliveryCompanyUrl = 'foodpanda' | 'grabfood' | 'shopeefood' | 'deliveroo' | 'gofood' | 'external'
|
|
19
20
|
|
|
20
21
|
const deliveryClientInstance = (
|
|
21
22
|
deliveryCompany: DeliveryCompanyUrl
|
|
@@ -125,6 +126,18 @@ export const remoteOrderApi = {
|
|
|
125
126
|
async syncShopeefoodMenu(storeId: string): Promise<FdoShopeeFoodSettings> {
|
|
126
127
|
return getData(await deliveryClientInstance('shopeefood').get(`/menu-sync/${storeId}`));
|
|
127
128
|
},
|
|
129
|
+
async readGofood(restaurantId: string): Promise<FdoGoFoodSettings | null> {
|
|
130
|
+
return getData(await deliveryClientInstance('gofood').get(`/setting/${restaurantId}`));
|
|
131
|
+
},
|
|
132
|
+
async updateGofood(restaurantId: string, dto: FdoGoFoodSettings): Promise<FdoGoFoodSettings | null> {
|
|
133
|
+
return getData(await deliveryClientInstance('gofood').put(`/setting/${restaurantId}`, {
|
|
134
|
+
...dto,
|
|
135
|
+
_id: restaurantId,
|
|
136
|
+
}));
|
|
137
|
+
},
|
|
138
|
+
async syncGofoodMenu(restaurantId: string): Promise<FdoGoFoodSettings> {
|
|
139
|
+
return getData(await deliveryClientInstance('gofood').get(`/menu-sync/${restaurantId}`));
|
|
140
|
+
},
|
|
128
141
|
async updateDeliveroo(restaurantId: string, dto: FdoDeliverooSettings): Promise<FdoRestaurant> {
|
|
129
142
|
return getData(await deliveryClientInstance('deliveroo').put(`/setting/${restaurantId}`, {
|
|
130
143
|
_id: restaurantId,
|