@odynn/awayz-hotels 0.1.11 → 0.1.13

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,398 +0,0 @@
1
- var ce = (t) => {
2
- throw TypeError(t);
3
- };
4
- var G = (t, e, r) => e.has(t) || ce("Cannot " + r);
5
- var s = (t, e, r) => (G(t, e, "read from private field"), r ? r.call(t) : e.get(t)), f = (t, e, r) => e.has(t) ? ce("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), u = (t, e, r, i) => (G(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r), l = (t, e, r) => (G(t, e, "access private method"), r);
6
- import { S as Se, p as le, r as O, s as J, a as q, b as Oe, d as X, e as de, t as Ee, f as we, j as Ie, k as fe, n as Re } from "./awayzClient-Bs2isDLP.js";
7
- import * as I from "react";
8
- import { s as Qe, u as xe, n as pe } from "./utils-DpMVuKj_.js";
9
- import "react/jsx-runtime";
10
- var y, n, V, m, T, P, Q, S, z, _, j, F, D, x, L, h, N, Y, Z, ee, te, se, re, ie, ve, ye, Te = (ye = class extends Se {
11
- constructor(e, r) {
12
- super();
13
- f(this, h);
14
- f(this, y);
15
- f(this, n);
16
- f(this, V);
17
- f(this, m);
18
- f(this, T);
19
- f(this, P);
20
- f(this, Q);
21
- f(this, S);
22
- f(this, z);
23
- f(this, _);
24
- // This property keeps track of the last query with defined data.
25
- // It will be used to pass the previous data and query to the placeholder function between renders.
26
- f(this, j);
27
- f(this, F);
28
- f(this, D);
29
- f(this, x);
30
- f(this, L, /* @__PURE__ */ new Set());
31
- this.options = r, u(this, y, e), u(this, S, null), u(this, Q, le()), this.options.experimental_prefetchInRender || s(this, Q).reject(
32
- new Error("experimental_prefetchInRender feature flag is not enabled")
33
- ), this.bindMethods(), this.setOptions(r);
34
- }
35
- bindMethods() {
36
- this.refetch = this.refetch.bind(this);
37
- }
38
- onSubscribe() {
39
- this.listeners.size === 1 && (s(this, n).addObserver(this), be(s(this, n), this.options) ? l(this, h, N).call(this) : this.updateResult(), l(this, h, te).call(this));
40
- }
41
- onUnsubscribe() {
42
- this.hasListeners() || this.destroy();
43
- }
44
- shouldFetchOnReconnect() {
45
- return ne(
46
- s(this, n),
47
- this.options,
48
- this.options.refetchOnReconnect
49
- );
50
- }
51
- shouldFetchOnWindowFocus() {
52
- return ne(
53
- s(this, n),
54
- this.options,
55
- this.options.refetchOnWindowFocus
56
- );
57
- }
58
- destroy() {
59
- this.listeners = /* @__PURE__ */ new Set(), l(this, h, se).call(this), l(this, h, re).call(this), s(this, n).removeObserver(this);
60
- }
61
- setOptions(e, r) {
62
- const i = this.options, d = s(this, n);
63
- if (this.options = s(this, y).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean" && typeof this.options.enabled != "function" && typeof O(this.options.enabled, s(this, n)) != "boolean")
64
- throw new Error(
65
- "Expected enabled to be a boolean or a callback that returns a boolean"
66
- );
67
- l(this, h, ie).call(this), s(this, n).setOptions(this.options), i._defaulted && !J(this.options, i) && s(this, y).getQueryCache().notify({
68
- type: "observerOptionsUpdated",
69
- query: s(this, n),
70
- observer: this
71
- });
72
- const c = this.hasListeners();
73
- c && ge(
74
- s(this, n),
75
- d,
76
- this.options,
77
- i
78
- ) && l(this, h, N).call(this), this.updateResult(r), c && (s(this, n) !== d || O(this.options.enabled, s(this, n)) !== O(i.enabled, s(this, n)) || q(this.options.staleTime, s(this, n)) !== q(i.staleTime, s(this, n))) && l(this, h, Y).call(this);
79
- const a = l(this, h, Z).call(this);
80
- c && (s(this, n) !== d || O(this.options.enabled, s(this, n)) !== O(i.enabled, s(this, n)) || a !== s(this, x)) && l(this, h, ee).call(this, a);
81
- }
82
- getOptimisticResult(e) {
83
- const r = s(this, y).getQueryCache().build(s(this, y), e), i = this.createResult(r, e);
84
- return De(this, i) && (u(this, m, i), u(this, P, this.options), u(this, T, s(this, n).state)), i;
85
- }
86
- getCurrentResult() {
87
- return s(this, m);
88
- }
89
- trackResult(e, r) {
90
- const i = {};
91
- return Object.keys(e).forEach((d) => {
92
- Object.defineProperty(i, d, {
93
- configurable: !1,
94
- enumerable: !0,
95
- get: () => (this.trackProp(d), r == null || r(d), e[d])
96
- });
97
- }), i;
98
- }
99
- trackProp(e) {
100
- s(this, L).add(e);
101
- }
102
- getCurrentQuery() {
103
- return s(this, n);
104
- }
105
- refetch({ ...e } = {}) {
106
- return this.fetch({
107
- ...e
108
- });
109
- }
110
- fetchOptimistic(e) {
111
- const r = s(this, y).defaultQueryOptions(e), i = s(this, y).getQueryCache().build(s(this, y), r);
112
- return i.fetch().then(() => this.createResult(i, r));
113
- }
114
- fetch(e) {
115
- return l(this, h, N).call(this, {
116
- ...e,
117
- cancelRefetch: e.cancelRefetch ?? !0
118
- }).then(() => (this.updateResult(), s(this, m)));
119
- }
120
- createResult(e, r) {
121
- var ue;
122
- const i = s(this, n), d = this.options, c = s(this, m), a = s(this, T), E = s(this, P), v = e !== i ? e.state : s(this, V), { state: w } = e;
123
- let o = { ...w }, k = !1, b;
124
- if (r._optimisticResults) {
125
- const g = this.hasListeners(), U = !g && be(e, r), M = g && ge(e, i, r, d);
126
- (U || M) && (o = {
127
- ...o,
128
- ...Ie(w.data, e.options)
129
- }), r._optimisticResults === "isRestoring" && (o.fetchStatus = "idle");
130
- }
131
- let { error: A, errorUpdatedAt: B, status: R } = o;
132
- if (r.select && o.data !== void 0)
133
- if (c && o.data === (a == null ? void 0 : a.data) && r.select === s(this, z))
134
- b = s(this, _);
135
- else
136
- try {
137
- u(this, z, r.select), b = r.select(o.data), b = fe(c == null ? void 0 : c.data, b, r), u(this, _, b), u(this, S, null);
138
- } catch (g) {
139
- u(this, S, g);
140
- }
141
- else
142
- b = o.data;
143
- if (r.placeholderData !== void 0 && b === void 0 && R === "pending") {
144
- let g;
145
- if (c != null && c.isPlaceholderData && r.placeholderData === (E == null ? void 0 : E.placeholderData))
146
- g = c.data;
147
- else if (g = typeof r.placeholderData == "function" ? r.placeholderData(
148
- (ue = s(this, j)) == null ? void 0 : ue.state.data,
149
- s(this, j)
150
- ) : r.placeholderData, r.select && g !== void 0)
151
- try {
152
- g = r.select(g), u(this, S, null);
153
- } catch (U) {
154
- u(this, S, U);
155
- }
156
- g !== void 0 && (R = "success", b = fe(
157
- c == null ? void 0 : c.data,
158
- g,
159
- r
160
- ), k = !0);
161
- }
162
- s(this, S) && (A = s(this, S), b = s(this, _), B = Date.now(), R = "error");
163
- const H = o.fetchStatus === "fetching", K = R === "pending", $ = R === "error", he = K && H, oe = b !== void 0, C = {
164
- status: R,
165
- fetchStatus: o.fetchStatus,
166
- isPending: K,
167
- isSuccess: R === "success",
168
- isError: $,
169
- isInitialLoading: he,
170
- isLoading: he,
171
- data: b,
172
- dataUpdatedAt: o.dataUpdatedAt,
173
- error: A,
174
- errorUpdatedAt: B,
175
- failureCount: o.fetchFailureCount,
176
- failureReason: o.fetchFailureReason,
177
- errorUpdateCount: o.errorUpdateCount,
178
- isFetched: o.dataUpdateCount > 0 || o.errorUpdateCount > 0,
179
- isFetchedAfterMount: o.dataUpdateCount > v.dataUpdateCount || o.errorUpdateCount > v.errorUpdateCount,
180
- isFetching: H,
181
- isRefetching: H && !K,
182
- isLoadingError: $ && !oe,
183
- isPaused: o.fetchStatus === "paused",
184
- isPlaceholderData: k,
185
- isRefetchError: $ && oe,
186
- isStale: ae(e, r),
187
- refetch: this.refetch,
188
- promise: s(this, Q)
189
- };
190
- if (this.options.experimental_prefetchInRender) {
191
- const g = (W) => {
192
- C.status === "error" ? W.reject(C.error) : C.data !== void 0 && W.resolve(C.data);
193
- }, U = () => {
194
- const W = u(this, Q, C.promise = le());
195
- g(W);
196
- }, M = s(this, Q);
197
- switch (M.status) {
198
- case "pending":
199
- e.queryHash === i.queryHash && g(M);
200
- break;
201
- case "fulfilled":
202
- (C.status === "error" || C.data !== M.value) && U();
203
- break;
204
- case "rejected":
205
- (C.status !== "error" || C.error !== M.reason) && U();
206
- break;
207
- }
208
- }
209
- return C;
210
- }
211
- updateResult(e) {
212
- const r = s(this, m), i = this.createResult(s(this, n), this.options);
213
- if (u(this, T, s(this, n).state), u(this, P, this.options), s(this, T).data !== void 0 && u(this, j, s(this, n)), J(i, r))
214
- return;
215
- u(this, m, i);
216
- const d = {}, c = () => {
217
- if (!r)
218
- return !0;
219
- const { notifyOnChangeProps: a } = this.options, E = typeof a == "function" ? a() : a;
220
- if (E === "all" || !E && !s(this, L).size)
221
- return !0;
222
- const p = new Set(
223
- E ?? s(this, L)
224
- );
225
- return this.options.throwOnError && p.add("error"), Object.keys(s(this, m)).some((v) => {
226
- const w = v;
227
- return s(this, m)[w] !== r[w] && p.has(w);
228
- });
229
- };
230
- (e == null ? void 0 : e.listeners) !== !1 && c() && (d.listeners = !0), l(this, h, ve).call(this, { ...d, ...e });
231
- }
232
- onQueryUpdate() {
233
- this.updateResult(), this.hasListeners() && l(this, h, te).call(this);
234
- }
235
- }, y = new WeakMap(), n = new WeakMap(), V = new WeakMap(), m = new WeakMap(), T = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), S = new WeakMap(), z = new WeakMap(), _ = new WeakMap(), j = new WeakMap(), F = new WeakMap(), D = new WeakMap(), x = new WeakMap(), L = new WeakMap(), h = new WeakSet(), N = function(e) {
236
- l(this, h, ie).call(this);
237
- let r = s(this, n).fetch(
238
- this.options,
239
- e
240
- );
241
- return e != null && e.throwOnError || (r = r.catch(Oe)), r;
242
- }, Y = function() {
243
- l(this, h, se).call(this);
244
- const e = q(
245
- this.options.staleTime,
246
- s(this, n)
247
- );
248
- if (X || s(this, m).isStale || !de(e))
249
- return;
250
- const i = Ee(s(this, m).dataUpdatedAt, e) + 1;
251
- u(this, F, setTimeout(() => {
252
- s(this, m).isStale || this.updateResult();
253
- }, i));
254
- }, Z = function() {
255
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(s(this, n)) : this.options.refetchInterval) ?? !1;
256
- }, ee = function(e) {
257
- l(this, h, re).call(this), u(this, x, e), !(X || O(this.options.enabled, s(this, n)) === !1 || !de(s(this, x)) || s(this, x) === 0) && u(this, D, setInterval(() => {
258
- (this.options.refetchIntervalInBackground || we.isFocused()) && l(this, h, N).call(this);
259
- }, s(this, x)));
260
- }, te = function() {
261
- l(this, h, Y).call(this), l(this, h, ee).call(this, l(this, h, Z).call(this));
262
- }, se = function() {
263
- s(this, F) && (clearTimeout(s(this, F)), u(this, F, void 0));
264
- }, re = function() {
265
- s(this, D) && (clearInterval(s(this, D)), u(this, D, void 0));
266
- }, ie = function() {
267
- const e = s(this, y).getQueryCache().build(s(this, y), this.options);
268
- if (e === s(this, n))
269
- return;
270
- const r = s(this, n);
271
- u(this, n, e), u(this, V, e.state), this.hasListeners() && (r == null || r.removeObserver(this), e.addObserver(this));
272
- }, ve = function(e) {
273
- Re.batch(() => {
274
- e.listeners && this.listeners.forEach((r) => {
275
- r(s(this, m));
276
- }), s(this, y).getQueryCache().notify({
277
- query: s(this, n),
278
- type: "observerResultsUpdated"
279
- });
280
- });
281
- }, ye);
282
- function Fe(t, e) {
283
- return O(e.enabled, t) !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
284
- }
285
- function be(t, e) {
286
- return Fe(t, e) || t.state.data !== void 0 && ne(t, e, e.refetchOnMount);
287
- }
288
- function ne(t, e, r) {
289
- if (O(e.enabled, t) !== !1) {
290
- const i = typeof r == "function" ? r(t) : r;
291
- return i === "always" || i !== !1 && ae(t, e);
292
- }
293
- return !1;
294
- }
295
- function ge(t, e, r, i) {
296
- return (t !== e || O(i.enabled, t) === !1) && (!r.suspense || t.state.status !== "error") && ae(t, r);
297
- }
298
- function ae(t, e) {
299
- return O(e.enabled, t) !== !1 && t.isStaleByTime(q(e.staleTime, t));
300
- }
301
- function De(t, e) {
302
- return !J(t.getCurrentResult(), e);
303
- }
304
- var Ce = I.createContext(!1), Ue = () => I.useContext(Ce);
305
- Ce.Provider;
306
- function Me() {
307
- let t = !1;
308
- return {
309
- clearReset: () => {
310
- t = !1;
311
- },
312
- reset: () => {
313
- t = !0;
314
- },
315
- isReset: () => t
316
- };
317
- }
318
- var Pe = I.createContext(Me()), _e = () => I.useContext(Pe), je = (t, e) => {
319
- (t.suspense || t.throwOnError || t.experimental_prefetchInRender) && (e.isReset() || (t.retryOnMount = !1));
320
- }, Le = (t) => {
321
- I.useEffect(() => {
322
- t.clearReset();
323
- }, [t]);
324
- }, ke = ({
325
- result: t,
326
- errorResetBoundary: e,
327
- throwOnError: r,
328
- query: i,
329
- suspense: d
330
- }) => t.isError && !e.isReset() && !t.isFetching && i && (d && t.data === void 0 || Qe(r, [t.error, i])), Ae = (t) => {
331
- const e = t.staleTime;
332
- t.suspense && (t.staleTime = typeof e == "function" ? (...r) => Math.max(e(...r), 1e3) : Math.max(e ?? 1e3, 1e3), typeof t.gcTime == "number" && (t.gcTime = Math.max(t.gcTime, 1e3)));
333
- }, Be = (t, e) => t.isLoading && t.isFetching && !e, He = (t, e) => (t == null ? void 0 : t.suspense) && e.isPending, me = (t, e, r) => e.fetchOptimistic(t).catch(() => {
334
- r.clearReset();
335
- });
336
- function Ne(t, e, r) {
337
- var o, k, b, A, B;
338
- if (process.env.NODE_ENV !== "production" && (typeof t != "object" || Array.isArray(t)))
339
- throw new Error(
340
- 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
341
- );
342
- const i = xe(), d = Ue(), c = _e(), a = i.defaultQueryOptions(t);
343
- (k = (o = i.getDefaultOptions().queries) == null ? void 0 : o._experimental_beforeQuery) == null || k.call(
344
- o,
345
- a
346
- ), a._optimisticResults = d ? "isRestoring" : "optimistic", Ae(a), je(a, c), Le(c);
347
- const E = !i.getQueryCache().get(a.queryHash), [p] = I.useState(
348
- () => new e(
349
- i,
350
- a
351
- )
352
- ), v = p.getOptimisticResult(a), w = !d && t.subscribed !== !1;
353
- if (I.useSyncExternalStore(
354
- I.useCallback(
355
- (R) => {
356
- const H = w ? p.subscribe(Re.batchCalls(R)) : pe;
357
- return p.updateResult(), H;
358
- },
359
- [p, w]
360
- ),
361
- () => p.getCurrentResult(),
362
- () => p.getCurrentResult()
363
- ), I.useEffect(() => {
364
- p.setOptions(a, { listeners: !1 });
365
- }, [a, p]), He(a, v))
366
- throw me(a, p, c);
367
- if (ke({
368
- result: v,
369
- errorResetBoundary: c,
370
- throwOnError: a.throwOnError,
371
- query: i.getQueryCache().get(a.queryHash),
372
- suspense: a.suspense
373
- }))
374
- throw v.error;
375
- if ((A = (b = i.getDefaultOptions().queries) == null ? void 0 : b._experimental_afterQuery) == null || A.call(
376
- b,
377
- a,
378
- v
379
- ), a.experimental_prefetchInRender && !X && Be(v, d)) {
380
- const R = E ? (
381
- // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
382
- me(a, p, c)
383
- ) : (
384
- // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
385
- (B = i.getQueryCache().get(a.queryHash)) == null ? void 0 : B.promise
386
- );
387
- R == null || R.catch(pe).finally(() => {
388
- p.updateResult();
389
- });
390
- }
391
- return a.notifyOnChangeProps ? v : p.trackResult(v);
392
- }
393
- function $e(t, e) {
394
- return Ne(t, Te);
395
- }
396
- export {
397
- $e as u
398
- };
@@ -1,20 +0,0 @@
1
- import * as n from "react";
2
- import "react/jsx-runtime";
3
- var r = n.createContext(
4
- void 0
5
- ), u = (e) => {
6
- const t = n.useContext(r);
7
- if (!t)
8
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
9
- return t;
10
- };
11
- function i(e, t) {
12
- return typeof e == "function" ? e(...t) : !!e;
13
- }
14
- function s() {
15
- }
16
- export {
17
- s as n,
18
- i as s,
19
- u
20
- };