@bigbinary/neeto-github-frontend 1.0.28 → 1.1.0-beta2

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.js CHANGED
@@ -1,60 +1,882 @@
1
- import React, { useState, useRef } from 'react';
1
+ import * as React from 'react';
2
+ import { useState, createElement, useRef } from 'react';
2
3
  import classnames from 'classnames';
3
4
  import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
4
5
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
5
6
  import { Trans, useTranslation } from 'react-i18next';
6
7
  import { isNotNil } from 'ramda';
7
- import { useQuery } from 'react-query';
8
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
9
  import axios from 'axios';
9
10
  import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
10
11
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
11
12
  import { Github } from '@bigbinary/neeto-icons/misc';
12
- import { Typography, Button, Avatar, Pane } from '@bigbinary/neetoui';
13
+ import Typography from '@bigbinary/neetoui/Typography';
13
14
  import { Settings, Plus, Building, Lock } from '@bigbinary/neeto-icons';
14
- import { isPresent, findBy, noop } from '@bigbinary/neeto-cist';
15
+ import Avatar from '@bigbinary/neetoui/Avatar';
16
+ import Button from '@bigbinary/neetoui/Button';
17
+ import { isPresent, findBy, noop as noop$1 } from '@bigbinary/neeto-cist';
15
18
  import Search from '@bigbinary/neeto-molecules/Search';
16
19
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
20
+ import Pane from '@bigbinary/neetoui/Pane';
17
21
  import require$$0 from 'util';
18
22
 
19
- function _typeof(o) {
20
- "@babel/helpers - typeof";
23
+ // src/subscribable.ts
24
+ var Subscribable = class {
25
+ constructor() {
26
+ this.listeners = /* @__PURE__ */ new Set();
27
+ this.subscribe = this.subscribe.bind(this);
28
+ }
29
+ subscribe(listener) {
30
+ this.listeners.add(listener);
31
+ this.onSubscribe();
32
+ return () => {
33
+ this.listeners.delete(listener);
34
+ this.onUnsubscribe();
35
+ };
36
+ }
37
+ hasListeners() {
38
+ return this.listeners.size > 0;
39
+ }
40
+ onSubscribe() {
41
+ }
42
+ onUnsubscribe() {
43
+ }
44
+ };
21
45
 
22
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
23
- return typeof o;
24
- } : function (o) {
25
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
26
- }, _typeof(o);
46
+ // src/utils.ts
47
+ var isServer = typeof window === "undefined" || "Deno" in globalThis;
48
+ function noop() {
49
+ return void 0;
50
+ }
51
+ function isValidTimeout(value) {
52
+ return typeof value === "number" && value >= 0 && value !== Infinity;
53
+ }
54
+ function timeUntilStale(updatedAt, staleTime) {
55
+ return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
56
+ }
57
+ function replaceEqualDeep(a, b) {
58
+ if (a === b) {
59
+ return a;
60
+ }
61
+ const array = isPlainArray(a) && isPlainArray(b);
62
+ if (array || isPlainObject(a) && isPlainObject(b)) {
63
+ const aItems = array ? a : Object.keys(a);
64
+ const aSize = aItems.length;
65
+ const bItems = array ? b : Object.keys(b);
66
+ const bSize = bItems.length;
67
+ const copy = array ? [] : {};
68
+ let equalItems = 0;
69
+ for (let i = 0; i < bSize; i++) {
70
+ const key = array ? i : bItems[i];
71
+ if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {
72
+ copy[key] = void 0;
73
+ equalItems++;
74
+ } else {
75
+ copy[key] = replaceEqualDeep(a[key], b[key]);
76
+ if (copy[key] === a[key] && a[key] !== void 0) {
77
+ equalItems++;
78
+ }
79
+ }
80
+ }
81
+ return aSize === bSize && equalItems === aSize ? a : copy;
82
+ }
83
+ return b;
84
+ }
85
+ function shallowEqualObjects(a, b) {
86
+ if (!b || Object.keys(a).length !== Object.keys(b).length) {
87
+ return false;
88
+ }
89
+ for (const key in a) {
90
+ if (a[key] !== b[key]) {
91
+ return false;
92
+ }
93
+ }
94
+ return true;
95
+ }
96
+ function isPlainArray(value) {
97
+ return Array.isArray(value) && value.length === Object.keys(value).length;
98
+ }
99
+ function isPlainObject(o) {
100
+ if (!hasObjectPrototype(o)) {
101
+ return false;
102
+ }
103
+ const ctor = o.constructor;
104
+ if (ctor === void 0) {
105
+ return true;
106
+ }
107
+ const prot = ctor.prototype;
108
+ if (!hasObjectPrototype(prot)) {
109
+ return false;
110
+ }
111
+ if (!prot.hasOwnProperty("isPrototypeOf")) {
112
+ return false;
113
+ }
114
+ if (Object.getPrototypeOf(o) !== Object.prototype) {
115
+ return false;
116
+ }
117
+ return true;
118
+ }
119
+ function hasObjectPrototype(o) {
120
+ return Object.prototype.toString.call(o) === "[object Object]";
121
+ }
122
+ function replaceData(prevData, data, options) {
123
+ if (typeof options.structuralSharing === "function") {
124
+ return options.structuralSharing(prevData, data);
125
+ } else if (options.structuralSharing !== false) {
126
+ return replaceEqualDeep(prevData, data);
127
+ }
128
+ return data;
27
129
  }
28
130
 
29
- function _toPrimitive(input, hint) {
30
- if (_typeof(input) !== "object" || input === null) return input;
31
- var prim = input[Symbol.toPrimitive];
32
- if (prim !== undefined) {
33
- var res = prim.call(input, hint || "default");
34
- if (_typeof(res) !== "object") return res;
35
- throw new TypeError("@@toPrimitive must return a primitive value.");
131
+ // src/focusManager.ts
132
+ var FocusManager = class extends Subscribable {
133
+ #focused;
134
+ #cleanup;
135
+ #setup;
136
+ constructor() {
137
+ super();
138
+ this.#setup = (onFocus) => {
139
+ if (!isServer && window.addEventListener) {
140
+ const listener = () => onFocus();
141
+ window.addEventListener("visibilitychange", listener, false);
142
+ return () => {
143
+ window.removeEventListener("visibilitychange", listener);
144
+ };
145
+ }
146
+ return;
147
+ };
148
+ }
149
+ onSubscribe() {
150
+ if (!this.#cleanup) {
151
+ this.setEventListener(this.#setup);
152
+ }
153
+ }
154
+ onUnsubscribe() {
155
+ if (!this.hasListeners()) {
156
+ this.#cleanup?.();
157
+ this.#cleanup = void 0;
158
+ }
159
+ }
160
+ setEventListener(setup) {
161
+ this.#setup = setup;
162
+ this.#cleanup?.();
163
+ this.#cleanup = setup((focused) => {
164
+ if (typeof focused === "boolean") {
165
+ this.setFocused(focused);
166
+ } else {
167
+ this.onFocus();
168
+ }
169
+ });
170
+ }
171
+ setFocused(focused) {
172
+ const changed = this.#focused !== focused;
173
+ if (changed) {
174
+ this.#focused = focused;
175
+ this.onFocus();
176
+ }
177
+ }
178
+ onFocus() {
179
+ const isFocused = this.isFocused();
180
+ this.listeners.forEach((listener) => {
181
+ listener(isFocused);
182
+ });
183
+ }
184
+ isFocused() {
185
+ if (typeof this.#focused === "boolean") {
186
+ return this.#focused;
187
+ }
188
+ return globalThis.document?.visibilityState !== "hidden";
189
+ }
190
+ };
191
+ var focusManager = new FocusManager();
192
+
193
+ // src/onlineManager.ts
194
+ var OnlineManager = class extends Subscribable {
195
+ #online = true;
196
+ #cleanup;
197
+ #setup;
198
+ constructor() {
199
+ super();
200
+ this.#setup = (onOnline) => {
201
+ if (!isServer && window.addEventListener) {
202
+ const onlineListener = () => onOnline(true);
203
+ const offlineListener = () => onOnline(false);
204
+ window.addEventListener("online", onlineListener, false);
205
+ window.addEventListener("offline", offlineListener, false);
206
+ return () => {
207
+ window.removeEventListener("online", onlineListener);
208
+ window.removeEventListener("offline", offlineListener);
209
+ };
210
+ }
211
+ return;
212
+ };
213
+ }
214
+ onSubscribe() {
215
+ if (!this.#cleanup) {
216
+ this.setEventListener(this.#setup);
217
+ }
218
+ }
219
+ onUnsubscribe() {
220
+ if (!this.hasListeners()) {
221
+ this.#cleanup?.();
222
+ this.#cleanup = void 0;
223
+ }
224
+ }
225
+ setEventListener(setup) {
226
+ this.#setup = setup;
227
+ this.#cleanup?.();
228
+ this.#cleanup = setup(this.setOnline.bind(this));
229
+ }
230
+ setOnline(online) {
231
+ const changed = this.#online !== online;
232
+ if (changed) {
233
+ this.#online = online;
234
+ this.listeners.forEach((listener) => {
235
+ listener(online);
236
+ });
237
+ }
238
+ }
239
+ isOnline() {
240
+ return this.#online;
36
241
  }
37
- return (hint === "string" ? String : Number)(input);
242
+ };
243
+ var onlineManager = new OnlineManager();
244
+
245
+ // src/retryer.ts
246
+ function canFetch(networkMode) {
247
+ return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
38
248
  }
39
249
 
40
- function _toPropertyKey(arg) {
41
- var key = _toPrimitive(arg, "string");
42
- return _typeof(key) === "symbol" ? key : String(key);
250
+ // src/notifyManager.ts
251
+ function createNotifyManager() {
252
+ let queue = [];
253
+ let transactions = 0;
254
+ let notifyFn = (callback) => {
255
+ callback();
256
+ };
257
+ let batchNotifyFn = (callback) => {
258
+ callback();
259
+ };
260
+ let scheduleFn = (cb) => setTimeout(cb, 0);
261
+ const setScheduler = (fn) => {
262
+ scheduleFn = fn;
263
+ };
264
+ const batch = (callback) => {
265
+ let result;
266
+ transactions++;
267
+ try {
268
+ result = callback();
269
+ } finally {
270
+ transactions--;
271
+ if (!transactions) {
272
+ flush();
273
+ }
274
+ }
275
+ return result;
276
+ };
277
+ const schedule = (callback) => {
278
+ if (transactions) {
279
+ queue.push(callback);
280
+ } else {
281
+ scheduleFn(() => {
282
+ notifyFn(callback);
283
+ });
284
+ }
285
+ };
286
+ const batchCalls = (callback) => {
287
+ return (...args) => {
288
+ schedule(() => {
289
+ callback(...args);
290
+ });
291
+ };
292
+ };
293
+ const flush = () => {
294
+ const originalQueue = queue;
295
+ queue = [];
296
+ if (originalQueue.length) {
297
+ scheduleFn(() => {
298
+ batchNotifyFn(() => {
299
+ originalQueue.forEach((callback) => {
300
+ notifyFn(callback);
301
+ });
302
+ });
303
+ });
304
+ }
305
+ };
306
+ const setNotifyFunction = (fn) => {
307
+ notifyFn = fn;
308
+ };
309
+ const setBatchNotifyFunction = (fn) => {
310
+ batchNotifyFn = fn;
311
+ };
312
+ return {
313
+ batch,
314
+ batchCalls,
315
+ schedule,
316
+ setNotifyFunction,
317
+ setBatchNotifyFunction,
318
+ setScheduler
319
+ };
320
+ }
321
+ var notifyManager = createNotifyManager();
322
+
323
+ // src/query.ts
324
+ function fetchState(data, options) {
325
+ return {
326
+ fetchFailureCount: 0,
327
+ fetchFailureReason: null,
328
+ fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
329
+ ...data === void 0 && {
330
+ error: null,
331
+ status: "pending"
332
+ }
333
+ };
43
334
  }
44
335
 
45
- function _defineProperty(obj, key, value) {
46
- key = _toPropertyKey(key);
47
- if (key in obj) {
48
- Object.defineProperty(obj, key, {
49
- value: value,
50
- enumerable: true,
51
- configurable: true,
52
- writable: true
336
+ // src/queryObserver.ts
337
+ var QueryObserver = class extends Subscribable {
338
+ constructor(client, options) {
339
+ super();
340
+ this.options = options;
341
+ this.#client = client;
342
+ this.#selectError = null;
343
+ this.bindMethods();
344
+ this.setOptions(options);
345
+ }
346
+ #client;
347
+ #currentQuery = void 0;
348
+ #currentQueryInitialState = void 0;
349
+ #currentResult = void 0;
350
+ #currentResultState;
351
+ #currentResultOptions;
352
+ #selectError;
353
+ #selectFn;
354
+ #selectResult;
355
+ // This property keeps track of the last query with defined data.
356
+ // It will be used to pass the previous data and query to the placeholder function between renders.
357
+ #lastQueryWithDefinedData;
358
+ #staleTimeoutId;
359
+ #refetchIntervalId;
360
+ #currentRefetchInterval;
361
+ #trackedProps = /* @__PURE__ */ new Set();
362
+ bindMethods() {
363
+ this.refetch = this.refetch.bind(this);
364
+ }
365
+ onSubscribe() {
366
+ if (this.listeners.size === 1) {
367
+ this.#currentQuery.addObserver(this);
368
+ if (shouldFetchOnMount(this.#currentQuery, this.options)) {
369
+ this.#executeFetch();
370
+ } else {
371
+ this.updateResult();
372
+ }
373
+ this.#updateTimers();
374
+ }
375
+ }
376
+ onUnsubscribe() {
377
+ if (!this.hasListeners()) {
378
+ this.destroy();
379
+ }
380
+ }
381
+ shouldFetchOnReconnect() {
382
+ return shouldFetchOn(
383
+ this.#currentQuery,
384
+ this.options,
385
+ this.options.refetchOnReconnect
386
+ );
387
+ }
388
+ shouldFetchOnWindowFocus() {
389
+ return shouldFetchOn(
390
+ this.#currentQuery,
391
+ this.options,
392
+ this.options.refetchOnWindowFocus
393
+ );
394
+ }
395
+ destroy() {
396
+ this.listeners = /* @__PURE__ */ new Set();
397
+ this.#clearStaleTimeout();
398
+ this.#clearRefetchInterval();
399
+ this.#currentQuery.removeObserver(this);
400
+ }
401
+ setOptions(options, notifyOptions) {
402
+ const prevOptions = this.options;
403
+ const prevQuery = this.#currentQuery;
404
+ this.options = this.#client.defaultQueryOptions(options);
405
+ if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean") {
406
+ throw new Error("Expected enabled to be a boolean");
407
+ }
408
+ this.#updateQuery();
409
+ this.#currentQuery.setOptions(this.options);
410
+ if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
411
+ this.#client.getQueryCache().notify({
412
+ type: "observerOptionsUpdated",
413
+ query: this.#currentQuery,
414
+ observer: this
415
+ });
416
+ }
417
+ const mounted = this.hasListeners();
418
+ if (mounted && shouldFetchOptionally(
419
+ this.#currentQuery,
420
+ prevQuery,
421
+ this.options,
422
+ prevOptions
423
+ )) {
424
+ this.#executeFetch();
425
+ }
426
+ this.updateResult(notifyOptions);
427
+ if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
428
+ this.#updateStaleTimeout();
429
+ }
430
+ const nextRefetchInterval = this.#computeRefetchInterval();
431
+ if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.#currentRefetchInterval)) {
432
+ this.#updateRefetchInterval(nextRefetchInterval);
433
+ }
434
+ }
435
+ getOptimisticResult(options) {
436
+ const query = this.#client.getQueryCache().build(this.#client, options);
437
+ const result = this.createResult(query, options);
438
+ if (shouldAssignObserverCurrentProperties(this, result)) {
439
+ this.#currentResult = result;
440
+ this.#currentResultOptions = this.options;
441
+ this.#currentResultState = this.#currentQuery.state;
442
+ }
443
+ return result;
444
+ }
445
+ getCurrentResult() {
446
+ return this.#currentResult;
447
+ }
448
+ trackResult(result, onPropTracked) {
449
+ const trackedResult = {};
450
+ Object.keys(result).forEach((key) => {
451
+ Object.defineProperty(trackedResult, key, {
452
+ configurable: false,
453
+ enumerable: true,
454
+ get: () => {
455
+ this.trackProp(key);
456
+ onPropTracked?.(key);
457
+ return result[key];
458
+ }
459
+ });
460
+ });
461
+ return trackedResult;
462
+ }
463
+ trackProp(key) {
464
+ this.#trackedProps.add(key);
465
+ }
466
+ getCurrentQuery() {
467
+ return this.#currentQuery;
468
+ }
469
+ refetch({ ...options } = {}) {
470
+ return this.fetch({
471
+ ...options
472
+ });
473
+ }
474
+ fetchOptimistic(options) {
475
+ const defaultedOptions = this.#client.defaultQueryOptions(options);
476
+ const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
477
+ query.isFetchingOptimistic = true;
478
+ return query.fetch().then(() => this.createResult(query, defaultedOptions));
479
+ }
480
+ fetch(fetchOptions) {
481
+ return this.#executeFetch({
482
+ ...fetchOptions,
483
+ cancelRefetch: fetchOptions.cancelRefetch ?? true
484
+ }).then(() => {
485
+ this.updateResult();
486
+ return this.#currentResult;
53
487
  });
54
- } else {
55
- obj[key] = value;
56
488
  }
57
- return obj;
489
+ #executeFetch(fetchOptions) {
490
+ this.#updateQuery();
491
+ let promise = this.#currentQuery.fetch(
492
+ this.options,
493
+ fetchOptions
494
+ );
495
+ if (!fetchOptions?.throwOnError) {
496
+ promise = promise.catch(noop);
497
+ }
498
+ return promise;
499
+ }
500
+ #updateStaleTimeout() {
501
+ this.#clearStaleTimeout();
502
+ if (isServer || this.#currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
503
+ return;
504
+ }
505
+ const time = timeUntilStale(
506
+ this.#currentResult.dataUpdatedAt,
507
+ this.options.staleTime
508
+ );
509
+ const timeout = time + 1;
510
+ this.#staleTimeoutId = setTimeout(() => {
511
+ if (!this.#currentResult.isStale) {
512
+ this.updateResult();
513
+ }
514
+ }, timeout);
515
+ }
516
+ #computeRefetchInterval() {
517
+ return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
518
+ }
519
+ #updateRefetchInterval(nextInterval) {
520
+ this.#clearRefetchInterval();
521
+ this.#currentRefetchInterval = nextInterval;
522
+ if (isServer || this.options.enabled === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
523
+ return;
524
+ }
525
+ this.#refetchIntervalId = setInterval(() => {
526
+ if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
527
+ this.#executeFetch();
528
+ }
529
+ }, this.#currentRefetchInterval);
530
+ }
531
+ #updateTimers() {
532
+ this.#updateStaleTimeout();
533
+ this.#updateRefetchInterval(this.#computeRefetchInterval());
534
+ }
535
+ #clearStaleTimeout() {
536
+ if (this.#staleTimeoutId) {
537
+ clearTimeout(this.#staleTimeoutId);
538
+ this.#staleTimeoutId = void 0;
539
+ }
540
+ }
541
+ #clearRefetchInterval() {
542
+ if (this.#refetchIntervalId) {
543
+ clearInterval(this.#refetchIntervalId);
544
+ this.#refetchIntervalId = void 0;
545
+ }
546
+ }
547
+ createResult(query, options) {
548
+ const prevQuery = this.#currentQuery;
549
+ const prevOptions = this.options;
550
+ const prevResult = this.#currentResult;
551
+ const prevResultState = this.#currentResultState;
552
+ const prevResultOptions = this.#currentResultOptions;
553
+ const queryChange = query !== prevQuery;
554
+ const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
555
+ const { state } = query;
556
+ let newState = { ...state };
557
+ let isPlaceholderData = false;
558
+ let data;
559
+ if (options._optimisticResults) {
560
+ const mounted = this.hasListeners();
561
+ const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
562
+ const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
563
+ if (fetchOnMount || fetchOptionally) {
564
+ newState = {
565
+ ...newState,
566
+ ...fetchState(state.data, query.options)
567
+ };
568
+ }
569
+ if (options._optimisticResults === "isRestoring") {
570
+ newState.fetchStatus = "idle";
571
+ }
572
+ }
573
+ let { error, errorUpdatedAt, status } = newState;
574
+ if (options.select && newState.data !== void 0) {
575
+ if (prevResult && newState.data === prevResultState?.data && options.select === this.#selectFn) {
576
+ data = this.#selectResult;
577
+ } else {
578
+ try {
579
+ this.#selectFn = options.select;
580
+ data = options.select(newState.data);
581
+ data = replaceData(prevResult?.data, data, options);
582
+ this.#selectResult = data;
583
+ this.#selectError = null;
584
+ } catch (selectError) {
585
+ this.#selectError = selectError;
586
+ }
587
+ }
588
+ } else {
589
+ data = newState.data;
590
+ }
591
+ if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
592
+ let placeholderData;
593
+ if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
594
+ placeholderData = prevResult.data;
595
+ } else {
596
+ placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
597
+ this.#lastQueryWithDefinedData?.state.data,
598
+ this.#lastQueryWithDefinedData
599
+ ) : options.placeholderData;
600
+ if (options.select && placeholderData !== void 0) {
601
+ try {
602
+ placeholderData = options.select(placeholderData);
603
+ this.#selectError = null;
604
+ } catch (selectError) {
605
+ this.#selectError = selectError;
606
+ }
607
+ }
608
+ }
609
+ if (placeholderData !== void 0) {
610
+ status = "success";
611
+ data = replaceData(
612
+ prevResult?.data,
613
+ placeholderData,
614
+ options
615
+ );
616
+ isPlaceholderData = true;
617
+ }
618
+ }
619
+ if (this.#selectError) {
620
+ error = this.#selectError;
621
+ data = this.#selectResult;
622
+ errorUpdatedAt = Date.now();
623
+ status = "error";
624
+ }
625
+ const isFetching = newState.fetchStatus === "fetching";
626
+ const isPending = status === "pending";
627
+ const isError = status === "error";
628
+ const isLoading = isPending && isFetching;
629
+ const hasData = data !== void 0;
630
+ const result = {
631
+ status,
632
+ fetchStatus: newState.fetchStatus,
633
+ isPending,
634
+ isSuccess: status === "success",
635
+ isError,
636
+ isInitialLoading: isLoading,
637
+ isLoading,
638
+ data,
639
+ dataUpdatedAt: newState.dataUpdatedAt,
640
+ error,
641
+ errorUpdatedAt,
642
+ failureCount: newState.fetchFailureCount,
643
+ failureReason: newState.fetchFailureReason,
644
+ errorUpdateCount: newState.errorUpdateCount,
645
+ isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
646
+ isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
647
+ isFetching,
648
+ isRefetching: isFetching && !isPending,
649
+ isLoadingError: isError && !hasData,
650
+ isPaused: newState.fetchStatus === "paused",
651
+ isPlaceholderData,
652
+ isRefetchError: isError && hasData,
653
+ isStale: isStale(query, options),
654
+ refetch: this.refetch
655
+ };
656
+ return result;
657
+ }
658
+ updateResult(notifyOptions) {
659
+ const prevResult = this.#currentResult;
660
+ const nextResult = this.createResult(this.#currentQuery, this.options);
661
+ this.#currentResultState = this.#currentQuery.state;
662
+ this.#currentResultOptions = this.options;
663
+ if (this.#currentResultState.data !== void 0) {
664
+ this.#lastQueryWithDefinedData = this.#currentQuery;
665
+ }
666
+ if (shallowEqualObjects(nextResult, prevResult)) {
667
+ return;
668
+ }
669
+ this.#currentResult = nextResult;
670
+ const defaultNotifyOptions = {};
671
+ const shouldNotifyListeners = () => {
672
+ if (!prevResult) {
673
+ return true;
674
+ }
675
+ const { notifyOnChangeProps } = this.options;
676
+ const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
677
+ if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
678
+ return true;
679
+ }
680
+ const includedProps = new Set(
681
+ notifyOnChangePropsValue ?? this.#trackedProps
682
+ );
683
+ if (this.options.throwOnError) {
684
+ includedProps.add("error");
685
+ }
686
+ return Object.keys(this.#currentResult).some((key) => {
687
+ const typedKey = key;
688
+ const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
689
+ return changed && includedProps.has(typedKey);
690
+ });
691
+ };
692
+ if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {
693
+ defaultNotifyOptions.listeners = true;
694
+ }
695
+ this.#notify({ ...defaultNotifyOptions, ...notifyOptions });
696
+ }
697
+ #updateQuery() {
698
+ const query = this.#client.getQueryCache().build(this.#client, this.options);
699
+ if (query === this.#currentQuery) {
700
+ return;
701
+ }
702
+ const prevQuery = this.#currentQuery;
703
+ this.#currentQuery = query;
704
+ this.#currentQueryInitialState = query.state;
705
+ if (this.hasListeners()) {
706
+ prevQuery?.removeObserver(this);
707
+ query.addObserver(this);
708
+ }
709
+ }
710
+ onQueryUpdate() {
711
+ this.updateResult();
712
+ if (this.hasListeners()) {
713
+ this.#updateTimers();
714
+ }
715
+ }
716
+ #notify(notifyOptions) {
717
+ notifyManager.batch(() => {
718
+ if (notifyOptions.listeners) {
719
+ this.listeners.forEach((listener) => {
720
+ listener(this.#currentResult);
721
+ });
722
+ }
723
+ this.#client.getQueryCache().notify({
724
+ query: this.#currentQuery,
725
+ type: "observerResultsUpdated"
726
+ });
727
+ });
728
+ }
729
+ };
730
+ function shouldLoadOnMount(query, options) {
731
+ return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
732
+ }
733
+ function shouldFetchOnMount(query, options) {
734
+ return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
735
+ }
736
+ function shouldFetchOn(query, options, field) {
737
+ if (options.enabled !== false) {
738
+ const value = typeof field === "function" ? field(query) : field;
739
+ return value === "always" || value !== false && isStale(query, options);
740
+ }
741
+ return false;
742
+ }
743
+ function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
744
+ return (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
745
+ }
746
+ function isStale(query, options) {
747
+ return options.enabled !== false && query.isStaleByTime(options.staleTime);
748
+ }
749
+ function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
750
+ if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
751
+ return true;
752
+ }
753
+ return false;
754
+ }
755
+
756
+ var QueryClientContext = React.createContext(
757
+ void 0
758
+ );
759
+ var useQueryClient = (queryClient) => {
760
+ const client = React.useContext(QueryClientContext);
761
+ if (queryClient) {
762
+ return queryClient;
763
+ }
764
+ if (!client) {
765
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
766
+ }
767
+ return client;
768
+ };
769
+
770
+ var IsRestoringContext = React.createContext(false);
771
+ var useIsRestoring = () => React.useContext(IsRestoringContext);
772
+ IsRestoringContext.Provider;
773
+
774
+ function createValue() {
775
+ let isReset = false;
776
+ return {
777
+ clearReset: () => {
778
+ isReset = false;
779
+ },
780
+ reset: () => {
781
+ isReset = true;
782
+ },
783
+ isReset: () => {
784
+ return isReset;
785
+ }
786
+ };
787
+ }
788
+ var QueryErrorResetBoundaryContext = React.createContext(createValue());
789
+ var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
790
+
791
+ // src/utils.ts
792
+ function shouldThrowError(throwError, params) {
793
+ if (typeof throwError === "function") {
794
+ return throwError(...params);
795
+ }
796
+ return !!throwError;
797
+ }
798
+
799
+ var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
800
+ if (options.suspense || options.throwOnError) {
801
+ if (!errorResetBoundary.isReset()) {
802
+ options.retryOnMount = false;
803
+ }
804
+ }
805
+ };
806
+ var useClearResetErrorBoundary = (errorResetBoundary) => {
807
+ React.useEffect(() => {
808
+ errorResetBoundary.clearReset();
809
+ }, [errorResetBoundary]);
810
+ };
811
+ var getHasError = ({
812
+ result,
813
+ errorResetBoundary,
814
+ throwOnError,
815
+ query
816
+ }) => {
817
+ return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && shouldThrowError(throwOnError, [result.error, query]);
818
+ };
819
+
820
+ // src/suspense.ts
821
+ var ensureStaleTime = (defaultedOptions) => {
822
+ if (defaultedOptions.suspense) {
823
+ if (typeof defaultedOptions.staleTime !== "number") {
824
+ defaultedOptions.staleTime = 1e3;
825
+ }
826
+ }
827
+ };
828
+ var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
829
+ var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
830
+ errorResetBoundary.clearReset();
831
+ });
832
+
833
+ function useBaseQuery(options, Observer, queryClient) {
834
+ const client = useQueryClient(queryClient);
835
+ const isRestoring = useIsRestoring();
836
+ const errorResetBoundary = useQueryErrorResetBoundary();
837
+ const defaultedOptions = client.defaultQueryOptions(options);
838
+ defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
839
+ ensureStaleTime(defaultedOptions);
840
+ ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
841
+ useClearResetErrorBoundary(errorResetBoundary);
842
+ const [observer] = React.useState(
843
+ () => new Observer(
844
+ client,
845
+ defaultedOptions
846
+ )
847
+ );
848
+ const result = observer.getOptimisticResult(defaultedOptions);
849
+ React.useSyncExternalStore(
850
+ React.useCallback(
851
+ (onStoreChange) => {
852
+ const unsubscribe = isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange));
853
+ observer.updateResult();
854
+ return unsubscribe;
855
+ },
856
+ [observer, isRestoring]
857
+ ),
858
+ () => observer.getCurrentResult(),
859
+ () => observer.getCurrentResult()
860
+ );
861
+ React.useEffect(() => {
862
+ observer.setOptions(defaultedOptions, { listeners: false });
863
+ }, [defaultedOptions, observer]);
864
+ if (shouldSuspend(defaultedOptions, result)) {
865
+ throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
866
+ }
867
+ if (getHasError({
868
+ result,
869
+ errorResetBoundary,
870
+ throwOnError: defaultedOptions.throwOnError,
871
+ query: client.getQueryCache().get(defaultedOptions.queryHash)
872
+ })) {
873
+ throw result.error;
874
+ }
875
+ return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
876
+ }
877
+
878
+ function useQuery(options, queryClient) {
879
+ return useBaseQuery(options, QueryObserver, queryClient);
58
880
  }
59
881
 
60
882
  var _globalProps$organiza$1;
@@ -88,40 +910,45 @@ var STALE_TIME_CONFIG = {
88
910
  staleTime: DEFAULT_STALE_TIME
89
911
  };
90
912
 
91
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
92
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
93
913
  var useFetchGithubRepositories = function useFetchGithubRepositories(_ref) {
94
914
  var isConnected = _ref.isConnected;
95
- return useQuery([QUERY_KEYS.GITHUB_REPOSITORIES_LIST], githubAccountsApi.repositories, _objectSpread(_objectSpread({}, STALE_TIME_CONFIG), {}, {
915
+ return useQuery({
916
+ queryKey: [QUERY_KEYS.GITHUB_REPOSITORIES_LIST],
917
+ queryFn: githubAccountsApi.repositories,
918
+ staleTime: STALE_TIME_CONFIG.staleTime,
96
919
  enabled: isConnected && isNotNil(globalProps.githubAppInstallationId)
97
- }));
920
+ });
98
921
  };
99
922
 
100
923
  var Header = withT(function (_ref) {
101
924
  var t = _ref.t;
102
- return /*#__PURE__*/React.createElement("div", {
103
- className: "neeto-ui-text-gray-800 mb-1 flex w-full flex-row items-center space-x-2 font-sans text-lg font-medium leading-6 antialiased"
104
- }, /*#__PURE__*/React.createElement(Github, {
105
- size: 16
106
- }), /*#__PURE__*/React.createElement(Typography, {
107
- style: "h4"
108
- }, t("neetoGithub.github")));
925
+ return /*#__PURE__*/jsxs("div", {
926
+ className: "neeto-ui-text-gray-800 mb-1 flex w-full flex-row items-center space-x-2 font-sans text-lg font-medium leading-6 antialiased",
927
+ children: [/*#__PURE__*/jsx(Github, {
928
+ size: 16
929
+ }), /*#__PURE__*/jsx(Typography, {
930
+ style: "h4",
931
+ children: t("neetoGithub.github")
932
+ })]
933
+ });
109
934
  });
110
935
 
111
936
  var Configure = withT(function (_ref) {
112
937
  var t = _ref.t,
113
938
  isConnected = _ref.isConnected,
114
939
  installationUrl = _ref.installationUrl;
115
- return /*#__PURE__*/React.createElement("div", {
116
- className: "neeto-ui-text-gray-900 flex-shrink-0 font-sans text-sm font-normal leading-6 antialiased"
117
- }, /*#__PURE__*/React.createElement(Button, {
118
- href: installationUrl,
119
- icon: isConnected ? Settings : Plus,
120
- iconPosition: "left",
121
- iconSize: 20,
122
- size: "small",
123
- style: "link"
124
- }, isConnected ? t("neetoGithub.configureAccount") : t("neetoGithub.connectAccount")));
940
+ return /*#__PURE__*/jsx("div", {
941
+ className: "neeto-ui-text-gray-900 flex-shrink-0 font-sans text-sm font-normal leading-6 antialiased",
942
+ children: /*#__PURE__*/jsx(Button, {
943
+ href: installationUrl,
944
+ icon: isConnected ? Settings : Plus,
945
+ iconPosition: "left",
946
+ iconSize: 20,
947
+ size: "small",
948
+ style: "link",
949
+ children: isConnected ? t("neetoGithub.configureAccount") : t("neetoGithub.connectAccount")
950
+ })
951
+ });
125
952
  });
126
953
 
127
954
  var List$1 = withT(function (_ref) {
@@ -130,53 +957,57 @@ var List$1 = withT(function (_ref) {
130
957
  isConnected = _ref.isConnected,
131
958
  installationUrl = _ref.installationUrl,
132
959
  isPane = _ref.isPane;
133
- return /*#__PURE__*/React.createElement("div", {
960
+ return /*#__PURE__*/jsxs("div", {
134
961
  className: classnames("neeto-ui-border-gray-300 flex justify-between gap-3 border-b pb-4 pt-2", {
135
962
  "flex-col md:flex-row": isPane,
136
963
  "flex-col": !isPane
137
- })
138
- }, accounts.map(function (_ref2) {
139
- var id = _ref2.id,
140
- name = _ref2.name,
141
- avatarUrl = _ref2.avatarUrl,
142
- type = _ref2.type,
143
- profileUrl = _ref2.profileUrl,
144
- count = _ref2.count;
145
- return /*#__PURE__*/React.createElement("div", {
146
- className: "flex w-full items-center space-x-2",
147
- key: id
148
- }, /*#__PURE__*/React.createElement("div", {
149
- className: "flex items-center gap-1"
150
- }, type === "Organization" ? /*#__PURE__*/React.createElement(Building, {
151
- className: "neeto-ui-text-gray-600",
152
- size: 24
153
- }) : /*#__PURE__*/React.createElement(Avatar, {
154
- size: "small",
155
- user: {
156
- imageUrl: avatarUrl
157
- }
158
- }), /*#__PURE__*/React.createElement(Typography, {
159
- className: "neeto-ui-text-gray-800",
160
- style: "body2"
161
- }, /*#__PURE__*/React.createElement(Button, {
162
- className: "neeto-ui-text-gray-800",
163
- label: "@".concat(name),
164
- style: "link",
165
- onClick: function onClick() {
166
- return window.open(profileUrl, "_blank");
167
- }
168
- }))), /*#__PURE__*/React.createElement("span", {
169
- className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
170
- }), /*#__PURE__*/React.createElement(Typography, {
171
- className: "neeto-ui-text-black",
172
- style: "body2"
173
- }, t("neetoGithub.countOf.repos", {
174
- count: count
175
- })));
176
- }), /*#__PURE__*/React.createElement(Configure, {
177
- installationUrl: installationUrl,
178
- isConnected: isConnected
179
- }));
964
+ }),
965
+ children: [accounts.map(function (_ref2) {
966
+ var id = _ref2.id,
967
+ name = _ref2.name,
968
+ avatarUrl = _ref2.avatarUrl,
969
+ type = _ref2.type,
970
+ profileUrl = _ref2.profileUrl,
971
+ count = _ref2.count;
972
+ return /*#__PURE__*/jsxs("div", {
973
+ className: "flex w-full items-center space-x-2",
974
+ children: [/*#__PURE__*/jsxs("div", {
975
+ className: "flex items-center gap-1",
976
+ children: [type === "Organization" ? /*#__PURE__*/jsx(Building, {
977
+ className: "neeto-ui-text-gray-600",
978
+ size: 24
979
+ }) : /*#__PURE__*/jsx(Avatar, {
980
+ size: "small",
981
+ user: {
982
+ imageUrl: avatarUrl
983
+ }
984
+ }), /*#__PURE__*/jsx(Typography, {
985
+ className: "neeto-ui-text-gray-800",
986
+ style: "body2",
987
+ children: /*#__PURE__*/jsx(Button, {
988
+ className: "neeto-ui-text-gray-800",
989
+ label: "@".concat(name),
990
+ style: "link",
991
+ onClick: function onClick() {
992
+ return window.open(profileUrl, "_blank");
993
+ }
994
+ })
995
+ })]
996
+ }), /*#__PURE__*/jsx("span", {
997
+ className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
998
+ }), /*#__PURE__*/jsx(Typography, {
999
+ className: "neeto-ui-text-black",
1000
+ style: "body2",
1001
+ children: t("neetoGithub.countOf.repos", {
1002
+ count: count
1003
+ })
1004
+ })]
1005
+ }, id);
1006
+ }), /*#__PURE__*/jsx(Configure, {
1007
+ installationUrl: installationUrl,
1008
+ isConnected: isConnected
1009
+ })]
1010
+ });
180
1011
  });
181
1012
 
182
1013
  var Accounts = function Accounts(_ref) {
@@ -185,20 +1016,22 @@ var Accounts = function Accounts(_ref) {
185
1016
  isConnected = _ref.isConnected,
186
1017
  onConnect = _ref.onConnect,
187
1018
  installationUrl = _ref.installationUrl;
188
- return /*#__PURE__*/React.createElement("div", {
1019
+ return /*#__PURE__*/jsx("div", {
189
1020
  className: classnames("flex w-full flex-col border border-solid border-transparent px-0 py-2", {
190
1021
  "order-1": isPane,
191
1022
  "md:order-2 md:max-w-72 lg:max-w-sm lg:px-6": !isPane
1023
+ }),
1024
+ children: /*#__PURE__*/jsxs("div", {
1025
+ className: "mb-2",
1026
+ children: [/*#__PURE__*/jsx(Header, {}), /*#__PURE__*/jsx(List$1, {
1027
+ accounts: accounts,
1028
+ installationUrl: installationUrl,
1029
+ isConnected: isConnected,
1030
+ isPane: isPane,
1031
+ onConnect: onConnect
1032
+ })]
192
1033
  })
193
- }, /*#__PURE__*/React.createElement("div", {
194
- className: "mb-2"
195
- }, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(List$1, {
196
- accounts: accounts,
197
- installationUrl: installationUrl,
198
- isConnected: isConnected,
199
- isPane: isPane,
200
- onConnect: onConnect
201
- })));
1034
+ });
202
1035
  };
203
1036
 
204
1037
  function _arrayWithHoles(arr) {
@@ -260,32 +1093,36 @@ var NoRepositories = withT(function (_ref) {
260
1093
  var t = _ref.t,
261
1094
  installationUrl = _ref.installationUrl,
262
1095
  troubleshootUrl = _ref.troubleshootUrl;
263
- return /*#__PURE__*/React.createElement("div", {
264
- className: "flex items-center justify-center py-6"
265
- }, /*#__PURE__*/React.createElement("div", {
266
- className: "mx-auto flex w-full max-w-sm flex-col items-center justify-center space-y-4 py-4 text-center"
267
- }, /*#__PURE__*/React.createElement(Typography, {
268
- style: "body2"
269
- }, t("neetoGithub.noReposDescription")), /*#__PURE__*/React.createElement(Button, {
270
- href: installationUrl,
271
- icon: Github,
272
- iconPosition: "left",
273
- label: t("neetoGithub.connectRepository"),
274
- size: "medium",
275
- style: "primary"
276
- }), /*#__PURE__*/React.createElement("div", {
277
- className: "text-xs"
278
- }, /*#__PURE__*/React.createElement(Trans, {
279
- i18nKey: t("neetoGithub.troubleshoot"),
280
- components: {
281
- troubleshootLink: /*#__PURE__*/React.createElement("a", {
282
- className: "text-indigo-600 underline",
283
- href: troubleshootUrl,
284
- rel: "noopener noreferrer",
285
- target: "_blank"
286
- })
287
- }
288
- }))));
1096
+ return /*#__PURE__*/jsx("div", {
1097
+ className: "flex items-center justify-center py-6",
1098
+ children: /*#__PURE__*/jsxs("div", {
1099
+ className: "mx-auto flex w-full max-w-sm flex-col items-center justify-center space-y-4 py-4 text-center",
1100
+ children: [/*#__PURE__*/jsx(Typography, {
1101
+ style: "body2",
1102
+ children: t("neetoGithub.noReposDescription")
1103
+ }), /*#__PURE__*/jsx(Button, {
1104
+ href: installationUrl,
1105
+ icon: Github,
1106
+ iconPosition: "left",
1107
+ label: t("neetoGithub.connectRepository"),
1108
+ size: "medium",
1109
+ style: "primary"
1110
+ }), /*#__PURE__*/jsx("div", {
1111
+ className: "text-xs",
1112
+ children: /*#__PURE__*/jsx(Trans, {
1113
+ i18nKey: t("neetoGithub.troubleshoot"),
1114
+ components: {
1115
+ troubleshootLink: /*#__PURE__*/jsx("a", {
1116
+ className: "text-indigo-600 underline",
1117
+ href: troubleshootUrl,
1118
+ rel: "noopener noreferrer",
1119
+ target: "_blank"
1120
+ })
1121
+ }
1122
+ })
1123
+ })]
1124
+ })
1125
+ });
289
1126
  });
290
1127
 
291
1128
  var RepositoryTile = function RepositoryTile(_ref) {
@@ -302,39 +1139,43 @@ var RepositoryTile = function RepositoryTile(_ref) {
302
1139
  fullName = repository.fullName,
303
1140
  isPrivate = repository.isPrivate,
304
1141
  updatedAt = repository.updatedAt;
305
- return /*#__PURE__*/React.createElement("div", {
1142
+ return /*#__PURE__*/jsxs("div", {
306
1143
  className: "neeto-ui-border-gray-300 flex flex-col justify-between gap-3 border-b border-solid py-3 pl-3 pr-3 last:border-b-0 md:flex-row md:items-center md:pl-5",
307
- key: id
308
- }, /*#__PURE__*/React.createElement("div", {
309
- className: "width-calc flex items-center space-x-2"
310
- }, /*#__PURE__*/React.createElement(Github, {
311
- className: "flex-shrink-0",
312
- size: 16
313
- }), /*#__PURE__*/React.createElement(Typography, {
314
- style: "body2"
315
- }, fullName), isPrivate && /*#__PURE__*/React.createElement(Lock, {
316
- className: "flex-shrink-0",
317
- size: 16
318
- }), /*#__PURE__*/React.createElement("div", {
319
- className: "hidden lg:inline-block"
320
- }, /*#__PURE__*/React.createElement("span", {
321
- className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
322
- }), /*#__PURE__*/React.createElement(DateFormat.FromNow, {
323
- date: updatedAt
324
- }))), /*#__PURE__*/React.createElement(Button, {
325
- className: "w-max",
326
- disabled: isConnecting,
327
- loading: isLoading,
328
- style: "primary",
329
- type: "button",
330
- onClick: function onClick() {
331
- return onConnect({
332
- repoType: "private",
333
- repository: repository,
334
- setIsLoading: setIsLoading
335
- });
336
- }
337
- }, t("neetoGithub.connect")));
1144
+ children: [/*#__PURE__*/jsxs("div", {
1145
+ className: "width-calc flex items-center space-x-2",
1146
+ children: [/*#__PURE__*/jsx(Github, {
1147
+ className: "flex-shrink-0",
1148
+ size: 16
1149
+ }), /*#__PURE__*/jsx(Typography, {
1150
+ style: "body2",
1151
+ children: fullName
1152
+ }), isPrivate && /*#__PURE__*/jsx(Lock, {
1153
+ className: "flex-shrink-0",
1154
+ size: 16
1155
+ }), /*#__PURE__*/jsxs("div", {
1156
+ className: "hidden lg:inline-block",
1157
+ children: [/*#__PURE__*/jsx("span", {
1158
+ className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
1159
+ }), /*#__PURE__*/jsx(DateFormat.FromNow, {
1160
+ date: updatedAt
1161
+ })]
1162
+ })]
1163
+ }), /*#__PURE__*/jsx(Button, {
1164
+ className: "w-max",
1165
+ disabled: isConnecting,
1166
+ loading: isLoading,
1167
+ style: "primary",
1168
+ type: "button",
1169
+ onClick: function onClick() {
1170
+ return onConnect({
1171
+ repoType: "private",
1172
+ repository: repository,
1173
+ setIsLoading: setIsLoading
1174
+ });
1175
+ },
1176
+ children: t("neetoGithub.connect")
1177
+ })]
1178
+ }, id);
338
1179
  };
339
1180
 
340
1181
  var List = withT(function (_ref) {
@@ -345,48 +1186,54 @@ var List = withT(function (_ref) {
345
1186
  onConnect = _ref.onConnect,
346
1187
  installationUrl = _ref.installationUrl,
347
1188
  troubleshootUrl = _ref.troubleshootUrl;
348
- return /*#__PURE__*/React.createElement("div", {
349
- className: "h-full overflow-y-scroll px-4 pb-4 md:px-6 md:pb-6"
350
- }, isPresent(repositories) ? /*#__PURE__*/React.createElement("div", {
351
- className: classnames("neeto-ui-border-gray-300 neeto-ui-rounded-md flex flex-col items-center justify-center border", {
352
- "h-auto": isPresent(filteredRepositories),
353
- "h-full": !isPresent(filteredRepositories)
1189
+ return /*#__PURE__*/jsx("div", {
1190
+ className: "h-full overflow-y-scroll px-4 pb-4 md:px-6 md:pb-6",
1191
+ children: isPresent(repositories) ? /*#__PURE__*/jsx("div", {
1192
+ className: classnames("neeto-ui-border-gray-300 neeto-ui-rounded-md flex flex-col items-center justify-center border", {
1193
+ "h-auto": isPresent(filteredRepositories),
1194
+ "h-full": !isPresent(filteredRepositories)
1195
+ }),
1196
+ children: /*#__PURE__*/jsx("div", {
1197
+ className: "m-0 h-full w-full p-0",
1198
+ children: isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
1199
+ return /*#__PURE__*/createElement(RepositoryTile, {
1200
+ isConnecting: isConnecting,
1201
+ onConnect: onConnect,
1202
+ repository: repository,
1203
+ key: index
1204
+ });
1205
+ }) : /*#__PURE__*/jsx(Typography, {
1206
+ className: "flex h-full w-full items-center justify-center",
1207
+ style: "body2",
1208
+ children: t("neetoGithub.noRepos")
1209
+ })
1210
+ })
1211
+ }) : /*#__PURE__*/jsx(NoRepositories, {
1212
+ installationUrl: installationUrl,
1213
+ troubleshootUrl: troubleshootUrl
354
1214
  })
355
- }, /*#__PURE__*/React.createElement("div", {
356
- className: "m-0 h-full w-full p-0"
357
- }, isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
358
- return /*#__PURE__*/React.createElement(RepositoryTile, {
359
- isConnecting: isConnecting,
360
- onConnect: onConnect,
361
- repository: repository,
362
- key: index
363
- });
364
- }) : /*#__PURE__*/React.createElement(Typography, {
365
- className: "flex h-full w-full items-center justify-center",
366
- style: "body2"
367
- }, t("neetoGithub.noRepos")))) : /*#__PURE__*/React.createElement(NoRepositories, {
368
- installationUrl: installationUrl,
369
- troubleshootUrl: troubleshootUrl
370
- }));
1215
+ });
371
1216
  });
372
1217
 
373
1218
  var NotConnected = withT(function (_ref) {
374
1219
  var t = _ref.t,
375
1220
  installationUrl = _ref.installationUrl;
376
- return /*#__PURE__*/React.createElement("div", {
377
- className: "flex w-full max-w-sm flex-col items-center justify-center space-y-4 text-center"
378
- }, /*#__PURE__*/React.createElement(Typography, {
379
- style: "body2"
380
- }, t("neetoGithub.notConnectedDescription", {
381
- appName: globalProps.appName
382
- })), /*#__PURE__*/React.createElement(Button, {
383
- href: installationUrl,
384
- icon: Github,
385
- iconPosition: "left",
386
- label: t("neetoGithub.connectGithub"),
387
- size: "medium",
388
- style: "primary"
389
- }));
1221
+ return /*#__PURE__*/jsxs("div", {
1222
+ className: "flex w-full max-w-sm flex-col items-center justify-center space-y-4 text-center",
1223
+ children: [/*#__PURE__*/jsx(Typography, {
1224
+ style: "body2",
1225
+ children: t("neetoGithub.notConnectedDescription", {
1226
+ appName: globalProps.appName
1227
+ })
1228
+ }), /*#__PURE__*/jsx(Button, {
1229
+ href: installationUrl,
1230
+ icon: Github,
1231
+ iconPosition: "left",
1232
+ label: t("neetoGithub.connectGithub"),
1233
+ size: "medium",
1234
+ style: "primary"
1235
+ })]
1236
+ });
390
1237
  });
391
1238
 
392
1239
  var Private = function Private(_ref) {
@@ -413,38 +1260,47 @@ var Private = function Private(_ref) {
413
1260
  });
414
1261
  setFilteredRepositories(filteredRepositories);
415
1262
  };
416
- return /*#__PURE__*/React.createElement("div", {
417
- className: "connect-repo flex h-full flex-col"
418
- }, isConnected ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
419
- className: "space-y-3 p-4 md:p-6"
420
- }, /*#__PURE__*/React.createElement(Typography, {
421
- className: "flex-shrink-0 text-lg font-medium",
422
- style: "h2"
423
- }, t("neetoGithub.connectARepo")), isPresent(repositories) && /*#__PURE__*/React.createElement(Search, {
424
- onSearch: onSearch,
425
- className: "w-full",
426
- unlimitedChars: false,
427
- suffix: /*#__PURE__*/React.createElement(Typography, {
428
- style: "body2"
429
- }, t("neetoGithub.countOf.repos", {
430
- count: filteredRepositories.length
431
- }))
432
- })), /*#__PURE__*/React.createElement("div", {
433
- className: "flex min-h-0 w-full flex-grow flex-col space-y-6"
434
- }, /*#__PURE__*/React.createElement(List, {
435
- filteredRepositories: filteredRepositories,
436
- installationUrl: installationUrl,
437
- isConnecting: isConnecting,
438
- onConnect: onConnect,
439
- repositories: repositories,
440
- troubleshootUrl: troubleshootUrl
441
- }))) : /*#__PURE__*/React.createElement("div", {
442
- className: "neeto-ui-text-gray-900 flex-grow font-sans text-sm font-normal leading-6 antialiased"
443
- }, /*#__PURE__*/React.createElement("div", {
444
- className: "flex h-full flex-col items-center justify-center p-4"
445
- }, /*#__PURE__*/React.createElement(NotConnected, {
446
- installationUrl: installationUrl
447
- }))));
1263
+ return /*#__PURE__*/jsx("div", {
1264
+ className: "connect-repo flex h-full flex-col",
1265
+ children: isConnected ? /*#__PURE__*/jsxs(Fragment, {
1266
+ children: [/*#__PURE__*/jsxs("div", {
1267
+ className: "space-y-3 p-4 md:p-6",
1268
+ children: [/*#__PURE__*/jsx(Typography, {
1269
+ className: "flex-shrink-0 text-lg font-medium",
1270
+ style: "h2",
1271
+ children: t("neetoGithub.connectARepo")
1272
+ }), isPresent(repositories) && /*#__PURE__*/jsx(Search, {
1273
+ onSearch: onSearch,
1274
+ className: "w-full",
1275
+ unlimitedChars: false,
1276
+ suffix: /*#__PURE__*/jsx(Typography, {
1277
+ style: "body2",
1278
+ children: t("neetoGithub.countOf.repos", {
1279
+ count: filteredRepositories.length
1280
+ })
1281
+ })
1282
+ })]
1283
+ }), /*#__PURE__*/jsx("div", {
1284
+ className: "flex min-h-0 w-full flex-grow flex-col space-y-6",
1285
+ children: /*#__PURE__*/jsx(List, {
1286
+ filteredRepositories: filteredRepositories,
1287
+ installationUrl: installationUrl,
1288
+ isConnecting: isConnecting,
1289
+ onConnect: onConnect,
1290
+ repositories: repositories,
1291
+ troubleshootUrl: troubleshootUrl
1292
+ })
1293
+ })]
1294
+ }) : /*#__PURE__*/jsx("div", {
1295
+ className: "neeto-ui-text-gray-900 flex-grow font-sans text-sm font-normal leading-6 antialiased",
1296
+ children: /*#__PURE__*/jsx("div", {
1297
+ className: "flex h-full flex-col items-center justify-center p-4",
1298
+ children: /*#__PURE__*/jsx(NotConnected, {
1299
+ installationUrl: installationUrl
1300
+ })
1301
+ })
1302
+ })
1303
+ });
448
1304
  };
449
1305
 
450
1306
  var Repositories = function Repositories(_ref) {
@@ -455,19 +1311,20 @@ var Repositories = function Repositories(_ref) {
455
1311
  installationUrl = _ref.installationUrl,
456
1312
  troubleshootUrl = _ref.troubleshootUrl,
457
1313
  isPane = _ref.isPane;
458
- return /*#__PURE__*/React.createElement("div", {
1314
+ return /*#__PURE__*/jsx("div", {
459
1315
  className: classnames("neeto-ui-rounded-md neeto-ui-border-gray-300 h-full w-full space-y-6 border border-solid", {
460
1316
  "order-2": isPane,
461
1317
  "order-1": !isPane
1318
+ }),
1319
+ children: /*#__PURE__*/jsx(Private, {
1320
+ installationUrl: installationUrl,
1321
+ isConnected: isConnected,
1322
+ isConnecting: isConnecting,
1323
+ onConnect: onConnect,
1324
+ repositories: repositories,
1325
+ troubleshootUrl: troubleshootUrl
462
1326
  })
463
- }, /*#__PURE__*/React.createElement(Private, {
464
- installationUrl: installationUrl,
465
- isConnected: isConnected,
466
- isConnecting: isConnecting,
467
- onConnect: onConnect,
468
- repositories: repositories,
469
- troubleshootUrl: troubleshootUrl
470
- }));
1327
+ });
471
1328
  };
472
1329
 
473
1330
  var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
@@ -503,32 +1360,34 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
503
1360
  var accounts = shouldFetchRepositories ? containerAccounts : paneAccounts;
504
1361
  var isLoading = shouldFetchRepositories ? isContainerLoading : isPaneLoading;
505
1362
  if (isLoading) {
506
- return /*#__PURE__*/React.createElement("div", {
507
- className: "flex h-full w-full flex-col items-center"
508
- }, /*#__PURE__*/React.createElement(PageLoader, {
509
- text: t("neetoGithub.fetchingRepos")
510
- }));
1363
+ return /*#__PURE__*/jsx("div", {
1364
+ className: "flex h-full w-full flex-col items-center",
1365
+ children: /*#__PURE__*/jsx(PageLoader, {
1366
+ text: t("neetoGithub.fetchingRepos")
1367
+ })
1368
+ });
511
1369
  }
512
- return /*#__PURE__*/React.createElement("div", {
1370
+ return /*#__PURE__*/jsxs("div", {
513
1371
  className: classnames("flex min-h-0 w-full flex-grow flex-col", {
514
1372
  "flex-col": isPane,
515
1373
  "gap-3 md:flex-row md:gap-6": !isPane
516
- })
517
- }, /*#__PURE__*/React.createElement(Accounts, {
518
- accounts: accounts,
519
- installationUrl: installationUrl,
520
- isConnected: isConnected,
521
- isPane: isPane,
522
- onConnect: onConnect
523
- }), /*#__PURE__*/React.createElement(Repositories, {
524
- installationUrl: installationUrl,
525
- isConnected: isConnected,
526
- isConnecting: isConnecting,
527
- isPane: isPane,
528
- onConnect: onConnect,
529
- repositories: repositories,
530
- troubleshootUrl: troubleshootUrl
531
- }));
1374
+ }),
1375
+ children: [/*#__PURE__*/jsx(Accounts, {
1376
+ accounts: accounts,
1377
+ installationUrl: installationUrl,
1378
+ isConnected: isConnected,
1379
+ isPane: isPane,
1380
+ onConnect: onConnect
1381
+ }), /*#__PURE__*/jsx(Repositories, {
1382
+ installationUrl: installationUrl,
1383
+ isConnected: isConnected,
1384
+ isConnecting: isConnecting,
1385
+ isPane: isPane,
1386
+ onConnect: onConnect,
1387
+ repositories: repositories,
1388
+ troubleshootUrl: troubleshootUrl
1389
+ })]
1390
+ });
532
1391
  };
533
1392
 
534
1393
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2796,7 +3655,7 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
2796
3655
  _ref$troubleshootUrl = _ref.troubleshootUrl,
2797
3656
  troubleshootUrl = _ref$troubleshootUrl === void 0 ? TROUBLESHOOT_URL : _ref$troubleshootUrl,
2798
3657
  _ref$onConnect = _ref.onConnect,
2799
- onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
3658
+ onConnect = _ref$onConnect === void 0 ? noop$1 : _ref$onConnect,
2800
3659
  _ref$projects = _ref.projects,
2801
3660
  projects = _ref$projects === void 0 ? [] : _ref$projects,
2802
3661
  _ref$title = _ref.title,
@@ -2820,26 +3679,32 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
2820
3679
  }, projects);
2821
3680
  });
2822
3681
  var paneAccounts = isConnected ? accounts : [];
2823
- return /*#__PURE__*/React.createElement(Pane, {
3682
+ return /*#__PURE__*/jsxs(Pane, {
2824
3683
  initialFocusRef: initialFocusRef,
2825
3684
  isOpen: isOpen,
2826
3685
  onClose: onClose,
2827
3686
  className: "neeto-github-modal-pane-wrapper",
2828
- size: "large"
2829
- }, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
2830
- style: "h2"
2831
- }, isPresent(title) ? title : t("neetoGithub.modal.title"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement(NeetoGithubNanoContainer, {
2832
- installationUrl: installationUrl,
2833
- isConnected: isConnected,
2834
- isConnecting: isConnecting,
2835
- isPaneLoading: isPaneLoading,
2836
- onConnect: onConnect,
2837
- paneAccounts: paneAccounts,
2838
- paneRepositories: paneRepositories,
2839
- troubleshootUrl: troubleshootUrl,
2840
- isPane: true,
2841
- shouldFetchRepositories: false
2842
- })));
3687
+ size: "large",
3688
+ children: [/*#__PURE__*/jsx(Pane.Header, {
3689
+ children: /*#__PURE__*/jsx(Typography, {
3690
+ style: "h2",
3691
+ children: isPresent(title) ? title : t("neetoGithub.modal.title")
3692
+ })
3693
+ }), /*#__PURE__*/jsx(Pane.Body, {
3694
+ children: /*#__PURE__*/jsx(NeetoGithubNanoContainer, {
3695
+ installationUrl: installationUrl,
3696
+ isConnected: isConnected,
3697
+ isConnecting: isConnecting,
3698
+ isPaneLoading: isPaneLoading,
3699
+ onConnect: onConnect,
3700
+ paneAccounts: paneAccounts,
3701
+ paneRepositories: paneRepositories,
3702
+ troubleshootUrl: troubleshootUrl,
3703
+ isPane: true,
3704
+ shouldFetchRepositories: false
3705
+ })
3706
+ })]
3707
+ });
2843
3708
  };
2844
3709
 
2845
3710
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}