@feedmepos/mf-common 1.29.23 → 1.29.25
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/{CustomAttributesForm-34cb2e10.js → CustomAttributesForm-97319d56.js} +1 -1
- package/dist/ItemSelector-eefda1b9.js +51528 -0
- package/dist/RestaurantSelector-1352748c.js +254 -0
- package/dist/api/index.d.ts +9 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/{app-5956b5d6.js → app-594ba388.js} +6488 -6446
- package/dist/app.js +9 -9
- package/dist/components/DebugUserDialog.vue.d.ts.map +1 -1
- package/dist/components/MyBusinessDialog.vue.d.ts.map +1 -1
- package/dist/components/Portal/PortalDesktop.vue.d.ts.map +1 -1
- package/dist/components/RestaurantSelector.vue.d.ts +5 -0
- package/dist/components/RestaurantSelector.vue.d.ts.map +1 -1
- package/dist/components.d.ts +5 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/composables/usePaginatedBusinesses.d.ts +6 -0
- package/dist/composables/usePaginatedBusinesses.d.ts.map +1 -1
- package/dist/store.d.ts +81 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/ItemSelector-f6a5b9a3.js +0 -25356
- package/dist/RestaurantSelector-0a3d3f18.js +0 -244
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { ref as S, computed as o, defineComponent as ne, mergeModels as ue, useModel as re, watch as j, resolveComponent as C, openBlock as i, createElementBlock as y, createElementVNode as w, createVNode as k, withCtx as N, renderSlot as K, normalizeClass as oe, toDisplayString as se, createCommentVNode as Q, createBlock as R, withModifiers as T, unref as g, isRef as ie, Fragment as E, renderList as W, nextTick as ce } from "vue";
|
|
2
|
+
import { t as ve, u as de, a as fe, O as P, b as me } from "./app-594ba388.js";
|
|
3
|
+
import "@feedmepos/ui-library";
|
|
4
|
+
import "pinia";
|
|
5
|
+
import "vue-router";
|
|
6
|
+
function pe(f, t, c = f) {
|
|
7
|
+
const a = S(!0), v = o(() => {
|
|
8
|
+
if (!a.value && !t.value)
|
|
9
|
+
return !0;
|
|
10
|
+
if (t.value && t.value.length > 0) {
|
|
11
|
+
const u = new Set(c.value.map((n) => n.value));
|
|
12
|
+
return t.value.length === c.value.length && t.value.every((n) => u.has(n));
|
|
13
|
+
}
|
|
14
|
+
return !1;
|
|
15
|
+
}), x = o(() => {
|
|
16
|
+
var u, n, b, m;
|
|
17
|
+
return !!((u = t.value) != null && u.length && ((n = t.value) == null ? void 0 : n.length) > 0 && ((b = t.value) == null ? void 0 : b.length) < ((m = f.value) == null ? void 0 : m.length));
|
|
18
|
+
});
|
|
19
|
+
return { allCleared: a, allSelected: v, indeterminate: x, toggleAll: () => {
|
|
20
|
+
if (v.value) {
|
|
21
|
+
t.value = void 0, a.value = !0;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const u = c.value.map((n) => n.value);
|
|
25
|
+
u.length === f.value.length ? (t.value = void 0, a.value = !1) : (t.value = u, a.value = !1);
|
|
26
|
+
}, toggleOption: (u) => {
|
|
27
|
+
var b, m, F;
|
|
28
|
+
let n;
|
|
29
|
+
t.value === void 0 && a.value ? n = [u] : t.value === void 0 && !a.value ? n = (b = f.value.map((p) => p.value)) == null ? void 0 : b.filter((p) => p !== u) : (m = t.value) != null && m.includes(u) ? n = (F = t.value) == null ? void 0 : F.filter((p) => p !== u) : n = [...t.value || [], u], n.length === 0 ? (t.value = void 0, a.value = !0) : n.length === f.value.length ? (t.value = void 0, a.value = !1) : t.value = n;
|
|
30
|
+
} };
|
|
31
|
+
}
|
|
32
|
+
const ge = { class: "w-full flex flex-col gap-8" }, he = { class: "flex items-center gap-8 min-w-0" }, be = { class: "inline-flex items-center max-w-full" }, ye = { class: "flex flex-col w-[360px] min-h-0 gap-8" }, ke = { class: "flex gap-4 px-[6px]" }, _e = { class: "flex-1" }, Ce = { class: "flex-1 overflow-y-auto min-h-0" }, we = { key: 0 }, Me = /* @__PURE__ */ ne({
|
|
33
|
+
__name: "RestaurantSelector",
|
|
34
|
+
props: /* @__PURE__ */ ue({
|
|
35
|
+
multiple: { type: Boolean, default: !1 },
|
|
36
|
+
excludeRestaurants: {},
|
|
37
|
+
managableOnly: { type: Boolean, default: !0 },
|
|
38
|
+
disabled: { type: Boolean, default: !1 },
|
|
39
|
+
variant: { default: "default" },
|
|
40
|
+
autoSelectFirst: { type: Boolean, default: !1 }
|
|
41
|
+
}, {
|
|
42
|
+
modelValue: {},
|
|
43
|
+
modelModifiers: {}
|
|
44
|
+
}),
|
|
45
|
+
emits: ["update:modelValue"],
|
|
46
|
+
setup(f) {
|
|
47
|
+
const t = f, { t: c } = ve(), a = re(f, "modelValue"), { restaurants: v, restaurantAttributeSettings: x } = de(), h = o(() => v.value.length === 0);
|
|
48
|
+
function D(e) {
|
|
49
|
+
const l = v.value.map((_) => {
|
|
50
|
+
var O;
|
|
51
|
+
return (O = _.customAttributes) == null ? void 0 : O[e];
|
|
52
|
+
}).filter((_) => typeof _ == "string" && !!_);
|
|
53
|
+
return [...new Set(l)];
|
|
54
|
+
}
|
|
55
|
+
const u = o(() => x.value.map((e) => {
|
|
56
|
+
const l = D(e.key);
|
|
57
|
+
return {
|
|
58
|
+
...e,
|
|
59
|
+
values: l
|
|
60
|
+
};
|
|
61
|
+
})), { searchKey: n, filter: b } = fe(), m = S(null);
|
|
62
|
+
function F(e) {
|
|
63
|
+
var l;
|
|
64
|
+
if (t.multiple)
|
|
65
|
+
throw new Error("Single selection is not supported for multiple selection");
|
|
66
|
+
a.value = e, (l = m.value) == null || l.toggleMenu(!1);
|
|
67
|
+
}
|
|
68
|
+
const p = (e) => {
|
|
69
|
+
const { name: l, code: r } = e.profile;
|
|
70
|
+
return {
|
|
71
|
+
label: `${l} (${r ?? "--"})`,
|
|
72
|
+
value: e._id
|
|
73
|
+
};
|
|
74
|
+
}, M = o(() => v.value.map(p)), V = o(
|
|
75
|
+
() => v.value.filter((e) => t.managableOnly ? e.managable : !0).filter((e) => t.multiple ? !0 : P(e.customAttributes || {}, d.value)).map(p).filter(({ label: e }) => b([e])).filter((e) => {
|
|
76
|
+
var l;
|
|
77
|
+
return !((l = t.excludeRestaurants) != null && l.includes(e.value));
|
|
78
|
+
})
|
|
79
|
+
), q = o(() => {
|
|
80
|
+
var e;
|
|
81
|
+
return a.value ? a.value.length === 1 ? (e = M.value.find((l) => {
|
|
82
|
+
var r;
|
|
83
|
+
return l.value === ((r = a.value) == null ? void 0 : r[0]);
|
|
84
|
+
})) == null ? void 0 : e.label : c("portalshell.components.restaurantSelector.restaurantCount", {
|
|
85
|
+
count: a.value.length
|
|
86
|
+
}) : c("portalshell.components.restaurantSelector.allRestaurants");
|
|
87
|
+
}), G = o(() => {
|
|
88
|
+
var e;
|
|
89
|
+
return a.value ? ((e = M.value.find((l) => l.value === a.value)) == null ? void 0 : e.label) || c("portalshell.components.restaurantSelector.unknownRestaurant") : c("portalshell.components.restaurantSelector.selectRestaurant");
|
|
90
|
+
}), B = o(() => t.multiple ? q.value : G.value), z = o(() => t.disabled ? "neutral-gray-200" : t.variant === "dark" ? "neutral-black" : "neutral-gray-400"), H = o(() => t.disabled ? "text-fm-color-neutral-gray-200" : t.variant === "dark" ? "text-fm-color-neutral-black" : "text-fm-color-neutral-gray-400"), { allSelected: U, toggleAll: J, toggleOption: X, indeterminate: Y } = pe(
|
|
91
|
+
M,
|
|
92
|
+
a,
|
|
93
|
+
V
|
|
94
|
+
), A = S(!1), Z = o(() => x.value.length > 0), $ = S(null);
|
|
95
|
+
async function ee() {
|
|
96
|
+
t.disabled || h.value || (A.value ? A.value = !1 : (A.value = !0, await ce(), $.value && $.value.toggleProperty(!0)));
|
|
97
|
+
}
|
|
98
|
+
const d = S((() => ({
|
|
99
|
+
logic: "AND",
|
|
100
|
+
rules: []
|
|
101
|
+
}))()), le = o(() => {
|
|
102
|
+
var e, l;
|
|
103
|
+
return ((l = (e = d.value) == null ? void 0 : e.rules) == null ? void 0 : l.length) || 0;
|
|
104
|
+
});
|
|
105
|
+
return j(
|
|
106
|
+
d,
|
|
107
|
+
() => {
|
|
108
|
+
var e;
|
|
109
|
+
if (t.multiple) {
|
|
110
|
+
if (!d.value || d.value.rules.length === 0) {
|
|
111
|
+
a.value = null;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const l = v.value.filter((r) => P(r.customAttributes || {}, d.value));
|
|
115
|
+
a.value = l.map((r) => r._id);
|
|
116
|
+
} else {
|
|
117
|
+
const l = v.value.filter((r) => P(r.customAttributes || {}, d.value));
|
|
118
|
+
l.length === 0 ? a.value = null : a.value = (e = l[0]) == null ? void 0 : e._id;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
deep: !0
|
|
123
|
+
}
|
|
124
|
+
), j(
|
|
125
|
+
[() => t.autoSelectFirst, V],
|
|
126
|
+
([e, l]) => {
|
|
127
|
+
e && l.length > 0 && !a.value && (a.value = l[0].value);
|
|
128
|
+
},
|
|
129
|
+
{ immediate: !0 }
|
|
130
|
+
), (e, l) => {
|
|
131
|
+
const r = C("FmIcon"), _ = C("FmCircularProgress"), O = C("FmChip"), te = C("FmSearch"), L = C("FmMenuItem"), ae = C("FmMenu");
|
|
132
|
+
return i(), y("div", ge, [
|
|
133
|
+
w("div", he, [
|
|
134
|
+
k(ae, {
|
|
135
|
+
class: "min-w-0",
|
|
136
|
+
"close-on-click": !1,
|
|
137
|
+
disabled: e.disabled || h.value,
|
|
138
|
+
ref_key: "menuRef",
|
|
139
|
+
ref: m,
|
|
140
|
+
"z-index": 50,
|
|
141
|
+
"selector-for-dismiss-away-event-exclusion": ".fm-dialog, .fm-select__menu__wrapper"
|
|
142
|
+
}, {
|
|
143
|
+
"menu-button": N(() => [
|
|
144
|
+
K(e.$slots, "menu-button", {
|
|
145
|
+
disabled: e.disabled || h.value,
|
|
146
|
+
isLoading: h.value,
|
|
147
|
+
label: B.value
|
|
148
|
+
}, () => [
|
|
149
|
+
w("div", be, [
|
|
150
|
+
k(O, {
|
|
151
|
+
disabled: e.disabled || h.value,
|
|
152
|
+
class: "max-w-full overflow-hidden"
|
|
153
|
+
}, {
|
|
154
|
+
default: N(() => [
|
|
155
|
+
k(r, {
|
|
156
|
+
color: z.value,
|
|
157
|
+
name: "storefront",
|
|
158
|
+
outline: "",
|
|
159
|
+
size: "sm"
|
|
160
|
+
}, null, 8, ["color"]),
|
|
161
|
+
B.value ? (i(), y("div", {
|
|
162
|
+
key: 0,
|
|
163
|
+
class: oe([
|
|
164
|
+
"fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap",
|
|
165
|
+
H.value
|
|
166
|
+
])
|
|
167
|
+
}, se(B.value), 3)) : Q("", !0),
|
|
168
|
+
h.value ? (i(), R(_, {
|
|
169
|
+
key: 1,
|
|
170
|
+
size: "md"
|
|
171
|
+
})) : (i(), R(r, {
|
|
172
|
+
key: 2,
|
|
173
|
+
color: z.value,
|
|
174
|
+
name: "keyboard_arrow_down",
|
|
175
|
+
size: "sm"
|
|
176
|
+
}, null, 8, ["color"])),
|
|
177
|
+
Z.value ? (i(), y("div", {
|
|
178
|
+
key: 3,
|
|
179
|
+
class: "pl-8 flex items-center justify-center border-l border-fm-color-neutral-gray-200",
|
|
180
|
+
onClick: T(ee, ["stop"])
|
|
181
|
+
}, [
|
|
182
|
+
k(r, {
|
|
183
|
+
name: "filter_alt",
|
|
184
|
+
size: "sm",
|
|
185
|
+
outline: le.value === 0,
|
|
186
|
+
color: z.value,
|
|
187
|
+
onClick: l[0] || (l[0] = T(() => {
|
|
188
|
+
}, ["prevent"]))
|
|
189
|
+
}, null, 8, ["outline", "color"])
|
|
190
|
+
])) : Q("", !0)
|
|
191
|
+
]),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 8, ["disabled"])
|
|
194
|
+
])
|
|
195
|
+
])
|
|
196
|
+
]),
|
|
197
|
+
default: N(() => [
|
|
198
|
+
w("div", ye, [
|
|
199
|
+
w("div", ke, [
|
|
200
|
+
w("div", _e, [
|
|
201
|
+
k(te, {
|
|
202
|
+
modelValue: g(n),
|
|
203
|
+
"onUpdate:modelValue": l[1] || (l[1] = (s) => ie(n) ? n.value = s : null),
|
|
204
|
+
placeholder: g(c)("common.search")
|
|
205
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
206
|
+
])
|
|
207
|
+
]),
|
|
208
|
+
w("div", Ce, [
|
|
209
|
+
e.multiple ? (i(), y(E, { key: 0 }, [
|
|
210
|
+
k(L, {
|
|
211
|
+
label: "All",
|
|
212
|
+
"has-checkbox": "",
|
|
213
|
+
"model-value": g(U),
|
|
214
|
+
indeterminate: g(Y),
|
|
215
|
+
onClick: g(J)
|
|
216
|
+
}, null, 8, ["model-value", "indeterminate", "onClick"]),
|
|
217
|
+
(i(!0), y(E, null, W(V.value, (s) => {
|
|
218
|
+
var I;
|
|
219
|
+
return i(), R(L, {
|
|
220
|
+
key: s.value,
|
|
221
|
+
label: s.label,
|
|
222
|
+
"has-checkbox": "",
|
|
223
|
+
"model-value": g(U) || ((I = a.value) == null ? void 0 : I.includes(s.value)),
|
|
224
|
+
onClick: (xe) => g(X)(s.value)
|
|
225
|
+
}, null, 8, ["label", "model-value", "onClick"]);
|
|
226
|
+
}), 128))
|
|
227
|
+
], 64)) : (i(!0), y(E, { key: 1 }, W(V.value, (s) => (i(), R(L, {
|
|
228
|
+
key: s.value,
|
|
229
|
+
label: s.label,
|
|
230
|
+
onClick: (I) => F(s.value)
|
|
231
|
+
}, null, 8, ["label", "onClick"]))), 128))
|
|
232
|
+
])
|
|
233
|
+
])
|
|
234
|
+
]),
|
|
235
|
+
_: 3
|
|
236
|
+
}, 8, ["disabled"]),
|
|
237
|
+
K(e.$slots, "append-right")
|
|
238
|
+
]),
|
|
239
|
+
A.value ? (i(), y("div", we, [
|
|
240
|
+
k(g(me), {
|
|
241
|
+
ref_key: "filterRef",
|
|
242
|
+
ref: $,
|
|
243
|
+
attributes: u.value,
|
|
244
|
+
modelValue: d.value,
|
|
245
|
+
"onUpdate:modelValue": l[2] || (l[2] = (s) => d.value = s)
|
|
246
|
+
}, null, 8, ["attributes", "modelValue"])
|
|
247
|
+
])) : Q("", !0)
|
|
248
|
+
]);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
export {
|
|
253
|
+
Me as default
|
|
254
|
+
};
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AxiosInstance, type AxiosResponse } from "axios";
|
|
2
|
-
import { FdoBusiness, FdoPermissionRule, FdoRestaurant, FdoRestaurantSetting, type FdoUser, type FdoPublicSetting } from "@feedmepos/core/entity";
|
|
2
|
+
import { F_COUNTRY, FdoBusiness, FdoPermissionRule, FdoRestaurant, FdoRestaurantSetting, type FdoUser, type FdoPublicSetting } from "@feedmepos/core/entity";
|
|
3
3
|
export interface PaginatedBusinessesResponse {
|
|
4
4
|
meta: {
|
|
5
5
|
skip: number;
|
|
@@ -25,6 +25,14 @@ export declare function readIsAgent(): Promise<{
|
|
|
25
25
|
}>;
|
|
26
26
|
export declare function debugUser(phoneNumber: string): Promise<string>;
|
|
27
27
|
export declare function stopDebugUser(): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Supported countries for user registration/login, served by the account
|
|
30
|
+
* backend at `/login/supported-countries` — the same source of truth the login
|
|
31
|
+
* page uses. Goes through `accountClientInstance` for consistency with the
|
|
32
|
+
* other account calls (shared base URL + auth header + error interceptor); the
|
|
33
|
+
* debug-user dialog only invokes this from an authenticated context.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readSupportedCountries(): Promise<F_COUNTRY[]>;
|
|
28
36
|
export type PublicSettingApi = FdoPublicSetting & {
|
|
29
37
|
aiSettings: {
|
|
30
38
|
remy: {
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"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