@upsnap/strapi 1.0.1 → 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.
@@ -6616,6 +6616,11 @@ function APIToken() {
6616
6616
  method: "POST",
6617
6617
  data: { token }
6618
6618
  }).then((res) => {
6619
+ if (!res.ok) {
6620
+ reactToastify.toast.error(res.error || "Failed to save token");
6621
+ setLoading(false);
6622
+ return;
6623
+ }
6619
6624
  reactToastify.toast.success("Token saved successfully");
6620
6625
  navigate("/plugins/upsnap/dashboard");
6621
6626
  });
@@ -7344,7 +7349,7 @@ const IntegrationsPage = () => {
7344
7349
  marginBottom: 6,
7345
7350
  children: [
7346
7351
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, children: [
7347
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: "Integrations" }),
7352
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", children: "Integrations" }),
7348
7353
  planLimits && /* @__PURE__ */ jsxRuntime.jsx(
7349
7354
  designSystem.Box,
7350
7355
  {
@@ -8343,10 +8348,10 @@ function Dashboard() {
8343
8348
  };
8344
8349
  React.useEffect(() => {
8345
8350
  handleRefresh();
8346
- }, [monitorId]);
8351
+ }, [monitorId, selectedRegion]);
8347
8352
  React.useEffect(() => {
8348
8353
  getRegionResponseTimeData();
8349
- }, [responseTimeData]);
8354
+ }, [responseTimeData, selectedRegion]);
8350
8355
  const handleRefresh = () => {
8351
8356
  const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
8352
8357
  setIsLoading(true);
@@ -9156,6 +9161,10 @@ function SecurityCertificates() {
9156
9161
  React.useEffect(() => {
9157
9162
  setLoading(true);
9158
9163
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9164
+ if (res?.monitor?.message === "Invalid authentication token") {
9165
+ setSelectedMonitor(null);
9166
+ navigate("/plugins/upsnap/settings");
9167
+ }
9159
9168
  setSelectedMonitor(res.monitor?.data || null);
9160
9169
  setLoading(false);
9161
9170
  });
@@ -9486,6 +9495,10 @@ function BrokenLinks() {
9486
9495
  React.useEffect(() => {
9487
9496
  setLoading(true);
9488
9497
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9498
+ if (res?.monitor?.message === "Invalid authentication token") {
9499
+ setSelectedMonitor(null);
9500
+ navigate("/plugins/upsnap/settings");
9501
+ }
9489
9502
  setSelectedMonitor(res.monitor?.data || null);
9490
9503
  setLoading(false);
9491
9504
  });
@@ -9696,6 +9709,10 @@ function Lighthouse() {
9696
9709
  React.useEffect(() => {
9697
9710
  setLoading(true);
9698
9711
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9712
+ if (res?.monitor?.message === "Invalid authentication token") {
9713
+ setSelectedMonitor(null);
9714
+ navigate("/plugins/upsnap/settings");
9715
+ }
9699
9716
  setSelectedMonitor(res.monitor?.data || null);
9700
9717
  setLoading(false);
9701
9718
  });
@@ -9900,6 +9917,10 @@ function DomainCheck() {
9900
9917
  React.useEffect(() => {
9901
9918
  setLoading(true);
9902
9919
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9920
+ if (res?.monitor?.message === "Invalid authentication token") {
9921
+ setSelectedMonitor(null);
9922
+ navigate("/plugins/upsnap/settings");
9923
+ }
9903
9924
  setSelectedMonitor(res.monitor?.data || null);
9904
9925
  setLoading(false);
9905
9926
  });
@@ -10009,6 +10030,10 @@ function MixedContent() {
10009
10030
  React.useEffect(() => {
10010
10031
  setLoading(true);
10011
10032
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
10033
+ if (res?.monitor?.message === "Invalid authentication token") {
10034
+ setSelectedMonitor(null);
10035
+ navigate("/plugins/upsnap/settings");
10036
+ }
10012
10037
  setSelectedMonitor(res.monitor?.data || null);
10013
10038
  setLoading(false);
10014
10039
  });
@@ -10209,7 +10234,7 @@ function ListStatusPages() {
10209
10234
  marginBottom: 6,
10210
10235
  children: [
10211
10236
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: [
10212
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", fontWeight: "bold", children: "Status Pages" }),
10237
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", children: "Status Pages" }),
10213
10238
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: "Manage your Status Pages" })
10214
10239
  ] }) }),
10215
10240
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}), onClick: handleAddStatusPage, variant: "tertiary", size: "S", children: "Add Status Page" })
@@ -10500,13 +10525,13 @@ function CreateStatusPage() {
10500
10525
  const handleBack = () => {
10501
10526
  navigate("/plugins/upsnap/status-pages");
10502
10527
  };
10503
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-mt-6", children: [
10504
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, marginBottom: 4, children: [
10528
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, padding: 2, alignItems: "start", children: [
10529
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, marginBottom: 2, children: [
10505
10530
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}),
10506
10531
  "Status Pages"
10507
10532
  ] }) }),
10508
10533
  /* @__PURE__ */ jsxRuntime.jsx(CreateUpdateForm, { mode: "create" })
10509
- ] });
10534
+ ] }) });
10510
10535
  }
10511
10536
  function UpdateStatusPage() {
10512
10537
  const { id } = reactRouterDom.useParams();
@@ -10538,13 +10563,13 @@ function UpdateStatusPage() {
10538
10563
  };
10539
10564
  fetchStatusPage();
10540
10565
  }, [id]);
10541
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tw-mt-6", children: [
10542
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, marginBottom: 4, children: [
10566
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {}) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, padding: 2, alignItems: "start", children: [
10567
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, marginBottom: 2, children: [
10543
10568
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}),
10544
10569
  "Status Pages"
10545
10570
  ] }) }),
10546
10571
  !loading && statusPage && /* @__PURE__ */ jsxRuntime.jsx(CreateUpdateForm, { mode: "edit", statusPage })
10547
- ] });
10572
+ ] }) });
10548
10573
  }
10549
10574
  function CreateMonitor() {
10550
10575
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(MonitorForm, { mode: "create", monitor: null }) });
@@ -6609,6 +6609,11 @@ function APIToken() {
6609
6609
  method: "POST",
6610
6610
  data: { token }
6611
6611
  }).then((res) => {
6612
+ if (!res.ok) {
6613
+ toast.error(res.error || "Failed to save token");
6614
+ setLoading(false);
6615
+ return;
6616
+ }
6612
6617
  toast.success("Token saved successfully");
6613
6618
  navigate("/plugins/upsnap/dashboard");
6614
6619
  });
@@ -7337,7 +7342,7 @@ const IntegrationsPage = () => {
7337
7342
  marginBottom: 6,
7338
7343
  children: [
7339
7344
  /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, children: [
7340
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Integrations" }),
7345
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", children: "Integrations" }),
7341
7346
  planLimits && /* @__PURE__ */ jsx(
7342
7347
  Box,
7343
7348
  {
@@ -8336,10 +8341,10 @@ function Dashboard() {
8336
8341
  };
8337
8342
  useEffect(() => {
8338
8343
  handleRefresh();
8339
- }, [monitorId]);
8344
+ }, [monitorId, selectedRegion]);
8340
8345
  useEffect(() => {
8341
8346
  getRegionResponseTimeData();
8342
- }, [responseTimeData]);
8347
+ }, [responseTimeData, selectedRegion]);
8343
8348
  const handleRefresh = () => {
8344
8349
  const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
8345
8350
  setIsLoading(true);
@@ -9149,6 +9154,10 @@ function SecurityCertificates() {
9149
9154
  useEffect(() => {
9150
9155
  setLoading(true);
9151
9156
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9157
+ if (res?.monitor?.message === "Invalid authentication token") {
9158
+ setSelectedMonitor(null);
9159
+ navigate("/plugins/upsnap/settings");
9160
+ }
9152
9161
  setSelectedMonitor(res.monitor?.data || null);
9153
9162
  setLoading(false);
9154
9163
  });
@@ -9479,6 +9488,10 @@ function BrokenLinks() {
9479
9488
  useEffect(() => {
9480
9489
  setLoading(true);
9481
9490
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9491
+ if (res?.monitor?.message === "Invalid authentication token") {
9492
+ setSelectedMonitor(null);
9493
+ navigate("/plugins/upsnap/settings");
9494
+ }
9482
9495
  setSelectedMonitor(res.monitor?.data || null);
9483
9496
  setLoading(false);
9484
9497
  });
@@ -9689,6 +9702,10 @@ function Lighthouse() {
9689
9702
  useEffect(() => {
9690
9703
  setLoading(true);
9691
9704
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9705
+ if (res?.monitor?.message === "Invalid authentication token") {
9706
+ setSelectedMonitor(null);
9707
+ navigate("/plugins/upsnap/settings");
9708
+ }
9692
9709
  setSelectedMonitor(res.monitor?.data || null);
9693
9710
  setLoading(false);
9694
9711
  });
@@ -9893,6 +9910,10 @@ function DomainCheck() {
9893
9910
  useEffect(() => {
9894
9911
  setLoading(true);
9895
9912
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
9913
+ if (res?.monitor?.message === "Invalid authentication token") {
9914
+ setSelectedMonitor(null);
9915
+ navigate("/plugins/upsnap/settings");
9916
+ }
9896
9917
  setSelectedMonitor(res.monitor?.data || null);
9897
9918
  setLoading(false);
9898
9919
  });
@@ -10002,6 +10023,10 @@ function MixedContent() {
10002
10023
  useEffect(() => {
10003
10024
  setLoading(true);
10004
10025
  request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
10026
+ if (res?.monitor?.message === "Invalid authentication token") {
10027
+ setSelectedMonitor(null);
10028
+ navigate("/plugins/upsnap/settings");
10029
+ }
10005
10030
  setSelectedMonitor(res.monitor?.data || null);
10006
10031
  setLoading(false);
10007
10032
  });
@@ -10202,7 +10227,7 @@ function ListStatusPages() {
10202
10227
  marginBottom: 6,
10203
10228
  children: [
10204
10229
  /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: [
10205
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", fontWeight: "bold", children: "Status Pages" }),
10230
+ /* @__PURE__ */ jsx(Typography, { variant: "beta", fontWeight: "bold", children: "Status Pages" }),
10206
10231
  /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: "Manage your Status Pages" })
10207
10232
  ] }) }),
10208
10233
  /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(Plus, {}), onClick: handleAddStatusPage, variant: "tertiary", size: "S", children: "Add Status Page" })
@@ -10493,13 +10518,13 @@ function CreateStatusPage() {
10493
10518
  const handleBack = () => {
10494
10519
  navigate("/plugins/upsnap/status-pages");
10495
10520
  };
10496
- return /* @__PURE__ */ jsxs("div", { className: "tw-mt-6", children: [
10497
- /* @__PURE__ */ jsx(Link$1, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, marginBottom: 4, children: [
10521
+ return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, padding: 2, alignItems: "start", children: [
10522
+ /* @__PURE__ */ jsx(Link$1, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, marginBottom: 2, children: [
10498
10523
  /* @__PURE__ */ jsx(ArrowLeft, {}),
10499
10524
  "Status Pages"
10500
10525
  ] }) }),
10501
10526
  /* @__PURE__ */ jsx(CreateUpdateForm, { mode: "create" })
10502
- ] });
10527
+ ] }) });
10503
10528
  }
10504
10529
  function UpdateStatusPage() {
10505
10530
  const { id } = useParams();
@@ -10531,13 +10556,13 @@ function UpdateStatusPage() {
10531
10556
  };
10532
10557
  fetchStatusPage();
10533
10558
  }, [id]);
10534
- return /* @__PURE__ */ jsxs("div", { className: "tw-mt-6", children: [
10535
- /* @__PURE__ */ jsx(Link$1, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, marginBottom: 4, children: [
10559
+ return /* @__PURE__ */ jsx(Main, { children: loading ? /* @__PURE__ */ jsx(LoadingCard, {}) : /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, padding: 2, alignItems: "start", children: [
10560
+ /* @__PURE__ */ jsx(Link$1, { onClick: handleBack, isExternal: false, children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 3, marginBottom: 2, children: [
10536
10561
  /* @__PURE__ */ jsx(ArrowLeft, {}),
10537
10562
  "Status Pages"
10538
10563
  ] }) }),
10539
10564
  !loading && statusPage && /* @__PURE__ */ jsx(CreateUpdateForm, { mode: "edit", statusPage })
10540
- ] });
10565
+ ] }) });
10541
10566
  }
10542
10567
  function CreateMonitor() {
10543
10568
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MonitorForm, { mode: "create", monitor: null }) });
@@ -38,7 +38,7 @@ const index = {
38
38
  defaultMessage: PLUGIN_ID
39
39
  },
40
40
  Component: async () => {
41
- const { App } = await Promise.resolve().then(() => require("./App--pwy8mra.js"));
41
+ const { App } = await Promise.resolve().then(() => require("./App-CWtrva1J.js"));
42
42
  return App;
43
43
  }
44
44
  });
@@ -36,7 +36,7 @@ const index = {
36
36
  defaultMessage: PLUGIN_ID
37
37
  },
38
38
  Component: async () => {
39
- const { App } = await import("./App-CCHfDIjc.mjs");
39
+ const { App } = await import("./App-gQQDdsJk.mjs");
40
40
  return App;
41
41
  }
42
42
  });
@@ -58,6 +58,14 @@ const settings = ({ strapi }) => ({
58
58
  },
59
59
  async set(ctx) {
60
60
  const { token } = ctx.request.body;
61
+ const isValidData = await service({ strapi }).makeBackendRequest("/tokens/validate", {
62
+ method: "POST",
63
+ body: JSON.stringify({ token })
64
+ });
65
+ if (!isValidData?.data?.valid) {
66
+ ctx.body = { ok: false, error: "Invalid token" };
67
+ return;
68
+ }
61
69
  const store = service({ strapi }).settingsStore;
62
70
  const current = await store.get() || {};
63
71
  await store.set({
@@ -56,6 +56,14 @@ const settings = ({ strapi }) => ({
56
56
  },
57
57
  async set(ctx) {
58
58
  const { token } = ctx.request.body;
59
+ const isValidData = await service({ strapi }).makeBackendRequest("/tokens/validate", {
60
+ method: "POST",
61
+ body: JSON.stringify({ token })
62
+ });
63
+ if (!isValidData?.data?.valid) {
64
+ ctx.body = { ok: false, error: "Invalid token" };
65
+ return;
66
+ }
59
67
  const store = service({ strapi }).settingsStore;
60
68
  const current = await store.get() || {};
61
69
  await store.set({
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.1",
2
+ "version": "1.0.2",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "https://github.com/Appfoster/upsnap-strapi"