@bigbinary/neeto-github-frontend 1.0.27 → 1.1.0-beta1
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 +1194 -297
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1174 -298
- package/dist/index.js.map +1 -1
- package/package.json +15 -15
package/dist/index.cjs.js
CHANGED
|
@@ -3,72 +3,915 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var classnames = require('classnames');
|
|
7
7
|
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
8
8
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
9
9
|
var reactI18next = require('react-i18next');
|
|
10
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
|
-
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
16
|
-
var neetoui = require('@bigbinary/neetoui');
|
|
17
15
|
var misc = require('@bigbinary/neeto-icons/misc');
|
|
16
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
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
|
-
|
|
26
|
-
|
|
28
|
+
function _interopNamespace(e) {
|
|
29
|
+
if (e && e.__esModule) return e;
|
|
30
|
+
var n = Object.create(null);
|
|
31
|
+
if (e) {
|
|
32
|
+
Object.keys(e).forEach(function (k) {
|
|
33
|
+
if (k !== 'default') {
|
|
34
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
35
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return e[k]; }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
n["default"] = e;
|
|
43
|
+
return Object.freeze(n);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
47
|
+
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
|
+
});
|
|
50
205
|
}
|
|
51
|
-
|
|
206
|
+
setFocused(focused) {
|
|
207
|
+
const changed = this.#focused !== focused;
|
|
208
|
+
if (changed) {
|
|
209
|
+
this.#focused = focused;
|
|
210
|
+
this.onFocus();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
onFocus() {
|
|
214
|
+
const isFocused = this.isFocused();
|
|
215
|
+
this.listeners.forEach((listener) => {
|
|
216
|
+
listener(isFocused);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
isFocused() {
|
|
220
|
+
if (typeof this.#focused === "boolean") {
|
|
221
|
+
return this.#focused;
|
|
222
|
+
}
|
|
223
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var focusManager = new FocusManager();
|
|
227
|
+
|
|
228
|
+
// src/onlineManager.ts
|
|
229
|
+
var OnlineManager = class extends Subscribable {
|
|
230
|
+
#online = true;
|
|
231
|
+
#cleanup;
|
|
232
|
+
#setup;
|
|
233
|
+
constructor() {
|
|
234
|
+
super();
|
|
235
|
+
this.#setup = (onOnline) => {
|
|
236
|
+
if (!isServer && window.addEventListener) {
|
|
237
|
+
const onlineListener = () => onOnline(true);
|
|
238
|
+
const offlineListener = () => onOnline(false);
|
|
239
|
+
window.addEventListener("online", onlineListener, false);
|
|
240
|
+
window.addEventListener("offline", offlineListener, false);
|
|
241
|
+
return () => {
|
|
242
|
+
window.removeEventListener("online", onlineListener);
|
|
243
|
+
window.removeEventListener("offline", offlineListener);
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
return;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
onSubscribe() {
|
|
250
|
+
if (!this.#cleanup) {
|
|
251
|
+
this.setEventListener(this.#setup);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
onUnsubscribe() {
|
|
255
|
+
if (!this.hasListeners()) {
|
|
256
|
+
this.#cleanup?.();
|
|
257
|
+
this.#cleanup = void 0;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setEventListener(setup) {
|
|
261
|
+
this.#setup = setup;
|
|
262
|
+
this.#cleanup?.();
|
|
263
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
264
|
+
}
|
|
265
|
+
setOnline(online) {
|
|
266
|
+
const changed = this.#online !== online;
|
|
267
|
+
if (changed) {
|
|
268
|
+
this.#online = online;
|
|
269
|
+
this.listeners.forEach((listener) => {
|
|
270
|
+
listener(online);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
isOnline() {
|
|
275
|
+
return this.#online;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
var onlineManager = new OnlineManager();
|
|
279
|
+
|
|
280
|
+
// src/retryer.ts
|
|
281
|
+
function canFetch(networkMode) {
|
|
282
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
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
|
+
});
|
|
67
495
|
});
|
|
68
|
-
|
|
69
|
-
|
|
496
|
+
return trackedResult;
|
|
497
|
+
}
|
|
498
|
+
trackProp(key) {
|
|
499
|
+
this.#trackedProps.add(key);
|
|
500
|
+
}
|
|
501
|
+
getCurrentQuery() {
|
|
502
|
+
return this.#currentQuery;
|
|
503
|
+
}
|
|
504
|
+
refetch({ ...options } = {}) {
|
|
505
|
+
return this.fetch({
|
|
506
|
+
...options
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
fetchOptimistic(options) {
|
|
510
|
+
const defaultedOptions = this.#client.defaultQueryOptions(options);
|
|
511
|
+
const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
|
|
512
|
+
query.isFetchingOptimistic = true;
|
|
513
|
+
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
514
|
+
}
|
|
515
|
+
fetch(fetchOptions) {
|
|
516
|
+
return this.#executeFetch({
|
|
517
|
+
...fetchOptions,
|
|
518
|
+
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
519
|
+
}).then(() => {
|
|
520
|
+
this.updateResult();
|
|
521
|
+
return this.#currentResult;
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
#executeFetch(fetchOptions) {
|
|
525
|
+
this.#updateQuery();
|
|
526
|
+
let promise = this.#currentQuery.fetch(
|
|
527
|
+
this.options,
|
|
528
|
+
fetchOptions
|
|
529
|
+
);
|
|
530
|
+
if (!fetchOptions?.throwOnError) {
|
|
531
|
+
promise = promise.catch(noop);
|
|
532
|
+
}
|
|
533
|
+
return promise;
|
|
534
|
+
}
|
|
535
|
+
#updateStaleTimeout() {
|
|
536
|
+
this.#clearStaleTimeout();
|
|
537
|
+
if (isServer || this.#currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
const time = timeUntilStale(
|
|
541
|
+
this.#currentResult.dataUpdatedAt,
|
|
542
|
+
this.options.staleTime
|
|
543
|
+
);
|
|
544
|
+
const timeout = time + 1;
|
|
545
|
+
this.#staleTimeoutId = setTimeout(() => {
|
|
546
|
+
if (!this.#currentResult.isStale) {
|
|
547
|
+
this.updateResult();
|
|
548
|
+
}
|
|
549
|
+
}, timeout);
|
|
550
|
+
}
|
|
551
|
+
#computeRefetchInterval() {
|
|
552
|
+
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
|
|
553
|
+
}
|
|
554
|
+
#updateRefetchInterval(nextInterval) {
|
|
555
|
+
this.#clearRefetchInterval();
|
|
556
|
+
this.#currentRefetchInterval = nextInterval;
|
|
557
|
+
if (isServer || this.options.enabled === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
this.#refetchIntervalId = setInterval(() => {
|
|
561
|
+
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
562
|
+
this.#executeFetch();
|
|
563
|
+
}
|
|
564
|
+
}, this.#currentRefetchInterval);
|
|
565
|
+
}
|
|
566
|
+
#updateTimers() {
|
|
567
|
+
this.#updateStaleTimeout();
|
|
568
|
+
this.#updateRefetchInterval(this.#computeRefetchInterval());
|
|
569
|
+
}
|
|
570
|
+
#clearStaleTimeout() {
|
|
571
|
+
if (this.#staleTimeoutId) {
|
|
572
|
+
clearTimeout(this.#staleTimeoutId);
|
|
573
|
+
this.#staleTimeoutId = void 0;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
#clearRefetchInterval() {
|
|
577
|
+
if (this.#refetchIntervalId) {
|
|
578
|
+
clearInterval(this.#refetchIntervalId);
|
|
579
|
+
this.#refetchIntervalId = void 0;
|
|
580
|
+
}
|
|
70
581
|
}
|
|
71
|
-
|
|
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,88 +945,103 @@ 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
|
|
|
958
|
+
var Header = reactUtils.withT(function (_ref) {
|
|
959
|
+
var t = _ref.t;
|
|
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
|
+
});
|
|
969
|
+
});
|
|
970
|
+
|
|
114
971
|
var Configure = reactUtils.withT(function (_ref) {
|
|
115
972
|
var t = _ref.t,
|
|
116
973
|
isConnected = _ref.isConnected,
|
|
117
974
|
installationUrl = _ref.installationUrl;
|
|
118
|
-
return /*#__PURE__*/
|
|
119
|
-
className: "neeto-ui-text-gray-900 font-sans text-sm font-normal leading-6 antialiased"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
var Header = reactUtils.withT(function (_ref) {
|
|
132
|
-
var t = _ref.t;
|
|
133
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
134
|
-
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"
|
|
135
|
-
}, /*#__PURE__*/React__default["default"].createElement(misc.Github, {
|
|
136
|
-
size: 16
|
|
137
|
-
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
138
|
-
style: "h4"
|
|
139
|
-
}, t("neetoGithub.github")));
|
|
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
|
+
});
|
|
140
987
|
});
|
|
141
988
|
|
|
142
989
|
var List$1 = reactUtils.withT(function (_ref) {
|
|
143
990
|
var t = _ref.t,
|
|
144
|
-
accounts = _ref.accounts
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
991
|
+
accounts = _ref.accounts,
|
|
992
|
+
isConnected = _ref.isConnected,
|
|
993
|
+
installationUrl = _ref.installationUrl,
|
|
994
|
+
isPane = _ref.isPane;
|
|
995
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
996
|
+
className: classnames__default["default"]("neeto-ui-border-gray-300 flex justify-between gap-3 border-b pb-4 pt-2", {
|
|
997
|
+
"flex-col md:flex-row": isPane,
|
|
998
|
+
"flex-col": !isPane
|
|
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
|
+
})]
|
|
187
1045
|
});
|
|
188
1046
|
});
|
|
189
1047
|
|
|
@@ -193,21 +1051,22 @@ var Accounts = function Accounts(_ref) {
|
|
|
193
1051
|
isConnected = _ref.isConnected,
|
|
194
1052
|
onConnect = _ref.onConnect,
|
|
195
1053
|
installationUrl = _ref.installationUrl;
|
|
196
|
-
return /*#__PURE__*/
|
|
197
|
-
className:
|
|
198
|
-
"
|
|
199
|
-
"
|
|
1054
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1055
|
+
className: classnames__default["default"]("flex w-full flex-col border border-solid border-transparent px-0 py-2", {
|
|
1056
|
+
"order-1": isPane,
|
|
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
|
+
})]
|
|
200
1068
|
})
|
|
201
|
-
}
|
|
202
|
-
className: "mb-2"
|
|
203
|
-
}, /*#__PURE__*/React__default["default"].createElement(Header, null), /*#__PURE__*/React__default["default"].createElement(List$1, {
|
|
204
|
-
accounts: accounts,
|
|
205
|
-
isConnected: isConnected
|
|
206
|
-
}), /*#__PURE__*/React__default["default"].createElement(Configure, {
|
|
207
|
-
installationUrl: installationUrl,
|
|
208
|
-
isConnected: isConnected,
|
|
209
|
-
onConnect: onConnect
|
|
210
|
-
})));
|
|
1069
|
+
});
|
|
211
1070
|
};
|
|
212
1071
|
|
|
213
1072
|
function _arrayWithHoles(arr) {
|
|
@@ -269,32 +1128,36 @@ var NoRepositories = reactUtils.withT(function (_ref) {
|
|
|
269
1128
|
var t = _ref.t,
|
|
270
1129
|
installationUrl = _ref.installationUrl,
|
|
271
1130
|
troubleshootUrl = _ref.troubleshootUrl;
|
|
272
|
-
return /*#__PURE__*/
|
|
273
|
-
className: "flex items-center justify-center py-6"
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
+
});
|
|
298
1161
|
});
|
|
299
1162
|
|
|
300
1163
|
var RepositoryTile = function RepositoryTile(_ref) {
|
|
@@ -311,38 +1174,43 @@ var RepositoryTile = function RepositoryTile(_ref) {
|
|
|
311
1174
|
fullName = repository.fullName,
|
|
312
1175
|
isPrivate = repository.isPrivate,
|
|
313
1176
|
updatedAt = repository.updatedAt;
|
|
314
|
-
return /*#__PURE__*/
|
|
315
|
-
className: "neeto-ui-border-gray-300 flex
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
1177
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
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",
|
|
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);
|
|
346
1214
|
};
|
|
347
1215
|
|
|
348
1216
|
var List = reactUtils.withT(function (_ref) {
|
|
@@ -353,48 +1221,54 @@ var List = reactUtils.withT(function (_ref) {
|
|
|
353
1221
|
onConnect = _ref.onConnect,
|
|
354
1222
|
installationUrl = _ref.installationUrl,
|
|
355
1223
|
troubleshootUrl = _ref.troubleshootUrl;
|
|
356
|
-
return /*#__PURE__*/
|
|
357
|
-
className: "h-full overflow-y-scroll px-6 pb-6"
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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
|
|
362
1249
|
})
|
|
363
|
-
}
|
|
364
|
-
className: "m-0 h-full w-full p-0"
|
|
365
|
-
}, neetoCist.isPresent(filteredRepositories) ? filteredRepositories.map(function (repository, index) {
|
|
366
|
-
return /*#__PURE__*/React__default["default"].createElement(RepositoryTile, {
|
|
367
|
-
isConnecting: isConnecting,
|
|
368
|
-
onConnect: onConnect,
|
|
369
|
-
repository: repository,
|
|
370
|
-
key: index
|
|
371
|
-
});
|
|
372
|
-
}) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
373
|
-
className: "flex h-full w-full items-center justify-center",
|
|
374
|
-
style: "body2"
|
|
375
|
-
}, t("neetoGithub.noRepos")))) : /*#__PURE__*/React__default["default"].createElement(NoRepositories, {
|
|
376
|
-
installationUrl: installationUrl,
|
|
377
|
-
troubleshootUrl: troubleshootUrl
|
|
378
|
-
}));
|
|
1250
|
+
});
|
|
379
1251
|
});
|
|
380
1252
|
|
|
381
1253
|
var NotConnected = reactUtils.withT(function (_ref) {
|
|
382
1254
|
var t = _ref.t,
|
|
383
1255
|
installationUrl = _ref.installationUrl;
|
|
384
|
-
return /*#__PURE__*/
|
|
385
|
-
className: "flex w-full max-w-sm flex-col items-center justify-center space-y-4 text-center"
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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
|
+
});
|
|
398
1272
|
});
|
|
399
1273
|
|
|
400
1274
|
var Private = function Private(_ref) {
|
|
@@ -421,38 +1295,47 @@ var Private = function Private(_ref) {
|
|
|
421
1295
|
});
|
|
422
1296
|
setFilteredRepositories(filteredRepositories);
|
|
423
1297
|
};
|
|
424
|
-
return /*#__PURE__*/
|
|
425
|
-
className: "connect-repo flex h-full flex-col"
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
+
});
|
|
456
1339
|
};
|
|
457
1340
|
|
|
458
1341
|
var Repositories = function Repositories(_ref) {
|
|
@@ -461,17 +1344,22 @@ var Repositories = function Repositories(_ref) {
|
|
|
461
1344
|
repositories = _ref.repositories,
|
|
462
1345
|
onConnect = _ref.onConnect,
|
|
463
1346
|
installationUrl = _ref.installationUrl,
|
|
464
|
-
troubleshootUrl = _ref.troubleshootUrl
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
1347
|
+
troubleshootUrl = _ref.troubleshootUrl,
|
|
1348
|
+
isPane = _ref.isPane;
|
|
1349
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1350
|
+
className: classnames__default["default"]("neeto-ui-rounded-md neeto-ui-border-gray-300 h-full w-full space-y-6 border border-solid", {
|
|
1351
|
+
"order-2": isPane,
|
|
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
|
|
1361
|
+
})
|
|
1362
|
+
});
|
|
475
1363
|
};
|
|
476
1364
|
|
|
477
1365
|
var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
|
|
@@ -507,31 +1395,34 @@ var NeetoGithubNanoContainer = function NeetoGithubNanoContainer(_ref) {
|
|
|
507
1395
|
var accounts = shouldFetchRepositories ? containerAccounts : paneAccounts;
|
|
508
1396
|
var isLoading = shouldFetchRepositories ? isContainerLoading : isPaneLoading;
|
|
509
1397
|
if (isLoading) {
|
|
510
|
-
return /*#__PURE__*/
|
|
511
|
-
className: "flex h-full w-full flex-col items-center"
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
"
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
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
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1406
|
+
className: classnames__default["default"]("flex min-h-0 w-full flex-grow flex-col", {
|
|
1407
|
+
"flex-col": isPane,
|
|
1408
|
+
"gap-3 md:flex-row md:gap-6": !isPane
|
|
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
|
+
});
|
|
535
1426
|
};
|
|
536
1427
|
|
|
537
1428
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -2823,31 +3714,37 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
|
|
|
2823
3714
|
}, projects);
|
|
2824
3715
|
});
|
|
2825
3716
|
var paneAccounts = isConnected ? accounts : [];
|
|
2826
|
-
return /*#__PURE__*/
|
|
3717
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"], {
|
|
2827
3718
|
initialFocusRef: initialFocusRef,
|
|
2828
3719
|
isOpen: isOpen,
|
|
2829
3720
|
onClose: onClose,
|
|
2830
3721
|
className: "neeto-github-modal-pane-wrapper",
|
|
2831
|
-
size: "large"
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
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
|
+
});
|
|
2846
3743
|
};
|
|
2847
3744
|
|
|
2848
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}}
|
|
2849
3746
|
|
|
2850
|
-
var css = ".width-calc{width:calc(100% - 82px)}.neeto-github-modal-pane-wrapper{width:min(
|
|
3747
|
+
var css = ".width-calc{width:100%}@media (min-width:768px){.width-calc{width:calc(100% - 82px)}}.neeto-github-modal-pane-wrapper{width:min(100%,1280px)}@media (min-width:768px){.neeto-github-modal-pane-wrapper{width:min(90%,1280px)}}@media (min-width:1024px){.neeto-github-modal-pane-wrapper{width:min(60%,1280px)}}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3JlcG9zaXRvcnktdGlsZS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYXBwbGljYXRpb24uc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3BhbmUuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxZQUNFLFVDQ0YsQ0RDRSx5QkFIRixZQUlJLHVCQ0VGLENBQ0YsQ0NQQSxpQ0FDRSxzQkRVRixDQ1JFLHlCQUhGLGlDQUlJLHFCRFdGLENBQ0YsQ0NURSwwQkFQRixpQ0FRSSxxQkRZRixDQUNGIiwic291cmNlc0NvbnRlbnQiOlsiLndpZHRoLWNhbGMge1xuICB3aWR0aDogMTAwJTtcblxuICBAc2NyZWVuIG1kIHtcbiAgICB3aWR0aDogY2FsYygxMDAlIC0gODJweCk7XG4gIH1cbn1cbiIsIi53aWR0aC1jYWxjIHtcbiAgd2lkdGg6IDEwMCU7XG59XG5Ac2NyZWVuIG1kIHtcbiAgLndpZHRoLWNhbGMge1xuICAgIHdpZHRoOiBjYWxjKDEwMCUgLSA4MnB4KTtcbiAgfVxufVxuXG4ubmVldG8tZ2l0aHViLW1vZGFsLXBhbmUtd3JhcHBlciB7XG4gIHdpZHRoOiBtaW4oMTAwJSwgMTI4MHB4KTtcbn1cbkBzY3JlZW4gbWQge1xuICAubmVldG8tZ2l0aHViLW1vZGFsLXBhbmUtd3JhcHBlciB7XG4gICAgd2lkdGg6IG1pbig5MCUsIDEyODBweCk7XG4gIH1cbn1cbkBzY3JlZW4gbGcge1xuICAubmVldG8tZ2l0aHViLW1vZGFsLXBhbmUtd3JhcHBlciB7XG4gICAgd2lkdGg6IG1pbig2MCUsIDEyODBweCk7XG4gIH1cbn0iLCIubmVldG8tZ2l0aHViLW1vZGFsLXBhbmUtd3JhcHBlciB7XG4gIHdpZHRoOiBtaW4oMTAwJSwgMTI4MHB4KTtcblxuICBAc2NyZWVuIG1kIHtcbiAgICB3aWR0aDogbWluKDkwJSwgMTI4MHB4KTtcbiAgfVxuXG4gIEBzY3JlZW4gbGcge1xuICAgIHdpZHRoOiBtaW4oNjAlLCAxMjgwcHgpO1xuICB9XG59XG4iXX0= */";
|
|
2851
3748
|
n(css,{});
|
|
2852
3749
|
|
|
2853
3750
|
exports.NeetoGithubNanoContainer = NeetoGithubNanoContainer;
|