strapi-plugin-radiocult-uploader 1.0.0 → 1.0.2

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 CHANGED
@@ -20,7 +20,7 @@ Built by [Sister Midnight FM](https://radio.sistermidnight.org/), a community ra
20
20
 
21
21
  ## Requirements
22
22
 
23
- - Strapi **v5**
23
+ - Strapi **v5** (any 5.x, including installs still on the `@strapi/design-system` 2.0.0-rc line)
24
24
  - Node **20+** (uploads stream files with `fs.openAsBlob`)
25
25
  - A Radio Cult station with API access; third-party publishing (SoundCloud/Mixcloud) needs a Radio Cult plan that includes the Connect endpoints (Premium/Business or the Connect add-on)
26
26
 
@@ -6,7 +6,7 @@ const reactRouterDom = require("react-router-dom");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const React = require("react");
8
8
  const styled = require("styled-components");
9
- const index = require("./index-BLAtUo_j.js");
9
+ const index = require("./index-D14SHuJI.js");
10
10
  const tokens = require("./tokens-CDeNcvZq.js");
11
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
12
  function _interopNamespace(e) {
@@ -4,7 +4,7 @@ import { useNavigate, useParams, Routes, Route } from "react-router-dom";
4
4
  import { Main, Typography, Box, Flex, Button } from "@strapi/design-system";
5
5
  import * as React from "react";
6
6
  import styled from "styled-components";
7
- import { f as fetchStatus, P as PLATFORMS, a as PLATFORM_LABEL, b as apiError, c as fetchUiConfig, s as saveTrackDetails, u as uploadTrack, p as publishTrack } from "./index-Dj3e3A79.mjs";
7
+ import { f as fetchStatus, P as PLATFORMS, a as PLATFORM_LABEL, b as apiError, c as fetchUiConfig, s as saveTrackDetails, u as uploadTrack, p as publishTrack } from "./index-MVv9-_DA.mjs";
8
8
  import { u as useGoogleFont, g as googleFontHref, r as resolveFont, t as themeToCssVars } from "./tokens-ACCekCH6.mjs";
9
9
  const HomePage = () => {
10
10
  const navigate = useNavigate();
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { Main, Typography, Flex, Box, Button, Grid, Field, TextInput, Toggle, SingleSelect, SingleSelectOption, Textarea } from "@strapi/design-system";
4
- import { d as fetchSettings, e as fetchContentTypes, g as fetchDiagnostics, b as apiError, h as saveSettings, t as testConnection } from "./index-Dj3e3A79.mjs";
4
+ import { d as fetchSettings, e as fetchContentTypes, g as fetchDiagnostics, b as apiError, h as saveSettings, t as testConnection } from "./index-MVv9-_DA.mjs";
5
5
  import { u as useGoogleFont, g as googleFontHref, r as resolveFont, a as resolveTokens, b as tokensToCssVars, P as PRESETS, F as FONTS, E as EDITABLE_TOKENS, p as pickEditableOverrides } from "./tokens-ACCekCH6.mjs";
6
6
  const MAPPING_FIELDS = [
7
7
  { key: "title", label: "Title", hint: "Track title on Radio Cult", types: ["string", "text"], required: true },
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
- const index = require("./index-BLAtUo_j.js");
6
+ const index = require("./index-D14SHuJI.js");
7
7
  const tokens = require("./tokens-CDeNcvZq.js");
8
8
  function _interopNamespace(e) {
9
9
  if (e && e.__esModule) return e;
@@ -232,19 +232,28 @@ const PanelContent = ({ documentId }) => {
232
232
  const PANEL_TITLE = "Upload to Soundcloud/​Mixcloud/​Radio Cult";
233
233
  let configuredType;
234
234
  let configPromise = null;
235
- const ensureConfigLoaded = () => {
235
+ const loadConfig = () => {
236
236
  configPromise ?? (configPromise = fetchUiConfig().then(({ contentType }) => {
237
237
  configuredType = contentType;
238
238
  }).catch(() => {
239
239
  configuredType = null;
240
240
  }));
241
+ return configPromise;
241
242
  };
242
243
  const RadioCultPanel = (props) => {
243
- if (configuredType === void 0) {
244
- ensureConfigLoaded();
245
- return null;
246
- }
247
- if (configuredType !== props.model) return null;
244
+ const [resolvedType, setResolvedType] = React__namespace.useState(configuredType);
245
+ React__namespace.useEffect(() => {
246
+ if (configuredType !== void 0) return;
247
+ let active = true;
248
+ loadConfig().finally(() => {
249
+ if (active) setResolvedType(configuredType);
250
+ });
251
+ return () => {
252
+ active = false;
253
+ };
254
+ }, []);
255
+ if (resolvedType === void 0) return null;
256
+ if (resolvedType !== props.model) return null;
248
257
  if (!props.documentId) {
249
258
  return {
250
259
  title: PANEL_TITLE,
@@ -265,7 +274,7 @@ const plugin = {
265
274
  id: `${PLUGIN_ID}.plugin.name`,
266
275
  defaultMessage: "Radio Cult Uploader"
267
276
  },
268
- Component: () => Promise.resolve().then(() => require("./App-DTOuR7aY.js")),
277
+ Component: () => Promise.resolve().then(() => require("./App-BF6sl43A.js")),
269
278
  permissions: []
270
279
  });
271
280
  app.createSettingSection(
@@ -284,7 +293,7 @@ const plugin = {
284
293
  },
285
294
  id: `${PLUGIN_ID}-settings`,
286
295
  to: `radiocult-uploader`,
287
- Component: () => Promise.resolve().then(() => require("./Settings-DHv9SmRU.js")),
296
+ Component: () => Promise.resolve().then(() => require("./Settings-qalA-Gda.js")),
288
297
  permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }]
289
298
  }
290
299
  ]
@@ -214,19 +214,28 @@ const PanelContent = ({ documentId }) => {
214
214
  const PANEL_TITLE = "Upload to Soundcloud/​Mixcloud/​Radio Cult";
215
215
  let configuredType;
216
216
  let configPromise = null;
217
- const ensureConfigLoaded = () => {
217
+ const loadConfig = () => {
218
218
  configPromise ?? (configPromise = fetchUiConfig().then(({ contentType }) => {
219
219
  configuredType = contentType;
220
220
  }).catch(() => {
221
221
  configuredType = null;
222
222
  }));
223
+ return configPromise;
223
224
  };
224
225
  const RadioCultPanel = (props) => {
225
- if (configuredType === void 0) {
226
- ensureConfigLoaded();
227
- return null;
228
- }
229
- if (configuredType !== props.model) return null;
226
+ const [resolvedType, setResolvedType] = React.useState(configuredType);
227
+ React.useEffect(() => {
228
+ if (configuredType !== void 0) return;
229
+ let active = true;
230
+ loadConfig().finally(() => {
231
+ if (active) setResolvedType(configuredType);
232
+ });
233
+ return () => {
234
+ active = false;
235
+ };
236
+ }, []);
237
+ if (resolvedType === void 0) return null;
238
+ if (resolvedType !== props.model) return null;
230
239
  if (!props.documentId) {
231
240
  return {
232
241
  title: PANEL_TITLE,
@@ -247,7 +256,7 @@ const plugin = {
247
256
  id: `${PLUGIN_ID}.plugin.name`,
248
257
  defaultMessage: "Radio Cult Uploader"
249
258
  },
250
- Component: () => import("./App-Cd-TZrqC.mjs"),
259
+ Component: () => import("./App-CyfM4LcR.mjs"),
251
260
  permissions: []
252
261
  });
253
262
  app.createSettingSection(
@@ -266,7 +275,7 @@ const plugin = {
266
275
  },
267
276
  id: `${PLUGIN_ID}-settings`,
268
277
  to: `radiocult-uploader`,
269
- Component: () => import("./Settings-B3cZR7VF.mjs"),
278
+ Component: () => import("./Settings-kAsf9BQP.mjs"),
270
279
  permissions: [{ action: `plugin::${PLUGIN_ID}.settings`, subject: null }]
271
280
  }
272
281
  ]
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-BLAtUo_j.js");
3
+ const index = require("./index-D14SHuJI.js");
4
4
  exports.default = index.plugin;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-Dj3e3A79.mjs";
1
+ import { i } from "./index-MVv9-_DA.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -5,9 +5,13 @@
5
5
  */
6
6
  import * as React from 'react';
7
7
  /**
8
- * PanelComponent for content-manager's addEditViewSidePanel. Called as a
9
- * plain function during render — it must not use hooks itself; everything
10
- * stateful lives in the components above.
8
+ * PanelComponent for content-manager's addEditViewSidePanel.
9
+ *
10
+ * content-manager calls this inside a React component (see its
11
+ * DescriptionComponentRenderer), so hooks are allowed here — and they are
12
+ * required: that wrapper is memoised on props, so a panel that returns null
13
+ * while its config loads is never re-rendered when the config arrives. The
14
+ * state update below is what brings the panel back.
11
15
  */
12
16
  export declare const RadioCultPanel: (props: {
13
17
  model: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.0.2",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -65,14 +65,14 @@
65
65
  "yalc": "^1.0.0-pre.53"
66
66
  },
67
67
  "peerDependencies": {
68
- "@strapi/design-system": "^2.0.0",
69
- "@strapi/icons": "^2.0.0",
68
+ "@strapi/design-system": "^2.0.0-rc.29",
69
+ "@strapi/icons": "^2.0.0-rc.29",
70
70
  "@strapi/strapi": "^5.0.0",
71
- "react": "^18.3.1",
72
- "react-dom": "^18.3.1",
73
- "react-intl": "^6.8.9",
74
- "react-router-dom": "^6.30.4",
75
- "styled-components": "^6.5.2"
71
+ "react": "^17.0.0 || ^18.0.0",
72
+ "react-dom": "^17.0.0 || ^18.0.0",
73
+ "react-intl": "^6.6.2",
74
+ "react-router-dom": "^6.0.0",
75
+ "styled-components": "^6.0.0"
76
76
  },
77
77
  "strapi": {
78
78
  "kind": "plugin",