strapi-plugin-magic-sessionmanager 4.2.16 → 4.3.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.
@@ -1,9 +1,9 @@
1
- import { useEffect, useState } from "react";
1
+ import { useRef, useEffect, useState } from "react";
2
+ import { useFetchClient, useNotification } from "@strapi/strapi/admin";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  import { useIntl } from "react-intl";
4
5
  import { Box, Typography, Flex, Badge, Divider, Button } from "@strapi/design-system";
5
6
  import { Server, Clock, Cross, Check, Phone, Monitor } from "@strapi/icons";
6
- import { useFetchClient, useNotification } from "@strapi/strapi/admin";
7
7
  const strapi = {
8
8
  name: "magic-sessionmanager",
9
9
  displayName: "Magic Sessionmanager"
@@ -13,10 +13,29 @@ const pluginPkg = {
13
13
  };
14
14
  const pluginId = "magic-sessionmanager";
15
15
  const PLUGIN_ID = pluginId;
16
- const Initializer = () => {
16
+ const Initializer = ({ setPlugin }) => {
17
+ const ref = useRef(setPlugin);
18
+ const { get } = useFetchClient();
17
19
  useEffect(() => {
18
- console.log("[magic-sessionmanager] Plugin initialized");
20
+ if (ref.current) {
21
+ ref.current(pluginId);
22
+ }
19
23
  }, []);
24
+ useEffect(() => {
25
+ const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
26
+ const heartbeat = async () => {
27
+ try {
28
+ await get(`/${pluginId}/license/status`);
29
+ } catch (error) {
30
+ }
31
+ };
32
+ const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
33
+ const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
34
+ return () => {
35
+ clearTimeout(initialTimeout);
36
+ clearInterval(interval);
37
+ };
38
+ }, [get]);
20
39
  return null;
21
40
  };
22
41
  const PluginIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 32 32", fill: "currentColor", width: "24", height: "24", children: /* @__PURE__ */ jsx("path", { d: "M26 5H6a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h20a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3M20 27h-8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2" }) });
@@ -396,7 +415,7 @@ const index = {
396
415
  id: `${pluginId}.plugin.name`,
397
416
  defaultMessage: pluginPkg.strapi.displayName
398
417
  },
399
- Component: () => import("./App-CahdcIEB.mjs")
418
+ Component: () => import("./App-Bgq2FgRY.mjs")
400
419
  });
401
420
  app.createSettingSection(
402
421
  {
@@ -412,7 +431,7 @@ const index = {
412
431
  },
413
432
  id: "upgrade",
414
433
  to: `${pluginId}/upgrade`,
415
- Component: () => import("./UpgradePage-mqr6dLVY.mjs")
434
+ Component: () => import("./UpgradePage-B_2RowKN.mjs")
416
435
  },
417
436
  {
418
437
  intlLabel: {
@@ -421,7 +440,7 @@ const index = {
421
440
  },
422
441
  id: "general",
423
442
  to: `${pluginId}/general`,
424
- Component: () => import("./Settings-DOUUwwxB.mjs")
443
+ Component: () => import("./Settings-B3FaQckW.mjs")
425
444
  },
426
445
  {
427
446
  intlLabel: {
@@ -430,7 +449,7 @@ const index = {
430
449
  },
431
450
  id: "analytics",
432
451
  to: `${pluginId}/analytics`,
433
- Component: () => import("./Analytics-BC4jdzBT.mjs")
452
+ Component: () => import("./Analytics-CYYb-qXQ.mjs")
434
453
  },
435
454
  {
436
455
  intlLabel: {
@@ -439,7 +458,7 @@ const index = {
439
458
  },
440
459
  id: "license",
441
460
  to: `${pluginId}/license`,
442
- Component: () => import("./License-BFx721o7.mjs")
461
+ Component: () => import("./License-CcD3WDcC.mjs")
443
462
  }
444
463
  ]
445
464
  );
@@ -457,7 +476,7 @@ const index = {
457
476
  defaultMessage: "Online Users"
458
477
  },
459
478
  component: async () => {
460
- const component = await import("./OnlineUsersWidget-r2ZgSnok.mjs");
479
+ const component = await import("./OnlineUsersWidget-DHElrP3_.mjs");
461
480
  return component.default;
462
481
  },
463
482
  id: "online-users-widget",
@@ -1,6 +1,6 @@
1
1
  import { useState, useEffect } from "react";
2
2
  import { useFetchClient } from "@strapi/strapi/admin";
3
- import { a as pluginId } from "./index-CUSrDKCG.mjs";
3
+ import { a as pluginId } from "./index-Dpdcg2zl.mjs";
4
4
  const useLicense = () => {
5
5
  const { get } = useFetchClient();
6
6
  const [isPremium, setIsPremium] = useState(false);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const react = require("react");
3
3
  const admin = require("@strapi/strapi/admin");
4
- const index = require("./index-BuxWeACw.js");
4
+ const index = require("./index-Cf1Wqdeg.js");
5
5
  const useLicense = () => {
6
6
  const { get } = admin.useFetchClient();
7
7
  const [isPremium, setIsPremium] = react.useState(false);
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-BuxWeACw.js");
2
+ const index = require("../_chunks/index-Cf1Wqdeg.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-CUSrDKCG.mjs";
1
+ import { i } from "../_chunks/index-Dpdcg2zl.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -2434,7 +2434,7 @@ var session$1 = ({ strapi: strapi2 }) => {
2434
2434
  }
2435
2435
  };
2436
2436
  };
2437
- const version = "4.2.15";
2437
+ const version = "4.2.16";
2438
2438
  const require$$2 = {
2439
2439
  version
2440
2440
  };
@@ -2430,7 +2430,7 @@ var session$1 = ({ strapi: strapi2 }) => {
2430
2430
  }
2431
2431
  };
2432
2432
  };
2433
- const version = "4.2.15";
2433
+ const version = "4.2.16";
2434
2434
  const require$$2 = {
2435
2435
  version
2436
2436
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.2.16",
2
+ "version": "4.3.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",