@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.cjs.js +1166 -280
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1147 -282
- package/dist/index.js.map +1 -1
- package/package.json +16 -15
package/dist/index.cjs.js
CHANGED
|
@@ -8,67 +8,910 @@ 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
10
|
var ramda = require('ramda');
|
|
11
|
-
var
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
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
|
-
var
|
|
16
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
17
17
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
18
|
+
var Avatar = require('@bigbinary/neetoui/Avatar');
|
|
19
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
18
20
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
19
21
|
var Search = require('@bigbinary/neeto-molecules/Search');
|
|
20
22
|
var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
|
|
23
|
+
var Pane = require('@bigbinary/neetoui/Pane');
|
|
21
24
|
var require$$0 = require('util');
|
|
22
25
|
|
|
23
26
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
27
|
|
|
25
|
-
|
|
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);
|
|
26
47
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
27
48
|
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
28
49
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
50
|
+
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
51
|
+
var Avatar__default = /*#__PURE__*/_interopDefaultLegacy(Avatar);
|
|
52
|
+
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
29
53
|
var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search);
|
|
30
54
|
var DateFormat__default = /*#__PURE__*/_interopDefaultLegacy(DateFormat);
|
|
55
|
+
var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
|
|
31
56
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
32
57
|
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
};
|
|
35
80
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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;
|
|
41
164
|
}
|
|
42
165
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
}
|
|
50
259
|
}
|
|
51
|
-
|
|
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;
|
|
52
283
|
}
|
|
53
284
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
+
};
|
|
57
369
|
}
|
|
58
370
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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;
|
|
67
522
|
});
|
|
68
|
-
} else {
|
|
69
|
-
obj[key] = value;
|
|
70
523
|
}
|
|
71
|
-
|
|
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);
|
|
72
915
|
}
|
|
73
916
|
|
|
74
917
|
var _globalProps$organiza$1;
|
|
@@ -102,40 +945,45 @@ var STALE_TIME_CONFIG = {
|
|
|
102
945
|
staleTime: constants.DEFAULT_STALE_TIME
|
|
103
946
|
};
|
|
104
947
|
|
|
105
|
-
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; }
|
|
106
|
-
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; }
|
|
107
948
|
var useFetchGithubRepositories = function useFetchGithubRepositories(_ref) {
|
|
108
949
|
var isConnected = _ref.isConnected;
|
|
109
|
-
return
|
|
950
|
+
return useQuery({
|
|
951
|
+
queryKey: [QUERY_KEYS.GITHUB_REPOSITORIES_LIST],
|
|
952
|
+
queryFn: githubAccountsApi.repositories,
|
|
953
|
+
staleTime: STALE_TIME_CONFIG.staleTime,
|
|
110
954
|
enabled: isConnected && ramda.isNotNil(initializers.globalProps.githubAppInstallationId)
|
|
111
|
-
})
|
|
955
|
+
});
|
|
112
956
|
};
|
|
113
957
|
|
|
114
958
|
var Header = reactUtils.withT(function (_ref) {
|
|
115
959
|
var t = _ref.t;
|
|
116
|
-
return /*#__PURE__*/
|
|
117
|
-
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"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
960
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
961
|
+
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",
|
|
962
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(misc.Github, {
|
|
963
|
+
size: 16
|
|
964
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
965
|
+
style: "h4",
|
|
966
|
+
children: t("neetoGithub.github")
|
|
967
|
+
})]
|
|
968
|
+
});
|
|
123
969
|
});
|
|
124
970
|
|
|
125
971
|
var Configure = reactUtils.withT(function (_ref) {
|
|
126
972
|
var t = _ref.t,
|
|
127
973
|
isConnected = _ref.isConnected,
|
|
128
974
|
installationUrl = _ref.installationUrl;
|
|
129
|
-
return /*#__PURE__*/
|
|
130
|
-
className: "neeto-ui-text-gray-900 flex-shrink-0 font-sans text-sm font-normal leading-6 antialiased"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
975
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
976
|
+
className: "neeto-ui-text-gray-900 flex-shrink-0 font-sans text-sm font-normal leading-6 antialiased",
|
|
977
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
978
|
+
href: installationUrl,
|
|
979
|
+
icon: isConnected ? neetoIcons.Settings : neetoIcons.Plus,
|
|
980
|
+
iconPosition: "left",
|
|
981
|
+
iconSize: 20,
|
|
982
|
+
size: "small",
|
|
983
|
+
style: "link",
|
|
984
|
+
children: isConnected ? t("neetoGithub.configureAccount") : t("neetoGithub.connectAccount")
|
|
985
|
+
})
|
|
986
|
+
});
|
|
139
987
|
});
|
|
140
988
|
|
|
141
989
|
var List$1 = reactUtils.withT(function (_ref) {
|
|
@@ -144,53 +992,57 @@ var List$1 = reactUtils.withT(function (_ref) {
|
|
|
144
992
|
isConnected = _ref.isConnected,
|
|
145
993
|
installationUrl = _ref.installationUrl,
|
|
146
994
|
isPane = _ref.isPane;
|
|
147
|
-
return /*#__PURE__*/
|
|
995
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
148
996
|
className: classnames__default["default"]("neeto-ui-border-gray-300 flex justify-between gap-3 border-b pb-4 pt-2", {
|
|
149
997
|
"flex-col md:flex-row": isPane,
|
|
150
998
|
"flex-col": !isPane
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
999
|
+
}),
|
|
1000
|
+
children: [accounts.map(function (_ref2) {
|
|
1001
|
+
var id = _ref2.id,
|
|
1002
|
+
name = _ref2.name,
|
|
1003
|
+
avatarUrl = _ref2.avatarUrl,
|
|
1004
|
+
type = _ref2.type,
|
|
1005
|
+
profileUrl = _ref2.profileUrl,
|
|
1006
|
+
count = _ref2.count;
|
|
1007
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1008
|
+
className: "flex w-full items-center space-x-2",
|
|
1009
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1010
|
+
className: "flex items-center gap-1",
|
|
1011
|
+
children: [type === "Organization" ? /*#__PURE__*/jsxRuntime.jsx(neetoIcons.Building, {
|
|
1012
|
+
className: "neeto-ui-text-gray-600",
|
|
1013
|
+
size: 24
|
|
1014
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Avatar__default["default"], {
|
|
1015
|
+
size: "small",
|
|
1016
|
+
user: {
|
|
1017
|
+
imageUrl: avatarUrl
|
|
1018
|
+
}
|
|
1019
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1020
|
+
className: "neeto-ui-text-gray-800",
|
|
1021
|
+
style: "body2",
|
|
1022
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1023
|
+
className: "neeto-ui-text-gray-800",
|
|
1024
|
+
label: "@".concat(name),
|
|
1025
|
+
style: "link",
|
|
1026
|
+
onClick: function onClick() {
|
|
1027
|
+
return window.open(profileUrl, "_blank");
|
|
1028
|
+
}
|
|
1029
|
+
})
|
|
1030
|
+
})]
|
|
1031
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
1032
|
+
className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
|
|
1033
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1034
|
+
className: "neeto-ui-text-black",
|
|
1035
|
+
style: "body2",
|
|
1036
|
+
children: t("neetoGithub.countOf.repos", {
|
|
1037
|
+
count: count
|
|
1038
|
+
})
|
|
1039
|
+
})]
|
|
1040
|
+
}, id);
|
|
1041
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Configure, {
|
|
1042
|
+
installationUrl: installationUrl,
|
|
1043
|
+
isConnected: isConnected
|
|
1044
|
+
})]
|
|
1045
|
+
});
|
|
194
1046
|
});
|
|
195
1047
|
|
|
196
1048
|
var Accounts = function Accounts(_ref) {
|
|
@@ -199,20 +1051,22 @@ var Accounts = function Accounts(_ref) {
|
|
|
199
1051
|
isConnected = _ref.isConnected,
|
|
200
1052
|
onConnect = _ref.onConnect,
|
|
201
1053
|
installationUrl = _ref.installationUrl;
|
|
202
|
-
return /*#__PURE__*/
|
|
1054
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
203
1055
|
className: classnames__default["default"]("flex w-full flex-col border border-solid border-transparent px-0 py-2", {
|
|
204
1056
|
"order-1": isPane,
|
|
205
1057
|
"md:order-2 md:max-w-72 lg:max-w-sm lg:px-6": !isPane
|
|
1058
|
+
}),
|
|
1059
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1060
|
+
className: "mb-2",
|
|
1061
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Header, {}), /*#__PURE__*/jsxRuntime.jsx(List$1, {
|
|
1062
|
+
accounts: accounts,
|
|
1063
|
+
installationUrl: installationUrl,
|
|
1064
|
+
isConnected: isConnected,
|
|
1065
|
+
isPane: isPane,
|
|
1066
|
+
onConnect: onConnect
|
|
1067
|
+
})]
|
|
206
1068
|
})
|
|
207
|
-
}
|
|
208
|
-
className: "mb-2"
|
|
209
|
-
}, /*#__PURE__*/React__default["default"].createElement(Header, null), /*#__PURE__*/React__default["default"].createElement(List$1, {
|
|
210
|
-
accounts: accounts,
|
|
211
|
-
installationUrl: installationUrl,
|
|
212
|
-
isConnected: isConnected,
|
|
213
|
-
isPane: isPane,
|
|
214
|
-
onConnect: onConnect
|
|
215
|
-
})));
|
|
1069
|
+
});
|
|
216
1070
|
};
|
|
217
1071
|
|
|
218
1072
|
function _arrayWithHoles(arr) {
|
|
@@ -274,32 +1128,36 @@ var NoRepositories = reactUtils.withT(function (_ref) {
|
|
|
274
1128
|
var t = _ref.t,
|
|
275
1129
|
installationUrl = _ref.installationUrl,
|
|
276
1130
|
troubleshootUrl = _ref.troubleshootUrl;
|
|
277
|
-
return /*#__PURE__*/
|
|
278
|
-
className: "flex items-center justify-center py-6"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
1131
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1132
|
+
className: "flex items-center justify-center py-6",
|
|
1133
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1134
|
+
className: "mx-auto flex w-full max-w-sm flex-col items-center justify-center space-y-4 py-4 text-center",
|
|
1135
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1136
|
+
style: "body2",
|
|
1137
|
+
children: t("neetoGithub.noReposDescription")
|
|
1138
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1139
|
+
href: installationUrl,
|
|
1140
|
+
icon: misc.Github,
|
|
1141
|
+
iconPosition: "left",
|
|
1142
|
+
label: t("neetoGithub.connectRepository"),
|
|
1143
|
+
size: "medium",
|
|
1144
|
+
style: "primary"
|
|
1145
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1146
|
+
className: "text-xs",
|
|
1147
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
1148
|
+
i18nKey: t("neetoGithub.troubleshoot"),
|
|
1149
|
+
components: {
|
|
1150
|
+
troubleshootLink: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
1151
|
+
className: "text-indigo-600 underline",
|
|
1152
|
+
href: troubleshootUrl,
|
|
1153
|
+
rel: "noopener noreferrer",
|
|
1154
|
+
target: "_blank"
|
|
1155
|
+
})
|
|
1156
|
+
}
|
|
1157
|
+
})
|
|
1158
|
+
})]
|
|
1159
|
+
})
|
|
1160
|
+
});
|
|
303
1161
|
});
|
|
304
1162
|
|
|
305
1163
|
var RepositoryTile = function RepositoryTile(_ref) {
|
|
@@ -316,39 +1174,43 @@ var RepositoryTile = function RepositoryTile(_ref) {
|
|
|
316
1174
|
fullName = repository.fullName,
|
|
317
1175
|
isPrivate = repository.isPrivate,
|
|
318
1176
|
updatedAt = repository.updatedAt;
|
|
319
|
-
return /*#__PURE__*/
|
|
1177
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
320
1178
|
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",
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
1179
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1180
|
+
className: "width-calc flex items-center space-x-2",
|
|
1181
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(misc.Github, {
|
|
1182
|
+
className: "flex-shrink-0",
|
|
1183
|
+
size: 16
|
|
1184
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1185
|
+
style: "body2",
|
|
1186
|
+
children: fullName
|
|
1187
|
+
}), isPrivate && /*#__PURE__*/jsxRuntime.jsx(neetoIcons.Lock, {
|
|
1188
|
+
className: "flex-shrink-0",
|
|
1189
|
+
size: 16
|
|
1190
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1191
|
+
className: "hidden lg:inline-block",
|
|
1192
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
1193
|
+
className: "neeto-ui-bg-gray-800 neeto-ui-rounded-full h-1 w-1"
|
|
1194
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DateFormat__default["default"].FromNow, {
|
|
1195
|
+
date: updatedAt
|
|
1196
|
+
})]
|
|
1197
|
+
})]
|
|
1198
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1199
|
+
className: "w-max",
|
|
1200
|
+
disabled: isConnecting,
|
|
1201
|
+
loading: isLoading,
|
|
1202
|
+
style: "primary",
|
|
1203
|
+
type: "button",
|
|
1204
|
+
onClick: function onClick() {
|
|
1205
|
+
return onConnect({
|
|
1206
|
+
repoType: "private",
|
|
1207
|
+
repository: repository,
|
|
1208
|
+
setIsLoading: setIsLoading
|
|
1209
|
+
});
|
|
1210
|
+
},
|
|
1211
|
+
children: t("neetoGithub.connect")
|
|
1212
|
+
})]
|
|
1213
|
+
}, id);
|
|
352
1214
|
};
|
|
353
1215
|
|
|
354
1216
|
var List = reactUtils.withT(function (_ref) {
|
|
@@ -359,48 +1221,54 @@ var List = reactUtils.withT(function (_ref) {
|
|
|
359
1221
|
onConnect = _ref.onConnect,
|
|
360
1222
|
installationUrl = _ref.installationUrl,
|
|
361
1223
|
troubleshootUrl = _ref.troubleshootUrl;
|
|
362
|
-
return /*#__PURE__*/
|
|
363
|
-
className: "h-full overflow-y-scroll px-4 pb-4 md:px-6 md:pb-6"
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
1224
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1225
|
+
className: "h-full overflow-y-scroll px-4 pb-4 md:px-6 md:pb-6",
|
|
1226
|
+
children: neetoCist.isPresent(repositories) ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1227
|
+
className: classnames__default["default"]("neeto-ui-border-gray-300 neeto-ui-rounded-md flex flex-col items-center justify-center border", {
|
|
1228
|
+
"h-auto": neetoCist.isPresent(filteredRepositories),
|
|
1229
|
+
"h-full": !neetoCist.isPresent(filteredRepositories)
|
|
1230
|
+
}),
|
|
1231
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1232
|
+
className: "m-0 h-full w-full p-0",
|
|
1233
|
+
children: neetoCist.isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
|
|
1234
|
+
return /*#__PURE__*/React.createElement(RepositoryTile, {
|
|
1235
|
+
isConnecting: isConnecting,
|
|
1236
|
+
onConnect: onConnect,
|
|
1237
|
+
repository: repository,
|
|
1238
|
+
key: index
|
|
1239
|
+
});
|
|
1240
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1241
|
+
className: "flex h-full w-full items-center justify-center",
|
|
1242
|
+
style: "body2",
|
|
1243
|
+
children: t("neetoGithub.noRepos")
|
|
1244
|
+
})
|
|
1245
|
+
})
|
|
1246
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(NoRepositories, {
|
|
1247
|
+
installationUrl: installationUrl,
|
|
1248
|
+
troubleshootUrl: troubleshootUrl
|
|
368
1249
|
})
|
|
369
|
-
}
|
|
370
|
-
className: "m-0 h-full w-full p-0"
|
|
371
|
-
}, neetoCist.isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
|
|
372
|
-
return /*#__PURE__*/React__default["default"].createElement(RepositoryTile, {
|
|
373
|
-
isConnecting: isConnecting,
|
|
374
|
-
onConnect: onConnect,
|
|
375
|
-
repository: repository,
|
|
376
|
-
key: index
|
|
377
|
-
});
|
|
378
|
-
}) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
379
|
-
className: "flex h-full w-full items-center justify-center",
|
|
380
|
-
style: "body2"
|
|
381
|
-
}, t("neetoGithub.noRepos")))) : /*#__PURE__*/React__default["default"].createElement(NoRepositories, {
|
|
382
|
-
installationUrl: installationUrl,
|
|
383
|
-
troubleshootUrl: troubleshootUrl
|
|
384
|
-
}));
|
|
1250
|
+
});
|
|
385
1251
|
});
|
|
386
1252
|
|
|
387
1253
|
var NotConnected = reactUtils.withT(function (_ref) {
|
|
388
1254
|
var t = _ref.t,
|
|
389
1255
|
installationUrl = _ref.installationUrl;
|
|
390
|
-
return /*#__PURE__*/
|
|
391
|
-
className: "flex w-full max-w-sm flex-col items-center justify-center space-y-4 text-center"
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
1256
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1257
|
+
className: "flex w-full max-w-sm flex-col items-center justify-center space-y-4 text-center",
|
|
1258
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1259
|
+
style: "body2",
|
|
1260
|
+
children: t("neetoGithub.notConnectedDescription", {
|
|
1261
|
+
appName: initializers.globalProps.appName
|
|
1262
|
+
})
|
|
1263
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1264
|
+
href: installationUrl,
|
|
1265
|
+
icon: misc.Github,
|
|
1266
|
+
iconPosition: "left",
|
|
1267
|
+
label: t("neetoGithub.connectGithub"),
|
|
1268
|
+
size: "medium",
|
|
1269
|
+
style: "primary"
|
|
1270
|
+
})]
|
|
1271
|
+
});
|
|
404
1272
|
});
|
|
405
1273
|
|
|
406
1274
|
var Private = function Private(_ref) {
|
|
@@ -427,38 +1295,47 @@ var Private = function Private(_ref) {
|
|
|
427
1295
|
});
|
|
428
1296
|
setFilteredRepositories(filteredRepositories);
|
|
429
1297
|
};
|
|
430
|
-
return /*#__PURE__*/
|
|
431
|
-
className: "connect-repo flex h-full flex-col"
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
1298
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1299
|
+
className: "connect-repo flex h-full flex-col",
|
|
1300
|
+
children: isConnected ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1301
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1302
|
+
className: "space-y-3 p-4 md:p-6",
|
|
1303
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1304
|
+
className: "flex-shrink-0 text-lg font-medium",
|
|
1305
|
+
style: "h2",
|
|
1306
|
+
children: t("neetoGithub.connectARepo")
|
|
1307
|
+
}), neetoCist.isPresent(repositories) && /*#__PURE__*/jsxRuntime.jsx(Search__default["default"], {
|
|
1308
|
+
onSearch: onSearch,
|
|
1309
|
+
className: "w-full",
|
|
1310
|
+
unlimitedChars: false,
|
|
1311
|
+
suffix: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1312
|
+
style: "body2",
|
|
1313
|
+
children: t("neetoGithub.countOf.repos", {
|
|
1314
|
+
count: filteredRepositories.length
|
|
1315
|
+
})
|
|
1316
|
+
})
|
|
1317
|
+
})]
|
|
1318
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1319
|
+
className: "flex min-h-0 w-full flex-grow flex-col space-y-6",
|
|
1320
|
+
children: /*#__PURE__*/jsxRuntime.jsx(List, {
|
|
1321
|
+
filteredRepositories: filteredRepositories,
|
|
1322
|
+
installationUrl: installationUrl,
|
|
1323
|
+
isConnecting: isConnecting,
|
|
1324
|
+
onConnect: onConnect,
|
|
1325
|
+
repositories: repositories,
|
|
1326
|
+
troubleshootUrl: troubleshootUrl
|
|
1327
|
+
})
|
|
1328
|
+
})]
|
|
1329
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1330
|
+
className: "neeto-ui-text-gray-900 flex-grow font-sans text-sm font-normal leading-6 antialiased",
|
|
1331
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1332
|
+
className: "flex h-full flex-col items-center justify-center p-4",
|
|
1333
|
+
children: /*#__PURE__*/jsxRuntime.jsx(NotConnected, {
|
|
1334
|
+
installationUrl: installationUrl
|
|
1335
|
+
})
|
|
1336
|
+
})
|
|
1337
|
+
})
|
|
1338
|
+
});
|
|
462
1339
|
};
|
|
463
1340
|
|
|
464
1341
|
var Repositories = function Repositories(_ref) {
|
|
@@ -469,19 +1346,20 @@ var Repositories = function Repositories(_ref) {
|
|
|
469
1346
|
installationUrl = _ref.installationUrl,
|
|
470
1347
|
troubleshootUrl = _ref.troubleshootUrl,
|
|
471
1348
|
isPane = _ref.isPane;
|
|
472
|
-
return /*#__PURE__*/
|
|
1349
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
473
1350
|
className: classnames__default["default"]("neeto-ui-rounded-md neeto-ui-border-gray-300 h-full w-full space-y-6 border border-solid", {
|
|
474
1351
|
"order-2": isPane,
|
|
475
1352
|
"order-1": !isPane
|
|
1353
|
+
}),
|
|
1354
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Private, {
|
|
1355
|
+
installationUrl: installationUrl,
|
|
1356
|
+
isConnected: isConnected,
|
|
1357
|
+
isConnecting: isConnecting,
|
|
1358
|
+
onConnect: onConnect,
|
|
1359
|
+
repositories: repositories,
|
|
1360
|
+
troubleshootUrl: troubleshootUrl
|
|
476
1361
|
})
|
|
477
|
-
}
|
|
478
|
-
installationUrl: installationUrl,
|
|
479
|
-
isConnected: isConnected,
|
|
480
|
-
isConnecting: isConnecting,
|
|
481
|
-
onConnect: onConnect,
|
|
482
|
-
repositories: repositories,
|
|
483
|
-
troubleshootUrl: troubleshootUrl
|
|
484
|
-
}));
|
|
1362
|
+
});
|
|
485
1363
|
};
|
|
486
1364
|
|
|
487
1365
|
var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
|
|
@@ -517,32 +1395,34 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
|
|
|
517
1395
|
var accounts = shouldFetchRepositories ? containerAccounts : paneAccounts;
|
|
518
1396
|
var isLoading = shouldFetchRepositories ? isContainerLoading : isPaneLoading;
|
|
519
1397
|
if (isLoading) {
|
|
520
|
-
return /*#__PURE__*/
|
|
521
|
-
className: "flex h-full w-full flex-col items-center"
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
1398
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1399
|
+
className: "flex h-full w-full flex-col items-center",
|
|
1400
|
+
children: /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {
|
|
1401
|
+
text: t("neetoGithub.fetchingRepos")
|
|
1402
|
+
})
|
|
1403
|
+
});
|
|
525
1404
|
}
|
|
526
|
-
return /*#__PURE__*/
|
|
1405
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
527
1406
|
className: classnames__default["default"]("flex min-h-0 w-full flex-grow flex-col", {
|
|
528
1407
|
"flex-col": isPane,
|
|
529
1408
|
"gap-3 md:flex-row md:gap-6": !isPane
|
|
530
|
-
})
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
1409
|
+
}),
|
|
1410
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Accounts, {
|
|
1411
|
+
accounts: accounts,
|
|
1412
|
+
installationUrl: installationUrl,
|
|
1413
|
+
isConnected: isConnected,
|
|
1414
|
+
isPane: isPane,
|
|
1415
|
+
onConnect: onConnect
|
|
1416
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Repositories, {
|
|
1417
|
+
installationUrl: installationUrl,
|
|
1418
|
+
isConnected: isConnected,
|
|
1419
|
+
isConnecting: isConnecting,
|
|
1420
|
+
isPane: isPane,
|
|
1421
|
+
onConnect: onConnect,
|
|
1422
|
+
repositories: repositories,
|
|
1423
|
+
troubleshootUrl: troubleshootUrl
|
|
1424
|
+
})]
|
|
1425
|
+
});
|
|
546
1426
|
};
|
|
547
1427
|
|
|
548
1428
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -2834,26 +3714,32 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
|
|
|
2834
3714
|
}, projects);
|
|
2835
3715
|
});
|
|
2836
3716
|
var paneAccounts = isConnected ? accounts : [];
|
|
2837
|
-
return /*#__PURE__*/
|
|
3717
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"], {
|
|
2838
3718
|
initialFocusRef: initialFocusRef,
|
|
2839
3719
|
isOpen: isOpen,
|
|
2840
3720
|
onClose: onClose,
|
|
2841
3721
|
className: "neeto-github-modal-pane-wrapper",
|
|
2842
|
-
size: "large"
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
3722
|
+
size: "large",
|
|
3723
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Header, {
|
|
3724
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
3725
|
+
style: "h2",
|
|
3726
|
+
children: neetoCist.isPresent(title) ? title : t("neetoGithub.modal.title")
|
|
3727
|
+
})
|
|
3728
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Body, {
|
|
3729
|
+
children: /*#__PURE__*/jsxRuntime.jsx(NeetoGithubNanoContainer, {
|
|
3730
|
+
installationUrl: installationUrl,
|
|
3731
|
+
isConnected: isConnected,
|
|
3732
|
+
isConnecting: isConnecting,
|
|
3733
|
+
isPaneLoading: isPaneLoading,
|
|
3734
|
+
onConnect: onConnect,
|
|
3735
|
+
paneAccounts: paneAccounts,
|
|
3736
|
+
paneRepositories: paneRepositories,
|
|
3737
|
+
troubleshootUrl: troubleshootUrl,
|
|
3738
|
+
isPane: true,
|
|
3739
|
+
shouldFetchRepositories: false
|
|
3740
|
+
})
|
|
3741
|
+
})]
|
|
3742
|
+
});
|
|
2857
3743
|
};
|
|
2858
3744
|
|
|
2859
3745
|
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}}
|