@bigbinary/neeto-github-frontend 1.1.0-beta3 → 1.1.0-beta4

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/index.cjs.js CHANGED
@@ -2,18 +2,19 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var React = require('react');
5
+ var react = require('react');
6
6
  var classnames = require('classnames');
7
7
  var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
8
8
  var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
9
9
  var reactI18next = require('react-i18next');
10
- var jsxRuntime = require('react/jsx-runtime');
10
+ var reactQuery = require('@tanstack/react-query');
11
11
  var ramda = require('ramda');
12
12
  var axios = require('axios');
13
13
  var constants = require('@bigbinary/neeto-commons-frontend/constants');
14
14
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
15
15
  var misc = require('@bigbinary/neeto-icons/misc');
16
16
  var Typography = require('@bigbinary/neetoui/Typography');
17
+ var jsxRuntime = require('react/jsx-runtime');
17
18
  var neetoIcons = require('@bigbinary/neeto-icons');
18
19
  var Avatar = require('@bigbinary/neetoui/Avatar');
19
20
  var Button = require('@bigbinary/neetoui/Button');
@@ -25,25 +26,6 @@ var require$$0 = require('util');
25
26
 
26
27
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
27
28
 
28
- function _interopNamespace(e) {
29
- if (e && e.__esModule) return e;
30
- var n = Object.create(null);
31
- if (e) {
32
- Object.keys(e).forEach(function (k) {
33
- if (k !== 'default') {
34
- var d = Object.getOwnPropertyDescriptor(e, k);
35
- Object.defineProperty(n, k, d.get ? d : {
36
- enumerable: true,
37
- get: function () { return e[k]; }
38
- });
39
- }
40
- });
41
- }
42
- n["default"] = e;
43
- return Object.freeze(n);
44
- }
45
-
46
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
29
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
48
30
  var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
49
31
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
@@ -55,865 +37,6 @@ var DateFormat__default = /*#__PURE__*/_interopDefaultLegacy(DateFormat);
55
37
  var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
56
38
  var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
57
39
 
58
- // src/subscribable.ts
59
- var Subscribable = class {
60
- constructor() {
61
- this.listeners = /* @__PURE__ */ new Set();
62
- this.subscribe = this.subscribe.bind(this);
63
- }
64
- subscribe(listener) {
65
- this.listeners.add(listener);
66
- this.onSubscribe();
67
- return () => {
68
- this.listeners.delete(listener);
69
- this.onUnsubscribe();
70
- };
71
- }
72
- hasListeners() {
73
- return this.listeners.size > 0;
74
- }
75
- onSubscribe() {
76
- }
77
- onUnsubscribe() {
78
- }
79
- };
80
-
81
- // src/utils.ts
82
- var isServer = typeof window === "undefined" || "Deno" in globalThis;
83
- function noop() {
84
- return void 0;
85
- }
86
- function isValidTimeout(value) {
87
- return typeof value === "number" && value >= 0 && value !== Infinity;
88
- }
89
- function timeUntilStale(updatedAt, staleTime) {
90
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
91
- }
92
- function replaceEqualDeep(a, b) {
93
- if (a === b) {
94
- return a;
95
- }
96
- const array = isPlainArray(a) && isPlainArray(b);
97
- if (array || isPlainObject(a) && isPlainObject(b)) {
98
- const aItems = array ? a : Object.keys(a);
99
- const aSize = aItems.length;
100
- const bItems = array ? b : Object.keys(b);
101
- const bSize = bItems.length;
102
- const copy = array ? [] : {};
103
- let equalItems = 0;
104
- for (let i = 0; i < bSize; i++) {
105
- const key = array ? i : bItems[i];
106
- if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {
107
- copy[key] = void 0;
108
- equalItems++;
109
- } else {
110
- copy[key] = replaceEqualDeep(a[key], b[key]);
111
- if (copy[key] === a[key] && a[key] !== void 0) {
112
- equalItems++;
113
- }
114
- }
115
- }
116
- return aSize === bSize && equalItems === aSize ? a : copy;
117
- }
118
- return b;
119
- }
120
- function shallowEqualObjects(a, b) {
121
- if (!b || Object.keys(a).length !== Object.keys(b).length) {
122
- return false;
123
- }
124
- for (const key in a) {
125
- if (a[key] !== b[key]) {
126
- return false;
127
- }
128
- }
129
- return true;
130
- }
131
- function isPlainArray(value) {
132
- return Array.isArray(value) && value.length === Object.keys(value).length;
133
- }
134
- function isPlainObject(o) {
135
- if (!hasObjectPrototype(o)) {
136
- return false;
137
- }
138
- const ctor = o.constructor;
139
- if (ctor === void 0) {
140
- return true;
141
- }
142
- const prot = ctor.prototype;
143
- if (!hasObjectPrototype(prot)) {
144
- return false;
145
- }
146
- if (!prot.hasOwnProperty("isPrototypeOf")) {
147
- return false;
148
- }
149
- if (Object.getPrototypeOf(o) !== Object.prototype) {
150
- return false;
151
- }
152
- return true;
153
- }
154
- function hasObjectPrototype(o) {
155
- return Object.prototype.toString.call(o) === "[object Object]";
156
- }
157
- function replaceData(prevData, data, options) {
158
- if (typeof options.structuralSharing === "function") {
159
- return options.structuralSharing(prevData, data);
160
- } else if (options.structuralSharing !== false) {
161
- return replaceEqualDeep(prevData, data);
162
- }
163
- return data;
164
- }
165
-
166
- // src/focusManager.ts
167
- var FocusManager = class extends Subscribable {
168
- #focused;
169
- #cleanup;
170
- #setup;
171
- constructor() {
172
- super();
173
- this.#setup = (onFocus) => {
174
- if (!isServer && window.addEventListener) {
175
- const listener = () => onFocus();
176
- window.addEventListener("visibilitychange", listener, false);
177
- return () => {
178
- window.removeEventListener("visibilitychange", listener);
179
- };
180
- }
181
- return;
182
- };
183
- }
184
- onSubscribe() {
185
- if (!this.#cleanup) {
186
- this.setEventListener(this.#setup);
187
- }
188
- }
189
- onUnsubscribe() {
190
- if (!this.hasListeners()) {
191
- this.#cleanup?.();
192
- this.#cleanup = void 0;
193
- }
194
- }
195
- setEventListener(setup) {
196
- this.#setup = setup;
197
- this.#cleanup?.();
198
- this.#cleanup = setup((focused) => {
199
- if (typeof focused === "boolean") {
200
- this.setFocused(focused);
201
- } else {
202
- this.onFocus();
203
- }
204
- });
205
- }
206
- setFocused(focused) {
207
- const changed = this.#focused !== focused;
208
- if (changed) {
209
- this.#focused = focused;
210
- this.onFocus();
211
- }
212
- }
213
- onFocus() {
214
- const isFocused = this.isFocused();
215
- this.listeners.forEach((listener) => {
216
- listener(isFocused);
217
- });
218
- }
219
- isFocused() {
220
- if (typeof this.#focused === "boolean") {
221
- return this.#focused;
222
- }
223
- return globalThis.document?.visibilityState !== "hidden";
224
- }
225
- };
226
- var focusManager = new FocusManager();
227
-
228
- // src/onlineManager.ts
229
- var OnlineManager = class extends Subscribable {
230
- #online = true;
231
- #cleanup;
232
- #setup;
233
- constructor() {
234
- super();
235
- this.#setup = (onOnline) => {
236
- if (!isServer && window.addEventListener) {
237
- const onlineListener = () => onOnline(true);
238
- const offlineListener = () => onOnline(false);
239
- window.addEventListener("online", onlineListener, false);
240
- window.addEventListener("offline", offlineListener, false);
241
- return () => {
242
- window.removeEventListener("online", onlineListener);
243
- window.removeEventListener("offline", offlineListener);
244
- };
245
- }
246
- return;
247
- };
248
- }
249
- onSubscribe() {
250
- if (!this.#cleanup) {
251
- this.setEventListener(this.#setup);
252
- }
253
- }
254
- onUnsubscribe() {
255
- if (!this.hasListeners()) {
256
- this.#cleanup?.();
257
- this.#cleanup = void 0;
258
- }
259
- }
260
- setEventListener(setup) {
261
- this.#setup = setup;
262
- this.#cleanup?.();
263
- this.#cleanup = setup(this.setOnline.bind(this));
264
- }
265
- setOnline(online) {
266
- const changed = this.#online !== online;
267
- if (changed) {
268
- this.#online = online;
269
- this.listeners.forEach((listener) => {
270
- listener(online);
271
- });
272
- }
273
- }
274
- isOnline() {
275
- return this.#online;
276
- }
277
- };
278
- var onlineManager = new OnlineManager();
279
-
280
- // src/retryer.ts
281
- function canFetch(networkMode) {
282
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
283
- }
284
-
285
- // src/notifyManager.ts
286
- function createNotifyManager() {
287
- let queue = [];
288
- let transactions = 0;
289
- let notifyFn = (callback) => {
290
- callback();
291
- };
292
- let batchNotifyFn = (callback) => {
293
- callback();
294
- };
295
- let scheduleFn = (cb) => setTimeout(cb, 0);
296
- const setScheduler = (fn) => {
297
- scheduleFn = fn;
298
- };
299
- const batch = (callback) => {
300
- let result;
301
- transactions++;
302
- try {
303
- result = callback();
304
- } finally {
305
- transactions--;
306
- if (!transactions) {
307
- flush();
308
- }
309
- }
310
- return result;
311
- };
312
- const schedule = (callback) => {
313
- if (transactions) {
314
- queue.push(callback);
315
- } else {
316
- scheduleFn(() => {
317
- notifyFn(callback);
318
- });
319
- }
320
- };
321
- const batchCalls = (callback) => {
322
- return (...args) => {
323
- schedule(() => {
324
- callback(...args);
325
- });
326
- };
327
- };
328
- const flush = () => {
329
- const originalQueue = queue;
330
- queue = [];
331
- if (originalQueue.length) {
332
- scheduleFn(() => {
333
- batchNotifyFn(() => {
334
- originalQueue.forEach((callback) => {
335
- notifyFn(callback);
336
- });
337
- });
338
- });
339
- }
340
- };
341
- const setNotifyFunction = (fn) => {
342
- notifyFn = fn;
343
- };
344
- const setBatchNotifyFunction = (fn) => {
345
- batchNotifyFn = fn;
346
- };
347
- return {
348
- batch,
349
- batchCalls,
350
- schedule,
351
- setNotifyFunction,
352
- setBatchNotifyFunction,
353
- setScheduler
354
- };
355
- }
356
- var notifyManager = createNotifyManager();
357
-
358
- // src/query.ts
359
- function fetchState(data, options) {
360
- return {
361
- fetchFailureCount: 0,
362
- fetchFailureReason: null,
363
- fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
364
- ...data === void 0 && {
365
- error: null,
366
- status: "pending"
367
- }
368
- };
369
- }
370
-
371
- // src/queryObserver.ts
372
- var QueryObserver = class extends Subscribable {
373
- constructor(client, options) {
374
- super();
375
- this.options = options;
376
- this.#client = client;
377
- this.#selectError = null;
378
- this.bindMethods();
379
- this.setOptions(options);
380
- }
381
- #client;
382
- #currentQuery = void 0;
383
- #currentQueryInitialState = void 0;
384
- #currentResult = void 0;
385
- #currentResultState;
386
- #currentResultOptions;
387
- #selectError;
388
- #selectFn;
389
- #selectResult;
390
- // This property keeps track of the last query with defined data.
391
- // It will be used to pass the previous data and query to the placeholder function between renders.
392
- #lastQueryWithDefinedData;
393
- #staleTimeoutId;
394
- #refetchIntervalId;
395
- #currentRefetchInterval;
396
- #trackedProps = /* @__PURE__ */ new Set();
397
- bindMethods() {
398
- this.refetch = this.refetch.bind(this);
399
- }
400
- onSubscribe() {
401
- if (this.listeners.size === 1) {
402
- this.#currentQuery.addObserver(this);
403
- if (shouldFetchOnMount(this.#currentQuery, this.options)) {
404
- this.#executeFetch();
405
- } else {
406
- this.updateResult();
407
- }
408
- this.#updateTimers();
409
- }
410
- }
411
- onUnsubscribe() {
412
- if (!this.hasListeners()) {
413
- this.destroy();
414
- }
415
- }
416
- shouldFetchOnReconnect() {
417
- return shouldFetchOn(
418
- this.#currentQuery,
419
- this.options,
420
- this.options.refetchOnReconnect
421
- );
422
- }
423
- shouldFetchOnWindowFocus() {
424
- return shouldFetchOn(
425
- this.#currentQuery,
426
- this.options,
427
- this.options.refetchOnWindowFocus
428
- );
429
- }
430
- destroy() {
431
- this.listeners = /* @__PURE__ */ new Set();
432
- this.#clearStaleTimeout();
433
- this.#clearRefetchInterval();
434
- this.#currentQuery.removeObserver(this);
435
- }
436
- setOptions(options, notifyOptions) {
437
- const prevOptions = this.options;
438
- const prevQuery = this.#currentQuery;
439
- this.options = this.#client.defaultQueryOptions(options);
440
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean") {
441
- throw new Error("Expected enabled to be a boolean");
442
- }
443
- this.#updateQuery();
444
- this.#currentQuery.setOptions(this.options);
445
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
446
- this.#client.getQueryCache().notify({
447
- type: "observerOptionsUpdated",
448
- query: this.#currentQuery,
449
- observer: this
450
- });
451
- }
452
- const mounted = this.hasListeners();
453
- if (mounted && shouldFetchOptionally(
454
- this.#currentQuery,
455
- prevQuery,
456
- this.options,
457
- prevOptions
458
- )) {
459
- this.#executeFetch();
460
- }
461
- this.updateResult(notifyOptions);
462
- if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
463
- this.#updateStaleTimeout();
464
- }
465
- const nextRefetchInterval = this.#computeRefetchInterval();
466
- if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.#currentRefetchInterval)) {
467
- this.#updateRefetchInterval(nextRefetchInterval);
468
- }
469
- }
470
- getOptimisticResult(options) {
471
- const query = this.#client.getQueryCache().build(this.#client, options);
472
- const result = this.createResult(query, options);
473
- if (shouldAssignObserverCurrentProperties(this, result)) {
474
- this.#currentResult = result;
475
- this.#currentResultOptions = this.options;
476
- this.#currentResultState = this.#currentQuery.state;
477
- }
478
- return result;
479
- }
480
- getCurrentResult() {
481
- return this.#currentResult;
482
- }
483
- trackResult(result, onPropTracked) {
484
- const trackedResult = {};
485
- Object.keys(result).forEach((key) => {
486
- Object.defineProperty(trackedResult, key, {
487
- configurable: false,
488
- enumerable: true,
489
- get: () => {
490
- this.trackProp(key);
491
- onPropTracked?.(key);
492
- return result[key];
493
- }
494
- });
495
- });
496
- return trackedResult;
497
- }
498
- trackProp(key) {
499
- this.#trackedProps.add(key);
500
- }
501
- getCurrentQuery() {
502
- return this.#currentQuery;
503
- }
504
- refetch({ ...options } = {}) {
505
- return this.fetch({
506
- ...options
507
- });
508
- }
509
- fetchOptimistic(options) {
510
- const defaultedOptions = this.#client.defaultQueryOptions(options);
511
- const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
512
- query.isFetchingOptimistic = true;
513
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
514
- }
515
- fetch(fetchOptions) {
516
- return this.#executeFetch({
517
- ...fetchOptions,
518
- cancelRefetch: fetchOptions.cancelRefetch ?? true
519
- }).then(() => {
520
- this.updateResult();
521
- return this.#currentResult;
522
- });
523
- }
524
- #executeFetch(fetchOptions) {
525
- this.#updateQuery();
526
- let promise = this.#currentQuery.fetch(
527
- this.options,
528
- fetchOptions
529
- );
530
- if (!fetchOptions?.throwOnError) {
531
- promise = promise.catch(noop);
532
- }
533
- return promise;
534
- }
535
- #updateStaleTimeout() {
536
- this.#clearStaleTimeout();
537
- if (isServer || this.#currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
538
- return;
539
- }
540
- const time = timeUntilStale(
541
- this.#currentResult.dataUpdatedAt,
542
- this.options.staleTime
543
- );
544
- const timeout = time + 1;
545
- this.#staleTimeoutId = setTimeout(() => {
546
- if (!this.#currentResult.isStale) {
547
- this.updateResult();
548
- }
549
- }, timeout);
550
- }
551
- #computeRefetchInterval() {
552
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
553
- }
554
- #updateRefetchInterval(nextInterval) {
555
- this.#clearRefetchInterval();
556
- this.#currentRefetchInterval = nextInterval;
557
- if (isServer || this.options.enabled === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
558
- return;
559
- }
560
- this.#refetchIntervalId = setInterval(() => {
561
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
562
- this.#executeFetch();
563
- }
564
- }, this.#currentRefetchInterval);
565
- }
566
- #updateTimers() {
567
- this.#updateStaleTimeout();
568
- this.#updateRefetchInterval(this.#computeRefetchInterval());
569
- }
570
- #clearStaleTimeout() {
571
- if (this.#staleTimeoutId) {
572
- clearTimeout(this.#staleTimeoutId);
573
- this.#staleTimeoutId = void 0;
574
- }
575
- }
576
- #clearRefetchInterval() {
577
- if (this.#refetchIntervalId) {
578
- clearInterval(this.#refetchIntervalId);
579
- this.#refetchIntervalId = void 0;
580
- }
581
- }
582
- createResult(query, options) {
583
- const prevQuery = this.#currentQuery;
584
- const prevOptions = this.options;
585
- const prevResult = this.#currentResult;
586
- const prevResultState = this.#currentResultState;
587
- const prevResultOptions = this.#currentResultOptions;
588
- const queryChange = query !== prevQuery;
589
- const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
590
- const { state } = query;
591
- let newState = { ...state };
592
- let isPlaceholderData = false;
593
- let data;
594
- if (options._optimisticResults) {
595
- const mounted = this.hasListeners();
596
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
597
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
598
- if (fetchOnMount || fetchOptionally) {
599
- newState = {
600
- ...newState,
601
- ...fetchState(state.data, query.options)
602
- };
603
- }
604
- if (options._optimisticResults === "isRestoring") {
605
- newState.fetchStatus = "idle";
606
- }
607
- }
608
- let { error, errorUpdatedAt, status } = newState;
609
- if (options.select && newState.data !== void 0) {
610
- if (prevResult && newState.data === prevResultState?.data && options.select === this.#selectFn) {
611
- data = this.#selectResult;
612
- } else {
613
- try {
614
- this.#selectFn = options.select;
615
- data = options.select(newState.data);
616
- data = replaceData(prevResult?.data, data, options);
617
- this.#selectResult = data;
618
- this.#selectError = null;
619
- } catch (selectError) {
620
- this.#selectError = selectError;
621
- }
622
- }
623
- } else {
624
- data = newState.data;
625
- }
626
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
627
- let placeholderData;
628
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
629
- placeholderData = prevResult.data;
630
- } else {
631
- placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
632
- this.#lastQueryWithDefinedData?.state.data,
633
- this.#lastQueryWithDefinedData
634
- ) : options.placeholderData;
635
- if (options.select && placeholderData !== void 0) {
636
- try {
637
- placeholderData = options.select(placeholderData);
638
- this.#selectError = null;
639
- } catch (selectError) {
640
- this.#selectError = selectError;
641
- }
642
- }
643
- }
644
- if (placeholderData !== void 0) {
645
- status = "success";
646
- data = replaceData(
647
- prevResult?.data,
648
- placeholderData,
649
- options
650
- );
651
- isPlaceholderData = true;
652
- }
653
- }
654
- if (this.#selectError) {
655
- error = this.#selectError;
656
- data = this.#selectResult;
657
- errorUpdatedAt = Date.now();
658
- status = "error";
659
- }
660
- const isFetching = newState.fetchStatus === "fetching";
661
- const isPending = status === "pending";
662
- const isError = status === "error";
663
- const isLoading = isPending && isFetching;
664
- const hasData = data !== void 0;
665
- const result = {
666
- status,
667
- fetchStatus: newState.fetchStatus,
668
- isPending,
669
- isSuccess: status === "success",
670
- isError,
671
- isInitialLoading: isLoading,
672
- isLoading,
673
- data,
674
- dataUpdatedAt: newState.dataUpdatedAt,
675
- error,
676
- errorUpdatedAt,
677
- failureCount: newState.fetchFailureCount,
678
- failureReason: newState.fetchFailureReason,
679
- errorUpdateCount: newState.errorUpdateCount,
680
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
681
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
682
- isFetching,
683
- isRefetching: isFetching && !isPending,
684
- isLoadingError: isError && !hasData,
685
- isPaused: newState.fetchStatus === "paused",
686
- isPlaceholderData,
687
- isRefetchError: isError && hasData,
688
- isStale: isStale(query, options),
689
- refetch: this.refetch
690
- };
691
- return result;
692
- }
693
- updateResult(notifyOptions) {
694
- const prevResult = this.#currentResult;
695
- const nextResult = this.createResult(this.#currentQuery, this.options);
696
- this.#currentResultState = this.#currentQuery.state;
697
- this.#currentResultOptions = this.options;
698
- if (this.#currentResultState.data !== void 0) {
699
- this.#lastQueryWithDefinedData = this.#currentQuery;
700
- }
701
- if (shallowEqualObjects(nextResult, prevResult)) {
702
- return;
703
- }
704
- this.#currentResult = nextResult;
705
- const defaultNotifyOptions = {};
706
- const shouldNotifyListeners = () => {
707
- if (!prevResult) {
708
- return true;
709
- }
710
- const { notifyOnChangeProps } = this.options;
711
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
712
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
713
- return true;
714
- }
715
- const includedProps = new Set(
716
- notifyOnChangePropsValue ?? this.#trackedProps
717
- );
718
- if (this.options.throwOnError) {
719
- includedProps.add("error");
720
- }
721
- return Object.keys(this.#currentResult).some((key) => {
722
- const typedKey = key;
723
- const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
724
- return changed && includedProps.has(typedKey);
725
- });
726
- };
727
- if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {
728
- defaultNotifyOptions.listeners = true;
729
- }
730
- this.#notify({ ...defaultNotifyOptions, ...notifyOptions });
731
- }
732
- #updateQuery() {
733
- const query = this.#client.getQueryCache().build(this.#client, this.options);
734
- if (query === this.#currentQuery) {
735
- return;
736
- }
737
- const prevQuery = this.#currentQuery;
738
- this.#currentQuery = query;
739
- this.#currentQueryInitialState = query.state;
740
- if (this.hasListeners()) {
741
- prevQuery?.removeObserver(this);
742
- query.addObserver(this);
743
- }
744
- }
745
- onQueryUpdate() {
746
- this.updateResult();
747
- if (this.hasListeners()) {
748
- this.#updateTimers();
749
- }
750
- }
751
- #notify(notifyOptions) {
752
- notifyManager.batch(() => {
753
- if (notifyOptions.listeners) {
754
- this.listeners.forEach((listener) => {
755
- listener(this.#currentResult);
756
- });
757
- }
758
- this.#client.getQueryCache().notify({
759
- query: this.#currentQuery,
760
- type: "observerResultsUpdated"
761
- });
762
- });
763
- }
764
- };
765
- function shouldLoadOnMount(query, options) {
766
- return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
767
- }
768
- function shouldFetchOnMount(query, options) {
769
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
770
- }
771
- function shouldFetchOn(query, options, field) {
772
- if (options.enabled !== false) {
773
- const value = typeof field === "function" ? field(query) : field;
774
- return value === "always" || value !== false && isStale(query, options);
775
- }
776
- return false;
777
- }
778
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
779
- return (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
780
- }
781
- function isStale(query, options) {
782
- return options.enabled !== false && query.isStaleByTime(options.staleTime);
783
- }
784
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
785
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
786
- return true;
787
- }
788
- return false;
789
- }
790
-
791
- var QueryClientContext = React__namespace.createContext(
792
- void 0
793
- );
794
- var useQueryClient = (queryClient) => {
795
- const client = React__namespace.useContext(QueryClientContext);
796
- if (queryClient) {
797
- return queryClient;
798
- }
799
- if (!client) {
800
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
801
- }
802
- return client;
803
- };
804
-
805
- var IsRestoringContext = React__namespace.createContext(false);
806
- var useIsRestoring = () => React__namespace.useContext(IsRestoringContext);
807
- IsRestoringContext.Provider;
808
-
809
- function createValue() {
810
- let isReset = false;
811
- return {
812
- clearReset: () => {
813
- isReset = false;
814
- },
815
- reset: () => {
816
- isReset = true;
817
- },
818
- isReset: () => {
819
- return isReset;
820
- }
821
- };
822
- }
823
- var QueryErrorResetBoundaryContext = React__namespace.createContext(createValue());
824
- var useQueryErrorResetBoundary = () => React__namespace.useContext(QueryErrorResetBoundaryContext);
825
-
826
- // src/utils.ts
827
- function shouldThrowError(throwError, params) {
828
- if (typeof throwError === "function") {
829
- return throwError(...params);
830
- }
831
- return !!throwError;
832
- }
833
-
834
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
835
- if (options.suspense || options.throwOnError) {
836
- if (!errorResetBoundary.isReset()) {
837
- options.retryOnMount = false;
838
- }
839
- }
840
- };
841
- var useClearResetErrorBoundary = (errorResetBoundary) => {
842
- React__namespace.useEffect(() => {
843
- errorResetBoundary.clearReset();
844
- }, [errorResetBoundary]);
845
- };
846
- var getHasError = ({
847
- result,
848
- errorResetBoundary,
849
- throwOnError,
850
- query
851
- }) => {
852
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && shouldThrowError(throwOnError, [result.error, query]);
853
- };
854
-
855
- // src/suspense.ts
856
- var ensureStaleTime = (defaultedOptions) => {
857
- if (defaultedOptions.suspense) {
858
- if (typeof defaultedOptions.staleTime !== "number") {
859
- defaultedOptions.staleTime = 1e3;
860
- }
861
- }
862
- };
863
- var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
864
- var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
865
- errorResetBoundary.clearReset();
866
- });
867
-
868
- function useBaseQuery(options, Observer, queryClient) {
869
- const client = useQueryClient(queryClient);
870
- const isRestoring = useIsRestoring();
871
- const errorResetBoundary = useQueryErrorResetBoundary();
872
- const defaultedOptions = client.defaultQueryOptions(options);
873
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
874
- ensureStaleTime(defaultedOptions);
875
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
876
- useClearResetErrorBoundary(errorResetBoundary);
877
- const [observer] = React__namespace.useState(
878
- () => new Observer(
879
- client,
880
- defaultedOptions
881
- )
882
- );
883
- const result = observer.getOptimisticResult(defaultedOptions);
884
- React__namespace.useSyncExternalStore(
885
- React__namespace.useCallback(
886
- (onStoreChange) => {
887
- const unsubscribe = isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange));
888
- observer.updateResult();
889
- return unsubscribe;
890
- },
891
- [observer, isRestoring]
892
- ),
893
- () => observer.getCurrentResult(),
894
- () => observer.getCurrentResult()
895
- );
896
- React__namespace.useEffect(() => {
897
- observer.setOptions(defaultedOptions, { listeners: false });
898
- }, [defaultedOptions, observer]);
899
- if (shouldSuspend(defaultedOptions, result)) {
900
- throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
901
- }
902
- if (getHasError({
903
- result,
904
- errorResetBoundary,
905
- throwOnError: defaultedOptions.throwOnError,
906
- query: client.getQueryCache().get(defaultedOptions.queryHash)
907
- })) {
908
- throw result.error;
909
- }
910
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
911
- }
912
-
913
- function useQuery(options, queryClient) {
914
- return useBaseQuery(options, QueryObserver, queryClient);
915
- }
916
-
917
40
  var _globalProps$organiza$1;
918
41
  var GITHUB_INTEGRATIONS_BASE_API_URL = "/github_integrations";
919
42
  ({
@@ -947,7 +70,7 @@ var STALE_TIME_CONFIG = {
947
70
 
948
71
  var useFetchGithubRepositories = function useFetchGithubRepositories(_ref) {
949
72
  var isConnected = _ref.isConnected;
950
- return useQuery({
73
+ return reactQuery.useQuery({
951
74
  queryKey: [QUERY_KEYS.GITHUB_REPOSITORIES_LIST],
952
75
  queryFn: githubAccountsApi.repositories,
953
76
  staleTime: STALE_TIME_CONFIG.staleTime,
@@ -1166,7 +289,7 @@ var RepositoryTile = function RepositoryTile(_ref) {
1166
289
  repository = _ref.repository;
1167
290
  var _useTranslation = reactI18next.useTranslation(),
1168
291
  t = _useTranslation.t;
1169
- var _useState = React.useState(false),
292
+ var _useState = react.useState(false),
1170
293
  _useState2 = _slicedToArray(_useState, 2),
1171
294
  isLoading = _useState2[0],
1172
295
  setIsLoading = _useState2[1];
@@ -1231,7 +354,7 @@ var List = reactUtils.withT(function (_ref) {
1231
354
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
1232
355
  className: "m-0 h-full w-full p-0",
1233
356
  children: neetoCist.isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
1234
- return /*#__PURE__*/React.createElement(RepositoryTile, {
357
+ return /*#__PURE__*/react.createElement(RepositoryTile, {
1235
358
  isConnecting: isConnecting,
1236
359
  onConnect: onConnect,
1237
360
  repository: repository,
@@ -1280,7 +403,7 @@ var Private = function Private(_ref) {
1280
403
  troubleshootUrl = _ref.troubleshootUrl;
1281
404
  var _useTranslation = reactI18next.useTranslation(),
1282
405
  t = _useTranslation.t;
1283
- var _useState = React.useState(repositories),
406
+ var _useState = react.useState(repositories),
1284
407
  _useState2 = _slicedToArray(_useState, 2),
1285
408
  filteredRepositories = _useState2[0],
1286
409
  setFilteredRepositories = _useState2[1];
@@ -3697,7 +2820,7 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
3697
2820
  title = _ref$title === void 0 ? "" : _ref$title;
3698
2821
  var _useTranslation = reactI18next.useTranslation(),
3699
2822
  t = _useTranslation.t;
3700
- var initialFocusRef = React.useRef(null);
2823
+ var initialFocusRef = react.useRef(null);
3701
2824
  var _useFetchGithubReposi = useFetchGithubRepositories({
3702
2825
  isConnected: isOpen && isConnected
3703
2826
  }),