@hellowearemito/payload-plugin-recently-visited
Version:
A plugin for Payload CMS to list recently visited items on the admin dashboard
37 lines • 2.13 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import { modifyCollections } from './recentlyVisitedSettingsFields';
export var recentlyVisited = function (pluginOptions) {
return function (incomingConfig) {
var _a, _b, _c, _d;
if (!pluginOptions.enabled)
return incomingConfig;
var config = __assign(__assign({}, incomingConfig), { admin: __assign(__assign({}, (incomingConfig.admin || {})), { dependencies: __assign(__assign({}, (((_a = incomingConfig.admin) === null || _a === void 0 ? void 0 : _a.dependencies) || {})), { recentlyVisited: {
path: '@hellowearemito/payload-plugin-recently-visited/RecentlyVisited',
type: 'component',
clientProps: pluginOptions
} }), components: __assign(__assign({}, (((_b = incomingConfig.admin) === null || _b === void 0 ? void 0 : _b.components) || {})), { beforeNavLinks: __spreadArray(__spreadArray([], (((_d = (_c = incomingConfig.admin) === null || _c === void 0 ? void 0 : _c.components) === null || _d === void 0 ? void 0 : _d.beforeNavLinks) || []), true), [
'@hellowearemito/payload-plugin-recently-visited/RecentlyVisited',
], false) }) }), collections: modifyCollections(incomingConfig.collections || [], pluginOptions) });
return config;
};
};
//# sourceMappingURL=index.js.map