@feedmepos/mf-payment 1.6.16-dev → 1.6.17-dev
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/{Actions.vue_vue_type_script_setup_true_lang-wXi4zlOF.js → Actions.vue_vue_type_script_setup_true_lang-DGfY2t-6.js} +1 -1
- package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-B3adh27R.js +890 -0
- package/dist/{Chargeback-CJqlNeMt.js → Chargeback-DAn-_ig0.js} +5 -5
- package/dist/{DocumentViewer.vue_vue_type_script_setup_true_lang-Ckul-6N5.js → DocumentViewer.vue_vue_type_script_setup_true_lang-BoYlG5gG.js} +1 -1
- package/dist/{OnboardForm-BXMmCslr.js → OnboardForm-CFmOBuJe.js} +5 -5
- package/dist/{OnboardForm-B4uFIDfL.js → OnboardForm-DHFAsJSI.js} +5 -5
- package/dist/{OnboardSubmission-DEdrkQIy.js → OnboardSubmission-BE9KwYCY.js} +2 -2
- package/dist/{OnboardSubmission-DTShUQzf.js → OnboardSubmission-DeB2CBUB.js} +5 -5
- package/dist/{PayoutAccount-3nq_6mVJ.js → PayoutAccount-C73lFaEx.js} +5 -5
- package/dist/{PayoutAccount-CPjDqMpd.js → PayoutAccount-DW9suPrv.js} +5 -5
- package/dist/{PayoutAccountSetting-BVgA9_0u.js → PayoutAccountSetting-LzIsoU_R.js} +6 -6
- package/dist/{Restaurant-DVj-b61o.js → Restaurant-CgxMZItP.js} +4 -4
- package/dist/{RestaurantSetting-7y0qkqkE.js → RestaurantSetting-COFAdaYk.js} +3 -3
- package/dist/{Settlement-Dg24FLXs.js → Settlement-CMUVS2mb.js} +3 -3
- package/dist/{Settlement-j77mmZXv.js → Settlement-CxSYpLHH.js} +4 -4
- package/dist/{SettlementTransactions-DqnFsNBQ.js → SettlementTransactions-BosItim0.js} +4 -4
- package/dist/{SettlementTransactions-PBQgs92s.js → SettlementTransactions-CP6daT2e.js} +4 -4
- package/dist/{Status.vue_vue_type_script_setup_true_lang-DhbTRCYM.js → Status.vue_vue_type_script_setup_true_lang-RGNNAi9t.js} +1 -1
- package/dist/{Terminal-BUDlYupd.js → Terminal-B1tijb4c.js} +5 -5
- package/dist/{TerminalSetting-CnfALKFc.js → TerminalSetting-cYSxA1sB.js} +4 -4
- package/dist/Transaction-A2Lryxwf.js +968 -0
- package/dist/{Transaction-Cvl6QATl.js → Transaction-CKAmdeTv.js} +10 -10
- package/dist/{TransactionOld-Cy2U8Hn4.js → TransactionOld-BxWF6sRD.js} +7 -7
- package/dist/api/business/index.d.ts +10 -0
- package/dist/api/restaurant/index.d.ts +7 -0
- package/dist/api/transaction/index.d.ts +5 -4
- package/dist/{app-Bv1eKatH.js → app-CKG0xR67.js} +29 -26
- package/dist/app.js +1 -1
- package/dist/{assets-DAh5KIbj.js → assets-Cfrp36Vb.js} +1 -1
- package/dist/components/AdminBusinessSelector.vue.d.ts +17 -0
- package/dist/components/AdminRestaurantSelector.vue.d.ts +1 -0
- package/dist/components/AdvancedFilter/AdvancedFilterPanel.vue.d.ts +21 -0
- package/dist/{grafana-CfbW-0Ri.js → grafana-EYkmncP1.js} +1 -1
- package/dist/{index-D_XLTy5p.js → index-Bs7nMxiZ.js} +1 -1
- package/dist/{index-FMXYkp6e.js → index-CTihFO70.js} +2 -2
- package/dist/{index-BP3lxBw_.js → index-CZqojfvs.js} +1 -1
- package/dist/{index-DyRqovBt.js → index-Cl0a8cQE.js} +1 -1
- package/dist/{index-BU3AY5BY.js → index-Cp6ofn99.js} +1 -1
- package/dist/{index-HB-taFPL.js → index-D20CJ8Ub.js} +1 -1
- package/dist/{index--DP2Qv9r.js → index-D7feQo05.js} +14 -5
- package/dist/{index-Ds4tJNkA.js → index-DNnQRgnm.js} +1 -1
- package/dist/index-Tu0z1D-j.js +27 -0
- package/dist/{index.vue_vue_type_script_setup_true_lang-BqUNz7vW.js → index.vue_vue_type_script_setup_true_lang-CKL7_NG8.js} +1 -1
- package/dist/package.json +2 -1
- package/dist/{payout-account-0jjiMCJQ.js → payout-account-C5nOcTf2.js} +3 -3
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/views/admin/transaction/composable/advancedFilter.d.ts +18 -0
- package/package.json +2 -1
- package/dist/AdminRestaurantSelector.vue_vue_type_script_setup_true_lang-CQSEq_3Z.js +0 -139
- package/dist/Transaction-C5oj2fA7.js +0 -690
- package/dist/index-AdfhP3iZ.js +0 -19
|
@@ -0,0 +1,890 @@
|
|
|
1
|
+
var Me = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
3
|
+
};
|
|
4
|
+
var ye = (t, e, s) => e.has(t) || Me("Cannot " + s);
|
|
5
|
+
var n = (t, e, s) => (ye(t, e, "read from private field"), s ? s.call(t) : e.get(t)), v = (t, e, s) => e.has(t) ? Me("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, s), u = (t, e, s, i) => (ye(t, e, "write to private field"), i ? i.call(t, s) : e.set(t, s), s), b = (t, e, s) => (ye(t, e, "access private method"), s);
|
|
6
|
+
import { isRef as tt, unref as me, hasInjectionContext as nt, inject as it, getCurrentScope as rt, computed as T, shallowReactive as ot, reactive as at, watch as Z, onScopeDispose as lt, shallowReadonly as ut, readonly as ct, toRefs as ht, defineComponent as dt, useModel as ft, toRef as pt, ref as Qe, resolveComponent as Y, openBlock as A, createBlock as oe, withCtx as ge, createVNode as Oe, createElementVNode as pe, createElementBlock as Ue, Fragment as vt, renderList as mt, toDisplayString as Ne, createCommentVNode as bt, withModifiers as yt, mergeModels as gt } from "vue";
|
|
7
|
+
import { r as we } from "./index-Tu0z1D-j.js";
|
|
8
|
+
import { useI18n as Ot } from "@feedmepos/mf-common";
|
|
9
|
+
var xe = class {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
12
|
+
}
|
|
13
|
+
subscribe(t) {
|
|
14
|
+
return this.listeners.add(t), this.onSubscribe(), () => {
|
|
15
|
+
this.listeners.delete(t), this.onUnsubscribe();
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
hasListeners() {
|
|
19
|
+
return this.listeners.size > 0;
|
|
20
|
+
}
|
|
21
|
+
onSubscribe() {
|
|
22
|
+
}
|
|
23
|
+
onUnsubscribe() {
|
|
24
|
+
}
|
|
25
|
+
}, z, D, G, Ze, wt = (Ze = class extends xe {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
v(this, z);
|
|
29
|
+
v(this, D);
|
|
30
|
+
v(this, G);
|
|
31
|
+
u(this, G, (e) => {
|
|
32
|
+
if (typeof window < "u" && window.addEventListener) {
|
|
33
|
+
const s = () => e();
|
|
34
|
+
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
35
|
+
window.removeEventListener("visibilitychange", s);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
onSubscribe() {
|
|
41
|
+
n(this, D) || this.setEventListener(n(this, G));
|
|
42
|
+
}
|
|
43
|
+
onUnsubscribe() {
|
|
44
|
+
var e;
|
|
45
|
+
this.hasListeners() || ((e = n(this, D)) == null || e.call(this), u(this, D, void 0));
|
|
46
|
+
}
|
|
47
|
+
setEventListener(e) {
|
|
48
|
+
var s;
|
|
49
|
+
u(this, G, e), (s = n(this, D)) == null || s.call(this), u(this, D, e((i) => {
|
|
50
|
+
typeof i == "boolean" ? this.setFocused(i) : this.onFocus();
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
setFocused(e) {
|
|
54
|
+
n(this, z) !== e && (u(this, z, e), this.onFocus());
|
|
55
|
+
}
|
|
56
|
+
onFocus() {
|
|
57
|
+
const e = this.isFocused();
|
|
58
|
+
this.listeners.forEach((s) => {
|
|
59
|
+
s(e);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
isFocused() {
|
|
63
|
+
var e;
|
|
64
|
+
return typeof n(this, z) == "boolean" ? n(this, z) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
|
|
65
|
+
}
|
|
66
|
+
}, z = new WeakMap(), D = new WeakMap(), G = new WeakMap(), Ze), St = new wt(), Rt = {
|
|
67
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
68
|
+
// global setTimeout etc.
|
|
69
|
+
//
|
|
70
|
+
// BAD: `setTimeout: setTimeout`
|
|
71
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
72
|
+
//
|
|
73
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
74
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
75
|
+
// have a hard reference to the original implementation at the time when this
|
|
76
|
+
// file was imported.
|
|
77
|
+
setTimeout: (t, e) => setTimeout(t, e),
|
|
78
|
+
clearTimeout: (t) => clearTimeout(t),
|
|
79
|
+
setInterval: (t, e) => setInterval(t, e),
|
|
80
|
+
clearInterval: (t) => clearInterval(t)
|
|
81
|
+
}, L, B, Ge, Et = (Ge = class {
|
|
82
|
+
constructor() {
|
|
83
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
84
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
85
|
+
// would need to support the default provider's concrete timer ID, which is
|
|
86
|
+
// infeasible across environments.
|
|
87
|
+
//
|
|
88
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
89
|
+
// this class is unsafe internally to allow for extension.
|
|
90
|
+
v(this, L, Rt);
|
|
91
|
+
v(this, B, !1);
|
|
92
|
+
}
|
|
93
|
+
setTimeoutProvider(t) {
|
|
94
|
+
process.env.NODE_ENV !== "production" && n(this, B) && t !== n(this, L) && console.error(
|
|
95
|
+
"[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",
|
|
96
|
+
{ previous: n(this, L), provider: t }
|
|
97
|
+
), u(this, L, t), process.env.NODE_ENV !== "production" && u(this, B, !1);
|
|
98
|
+
}
|
|
99
|
+
setTimeout(t, e) {
|
|
100
|
+
return process.env.NODE_ENV !== "production" && u(this, B, !0), n(this, L).setTimeout(t, e);
|
|
101
|
+
}
|
|
102
|
+
clearTimeout(t) {
|
|
103
|
+
n(this, L).clearTimeout(t);
|
|
104
|
+
}
|
|
105
|
+
setInterval(t, e) {
|
|
106
|
+
return process.env.NODE_ENV !== "production" && u(this, B, !0), n(this, L).setInterval(t, e);
|
|
107
|
+
}
|
|
108
|
+
clearInterval(t) {
|
|
109
|
+
n(this, L).clearInterval(t);
|
|
110
|
+
}
|
|
111
|
+
}, L = new WeakMap(), B = new WeakMap(), Ge), ve = new Et();
|
|
112
|
+
function Ft(t) {
|
|
113
|
+
setTimeout(t, 0);
|
|
114
|
+
}
|
|
115
|
+
var It = typeof window > "u" || "Deno" in globalThis;
|
|
116
|
+
function Ct() {
|
|
117
|
+
}
|
|
118
|
+
function Ve(t) {
|
|
119
|
+
return typeof t == "number" && t >= 0 && t !== 1 / 0;
|
|
120
|
+
}
|
|
121
|
+
function _t(t, e) {
|
|
122
|
+
return Math.max(t + (e || 0) - Date.now(), 0);
|
|
123
|
+
}
|
|
124
|
+
function le(t, e) {
|
|
125
|
+
return typeof t == "function" ? t(e) : t;
|
|
126
|
+
}
|
|
127
|
+
function _(t, e) {
|
|
128
|
+
return typeof t == "function" ? t(e) : t;
|
|
129
|
+
}
|
|
130
|
+
var jt = Object.prototype.hasOwnProperty;
|
|
131
|
+
function Re(t, e, s = 0) {
|
|
132
|
+
if (t === e)
|
|
133
|
+
return t;
|
|
134
|
+
if (s > 500) return e;
|
|
135
|
+
const i = Ae(t) && Ae(e);
|
|
136
|
+
if (!i && !(ze(t) && ze(e))) return e;
|
|
137
|
+
const o = (i ? t : Object.keys(t)).length, h = i ? e : Object.keys(e), l = h.length, m = i ? new Array(l) : {};
|
|
138
|
+
let I = 0;
|
|
139
|
+
for (let F = 0; F < l; F++) {
|
|
140
|
+
const f = i ? F : h[F], y = t[f], a = e[f];
|
|
141
|
+
if (y === a) {
|
|
142
|
+
m[f] = y, (i ? F < o : jt.call(t, f)) && I++;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (y === null || a === null || typeof y != "object" || typeof a != "object") {
|
|
146
|
+
m[f] = a;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const g = Re(y, a, s + 1);
|
|
150
|
+
m[f] = g, g === y && I++;
|
|
151
|
+
}
|
|
152
|
+
return o === l && I === o ? t : m;
|
|
153
|
+
}
|
|
154
|
+
function Ee(t, e) {
|
|
155
|
+
if (!e || Object.keys(t).length !== Object.keys(e).length)
|
|
156
|
+
return !1;
|
|
157
|
+
for (const s in t)
|
|
158
|
+
if (t[s] !== e[s])
|
|
159
|
+
return !1;
|
|
160
|
+
return !0;
|
|
161
|
+
}
|
|
162
|
+
function Ae(t) {
|
|
163
|
+
return Array.isArray(t) && t.length === Object.keys(t).length;
|
|
164
|
+
}
|
|
165
|
+
function ze(t) {
|
|
166
|
+
if (!Be(t))
|
|
167
|
+
return !1;
|
|
168
|
+
const e = t.constructor;
|
|
169
|
+
if (e === void 0)
|
|
170
|
+
return !0;
|
|
171
|
+
const s = e.prototype;
|
|
172
|
+
return !(!Be(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(t) !== Object.prototype);
|
|
173
|
+
}
|
|
174
|
+
function Be(t) {
|
|
175
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
176
|
+
}
|
|
177
|
+
function qe(t, e, s) {
|
|
178
|
+
if (typeof s.structuralSharing == "function")
|
|
179
|
+
return s.structuralSharing(t, e);
|
|
180
|
+
if (s.structuralSharing !== !1) {
|
|
181
|
+
if (process.env.NODE_ENV !== "production")
|
|
182
|
+
try {
|
|
183
|
+
return Re(t, e);
|
|
184
|
+
} catch (i) {
|
|
185
|
+
throw console.error(
|
|
186
|
+
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${s.queryHash}]: ${i}`
|
|
187
|
+
), i;
|
|
188
|
+
}
|
|
189
|
+
return Re(t, e);
|
|
190
|
+
}
|
|
191
|
+
return e;
|
|
192
|
+
}
|
|
193
|
+
function Tt(t) {
|
|
194
|
+
return t;
|
|
195
|
+
}
|
|
196
|
+
function $e(t, e) {
|
|
197
|
+
return typeof t == "function" ? t(...e) : !!t;
|
|
198
|
+
}
|
|
199
|
+
var Ke = /* @__PURE__ */ (() => {
|
|
200
|
+
let t = () => It;
|
|
201
|
+
return {
|
|
202
|
+
/**
|
|
203
|
+
* Returns whether the current runtime should be treated as a server environment.
|
|
204
|
+
*/
|
|
205
|
+
isServer() {
|
|
206
|
+
return t();
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* Overrides the server check globally.
|
|
210
|
+
*/
|
|
211
|
+
setIsServer(e) {
|
|
212
|
+
t = e;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
})();
|
|
216
|
+
function We() {
|
|
217
|
+
let t, e;
|
|
218
|
+
const s = new Promise((r, o) => {
|
|
219
|
+
t = r, e = o;
|
|
220
|
+
});
|
|
221
|
+
s.status = "pending", s.catch(() => {
|
|
222
|
+
});
|
|
223
|
+
function i(r) {
|
|
224
|
+
Object.assign(s, r), delete s.resolve, delete s.reject;
|
|
225
|
+
}
|
|
226
|
+
return s.resolve = (r) => {
|
|
227
|
+
i({
|
|
228
|
+
status: "fulfilled",
|
|
229
|
+
value: r
|
|
230
|
+
}), t(r);
|
|
231
|
+
}, s.reject = (r) => {
|
|
232
|
+
i({
|
|
233
|
+
status: "rejected",
|
|
234
|
+
reason: r
|
|
235
|
+
}), e(r);
|
|
236
|
+
}, s;
|
|
237
|
+
}
|
|
238
|
+
var Lt = Ft;
|
|
239
|
+
function kt() {
|
|
240
|
+
let t = [], e = 0, s = (l) => {
|
|
241
|
+
l();
|
|
242
|
+
}, i = (l) => {
|
|
243
|
+
l();
|
|
244
|
+
}, r = Lt;
|
|
245
|
+
const o = (l) => {
|
|
246
|
+
e ? t.push(l) : r(() => {
|
|
247
|
+
s(l);
|
|
248
|
+
});
|
|
249
|
+
}, h = () => {
|
|
250
|
+
const l = t;
|
|
251
|
+
t = [], l.length && r(() => {
|
|
252
|
+
i(() => {
|
|
253
|
+
l.forEach((m) => {
|
|
254
|
+
s(m);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
batch: (l) => {
|
|
261
|
+
let m;
|
|
262
|
+
e++;
|
|
263
|
+
try {
|
|
264
|
+
m = l();
|
|
265
|
+
} finally {
|
|
266
|
+
e--, e || h();
|
|
267
|
+
}
|
|
268
|
+
return m;
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* All calls to the wrapped function will be batched.
|
|
272
|
+
*/
|
|
273
|
+
batchCalls: (l) => (...m) => {
|
|
274
|
+
o(() => {
|
|
275
|
+
l(...m);
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
schedule: o,
|
|
279
|
+
/**
|
|
280
|
+
* Use this method to set a custom notify function.
|
|
281
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
282
|
+
*/
|
|
283
|
+
setNotifyFunction: (l) => {
|
|
284
|
+
s = l;
|
|
285
|
+
},
|
|
286
|
+
/**
|
|
287
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
288
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
289
|
+
*/
|
|
290
|
+
setBatchNotifyFunction: (l) => {
|
|
291
|
+
i = l;
|
|
292
|
+
},
|
|
293
|
+
setScheduler: (l) => {
|
|
294
|
+
r = l;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
var Pt = kt(), X, M, ee, Xe, xt = (Xe = class extends xe {
|
|
299
|
+
constructor() {
|
|
300
|
+
super();
|
|
301
|
+
v(this, X, !0);
|
|
302
|
+
v(this, M);
|
|
303
|
+
v(this, ee);
|
|
304
|
+
u(this, ee, (e) => {
|
|
305
|
+
if (typeof window < "u" && window.addEventListener) {
|
|
306
|
+
const s = () => e(!0), i = () => e(!1);
|
|
307
|
+
return window.addEventListener("online", s, !1), window.addEventListener("offline", i, !1), () => {
|
|
308
|
+
window.removeEventListener("online", s), window.removeEventListener("offline", i);
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
onSubscribe() {
|
|
314
|
+
n(this, M) || this.setEventListener(n(this, ee));
|
|
315
|
+
}
|
|
316
|
+
onUnsubscribe() {
|
|
317
|
+
var e;
|
|
318
|
+
this.hasListeners() || ((e = n(this, M)) == null || e.call(this), u(this, M, void 0));
|
|
319
|
+
}
|
|
320
|
+
setEventListener(e) {
|
|
321
|
+
var s;
|
|
322
|
+
u(this, ee, e), (s = n(this, M)) == null || s.call(this), u(this, M, e(this.setOnline.bind(this)));
|
|
323
|
+
}
|
|
324
|
+
setOnline(e) {
|
|
325
|
+
n(this, X) !== e && (u(this, X, e), this.listeners.forEach((i) => {
|
|
326
|
+
i(e);
|
|
327
|
+
}));
|
|
328
|
+
}
|
|
329
|
+
isOnline() {
|
|
330
|
+
return n(this, X);
|
|
331
|
+
}
|
|
332
|
+
}, X = new WeakMap(), M = new WeakMap(), ee = new WeakMap(), Xe), Dt = new xt();
|
|
333
|
+
function Mt(t) {
|
|
334
|
+
return (t ?? "online") === "online" ? Dt.isOnline() : !0;
|
|
335
|
+
}
|
|
336
|
+
function Qt(t, e) {
|
|
337
|
+
return {
|
|
338
|
+
fetchFailureCount: 0,
|
|
339
|
+
fetchFailureReason: null,
|
|
340
|
+
fetchStatus: Mt(e.networkMode) ? "fetching" : "paused",
|
|
341
|
+
...t === void 0 && {
|
|
342
|
+
error: null,
|
|
343
|
+
status: "pending"
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
var E, c, ue, S, q, te, P, Q, ce, se, ne, $, K, U, ie, d, ae, Fe, Ie, Ce, _e, je, Te, Le, st, et, Ut = (et = class extends xe {
|
|
348
|
+
constructor(e, s) {
|
|
349
|
+
super();
|
|
350
|
+
v(this, d);
|
|
351
|
+
v(this, E);
|
|
352
|
+
v(this, c);
|
|
353
|
+
v(this, ue);
|
|
354
|
+
v(this, S);
|
|
355
|
+
v(this, q);
|
|
356
|
+
v(this, te);
|
|
357
|
+
v(this, P);
|
|
358
|
+
v(this, Q);
|
|
359
|
+
v(this, ce);
|
|
360
|
+
v(this, se);
|
|
361
|
+
// This property keeps track of the last query with defined data.
|
|
362
|
+
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
363
|
+
v(this, ne);
|
|
364
|
+
v(this, $);
|
|
365
|
+
v(this, K);
|
|
366
|
+
v(this, U);
|
|
367
|
+
v(this, ie, /* @__PURE__ */ new Set());
|
|
368
|
+
this.options = s, u(this, E, e), u(this, Q, null), u(this, P, We()), this.bindMethods(), this.setOptions(s);
|
|
369
|
+
}
|
|
370
|
+
bindMethods() {
|
|
371
|
+
this.refetch = this.refetch.bind(this);
|
|
372
|
+
}
|
|
373
|
+
onSubscribe() {
|
|
374
|
+
this.listeners.size === 1 && (n(this, c).addObserver(this), He(n(this, c), this.options) ? b(this, d, ae).call(this) : this.updateResult(), b(this, d, _e).call(this));
|
|
375
|
+
}
|
|
376
|
+
onUnsubscribe() {
|
|
377
|
+
this.hasListeners() || this.destroy();
|
|
378
|
+
}
|
|
379
|
+
shouldFetchOnReconnect() {
|
|
380
|
+
return ke(
|
|
381
|
+
n(this, c),
|
|
382
|
+
this.options,
|
|
383
|
+
this.options.refetchOnReconnect
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
shouldFetchOnWindowFocus() {
|
|
387
|
+
return ke(
|
|
388
|
+
n(this, c),
|
|
389
|
+
this.options,
|
|
390
|
+
this.options.refetchOnWindowFocus
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
destroy() {
|
|
394
|
+
this.listeners = /* @__PURE__ */ new Set(), b(this, d, je).call(this), b(this, d, Te).call(this), n(this, c).removeObserver(this);
|
|
395
|
+
}
|
|
396
|
+
setOptions(e) {
|
|
397
|
+
const s = this.options, i = n(this, c);
|
|
398
|
+
if (this.options = n(this, E).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof _(this.options.enabled, n(this, c)) != "boolean")
|
|
399
|
+
throw new Error(
|
|
400
|
+
"Expected enabled to be a boolean or a callback that returns a boolean"
|
|
401
|
+
);
|
|
402
|
+
b(this, d, Le).call(this), n(this, c).setOptions(this.options), s._defaulted && !Ee(this.options, s) && n(this, E).getQueryCache().notify({
|
|
403
|
+
type: "observerOptionsUpdated",
|
|
404
|
+
query: n(this, c),
|
|
405
|
+
observer: this
|
|
406
|
+
});
|
|
407
|
+
const r = this.hasListeners();
|
|
408
|
+
r && Je(
|
|
409
|
+
n(this, c),
|
|
410
|
+
i,
|
|
411
|
+
this.options,
|
|
412
|
+
s
|
|
413
|
+
) && b(this, d, ae).call(this), this.updateResult(), r && (n(this, c) !== i || _(this.options.enabled, n(this, c)) !== _(s.enabled, n(this, c)) || le(this.options.staleTime, n(this, c)) !== le(s.staleTime, n(this, c))) && b(this, d, Fe).call(this);
|
|
414
|
+
const o = b(this, d, Ie).call(this);
|
|
415
|
+
r && (n(this, c) !== i || _(this.options.enabled, n(this, c)) !== _(s.enabled, n(this, c)) || o !== n(this, U)) && b(this, d, Ce).call(this, o);
|
|
416
|
+
}
|
|
417
|
+
getOptimisticResult(e) {
|
|
418
|
+
const s = n(this, E).getQueryCache().build(n(this, E), e), i = this.createResult(s, e);
|
|
419
|
+
return Vt(this, i) && (u(this, S, i), u(this, te, this.options), u(this, q, n(this, c).state)), i;
|
|
420
|
+
}
|
|
421
|
+
getCurrentResult() {
|
|
422
|
+
return n(this, S);
|
|
423
|
+
}
|
|
424
|
+
trackResult(e, s) {
|
|
425
|
+
return new Proxy(e, {
|
|
426
|
+
get: (i, r) => (this.trackProp(r), s == null || s(r), r === "promise" && (this.trackProp("data"), !this.options.experimental_prefetchInRender && n(this, P).status === "pending" && n(this, P).reject(
|
|
427
|
+
new Error(
|
|
428
|
+
"experimental_prefetchInRender feature flag is not enabled"
|
|
429
|
+
)
|
|
430
|
+
)), Reflect.get(i, r))
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
trackProp(e) {
|
|
434
|
+
n(this, ie).add(e);
|
|
435
|
+
}
|
|
436
|
+
getCurrentQuery() {
|
|
437
|
+
return n(this, c);
|
|
438
|
+
}
|
|
439
|
+
refetch({ ...e } = {}) {
|
|
440
|
+
return this.fetch({
|
|
441
|
+
...e
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
fetchOptimistic(e) {
|
|
445
|
+
const s = n(this, E).defaultQueryOptions(e), i = n(this, E).getQueryCache().build(n(this, E), s);
|
|
446
|
+
return i.fetch().then(() => this.createResult(i, s));
|
|
447
|
+
}
|
|
448
|
+
fetch(e) {
|
|
449
|
+
return b(this, d, ae).call(this, {
|
|
450
|
+
...e,
|
|
451
|
+
cancelRefetch: e.cancelRefetch ?? !0
|
|
452
|
+
}).then(() => (this.updateResult(), n(this, S)));
|
|
453
|
+
}
|
|
454
|
+
createResult(e, s) {
|
|
455
|
+
var de;
|
|
456
|
+
const i = n(this, c), r = this.options, o = n(this, S), h = n(this, q), l = n(this, te), I = e !== i ? e.state : n(this, ue), { state: F } = e;
|
|
457
|
+
let f = { ...F }, y = !1, a;
|
|
458
|
+
if (s._optimisticResults) {
|
|
459
|
+
const R = this.hasListeners(), V = !R && He(e, s), H = R && Je(e, i, s, r);
|
|
460
|
+
(V || H) && (f = {
|
|
461
|
+
...f,
|
|
462
|
+
...Qt(F.data, e.options)
|
|
463
|
+
}), s._optimisticResults === "isRestoring" && (f.fetchStatus = "idle");
|
|
464
|
+
}
|
|
465
|
+
let { error: g, errorUpdatedAt: j, status: O } = f;
|
|
466
|
+
a = f.data;
|
|
467
|
+
let x = !1;
|
|
468
|
+
if (s.placeholderData !== void 0 && a === void 0 && O === "pending") {
|
|
469
|
+
let R;
|
|
470
|
+
o != null && o.isPlaceholderData && s.placeholderData === (l == null ? void 0 : l.placeholderData) ? (R = o.data, x = !0) : R = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
471
|
+
(de = n(this, ne)) == null ? void 0 : de.state.data,
|
|
472
|
+
n(this, ne)
|
|
473
|
+
) : s.placeholderData, R !== void 0 && (O = "success", a = qe(
|
|
474
|
+
o == null ? void 0 : o.data,
|
|
475
|
+
R,
|
|
476
|
+
s
|
|
477
|
+
), y = !0);
|
|
478
|
+
}
|
|
479
|
+
if (s.select && a !== void 0 && !x)
|
|
480
|
+
if (o && a === (h == null ? void 0 : h.data) && s.select === n(this, ce))
|
|
481
|
+
a = n(this, se);
|
|
482
|
+
else
|
|
483
|
+
try {
|
|
484
|
+
u(this, ce, s.select), a = s.select(a), a = qe(o == null ? void 0 : o.data, a, s), u(this, se, a), u(this, Q, null);
|
|
485
|
+
} catch (R) {
|
|
486
|
+
u(this, Q, R);
|
|
487
|
+
}
|
|
488
|
+
n(this, Q) && (g = n(this, Q), a = n(this, se), j = Date.now(), O = "error");
|
|
489
|
+
const k = f.fetchStatus === "fetching", W = O === "pending", re = O === "error", he = W && k, p = a !== void 0, C = {
|
|
490
|
+
status: O,
|
|
491
|
+
fetchStatus: f.fetchStatus,
|
|
492
|
+
isPending: W,
|
|
493
|
+
isSuccess: O === "success",
|
|
494
|
+
isError: re,
|
|
495
|
+
isInitialLoading: he,
|
|
496
|
+
isLoading: he,
|
|
497
|
+
data: a,
|
|
498
|
+
dataUpdatedAt: f.dataUpdatedAt,
|
|
499
|
+
error: g,
|
|
500
|
+
errorUpdatedAt: j,
|
|
501
|
+
failureCount: f.fetchFailureCount,
|
|
502
|
+
failureReason: f.fetchFailureReason,
|
|
503
|
+
errorUpdateCount: f.errorUpdateCount,
|
|
504
|
+
isFetched: e.isFetched(),
|
|
505
|
+
isFetchedAfterMount: f.dataUpdateCount > I.dataUpdateCount || f.errorUpdateCount > I.errorUpdateCount,
|
|
506
|
+
isFetching: k,
|
|
507
|
+
isRefetching: k && !W,
|
|
508
|
+
isLoadingError: re && !p,
|
|
509
|
+
isPaused: f.fetchStatus === "paused",
|
|
510
|
+
isPlaceholderData: y,
|
|
511
|
+
isRefetchError: re && p,
|
|
512
|
+
isStale: De(e, s),
|
|
513
|
+
refetch: this.refetch,
|
|
514
|
+
promise: n(this, P),
|
|
515
|
+
isEnabled: _(s.enabled, e) !== !1
|
|
516
|
+
};
|
|
517
|
+
if (this.options.experimental_prefetchInRender) {
|
|
518
|
+
const R = C.data !== void 0, V = C.status === "error" && !R, H = (J) => {
|
|
519
|
+
V ? J.reject(C.error) : R && J.resolve(C.data);
|
|
520
|
+
}, fe = () => {
|
|
521
|
+
const J = u(this, P, C.promise = We());
|
|
522
|
+
H(J);
|
|
523
|
+
}, w = n(this, P);
|
|
524
|
+
switch (w.status) {
|
|
525
|
+
case "pending":
|
|
526
|
+
e.queryHash === i.queryHash && H(w);
|
|
527
|
+
break;
|
|
528
|
+
case "fulfilled":
|
|
529
|
+
(V || C.data !== w.value) && fe();
|
|
530
|
+
break;
|
|
531
|
+
case "rejected":
|
|
532
|
+
(!V || C.error !== w.reason) && fe();
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return C;
|
|
537
|
+
}
|
|
538
|
+
updateResult() {
|
|
539
|
+
const e = n(this, S), s = this.createResult(n(this, c), this.options);
|
|
540
|
+
if (u(this, q, n(this, c).state), u(this, te, this.options), n(this, q).data !== void 0 && u(this, ne, n(this, c)), Ee(s, e))
|
|
541
|
+
return;
|
|
542
|
+
u(this, S, s);
|
|
543
|
+
const i = () => {
|
|
544
|
+
if (!e)
|
|
545
|
+
return !0;
|
|
546
|
+
const { notifyOnChangeProps: r } = this.options, o = typeof r == "function" ? r() : r;
|
|
547
|
+
if (o === "all" || !o && !n(this, ie).size)
|
|
548
|
+
return !0;
|
|
549
|
+
const h = new Set(
|
|
550
|
+
o ?? n(this, ie)
|
|
551
|
+
);
|
|
552
|
+
return this.options.throwOnError && h.add("error"), Object.keys(n(this, S)).some((l) => {
|
|
553
|
+
const m = l;
|
|
554
|
+
return n(this, S)[m] !== e[m] && h.has(m);
|
|
555
|
+
});
|
|
556
|
+
};
|
|
557
|
+
b(this, d, st).call(this, { listeners: i() });
|
|
558
|
+
}
|
|
559
|
+
onQueryUpdate() {
|
|
560
|
+
this.updateResult(), this.hasListeners() && b(this, d, _e).call(this);
|
|
561
|
+
}
|
|
562
|
+
}, E = new WeakMap(), c = new WeakMap(), ue = new WeakMap(), S = new WeakMap(), q = new WeakMap(), te = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), ce = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), $ = new WeakMap(), K = new WeakMap(), U = new WeakMap(), ie = new WeakMap(), d = new WeakSet(), ae = function(e) {
|
|
563
|
+
b(this, d, Le).call(this);
|
|
564
|
+
let s = n(this, c).fetch(
|
|
565
|
+
this.options,
|
|
566
|
+
e
|
|
567
|
+
);
|
|
568
|
+
return e != null && e.throwOnError || (s = s.catch(Ct)), s;
|
|
569
|
+
}, Fe = function() {
|
|
570
|
+
b(this, d, je).call(this);
|
|
571
|
+
const e = le(
|
|
572
|
+
this.options.staleTime,
|
|
573
|
+
n(this, c)
|
|
574
|
+
);
|
|
575
|
+
if (Ke.isServer() || n(this, S).isStale || !Ve(e))
|
|
576
|
+
return;
|
|
577
|
+
const i = _t(n(this, S).dataUpdatedAt, e) + 1;
|
|
578
|
+
u(this, $, ve.setTimeout(() => {
|
|
579
|
+
n(this, S).isStale || this.updateResult();
|
|
580
|
+
}, i));
|
|
581
|
+
}, Ie = function() {
|
|
582
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(n(this, c)) : this.options.refetchInterval) ?? !1;
|
|
583
|
+
}, Ce = function(e) {
|
|
584
|
+
b(this, d, Te).call(this), u(this, U, e), !(Ke.isServer() || _(this.options.enabled, n(this, c)) === !1 || !Ve(n(this, U)) || n(this, U) === 0) && u(this, K, ve.setInterval(() => {
|
|
585
|
+
(this.options.refetchIntervalInBackground || St.isFocused()) && b(this, d, ae).call(this);
|
|
586
|
+
}, n(this, U)));
|
|
587
|
+
}, _e = function() {
|
|
588
|
+
b(this, d, Fe).call(this), b(this, d, Ce).call(this, b(this, d, Ie).call(this));
|
|
589
|
+
}, je = function() {
|
|
590
|
+
n(this, $) !== void 0 && (ve.clearTimeout(n(this, $)), u(this, $, void 0));
|
|
591
|
+
}, Te = function() {
|
|
592
|
+
n(this, K) !== void 0 && (ve.clearInterval(n(this, K)), u(this, K, void 0));
|
|
593
|
+
}, Le = function() {
|
|
594
|
+
const e = n(this, E).getQueryCache().build(n(this, E), this.options);
|
|
595
|
+
if (e === n(this, c))
|
|
596
|
+
return;
|
|
597
|
+
const s = n(this, c);
|
|
598
|
+
u(this, c, e), u(this, ue, e.state), this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
|
|
599
|
+
}, st = function(e) {
|
|
600
|
+
Pt.batch(() => {
|
|
601
|
+
e.listeners && this.listeners.forEach((s) => {
|
|
602
|
+
s(n(this, S));
|
|
603
|
+
}), n(this, E).getQueryCache().notify({
|
|
604
|
+
query: n(this, c),
|
|
605
|
+
type: "observerResultsUpdated"
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}, et);
|
|
609
|
+
function Nt(t, e) {
|
|
610
|
+
return _(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && _(e.retryOnMount, t) === !1);
|
|
611
|
+
}
|
|
612
|
+
function He(t, e) {
|
|
613
|
+
return Nt(t, e) || t.state.data !== void 0 && ke(t, e, e.refetchOnMount);
|
|
614
|
+
}
|
|
615
|
+
function ke(t, e, s) {
|
|
616
|
+
if (_(e.enabled, t) !== !1 && le(e.staleTime, t) !== "static") {
|
|
617
|
+
const i = typeof s == "function" ? s(t) : s;
|
|
618
|
+
return i === "always" || i !== !1 && De(t, e);
|
|
619
|
+
}
|
|
620
|
+
return !1;
|
|
621
|
+
}
|
|
622
|
+
function Je(t, e, s, i) {
|
|
623
|
+
return (t !== e || _(i.enabled, t) === !1) && (!s.suspense || t.state.status !== "error") && De(t, s);
|
|
624
|
+
}
|
|
625
|
+
function De(t, e) {
|
|
626
|
+
return _(e.enabled, t) !== !1 && t.isStaleByTime(le(e.staleTime, t));
|
|
627
|
+
}
|
|
628
|
+
function Vt(t, e) {
|
|
629
|
+
return !Ee(t.getCurrentResult(), e);
|
|
630
|
+
}
|
|
631
|
+
var At = "VUE_QUERY_CLIENT";
|
|
632
|
+
function zt(t) {
|
|
633
|
+
const e = t ? `:${t}` : "";
|
|
634
|
+
return `${At}${e}`;
|
|
635
|
+
}
|
|
636
|
+
function Ye(t, e) {
|
|
637
|
+
Object.keys(t).forEach((s) => {
|
|
638
|
+
t[s] = e[s];
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
function Pe(t, e, s = "", i = 0) {
|
|
642
|
+
if (e) {
|
|
643
|
+
const r = e(t, s, i);
|
|
644
|
+
if (r === void 0 && tt(t) || r !== void 0)
|
|
645
|
+
return r;
|
|
646
|
+
}
|
|
647
|
+
if (Array.isArray(t))
|
|
648
|
+
return t.map(
|
|
649
|
+
(r, o) => Pe(r, e, String(o), i + 1)
|
|
650
|
+
);
|
|
651
|
+
if (typeof t == "object" && qt(t)) {
|
|
652
|
+
const r = Object.entries(t).map(([o, h]) => [
|
|
653
|
+
o,
|
|
654
|
+
Pe(h, e, o, i + 1)
|
|
655
|
+
]);
|
|
656
|
+
return Object.fromEntries(r);
|
|
657
|
+
}
|
|
658
|
+
return t;
|
|
659
|
+
}
|
|
660
|
+
function Bt(t, e) {
|
|
661
|
+
return Pe(t, e);
|
|
662
|
+
}
|
|
663
|
+
function be(t, e = !1) {
|
|
664
|
+
return Bt(t, (s, i, r) => {
|
|
665
|
+
if (r === 1 && i === "queryKey")
|
|
666
|
+
return be(s, !0);
|
|
667
|
+
if (e && $t(s))
|
|
668
|
+
return be(s(), e);
|
|
669
|
+
if (tt(s))
|
|
670
|
+
return be(me(s), e);
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
function qt(t) {
|
|
674
|
+
if (Object.prototype.toString.call(t) !== "[object Object]")
|
|
675
|
+
return !1;
|
|
676
|
+
const e = Object.getPrototypeOf(t);
|
|
677
|
+
return e === null || e === Object.prototype;
|
|
678
|
+
}
|
|
679
|
+
function $t(t) {
|
|
680
|
+
return typeof t == "function";
|
|
681
|
+
}
|
|
682
|
+
function Kt(t = "") {
|
|
683
|
+
if (!nt())
|
|
684
|
+
throw new Error(
|
|
685
|
+
"vue-query hooks can only be used inside setup() function or functions that support injection context."
|
|
686
|
+
);
|
|
687
|
+
const e = zt(t), s = it(e);
|
|
688
|
+
if (!s)
|
|
689
|
+
throw new Error(
|
|
690
|
+
"No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library."
|
|
691
|
+
);
|
|
692
|
+
return s;
|
|
693
|
+
}
|
|
694
|
+
function Wt(t, e, s) {
|
|
695
|
+
process.env.NODE_ENV === "development" && (rt() || console.warn(
|
|
696
|
+
'vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.'
|
|
697
|
+
));
|
|
698
|
+
const i = Kt(), r = T(() => {
|
|
699
|
+
var O;
|
|
700
|
+
let a = e;
|
|
701
|
+
typeof a == "function" && (a = a());
|
|
702
|
+
const g = be(a);
|
|
703
|
+
typeof g.enabled == "function" && (g.enabled = g.enabled());
|
|
704
|
+
const j = i.defaultQueryOptions(g);
|
|
705
|
+
return j._optimisticResults = (O = i.isRestoring) != null && O.value ? "isRestoring" : "optimistic", j;
|
|
706
|
+
}), o = new t(i, r.value), h = r.value.shallow ? ot(o.getCurrentResult()) : at(o.getCurrentResult());
|
|
707
|
+
let l = () => {
|
|
708
|
+
};
|
|
709
|
+
i.isRestoring && Z(
|
|
710
|
+
i.isRestoring,
|
|
711
|
+
(a) => {
|
|
712
|
+
a || (l(), l = o.subscribe((g) => {
|
|
713
|
+
Ye(h, g);
|
|
714
|
+
}));
|
|
715
|
+
},
|
|
716
|
+
{ immediate: !0 }
|
|
717
|
+
);
|
|
718
|
+
const m = () => {
|
|
719
|
+
o.setOptions(r.value), Ye(h, o.getCurrentResult());
|
|
720
|
+
};
|
|
721
|
+
Z(r, m), lt(() => {
|
|
722
|
+
l();
|
|
723
|
+
});
|
|
724
|
+
const I = (...a) => (m(), h.refetch(...a)), F = () => new Promise(
|
|
725
|
+
(a, g) => {
|
|
726
|
+
let j = () => {
|
|
727
|
+
};
|
|
728
|
+
const O = () => {
|
|
729
|
+
if (r.value.enabled !== !1) {
|
|
730
|
+
o.setOptions(r.value);
|
|
731
|
+
const x = o.getOptimisticResult(
|
|
732
|
+
r.value
|
|
733
|
+
);
|
|
734
|
+
x.isStale ? (j(), o.fetchOptimistic(r.value).then(a, (k) => {
|
|
735
|
+
$e(r.value.throwOnError, [
|
|
736
|
+
k,
|
|
737
|
+
o.getCurrentQuery()
|
|
738
|
+
]) ? g(k) : a(o.getCurrentResult());
|
|
739
|
+
})) : (j(), a(x));
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
O(), j = Z(r, O);
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
Z(
|
|
746
|
+
() => h.error,
|
|
747
|
+
(a) => {
|
|
748
|
+
if (h.isError && !h.isFetching && $e(r.value.throwOnError, [
|
|
749
|
+
a,
|
|
750
|
+
o.getCurrentQuery()
|
|
751
|
+
]))
|
|
752
|
+
throw a;
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
const f = r.value.shallow ? ut(h) : ct(h), y = ht(f);
|
|
756
|
+
for (const a in h)
|
|
757
|
+
typeof h[a] == "function" && (y[a] = h[a]);
|
|
758
|
+
return y.suspense = F, y.refetch = I, y;
|
|
759
|
+
}
|
|
760
|
+
function Se(t, e) {
|
|
761
|
+
return Wt(Ut, t);
|
|
762
|
+
}
|
|
763
|
+
const Ht = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 cursor-pointer" }, Jt = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, Yt = { class: "relative min-w-[280px]" }, Zt = { class: "sticky top-0 py-8 bg-white translate-y-[-12px]" }, Gt = {
|
|
764
|
+
key: 0,
|
|
765
|
+
class: "px-8 py-12 text-center fm-typo-en-body-md-400 text-fm-color-neutral-gray-500"
|
|
766
|
+
}, ns = /* @__PURE__ */ dt({
|
|
767
|
+
__name: "AdminRestaurantSelector",
|
|
768
|
+
props: /* @__PURE__ */ gt({
|
|
769
|
+
label: {},
|
|
770
|
+
labelMark: {},
|
|
771
|
+
placeholder: {},
|
|
772
|
+
searchPlaceholder: {},
|
|
773
|
+
rules: {},
|
|
774
|
+
businessId: {}
|
|
775
|
+
}, {
|
|
776
|
+
modelValue: { default: "" },
|
|
777
|
+
modelModifiers: {}
|
|
778
|
+
}),
|
|
779
|
+
emits: ["update:modelValue"],
|
|
780
|
+
setup(t) {
|
|
781
|
+
const e = t, s = ft(t, "modelValue"), { t: i } = Ot(), r = pt(e, "businessId"), o = Qe(""), h = Qe("");
|
|
782
|
+
let l = null;
|
|
783
|
+
Z(o, (p) => {
|
|
784
|
+
l && clearTimeout(l), l = setTimeout(() => h.value = p, 300);
|
|
785
|
+
}), Z(r, () => {
|
|
786
|
+
s.value = "";
|
|
787
|
+
});
|
|
788
|
+
const m = (p) => ({
|
|
789
|
+
label: p.profile.name,
|
|
790
|
+
value: p._id
|
|
791
|
+
}), I = T(
|
|
792
|
+
() => r.value ? ["admin-restaurants", "business", r.value] : ["admin-restaurants"]
|
|
793
|
+
), { data: F, isLoading: f } = Se({
|
|
794
|
+
queryKey: I,
|
|
795
|
+
queryFn: () => we.readPaymentRestaurantsWithPagination({ limit: 20, businessId: r.value }).then((p) => p.data),
|
|
796
|
+
select: (p) => p.map(m)
|
|
797
|
+
}), { data: y, isLoading: a } = Se({
|
|
798
|
+
queryKey: T(() => [...I.value, "search", h.value]),
|
|
799
|
+
queryFn: () => we.readPaymentRestaurantsWithPagination({
|
|
800
|
+
limit: 20,
|
|
801
|
+
search: h.value,
|
|
802
|
+
businessId: r.value
|
|
803
|
+
}).then((p) => p.data),
|
|
804
|
+
select: (p) => p.map(m),
|
|
805
|
+
enabled: T(() => h.value.length > 0),
|
|
806
|
+
placeholderData: Tt
|
|
807
|
+
}), { data: g, isLoading: j } = Se({
|
|
808
|
+
queryKey: T(() => ["admin-restaurants", s.value]),
|
|
809
|
+
queryFn: () => we.readRestaurantById(s.value).then((p) => p ? m(p) : null),
|
|
810
|
+
enabled: T(
|
|
811
|
+
() => !!s.value && !(F.value ?? []).some((p) => p.value === s.value)
|
|
812
|
+
)
|
|
813
|
+
}), O = T(() => F.value ?? []), x = T(
|
|
814
|
+
() => o.value ? y.value ?? [] : O.value
|
|
815
|
+
), k = T(
|
|
816
|
+
() => f.value || a.value || j.value
|
|
817
|
+
), W = T(
|
|
818
|
+
() => O.value.find((p) => p.value === s.value) ?? g.value ?? void 0
|
|
819
|
+
), re = T(
|
|
820
|
+
() => o.value && !k.value && x.value.length === 0
|
|
821
|
+
), he = (p) => {
|
|
822
|
+
s.value = p, o.value = "";
|
|
823
|
+
};
|
|
824
|
+
return (p, N) => {
|
|
825
|
+
const C = Y("FmIcon"), de = Y("FmCircularProgress"), R = Y("FmSearch"), V = Y("FmMenuItem"), H = Y("FmMenu"), fe = Y("FmFormGroup");
|
|
826
|
+
return A(), oe(fe, {
|
|
827
|
+
modelValue: s.value,
|
|
828
|
+
"onUpdate:modelValue": N[2] || (N[2] = (w) => s.value = w),
|
|
829
|
+
label: e.label,
|
|
830
|
+
"label-mark": e.labelMark,
|
|
831
|
+
rules: e.rules
|
|
832
|
+
}, {
|
|
833
|
+
default: ge(() => [
|
|
834
|
+
Oe(H, { "close-on-click": !0 }, {
|
|
835
|
+
"menu-button": ge(() => {
|
|
836
|
+
var w;
|
|
837
|
+
return [
|
|
838
|
+
pe("div", Ht, [
|
|
839
|
+
Oe(C, {
|
|
840
|
+
name: "store",
|
|
841
|
+
size: "sm"
|
|
842
|
+
}),
|
|
843
|
+
pe("div", Jt, Ne(((w = W.value) == null ? void 0 : w.label) ?? e.placeholder ?? me(i)("payment.components.select")), 1),
|
|
844
|
+
k.value ? (A(), oe(de, {
|
|
845
|
+
key: 0,
|
|
846
|
+
size: "md"
|
|
847
|
+
})) : W.value ? (A(), oe(C, {
|
|
848
|
+
key: 1,
|
|
849
|
+
name: "close",
|
|
850
|
+
size: "sm",
|
|
851
|
+
onClick: N[0] || (N[0] = yt((J) => s.value = "", ["stop"]))
|
|
852
|
+
})) : (A(), oe(C, {
|
|
853
|
+
key: 2,
|
|
854
|
+
name: "expand_more",
|
|
855
|
+
size: "sm"
|
|
856
|
+
}))
|
|
857
|
+
])
|
|
858
|
+
];
|
|
859
|
+
}),
|
|
860
|
+
default: ge(() => [
|
|
861
|
+
pe("div", Yt, [
|
|
862
|
+
pe("div", Zt, [
|
|
863
|
+
Oe(R, {
|
|
864
|
+
"model-value": o.value,
|
|
865
|
+
"onUpdate:modelValue": N[1] || (N[1] = (w) => o.value = w),
|
|
866
|
+
placeholder: e.searchPlaceholder ?? e.placeholder ?? me(i)("payment.components.select")
|
|
867
|
+
}, null, 8, ["model-value", "placeholder"])
|
|
868
|
+
]),
|
|
869
|
+
(A(!0), Ue(vt, null, mt(x.value, (w) => (A(), oe(V, {
|
|
870
|
+
key: w.value,
|
|
871
|
+
label: w.label,
|
|
872
|
+
sublabel: "Restaurant",
|
|
873
|
+
onClick: (J) => he(w.value)
|
|
874
|
+
}, null, 8, ["label", "onClick"]))), 128)),
|
|
875
|
+
re.value ? (A(), Ue("div", Gt, Ne(me(i)("payment.components.no_results")), 1)) : bt("", !0)
|
|
876
|
+
])
|
|
877
|
+
]),
|
|
878
|
+
_: 1
|
|
879
|
+
})
|
|
880
|
+
]),
|
|
881
|
+
_: 1
|
|
882
|
+
}, 8, ["modelValue", "label", "label-mark", "rules"]);
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
export {
|
|
887
|
+
ns as _,
|
|
888
|
+
Tt as k,
|
|
889
|
+
Se as u
|
|
890
|
+
};
|