strapi-plugin-recycle-bin 0.0.0-stage → 1.0.0

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.
Files changed (35) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -3
  3. package/dist/admin/App-C4C5Xm58.mjs +133 -0
  4. package/dist/admin/App-CVuyP4MA.js +133 -0
  5. package/dist/admin/en-Dsektncp.mjs +6 -0
  6. package/dist/admin/en-tJ9b64pl.js +6 -0
  7. package/dist/admin/index.js +69 -0
  8. package/dist/admin/index.mjs +69 -0
  9. package/dist/admin/src/components/Initializer.d.ts +5 -0
  10. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  11. package/dist/admin/src/index.d.ts +3 -0
  12. package/dist/admin/src/pages/App.d.ts +2 -0
  13. package/dist/admin/src/pages/HomePage.d.ts +3 -0
  14. package/dist/admin/src/pluginId.d.ts +1 -0
  15. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  16. package/dist/server/index.js +258 -0
  17. package/dist/server/index.mjs +258 -0
  18. package/dist/server/src/bootstrap.d.ts +5 -0
  19. package/dist/server/src/config/index.d.ts +8 -0
  20. package/dist/server/src/content-types/index.d.ts +53 -0
  21. package/dist/server/src/content-types/recycle-bin-item/schema.json.d.ts +51 -0
  22. package/dist/server/src/controllers/index.d.ts +10 -0
  23. package/dist/server/src/controllers/recycle-bin.d.ts +9 -0
  24. package/dist/server/src/destroy.d.ts +5 -0
  25. package/dist/server/src/index.d.ts +110 -0
  26. package/dist/server/src/middlewares/index.d.ts +2 -0
  27. package/dist/server/src/middlewares/intercept-deletion.d.ts +2 -0
  28. package/dist/server/src/policies/index.d.ts +2 -0
  29. package/dist/server/src/register.d.ts +5 -0
  30. package/dist/server/src/routes/admin.d.ts +12 -0
  31. package/dist/server/src/routes/index.d.ts +14 -0
  32. package/dist/server/src/services/archive.d.ts +7 -0
  33. package/dist/server/src/services/index.d.ts +16 -0
  34. package/dist/server/src/services/restore.d.ts +10 -0
  35. package/package.json +85 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kaushik-Patil-biradar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # Strapi 5 Recycle Bin Plugin (`strapi-plugin-recycle-bin`)
2
+
3
+ Safely intercept content deletions in **Strapi 5** with a soft-delete recycle bin, one-click document restore, and configurable retention auto-purge policies.
4
+
5
+ ---
6
+
7
+ ## ⚡ The Problem It Solves
8
+
9
+ In Strapi 5, when an editor deletes an entry in the Content Manager, it is immediately and permanently purged from the database. Accidental deletions happen often in editorial teams, and until now the only recovery option was restoring a raw database backup.
10
+
11
+ This plugin provides a safety net:
12
+ 1. **Intercepts Deletion**: A Document Service middleware archives deleted documents and relations into a secure recycle bin snapshot before deletion.
13
+ 2. **Strapi Admin UI**: An intuitive "Recycle Bin" interface in the Strapi Admin sidebar where editors can search, view, restore, or permanently purge items.
14
+ 3. **Draft & Published Aware**: Restores records back into their original content type seamlessly.
15
+ 4. **Automatic Retention Cron**: Configurable background cron that auto-purges items older than your retention limit (default: 30 days).
16
+
17
+ ---
18
+
19
+ ## 📦 Installation
20
+
21
+ In your Strapi 5 project root:
22
+
23
+ ```bash
24
+ # Using npm
25
+ npm install strapi-plugin-recycle-bin
26
+
27
+ # Using yarn
28
+ yarn add strapi-plugin-recycle-bin
29
+ ```
30
+
31
+ ---
32
+
33
+ ## ⚙️ Configuration
34
+
35
+ Enable and configure the plugin in `config/plugins.ts` (or `config/plugins.js`):
36
+
37
+ ```typescript
38
+ export default ({ env }) => ({
39
+ 'recycle-bin': {
40
+ enabled: true,
41
+ config: {
42
+ retentionDays: 30, // Number of days to keep deleted items before automatic purge
43
+ excludedUids: [ // Content types to bypass (not captured into recycle bin)
44
+ 'admin::user',
45
+ 'admin::permission',
46
+ 'admin::role',
47
+ 'admin::api-token',
48
+ 'admin::transfer-token',
49
+ 'plugin::recycle-bin.recycle-bin-item',
50
+ 'plugin::upload.file',
51
+ ],
52
+ },
53
+ },
54
+ });
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 🚀 How It Works
60
+
61
+ - **Archive Action**: Whenever `strapi.documents(uid).delete(...)` is called, the deletion middleware captures the document snapshot, record metadata, and the deleting user context.
62
+ - **Restore Action**: Clicking **Restore** re-instantiates the document through the Strapi Document Service API, preserving draft/published state, and deletes the recycle bin entry.
63
+ - **Permanent Purge**: Clicking **Purge** immediately removes the snapshot from the recycle bin table.
64
+ - **Auto-Purge**: Runs every night at midnight (`0 0 * * *`) to delete expired items older than `retentionDays`.
65
+
66
+ ---
67
+
68
+ ## 🛡️ Security & Permissions
69
+
70
+ - All Recycle Bin management endpoints (`/recycle-bin/items`) require authenticated admin privileges (`admin::isAuthenticatedAdmin`).
71
+ - Recycle bin entries are hidden from the standard Content Manager and Content-Type Builder to prevent tampering.
72
+
73
+ ---
74
+
75
+ ## 📄 License
76
+
77
+ MIT © [Kaushik Patil](mailto:kaushik.patil@gigasolv.com)
@@ -0,0 +1,133 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useFetchClient, useNotification, Layouts, Page } from "@strapi/strapi/admin";
3
+ import { Routes, Route } from "react-router-dom";
4
+ import { useState, useEffect } from "react";
5
+ import { Main, Flex, Searchbar, Table, Thead, Tr, Th, Typography, Tbody, Td, Box, Button } from "@strapi/design-system";
6
+ import { ArrowClockwise, Trash } from "@strapi/icons";
7
+ const HomePage = () => {
8
+ const [items, setItems] = useState([]);
9
+ const [search, setSearch] = useState("");
10
+ const [loading, setLoading] = useState(false);
11
+ const { get, post, del } = useFetchClient();
12
+ const { toggleNotification } = useNotification();
13
+ const fetchItems = async () => {
14
+ setLoading(true);
15
+ try {
16
+ const { data } = await get(
17
+ `/recycle-bin/items?search=${encodeURIComponent(search)}`
18
+ );
19
+ setItems(data?.data || []);
20
+ } catch (err) {
21
+ toggleNotification({
22
+ type: "danger",
23
+ message: err?.message || "Failed to fetch recycle bin items"
24
+ });
25
+ } finally {
26
+ setLoading(false);
27
+ }
28
+ };
29
+ useEffect(() => {
30
+ fetchItems();
31
+ }, [search]);
32
+ const handleRestore = async (id) => {
33
+ try {
34
+ await post(`/recycle-bin/items/${id}/restore`, {});
35
+ toggleNotification({
36
+ type: "success",
37
+ message: "Item restored successfully"
38
+ });
39
+ fetchItems();
40
+ } catch (err) {
41
+ toggleNotification({
42
+ type: "danger",
43
+ message: err?.response?.data?.error?.message || err?.message || "Failed to restore item"
44
+ });
45
+ }
46
+ };
47
+ const handlePurge = async (id) => {
48
+ if (window.confirm("This will permanently delete the snapshot. Continue?")) {
49
+ try {
50
+ await del(`/recycle-bin/items/${id}`);
51
+ toggleNotification({
52
+ type: "success",
53
+ message: "Item permanently deleted"
54
+ });
55
+ fetchItems();
56
+ } catch (err) {
57
+ toggleNotification({
58
+ type: "danger",
59
+ message: err?.response?.data?.error?.message || err?.message || "Failed to purge item"
60
+ });
61
+ }
62
+ }
63
+ };
64
+ return /* @__PURE__ */ jsxs(Main, { children: [
65
+ /* @__PURE__ */ jsx(
66
+ Layouts.Header,
67
+ {
68
+ title: "Recycle Bin",
69
+ subtitle: "Recover deleted content items before permanent purge"
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
73
+ /* @__PURE__ */ jsx(
74
+ Searchbar,
75
+ {
76
+ name: "search",
77
+ placeholder: "Search by title...",
78
+ value: search,
79
+ onChange: (e) => setSearch(e.target.value),
80
+ onClear: () => setSearch(""),
81
+ clearLabel: "Clear search",
82
+ children: "Search by title"
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsxs(Table, { colCount: 5, rowCount: items.length, children: [
86
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
87
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Title" }) }),
88
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Content Type" }) }),
89
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Deleted At" }) }),
90
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Deleted By" }) }),
91
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "Actions" }) })
92
+ ] }) }),
93
+ /* @__PURE__ */ jsx(Tbody, { children: items.length === 0 ? /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 5, children: /* @__PURE__ */ jsx(Box, { padding: 6, textAlign: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "delta", textColor: "neutral600", children: loading ? "Loading items..." : "No items found in the recycle bin" }) }) }) }) : items.map((row) => /* @__PURE__ */ jsxs(Tr, { children: [
94
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: row.title || row.recordDocumentId }) }),
95
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: row.entityUid }) }),
96
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: new Date(row.deletedAt).toLocaleString() }) }),
97
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { children: row.deletedBy?.email || "System / API" }) }),
98
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
99
+ /* @__PURE__ */ jsx(
100
+ Button,
101
+ {
102
+ size: "S",
103
+ variant: "tertiary",
104
+ startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}),
105
+ onClick: () => handleRestore(row.id),
106
+ children: "Restore"
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsx(
110
+ Button,
111
+ {
112
+ size: "S",
113
+ variant: "danger-light",
114
+ startIcon: /* @__PURE__ */ jsx(Trash, {}),
115
+ onClick: () => handlePurge(row.id),
116
+ children: "Purge"
117
+ }
118
+ )
119
+ ] }) })
120
+ ] }, row.id)) })
121
+ ] })
122
+ ] }) })
123
+ ] });
124
+ };
125
+ const App = () => {
126
+ return /* @__PURE__ */ jsxs(Routes, { children: [
127
+ /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
128
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
129
+ ] });
130
+ };
131
+ export {
132
+ App as default
133
+ };
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const admin = require("@strapi/strapi/admin");
5
+ const reactRouterDom = require("react-router-dom");
6
+ const react = require("react");
7
+ const designSystem = require("@strapi/design-system");
8
+ const icons = require("@strapi/icons");
9
+ const HomePage = () => {
10
+ const [items, setItems] = react.useState([]);
11
+ const [search, setSearch] = react.useState("");
12
+ const [loading, setLoading] = react.useState(false);
13
+ const { get, post, del } = admin.useFetchClient();
14
+ const { toggleNotification } = admin.useNotification();
15
+ const fetchItems = async () => {
16
+ setLoading(true);
17
+ try {
18
+ const { data } = await get(
19
+ `/recycle-bin/items?search=${encodeURIComponent(search)}`
20
+ );
21
+ setItems(data?.data || []);
22
+ } catch (err) {
23
+ toggleNotification({
24
+ type: "danger",
25
+ message: err?.message || "Failed to fetch recycle bin items"
26
+ });
27
+ } finally {
28
+ setLoading(false);
29
+ }
30
+ };
31
+ react.useEffect(() => {
32
+ fetchItems();
33
+ }, [search]);
34
+ const handleRestore = async (id) => {
35
+ try {
36
+ await post(`/recycle-bin/items/${id}/restore`, {});
37
+ toggleNotification({
38
+ type: "success",
39
+ message: "Item restored successfully"
40
+ });
41
+ fetchItems();
42
+ } catch (err) {
43
+ toggleNotification({
44
+ type: "danger",
45
+ message: err?.response?.data?.error?.message || err?.message || "Failed to restore item"
46
+ });
47
+ }
48
+ };
49
+ const handlePurge = async (id) => {
50
+ if (window.confirm("This will permanently delete the snapshot. Continue?")) {
51
+ try {
52
+ await del(`/recycle-bin/items/${id}`);
53
+ toggleNotification({
54
+ type: "success",
55
+ message: "Item permanently deleted"
56
+ });
57
+ fetchItems();
58
+ } catch (err) {
59
+ toggleNotification({
60
+ type: "danger",
61
+ message: err?.response?.data?.error?.message || err?.message || "Failed to purge item"
62
+ });
63
+ }
64
+ }
65
+ };
66
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { children: [
67
+ /* @__PURE__ */ jsxRuntime.jsx(
68
+ admin.Layouts.Header,
69
+ {
70
+ title: "Recycle Bin",
71
+ subtitle: "Recover deleted content items before permanent purge"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
75
+ /* @__PURE__ */ jsxRuntime.jsx(
76
+ designSystem.Searchbar,
77
+ {
78
+ name: "search",
79
+ placeholder: "Search by title...",
80
+ value: search,
81
+ onChange: (e) => setSearch(e.target.value),
82
+ onClear: () => setSearch(""),
83
+ clearLabel: "Clear search",
84
+ children: "Search by title"
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 5, rowCount: items.length, children: [
88
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Title" }) }),
90
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Content Type" }) }),
91
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Deleted At" }) }),
92
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Deleted By" }) }),
93
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Actions" }) })
94
+ ] }) }),
95
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, textAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", textColor: "neutral600", children: loading ? "Loading items..." : "No items found in the recycle bin" }) }) }) }) : items.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
96
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.title || row.recordDocumentId }) }),
97
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.entityUid }) }),
98
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: new Date(row.deletedAt).toLocaleString() }) }),
99
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.deletedBy?.email || "System / API" }) }),
100
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
101
+ /* @__PURE__ */ jsxRuntime.jsx(
102
+ designSystem.Button,
103
+ {
104
+ size: "S",
105
+ variant: "tertiary",
106
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
107
+ onClick: () => handleRestore(row.id),
108
+ children: "Restore"
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ designSystem.Button,
113
+ {
114
+ size: "S",
115
+ variant: "danger-light",
116
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
117
+ onClick: () => handlePurge(row.id),
118
+ children: "Purge"
119
+ }
120
+ )
121
+ ] }) })
122
+ ] }, row.id)) })
123
+ ] })
124
+ ] }) })
125
+ ] });
126
+ };
127
+ const App = () => {
128
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
129
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
130
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
131
+ ] });
132
+ };
133
+ exports.default = App;
@@ -0,0 +1,6 @@
1
+ const en = {
2
+ "plugin.name": "Recycle Bin"
3
+ };
4
+ export {
5
+ en as default
6
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const en = {
4
+ "plugin.name": "Recycle Bin"
5
+ };
6
+ exports.default = en;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const react = require("react");
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const icons = require("@strapi/icons");
6
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
7
+ const v = glob[path];
8
+ if (v) {
9
+ return typeof v === "function" ? v() : Promise.resolve(v);
10
+ }
11
+ return new Promise((_, reject) => {
12
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
13
+ reject.bind(
14
+ null,
15
+ new Error(
16
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
17
+ )
18
+ )
19
+ );
20
+ });
21
+ };
22
+ const PLUGIN_ID = "recycle-bin";
23
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
24
+ const Initializer = ({ setPlugin }) => {
25
+ const ref = react.useRef(setPlugin);
26
+ react.useEffect(() => {
27
+ ref.current(PLUGIN_ID);
28
+ }, []);
29
+ return null;
30
+ };
31
+ const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {});
32
+ const plugin = {
33
+ register(app) {
34
+ app.addMenuLink({
35
+ to: `plugins/${PLUGIN_ID}`,
36
+ icon: PluginIcon,
37
+ intlLabel: {
38
+ id: `${PLUGIN_ID}.plugin.name`,
39
+ defaultMessage: "Recycle Bin"
40
+ },
41
+ Component: () => Promise.resolve().then(() => require("./App-CVuyP4MA.js")),
42
+ permissions: []
43
+ });
44
+ app.registerPlugin({
45
+ id: PLUGIN_ID,
46
+ initializer: Initializer,
47
+ isReady: false,
48
+ name: PLUGIN_ID
49
+ });
50
+ },
51
+ registerTrads({ locales }) {
52
+ return Promise.all(
53
+ locales.map(async (locale) => {
54
+ try {
55
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-tJ9b64pl.js")) }), `./translations/${locale}.json`, 3);
56
+ const newData = {};
57
+ const keys = Object.keys(data);
58
+ for (const key of keys) {
59
+ newData[getTranslation(key)] = data[key];
60
+ }
61
+ return { data: newData, locale };
62
+ } catch {
63
+ return { data: {}, locale };
64
+ }
65
+ })
66
+ );
67
+ }
68
+ };
69
+ exports.default = plugin;
@@ -0,0 +1,69 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Trash } from "@strapi/icons";
4
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
5
+ const v = glob[path];
6
+ if (v) {
7
+ return typeof v === "function" ? v() : Promise.resolve(v);
8
+ }
9
+ return new Promise((_, reject) => {
10
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
11
+ reject.bind(
12
+ null,
13
+ new Error(
14
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
15
+ )
16
+ )
17
+ );
18
+ });
19
+ };
20
+ const PLUGIN_ID = "recycle-bin";
21
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
22
+ const Initializer = ({ setPlugin }) => {
23
+ const ref = useRef(setPlugin);
24
+ useEffect(() => {
25
+ ref.current(PLUGIN_ID);
26
+ }, []);
27
+ return null;
28
+ };
29
+ const PluginIcon = () => /* @__PURE__ */ jsx(Trash, {});
30
+ const plugin = {
31
+ register(app) {
32
+ app.addMenuLink({
33
+ to: `plugins/${PLUGIN_ID}`,
34
+ icon: PluginIcon,
35
+ intlLabel: {
36
+ id: `${PLUGIN_ID}.plugin.name`,
37
+ defaultMessage: "Recycle Bin"
38
+ },
39
+ Component: () => import("./App-C4C5Xm58.mjs"),
40
+ permissions: []
41
+ });
42
+ app.registerPlugin({
43
+ id: PLUGIN_ID,
44
+ initializer: Initializer,
45
+ isReady: false,
46
+ name: PLUGIN_ID
47
+ });
48
+ },
49
+ registerTrads({ locales }) {
50
+ return Promise.all(
51
+ locales.map(async (locale) => {
52
+ try {
53
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Dsektncp.mjs") }), `./translations/${locale}.json`, 3);
54
+ const newData = {};
55
+ const keys = Object.keys(data);
56
+ for (const key of keys) {
57
+ newData[getTranslation(key)] = data[key];
58
+ }
59
+ return { data: newData, locale };
60
+ } catch {
61
+ return { data: {}, locale };
62
+ }
63
+ })
64
+ );
65
+ }
66
+ };
67
+ export {
68
+ plugin as default
69
+ };
@@ -0,0 +1,5 @@
1
+ type InitializerProps = {
2
+ setPlugin: (id: string) => void;
3
+ };
4
+ declare const Initializer: ({ setPlugin }: InitializerProps) => null;
5
+ export { Initializer };
@@ -0,0 +1,2 @@
1
+ declare const PluginIcon: () => import("react").JSX.Element;
2
+ export { PluginIcon };
@@ -0,0 +1,3 @@
1
+ import { StrapiApp } from '@strapi/strapi/admin';
2
+ declare const plugin: StrapiApp["appPlugins"][string];
3
+ export default plugin;
@@ -0,0 +1,2 @@
1
+ declare const App: () => import("react").JSX.Element;
2
+ export default App;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const HomePage: () => React.JSX.Element;
3
+ export { HomePage };
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_ID = "recycle-bin";
@@ -0,0 +1,2 @@
1
+ declare const getTranslation: (id: string) => string;
2
+ export { getTranslation };