@bigbinary/neeto-team-members-frontend 2.4.13 → 2.4.14
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/README.md +2 -2
- package/dist/index.cjs.js +112 -3280
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +101 -3268
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -5
package/dist/index.cjs.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ramda = require('ramda');
|
|
7
7
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
8
|
-
var
|
|
8
|
+
var reactQuery = require('react-query');
|
|
9
|
+
var devtools = require('react-query/devtools');
|
|
9
10
|
var axios = require('axios');
|
|
10
11
|
var neetoui = require('@bigbinary/neetoui');
|
|
11
12
|
var layouts = require('@bigbinary/neetoui/layouts');
|
|
@@ -35,7 +36,6 @@ function _interopNamespace(e) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
38
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
39
39
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
40
40
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
41
41
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
@@ -2387,7 +2387,7 @@ function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeRefl
|
|
|
2387
2387
|
|
|
2388
2388
|
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
2389
2389
|
|
|
2390
|
-
function noop$
|
|
2390
|
+
function noop$1() {}
|
|
2391
2391
|
|
|
2392
2392
|
function bindMemberFunctions(inst) {
|
|
2393
2393
|
var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
@@ -2552,7 +2552,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2552
2552
|
}
|
|
2553
2553
|
|
|
2554
2554
|
this.format = this.options.interpolation.format;
|
|
2555
|
-
if (!callback) callback = noop$
|
|
2555
|
+
if (!callback) callback = noop$1;
|
|
2556
2556
|
|
|
2557
2557
|
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2558
2558
|
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
@@ -2613,7 +2613,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2613
2613
|
value: function loadResources(language) {
|
|
2614
2614
|
var _this3 = this;
|
|
2615
2615
|
|
|
2616
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$
|
|
2616
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
2617
2617
|
var usedCallback = callback;
|
|
2618
2618
|
var usedLng = typeof language === 'string' ? language : this.language;
|
|
2619
2619
|
if (typeof language === 'function') usedCallback = language;
|
|
@@ -2661,7 +2661,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2661
2661
|
var deferred = defer();
|
|
2662
2662
|
if (!lngs) lngs = this.languages;
|
|
2663
2663
|
if (!ns) ns = this.options.ns;
|
|
2664
|
-
if (!callback) callback = noop$
|
|
2664
|
+
if (!callback) callback = noop$1;
|
|
2665
2665
|
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
2666
2666
|
deferred.resolve();
|
|
2667
2667
|
callback(err);
|
|
@@ -2940,7 +2940,7 @@ var I18n = function (_EventEmitter) {
|
|
|
2940
2940
|
var _this8 = this;
|
|
2941
2941
|
|
|
2942
2942
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2943
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$
|
|
2943
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
|
|
2944
2944
|
|
|
2945
2945
|
var mergedOptions = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, this.options), options), {
|
|
2946
2946
|
isClone: true
|
|
@@ -4046,7 +4046,8 @@ var common$1 = {
|
|
|
4046
4046
|
role_one: "Role",
|
|
4047
4047
|
role_other: "Roles",
|
|
4048
4048
|
search_: "Search {{what}}",
|
|
4049
|
-
update_: "Update {{what}}"
|
|
4049
|
+
update_: "Update {{what}}",
|
|
4050
|
+
takeAction: "Take action"
|
|
4050
4051
|
};
|
|
4051
4052
|
var helpers$1 = {
|
|
4052
4053
|
configPermissions: "Configure permissions for the modules.",
|
|
@@ -4054,7 +4055,7 @@ var helpers$1 = {
|
|
|
4054
4055
|
moreInfoAboutPermissions: "More information about permissions",
|
|
4055
4056
|
noRolesFound: "No roles found.",
|
|
4056
4057
|
searchRoles: "Search roles",
|
|
4057
|
-
selectedMembersCount: "{{count}} {{metaName}} selected
|
|
4058
|
+
selectedMembersCount: "{{count}} {{metaName}} selected of",
|
|
4058
4059
|
visitToKnowMoreAboutPermissions: "Visit to know more about permissions"
|
|
4059
4060
|
};
|
|
4060
4061
|
var metaNames$1 = {
|
|
@@ -4143,7 +4144,8 @@ var common = {
|
|
|
4143
4144
|
role_one: "Rôle",
|
|
4144
4145
|
role_other: "Rôles",
|
|
4145
4146
|
search_: "Rechercher des {{what}}",
|
|
4146
|
-
update_: "Mettre à jour le {{what}}"
|
|
4147
|
+
update_: "Mettre à jour le {{what}}",
|
|
4148
|
+
takeAction: "Passer à l'action"
|
|
4147
4149
|
};
|
|
4148
4150
|
var helpers = {
|
|
4149
4151
|
configPermissions: "Configurez les autorisations pour les modules.",
|
|
@@ -4151,8 +4153,8 @@ var helpers = {
|
|
|
4151
4153
|
moreInfoAboutPermissions: "Plus d'informations sur les autorisations",
|
|
4152
4154
|
noRolesFound: "Aucun rôle trouvé.",
|
|
4153
4155
|
searchRoles: "Rechercher des rôles",
|
|
4154
|
-
selectedMembersCount_one: "{{count}} {{metaName}} sélectionné
|
|
4155
|
-
selectedMembersCount_other: "{{count}} {{metaName}} sélectionnés
|
|
4156
|
+
selectedMembersCount_one: "{{count}} {{metaName}} sélectionné sur",
|
|
4157
|
+
selectedMembersCount_other: "{{count}} {{metaName}} sélectionnés sur",
|
|
4156
4158
|
visitToKnowMoreAboutPermissions: "Visitez pour en savoir plus sur les autorisations"
|
|
4157
4159
|
};
|
|
4158
4160
|
var metaNames = {
|
|
@@ -4243,7 +4245,7 @@ const getScrollBarWidth = () => {
|
|
|
4243
4245
|
document.body.removeChild(outerElement);
|
|
4244
4246
|
return w1 - w2;
|
|
4245
4247
|
};
|
|
4246
|
-
const noop
|
|
4248
|
+
const noop = () => {};
|
|
4247
4249
|
const slugify = string => string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
|
|
4248
4250
|
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
4249
4251
|
.replace(/[^\w-]+/g, "") // Remove all non-word characters
|
|
@@ -4264,3202 +4266,14 @@ const PLURAL = {
|
|
|
4264
4266
|
const MANAGE_MEMBER_PERMISSIONS = ["members.manage_members", "agents.manage_agents"];
|
|
4265
4267
|
const DEFAULT_PERMISSION = true; // Until we add permission prop to all neeto apps, this is the default permission.
|
|
4266
4268
|
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
subClass.prototype.constructor = subClass;
|
|
4270
|
-
_setPrototypeOf(subClass, superClass);
|
|
4271
|
-
}
|
|
4272
|
-
|
|
4273
|
-
var Subscribable = /*#__PURE__*/function () {
|
|
4274
|
-
function Subscribable() {
|
|
4275
|
-
this.listeners = [];
|
|
4276
|
-
}
|
|
4277
|
-
|
|
4278
|
-
var _proto = Subscribable.prototype;
|
|
4279
|
-
|
|
4280
|
-
_proto.subscribe = function subscribe(listener) {
|
|
4281
|
-
var _this = this;
|
|
4282
|
-
|
|
4283
|
-
var callback = listener || function () {
|
|
4284
|
-
return undefined;
|
|
4285
|
-
};
|
|
4286
|
-
|
|
4287
|
-
this.listeners.push(callback);
|
|
4288
|
-
this.onSubscribe();
|
|
4289
|
-
return function () {
|
|
4290
|
-
_this.listeners = _this.listeners.filter(function (x) {
|
|
4291
|
-
return x !== callback;
|
|
4292
|
-
});
|
|
4293
|
-
|
|
4294
|
-
_this.onUnsubscribe();
|
|
4295
|
-
};
|
|
4296
|
-
};
|
|
4297
|
-
|
|
4298
|
-
_proto.hasListeners = function hasListeners() {
|
|
4299
|
-
return this.listeners.length > 0;
|
|
4300
|
-
};
|
|
4301
|
-
|
|
4302
|
-
_proto.onSubscribe = function onSubscribe() {// Do nothing
|
|
4303
|
-
};
|
|
4304
|
-
|
|
4305
|
-
_proto.onUnsubscribe = function onUnsubscribe() {// Do nothing
|
|
4306
|
-
};
|
|
4307
|
-
|
|
4308
|
-
return Subscribable;
|
|
4309
|
-
}();
|
|
4310
|
-
|
|
4311
|
-
function _extends() {
|
|
4312
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
4313
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4314
|
-
var source = arguments[i];
|
|
4315
|
-
for (var key in source) {
|
|
4316
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4317
|
-
target[key] = source[key];
|
|
4318
|
-
}
|
|
4319
|
-
}
|
|
4320
|
-
}
|
|
4321
|
-
return target;
|
|
4322
|
-
};
|
|
4323
|
-
return _extends.apply(this, arguments);
|
|
4324
|
-
}
|
|
4325
|
-
|
|
4326
|
-
// TYPES
|
|
4327
|
-
// UTILS
|
|
4328
|
-
var isServer = typeof window === 'undefined';
|
|
4329
|
-
function noop() {
|
|
4330
|
-
return undefined;
|
|
4331
|
-
}
|
|
4332
|
-
function functionalUpdate(updater, input) {
|
|
4333
|
-
return typeof updater === 'function' ? updater(input) : updater;
|
|
4334
|
-
}
|
|
4335
|
-
function isValidTimeout(value) {
|
|
4336
|
-
return typeof value === 'number' && value >= 0 && value !== Infinity;
|
|
4337
|
-
}
|
|
4338
|
-
function ensureQueryKeyArray(value) {
|
|
4339
|
-
return Array.isArray(value) ? value : [value];
|
|
4340
|
-
}
|
|
4341
|
-
function timeUntilStale(updatedAt, staleTime) {
|
|
4342
|
-
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
4343
|
-
}
|
|
4344
|
-
function parseQueryArgs(arg1, arg2, arg3) {
|
|
4345
|
-
if (!isQueryKey(arg1)) {
|
|
4346
|
-
return arg1;
|
|
4347
|
-
}
|
|
4348
|
-
|
|
4349
|
-
if (typeof arg2 === 'function') {
|
|
4350
|
-
return _extends({}, arg3, {
|
|
4351
|
-
queryKey: arg1,
|
|
4352
|
-
queryFn: arg2
|
|
4353
|
-
});
|
|
4354
|
-
}
|
|
4355
|
-
|
|
4356
|
-
return _extends({}, arg2, {
|
|
4357
|
-
queryKey: arg1
|
|
4358
|
-
});
|
|
4359
|
-
}
|
|
4360
|
-
function parseMutationArgs(arg1, arg2, arg3) {
|
|
4361
|
-
if (isQueryKey(arg1)) {
|
|
4362
|
-
if (typeof arg2 === 'function') {
|
|
4363
|
-
return _extends({}, arg3, {
|
|
4364
|
-
mutationKey: arg1,
|
|
4365
|
-
mutationFn: arg2
|
|
4366
|
-
});
|
|
4367
|
-
}
|
|
4368
|
-
|
|
4369
|
-
return _extends({}, arg2, {
|
|
4370
|
-
mutationKey: arg1
|
|
4371
|
-
});
|
|
4372
|
-
}
|
|
4373
|
-
|
|
4374
|
-
if (typeof arg1 === 'function') {
|
|
4375
|
-
return _extends({}, arg2, {
|
|
4376
|
-
mutationFn: arg1
|
|
4377
|
-
});
|
|
4378
|
-
}
|
|
4379
|
-
|
|
4380
|
-
return _extends({}, arg1);
|
|
4381
|
-
}
|
|
4382
|
-
function parseFilterArgs(arg1, arg2, arg3) {
|
|
4383
|
-
return isQueryKey(arg1) ? [_extends({}, arg2, {
|
|
4384
|
-
queryKey: arg1
|
|
4385
|
-
}), arg3] : [arg1 || {}, arg2];
|
|
4386
|
-
}
|
|
4387
|
-
function mapQueryStatusFilter(active, inactive) {
|
|
4388
|
-
if (active === true && inactive === true || active == null && inactive == null) {
|
|
4389
|
-
return 'all';
|
|
4390
|
-
} else if (active === false && inactive === false) {
|
|
4391
|
-
return 'none';
|
|
4392
|
-
} else {
|
|
4393
|
-
// At this point, active|inactive can only be true|false or false|true
|
|
4394
|
-
// so, when only one value is provided, the missing one has to be the negated value
|
|
4395
|
-
var isActive = active != null ? active : !inactive;
|
|
4396
|
-
return isActive ? 'active' : 'inactive';
|
|
4397
|
-
}
|
|
4398
|
-
}
|
|
4399
|
-
function matchQuery(filters, query) {
|
|
4400
|
-
var active = filters.active,
|
|
4401
|
-
exact = filters.exact,
|
|
4402
|
-
fetching = filters.fetching,
|
|
4403
|
-
inactive = filters.inactive,
|
|
4404
|
-
predicate = filters.predicate,
|
|
4405
|
-
queryKey = filters.queryKey,
|
|
4406
|
-
stale = filters.stale;
|
|
4407
|
-
|
|
4408
|
-
if (isQueryKey(queryKey)) {
|
|
4409
|
-
if (exact) {
|
|
4410
|
-
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
|
|
4411
|
-
return false;
|
|
4412
|
-
}
|
|
4413
|
-
} else if (!partialMatchKey(query.queryKey, queryKey)) {
|
|
4414
|
-
return false;
|
|
4415
|
-
}
|
|
4416
|
-
}
|
|
4417
|
-
|
|
4418
|
-
var queryStatusFilter = mapQueryStatusFilter(active, inactive);
|
|
4419
|
-
|
|
4420
|
-
if (queryStatusFilter === 'none') {
|
|
4421
|
-
return false;
|
|
4422
|
-
} else if (queryStatusFilter !== 'all') {
|
|
4423
|
-
var isActive = query.isActive();
|
|
4424
|
-
|
|
4425
|
-
if (queryStatusFilter === 'active' && !isActive) {
|
|
4426
|
-
return false;
|
|
4427
|
-
}
|
|
4428
|
-
|
|
4429
|
-
if (queryStatusFilter === 'inactive' && isActive) {
|
|
4430
|
-
return false;
|
|
4431
|
-
}
|
|
4432
|
-
}
|
|
4433
|
-
|
|
4434
|
-
if (typeof stale === 'boolean' && query.isStale() !== stale) {
|
|
4435
|
-
return false;
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
|
-
if (typeof fetching === 'boolean' && query.isFetching() !== fetching) {
|
|
4439
|
-
return false;
|
|
4440
|
-
}
|
|
4441
|
-
|
|
4442
|
-
if (predicate && !predicate(query)) {
|
|
4443
|
-
return false;
|
|
4444
|
-
}
|
|
4445
|
-
|
|
4446
|
-
return true;
|
|
4447
|
-
}
|
|
4448
|
-
function matchMutation(filters, mutation) {
|
|
4449
|
-
var exact = filters.exact,
|
|
4450
|
-
fetching = filters.fetching,
|
|
4451
|
-
predicate = filters.predicate,
|
|
4452
|
-
mutationKey = filters.mutationKey;
|
|
4453
|
-
|
|
4454
|
-
if (isQueryKey(mutationKey)) {
|
|
4455
|
-
if (!mutation.options.mutationKey) {
|
|
4456
|
-
return false;
|
|
4457
|
-
}
|
|
4458
|
-
|
|
4459
|
-
if (exact) {
|
|
4460
|
-
if (hashQueryKey(mutation.options.mutationKey) !== hashQueryKey(mutationKey)) {
|
|
4461
|
-
return false;
|
|
4462
|
-
}
|
|
4463
|
-
} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
|
|
4464
|
-
return false;
|
|
4465
|
-
}
|
|
4466
|
-
}
|
|
4467
|
-
|
|
4468
|
-
if (typeof fetching === 'boolean' && mutation.state.status === 'loading' !== fetching) {
|
|
4469
|
-
return false;
|
|
4470
|
-
}
|
|
4471
|
-
|
|
4472
|
-
if (predicate && !predicate(mutation)) {
|
|
4473
|
-
return false;
|
|
4474
|
-
}
|
|
4475
|
-
|
|
4476
|
-
return true;
|
|
4477
|
-
}
|
|
4478
|
-
function hashQueryKeyByOptions(queryKey, options) {
|
|
4479
|
-
var hashFn = (options == null ? void 0 : options.queryKeyHashFn) || hashQueryKey;
|
|
4480
|
-
return hashFn(queryKey);
|
|
4481
|
-
}
|
|
4482
|
-
/**
|
|
4483
|
-
* Default query keys hash function.
|
|
4484
|
-
*/
|
|
4485
|
-
|
|
4486
|
-
function hashQueryKey(queryKey) {
|
|
4487
|
-
var asArray = ensureQueryKeyArray(queryKey);
|
|
4488
|
-
return stableValueHash(asArray);
|
|
4489
|
-
}
|
|
4490
|
-
/**
|
|
4491
|
-
* Hashes the value into a stable hash.
|
|
4492
|
-
*/
|
|
4493
|
-
|
|
4494
|
-
function stableValueHash(value) {
|
|
4495
|
-
return JSON.stringify(value, function (_, val) {
|
|
4496
|
-
return isPlainObject(val) ? Object.keys(val).sort().reduce(function (result, key) {
|
|
4497
|
-
result[key] = val[key];
|
|
4498
|
-
return result;
|
|
4499
|
-
}, {}) : val;
|
|
4500
|
-
});
|
|
4501
|
-
}
|
|
4502
|
-
/**
|
|
4503
|
-
* Checks if key `b` partially matches with key `a`.
|
|
4504
|
-
*/
|
|
4505
|
-
|
|
4506
|
-
function partialMatchKey(a, b) {
|
|
4507
|
-
return partialDeepEqual(ensureQueryKeyArray(a), ensureQueryKeyArray(b));
|
|
4508
|
-
}
|
|
4509
|
-
/**
|
|
4510
|
-
* Checks if `b` partially matches with `a`.
|
|
4511
|
-
*/
|
|
4512
|
-
|
|
4513
|
-
function partialDeepEqual(a, b) {
|
|
4514
|
-
if (a === b) {
|
|
4515
|
-
return true;
|
|
4516
|
-
}
|
|
4517
|
-
|
|
4518
|
-
if (typeof a !== typeof b) {
|
|
4519
|
-
return false;
|
|
4520
|
-
}
|
|
4521
|
-
|
|
4522
|
-
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
4523
|
-
return !Object.keys(b).some(function (key) {
|
|
4524
|
-
return !partialDeepEqual(a[key], b[key]);
|
|
4525
|
-
});
|
|
4526
|
-
}
|
|
4527
|
-
|
|
4528
|
-
return false;
|
|
4529
|
-
}
|
|
4530
|
-
/**
|
|
4531
|
-
* This function returns `a` if `b` is deeply equal.
|
|
4532
|
-
* If not, it will replace any deeply equal children of `b` with those of `a`.
|
|
4533
|
-
* This can be used for structural sharing between JSON values for example.
|
|
4534
|
-
*/
|
|
4535
|
-
|
|
4536
|
-
function replaceEqualDeep(a, b) {
|
|
4537
|
-
if (a === b) {
|
|
4538
|
-
return a;
|
|
4539
|
-
}
|
|
4540
|
-
|
|
4541
|
-
var array = Array.isArray(a) && Array.isArray(b);
|
|
4542
|
-
|
|
4543
|
-
if (array || isPlainObject(a) && isPlainObject(b)) {
|
|
4544
|
-
var aSize = array ? a.length : Object.keys(a).length;
|
|
4545
|
-
var bItems = array ? b : Object.keys(b);
|
|
4546
|
-
var bSize = bItems.length;
|
|
4547
|
-
var copy = array ? [] : {};
|
|
4548
|
-
var equalItems = 0;
|
|
4549
|
-
|
|
4550
|
-
for (var i = 0; i < bSize; i++) {
|
|
4551
|
-
var key = array ? i : bItems[i];
|
|
4552
|
-
copy[key] = replaceEqualDeep(a[key], b[key]);
|
|
4553
|
-
|
|
4554
|
-
if (copy[key] === a[key]) {
|
|
4555
|
-
equalItems++;
|
|
4556
|
-
}
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
return b;
|
|
4563
|
-
}
|
|
4564
|
-
/**
|
|
4565
|
-
* Shallow compare objects. Only works with objects that always have the same properties.
|
|
4566
|
-
*/
|
|
4567
|
-
|
|
4568
|
-
function shallowEqualObjects(a, b) {
|
|
4569
|
-
if (a && !b || b && !a) {
|
|
4570
|
-
return false;
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
for (var key in a) {
|
|
4574
|
-
if (a[key] !== b[key]) {
|
|
4575
|
-
return false;
|
|
4576
|
-
}
|
|
4577
|
-
}
|
|
4578
|
-
|
|
4579
|
-
return true;
|
|
4580
|
-
} // Copied from: https://github.com/jonschlinkert/is-plain-object
|
|
4581
|
-
|
|
4582
|
-
function isPlainObject(o) {
|
|
4583
|
-
if (!hasObjectPrototype(o)) {
|
|
4584
|
-
return false;
|
|
4585
|
-
} // If has modified constructor
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
var ctor = o.constructor;
|
|
4589
|
-
|
|
4590
|
-
if (typeof ctor === 'undefined') {
|
|
4591
|
-
return true;
|
|
4592
|
-
} // If has modified prototype
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
var prot = ctor.prototype;
|
|
4596
|
-
|
|
4597
|
-
if (!hasObjectPrototype(prot)) {
|
|
4598
|
-
return false;
|
|
4599
|
-
} // If constructor does not have an Object-specific method
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
if (!prot.hasOwnProperty('isPrototypeOf')) {
|
|
4603
|
-
return false;
|
|
4604
|
-
} // Most likely a plain Object
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
return true;
|
|
4608
|
-
}
|
|
4609
|
-
|
|
4610
|
-
function hasObjectPrototype(o) {
|
|
4611
|
-
return Object.prototype.toString.call(o) === '[object Object]';
|
|
4612
|
-
}
|
|
4613
|
-
|
|
4614
|
-
function isQueryKey(value) {
|
|
4615
|
-
return typeof value === 'string' || Array.isArray(value);
|
|
4616
|
-
}
|
|
4617
|
-
function sleep(timeout) {
|
|
4618
|
-
return new Promise(function (resolve) {
|
|
4619
|
-
setTimeout(resolve, timeout);
|
|
4620
|
-
});
|
|
4621
|
-
}
|
|
4622
|
-
/**
|
|
4623
|
-
* Schedules a microtask.
|
|
4624
|
-
* This can be useful to schedule state updates after rendering.
|
|
4625
|
-
*/
|
|
4626
|
-
|
|
4627
|
-
function scheduleMicrotask(callback) {
|
|
4628
|
-
Promise.resolve().then(callback).catch(function (error) {
|
|
4629
|
-
return setTimeout(function () {
|
|
4630
|
-
throw error;
|
|
4631
|
-
});
|
|
4632
|
-
});
|
|
4633
|
-
}
|
|
4634
|
-
function getAbortController() {
|
|
4635
|
-
if (typeof AbortController === 'function') {
|
|
4636
|
-
return new AbortController();
|
|
4637
|
-
}
|
|
4638
|
-
}
|
|
4639
|
-
|
|
4640
|
-
var FocusManager = /*#__PURE__*/function (_Subscribable) {
|
|
4641
|
-
_inheritsLoose(FocusManager, _Subscribable);
|
|
4642
|
-
|
|
4643
|
-
function FocusManager() {
|
|
4644
|
-
var _this;
|
|
4645
|
-
|
|
4646
|
-
_this = _Subscribable.call(this) || this;
|
|
4647
|
-
|
|
4648
|
-
_this.setup = function (onFocus) {
|
|
4649
|
-
var _window;
|
|
4650
|
-
|
|
4651
|
-
if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {
|
|
4652
|
-
var listener = function listener() {
|
|
4653
|
-
return onFocus();
|
|
4654
|
-
}; // Listen to visibillitychange and focus
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
window.addEventListener('visibilitychange', listener, false);
|
|
4658
|
-
window.addEventListener('focus', listener, false);
|
|
4659
|
-
return function () {
|
|
4660
|
-
// Be sure to unsubscribe if a new handler is set
|
|
4661
|
-
window.removeEventListener('visibilitychange', listener);
|
|
4662
|
-
window.removeEventListener('focus', listener);
|
|
4663
|
-
};
|
|
4664
|
-
}
|
|
4665
|
-
};
|
|
4666
|
-
|
|
4667
|
-
return _this;
|
|
4668
|
-
}
|
|
4669
|
-
|
|
4670
|
-
var _proto = FocusManager.prototype;
|
|
4671
|
-
|
|
4672
|
-
_proto.onSubscribe = function onSubscribe() {
|
|
4673
|
-
if (!this.cleanup) {
|
|
4674
|
-
this.setEventListener(this.setup);
|
|
4675
|
-
}
|
|
4676
|
-
};
|
|
4677
|
-
|
|
4678
|
-
_proto.onUnsubscribe = function onUnsubscribe() {
|
|
4679
|
-
if (!this.hasListeners()) {
|
|
4680
|
-
var _this$cleanup;
|
|
4681
|
-
|
|
4682
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
4683
|
-
this.cleanup = undefined;
|
|
4684
|
-
}
|
|
4685
|
-
};
|
|
4686
|
-
|
|
4687
|
-
_proto.setEventListener = function setEventListener(setup) {
|
|
4688
|
-
var _this$cleanup2,
|
|
4689
|
-
_this2 = this;
|
|
4690
|
-
|
|
4691
|
-
this.setup = setup;
|
|
4692
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
4693
|
-
this.cleanup = setup(function (focused) {
|
|
4694
|
-
if (typeof focused === 'boolean') {
|
|
4695
|
-
_this2.setFocused(focused);
|
|
4696
|
-
} else {
|
|
4697
|
-
_this2.onFocus();
|
|
4698
|
-
}
|
|
4699
|
-
});
|
|
4700
|
-
};
|
|
4701
|
-
|
|
4702
|
-
_proto.setFocused = function setFocused(focused) {
|
|
4703
|
-
this.focused = focused;
|
|
4704
|
-
|
|
4705
|
-
if (focused) {
|
|
4706
|
-
this.onFocus();
|
|
4707
|
-
}
|
|
4708
|
-
};
|
|
4709
|
-
|
|
4710
|
-
_proto.onFocus = function onFocus() {
|
|
4711
|
-
this.listeners.forEach(function (listener) {
|
|
4712
|
-
listener();
|
|
4713
|
-
});
|
|
4714
|
-
};
|
|
4715
|
-
|
|
4716
|
-
_proto.isFocused = function isFocused() {
|
|
4717
|
-
if (typeof this.focused === 'boolean') {
|
|
4718
|
-
return this.focused;
|
|
4719
|
-
} // document global can be unavailable in react native
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
if (typeof document === 'undefined') {
|
|
4723
|
-
return true;
|
|
4724
|
-
}
|
|
4725
|
-
|
|
4726
|
-
return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
|
|
4727
|
-
};
|
|
4728
|
-
|
|
4729
|
-
return FocusManager;
|
|
4730
|
-
}(Subscribable);
|
|
4731
|
-
var focusManager = new FocusManager();
|
|
4732
|
-
|
|
4733
|
-
var OnlineManager = /*#__PURE__*/function (_Subscribable) {
|
|
4734
|
-
_inheritsLoose(OnlineManager, _Subscribable);
|
|
4735
|
-
|
|
4736
|
-
function OnlineManager() {
|
|
4737
|
-
var _this;
|
|
4738
|
-
|
|
4739
|
-
_this = _Subscribable.call(this) || this;
|
|
4740
|
-
|
|
4741
|
-
_this.setup = function (onOnline) {
|
|
4742
|
-
var _window;
|
|
4743
|
-
|
|
4744
|
-
if (!isServer && ((_window = window) == null ? void 0 : _window.addEventListener)) {
|
|
4745
|
-
var listener = function listener() {
|
|
4746
|
-
return onOnline();
|
|
4747
|
-
}; // Listen to online
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
window.addEventListener('online', listener, false);
|
|
4751
|
-
window.addEventListener('offline', listener, false);
|
|
4752
|
-
return function () {
|
|
4753
|
-
// Be sure to unsubscribe if a new handler is set
|
|
4754
|
-
window.removeEventListener('online', listener);
|
|
4755
|
-
window.removeEventListener('offline', listener);
|
|
4756
|
-
};
|
|
4757
|
-
}
|
|
4758
|
-
};
|
|
4759
|
-
|
|
4760
|
-
return _this;
|
|
4761
|
-
}
|
|
4762
|
-
|
|
4763
|
-
var _proto = OnlineManager.prototype;
|
|
4764
|
-
|
|
4765
|
-
_proto.onSubscribe = function onSubscribe() {
|
|
4766
|
-
if (!this.cleanup) {
|
|
4767
|
-
this.setEventListener(this.setup);
|
|
4768
|
-
}
|
|
4769
|
-
};
|
|
4770
|
-
|
|
4771
|
-
_proto.onUnsubscribe = function onUnsubscribe() {
|
|
4772
|
-
if (!this.hasListeners()) {
|
|
4773
|
-
var _this$cleanup;
|
|
4774
|
-
|
|
4775
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
4776
|
-
this.cleanup = undefined;
|
|
4777
|
-
}
|
|
4778
|
-
};
|
|
4779
|
-
|
|
4780
|
-
_proto.setEventListener = function setEventListener(setup) {
|
|
4781
|
-
var _this$cleanup2,
|
|
4782
|
-
_this2 = this;
|
|
4783
|
-
|
|
4784
|
-
this.setup = setup;
|
|
4785
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
4786
|
-
this.cleanup = setup(function (online) {
|
|
4787
|
-
if (typeof online === 'boolean') {
|
|
4788
|
-
_this2.setOnline(online);
|
|
4789
|
-
} else {
|
|
4790
|
-
_this2.onOnline();
|
|
4791
|
-
}
|
|
4792
|
-
});
|
|
4793
|
-
};
|
|
4794
|
-
|
|
4795
|
-
_proto.setOnline = function setOnline(online) {
|
|
4796
|
-
this.online = online;
|
|
4797
|
-
|
|
4798
|
-
if (online) {
|
|
4799
|
-
this.onOnline();
|
|
4800
|
-
}
|
|
4801
|
-
};
|
|
4802
|
-
|
|
4803
|
-
_proto.onOnline = function onOnline() {
|
|
4804
|
-
this.listeners.forEach(function (listener) {
|
|
4805
|
-
listener();
|
|
4806
|
-
});
|
|
4807
|
-
};
|
|
4808
|
-
|
|
4809
|
-
_proto.isOnline = function isOnline() {
|
|
4810
|
-
if (typeof this.online === 'boolean') {
|
|
4811
|
-
return this.online;
|
|
4812
|
-
}
|
|
4813
|
-
|
|
4814
|
-
if (typeof navigator === 'undefined' || typeof navigator.onLine === 'undefined') {
|
|
4815
|
-
return true;
|
|
4816
|
-
}
|
|
4817
|
-
|
|
4818
|
-
return navigator.onLine;
|
|
4819
|
-
};
|
|
4820
|
-
|
|
4821
|
-
return OnlineManager;
|
|
4822
|
-
}(Subscribable);
|
|
4823
|
-
var onlineManager = new OnlineManager();
|
|
4824
|
-
|
|
4825
|
-
function defaultRetryDelay(failureCount) {
|
|
4826
|
-
return Math.min(1000 * Math.pow(2, failureCount), 30000);
|
|
4827
|
-
}
|
|
4828
|
-
|
|
4829
|
-
function isCancelable(value) {
|
|
4830
|
-
return typeof (value == null ? void 0 : value.cancel) === 'function';
|
|
4831
|
-
}
|
|
4832
|
-
var CancelledError = function CancelledError(options) {
|
|
4833
|
-
this.revert = options == null ? void 0 : options.revert;
|
|
4834
|
-
this.silent = options == null ? void 0 : options.silent;
|
|
4835
|
-
};
|
|
4836
|
-
function isCancelledError(value) {
|
|
4837
|
-
return value instanceof CancelledError;
|
|
4838
|
-
} // CLASS
|
|
4839
|
-
|
|
4840
|
-
var Retryer = function Retryer(config) {
|
|
4841
|
-
var _this = this;
|
|
4842
|
-
|
|
4843
|
-
var cancelRetry = false;
|
|
4844
|
-
var cancelFn;
|
|
4845
|
-
var continueFn;
|
|
4846
|
-
var promiseResolve;
|
|
4847
|
-
var promiseReject;
|
|
4848
|
-
this.abort = config.abort;
|
|
4849
|
-
|
|
4850
|
-
this.cancel = function (cancelOptions) {
|
|
4851
|
-
return cancelFn == null ? void 0 : cancelFn(cancelOptions);
|
|
4852
|
-
};
|
|
4853
|
-
|
|
4854
|
-
this.cancelRetry = function () {
|
|
4855
|
-
cancelRetry = true;
|
|
4856
|
-
};
|
|
4857
|
-
|
|
4858
|
-
this.continueRetry = function () {
|
|
4859
|
-
cancelRetry = false;
|
|
4860
|
-
};
|
|
4861
|
-
|
|
4862
|
-
this.continue = function () {
|
|
4863
|
-
return continueFn == null ? void 0 : continueFn();
|
|
4864
|
-
};
|
|
4865
|
-
|
|
4866
|
-
this.failureCount = 0;
|
|
4867
|
-
this.isPaused = false;
|
|
4868
|
-
this.isResolved = false;
|
|
4869
|
-
this.isTransportCancelable = false;
|
|
4870
|
-
this.promise = new Promise(function (outerResolve, outerReject) {
|
|
4871
|
-
promiseResolve = outerResolve;
|
|
4872
|
-
promiseReject = outerReject;
|
|
4873
|
-
});
|
|
4874
|
-
|
|
4875
|
-
var resolve = function resolve(value) {
|
|
4876
|
-
if (!_this.isResolved) {
|
|
4877
|
-
_this.isResolved = true;
|
|
4878
|
-
config.onSuccess == null ? void 0 : config.onSuccess(value);
|
|
4879
|
-
continueFn == null ? void 0 : continueFn();
|
|
4880
|
-
promiseResolve(value);
|
|
4881
|
-
}
|
|
4882
|
-
};
|
|
4883
|
-
|
|
4884
|
-
var reject = function reject(value) {
|
|
4885
|
-
if (!_this.isResolved) {
|
|
4886
|
-
_this.isResolved = true;
|
|
4887
|
-
config.onError == null ? void 0 : config.onError(value);
|
|
4888
|
-
continueFn == null ? void 0 : continueFn();
|
|
4889
|
-
promiseReject(value);
|
|
4890
|
-
}
|
|
4891
|
-
};
|
|
4892
|
-
|
|
4893
|
-
var pause = function pause() {
|
|
4894
|
-
return new Promise(function (continueResolve) {
|
|
4895
|
-
continueFn = continueResolve;
|
|
4896
|
-
_this.isPaused = true;
|
|
4897
|
-
config.onPause == null ? void 0 : config.onPause();
|
|
4898
|
-
}).then(function () {
|
|
4899
|
-
continueFn = undefined;
|
|
4900
|
-
_this.isPaused = false;
|
|
4901
|
-
config.onContinue == null ? void 0 : config.onContinue();
|
|
4902
|
-
});
|
|
4903
|
-
}; // Create loop function
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
var run = function run() {
|
|
4907
|
-
// Do nothing if already resolved
|
|
4908
|
-
if (_this.isResolved) {
|
|
4909
|
-
return;
|
|
4910
|
-
}
|
|
4911
|
-
|
|
4912
|
-
var promiseOrValue; // Execute query
|
|
4913
|
-
|
|
4914
|
-
try {
|
|
4915
|
-
promiseOrValue = config.fn();
|
|
4916
|
-
} catch (error) {
|
|
4917
|
-
promiseOrValue = Promise.reject(error);
|
|
4918
|
-
} // Create callback to cancel this fetch
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
cancelFn = function cancelFn(cancelOptions) {
|
|
4922
|
-
if (!_this.isResolved) {
|
|
4923
|
-
reject(new CancelledError(cancelOptions));
|
|
4924
|
-
_this.abort == null ? void 0 : _this.abort(); // Cancel transport if supported
|
|
4925
|
-
|
|
4926
|
-
if (isCancelable(promiseOrValue)) {
|
|
4927
|
-
try {
|
|
4928
|
-
promiseOrValue.cancel();
|
|
4929
|
-
} catch (_unused) {}
|
|
4930
|
-
}
|
|
4931
|
-
}
|
|
4932
|
-
}; // Check if the transport layer support cancellation
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
_this.isTransportCancelable = isCancelable(promiseOrValue);
|
|
4936
|
-
Promise.resolve(promiseOrValue).then(resolve).catch(function (error) {
|
|
4937
|
-
var _config$retry, _config$retryDelay;
|
|
4938
|
-
|
|
4939
|
-
// Stop if the fetch is already resolved
|
|
4940
|
-
if (_this.isResolved) {
|
|
4941
|
-
return;
|
|
4942
|
-
} // Do we need to retry the request?
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
var retry = (_config$retry = config.retry) != null ? _config$retry : 3;
|
|
4946
|
-
var retryDelay = (_config$retryDelay = config.retryDelay) != null ? _config$retryDelay : defaultRetryDelay;
|
|
4947
|
-
var delay = typeof retryDelay === 'function' ? retryDelay(_this.failureCount, error) : retryDelay;
|
|
4948
|
-
var shouldRetry = retry === true || typeof retry === 'number' && _this.failureCount < retry || typeof retry === 'function' && retry(_this.failureCount, error);
|
|
4949
|
-
|
|
4950
|
-
if (cancelRetry || !shouldRetry) {
|
|
4951
|
-
// We are done if the query does not need to be retried
|
|
4952
|
-
reject(error);
|
|
4953
|
-
return;
|
|
4954
|
-
}
|
|
4955
|
-
|
|
4956
|
-
_this.failureCount++; // Notify on fail
|
|
4957
|
-
|
|
4958
|
-
config.onFail == null ? void 0 : config.onFail(_this.failureCount, error); // Delay
|
|
4959
|
-
|
|
4960
|
-
sleep(delay) // Pause if the document is not visible or when the device is offline
|
|
4961
|
-
.then(function () {
|
|
4962
|
-
if (!focusManager.isFocused() || !onlineManager.isOnline()) {
|
|
4963
|
-
return pause();
|
|
4964
|
-
}
|
|
4965
|
-
}).then(function () {
|
|
4966
|
-
if (cancelRetry) {
|
|
4967
|
-
reject(error);
|
|
4968
|
-
} else {
|
|
4969
|
-
run();
|
|
4970
|
-
}
|
|
4971
|
-
});
|
|
4972
|
-
});
|
|
4973
|
-
}; // Start loop
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
run();
|
|
4977
|
-
};
|
|
4978
|
-
|
|
4979
|
-
// CLASS
|
|
4980
|
-
var NotifyManager = /*#__PURE__*/function () {
|
|
4981
|
-
function NotifyManager() {
|
|
4982
|
-
this.queue = [];
|
|
4983
|
-
this.transactions = 0;
|
|
4984
|
-
|
|
4985
|
-
this.notifyFn = function (callback) {
|
|
4986
|
-
callback();
|
|
4987
|
-
};
|
|
4988
|
-
|
|
4989
|
-
this.batchNotifyFn = function (callback) {
|
|
4990
|
-
callback();
|
|
4991
|
-
};
|
|
4992
|
-
}
|
|
4993
|
-
|
|
4994
|
-
var _proto = NotifyManager.prototype;
|
|
4995
|
-
|
|
4996
|
-
_proto.batch = function batch(callback) {
|
|
4997
|
-
var result;
|
|
4998
|
-
this.transactions++;
|
|
4999
|
-
|
|
5000
|
-
try {
|
|
5001
|
-
result = callback();
|
|
5002
|
-
} finally {
|
|
5003
|
-
this.transactions--;
|
|
5004
|
-
|
|
5005
|
-
if (!this.transactions) {
|
|
5006
|
-
this.flush();
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
|
|
5010
|
-
return result;
|
|
5011
|
-
};
|
|
5012
|
-
|
|
5013
|
-
_proto.schedule = function schedule(callback) {
|
|
5014
|
-
var _this = this;
|
|
5015
|
-
|
|
5016
|
-
if (this.transactions) {
|
|
5017
|
-
this.queue.push(callback);
|
|
5018
|
-
} else {
|
|
5019
|
-
scheduleMicrotask(function () {
|
|
5020
|
-
_this.notifyFn(callback);
|
|
5021
|
-
});
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
/**
|
|
5025
|
-
* All calls to the wrapped function will be batched.
|
|
5026
|
-
*/
|
|
5027
|
-
;
|
|
5028
|
-
|
|
5029
|
-
_proto.batchCalls = function batchCalls(callback) {
|
|
5030
|
-
var _this2 = this;
|
|
5031
|
-
|
|
5032
|
-
return function () {
|
|
5033
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5034
|
-
args[_key] = arguments[_key];
|
|
5035
|
-
}
|
|
5036
|
-
|
|
5037
|
-
_this2.schedule(function () {
|
|
5038
|
-
callback.apply(void 0, args);
|
|
5039
|
-
});
|
|
5040
|
-
};
|
|
5041
|
-
};
|
|
5042
|
-
|
|
5043
|
-
_proto.flush = function flush() {
|
|
5044
|
-
var _this3 = this;
|
|
5045
|
-
|
|
5046
|
-
var queue = this.queue;
|
|
5047
|
-
this.queue = [];
|
|
5048
|
-
|
|
5049
|
-
if (queue.length) {
|
|
5050
|
-
scheduleMicrotask(function () {
|
|
5051
|
-
_this3.batchNotifyFn(function () {
|
|
5052
|
-
queue.forEach(function (callback) {
|
|
5053
|
-
_this3.notifyFn(callback);
|
|
5054
|
-
});
|
|
5055
|
-
});
|
|
5056
|
-
});
|
|
5057
|
-
}
|
|
5058
|
-
}
|
|
5059
|
-
/**
|
|
5060
|
-
* Use this method to set a custom notify function.
|
|
5061
|
-
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
5062
|
-
*/
|
|
5063
|
-
;
|
|
5064
|
-
|
|
5065
|
-
_proto.setNotifyFunction = function setNotifyFunction(fn) {
|
|
5066
|
-
this.notifyFn = fn;
|
|
5067
|
-
}
|
|
5068
|
-
/**
|
|
5069
|
-
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
5070
|
-
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
5071
|
-
*/
|
|
5072
|
-
;
|
|
5073
|
-
|
|
5074
|
-
_proto.setBatchNotifyFunction = function setBatchNotifyFunction(fn) {
|
|
5075
|
-
this.batchNotifyFn = fn;
|
|
5076
|
-
};
|
|
5077
|
-
|
|
5078
|
-
return NotifyManager;
|
|
5079
|
-
}(); // SINGLETON
|
|
5080
|
-
|
|
5081
|
-
var notifyManager = new NotifyManager();
|
|
5082
|
-
|
|
5083
|
-
// TYPES
|
|
5084
|
-
// FUNCTIONS
|
|
5085
|
-
var logger$1 = console;
|
|
5086
|
-
function getLogger() {
|
|
5087
|
-
return logger$1;
|
|
5088
|
-
}
|
|
5089
|
-
function setLogger(newLogger) {
|
|
5090
|
-
logger$1 = newLogger;
|
|
5091
|
-
}
|
|
5092
|
-
|
|
5093
|
-
// CLASS
|
|
5094
|
-
var Query = /*#__PURE__*/function () {
|
|
5095
|
-
function Query(config) {
|
|
5096
|
-
this.abortSignalConsumed = false;
|
|
5097
|
-
this.hadObservers = false;
|
|
5098
|
-
this.defaultOptions = config.defaultOptions;
|
|
5099
|
-
this.setOptions(config.options);
|
|
5100
|
-
this.observers = [];
|
|
5101
|
-
this.cache = config.cache;
|
|
5102
|
-
this.queryKey = config.queryKey;
|
|
5103
|
-
this.queryHash = config.queryHash;
|
|
5104
|
-
this.initialState = config.state || this.getDefaultState(this.options);
|
|
5105
|
-
this.state = this.initialState;
|
|
5106
|
-
this.meta = config.meta;
|
|
5107
|
-
this.scheduleGc();
|
|
5108
|
-
}
|
|
5109
|
-
|
|
5110
|
-
var _proto = Query.prototype;
|
|
5111
|
-
|
|
5112
|
-
_proto.setOptions = function setOptions(options) {
|
|
5113
|
-
var _this$options$cacheTi;
|
|
5114
|
-
|
|
5115
|
-
this.options = _extends({}, this.defaultOptions, options);
|
|
5116
|
-
this.meta = options == null ? void 0 : options.meta; // Default to 5 minutes if not cache time is set
|
|
5117
|
-
|
|
5118
|
-
this.cacheTime = Math.max(this.cacheTime || 0, (_this$options$cacheTi = this.options.cacheTime) != null ? _this$options$cacheTi : 5 * 60 * 1000);
|
|
5119
|
-
};
|
|
5120
|
-
|
|
5121
|
-
_proto.setDefaultOptions = function setDefaultOptions(options) {
|
|
5122
|
-
this.defaultOptions = options;
|
|
5123
|
-
};
|
|
5124
|
-
|
|
5125
|
-
_proto.scheduleGc = function scheduleGc() {
|
|
5126
|
-
var _this = this;
|
|
5127
|
-
|
|
5128
|
-
this.clearGcTimeout();
|
|
5129
|
-
|
|
5130
|
-
if (isValidTimeout(this.cacheTime)) {
|
|
5131
|
-
this.gcTimeout = setTimeout(function () {
|
|
5132
|
-
_this.optionalRemove();
|
|
5133
|
-
}, this.cacheTime);
|
|
5134
|
-
}
|
|
5135
|
-
};
|
|
5136
|
-
|
|
5137
|
-
_proto.clearGcTimeout = function clearGcTimeout() {
|
|
5138
|
-
if (this.gcTimeout) {
|
|
5139
|
-
clearTimeout(this.gcTimeout);
|
|
5140
|
-
this.gcTimeout = undefined;
|
|
5141
|
-
}
|
|
5142
|
-
};
|
|
5143
|
-
|
|
5144
|
-
_proto.optionalRemove = function optionalRemove() {
|
|
5145
|
-
if (!this.observers.length) {
|
|
5146
|
-
if (this.state.isFetching) {
|
|
5147
|
-
if (this.hadObservers) {
|
|
5148
|
-
this.scheduleGc();
|
|
5149
|
-
}
|
|
5150
|
-
} else {
|
|
5151
|
-
this.cache.remove(this);
|
|
5152
|
-
}
|
|
5153
|
-
}
|
|
5154
|
-
};
|
|
5155
|
-
|
|
5156
|
-
_proto.setData = function setData(updater, options) {
|
|
5157
|
-
var _this$options$isDataE, _this$options;
|
|
5158
|
-
|
|
5159
|
-
var prevData = this.state.data; // Get the new data
|
|
5160
|
-
|
|
5161
|
-
var data = functionalUpdate(updater, prevData); // Use prev data if an isDataEqual function is defined and returns `true`
|
|
5162
|
-
|
|
5163
|
-
if ((_this$options$isDataE = (_this$options = this.options).isDataEqual) == null ? void 0 : _this$options$isDataE.call(_this$options, prevData, data)) {
|
|
5164
|
-
data = prevData;
|
|
5165
|
-
} else if (this.options.structuralSharing !== false) {
|
|
5166
|
-
// Structurally share data between prev and new data if needed
|
|
5167
|
-
data = replaceEqualDeep(prevData, data);
|
|
5168
|
-
} // Set data and mark it as cached
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
this.dispatch({
|
|
5172
|
-
data: data,
|
|
5173
|
-
type: 'success',
|
|
5174
|
-
dataUpdatedAt: options == null ? void 0 : options.updatedAt
|
|
5175
|
-
});
|
|
5176
|
-
return data;
|
|
5177
|
-
};
|
|
5178
|
-
|
|
5179
|
-
_proto.setState = function setState(state, setStateOptions) {
|
|
5180
|
-
this.dispatch({
|
|
5181
|
-
type: 'setState',
|
|
5182
|
-
state: state,
|
|
5183
|
-
setStateOptions: setStateOptions
|
|
5184
|
-
});
|
|
5185
|
-
};
|
|
5186
|
-
|
|
5187
|
-
_proto.cancel = function cancel(options) {
|
|
5188
|
-
var _this$retryer;
|
|
5189
|
-
|
|
5190
|
-
var promise = this.promise;
|
|
5191
|
-
(_this$retryer = this.retryer) == null ? void 0 : _this$retryer.cancel(options);
|
|
5192
|
-
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
5193
|
-
};
|
|
5194
|
-
|
|
5195
|
-
_proto.destroy = function destroy() {
|
|
5196
|
-
this.clearGcTimeout();
|
|
5197
|
-
this.cancel({
|
|
5198
|
-
silent: true
|
|
5199
|
-
});
|
|
5200
|
-
};
|
|
5201
|
-
|
|
5202
|
-
_proto.reset = function reset() {
|
|
5203
|
-
this.destroy();
|
|
5204
|
-
this.setState(this.initialState);
|
|
5205
|
-
};
|
|
5206
|
-
|
|
5207
|
-
_proto.isActive = function isActive() {
|
|
5208
|
-
return this.observers.some(function (observer) {
|
|
5209
|
-
return observer.options.enabled !== false;
|
|
5210
|
-
});
|
|
5211
|
-
};
|
|
5212
|
-
|
|
5213
|
-
_proto.isFetching = function isFetching() {
|
|
5214
|
-
return this.state.isFetching;
|
|
5215
|
-
};
|
|
5216
|
-
|
|
5217
|
-
_proto.isStale = function isStale() {
|
|
5218
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || this.observers.some(function (observer) {
|
|
5219
|
-
return observer.getCurrentResult().isStale;
|
|
5220
|
-
});
|
|
5221
|
-
};
|
|
5222
|
-
|
|
5223
|
-
_proto.isStaleByTime = function isStaleByTime(staleTime) {
|
|
5224
|
-
if (staleTime === void 0) {
|
|
5225
|
-
staleTime = 0;
|
|
5226
|
-
}
|
|
5227
|
-
|
|
5228
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
5229
|
-
};
|
|
5230
|
-
|
|
5231
|
-
_proto.onFocus = function onFocus() {
|
|
5232
|
-
var _this$retryer2;
|
|
5233
|
-
|
|
5234
|
-
var observer = this.observers.find(function (x) {
|
|
5235
|
-
return x.shouldFetchOnWindowFocus();
|
|
5236
|
-
});
|
|
5237
|
-
|
|
5238
|
-
if (observer) {
|
|
5239
|
-
observer.refetch();
|
|
5240
|
-
} // Continue fetch if currently paused
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
(_this$retryer2 = this.retryer) == null ? void 0 : _this$retryer2.continue();
|
|
5244
|
-
};
|
|
5245
|
-
|
|
5246
|
-
_proto.onOnline = function onOnline() {
|
|
5247
|
-
var _this$retryer3;
|
|
5248
|
-
|
|
5249
|
-
var observer = this.observers.find(function (x) {
|
|
5250
|
-
return x.shouldFetchOnReconnect();
|
|
5251
|
-
});
|
|
5252
|
-
|
|
5253
|
-
if (observer) {
|
|
5254
|
-
observer.refetch();
|
|
5255
|
-
} // Continue fetch if currently paused
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
(_this$retryer3 = this.retryer) == null ? void 0 : _this$retryer3.continue();
|
|
5259
|
-
};
|
|
5260
|
-
|
|
5261
|
-
_proto.addObserver = function addObserver(observer) {
|
|
5262
|
-
if (this.observers.indexOf(observer) === -1) {
|
|
5263
|
-
this.observers.push(observer);
|
|
5264
|
-
this.hadObservers = true; // Stop the query from being garbage collected
|
|
5265
|
-
|
|
5266
|
-
this.clearGcTimeout();
|
|
5267
|
-
this.cache.notify({
|
|
5268
|
-
type: 'observerAdded',
|
|
5269
|
-
query: this,
|
|
5270
|
-
observer: observer
|
|
5271
|
-
});
|
|
5272
|
-
}
|
|
5273
|
-
};
|
|
5274
|
-
|
|
5275
|
-
_proto.removeObserver = function removeObserver(observer) {
|
|
5276
|
-
if (this.observers.indexOf(observer) !== -1) {
|
|
5277
|
-
this.observers = this.observers.filter(function (x) {
|
|
5278
|
-
return x !== observer;
|
|
5279
|
-
});
|
|
5280
|
-
|
|
5281
|
-
if (!this.observers.length) {
|
|
5282
|
-
// If the transport layer does not support cancellation
|
|
5283
|
-
// we'll let the query continue so the result can be cached
|
|
5284
|
-
if (this.retryer) {
|
|
5285
|
-
if (this.retryer.isTransportCancelable || this.abortSignalConsumed) {
|
|
5286
|
-
this.retryer.cancel({
|
|
5287
|
-
revert: true
|
|
5288
|
-
});
|
|
5289
|
-
} else {
|
|
5290
|
-
this.retryer.cancelRetry();
|
|
5291
|
-
}
|
|
5292
|
-
}
|
|
5293
|
-
|
|
5294
|
-
if (this.cacheTime) {
|
|
5295
|
-
this.scheduleGc();
|
|
5296
|
-
} else {
|
|
5297
|
-
this.cache.remove(this);
|
|
5298
|
-
}
|
|
5299
|
-
}
|
|
5300
|
-
|
|
5301
|
-
this.cache.notify({
|
|
5302
|
-
type: 'observerRemoved',
|
|
5303
|
-
query: this,
|
|
5304
|
-
observer: observer
|
|
5305
|
-
});
|
|
5306
|
-
}
|
|
5307
|
-
};
|
|
5308
|
-
|
|
5309
|
-
_proto.getObserversCount = function getObserversCount() {
|
|
5310
|
-
return this.observers.length;
|
|
5311
|
-
};
|
|
5312
|
-
|
|
5313
|
-
_proto.invalidate = function invalidate() {
|
|
5314
|
-
if (!this.state.isInvalidated) {
|
|
5315
|
-
this.dispatch({
|
|
5316
|
-
type: 'invalidate'
|
|
5317
|
-
});
|
|
5318
|
-
}
|
|
5319
|
-
};
|
|
5320
|
-
|
|
5321
|
-
_proto.fetch = function fetch(options, fetchOptions) {
|
|
5322
|
-
var _this2 = this,
|
|
5323
|
-
_this$options$behavio,
|
|
5324
|
-
_context$fetchOptions,
|
|
5325
|
-
_abortController$abor;
|
|
5326
|
-
|
|
5327
|
-
if (this.state.isFetching) {
|
|
5328
|
-
if (this.state.dataUpdatedAt && (fetchOptions == null ? void 0 : fetchOptions.cancelRefetch)) {
|
|
5329
|
-
// Silently cancel current fetch if the user wants to cancel refetches
|
|
5330
|
-
this.cancel({
|
|
5331
|
-
silent: true
|
|
5332
|
-
});
|
|
5333
|
-
} else if (this.promise) {
|
|
5334
|
-
var _this$retryer4;
|
|
5335
|
-
|
|
5336
|
-
// make sure that retries that were potentially cancelled due to unmounts can continue
|
|
5337
|
-
(_this$retryer4 = this.retryer) == null ? void 0 : _this$retryer4.continueRetry(); // Return current promise if we are already fetching
|
|
5338
|
-
|
|
5339
|
-
return this.promise;
|
|
5340
|
-
}
|
|
5341
|
-
} // Update config if passed, otherwise the config from the last execution is used
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
if (options) {
|
|
5345
|
-
this.setOptions(options);
|
|
5346
|
-
} // Use the options from the first observer with a query function if no function is found.
|
|
5347
|
-
// This can happen when the query is hydrated or created with setQueryData.
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
if (!this.options.queryFn) {
|
|
5351
|
-
var observer = this.observers.find(function (x) {
|
|
5352
|
-
return x.options.queryFn;
|
|
5353
|
-
});
|
|
5354
|
-
|
|
5355
|
-
if (observer) {
|
|
5356
|
-
this.setOptions(observer.options);
|
|
5357
|
-
}
|
|
5358
|
-
}
|
|
5359
|
-
|
|
5360
|
-
var queryKey = ensureQueryKeyArray(this.queryKey);
|
|
5361
|
-
var abortController = getAbortController(); // Create query function context
|
|
5362
|
-
|
|
5363
|
-
var queryFnContext = {
|
|
5364
|
-
queryKey: queryKey,
|
|
5365
|
-
pageParam: undefined,
|
|
5366
|
-
meta: this.meta
|
|
5367
|
-
};
|
|
5368
|
-
Object.defineProperty(queryFnContext, 'signal', {
|
|
5369
|
-
enumerable: true,
|
|
5370
|
-
get: function get() {
|
|
5371
|
-
if (abortController) {
|
|
5372
|
-
_this2.abortSignalConsumed = true;
|
|
5373
|
-
return abortController.signal;
|
|
5374
|
-
}
|
|
5375
|
-
|
|
5376
|
-
return undefined;
|
|
5377
|
-
}
|
|
5378
|
-
}); // Create fetch function
|
|
5379
|
-
|
|
5380
|
-
var fetchFn = function fetchFn() {
|
|
5381
|
-
if (!_this2.options.queryFn) {
|
|
5382
|
-
return Promise.reject('Missing queryFn');
|
|
5383
|
-
}
|
|
5384
|
-
|
|
5385
|
-
_this2.abortSignalConsumed = false;
|
|
5386
|
-
return _this2.options.queryFn(queryFnContext);
|
|
5387
|
-
}; // Trigger behavior hook
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
var context = {
|
|
5391
|
-
fetchOptions: fetchOptions,
|
|
5392
|
-
options: this.options,
|
|
5393
|
-
queryKey: queryKey,
|
|
5394
|
-
state: this.state,
|
|
5395
|
-
fetchFn: fetchFn,
|
|
5396
|
-
meta: this.meta
|
|
5397
|
-
};
|
|
5398
|
-
|
|
5399
|
-
if ((_this$options$behavio = this.options.behavior) == null ? void 0 : _this$options$behavio.onFetch) {
|
|
5400
|
-
var _this$options$behavio2;
|
|
5401
|
-
|
|
5402
|
-
(_this$options$behavio2 = this.options.behavior) == null ? void 0 : _this$options$behavio2.onFetch(context);
|
|
5403
|
-
} // Store state in case the current fetch needs to be reverted
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
this.revertState = this.state; // Set to fetching state if not already in it
|
|
5407
|
-
|
|
5408
|
-
if (!this.state.isFetching || this.state.fetchMeta !== ((_context$fetchOptions = context.fetchOptions) == null ? void 0 : _context$fetchOptions.meta)) {
|
|
5409
|
-
var _context$fetchOptions2;
|
|
5410
|
-
|
|
5411
|
-
this.dispatch({
|
|
5412
|
-
type: 'fetch',
|
|
5413
|
-
meta: (_context$fetchOptions2 = context.fetchOptions) == null ? void 0 : _context$fetchOptions2.meta
|
|
5414
|
-
});
|
|
5415
|
-
} // Try to fetch the data
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
this.retryer = new Retryer({
|
|
5419
|
-
fn: context.fetchFn,
|
|
5420
|
-
abort: abortController == null ? void 0 : (_abortController$abor = abortController.abort) == null ? void 0 : _abortController$abor.bind(abortController),
|
|
5421
|
-
onSuccess: function onSuccess(data) {
|
|
5422
|
-
_this2.setData(data); // Notify cache callback
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
_this2.cache.config.onSuccess == null ? void 0 : _this2.cache.config.onSuccess(data, _this2); // Remove query after fetching if cache time is 0
|
|
5426
|
-
|
|
5427
|
-
if (_this2.cacheTime === 0) {
|
|
5428
|
-
_this2.optionalRemove();
|
|
5429
|
-
}
|
|
5430
|
-
},
|
|
5431
|
-
onError: function onError(error) {
|
|
5432
|
-
// Optimistically update state if needed
|
|
5433
|
-
if (!(isCancelledError(error) && error.silent)) {
|
|
5434
|
-
_this2.dispatch({
|
|
5435
|
-
type: 'error',
|
|
5436
|
-
error: error
|
|
5437
|
-
});
|
|
5438
|
-
}
|
|
5439
|
-
|
|
5440
|
-
if (!isCancelledError(error)) {
|
|
5441
|
-
// Notify cache callback
|
|
5442
|
-
_this2.cache.config.onError == null ? void 0 : _this2.cache.config.onError(error, _this2); // Log error
|
|
5443
|
-
|
|
5444
|
-
getLogger().error(error);
|
|
5445
|
-
} // Remove query after fetching if cache time is 0
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
if (_this2.cacheTime === 0) {
|
|
5449
|
-
_this2.optionalRemove();
|
|
5450
|
-
}
|
|
5451
|
-
},
|
|
5452
|
-
onFail: function onFail() {
|
|
5453
|
-
_this2.dispatch({
|
|
5454
|
-
type: 'failed'
|
|
5455
|
-
});
|
|
5456
|
-
},
|
|
5457
|
-
onPause: function onPause() {
|
|
5458
|
-
_this2.dispatch({
|
|
5459
|
-
type: 'pause'
|
|
5460
|
-
});
|
|
5461
|
-
},
|
|
5462
|
-
onContinue: function onContinue() {
|
|
5463
|
-
_this2.dispatch({
|
|
5464
|
-
type: 'continue'
|
|
5465
|
-
});
|
|
5466
|
-
},
|
|
5467
|
-
retry: context.options.retry,
|
|
5468
|
-
retryDelay: context.options.retryDelay
|
|
5469
|
-
});
|
|
5470
|
-
this.promise = this.retryer.promise;
|
|
5471
|
-
return this.promise;
|
|
5472
|
-
};
|
|
5473
|
-
|
|
5474
|
-
_proto.dispatch = function dispatch(action) {
|
|
5475
|
-
var _this3 = this;
|
|
5476
|
-
|
|
5477
|
-
this.state = this.reducer(this.state, action);
|
|
5478
|
-
notifyManager.batch(function () {
|
|
5479
|
-
_this3.observers.forEach(function (observer) {
|
|
5480
|
-
observer.onQueryUpdate(action);
|
|
5481
|
-
});
|
|
5482
|
-
|
|
5483
|
-
_this3.cache.notify({
|
|
5484
|
-
query: _this3,
|
|
5485
|
-
type: 'queryUpdated',
|
|
5486
|
-
action: action
|
|
5487
|
-
});
|
|
5488
|
-
});
|
|
5489
|
-
};
|
|
5490
|
-
|
|
5491
|
-
_proto.getDefaultState = function getDefaultState(options) {
|
|
5492
|
-
var data = typeof options.initialData === 'function' ? options.initialData() : options.initialData;
|
|
5493
|
-
var hasInitialData = typeof options.initialData !== 'undefined';
|
|
5494
|
-
var initialDataUpdatedAt = hasInitialData ? typeof options.initialDataUpdatedAt === 'function' ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
5495
|
-
var hasData = typeof data !== 'undefined';
|
|
5496
|
-
return {
|
|
5497
|
-
data: data,
|
|
5498
|
-
dataUpdateCount: 0,
|
|
5499
|
-
dataUpdatedAt: hasData ? initialDataUpdatedAt != null ? initialDataUpdatedAt : Date.now() : 0,
|
|
5500
|
-
error: null,
|
|
5501
|
-
errorUpdateCount: 0,
|
|
5502
|
-
errorUpdatedAt: 0,
|
|
5503
|
-
fetchFailureCount: 0,
|
|
5504
|
-
fetchMeta: null,
|
|
5505
|
-
isFetching: false,
|
|
5506
|
-
isInvalidated: false,
|
|
5507
|
-
isPaused: false,
|
|
5508
|
-
status: hasData ? 'success' : 'idle'
|
|
5509
|
-
};
|
|
5510
|
-
};
|
|
5511
|
-
|
|
5512
|
-
_proto.reducer = function reducer(state, action) {
|
|
5513
|
-
var _action$meta, _action$dataUpdatedAt;
|
|
5514
|
-
|
|
5515
|
-
switch (action.type) {
|
|
5516
|
-
case 'failed':
|
|
5517
|
-
return _extends({}, state, {
|
|
5518
|
-
fetchFailureCount: state.fetchFailureCount + 1
|
|
5519
|
-
});
|
|
5520
|
-
|
|
5521
|
-
case 'pause':
|
|
5522
|
-
return _extends({}, state, {
|
|
5523
|
-
isPaused: true
|
|
5524
|
-
});
|
|
5525
|
-
|
|
5526
|
-
case 'continue':
|
|
5527
|
-
return _extends({}, state, {
|
|
5528
|
-
isPaused: false
|
|
5529
|
-
});
|
|
5530
|
-
|
|
5531
|
-
case 'fetch':
|
|
5532
|
-
return _extends({}, state, {
|
|
5533
|
-
fetchFailureCount: 0,
|
|
5534
|
-
fetchMeta: (_action$meta = action.meta) != null ? _action$meta : null,
|
|
5535
|
-
isFetching: true,
|
|
5536
|
-
isPaused: false
|
|
5537
|
-
}, !state.dataUpdatedAt && {
|
|
5538
|
-
error: null,
|
|
5539
|
-
status: 'loading'
|
|
5540
|
-
});
|
|
5541
|
-
|
|
5542
|
-
case 'success':
|
|
5543
|
-
return _extends({}, state, {
|
|
5544
|
-
data: action.data,
|
|
5545
|
-
dataUpdateCount: state.dataUpdateCount + 1,
|
|
5546
|
-
dataUpdatedAt: (_action$dataUpdatedAt = action.dataUpdatedAt) != null ? _action$dataUpdatedAt : Date.now(),
|
|
5547
|
-
error: null,
|
|
5548
|
-
fetchFailureCount: 0,
|
|
5549
|
-
isFetching: false,
|
|
5550
|
-
isInvalidated: false,
|
|
5551
|
-
isPaused: false,
|
|
5552
|
-
status: 'success'
|
|
5553
|
-
});
|
|
5554
|
-
|
|
5555
|
-
case 'error':
|
|
5556
|
-
var error = action.error;
|
|
5557
|
-
|
|
5558
|
-
if (isCancelledError(error) && error.revert && this.revertState) {
|
|
5559
|
-
return _extends({}, this.revertState);
|
|
5560
|
-
}
|
|
5561
|
-
|
|
5562
|
-
return _extends({}, state, {
|
|
5563
|
-
error: error,
|
|
5564
|
-
errorUpdateCount: state.errorUpdateCount + 1,
|
|
5565
|
-
errorUpdatedAt: Date.now(),
|
|
5566
|
-
fetchFailureCount: state.fetchFailureCount + 1,
|
|
5567
|
-
isFetching: false,
|
|
5568
|
-
isPaused: false,
|
|
5569
|
-
status: 'error'
|
|
5570
|
-
});
|
|
5571
|
-
|
|
5572
|
-
case 'invalidate':
|
|
5573
|
-
return _extends({}, state, {
|
|
5574
|
-
isInvalidated: true
|
|
5575
|
-
});
|
|
5576
|
-
|
|
5577
|
-
case 'setState':
|
|
5578
|
-
return _extends({}, state, action.state);
|
|
5579
|
-
|
|
5580
|
-
default:
|
|
5581
|
-
return state;
|
|
5582
|
-
}
|
|
5583
|
-
};
|
|
5584
|
-
|
|
5585
|
-
return Query;
|
|
5586
|
-
}();
|
|
5587
|
-
|
|
5588
|
-
// CLASS
|
|
5589
|
-
var QueryCache = /*#__PURE__*/function (_Subscribable) {
|
|
5590
|
-
_inheritsLoose(QueryCache, _Subscribable);
|
|
5591
|
-
|
|
5592
|
-
function QueryCache(config) {
|
|
5593
|
-
var _this;
|
|
5594
|
-
|
|
5595
|
-
_this = _Subscribable.call(this) || this;
|
|
5596
|
-
_this.config = config || {};
|
|
5597
|
-
_this.queries = [];
|
|
5598
|
-
_this.queriesMap = {};
|
|
5599
|
-
return _this;
|
|
5600
|
-
}
|
|
5601
|
-
|
|
5602
|
-
var _proto = QueryCache.prototype;
|
|
5603
|
-
|
|
5604
|
-
_proto.build = function build(client, options, state) {
|
|
5605
|
-
var _options$queryHash;
|
|
5606
|
-
|
|
5607
|
-
var queryKey = options.queryKey;
|
|
5608
|
-
var queryHash = (_options$queryHash = options.queryHash) != null ? _options$queryHash : hashQueryKeyByOptions(queryKey, options);
|
|
5609
|
-
var query = this.get(queryHash);
|
|
5610
|
-
|
|
5611
|
-
if (!query) {
|
|
5612
|
-
query = new Query({
|
|
5613
|
-
cache: this,
|
|
5614
|
-
queryKey: queryKey,
|
|
5615
|
-
queryHash: queryHash,
|
|
5616
|
-
options: client.defaultQueryOptions(options),
|
|
5617
|
-
state: state,
|
|
5618
|
-
defaultOptions: client.getQueryDefaults(queryKey),
|
|
5619
|
-
meta: options.meta
|
|
5620
|
-
});
|
|
5621
|
-
this.add(query);
|
|
5622
|
-
}
|
|
5623
|
-
|
|
5624
|
-
return query;
|
|
5625
|
-
};
|
|
5626
|
-
|
|
5627
|
-
_proto.add = function add(query) {
|
|
5628
|
-
if (!this.queriesMap[query.queryHash]) {
|
|
5629
|
-
this.queriesMap[query.queryHash] = query;
|
|
5630
|
-
this.queries.push(query);
|
|
5631
|
-
this.notify({
|
|
5632
|
-
type: 'queryAdded',
|
|
5633
|
-
query: query
|
|
5634
|
-
});
|
|
5635
|
-
}
|
|
5636
|
-
};
|
|
5637
|
-
|
|
5638
|
-
_proto.remove = function remove(query) {
|
|
5639
|
-
var queryInMap = this.queriesMap[query.queryHash];
|
|
5640
|
-
|
|
5641
|
-
if (queryInMap) {
|
|
5642
|
-
query.destroy();
|
|
5643
|
-
this.queries = this.queries.filter(function (x) {
|
|
5644
|
-
return x !== query;
|
|
5645
|
-
});
|
|
5646
|
-
|
|
5647
|
-
if (queryInMap === query) {
|
|
5648
|
-
delete this.queriesMap[query.queryHash];
|
|
5649
|
-
}
|
|
5650
|
-
|
|
5651
|
-
this.notify({
|
|
5652
|
-
type: 'queryRemoved',
|
|
5653
|
-
query: query
|
|
5654
|
-
});
|
|
5655
|
-
}
|
|
5656
|
-
};
|
|
5657
|
-
|
|
5658
|
-
_proto.clear = function clear() {
|
|
5659
|
-
var _this2 = this;
|
|
5660
|
-
|
|
5661
|
-
notifyManager.batch(function () {
|
|
5662
|
-
_this2.queries.forEach(function (query) {
|
|
5663
|
-
_this2.remove(query);
|
|
5664
|
-
});
|
|
5665
|
-
});
|
|
5666
|
-
};
|
|
5667
|
-
|
|
5668
|
-
_proto.get = function get(queryHash) {
|
|
5669
|
-
return this.queriesMap[queryHash];
|
|
5670
|
-
};
|
|
5671
|
-
|
|
5672
|
-
_proto.getAll = function getAll() {
|
|
5673
|
-
return this.queries;
|
|
5674
|
-
};
|
|
5675
|
-
|
|
5676
|
-
_proto.find = function find(arg1, arg2) {
|
|
5677
|
-
var _parseFilterArgs = parseFilterArgs(arg1, arg2),
|
|
5678
|
-
filters = _parseFilterArgs[0];
|
|
5679
|
-
|
|
5680
|
-
if (typeof filters.exact === 'undefined') {
|
|
5681
|
-
filters.exact = true;
|
|
5682
|
-
}
|
|
5683
|
-
|
|
5684
|
-
return this.queries.find(function (query) {
|
|
5685
|
-
return matchQuery(filters, query);
|
|
5686
|
-
});
|
|
5687
|
-
};
|
|
5688
|
-
|
|
5689
|
-
_proto.findAll = function findAll(arg1, arg2) {
|
|
5690
|
-
var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),
|
|
5691
|
-
filters = _parseFilterArgs2[0];
|
|
5692
|
-
|
|
5693
|
-
return Object.keys(filters).length > 0 ? this.queries.filter(function (query) {
|
|
5694
|
-
return matchQuery(filters, query);
|
|
5695
|
-
}) : this.queries;
|
|
5696
|
-
};
|
|
5697
|
-
|
|
5698
|
-
_proto.notify = function notify(event) {
|
|
5699
|
-
var _this3 = this;
|
|
5700
|
-
|
|
5701
|
-
notifyManager.batch(function () {
|
|
5702
|
-
_this3.listeners.forEach(function (listener) {
|
|
5703
|
-
listener(event);
|
|
5704
|
-
});
|
|
5705
|
-
});
|
|
5706
|
-
};
|
|
5707
|
-
|
|
5708
|
-
_proto.onFocus = function onFocus() {
|
|
5709
|
-
var _this4 = this;
|
|
5710
|
-
|
|
5711
|
-
notifyManager.batch(function () {
|
|
5712
|
-
_this4.queries.forEach(function (query) {
|
|
5713
|
-
query.onFocus();
|
|
5714
|
-
});
|
|
5715
|
-
});
|
|
5716
|
-
};
|
|
5717
|
-
|
|
5718
|
-
_proto.onOnline = function onOnline() {
|
|
5719
|
-
var _this5 = this;
|
|
5720
|
-
|
|
5721
|
-
notifyManager.batch(function () {
|
|
5722
|
-
_this5.queries.forEach(function (query) {
|
|
5723
|
-
query.onOnline();
|
|
5724
|
-
});
|
|
5725
|
-
});
|
|
5726
|
-
};
|
|
5727
|
-
|
|
5728
|
-
return QueryCache;
|
|
5729
|
-
}(Subscribable);
|
|
5730
|
-
|
|
5731
|
-
// CLASS
|
|
5732
|
-
var Mutation = /*#__PURE__*/function () {
|
|
5733
|
-
function Mutation(config) {
|
|
5734
|
-
this.options = _extends({}, config.defaultOptions, config.options);
|
|
5735
|
-
this.mutationId = config.mutationId;
|
|
5736
|
-
this.mutationCache = config.mutationCache;
|
|
5737
|
-
this.observers = [];
|
|
5738
|
-
this.state = config.state || getDefaultState();
|
|
5739
|
-
this.meta = config.meta;
|
|
5740
|
-
}
|
|
5741
|
-
|
|
5742
|
-
var _proto = Mutation.prototype;
|
|
5743
|
-
|
|
5744
|
-
_proto.setState = function setState(state) {
|
|
5745
|
-
this.dispatch({
|
|
5746
|
-
type: 'setState',
|
|
5747
|
-
state: state
|
|
5748
|
-
});
|
|
5749
|
-
};
|
|
5750
|
-
|
|
5751
|
-
_proto.addObserver = function addObserver(observer) {
|
|
5752
|
-
if (this.observers.indexOf(observer) === -1) {
|
|
5753
|
-
this.observers.push(observer);
|
|
5754
|
-
}
|
|
5755
|
-
};
|
|
5756
|
-
|
|
5757
|
-
_proto.removeObserver = function removeObserver(observer) {
|
|
5758
|
-
this.observers = this.observers.filter(function (x) {
|
|
5759
|
-
return x !== observer;
|
|
5760
|
-
});
|
|
5761
|
-
};
|
|
5762
|
-
|
|
5763
|
-
_proto.cancel = function cancel() {
|
|
5764
|
-
if (this.retryer) {
|
|
5765
|
-
this.retryer.cancel();
|
|
5766
|
-
return this.retryer.promise.then(noop).catch(noop);
|
|
5767
|
-
}
|
|
5768
|
-
|
|
5769
|
-
return Promise.resolve();
|
|
5770
|
-
};
|
|
5771
|
-
|
|
5772
|
-
_proto.continue = function _continue() {
|
|
5773
|
-
if (this.retryer) {
|
|
5774
|
-
this.retryer.continue();
|
|
5775
|
-
return this.retryer.promise;
|
|
5776
|
-
}
|
|
5777
|
-
|
|
5778
|
-
return this.execute();
|
|
5779
|
-
};
|
|
5780
|
-
|
|
5781
|
-
_proto.execute = function execute() {
|
|
5782
|
-
var _this = this;
|
|
5783
|
-
|
|
5784
|
-
var data;
|
|
5785
|
-
var restored = this.state.status === 'loading';
|
|
5786
|
-
var promise = Promise.resolve();
|
|
5787
|
-
|
|
5788
|
-
if (!restored) {
|
|
5789
|
-
this.dispatch({
|
|
5790
|
-
type: 'loading',
|
|
5791
|
-
variables: this.options.variables
|
|
5792
|
-
});
|
|
5793
|
-
promise = promise.then(function () {
|
|
5794
|
-
// Notify cache callback
|
|
5795
|
-
_this.mutationCache.config.onMutate == null ? void 0 : _this.mutationCache.config.onMutate(_this.state.variables, _this);
|
|
5796
|
-
}).then(function () {
|
|
5797
|
-
return _this.options.onMutate == null ? void 0 : _this.options.onMutate(_this.state.variables);
|
|
5798
|
-
}).then(function (context) {
|
|
5799
|
-
if (context !== _this.state.context) {
|
|
5800
|
-
_this.dispatch({
|
|
5801
|
-
type: 'loading',
|
|
5802
|
-
context: context,
|
|
5803
|
-
variables: _this.state.variables
|
|
5804
|
-
});
|
|
5805
|
-
}
|
|
5806
|
-
});
|
|
5807
|
-
}
|
|
5808
|
-
|
|
5809
|
-
return promise.then(function () {
|
|
5810
|
-
return _this.executeMutation();
|
|
5811
|
-
}).then(function (result) {
|
|
5812
|
-
data = result; // Notify cache callback
|
|
5813
|
-
|
|
5814
|
-
_this.mutationCache.config.onSuccess == null ? void 0 : _this.mutationCache.config.onSuccess(data, _this.state.variables, _this.state.context, _this);
|
|
5815
|
-
}).then(function () {
|
|
5816
|
-
return _this.options.onSuccess == null ? void 0 : _this.options.onSuccess(data, _this.state.variables, _this.state.context);
|
|
5817
|
-
}).then(function () {
|
|
5818
|
-
return _this.options.onSettled == null ? void 0 : _this.options.onSettled(data, null, _this.state.variables, _this.state.context);
|
|
5819
|
-
}).then(function () {
|
|
5820
|
-
_this.dispatch({
|
|
5821
|
-
type: 'success',
|
|
5822
|
-
data: data
|
|
5823
|
-
});
|
|
5824
|
-
|
|
5825
|
-
return data;
|
|
5826
|
-
}).catch(function (error) {
|
|
5827
|
-
// Notify cache callback
|
|
5828
|
-
_this.mutationCache.config.onError == null ? void 0 : _this.mutationCache.config.onError(error, _this.state.variables, _this.state.context, _this); // Log error
|
|
5829
|
-
|
|
5830
|
-
getLogger().error(error);
|
|
5831
|
-
return Promise.resolve().then(function () {
|
|
5832
|
-
return _this.options.onError == null ? void 0 : _this.options.onError(error, _this.state.variables, _this.state.context);
|
|
5833
|
-
}).then(function () {
|
|
5834
|
-
return _this.options.onSettled == null ? void 0 : _this.options.onSettled(undefined, error, _this.state.variables, _this.state.context);
|
|
5835
|
-
}).then(function () {
|
|
5836
|
-
_this.dispatch({
|
|
5837
|
-
type: 'error',
|
|
5838
|
-
error: error
|
|
5839
|
-
});
|
|
5840
|
-
|
|
5841
|
-
throw error;
|
|
5842
|
-
});
|
|
5843
|
-
});
|
|
5844
|
-
};
|
|
5845
|
-
|
|
5846
|
-
_proto.executeMutation = function executeMutation() {
|
|
5847
|
-
var _this2 = this,
|
|
5848
|
-
_this$options$retry;
|
|
5849
|
-
|
|
5850
|
-
this.retryer = new Retryer({
|
|
5851
|
-
fn: function fn() {
|
|
5852
|
-
if (!_this2.options.mutationFn) {
|
|
5853
|
-
return Promise.reject('No mutationFn found');
|
|
5854
|
-
}
|
|
5855
|
-
|
|
5856
|
-
return _this2.options.mutationFn(_this2.state.variables);
|
|
5857
|
-
},
|
|
5858
|
-
onFail: function onFail() {
|
|
5859
|
-
_this2.dispatch({
|
|
5860
|
-
type: 'failed'
|
|
5861
|
-
});
|
|
5862
|
-
},
|
|
5863
|
-
onPause: function onPause() {
|
|
5864
|
-
_this2.dispatch({
|
|
5865
|
-
type: 'pause'
|
|
5866
|
-
});
|
|
5867
|
-
},
|
|
5868
|
-
onContinue: function onContinue() {
|
|
5869
|
-
_this2.dispatch({
|
|
5870
|
-
type: 'continue'
|
|
5871
|
-
});
|
|
5872
|
-
},
|
|
5873
|
-
retry: (_this$options$retry = this.options.retry) != null ? _this$options$retry : 0,
|
|
5874
|
-
retryDelay: this.options.retryDelay
|
|
5875
|
-
});
|
|
5876
|
-
return this.retryer.promise;
|
|
5877
|
-
};
|
|
5878
|
-
|
|
5879
|
-
_proto.dispatch = function dispatch(action) {
|
|
5880
|
-
var _this3 = this;
|
|
5881
|
-
|
|
5882
|
-
this.state = reducer(this.state, action);
|
|
5883
|
-
notifyManager.batch(function () {
|
|
5884
|
-
_this3.observers.forEach(function (observer) {
|
|
5885
|
-
observer.onMutationUpdate(action);
|
|
5886
|
-
});
|
|
5887
|
-
|
|
5888
|
-
_this3.mutationCache.notify(_this3);
|
|
5889
|
-
});
|
|
5890
|
-
};
|
|
5891
|
-
|
|
5892
|
-
return Mutation;
|
|
5893
|
-
}();
|
|
5894
|
-
function getDefaultState() {
|
|
5895
|
-
return {
|
|
5896
|
-
context: undefined,
|
|
5897
|
-
data: undefined,
|
|
5898
|
-
error: null,
|
|
5899
|
-
failureCount: 0,
|
|
5900
|
-
isPaused: false,
|
|
5901
|
-
status: 'idle',
|
|
5902
|
-
variables: undefined
|
|
5903
|
-
};
|
|
5904
|
-
}
|
|
5905
|
-
|
|
5906
|
-
function reducer(state, action) {
|
|
5907
|
-
switch (action.type) {
|
|
5908
|
-
case 'failed':
|
|
5909
|
-
return _extends({}, state, {
|
|
5910
|
-
failureCount: state.failureCount + 1
|
|
5911
|
-
});
|
|
5912
|
-
|
|
5913
|
-
case 'pause':
|
|
5914
|
-
return _extends({}, state, {
|
|
5915
|
-
isPaused: true
|
|
5916
|
-
});
|
|
5917
|
-
|
|
5918
|
-
case 'continue':
|
|
5919
|
-
return _extends({}, state, {
|
|
5920
|
-
isPaused: false
|
|
5921
|
-
});
|
|
5922
|
-
|
|
5923
|
-
case 'loading':
|
|
5924
|
-
return _extends({}, state, {
|
|
5925
|
-
context: action.context,
|
|
5926
|
-
data: undefined,
|
|
5927
|
-
error: null,
|
|
5928
|
-
isPaused: false,
|
|
5929
|
-
status: 'loading',
|
|
5930
|
-
variables: action.variables
|
|
5931
|
-
});
|
|
5932
|
-
|
|
5933
|
-
case 'success':
|
|
5934
|
-
return _extends({}, state, {
|
|
5935
|
-
data: action.data,
|
|
5936
|
-
error: null,
|
|
5937
|
-
status: 'success',
|
|
5938
|
-
isPaused: false
|
|
5939
|
-
});
|
|
5940
|
-
|
|
5941
|
-
case 'error':
|
|
5942
|
-
return _extends({}, state, {
|
|
5943
|
-
data: undefined,
|
|
5944
|
-
error: action.error,
|
|
5945
|
-
failureCount: state.failureCount + 1,
|
|
5946
|
-
isPaused: false,
|
|
5947
|
-
status: 'error'
|
|
5948
|
-
});
|
|
5949
|
-
|
|
5950
|
-
case 'setState':
|
|
5951
|
-
return _extends({}, state, action.state);
|
|
5952
|
-
|
|
5953
|
-
default:
|
|
5954
|
-
return state;
|
|
5955
|
-
}
|
|
5956
|
-
}
|
|
5957
|
-
|
|
5958
|
-
// CLASS
|
|
5959
|
-
var MutationCache = /*#__PURE__*/function (_Subscribable) {
|
|
5960
|
-
_inheritsLoose(MutationCache, _Subscribable);
|
|
5961
|
-
|
|
5962
|
-
function MutationCache(config) {
|
|
5963
|
-
var _this;
|
|
5964
|
-
|
|
5965
|
-
_this = _Subscribable.call(this) || this;
|
|
5966
|
-
_this.config = config || {};
|
|
5967
|
-
_this.mutations = [];
|
|
5968
|
-
_this.mutationId = 0;
|
|
5969
|
-
return _this;
|
|
5970
|
-
}
|
|
5971
|
-
|
|
5972
|
-
var _proto = MutationCache.prototype;
|
|
5973
|
-
|
|
5974
|
-
_proto.build = function build(client, options, state) {
|
|
5975
|
-
var mutation = new Mutation({
|
|
5976
|
-
mutationCache: this,
|
|
5977
|
-
mutationId: ++this.mutationId,
|
|
5978
|
-
options: client.defaultMutationOptions(options),
|
|
5979
|
-
state: state,
|
|
5980
|
-
defaultOptions: options.mutationKey ? client.getMutationDefaults(options.mutationKey) : undefined,
|
|
5981
|
-
meta: options.meta
|
|
5982
|
-
});
|
|
5983
|
-
this.add(mutation);
|
|
5984
|
-
return mutation;
|
|
5985
|
-
};
|
|
5986
|
-
|
|
5987
|
-
_proto.add = function add(mutation) {
|
|
5988
|
-
this.mutations.push(mutation);
|
|
5989
|
-
this.notify(mutation);
|
|
5990
|
-
};
|
|
5991
|
-
|
|
5992
|
-
_proto.remove = function remove(mutation) {
|
|
5993
|
-
this.mutations = this.mutations.filter(function (x) {
|
|
5994
|
-
return x !== mutation;
|
|
5995
|
-
});
|
|
5996
|
-
mutation.cancel();
|
|
5997
|
-
this.notify(mutation);
|
|
5998
|
-
};
|
|
5999
|
-
|
|
6000
|
-
_proto.clear = function clear() {
|
|
6001
|
-
var _this2 = this;
|
|
6002
|
-
|
|
6003
|
-
notifyManager.batch(function () {
|
|
6004
|
-
_this2.mutations.forEach(function (mutation) {
|
|
6005
|
-
_this2.remove(mutation);
|
|
6006
|
-
});
|
|
6007
|
-
});
|
|
6008
|
-
};
|
|
6009
|
-
|
|
6010
|
-
_proto.getAll = function getAll() {
|
|
6011
|
-
return this.mutations;
|
|
6012
|
-
};
|
|
6013
|
-
|
|
6014
|
-
_proto.find = function find(filters) {
|
|
6015
|
-
if (typeof filters.exact === 'undefined') {
|
|
6016
|
-
filters.exact = true;
|
|
6017
|
-
}
|
|
6018
|
-
|
|
6019
|
-
return this.mutations.find(function (mutation) {
|
|
6020
|
-
return matchMutation(filters, mutation);
|
|
6021
|
-
});
|
|
6022
|
-
};
|
|
6023
|
-
|
|
6024
|
-
_proto.findAll = function findAll(filters) {
|
|
6025
|
-
return this.mutations.filter(function (mutation) {
|
|
6026
|
-
return matchMutation(filters, mutation);
|
|
6027
|
-
});
|
|
6028
|
-
};
|
|
6029
|
-
|
|
6030
|
-
_proto.notify = function notify(mutation) {
|
|
6031
|
-
var _this3 = this;
|
|
6032
|
-
|
|
6033
|
-
notifyManager.batch(function () {
|
|
6034
|
-
_this3.listeners.forEach(function (listener) {
|
|
6035
|
-
listener(mutation);
|
|
6036
|
-
});
|
|
6037
|
-
});
|
|
6038
|
-
};
|
|
6039
|
-
|
|
6040
|
-
_proto.onFocus = function onFocus() {
|
|
6041
|
-
this.resumePausedMutations();
|
|
6042
|
-
};
|
|
6043
|
-
|
|
6044
|
-
_proto.onOnline = function onOnline() {
|
|
6045
|
-
this.resumePausedMutations();
|
|
6046
|
-
};
|
|
6047
|
-
|
|
6048
|
-
_proto.resumePausedMutations = function resumePausedMutations() {
|
|
6049
|
-
var pausedMutations = this.mutations.filter(function (x) {
|
|
6050
|
-
return x.state.isPaused;
|
|
6051
|
-
});
|
|
6052
|
-
return notifyManager.batch(function () {
|
|
6053
|
-
return pausedMutations.reduce(function (promise, mutation) {
|
|
6054
|
-
return promise.then(function () {
|
|
6055
|
-
return mutation.continue().catch(noop);
|
|
6056
|
-
});
|
|
6057
|
-
}, Promise.resolve());
|
|
6058
|
-
});
|
|
6059
|
-
};
|
|
6060
|
-
|
|
6061
|
-
return MutationCache;
|
|
6062
|
-
}(Subscribable);
|
|
6063
|
-
|
|
6064
|
-
function infiniteQueryBehavior() {
|
|
6065
|
-
return {
|
|
6066
|
-
onFetch: function onFetch(context) {
|
|
6067
|
-
context.fetchFn = function () {
|
|
6068
|
-
var _context$fetchOptions, _context$fetchOptions2, _context$fetchOptions3, _context$fetchOptions4, _context$state$data, _context$state$data2;
|
|
6069
|
-
|
|
6070
|
-
var refetchPage = (_context$fetchOptions = context.fetchOptions) == null ? void 0 : (_context$fetchOptions2 = _context$fetchOptions.meta) == null ? void 0 : _context$fetchOptions2.refetchPage;
|
|
6071
|
-
var fetchMore = (_context$fetchOptions3 = context.fetchOptions) == null ? void 0 : (_context$fetchOptions4 = _context$fetchOptions3.meta) == null ? void 0 : _context$fetchOptions4.fetchMore;
|
|
6072
|
-
var pageParam = fetchMore == null ? void 0 : fetchMore.pageParam;
|
|
6073
|
-
var isFetchingNextPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'forward';
|
|
6074
|
-
var isFetchingPreviousPage = (fetchMore == null ? void 0 : fetchMore.direction) === 'backward';
|
|
6075
|
-
var oldPages = ((_context$state$data = context.state.data) == null ? void 0 : _context$state$data.pages) || [];
|
|
6076
|
-
var oldPageParams = ((_context$state$data2 = context.state.data) == null ? void 0 : _context$state$data2.pageParams) || [];
|
|
6077
|
-
var abortController = getAbortController();
|
|
6078
|
-
var abortSignal = abortController == null ? void 0 : abortController.signal;
|
|
6079
|
-
var newPageParams = oldPageParams;
|
|
6080
|
-
var cancelled = false; // Get query function
|
|
6081
|
-
|
|
6082
|
-
var queryFn = context.options.queryFn || function () {
|
|
6083
|
-
return Promise.reject('Missing queryFn');
|
|
6084
|
-
};
|
|
6085
|
-
|
|
6086
|
-
var buildNewPages = function buildNewPages(pages, param, page, previous) {
|
|
6087
|
-
newPageParams = previous ? [param].concat(newPageParams) : [].concat(newPageParams, [param]);
|
|
6088
|
-
return previous ? [page].concat(pages) : [].concat(pages, [page]);
|
|
6089
|
-
}; // Create function to fetch a page
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
var fetchPage = function fetchPage(pages, manual, param, previous) {
|
|
6093
|
-
if (cancelled) {
|
|
6094
|
-
return Promise.reject('Cancelled');
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6097
|
-
if (typeof param === 'undefined' && !manual && pages.length) {
|
|
6098
|
-
return Promise.resolve(pages);
|
|
6099
|
-
}
|
|
6100
|
-
|
|
6101
|
-
var queryFnContext = {
|
|
6102
|
-
queryKey: context.queryKey,
|
|
6103
|
-
signal: abortSignal,
|
|
6104
|
-
pageParam: param,
|
|
6105
|
-
meta: context.meta
|
|
6106
|
-
};
|
|
6107
|
-
var queryFnResult = queryFn(queryFnContext);
|
|
6108
|
-
var promise = Promise.resolve(queryFnResult).then(function (page) {
|
|
6109
|
-
return buildNewPages(pages, param, page, previous);
|
|
6110
|
-
});
|
|
6111
|
-
|
|
6112
|
-
if (isCancelable(queryFnResult)) {
|
|
6113
|
-
var promiseAsAny = promise;
|
|
6114
|
-
promiseAsAny.cancel = queryFnResult.cancel;
|
|
6115
|
-
}
|
|
6116
|
-
|
|
6117
|
-
return promise;
|
|
6118
|
-
};
|
|
6119
|
-
|
|
6120
|
-
var promise; // Fetch first page?
|
|
6121
|
-
|
|
6122
|
-
if (!oldPages.length) {
|
|
6123
|
-
promise = fetchPage([]);
|
|
6124
|
-
} // Fetch next page?
|
|
6125
|
-
else if (isFetchingNextPage) {
|
|
6126
|
-
var manual = typeof pageParam !== 'undefined';
|
|
6127
|
-
var param = manual ? pageParam : getNextPageParam(context.options, oldPages);
|
|
6128
|
-
promise = fetchPage(oldPages, manual, param);
|
|
6129
|
-
} // Fetch previous page?
|
|
6130
|
-
else if (isFetchingPreviousPage) {
|
|
6131
|
-
var _manual = typeof pageParam !== 'undefined';
|
|
6132
|
-
|
|
6133
|
-
var _param = _manual ? pageParam : getPreviousPageParam(context.options, oldPages);
|
|
6134
|
-
|
|
6135
|
-
promise = fetchPage(oldPages, _manual, _param, true);
|
|
6136
|
-
} // Refetch pages
|
|
6137
|
-
else {
|
|
6138
|
-
(function () {
|
|
6139
|
-
newPageParams = [];
|
|
6140
|
-
var manual = typeof context.options.getNextPageParam === 'undefined';
|
|
6141
|
-
var shouldFetchFirstPage = refetchPage && oldPages[0] ? refetchPage(oldPages[0], 0, oldPages) : true; // Fetch first page
|
|
6142
|
-
|
|
6143
|
-
promise = shouldFetchFirstPage ? fetchPage([], manual, oldPageParams[0]) : Promise.resolve(buildNewPages([], oldPageParams[0], oldPages[0])); // Fetch remaining pages
|
|
6144
|
-
|
|
6145
|
-
var _loop = function _loop(i) {
|
|
6146
|
-
promise = promise.then(function (pages) {
|
|
6147
|
-
var shouldFetchNextPage = refetchPage && oldPages[i] ? refetchPage(oldPages[i], i, oldPages) : true;
|
|
6148
|
-
|
|
6149
|
-
if (shouldFetchNextPage) {
|
|
6150
|
-
var _param2 = manual ? oldPageParams[i] : getNextPageParam(context.options, pages);
|
|
6151
|
-
|
|
6152
|
-
return fetchPage(pages, manual, _param2);
|
|
6153
|
-
}
|
|
6154
|
-
|
|
6155
|
-
return Promise.resolve(buildNewPages(pages, oldPageParams[i], oldPages[i]));
|
|
6156
|
-
});
|
|
6157
|
-
};
|
|
6158
|
-
|
|
6159
|
-
for (var i = 1; i < oldPages.length; i++) {
|
|
6160
|
-
_loop(i);
|
|
6161
|
-
}
|
|
6162
|
-
})();
|
|
6163
|
-
}
|
|
6164
|
-
|
|
6165
|
-
var finalPromise = promise.then(function (pages) {
|
|
6166
|
-
return {
|
|
6167
|
-
pages: pages,
|
|
6168
|
-
pageParams: newPageParams
|
|
6169
|
-
};
|
|
6170
|
-
});
|
|
6171
|
-
var finalPromiseAsAny = finalPromise;
|
|
6172
|
-
|
|
6173
|
-
finalPromiseAsAny.cancel = function () {
|
|
6174
|
-
cancelled = true;
|
|
6175
|
-
abortController == null ? void 0 : abortController.abort();
|
|
6176
|
-
|
|
6177
|
-
if (isCancelable(promise)) {
|
|
6178
|
-
promise.cancel();
|
|
6179
|
-
}
|
|
6180
|
-
};
|
|
6181
|
-
|
|
6182
|
-
return finalPromise;
|
|
6183
|
-
};
|
|
6184
|
-
}
|
|
6185
|
-
};
|
|
6186
|
-
}
|
|
6187
|
-
function getNextPageParam(options, pages) {
|
|
6188
|
-
return options.getNextPageParam == null ? void 0 : options.getNextPageParam(pages[pages.length - 1], pages);
|
|
6189
|
-
}
|
|
6190
|
-
function getPreviousPageParam(options, pages) {
|
|
6191
|
-
return options.getPreviousPageParam == null ? void 0 : options.getPreviousPageParam(pages[0], pages);
|
|
6192
|
-
}
|
|
6193
|
-
|
|
6194
|
-
// CLASS
|
|
6195
|
-
var QueryClient = /*#__PURE__*/function () {
|
|
6196
|
-
function QueryClient(config) {
|
|
6197
|
-
if (config === void 0) {
|
|
6198
|
-
config = {};
|
|
6199
|
-
}
|
|
6200
|
-
|
|
6201
|
-
this.queryCache = config.queryCache || new QueryCache();
|
|
6202
|
-
this.mutationCache = config.mutationCache || new MutationCache();
|
|
6203
|
-
this.defaultOptions = config.defaultOptions || {};
|
|
6204
|
-
this.queryDefaults = [];
|
|
6205
|
-
this.mutationDefaults = [];
|
|
6206
|
-
}
|
|
6207
|
-
|
|
6208
|
-
var _proto = QueryClient.prototype;
|
|
6209
|
-
|
|
6210
|
-
_proto.mount = function mount() {
|
|
6211
|
-
var _this = this;
|
|
6212
|
-
|
|
6213
|
-
this.unsubscribeFocus = focusManager.subscribe(function () {
|
|
6214
|
-
if (focusManager.isFocused() && onlineManager.isOnline()) {
|
|
6215
|
-
_this.mutationCache.onFocus();
|
|
6216
|
-
|
|
6217
|
-
_this.queryCache.onFocus();
|
|
6218
|
-
}
|
|
6219
|
-
});
|
|
6220
|
-
this.unsubscribeOnline = onlineManager.subscribe(function () {
|
|
6221
|
-
if (focusManager.isFocused() && onlineManager.isOnline()) {
|
|
6222
|
-
_this.mutationCache.onOnline();
|
|
6223
|
-
|
|
6224
|
-
_this.queryCache.onOnline();
|
|
6225
|
-
}
|
|
6226
|
-
});
|
|
6227
|
-
};
|
|
6228
|
-
|
|
6229
|
-
_proto.unmount = function unmount() {
|
|
6230
|
-
var _this$unsubscribeFocu, _this$unsubscribeOnli;
|
|
6231
|
-
|
|
6232
|
-
(_this$unsubscribeFocu = this.unsubscribeFocus) == null ? void 0 : _this$unsubscribeFocu.call(this);
|
|
6233
|
-
(_this$unsubscribeOnli = this.unsubscribeOnline) == null ? void 0 : _this$unsubscribeOnli.call(this);
|
|
6234
|
-
};
|
|
6235
|
-
|
|
6236
|
-
_proto.isFetching = function isFetching(arg1, arg2) {
|
|
6237
|
-
var _parseFilterArgs = parseFilterArgs(arg1, arg2),
|
|
6238
|
-
filters = _parseFilterArgs[0];
|
|
6239
|
-
|
|
6240
|
-
filters.fetching = true;
|
|
6241
|
-
return this.queryCache.findAll(filters).length;
|
|
6242
|
-
};
|
|
6243
|
-
|
|
6244
|
-
_proto.isMutating = function isMutating(filters) {
|
|
6245
|
-
return this.mutationCache.findAll(_extends({}, filters, {
|
|
6246
|
-
fetching: true
|
|
6247
|
-
})).length;
|
|
6248
|
-
};
|
|
6249
|
-
|
|
6250
|
-
_proto.getQueryData = function getQueryData(queryKey, filters) {
|
|
6251
|
-
var _this$queryCache$find;
|
|
6252
|
-
|
|
6253
|
-
return (_this$queryCache$find = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find.state.data;
|
|
6254
|
-
};
|
|
6255
|
-
|
|
6256
|
-
_proto.getQueriesData = function getQueriesData(queryKeyOrFilters) {
|
|
6257
|
-
return this.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref) {
|
|
6258
|
-
var queryKey = _ref.queryKey,
|
|
6259
|
-
state = _ref.state;
|
|
6260
|
-
var data = state.data;
|
|
6261
|
-
return [queryKey, data];
|
|
6262
|
-
});
|
|
6263
|
-
};
|
|
6264
|
-
|
|
6265
|
-
_proto.setQueryData = function setQueryData(queryKey, updater, options) {
|
|
6266
|
-
var parsedOptions = parseQueryArgs(queryKey);
|
|
6267
|
-
var defaultedOptions = this.defaultQueryOptions(parsedOptions);
|
|
6268
|
-
return this.queryCache.build(this, defaultedOptions).setData(updater, options);
|
|
6269
|
-
};
|
|
6270
|
-
|
|
6271
|
-
_proto.setQueriesData = function setQueriesData(queryKeyOrFilters, updater, options) {
|
|
6272
|
-
var _this2 = this;
|
|
6273
|
-
|
|
6274
|
-
return notifyManager.batch(function () {
|
|
6275
|
-
return _this2.getQueryCache().findAll(queryKeyOrFilters).map(function (_ref2) {
|
|
6276
|
-
var queryKey = _ref2.queryKey;
|
|
6277
|
-
return [queryKey, _this2.setQueryData(queryKey, updater, options)];
|
|
6278
|
-
});
|
|
6279
|
-
});
|
|
6280
|
-
};
|
|
6281
|
-
|
|
6282
|
-
_proto.getQueryState = function getQueryState(queryKey, filters) {
|
|
6283
|
-
var _this$queryCache$find2;
|
|
6284
|
-
|
|
6285
|
-
return (_this$queryCache$find2 = this.queryCache.find(queryKey, filters)) == null ? void 0 : _this$queryCache$find2.state;
|
|
6286
|
-
};
|
|
6287
|
-
|
|
6288
|
-
_proto.removeQueries = function removeQueries(arg1, arg2) {
|
|
6289
|
-
var _parseFilterArgs2 = parseFilterArgs(arg1, arg2),
|
|
6290
|
-
filters = _parseFilterArgs2[0];
|
|
6291
|
-
|
|
6292
|
-
var queryCache = this.queryCache;
|
|
6293
|
-
notifyManager.batch(function () {
|
|
6294
|
-
queryCache.findAll(filters).forEach(function (query) {
|
|
6295
|
-
queryCache.remove(query);
|
|
6296
|
-
});
|
|
6297
|
-
});
|
|
6298
|
-
};
|
|
6299
|
-
|
|
6300
|
-
_proto.resetQueries = function resetQueries(arg1, arg2, arg3) {
|
|
6301
|
-
var _this3 = this;
|
|
6302
|
-
|
|
6303
|
-
var _parseFilterArgs3 = parseFilterArgs(arg1, arg2, arg3),
|
|
6304
|
-
filters = _parseFilterArgs3[0],
|
|
6305
|
-
options = _parseFilterArgs3[1];
|
|
6306
|
-
|
|
6307
|
-
var queryCache = this.queryCache;
|
|
6308
|
-
|
|
6309
|
-
var refetchFilters = _extends({}, filters, {
|
|
6310
|
-
active: true
|
|
6311
|
-
});
|
|
6312
|
-
|
|
6313
|
-
return notifyManager.batch(function () {
|
|
6314
|
-
queryCache.findAll(filters).forEach(function (query) {
|
|
6315
|
-
query.reset();
|
|
6316
|
-
});
|
|
6317
|
-
return _this3.refetchQueries(refetchFilters, options);
|
|
6318
|
-
});
|
|
6319
|
-
};
|
|
6320
|
-
|
|
6321
|
-
_proto.cancelQueries = function cancelQueries(arg1, arg2, arg3) {
|
|
6322
|
-
var _this4 = this;
|
|
6323
|
-
|
|
6324
|
-
var _parseFilterArgs4 = parseFilterArgs(arg1, arg2, arg3),
|
|
6325
|
-
filters = _parseFilterArgs4[0],
|
|
6326
|
-
_parseFilterArgs4$ = _parseFilterArgs4[1],
|
|
6327
|
-
cancelOptions = _parseFilterArgs4$ === void 0 ? {} : _parseFilterArgs4$;
|
|
6328
|
-
|
|
6329
|
-
if (typeof cancelOptions.revert === 'undefined') {
|
|
6330
|
-
cancelOptions.revert = true;
|
|
6331
|
-
}
|
|
6332
|
-
|
|
6333
|
-
var promises = notifyManager.batch(function () {
|
|
6334
|
-
return _this4.queryCache.findAll(filters).map(function (query) {
|
|
6335
|
-
return query.cancel(cancelOptions);
|
|
6336
|
-
});
|
|
6337
|
-
});
|
|
6338
|
-
return Promise.all(promises).then(noop).catch(noop);
|
|
6339
|
-
};
|
|
6340
|
-
|
|
6341
|
-
_proto.invalidateQueries = function invalidateQueries(arg1, arg2, arg3) {
|
|
6342
|
-
var _ref3,
|
|
6343
|
-
_filters$refetchActiv,
|
|
6344
|
-
_filters$refetchInact,
|
|
6345
|
-
_this5 = this;
|
|
6346
|
-
|
|
6347
|
-
var _parseFilterArgs5 = parseFilterArgs(arg1, arg2, arg3),
|
|
6348
|
-
filters = _parseFilterArgs5[0],
|
|
6349
|
-
options = _parseFilterArgs5[1];
|
|
6350
|
-
|
|
6351
|
-
var refetchFilters = _extends({}, filters, {
|
|
6352
|
-
// if filters.refetchActive is not provided and filters.active is explicitly false,
|
|
6353
|
-
// e.g. invalidateQueries({ active: false }), we don't want to refetch active queries
|
|
6354
|
-
active: (_ref3 = (_filters$refetchActiv = filters.refetchActive) != null ? _filters$refetchActiv : filters.active) != null ? _ref3 : true,
|
|
6355
|
-
inactive: (_filters$refetchInact = filters.refetchInactive) != null ? _filters$refetchInact : false
|
|
6356
|
-
});
|
|
6357
|
-
|
|
6358
|
-
return notifyManager.batch(function () {
|
|
6359
|
-
_this5.queryCache.findAll(filters).forEach(function (query) {
|
|
6360
|
-
query.invalidate();
|
|
6361
|
-
});
|
|
6362
|
-
|
|
6363
|
-
return _this5.refetchQueries(refetchFilters, options);
|
|
6364
|
-
});
|
|
6365
|
-
};
|
|
6366
|
-
|
|
6367
|
-
_proto.refetchQueries = function refetchQueries(arg1, arg2, arg3) {
|
|
6368
|
-
var _this6 = this;
|
|
6369
|
-
|
|
6370
|
-
var _parseFilterArgs6 = parseFilterArgs(arg1, arg2, arg3),
|
|
6371
|
-
filters = _parseFilterArgs6[0],
|
|
6372
|
-
options = _parseFilterArgs6[1];
|
|
6373
|
-
|
|
6374
|
-
var promises = notifyManager.batch(function () {
|
|
6375
|
-
return _this6.queryCache.findAll(filters).map(function (query) {
|
|
6376
|
-
return query.fetch(undefined, _extends({}, options, {
|
|
6377
|
-
meta: {
|
|
6378
|
-
refetchPage: filters == null ? void 0 : filters.refetchPage
|
|
6379
|
-
}
|
|
6380
|
-
}));
|
|
6381
|
-
});
|
|
6382
|
-
});
|
|
6383
|
-
var promise = Promise.all(promises).then(noop);
|
|
6384
|
-
|
|
6385
|
-
if (!(options == null ? void 0 : options.throwOnError)) {
|
|
6386
|
-
promise = promise.catch(noop);
|
|
6387
|
-
}
|
|
6388
|
-
|
|
6389
|
-
return promise;
|
|
6390
|
-
};
|
|
6391
|
-
|
|
6392
|
-
_proto.fetchQuery = function fetchQuery(arg1, arg2, arg3) {
|
|
6393
|
-
var parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
6394
|
-
var defaultedOptions = this.defaultQueryOptions(parsedOptions); // https://github.com/tannerlinsley/react-query/issues/652
|
|
6395
|
-
|
|
6396
|
-
if (typeof defaultedOptions.retry === 'undefined') {
|
|
6397
|
-
defaultedOptions.retry = false;
|
|
6398
|
-
}
|
|
6399
|
-
|
|
6400
|
-
var query = this.queryCache.build(this, defaultedOptions);
|
|
6401
|
-
return query.isStaleByTime(defaultedOptions.staleTime) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
6402
|
-
};
|
|
6403
|
-
|
|
6404
|
-
_proto.prefetchQuery = function prefetchQuery(arg1, arg2, arg3) {
|
|
6405
|
-
return this.fetchQuery(arg1, arg2, arg3).then(noop).catch(noop);
|
|
6406
|
-
};
|
|
6407
|
-
|
|
6408
|
-
_proto.fetchInfiniteQuery = function fetchInfiniteQuery(arg1, arg2, arg3) {
|
|
6409
|
-
var parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
6410
|
-
parsedOptions.behavior = infiniteQueryBehavior();
|
|
6411
|
-
return this.fetchQuery(parsedOptions);
|
|
6412
|
-
};
|
|
6413
|
-
|
|
6414
|
-
_proto.prefetchInfiniteQuery = function prefetchInfiniteQuery(arg1, arg2, arg3) {
|
|
6415
|
-
return this.fetchInfiniteQuery(arg1, arg2, arg3).then(noop).catch(noop);
|
|
6416
|
-
};
|
|
6417
|
-
|
|
6418
|
-
_proto.cancelMutations = function cancelMutations() {
|
|
6419
|
-
var _this7 = this;
|
|
6420
|
-
|
|
6421
|
-
var promises = notifyManager.batch(function () {
|
|
6422
|
-
return _this7.mutationCache.getAll().map(function (mutation) {
|
|
6423
|
-
return mutation.cancel();
|
|
6424
|
-
});
|
|
6425
|
-
});
|
|
6426
|
-
return Promise.all(promises).then(noop).catch(noop);
|
|
6427
|
-
};
|
|
6428
|
-
|
|
6429
|
-
_proto.resumePausedMutations = function resumePausedMutations() {
|
|
6430
|
-
return this.getMutationCache().resumePausedMutations();
|
|
6431
|
-
};
|
|
6432
|
-
|
|
6433
|
-
_proto.executeMutation = function executeMutation(options) {
|
|
6434
|
-
return this.mutationCache.build(this, options).execute();
|
|
6435
|
-
};
|
|
6436
|
-
|
|
6437
|
-
_proto.getQueryCache = function getQueryCache() {
|
|
6438
|
-
return this.queryCache;
|
|
6439
|
-
};
|
|
6440
|
-
|
|
6441
|
-
_proto.getMutationCache = function getMutationCache() {
|
|
6442
|
-
return this.mutationCache;
|
|
6443
|
-
};
|
|
6444
|
-
|
|
6445
|
-
_proto.getDefaultOptions = function getDefaultOptions() {
|
|
6446
|
-
return this.defaultOptions;
|
|
6447
|
-
};
|
|
6448
|
-
|
|
6449
|
-
_proto.setDefaultOptions = function setDefaultOptions(options) {
|
|
6450
|
-
this.defaultOptions = options;
|
|
6451
|
-
};
|
|
6452
|
-
|
|
6453
|
-
_proto.setQueryDefaults = function setQueryDefaults(queryKey, options) {
|
|
6454
|
-
var result = this.queryDefaults.find(function (x) {
|
|
6455
|
-
return hashQueryKey(queryKey) === hashQueryKey(x.queryKey);
|
|
6456
|
-
});
|
|
6457
|
-
|
|
6458
|
-
if (result) {
|
|
6459
|
-
result.defaultOptions = options;
|
|
6460
|
-
} else {
|
|
6461
|
-
this.queryDefaults.push({
|
|
6462
|
-
queryKey: queryKey,
|
|
6463
|
-
defaultOptions: options
|
|
6464
|
-
});
|
|
6465
|
-
}
|
|
6466
|
-
};
|
|
6467
|
-
|
|
6468
|
-
_proto.getQueryDefaults = function getQueryDefaults(queryKey) {
|
|
6469
|
-
var _this$queryDefaults$f;
|
|
6470
|
-
|
|
6471
|
-
return queryKey ? (_this$queryDefaults$f = this.queryDefaults.find(function (x) {
|
|
6472
|
-
return partialMatchKey(queryKey, x.queryKey);
|
|
6473
|
-
})) == null ? void 0 : _this$queryDefaults$f.defaultOptions : undefined;
|
|
6474
|
-
};
|
|
6475
|
-
|
|
6476
|
-
_proto.setMutationDefaults = function setMutationDefaults(mutationKey, options) {
|
|
6477
|
-
var result = this.mutationDefaults.find(function (x) {
|
|
6478
|
-
return hashQueryKey(mutationKey) === hashQueryKey(x.mutationKey);
|
|
6479
|
-
});
|
|
6480
|
-
|
|
6481
|
-
if (result) {
|
|
6482
|
-
result.defaultOptions = options;
|
|
6483
|
-
} else {
|
|
6484
|
-
this.mutationDefaults.push({
|
|
6485
|
-
mutationKey: mutationKey,
|
|
6486
|
-
defaultOptions: options
|
|
6487
|
-
});
|
|
6488
|
-
}
|
|
6489
|
-
};
|
|
6490
|
-
|
|
6491
|
-
_proto.getMutationDefaults = function getMutationDefaults(mutationKey) {
|
|
6492
|
-
var _this$mutationDefault;
|
|
6493
|
-
|
|
6494
|
-
return mutationKey ? (_this$mutationDefault = this.mutationDefaults.find(function (x) {
|
|
6495
|
-
return partialMatchKey(mutationKey, x.mutationKey);
|
|
6496
|
-
})) == null ? void 0 : _this$mutationDefault.defaultOptions : undefined;
|
|
6497
|
-
};
|
|
6498
|
-
|
|
6499
|
-
_proto.defaultQueryOptions = function defaultQueryOptions(options) {
|
|
6500
|
-
if (options == null ? void 0 : options._defaulted) {
|
|
6501
|
-
return options;
|
|
6502
|
-
}
|
|
6503
|
-
|
|
6504
|
-
var defaultedOptions = _extends({}, this.defaultOptions.queries, this.getQueryDefaults(options == null ? void 0 : options.queryKey), options, {
|
|
6505
|
-
_defaulted: true
|
|
6506
|
-
});
|
|
6507
|
-
|
|
6508
|
-
if (!defaultedOptions.queryHash && defaultedOptions.queryKey) {
|
|
6509
|
-
defaultedOptions.queryHash = hashQueryKeyByOptions(defaultedOptions.queryKey, defaultedOptions);
|
|
6510
|
-
}
|
|
6511
|
-
|
|
6512
|
-
return defaultedOptions;
|
|
6513
|
-
};
|
|
6514
|
-
|
|
6515
|
-
_proto.defaultQueryObserverOptions = function defaultQueryObserverOptions(options) {
|
|
6516
|
-
return this.defaultQueryOptions(options);
|
|
6517
|
-
};
|
|
6518
|
-
|
|
6519
|
-
_proto.defaultMutationOptions = function defaultMutationOptions(options) {
|
|
6520
|
-
if (options == null ? void 0 : options._defaulted) {
|
|
6521
|
-
return options;
|
|
6522
|
-
}
|
|
6523
|
-
|
|
6524
|
-
return _extends({}, this.defaultOptions.mutations, this.getMutationDefaults(options == null ? void 0 : options.mutationKey), options, {
|
|
6525
|
-
_defaulted: true
|
|
6526
|
-
});
|
|
6527
|
-
};
|
|
6528
|
-
|
|
6529
|
-
_proto.clear = function clear() {
|
|
6530
|
-
this.queryCache.clear();
|
|
6531
|
-
this.mutationCache.clear();
|
|
6532
|
-
};
|
|
6533
|
-
|
|
6534
|
-
return QueryClient;
|
|
6535
|
-
}();
|
|
6536
|
-
|
|
6537
|
-
var QueryObserver = /*#__PURE__*/function (_Subscribable) {
|
|
6538
|
-
_inheritsLoose(QueryObserver, _Subscribable);
|
|
6539
|
-
|
|
6540
|
-
function QueryObserver(client, options) {
|
|
6541
|
-
var _this;
|
|
6542
|
-
|
|
6543
|
-
_this = _Subscribable.call(this) || this;
|
|
6544
|
-
_this.client = client;
|
|
6545
|
-
_this.options = options;
|
|
6546
|
-
_this.trackedProps = [];
|
|
6547
|
-
_this.selectError = null;
|
|
6548
|
-
|
|
6549
|
-
_this.bindMethods();
|
|
6550
|
-
|
|
6551
|
-
_this.setOptions(options);
|
|
6552
|
-
|
|
6553
|
-
return _this;
|
|
6554
|
-
}
|
|
6555
|
-
|
|
6556
|
-
var _proto = QueryObserver.prototype;
|
|
6557
|
-
|
|
6558
|
-
_proto.bindMethods = function bindMethods() {
|
|
6559
|
-
this.remove = this.remove.bind(this);
|
|
6560
|
-
this.refetch = this.refetch.bind(this);
|
|
6561
|
-
};
|
|
6562
|
-
|
|
6563
|
-
_proto.onSubscribe = function onSubscribe() {
|
|
6564
|
-
if (this.listeners.length === 1) {
|
|
6565
|
-
this.currentQuery.addObserver(this);
|
|
6566
|
-
|
|
6567
|
-
if (shouldFetchOnMount(this.currentQuery, this.options)) {
|
|
6568
|
-
this.executeFetch();
|
|
6569
|
-
}
|
|
6570
|
-
|
|
6571
|
-
this.updateTimers();
|
|
6572
|
-
}
|
|
6573
|
-
};
|
|
6574
|
-
|
|
6575
|
-
_proto.onUnsubscribe = function onUnsubscribe() {
|
|
6576
|
-
if (!this.listeners.length) {
|
|
6577
|
-
this.destroy();
|
|
6578
|
-
}
|
|
6579
|
-
};
|
|
6580
|
-
|
|
6581
|
-
_proto.shouldFetchOnReconnect = function shouldFetchOnReconnect() {
|
|
6582
|
-
return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnReconnect);
|
|
6583
|
-
};
|
|
6584
|
-
|
|
6585
|
-
_proto.shouldFetchOnWindowFocus = function shouldFetchOnWindowFocus() {
|
|
6586
|
-
return shouldFetchOn(this.currentQuery, this.options, this.options.refetchOnWindowFocus);
|
|
6587
|
-
};
|
|
6588
|
-
|
|
6589
|
-
_proto.destroy = function destroy() {
|
|
6590
|
-
this.listeners = [];
|
|
6591
|
-
this.clearTimers();
|
|
6592
|
-
this.currentQuery.removeObserver(this);
|
|
6593
|
-
};
|
|
6594
|
-
|
|
6595
|
-
_proto.setOptions = function setOptions(options, notifyOptions) {
|
|
6596
|
-
var prevOptions = this.options;
|
|
6597
|
-
var prevQuery = this.currentQuery;
|
|
6598
|
-
this.options = this.client.defaultQueryObserverOptions(options);
|
|
6599
|
-
|
|
6600
|
-
if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {
|
|
6601
|
-
throw new Error('Expected enabled to be a boolean');
|
|
6602
|
-
} // Keep previous query key if the user does not supply one
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
if (!this.options.queryKey) {
|
|
6606
|
-
this.options.queryKey = prevOptions.queryKey;
|
|
6607
|
-
}
|
|
6608
|
-
|
|
6609
|
-
this.updateQuery();
|
|
6610
|
-
var mounted = this.hasListeners(); // Fetch if there are subscribers
|
|
6611
|
-
|
|
6612
|
-
if (mounted && shouldFetchOptionally(this.currentQuery, prevQuery, this.options, prevOptions)) {
|
|
6613
|
-
this.executeFetch();
|
|
6614
|
-
} // Update result
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
this.updateResult(notifyOptions); // Update stale interval if needed
|
|
6618
|
-
|
|
6619
|
-
if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
|
|
6620
|
-
this.updateStaleTimeout();
|
|
6621
|
-
}
|
|
6622
|
-
|
|
6623
|
-
var nextRefetchInterval = this.computeRefetchInterval(); // Update refetch interval if needed
|
|
6624
|
-
|
|
6625
|
-
if (mounted && (this.currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.currentRefetchInterval)) {
|
|
6626
|
-
this.updateRefetchInterval(nextRefetchInterval);
|
|
6627
|
-
}
|
|
6628
|
-
};
|
|
6629
|
-
|
|
6630
|
-
_proto.getOptimisticResult = function getOptimisticResult(options) {
|
|
6631
|
-
var defaultedOptions = this.client.defaultQueryObserverOptions(options);
|
|
6632
|
-
var query = this.client.getQueryCache().build(this.client, defaultedOptions);
|
|
6633
|
-
return this.createResult(query, defaultedOptions);
|
|
6634
|
-
};
|
|
6635
|
-
|
|
6636
|
-
_proto.getCurrentResult = function getCurrentResult() {
|
|
6637
|
-
return this.currentResult;
|
|
6638
|
-
};
|
|
6639
|
-
|
|
6640
|
-
_proto.trackResult = function trackResult(result, defaultedOptions) {
|
|
6641
|
-
var _this2 = this;
|
|
6642
|
-
|
|
6643
|
-
var trackedResult = {};
|
|
6644
|
-
|
|
6645
|
-
var trackProp = function trackProp(key) {
|
|
6646
|
-
if (!_this2.trackedProps.includes(key)) {
|
|
6647
|
-
_this2.trackedProps.push(key);
|
|
6648
|
-
}
|
|
6649
|
-
};
|
|
6650
|
-
|
|
6651
|
-
Object.keys(result).forEach(function (key) {
|
|
6652
|
-
Object.defineProperty(trackedResult, key, {
|
|
6653
|
-
configurable: false,
|
|
6654
|
-
enumerable: true,
|
|
6655
|
-
get: function get() {
|
|
6656
|
-
trackProp(key);
|
|
6657
|
-
return result[key];
|
|
6658
|
-
}
|
|
6659
|
-
});
|
|
6660
|
-
});
|
|
6661
|
-
|
|
6662
|
-
if (defaultedOptions.useErrorBoundary || defaultedOptions.suspense) {
|
|
6663
|
-
trackProp('error');
|
|
6664
|
-
}
|
|
6665
|
-
|
|
6666
|
-
return trackedResult;
|
|
6667
|
-
};
|
|
6668
|
-
|
|
6669
|
-
_proto.getNextResult = function getNextResult(options) {
|
|
6670
|
-
var _this3 = this;
|
|
6671
|
-
|
|
6672
|
-
return new Promise(function (resolve, reject) {
|
|
6673
|
-
var unsubscribe = _this3.subscribe(function (result) {
|
|
6674
|
-
if (!result.isFetching) {
|
|
6675
|
-
unsubscribe();
|
|
6676
|
-
|
|
6677
|
-
if (result.isError && (options == null ? void 0 : options.throwOnError)) {
|
|
6678
|
-
reject(result.error);
|
|
6679
|
-
} else {
|
|
6680
|
-
resolve(result);
|
|
6681
|
-
}
|
|
6682
|
-
}
|
|
6683
|
-
});
|
|
6684
|
-
});
|
|
6685
|
-
};
|
|
6686
|
-
|
|
6687
|
-
_proto.getCurrentQuery = function getCurrentQuery() {
|
|
6688
|
-
return this.currentQuery;
|
|
6689
|
-
};
|
|
6690
|
-
|
|
6691
|
-
_proto.remove = function remove() {
|
|
6692
|
-
this.client.getQueryCache().remove(this.currentQuery);
|
|
6693
|
-
};
|
|
6694
|
-
|
|
6695
|
-
_proto.refetch = function refetch(options) {
|
|
6696
|
-
return this.fetch(_extends({}, options, {
|
|
6697
|
-
meta: {
|
|
6698
|
-
refetchPage: options == null ? void 0 : options.refetchPage
|
|
6699
|
-
}
|
|
6700
|
-
}));
|
|
6701
|
-
};
|
|
6702
|
-
|
|
6703
|
-
_proto.fetchOptimistic = function fetchOptimistic(options) {
|
|
6704
|
-
var _this4 = this;
|
|
6705
|
-
|
|
6706
|
-
var defaultedOptions = this.client.defaultQueryObserverOptions(options);
|
|
6707
|
-
var query = this.client.getQueryCache().build(this.client, defaultedOptions);
|
|
6708
|
-
return query.fetch().then(function () {
|
|
6709
|
-
return _this4.createResult(query, defaultedOptions);
|
|
6710
|
-
});
|
|
6711
|
-
};
|
|
6712
|
-
|
|
6713
|
-
_proto.fetch = function fetch(fetchOptions) {
|
|
6714
|
-
var _this5 = this;
|
|
6715
|
-
|
|
6716
|
-
return this.executeFetch(fetchOptions).then(function () {
|
|
6717
|
-
_this5.updateResult();
|
|
6718
|
-
|
|
6719
|
-
return _this5.currentResult;
|
|
6720
|
-
});
|
|
6721
|
-
};
|
|
6722
|
-
|
|
6723
|
-
_proto.executeFetch = function executeFetch(fetchOptions) {
|
|
6724
|
-
// Make sure we reference the latest query as the current one might have been removed
|
|
6725
|
-
this.updateQuery(); // Fetch
|
|
6726
|
-
|
|
6727
|
-
var promise = this.currentQuery.fetch(this.options, fetchOptions);
|
|
6728
|
-
|
|
6729
|
-
if (!(fetchOptions == null ? void 0 : fetchOptions.throwOnError)) {
|
|
6730
|
-
promise = promise.catch(noop);
|
|
6731
|
-
}
|
|
6732
|
-
|
|
6733
|
-
return promise;
|
|
6734
|
-
};
|
|
6735
|
-
|
|
6736
|
-
_proto.updateStaleTimeout = function updateStaleTimeout() {
|
|
6737
|
-
var _this6 = this;
|
|
6738
|
-
|
|
6739
|
-
this.clearStaleTimeout();
|
|
6740
|
-
|
|
6741
|
-
if (isServer || this.currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
|
|
6742
|
-
return;
|
|
6743
|
-
}
|
|
6744
|
-
|
|
6745
|
-
var time = timeUntilStale(this.currentResult.dataUpdatedAt, this.options.staleTime); // The timeout is sometimes triggered 1 ms before the stale time expiration.
|
|
6746
|
-
// To mitigate this issue we always add 1 ms to the timeout.
|
|
6747
|
-
|
|
6748
|
-
var timeout = time + 1;
|
|
6749
|
-
this.staleTimeoutId = setTimeout(function () {
|
|
6750
|
-
if (!_this6.currentResult.isStale) {
|
|
6751
|
-
_this6.updateResult();
|
|
6752
|
-
}
|
|
6753
|
-
}, timeout);
|
|
6754
|
-
};
|
|
6755
|
-
|
|
6756
|
-
_proto.computeRefetchInterval = function computeRefetchInterval() {
|
|
6757
|
-
var _this$options$refetch;
|
|
6758
|
-
|
|
6759
|
-
return typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(this.currentResult.data, this.currentQuery) : (_this$options$refetch = this.options.refetchInterval) != null ? _this$options$refetch : false;
|
|
6760
|
-
};
|
|
6761
|
-
|
|
6762
|
-
_proto.updateRefetchInterval = function updateRefetchInterval(nextInterval) {
|
|
6763
|
-
var _this7 = this;
|
|
6764
|
-
|
|
6765
|
-
this.clearRefetchInterval();
|
|
6766
|
-
this.currentRefetchInterval = nextInterval;
|
|
6767
|
-
|
|
6768
|
-
if (isServer || this.options.enabled === false || !isValidTimeout(this.currentRefetchInterval) || this.currentRefetchInterval === 0) {
|
|
6769
|
-
return;
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
this.refetchIntervalId = setInterval(function () {
|
|
6773
|
-
if (_this7.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
6774
|
-
_this7.executeFetch();
|
|
6775
|
-
}
|
|
6776
|
-
}, this.currentRefetchInterval);
|
|
6777
|
-
};
|
|
6778
|
-
|
|
6779
|
-
_proto.updateTimers = function updateTimers() {
|
|
6780
|
-
this.updateStaleTimeout();
|
|
6781
|
-
this.updateRefetchInterval(this.computeRefetchInterval());
|
|
6782
|
-
};
|
|
6783
|
-
|
|
6784
|
-
_proto.clearTimers = function clearTimers() {
|
|
6785
|
-
this.clearStaleTimeout();
|
|
6786
|
-
this.clearRefetchInterval();
|
|
6787
|
-
};
|
|
6788
|
-
|
|
6789
|
-
_proto.clearStaleTimeout = function clearStaleTimeout() {
|
|
6790
|
-
if (this.staleTimeoutId) {
|
|
6791
|
-
clearTimeout(this.staleTimeoutId);
|
|
6792
|
-
this.staleTimeoutId = undefined;
|
|
6793
|
-
}
|
|
6794
|
-
};
|
|
6795
|
-
|
|
6796
|
-
_proto.clearRefetchInterval = function clearRefetchInterval() {
|
|
6797
|
-
if (this.refetchIntervalId) {
|
|
6798
|
-
clearInterval(this.refetchIntervalId);
|
|
6799
|
-
this.refetchIntervalId = undefined;
|
|
6800
|
-
}
|
|
6801
|
-
};
|
|
6802
|
-
|
|
6803
|
-
_proto.createResult = function createResult(query, options) {
|
|
6804
|
-
var prevQuery = this.currentQuery;
|
|
6805
|
-
var prevOptions = this.options;
|
|
6806
|
-
var prevResult = this.currentResult;
|
|
6807
|
-
var prevResultState = this.currentResultState;
|
|
6808
|
-
var prevResultOptions = this.currentResultOptions;
|
|
6809
|
-
var queryChange = query !== prevQuery;
|
|
6810
|
-
var queryInitialState = queryChange ? query.state : this.currentQueryInitialState;
|
|
6811
|
-
var prevQueryResult = queryChange ? this.currentResult : this.previousQueryResult;
|
|
6812
|
-
var state = query.state;
|
|
6813
|
-
var dataUpdatedAt = state.dataUpdatedAt,
|
|
6814
|
-
error = state.error,
|
|
6815
|
-
errorUpdatedAt = state.errorUpdatedAt,
|
|
6816
|
-
isFetching = state.isFetching,
|
|
6817
|
-
status = state.status;
|
|
6818
|
-
var isPreviousData = false;
|
|
6819
|
-
var isPlaceholderData = false;
|
|
6820
|
-
var data; // Optimistically set result in fetching state if needed
|
|
6821
|
-
|
|
6822
|
-
if (options.optimisticResults) {
|
|
6823
|
-
var mounted = this.hasListeners();
|
|
6824
|
-
var fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
6825
|
-
var fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
6826
|
-
|
|
6827
|
-
if (fetchOnMount || fetchOptionally) {
|
|
6828
|
-
isFetching = true;
|
|
6829
|
-
|
|
6830
|
-
if (!dataUpdatedAt) {
|
|
6831
|
-
status = 'loading';
|
|
6832
|
-
}
|
|
6833
|
-
}
|
|
6834
|
-
} // Keep previous data if needed
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
if (options.keepPreviousData && !state.dataUpdateCount && (prevQueryResult == null ? void 0 : prevQueryResult.isSuccess) && status !== 'error') {
|
|
6838
|
-
data = prevQueryResult.data;
|
|
6839
|
-
dataUpdatedAt = prevQueryResult.dataUpdatedAt;
|
|
6840
|
-
status = prevQueryResult.status;
|
|
6841
|
-
isPreviousData = true;
|
|
6842
|
-
} // Select data if needed
|
|
6843
|
-
else if (options.select && typeof state.data !== 'undefined') {
|
|
6844
|
-
// Memoize select result
|
|
6845
|
-
if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === this.selectFn) {
|
|
6846
|
-
data = this.selectResult;
|
|
6847
|
-
} else {
|
|
6848
|
-
try {
|
|
6849
|
-
this.selectFn = options.select;
|
|
6850
|
-
data = options.select(state.data);
|
|
6851
|
-
|
|
6852
|
-
if (options.structuralSharing !== false) {
|
|
6853
|
-
data = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, data);
|
|
6854
|
-
}
|
|
6855
|
-
|
|
6856
|
-
this.selectResult = data;
|
|
6857
|
-
this.selectError = null;
|
|
6858
|
-
} catch (selectError) {
|
|
6859
|
-
getLogger().error(selectError);
|
|
6860
|
-
this.selectError = selectError;
|
|
6861
|
-
}
|
|
6862
|
-
}
|
|
6863
|
-
} // Use query data
|
|
6864
|
-
else {
|
|
6865
|
-
data = state.data;
|
|
6866
|
-
} // Show placeholder data if needed
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && (status === 'loading' || status === 'idle')) {
|
|
6870
|
-
var placeholderData; // Memoize placeholder data
|
|
6871
|
-
|
|
6872
|
-
if ((prevResult == null ? void 0 : prevResult.isPlaceholderData) && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
6873
|
-
placeholderData = prevResult.data;
|
|
6874
|
-
} else {
|
|
6875
|
-
placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData() : options.placeholderData;
|
|
6876
|
-
|
|
6877
|
-
if (options.select && typeof placeholderData !== 'undefined') {
|
|
6878
|
-
try {
|
|
6879
|
-
placeholderData = options.select(placeholderData);
|
|
6880
|
-
|
|
6881
|
-
if (options.structuralSharing !== false) {
|
|
6882
|
-
placeholderData = replaceEqualDeep(prevResult == null ? void 0 : prevResult.data, placeholderData);
|
|
6883
|
-
}
|
|
6884
|
-
|
|
6885
|
-
this.selectError = null;
|
|
6886
|
-
} catch (selectError) {
|
|
6887
|
-
getLogger().error(selectError);
|
|
6888
|
-
this.selectError = selectError;
|
|
6889
|
-
}
|
|
6890
|
-
}
|
|
6891
|
-
}
|
|
6892
|
-
|
|
6893
|
-
if (typeof placeholderData !== 'undefined') {
|
|
6894
|
-
status = 'success';
|
|
6895
|
-
data = placeholderData;
|
|
6896
|
-
isPlaceholderData = true;
|
|
6897
|
-
}
|
|
6898
|
-
}
|
|
6899
|
-
|
|
6900
|
-
if (this.selectError) {
|
|
6901
|
-
error = this.selectError;
|
|
6902
|
-
data = this.selectResult;
|
|
6903
|
-
errorUpdatedAt = Date.now();
|
|
6904
|
-
status = 'error';
|
|
6905
|
-
}
|
|
6906
|
-
|
|
6907
|
-
var result = {
|
|
6908
|
-
status: status,
|
|
6909
|
-
isLoading: status === 'loading',
|
|
6910
|
-
isSuccess: status === 'success',
|
|
6911
|
-
isError: status === 'error',
|
|
6912
|
-
isIdle: status === 'idle',
|
|
6913
|
-
data: data,
|
|
6914
|
-
dataUpdatedAt: dataUpdatedAt,
|
|
6915
|
-
error: error,
|
|
6916
|
-
errorUpdatedAt: errorUpdatedAt,
|
|
6917
|
-
failureCount: state.fetchFailureCount,
|
|
6918
|
-
errorUpdateCount: state.errorUpdateCount,
|
|
6919
|
-
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
6920
|
-
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
6921
|
-
isFetching: isFetching,
|
|
6922
|
-
isRefetching: isFetching && status !== 'loading',
|
|
6923
|
-
isLoadingError: status === 'error' && state.dataUpdatedAt === 0,
|
|
6924
|
-
isPlaceholderData: isPlaceholderData,
|
|
6925
|
-
isPreviousData: isPreviousData,
|
|
6926
|
-
isRefetchError: status === 'error' && state.dataUpdatedAt !== 0,
|
|
6927
|
-
isStale: isStale(query, options),
|
|
6928
|
-
refetch: this.refetch,
|
|
6929
|
-
remove: this.remove
|
|
6930
|
-
};
|
|
6931
|
-
return result;
|
|
6932
|
-
};
|
|
6933
|
-
|
|
6934
|
-
_proto.shouldNotifyListeners = function shouldNotifyListeners(result, prevResult) {
|
|
6935
|
-
if (!prevResult) {
|
|
6936
|
-
return true;
|
|
6937
|
-
}
|
|
6938
|
-
|
|
6939
|
-
var _this$options = this.options,
|
|
6940
|
-
notifyOnChangeProps = _this$options.notifyOnChangeProps,
|
|
6941
|
-
notifyOnChangePropsExclusions = _this$options.notifyOnChangePropsExclusions;
|
|
6942
|
-
|
|
6943
|
-
if (!notifyOnChangeProps && !notifyOnChangePropsExclusions) {
|
|
6944
|
-
return true;
|
|
6945
|
-
}
|
|
6946
|
-
|
|
6947
|
-
if (notifyOnChangeProps === 'tracked' && !this.trackedProps.length) {
|
|
6948
|
-
return true;
|
|
6949
|
-
}
|
|
6950
|
-
|
|
6951
|
-
var includedProps = notifyOnChangeProps === 'tracked' ? this.trackedProps : notifyOnChangeProps;
|
|
6952
|
-
return Object.keys(result).some(function (key) {
|
|
6953
|
-
var typedKey = key;
|
|
6954
|
-
var changed = result[typedKey] !== prevResult[typedKey];
|
|
6955
|
-
var isIncluded = includedProps == null ? void 0 : includedProps.some(function (x) {
|
|
6956
|
-
return x === key;
|
|
6957
|
-
});
|
|
6958
|
-
var isExcluded = notifyOnChangePropsExclusions == null ? void 0 : notifyOnChangePropsExclusions.some(function (x) {
|
|
6959
|
-
return x === key;
|
|
6960
|
-
});
|
|
6961
|
-
return changed && !isExcluded && (!includedProps || isIncluded);
|
|
6962
|
-
});
|
|
6963
|
-
};
|
|
6964
|
-
|
|
6965
|
-
_proto.updateResult = function updateResult(notifyOptions) {
|
|
6966
|
-
var prevResult = this.currentResult;
|
|
6967
|
-
this.currentResult = this.createResult(this.currentQuery, this.options);
|
|
6968
|
-
this.currentResultState = this.currentQuery.state;
|
|
6969
|
-
this.currentResultOptions = this.options; // Only notify if something has changed
|
|
6970
|
-
|
|
6971
|
-
if (shallowEqualObjects(this.currentResult, prevResult)) {
|
|
6972
|
-
return;
|
|
6973
|
-
} // Determine which callbacks to trigger
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
var defaultNotifyOptions = {
|
|
6977
|
-
cache: true
|
|
6978
|
-
};
|
|
6979
|
-
|
|
6980
|
-
if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && this.shouldNotifyListeners(this.currentResult, prevResult)) {
|
|
6981
|
-
defaultNotifyOptions.listeners = true;
|
|
6982
|
-
}
|
|
6983
|
-
|
|
6984
|
-
this.notify(_extends({}, defaultNotifyOptions, notifyOptions));
|
|
6985
|
-
};
|
|
6986
|
-
|
|
6987
|
-
_proto.updateQuery = function updateQuery() {
|
|
6988
|
-
var query = this.client.getQueryCache().build(this.client, this.options);
|
|
6989
|
-
|
|
6990
|
-
if (query === this.currentQuery) {
|
|
6991
|
-
return;
|
|
6992
|
-
}
|
|
6993
|
-
|
|
6994
|
-
var prevQuery = this.currentQuery;
|
|
6995
|
-
this.currentQuery = query;
|
|
6996
|
-
this.currentQueryInitialState = query.state;
|
|
6997
|
-
this.previousQueryResult = this.currentResult;
|
|
6998
|
-
|
|
6999
|
-
if (this.hasListeners()) {
|
|
7000
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
7001
|
-
query.addObserver(this);
|
|
7002
|
-
}
|
|
7003
|
-
};
|
|
7004
|
-
|
|
7005
|
-
_proto.onQueryUpdate = function onQueryUpdate(action) {
|
|
7006
|
-
var notifyOptions = {};
|
|
7007
|
-
|
|
7008
|
-
if (action.type === 'success') {
|
|
7009
|
-
notifyOptions.onSuccess = true;
|
|
7010
|
-
} else if (action.type === 'error' && !isCancelledError(action.error)) {
|
|
7011
|
-
notifyOptions.onError = true;
|
|
7012
|
-
}
|
|
7013
|
-
|
|
7014
|
-
this.updateResult(notifyOptions);
|
|
7015
|
-
|
|
7016
|
-
if (this.hasListeners()) {
|
|
7017
|
-
this.updateTimers();
|
|
7018
|
-
}
|
|
7019
|
-
};
|
|
7020
|
-
|
|
7021
|
-
_proto.notify = function notify(notifyOptions) {
|
|
7022
|
-
var _this8 = this;
|
|
7023
|
-
|
|
7024
|
-
notifyManager.batch(function () {
|
|
7025
|
-
// First trigger the configuration callbacks
|
|
7026
|
-
if (notifyOptions.onSuccess) {
|
|
7027
|
-
_this8.options.onSuccess == null ? void 0 : _this8.options.onSuccess(_this8.currentResult.data);
|
|
7028
|
-
_this8.options.onSettled == null ? void 0 : _this8.options.onSettled(_this8.currentResult.data, null);
|
|
7029
|
-
} else if (notifyOptions.onError) {
|
|
7030
|
-
_this8.options.onError == null ? void 0 : _this8.options.onError(_this8.currentResult.error);
|
|
7031
|
-
_this8.options.onSettled == null ? void 0 : _this8.options.onSettled(undefined, _this8.currentResult.error);
|
|
7032
|
-
} // Then trigger the listeners
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
if (notifyOptions.listeners) {
|
|
7036
|
-
_this8.listeners.forEach(function (listener) {
|
|
7037
|
-
listener(_this8.currentResult);
|
|
7038
|
-
});
|
|
7039
|
-
} // Then the cache listeners
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
if (notifyOptions.cache) {
|
|
7043
|
-
_this8.client.getQueryCache().notify({
|
|
7044
|
-
query: _this8.currentQuery,
|
|
7045
|
-
type: 'observerResultsUpdated'
|
|
7046
|
-
});
|
|
7047
|
-
}
|
|
7048
|
-
});
|
|
7049
|
-
};
|
|
7050
|
-
|
|
7051
|
-
return QueryObserver;
|
|
7052
|
-
}(Subscribable);
|
|
7053
|
-
|
|
7054
|
-
function shouldLoadOnMount(query, options) {
|
|
7055
|
-
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);
|
|
7056
|
-
}
|
|
7057
|
-
|
|
7058
|
-
function shouldFetchOnMount(query, options) {
|
|
7059
|
-
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
7060
|
-
}
|
|
7061
|
-
|
|
7062
|
-
function shouldFetchOn(query, options, field) {
|
|
7063
|
-
if (options.enabled !== false) {
|
|
7064
|
-
var value = typeof field === 'function' ? field(query) : field;
|
|
7065
|
-
return value === 'always' || value !== false && isStale(query, options);
|
|
7066
|
-
}
|
|
7067
|
-
|
|
7068
|
-
return false;
|
|
7069
|
-
}
|
|
7070
|
-
|
|
7071
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
7072
|
-
return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);
|
|
7073
|
-
}
|
|
7074
|
-
|
|
7075
|
-
function isStale(query, options) {
|
|
7076
|
-
return query.isStaleByTime(options.staleTime);
|
|
7077
|
-
}
|
|
7078
|
-
|
|
7079
|
-
// CLASS
|
|
7080
|
-
var MutationObserver = /*#__PURE__*/function (_Subscribable) {
|
|
7081
|
-
_inheritsLoose(MutationObserver, _Subscribable);
|
|
7082
|
-
|
|
7083
|
-
function MutationObserver(client, options) {
|
|
7084
|
-
var _this;
|
|
7085
|
-
|
|
7086
|
-
_this = _Subscribable.call(this) || this;
|
|
7087
|
-
_this.client = client;
|
|
7088
|
-
|
|
7089
|
-
_this.setOptions(options);
|
|
7090
|
-
|
|
7091
|
-
_this.bindMethods();
|
|
7092
|
-
|
|
7093
|
-
_this.updateResult();
|
|
7094
|
-
|
|
7095
|
-
return _this;
|
|
7096
|
-
}
|
|
7097
|
-
|
|
7098
|
-
var _proto = MutationObserver.prototype;
|
|
7099
|
-
|
|
7100
|
-
_proto.bindMethods = function bindMethods() {
|
|
7101
|
-
this.mutate = this.mutate.bind(this);
|
|
7102
|
-
this.reset = this.reset.bind(this);
|
|
7103
|
-
};
|
|
7104
|
-
|
|
7105
|
-
_proto.setOptions = function setOptions(options) {
|
|
7106
|
-
this.options = this.client.defaultMutationOptions(options);
|
|
7107
|
-
};
|
|
7108
|
-
|
|
7109
|
-
_proto.onUnsubscribe = function onUnsubscribe() {
|
|
7110
|
-
if (!this.listeners.length) {
|
|
7111
|
-
var _this$currentMutation;
|
|
7112
|
-
|
|
7113
|
-
(_this$currentMutation = this.currentMutation) == null ? void 0 : _this$currentMutation.removeObserver(this);
|
|
7114
|
-
}
|
|
7115
|
-
};
|
|
7116
|
-
|
|
7117
|
-
_proto.onMutationUpdate = function onMutationUpdate(action) {
|
|
7118
|
-
this.updateResult(); // Determine which callbacks to trigger
|
|
7119
|
-
|
|
7120
|
-
var notifyOptions = {
|
|
7121
|
-
listeners: true
|
|
7122
|
-
};
|
|
7123
|
-
|
|
7124
|
-
if (action.type === 'success') {
|
|
7125
|
-
notifyOptions.onSuccess = true;
|
|
7126
|
-
} else if (action.type === 'error') {
|
|
7127
|
-
notifyOptions.onError = true;
|
|
7128
|
-
}
|
|
7129
|
-
|
|
7130
|
-
this.notify(notifyOptions);
|
|
7131
|
-
};
|
|
7132
|
-
|
|
7133
|
-
_proto.getCurrentResult = function getCurrentResult() {
|
|
7134
|
-
return this.currentResult;
|
|
7135
|
-
};
|
|
7136
|
-
|
|
7137
|
-
_proto.reset = function reset() {
|
|
7138
|
-
this.currentMutation = undefined;
|
|
7139
|
-
this.updateResult();
|
|
7140
|
-
this.notify({
|
|
7141
|
-
listeners: true
|
|
7142
|
-
});
|
|
7143
|
-
};
|
|
7144
|
-
|
|
7145
|
-
_proto.mutate = function mutate(variables, options) {
|
|
7146
|
-
this.mutateOptions = options;
|
|
7147
|
-
|
|
7148
|
-
if (this.currentMutation) {
|
|
7149
|
-
this.currentMutation.removeObserver(this);
|
|
7150
|
-
}
|
|
7151
|
-
|
|
7152
|
-
this.currentMutation = this.client.getMutationCache().build(this.client, _extends({}, this.options, {
|
|
7153
|
-
variables: typeof variables !== 'undefined' ? variables : this.options.variables
|
|
7154
|
-
}));
|
|
7155
|
-
this.currentMutation.addObserver(this);
|
|
7156
|
-
return this.currentMutation.execute();
|
|
7157
|
-
};
|
|
7158
|
-
|
|
7159
|
-
_proto.updateResult = function updateResult() {
|
|
7160
|
-
var state = this.currentMutation ? this.currentMutation.state : getDefaultState();
|
|
7161
|
-
|
|
7162
|
-
var result = _extends({}, state, {
|
|
7163
|
-
isLoading: state.status === 'loading',
|
|
7164
|
-
isSuccess: state.status === 'success',
|
|
7165
|
-
isError: state.status === 'error',
|
|
7166
|
-
isIdle: state.status === 'idle',
|
|
7167
|
-
mutate: this.mutate,
|
|
7168
|
-
reset: this.reset
|
|
7169
|
-
});
|
|
7170
|
-
|
|
7171
|
-
this.currentResult = result;
|
|
7172
|
-
};
|
|
7173
|
-
|
|
7174
|
-
_proto.notify = function notify(options) {
|
|
7175
|
-
var _this2 = this;
|
|
7176
|
-
|
|
7177
|
-
notifyManager.batch(function () {
|
|
7178
|
-
// First trigger the mutate callbacks
|
|
7179
|
-
if (_this2.mutateOptions) {
|
|
7180
|
-
if (options.onSuccess) {
|
|
7181
|
-
_this2.mutateOptions.onSuccess == null ? void 0 : _this2.mutateOptions.onSuccess(_this2.currentResult.data, _this2.currentResult.variables, _this2.currentResult.context);
|
|
7182
|
-
_this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(_this2.currentResult.data, null, _this2.currentResult.variables, _this2.currentResult.context);
|
|
7183
|
-
} else if (options.onError) {
|
|
7184
|
-
_this2.mutateOptions.onError == null ? void 0 : _this2.mutateOptions.onError(_this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);
|
|
7185
|
-
_this2.mutateOptions.onSettled == null ? void 0 : _this2.mutateOptions.onSettled(undefined, _this2.currentResult.error, _this2.currentResult.variables, _this2.currentResult.context);
|
|
7186
|
-
}
|
|
7187
|
-
} // Then trigger the listeners
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
if (options.listeners) {
|
|
7191
|
-
_this2.listeners.forEach(function (listener) {
|
|
7192
|
-
listener(_this2.currentResult);
|
|
7193
|
-
});
|
|
7194
|
-
}
|
|
7195
|
-
});
|
|
7196
|
-
};
|
|
7197
|
-
|
|
7198
|
-
return MutationObserver;
|
|
7199
|
-
}(Subscribable);
|
|
7200
|
-
|
|
7201
|
-
var unstable_batchedUpdates = ReactDOM__default["default"].unstable_batchedUpdates;
|
|
7202
|
-
|
|
7203
|
-
notifyManager.setBatchNotifyFunction(unstable_batchedUpdates);
|
|
7204
|
-
|
|
7205
|
-
var logger = console;
|
|
7206
|
-
|
|
7207
|
-
setLogger(logger);
|
|
7208
|
-
|
|
7209
|
-
var defaultContext = /*#__PURE__*/React__default["default"].createContext(undefined);
|
|
7210
|
-
var QueryClientSharingContext = /*#__PURE__*/React__default["default"].createContext(false); // if contextSharing is on, we share the first and at least one
|
|
7211
|
-
// instance of the context across the window
|
|
7212
|
-
// to ensure that if React Query is used across
|
|
7213
|
-
// different bundles or microfrontends they will
|
|
7214
|
-
// all use the same **instance** of context, regardless
|
|
7215
|
-
// of module scoping.
|
|
7216
|
-
|
|
7217
|
-
function getQueryClientContext(contextSharing) {
|
|
7218
|
-
if (contextSharing && typeof window !== 'undefined') {
|
|
7219
|
-
if (!window.ReactQueryClientContext) {
|
|
7220
|
-
window.ReactQueryClientContext = defaultContext;
|
|
7221
|
-
}
|
|
7222
|
-
|
|
7223
|
-
return window.ReactQueryClientContext;
|
|
7224
|
-
}
|
|
7225
|
-
|
|
7226
|
-
return defaultContext;
|
|
7227
|
-
}
|
|
7228
|
-
|
|
7229
|
-
var useQueryClient = function useQueryClient() {
|
|
7230
|
-
var queryClient = React__default["default"].useContext(getQueryClientContext(React__default["default"].useContext(QueryClientSharingContext)));
|
|
7231
|
-
|
|
7232
|
-
if (!queryClient) {
|
|
7233
|
-
throw new Error('No QueryClient set, use QueryClientProvider to set one');
|
|
7234
|
-
}
|
|
7235
|
-
|
|
7236
|
-
return queryClient;
|
|
7237
|
-
};
|
|
7238
|
-
var QueryClientProvider = function QueryClientProvider(_ref) {
|
|
7239
|
-
var client = _ref.client,
|
|
7240
|
-
_ref$contextSharing = _ref.contextSharing,
|
|
7241
|
-
contextSharing = _ref$contextSharing === void 0 ? false : _ref$contextSharing,
|
|
7242
|
-
children = _ref.children;
|
|
7243
|
-
React__default["default"].useEffect(function () {
|
|
7244
|
-
client.mount();
|
|
7245
|
-
return function () {
|
|
7246
|
-
client.unmount();
|
|
7247
|
-
};
|
|
7248
|
-
}, [client]);
|
|
7249
|
-
var Context = getQueryClientContext(contextSharing);
|
|
7250
|
-
return /*#__PURE__*/React__default["default"].createElement(QueryClientSharingContext.Provider, {
|
|
7251
|
-
value: contextSharing
|
|
7252
|
-
}, /*#__PURE__*/React__default["default"].createElement(Context.Provider, {
|
|
7253
|
-
value: client
|
|
7254
|
-
}, children));
|
|
7255
|
-
};
|
|
7256
|
-
|
|
7257
|
-
function createValue() {
|
|
7258
|
-
var _isReset = false;
|
|
7259
|
-
return {
|
|
7260
|
-
clearReset: function clearReset() {
|
|
7261
|
-
_isReset = false;
|
|
7262
|
-
},
|
|
7263
|
-
reset: function reset() {
|
|
7264
|
-
_isReset = true;
|
|
7265
|
-
},
|
|
7266
|
-
isReset: function isReset() {
|
|
7267
|
-
return _isReset;
|
|
7268
|
-
}
|
|
7269
|
-
};
|
|
7270
|
-
}
|
|
7271
|
-
|
|
7272
|
-
var QueryErrorResetBoundaryContext = /*#__PURE__*/React__default["default"].createContext(createValue()); // HOOK
|
|
7273
|
-
|
|
7274
|
-
var useQueryErrorResetBoundary = function useQueryErrorResetBoundary() {
|
|
7275
|
-
return React__default["default"].useContext(QueryErrorResetBoundaryContext);
|
|
7276
|
-
}; // COMPONENT
|
|
7277
|
-
|
|
7278
|
-
function shouldThrowError(suspense, _useErrorBoundary, params) {
|
|
7279
|
-
// Allow useErrorBoundary function to override throwing behavior on a per-error basis
|
|
7280
|
-
if (typeof _useErrorBoundary === 'function') {
|
|
7281
|
-
return _useErrorBoundary.apply(void 0, params);
|
|
7282
|
-
} // Allow useErrorBoundary to override suspense's throwing behavior
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
if (typeof _useErrorBoundary === 'boolean') return _useErrorBoundary; // If suspense is enabled default to throwing errors
|
|
7286
|
-
|
|
7287
|
-
return !!suspense;
|
|
7288
|
-
}
|
|
7289
|
-
|
|
7290
|
-
function useMutation(arg1, arg2, arg3) {
|
|
7291
|
-
var mountedRef = React__default["default"].useRef(false);
|
|
7292
|
-
|
|
7293
|
-
var _React$useState = React__default["default"].useState(0),
|
|
7294
|
-
forceUpdate = _React$useState[1];
|
|
7295
|
-
|
|
7296
|
-
var options = parseMutationArgs(arg1, arg2, arg3);
|
|
7297
|
-
var queryClient = useQueryClient();
|
|
7298
|
-
var obsRef = React__default["default"].useRef();
|
|
7299
|
-
|
|
7300
|
-
if (!obsRef.current) {
|
|
7301
|
-
obsRef.current = new MutationObserver(queryClient, options);
|
|
7302
|
-
} else {
|
|
7303
|
-
obsRef.current.setOptions(options);
|
|
7304
|
-
}
|
|
7305
|
-
|
|
7306
|
-
var currentResult = obsRef.current.getCurrentResult();
|
|
7307
|
-
React__default["default"].useEffect(function () {
|
|
7308
|
-
mountedRef.current = true;
|
|
7309
|
-
var unsubscribe = obsRef.current.subscribe(notifyManager.batchCalls(function () {
|
|
7310
|
-
if (mountedRef.current) {
|
|
7311
|
-
forceUpdate(function (x) {
|
|
7312
|
-
return x + 1;
|
|
7313
|
-
});
|
|
7314
|
-
}
|
|
7315
|
-
}));
|
|
7316
|
-
return function () {
|
|
7317
|
-
mountedRef.current = false;
|
|
7318
|
-
unsubscribe();
|
|
7319
|
-
};
|
|
7320
|
-
}, []);
|
|
7321
|
-
var mutate = React__default["default"].useCallback(function (variables, mutateOptions) {
|
|
7322
|
-
obsRef.current.mutate(variables, mutateOptions).catch(noop);
|
|
7323
|
-
}, []);
|
|
7324
|
-
|
|
7325
|
-
if (currentResult.error && shouldThrowError(undefined, obsRef.current.options.useErrorBoundary, [currentResult.error])) {
|
|
7326
|
-
throw currentResult.error;
|
|
7327
|
-
}
|
|
7328
|
-
|
|
7329
|
-
return _extends({}, currentResult, {
|
|
7330
|
-
mutate: mutate,
|
|
7331
|
-
mutateAsync: currentResult.mutate
|
|
7332
|
-
});
|
|
7333
|
-
}
|
|
7334
|
-
|
|
7335
|
-
function useBaseQuery(options, Observer) {
|
|
7336
|
-
var mountedRef = React__default["default"].useRef(false);
|
|
7337
|
-
|
|
7338
|
-
var _React$useState = React__default["default"].useState(0),
|
|
7339
|
-
forceUpdate = _React$useState[1];
|
|
7340
|
-
|
|
7341
|
-
var queryClient = useQueryClient();
|
|
7342
|
-
var errorResetBoundary = useQueryErrorResetBoundary();
|
|
7343
|
-
var defaultedOptions = queryClient.defaultQueryObserverOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options
|
|
7344
|
-
|
|
7345
|
-
defaultedOptions.optimisticResults = true; // Include callbacks in batch renders
|
|
7346
|
-
|
|
7347
|
-
if (defaultedOptions.onError) {
|
|
7348
|
-
defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);
|
|
7349
|
-
}
|
|
7350
|
-
|
|
7351
|
-
if (defaultedOptions.onSuccess) {
|
|
7352
|
-
defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);
|
|
7353
|
-
}
|
|
7354
|
-
|
|
7355
|
-
if (defaultedOptions.onSettled) {
|
|
7356
|
-
defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);
|
|
7357
|
-
}
|
|
7358
|
-
|
|
7359
|
-
if (defaultedOptions.suspense) {
|
|
7360
|
-
// Always set stale time when using suspense to prevent
|
|
7361
|
-
// fetching again when directly mounting after suspending
|
|
7362
|
-
if (typeof defaultedOptions.staleTime !== 'number') {
|
|
7363
|
-
defaultedOptions.staleTime = 1000;
|
|
7364
|
-
} // Set cache time to 1 if the option has been set to 0
|
|
7365
|
-
// when using suspense to prevent infinite loop of fetches
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
if (defaultedOptions.cacheTime === 0) {
|
|
7369
|
-
defaultedOptions.cacheTime = 1;
|
|
7370
|
-
}
|
|
7371
|
-
}
|
|
7372
|
-
|
|
7373
|
-
if (defaultedOptions.suspense || defaultedOptions.useErrorBoundary) {
|
|
7374
|
-
// Prevent retrying failed query if the error boundary has not been reset yet
|
|
7375
|
-
if (!errorResetBoundary.isReset()) {
|
|
7376
|
-
defaultedOptions.retryOnMount = false;
|
|
7377
|
-
}
|
|
7378
|
-
}
|
|
7379
|
-
|
|
7380
|
-
var _React$useState2 = React__default["default"].useState(function () {
|
|
7381
|
-
return new Observer(queryClient, defaultedOptions);
|
|
7382
|
-
}),
|
|
7383
|
-
observer = _React$useState2[0];
|
|
7384
|
-
|
|
7385
|
-
var result = observer.getOptimisticResult(defaultedOptions);
|
|
7386
|
-
React__default["default"].useEffect(function () {
|
|
7387
|
-
mountedRef.current = true;
|
|
7388
|
-
errorResetBoundary.clearReset();
|
|
7389
|
-
var unsubscribe = observer.subscribe(notifyManager.batchCalls(function () {
|
|
7390
|
-
if (mountedRef.current) {
|
|
7391
|
-
forceUpdate(function (x) {
|
|
7392
|
-
return x + 1;
|
|
7393
|
-
});
|
|
7394
|
-
}
|
|
7395
|
-
})); // Update result to make sure we did not miss any query updates
|
|
7396
|
-
// between creating the observer and subscribing to it.
|
|
7397
|
-
|
|
7398
|
-
observer.updateResult();
|
|
7399
|
-
return function () {
|
|
7400
|
-
mountedRef.current = false;
|
|
7401
|
-
unsubscribe();
|
|
7402
|
-
};
|
|
7403
|
-
}, [errorResetBoundary, observer]);
|
|
7404
|
-
React__default["default"].useEffect(function () {
|
|
7405
|
-
// Do not notify on updates because of changes in the options because
|
|
7406
|
-
// these changes should already be reflected in the optimistic result.
|
|
7407
|
-
observer.setOptions(defaultedOptions, {
|
|
7408
|
-
listeners: false
|
|
7409
|
-
});
|
|
7410
|
-
}, [defaultedOptions, observer]); // Handle suspense
|
|
7411
|
-
|
|
7412
|
-
if (defaultedOptions.suspense && result.isLoading) {
|
|
7413
|
-
throw observer.fetchOptimistic(defaultedOptions).then(function (_ref) {
|
|
7414
|
-
var data = _ref.data;
|
|
7415
|
-
defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);
|
|
7416
|
-
defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);
|
|
7417
|
-
}).catch(function (error) {
|
|
7418
|
-
errorResetBoundary.clearReset();
|
|
7419
|
-
defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);
|
|
7420
|
-
defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);
|
|
7421
|
-
});
|
|
7422
|
-
} // Handle error boundary
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
if (result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(defaultedOptions.suspense, defaultedOptions.useErrorBoundary, [result.error, observer.getCurrentQuery()])) {
|
|
7426
|
-
throw result.error;
|
|
7427
|
-
} // Handle result property usage tracking
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
if (defaultedOptions.notifyOnChangeProps === 'tracked') {
|
|
7431
|
-
result = observer.trackResult(result, defaultedOptions);
|
|
7432
|
-
}
|
|
7433
|
-
|
|
7434
|
-
return result;
|
|
7435
|
-
}
|
|
7436
|
-
|
|
7437
|
-
function useQuery(arg1, arg2, arg3) {
|
|
7438
|
-
var parsedOptions = parseQueryArgs(arg1, arg2, arg3);
|
|
7439
|
-
return useBaseQuery(parsedOptions, QueryObserver);
|
|
7440
|
-
}
|
|
7441
|
-
|
|
7442
|
-
const queryClient = new QueryClient({
|
|
7443
|
-
queryCache: new QueryCache()
|
|
4269
|
+
const queryClient = new reactQuery.QueryClient({
|
|
4270
|
+
queryCache: new reactQuery.QueryCache()
|
|
7444
4271
|
});
|
|
7445
4272
|
|
|
7446
|
-
var devtools = {exports: {}};
|
|
7447
|
-
|
|
7448
|
-
{
|
|
7449
|
-
devtools.exports = {
|
|
7450
|
-
ReactQueryDevtools: function () {
|
|
7451
|
-
return null
|
|
7452
|
-
},
|
|
7453
|
-
ReactQueryDevtoolsPanel: function () {
|
|
7454
|
-
return null
|
|
7455
|
-
},
|
|
7456
|
-
};
|
|
7457
|
-
}
|
|
7458
|
-
|
|
7459
4273
|
const withReactQuery = Component => {
|
|
7460
|
-
const QueryWrapper = props => /*#__PURE__*/React__default["default"].createElement(QueryClientProvider, {
|
|
4274
|
+
const QueryWrapper = props => /*#__PURE__*/React__default["default"].createElement(reactQuery.QueryClientProvider, {
|
|
7461
4275
|
client: queryClient
|
|
7462
|
-
}, /*#__PURE__*/React__default["default"].createElement(Component, props), /*#__PURE__*/React__default["default"].createElement(devtools.
|
|
4276
|
+
}, /*#__PURE__*/React__default["default"].createElement(Component, props), /*#__PURE__*/React__default["default"].createElement(devtools.ReactQueryDevtools, {
|
|
7463
4277
|
initialIsOpen: false,
|
|
7464
4278
|
position: "bottom-right"
|
|
7465
4279
|
}));
|
|
@@ -7486,7 +4300,7 @@ function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
7486
4300
|
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7487
4301
|
const useFetchPermissions = function () {
|
|
7488
4302
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7489
|
-
return useQuery(QUERY_KEYS.PERMISSIONS, permissionsApi.fetch, _objectSpread$8({
|
|
4303
|
+
return reactQuery.useQuery(QUERY_KEYS.PERMISSIONS, permissionsApi.fetch, _objectSpread$8({
|
|
7490
4304
|
staleTime: DEFAULT_STALE_TIME,
|
|
7491
4305
|
select: response => response.permissions || response.data.permissions
|
|
7492
4306
|
}, options));
|
|
@@ -7512,7 +4326,7 @@ function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if
|
|
|
7512
4326
|
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7513
4327
|
const useFetchRoles = function () {
|
|
7514
4328
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7515
|
-
return useQuery(QUERY_KEYS.ROLES, organizationRolesApi.fetch, _objectSpread$7({
|
|
4329
|
+
return reactQuery.useQuery(QUERY_KEYS.ROLES, organizationRolesApi.fetch, _objectSpread$7({
|
|
7516
4330
|
staleTime: DEFAULT_STALE_TIME,
|
|
7517
4331
|
select: response => response.organizationRoles || response.data.organizationRoles
|
|
7518
4332
|
}, options));
|
|
@@ -7520,7 +4334,7 @@ const useFetchRoles = function () {
|
|
|
7520
4334
|
const useCreateRole = _ref => {
|
|
7521
4335
|
let onSuccess = _ref.onSuccess,
|
|
7522
4336
|
options = _objectWithoutProperties(_ref, _excluded$1);
|
|
7523
|
-
return useMutation(organizationRolesApi.create, _objectSpread$7({
|
|
4337
|
+
return reactQuery.useMutation(organizationRolesApi.create, _objectSpread$7({
|
|
7524
4338
|
onSuccess: response => {
|
|
7525
4339
|
queryClient.setQueriesData(QUERY_KEYS.ROLES, cachedData => {
|
|
7526
4340
|
if (!!cachedData.data && !!cachedData.data.organizationRoles) {
|
|
@@ -7536,7 +4350,7 @@ const useCreateRole = _ref => {
|
|
|
7536
4350
|
const useUpdateRole = _ref2 => {
|
|
7537
4351
|
let onSuccess = _ref2.onSuccess,
|
|
7538
4352
|
options = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
7539
|
-
return useMutation(_ref3 => {
|
|
4353
|
+
return reactQuery.useMutation(_ref3 => {
|
|
7540
4354
|
let id = _ref3.id,
|
|
7541
4355
|
payload = _ref3.payload;
|
|
7542
4356
|
return organizationRolesApi.update(id, payload);
|
|
@@ -7556,9 +4370,9 @@ const useUpdateRole = _ref2 => {
|
|
|
7556
4370
|
};
|
|
7557
4371
|
const useDestroyRole = _ref4 => {
|
|
7558
4372
|
let _ref4$onSuccess = _ref4.onSuccess,
|
|
7559
|
-
onSuccess = _ref4$onSuccess === void 0 ? noop
|
|
4373
|
+
onSuccess = _ref4$onSuccess === void 0 ? noop : _ref4$onSuccess,
|
|
7560
4374
|
options = _objectWithoutProperties(_ref4, _excluded3$1);
|
|
7561
|
-
return useMutation(_ref5 => {
|
|
4375
|
+
return reactQuery.useMutation(_ref5 => {
|
|
7562
4376
|
let id = _ref5.id,
|
|
7563
4377
|
payload = _ref5.payload;
|
|
7564
4378
|
return organizationRolesApi.destroy(id, payload);
|
|
@@ -9899,7 +6713,7 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
9899
6713
|
const useFetchMembers = function () {
|
|
9900
6714
|
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9901
6715
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9902
|
-
return useQuery([QUERY_KEYS.TEAMS, params], () => teamsApi.fetch(params), _objectSpread$4({
|
|
6716
|
+
return reactQuery.useQuery([QUERY_KEYS.TEAMS, params], () => teamsApi.fetch(params), _objectSpread$4({
|
|
9903
6717
|
staleTime: DEFAULT_STALE_TIME,
|
|
9904
6718
|
select: response => response.data || response,
|
|
9905
6719
|
keepPreviousData: true
|
|
@@ -9908,7 +6722,7 @@ const useFetchMembers = function () {
|
|
|
9908
6722
|
const useCreateMember = _ref => {
|
|
9909
6723
|
let onSuccess = _ref.onSuccess,
|
|
9910
6724
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
9911
|
-
return useMutation(teamsApi.create, _objectSpread$4({
|
|
6725
|
+
return reactQuery.useMutation(teamsApi.create, _objectSpread$4({
|
|
9912
6726
|
onSuccess: response => {
|
|
9913
6727
|
queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
|
|
9914
6728
|
neetoui.Toastr.success(response.ntmNotice || response.data.ntmNotice);
|
|
@@ -9919,7 +6733,7 @@ const useCreateMember = _ref => {
|
|
|
9919
6733
|
const useUpdateMember = _ref2 => {
|
|
9920
6734
|
let onSuccess = _ref2.onSuccess,
|
|
9921
6735
|
options = _objectWithoutProperties(_ref2, _excluded2);
|
|
9922
|
-
return useMutation(_ref3 => {
|
|
6736
|
+
return reactQuery.useMutation(_ref3 => {
|
|
9923
6737
|
let id = _ref3.id,
|
|
9924
6738
|
payload = _ref3.payload;
|
|
9925
6739
|
return teamsApi.update(id, payload);
|
|
@@ -9934,7 +6748,7 @@ const useUpdateMember = _ref2 => {
|
|
|
9934
6748
|
const useBulkUpdateMembers = _ref4 => {
|
|
9935
6749
|
let onSuccess = _ref4.onSuccess,
|
|
9936
6750
|
options = _objectWithoutProperties(_ref4, _excluded3);
|
|
9937
|
-
return useMutation(teamsApi.bulkUpdate, _objectSpread$4({
|
|
6751
|
+
return reactQuery.useMutation(teamsApi.bulkUpdate, _objectSpread$4({
|
|
9938
6752
|
onSuccess: response => {
|
|
9939
6753
|
queryClient.invalidateQueries(QUERY_KEYS.TEAMS);
|
|
9940
6754
|
neetoui.Toastr.success(response.ntmNotice || response.data.ntmNotice);
|
|
@@ -9963,7 +6777,7 @@ const Header = _ref => {
|
|
|
9963
6777
|
var _permissions$create, _permissions$create2;
|
|
9964
6778
|
let metaName = _ref.metaName,
|
|
9965
6779
|
_ref$onClick = _ref.onClick,
|
|
9966
|
-
onClick = _ref$onClick === void 0 ? noop
|
|
6780
|
+
onClick = _ref$onClick === void 0 ? noop : _ref$onClick,
|
|
9967
6781
|
permissions = _ref.permissions;
|
|
9968
6782
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
|
|
9969
6783
|
content: instance.t("tooltips.noPermissionToAddMember"),
|
|
@@ -9979,6 +6793,21 @@ const Header = _ref => {
|
|
|
9979
6793
|
})));
|
|
9980
6794
|
};
|
|
9981
6795
|
|
|
6796
|
+
function _extends() {
|
|
6797
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
6798
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6799
|
+
var source = arguments[i];
|
|
6800
|
+
for (var key in source) {
|
|
6801
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6802
|
+
target[key] = source[key];
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6805
|
+
}
|
|
6806
|
+
return target;
|
|
6807
|
+
};
|
|
6808
|
+
return _extends.apply(this, arguments);
|
|
6809
|
+
}
|
|
6810
|
+
|
|
9982
6811
|
const getStorageValue = (key, defaultValue) => {
|
|
9983
6812
|
const saved = localStorage.getItem(key);
|
|
9984
6813
|
return JSON.parse(saved) || defaultValue;
|
|
@@ -10112,9 +6941,6 @@ const Columns = _ref => {
|
|
|
10112
6941
|
|
|
10113
6942
|
const FIXED_COLUMNS = ["actions"];
|
|
10114
6943
|
const COLUMNS_DROPDOWN_PROPS = {
|
|
10115
|
-
buttonProps: {
|
|
10116
|
-
size: "small"
|
|
10117
|
-
},
|
|
10118
6944
|
label: instance.t("common.column", PLURAL)
|
|
10119
6945
|
};
|
|
10120
6946
|
const COLUMNS_SEARCH_PROPS = {
|
|
@@ -10161,39 +6987,49 @@ const RolesDropdown = _ref => {
|
|
|
10161
6987
|
setSearchTerm("");
|
|
10162
6988
|
setIsDropdownOpen(false);
|
|
10163
6989
|
};
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
buttonSize: "small",
|
|
6990
|
+
const handleClick = event => {
|
|
6991
|
+
event.stopPropagation();
|
|
6992
|
+
setIsDropdownOpen(!isDropdownOpen);
|
|
6993
|
+
};
|
|
6994
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
|
|
10170
6995
|
buttonStyle: "secondary",
|
|
10171
6996
|
closeOnSelect: false,
|
|
10172
|
-
|
|
6997
|
+
customTarget: /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
|
|
6998
|
+
suffix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Right, {
|
|
6999
|
+
size: 16
|
|
7000
|
+
})
|
|
7001
|
+
}, instance.t("buttons.changeRole")),
|
|
7002
|
+
"data-cy": "ntm-members-roles-update-dropdown-button",
|
|
10173
7003
|
disabled: !hasUpdatePermission,
|
|
10174
|
-
label: instance.t("buttons.changeRole"),
|
|
10175
7004
|
isOpen: isDropdownOpen,
|
|
10176
|
-
onClick:
|
|
10177
|
-
onClose:
|
|
10178
|
-
position: "
|
|
10179
|
-
}, /*#__PURE__*/React__default["default"].createElement(Menu$1, null,
|
|
7005
|
+
onClick: handleClick,
|
|
7006
|
+
onClose: handleOnClose,
|
|
7007
|
+
position: "auto-end"
|
|
7008
|
+
}, /*#__PURE__*/React__default["default"].createElement(Menu$1, null, isSearchable && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
10180
7009
|
className: "neeto-ui-px-3 neeto-ui-py-2",
|
|
7010
|
+
onClick: e => {
|
|
7011
|
+
e.stopPropagation();
|
|
7012
|
+
}
|
|
7013
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
|
|
10181
7014
|
"data-cy": "ntm-members-roles-search-input",
|
|
10182
7015
|
onChange: handleSearch,
|
|
10183
7016
|
placeholder: instance.t("helpers.searchRoles"),
|
|
10184
7017
|
prefix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Search, null),
|
|
10185
7018
|
type: "search",
|
|
10186
7019
|
value: searchTerm
|
|
10187
|
-
}), isNotEmpty$1(filteredRoles) ? filteredRoles.map(_ref3 => {
|
|
7020
|
+
})), isNotEmpty$1(filteredRoles) ? filteredRoles.map(_ref3 => {
|
|
10188
7021
|
let id = _ref3.id,
|
|
10189
7022
|
name = _ref3.name;
|
|
10190
7023
|
return /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
|
|
10191
7024
|
key: id,
|
|
10192
7025
|
onClick: () => handleSelectRole(name)
|
|
10193
7026
|
}, name);
|
|
10194
|
-
}) : /*#__PURE__*/React__default["default"].createElement("
|
|
10195
|
-
className: "neeto-ui-flex neeto-ui-
|
|
10196
|
-
},
|
|
7027
|
+
}) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
7028
|
+
className: "neeto-ui-flex neeto-ui-justify-center neeto-ui-p-1"
|
|
7029
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
7030
|
+
className: "neeto-ui-text-gray-700",
|
|
7031
|
+
style: "body2"
|
|
7032
|
+
}, instance.t("helpers.noRolesFound")))));
|
|
10197
7033
|
};
|
|
10198
7034
|
|
|
10199
7035
|
var _URLSearchParams$get;
|
|
@@ -10243,10 +7079,13 @@ const DEFAULT_SELECTED_ROWS = {
|
|
|
10243
7079
|
};
|
|
10244
7080
|
|
|
10245
7081
|
const Left = _ref => {
|
|
10246
|
-
var _selectedRows$keys, _selectedRows$keys2;
|
|
10247
|
-
let
|
|
7082
|
+
var _selectedRows$keys, _selectedRows$keys2, _config$permissions$u, _config$permissions;
|
|
7083
|
+
let config = _ref.config,
|
|
7084
|
+
filteredCount = _ref.filteredCount,
|
|
10248
7085
|
metaName = _ref.metaName,
|
|
7086
|
+
roles = _ref.roles,
|
|
10249
7087
|
selectedRows = _ref.selectedRows,
|
|
7088
|
+
setSelectedRows = _ref.setSelectedRows,
|
|
10250
7089
|
totalCount = _ref.totalCount;
|
|
10251
7090
|
const hasSelectedRows = isNotEmpty$1(selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows.keys);
|
|
10252
7091
|
const pluralizedByFilterCount = metaName({
|
|
@@ -10256,28 +7095,8 @@ const Left = _ref => {
|
|
|
10256
7095
|
count: selectedRows === null || selectedRows === void 0 ? void 0 : (_selectedRows$keys = selectedRows.keys) === null || _selectedRows$keys === void 0 ? void 0 : _selectedRows$keys.length,
|
|
10257
7096
|
metaName: metaName({
|
|
10258
7097
|
count: selectedRows === null || selectedRows === void 0 ? void 0 : (_selectedRows$keys2 = selectedRows.keys) === null || _selectedRows$keys2 === void 0 ? void 0 : _selectedRows$keys2.length
|
|
10259
|
-
}).toLocaleLowerCase()
|
|
10260
|
-
totalCount
|
|
7098
|
+
}).toLocaleLowerCase()
|
|
10261
7099
|
};
|
|
10262
|
-
return /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
10263
|
-
"data-cy": "ntm-filtered-members-count",
|
|
10264
|
-
component: "h4",
|
|
10265
|
-
style: "h4"
|
|
10266
|
-
}, hasSelectedRows ? /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
10267
|
-
i18nKey: "helpers.selectedMembersCount",
|
|
10268
|
-
values: selectedMembersCountValues
|
|
10269
|
-
}) : `${filteredCount} ${pluralizedByFilterCount}`);
|
|
10270
|
-
};
|
|
10271
|
-
const Right = _ref2 => {
|
|
10272
|
-
var _config$permissions$u, _config$permissions;
|
|
10273
|
-
let columns = _ref2.columns,
|
|
10274
|
-
config = _ref2.config,
|
|
10275
|
-
roles = _ref2.roles,
|
|
10276
|
-
rolesButtonProps = _ref2.rolesButtonProps,
|
|
10277
|
-
selectedRows = _ref2.selectedRows,
|
|
10278
|
-
setColumnData = _ref2.setColumnData,
|
|
10279
|
-
setSelectedRows = _ref2.setSelectedRows;
|
|
10280
|
-
const isRolesButtonVisible = !!rolesButtonProps;
|
|
10281
7100
|
const hasUpdatePermission = (_config$permissions$u = config === null || config === void 0 ? void 0 : (_config$permissions = config.permissions) === null || _config$permissions === void 0 ? void 0 : _config$permissions.update) !== null && _config$permissions$u !== void 0 ? _config$permissions$u : DEFAULT_PERMISSION;
|
|
10282
7101
|
const _useBulkUpdateMembers = useBulkUpdateMembers({
|
|
10283
7102
|
onSuccess: () => setSelectedRows(DEFAULT_SELECTED_ROWS)
|
|
@@ -10304,33 +7123,48 @@ const Right = _ref2 => {
|
|
|
10304
7123
|
}
|
|
10305
7124
|
});
|
|
10306
7125
|
};
|
|
10307
|
-
|
|
7126
|
+
const Menu = neetoui.Dropdown.Menu,
|
|
7127
|
+
MenuItem = neetoui.Dropdown.MenuItem;
|
|
7128
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
7129
|
+
className: "flex items-center gap-4"
|
|
7130
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
7131
|
+
component: "h4",
|
|
7132
|
+
"data-cy": "ntm-filtered-members-count",
|
|
7133
|
+
style: "h4"
|
|
7134
|
+
}, hasSelectedRows ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
7135
|
+
i18nKey: "helpers.selectedMembersCount",
|
|
7136
|
+
values: selectedMembersCountValues
|
|
7137
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
7138
|
+
className: "neeto-ui-text-gray-600"
|
|
7139
|
+
}, " ", totalCount)) : `${filteredCount} ${pluralizedByFilterCount}`), hasSelectedRows && /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
|
|
10308
7140
|
content: instance.t("tooltips.noPermissionToEditMembers"),
|
|
10309
7141
|
disabled: hasUpdatePermission,
|
|
10310
7142
|
position: "top"
|
|
10311
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(neetoui.
|
|
7143
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
|
|
7144
|
+
"data-cy": "ntm-members-take-action-dropdown-button",
|
|
7145
|
+
buttonStyle: "secondary",
|
|
7146
|
+
disabled: !hasUpdatePermission,
|
|
7147
|
+
label: instance.t("common.takeAction")
|
|
7148
|
+
}, /*#__PURE__*/React__default["default"].createElement(Menu, null, getDeactivatedButtonVisible(selectedRows) && /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
|
|
10312
7149
|
"data-cy": "ntm-deactivate-members-button",
|
|
10313
7150
|
disabled: !hasUpdatePermission,
|
|
10314
|
-
label: instance.t("common.deactivate"),
|
|
10315
|
-
size: "small",
|
|
10316
|
-
style: "secondary",
|
|
10317
7151
|
onClick: () => handleDeactivateMembers()
|
|
10318
|
-
}))
|
|
10319
|
-
content: instance.t("tooltips.noPermissionToEditMembers"),
|
|
10320
|
-
disabled: hasUpdatePermission,
|
|
10321
|
-
position: "top"
|
|
10322
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
7152
|
+
}, instance.t("common.deactivate")), getActivateButtonVisible(selectedRows) && /*#__PURE__*/React__default["default"].createElement(MenuItem.Button, {
|
|
10323
7153
|
"data-cy": "ntm-activate-members-button",
|
|
10324
7154
|
disabled: !hasUpdatePermission,
|
|
10325
|
-
label: instance.t("common.activate"),
|
|
10326
|
-
size: "small",
|
|
10327
|
-
style: "secondary",
|
|
10328
7155
|
onClick: () => handleActivateMembers()
|
|
10329
|
-
}
|
|
7156
|
+
}, instance.t("common.activate")), /*#__PURE__*/React__default["default"].createElement(RolesDropdown, {
|
|
10330
7157
|
handleRoleChange: handleRoleChange,
|
|
10331
7158
|
hasUpdatePermission: hasUpdatePermission,
|
|
10332
7159
|
roles: roles
|
|
10333
|
-
})
|
|
7160
|
+
}))))));
|
|
7161
|
+
};
|
|
7162
|
+
const Right = _ref2 => {
|
|
7163
|
+
let columns = _ref2.columns,
|
|
7164
|
+
rolesButtonProps = _ref2.rolesButtonProps,
|
|
7165
|
+
setColumnData = _ref2.setColumnData;
|
|
7166
|
+
const isRolesButtonVisible = !!rolesButtonProps;
|
|
7167
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Columns, {
|
|
10334
7168
|
columnData: columns,
|
|
10335
7169
|
dropdownProps: COLUMNS_DROPDOWN_PROPS,
|
|
10336
7170
|
fixedColumns: FIXED_COLUMNS,
|
|
@@ -10341,7 +7175,6 @@ const Right = _ref2 => {
|
|
|
10341
7175
|
}), isRolesButtonVisible ? /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends({
|
|
10342
7176
|
"data-cy": "ntm-manage-roles-button",
|
|
10343
7177
|
label: MANAGE_ROLES_BUTTON_LABEL,
|
|
10344
|
-
size: "small",
|
|
10345
7178
|
style: "secondary"
|
|
10346
7179
|
}, rolesButtonProps)) : null);
|
|
10347
7180
|
};
|
|
@@ -11431,19 +8264,18 @@ const TeamMembers = _ref => {
|
|
|
11431
8264
|
})
|
|
11432
8265
|
}), /*#__PURE__*/React__default["default"].createElement(layouts.SubHeader, {
|
|
11433
8266
|
leftActionBlock: /*#__PURE__*/React__default["default"].createElement(SubHeader.Left, {
|
|
8267
|
+
config: config,
|
|
11434
8268
|
filteredCount: team === null || team === void 0 ? void 0 : team.membersCount,
|
|
11435
8269
|
metaName: metaName,
|
|
8270
|
+
roles: roles,
|
|
11436
8271
|
selectedRows: selectedRows,
|
|
8272
|
+
setSelectedRows: setSelectedRows,
|
|
11437
8273
|
totalCount: currentCategoryCount
|
|
11438
8274
|
}),
|
|
11439
8275
|
rightActionBlock: /*#__PURE__*/React__default["default"].createElement(SubHeader.Right, {
|
|
11440
8276
|
columns: columns,
|
|
11441
|
-
config: config,
|
|
11442
|
-
roles: roles,
|
|
11443
8277
|
rolesButtonProps: config.rolesButtonProps,
|
|
11444
|
-
|
|
11445
|
-
setColumnData: setColumnData,
|
|
11446
|
-
setSelectedRows: setSelectedRows
|
|
8278
|
+
setColumnData: setColumnData
|
|
11447
8279
|
})
|
|
11448
8280
|
}), (team === null || team === void 0 ? void 0 : team.membersCount) !== 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
11449
8281
|
className: "ntm-members__table-wrapper"
|
|
@@ -11509,7 +8341,7 @@ const VALIDATION_SCHEMA = {
|
|
|
11509
8341
|
|
|
11510
8342
|
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}}
|
|
11511
8343
|
|
|
11512
|
-
var css = ":root {\n --ntm-roles-table-default-scroll: 15px;\n --ntm-roles-table-cell-height: 68px;\n}\n\n.ntm-dropdown__button {\n border-radius: 0 !important;\n font-weight: var(--neeto-ui-font-normal);\n min-height: 34px;\n min-width: 150px;\n text-align: left;\n width: 100%;\n}\n\n.ntm-scrollbar__inner {\n width: 100%;\n height: 200px;\n}\n.ntm-scrollbar__outer {\n position: \"absolute\";\n top: 0px;\n left: 0px;\n width: 200px;\n height: 150px;\n overflow: \"hidden\";\n visibility: \"hidden\";\n}\n\n.ntm-empty-state {\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n}\n.ntm-empty-state__image {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 2rem;\n}\n.ntm-empty-state__title--with-action-block {\n margin-bottom: 1rem;\n}\n.ntm-empty-state__action-block {\n display: flex;\n justify-content: center;\n}\n\n.ntm-members {\n overflow: auto;\n width: 100%;\n}\n.ntm-members-wrapper {\n display: flex;\n}\n.ntm-members-page-loader {\n width: 100%;\n height: 100vh;\n}\n.ntm-members__table-wrapper {\n height: calc(100vh - 205px);\n width: 100%;\n}\n.ntm-members-table__column {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n.ntm-members-pane__header {\n margin-bottom: 0.5rem;\n}\n.ntm-members-pane__body {\n width: 100%;\n padding-bottom: 1rem;\n}\n.ntm-members-pane__body > * + * {\n margin-top: 1rem;\n}\n.ntm-members-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-members-radio-group {\n width: 100%;\n}\n.ntm-members-radio-group .neeto-ui-radio__container--stacked {\n width: 100%;\n}\n.ntm-members-radio-group__label {\n padding-right: 4px;\n}\n.ntm-members-radio-group__icon {\n cursor: pointer;\n}\n\n.ntm-members-pane-radio-item__wrapper {\n width: 100%;\n cursor: pointer;\n padding: 8px 0px !important;\n}\n.ntm-members-pane-radio-item__wrapper:first-child {\n padding-top: 0px !important;\n}\n.ntm-members-pane-radio-item__label {\n margin-bottom: 0 !important;\n}\n.ntm-members-pane-radio-item__description {\n color: rgb(var(--neeto-ui-gray-700));\n}\n\n.ntm-roles-header {\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table__wrapper {\n width: 100%;\n height: calc(100vh - var(--neeto-ui-main-header-with-breadcrumbs-height));\n display: flex;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar {\n width: 396px;\n min-width: 396px;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__search {\n padding: 24px 24px 16px;\n height: 72px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list {\n height: calc(\n 100vh - var(--neeto-ui-main-header-with-breadcrumbs-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 8px;\n min-height: var(--ntm-roles-table-cell-height);\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item.ntm-roles-table-sidebar__list-item--highlighted {\n background-color: rgb(var(--neeto-ui-primary-100));\n padding: 12px 8px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item:not(.ntm-roles-table-sidebar__list-item--highlighted) {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns {\n width: calc(\n 100vw - var(--neeto-ui-sidebar-width) - 396px - 24px\n );\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__cell {\n width: 100%;\n min-width: 200px;\n height: var(--ntm-roles-table-cell-height);\n padding: 12px 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox-wrapper {\n position: absolute;\n height: 1rem;\n width: 1rem;\n margin: auto;\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox {\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header {\n display: flex;\n align-items: center;\n overflow-x: auto;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table__cell {\n height: 72px;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header-cell__container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n gap: 1rem;\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__dropdown {\n margin: 3px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__role-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows {\n width: 100%;\n height: calc(\n 100vh - var(--neeto-ui-main-header-with-breadcrumbs-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n scrollbar-width: none;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb {\n background: rgb(var(--neeto-ui-gray-300));\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb:hover {\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-track {\n background: rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row {\n display: flex;\n align-items: center;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell {\n overflow: hidden;\n position: relative;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell p {\n opacity: 0;\n width: 340px;\n min-width: 340px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row.ntm-roles-table__row--highlighted .ntm-roles-table__cell {\n background-color: rgb(var(--neeto-ui-primary-100));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row:not(.ntm-roles-table__row--highlighted) .ntm-roles-table__cell {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table-sidebar__drop-down-button {\n color: rgb(var(--neeto-ui-gray-600));\n cursor: pointer;\n}\n\n.ntm-roles-modal__body > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-modal__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-pane__body {\n width: 100%;\n margin-bottom: 1.5rem;\n}\n.ntm-roles-pane__body-wrapper > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-pane__body > * + * {\n margin-top: 1.5rem;\n}\n.ntm-roles-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-permission > * + * {\n margin: 0.5rem;\n}\n.ntm-roles-permission__heading {\n color: rgb(var(--neeto-ui-gray-500));\n text-transform: uppercase;\n}\n.ntm-roles-permission__card {\n background-color: rgb(var(--neeto-ui-white));\n align-items: center;\n border-radius: var(--neeto-ui-rounded);\n border-width: 1px;\n border-color: rgb(var(--neeto-ui-gray-300));\n cursor: pointer;\n display: flex;\n gap: 0.75rem;\n padding: 1rem 0.75rem;\n}\n.ntm-roles-permission__card--description {\n flex-grow: 1;\n}\n.ntm-roles-permission__card--checkbox {\n padding: 0 0.5rem;\n}\n\n.ntm-roles-help-url-wrapper {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n padding: 1rem 0;\n}\n\ntd.ant-table-column-sort {\n background: transparent;\n}";
|
|
8344
|
+
var css = ":root {\n --ntm-roles-table-default-scroll: 15px;\n --ntm-roles-table-cell-height: 68px;\n}\n\n.ntm-dropdown__button {\n border-radius: 0 !important;\n font-weight: var(--neeto-ui-font-normal);\n min-height: 34px;\n min-width: 150px;\n text-align: left;\n width: 100%;\n}\n\n.ntm-scrollbar__inner {\n width: 100%;\n height: 200px;\n}\n.ntm-scrollbar__outer {\n position: \"absolute\";\n top: 0px;\n left: 0px;\n width: 200px;\n height: 150px;\n overflow: \"hidden\";\n visibility: \"hidden\";\n}\n\n.ntm-empty-state {\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n}\n.ntm-empty-state__image {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 2rem;\n}\n.ntm-empty-state__title--with-action-block {\n margin-bottom: 1rem;\n}\n.ntm-empty-state__action-block {\n display: flex;\n justify-content: center;\n}\n\n.ntm-members {\n overflow: auto;\n width: 100%;\n}\n.ntm-members-wrapper {\n display: flex;\n}\n.ntm-members-page-loader {\n width: 100%;\n height: 100vh;\n}\n.ntm-members__table-wrapper {\n height: calc(100vh - 205px);\n width: 100%;\n}\n.ntm-members-table__column {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n.ntm-members-pane__header {\n margin-bottom: 0.5rem;\n}\n.ntm-members-pane__body {\n width: 100%;\n padding-bottom: 1rem;\n}\n.ntm-members-pane__body > * + * {\n margin-top: 1rem;\n}\n.ntm-members-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-members-radio-group {\n width: 100%;\n}\n.ntm-members-radio-group .neeto-ui-radio__container--stacked {\n width: 100%;\n}\n.ntm-members-radio-group__label {\n padding-right: 4px;\n}\n.ntm-members-radio-group__icon {\n cursor: pointer;\n}\n\n.ntm-members-pane-radio-item__wrapper {\n width: 100%;\n cursor: pointer;\n padding: 8px 0px !important;\n}\n.ntm-members-pane-radio-item__wrapper:first-child {\n padding-top: 0px !important;\n}\n.ntm-members-pane-radio-item__label {\n margin-bottom: 0 !important;\n}\n.ntm-members-pane-radio-item__description {\n color: rgb(var(--neeto-ui-gray-700));\n}\n\n.ntm-roles-header {\n border-bottom: 1px solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table__wrapper {\n width: 100%;\n height: calc(100vh - var(--neeto-ui-main-header-with-breadcrumbs-height));\n display: flex;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar {\n width: 396px;\n min-width: 396px;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__search {\n padding: 24px 24px 16px;\n height: 72px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list {\n height: calc(\n 100vh - var(--neeto-ui-main-header-with-breadcrumbs-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 12px 8px;\n min-height: var(--ntm-roles-table-cell-height);\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item.ntm-roles-table-sidebar__list-item--highlighted {\n background-color: rgb(var(--neeto-ui-primary-100));\n padding: 12px 8px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__sidebar .ntm-roles-table-sidebar__list .ntm-roles-table-sidebar__list-item:not(.ntm-roles-table-sidebar__list-item--highlighted) {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns {\n width: calc(\n 100vw - var(--neeto-ui-sidebar-width) - 396px - 24px\n );\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__cell {\n width: 100%;\n min-width: 200px;\n height: var(--ntm-roles-table-cell-height);\n padding: 12px 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-right: thin solid rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox-wrapper {\n position: absolute;\n height: 1rem;\n width: 1rem;\n margin: auto;\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table-cell__checkbox {\n z-index: 10;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header {\n display: flex;\n align-items: center;\n overflow-x: auto;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table__cell {\n height: 72px;\n padding-left: 24px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header-cell__container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n gap: 1rem;\n overflow: hidden;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__dropdown {\n margin: 3px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__header .ntm-roles-table-header__role-name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows {\n width: 100%;\n height: calc(\n 100vh - var(--neeto-ui-main-header-with-breadcrumbs-height) - 72px -\n var(--ntm-roles-table-default-scroll)\n );\n overflow-y: auto;\n scrollbar-width: none;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar {\n width: 0px;\n height: 0px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb {\n background: rgb(var(--neeto-ui-gray-300));\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-thumb:hover {\n border-radius: 50px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows::-webkit-scrollbar-track {\n background: rgb(var(--neeto-ui-gray-300));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row {\n display: flex;\n align-items: center;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell {\n overflow: hidden;\n position: relative;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row .ntm-roles-table__cell p {\n opacity: 0;\n width: 340px;\n min-width: 340px;\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row.ntm-roles-table__row--highlighted .ntm-roles-table__cell {\n background-color: rgb(var(--neeto-ui-primary-100));\n}\n.ntm-roles-table__wrapper .ntm-roles-table__columns .ntm-roles-table__rows .ntm-roles-table__row:not(.ntm-roles-table__row--highlighted) .ntm-roles-table__cell {\n border-bottom: thin solid rgb(var(--neeto-ui-gray-300));\n}\n\n.ntm-roles-table-sidebar__drop-down-button {\n color: rgb(var(--neeto-ui-gray-600));\n cursor: pointer;\n}\n\n.ntm-roles-modal__body > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-modal__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-pane__body {\n width: 100%;\n margin-bottom: 1.5rem;\n}\n.ntm-roles-pane__body-wrapper > * + * {\n margin-top: 1rem;\n}\n.ntm-roles-pane__body > * + * {\n margin-top: 1.5rem;\n}\n.ntm-roles-pane__footer {\n display: flex;\n gap: 0.5rem;\n}\n\n.ntm-roles-permission > * + * {\n margin: 0.5rem;\n}\n.ntm-roles-permission__heading {\n color: rgb(var(--neeto-ui-gray-500));\n text-transform: uppercase;\n}\n.ntm-roles-permission__card {\n background-color: rgb(var(--neeto-ui-white));\n align-items: center;\n border-radius: var(--neeto-ui-rounded);\n border-width: 1px;\n border-color: rgb(var(--neeto-ui-gray-300));\n cursor: pointer;\n display: flex;\n gap: 0.75rem;\n padding: 1rem 0.75rem;\n}\n.ntm-roles-permission__card--description {\n flex-grow: 1;\n}\n.ntm-roles-permission__card--checkbox {\n padding: 0 0.5rem;\n}\n\n.ntm-roles-help-url-wrapper {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n padding: 1rem 0;\n}\n\n.neeto-ui-subheader .neeto-ui-subheader__left-wrapper .neeto-ui-subheader__left {\n max-width: none;\n}\n\ntd.ant-table-column-sort {\n background: transparent;\n}";
|
|
11513
8345
|
n(css,{});
|
|
11514
8346
|
|
|
11515
8347
|
exports.MultipleEmailInput = MultipleEmailInput;
|