@upsnap/strapi 1.0.11 → 1.0.14

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.
@@ -7,66 +7,14 @@ const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const React = require("react");
9
9
  const reactToastify = require("react-toastify");
10
- const axios = require("axios");
10
+ const index = require("./index-BWyzuEFm.js");
11
11
  const styled = require("styled-components");
12
12
  const Chart = require("react-apexcharts");
13
13
  require("react-toastify/dist/ReactToastify.css");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const React__default = /* @__PURE__ */ _interopDefault(React);
16
- const axios__default = /* @__PURE__ */ _interopDefault(axios);
17
16
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
18
17
  const Chart__default = /* @__PURE__ */ _interopDefault(Chart);
19
- const SideNav = () => {
20
- const CustomSubNavLink = designSystem.SubNavLink;
21
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNav, { "aria-label": "Upsnap navigation", children: [
22
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavHeader, { label: "Upsnap" }),
23
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNavSection, { label: "", children: [
24
- /* @__PURE__ */ jsxRuntime.jsx(
25
- CustomSubNavLink,
26
- {
27
- as: reactRouterDom.NavLink,
28
- to: `dashboard`,
29
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.House, {}),
30
- padding: 2,
31
- marginBottom: 1,
32
- marginLeft: 2,
33
- style: { marginLeft: "10px", marginBottom: "10px" },
34
- children: "Dashboard"
35
- }
36
- ),
37
- /* @__PURE__ */ jsxRuntime.jsx(
38
- CustomSubNavLink,
39
- {
40
- as: reactRouterDom.NavLink,
41
- to: `incidents`,
42
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.BulletList, {}),
43
- style: { marginLeft: "10px", marginBottom: "10px" },
44
- children: "Incidents"
45
- }
46
- ),
47
- /* @__PURE__ */ jsxRuntime.jsx(
48
- CustomSubNavLink,
49
- {
50
- as: reactRouterDom.NavLink,
51
- to: `status-pages`,
52
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Monitor, {}),
53
- style: { marginLeft: "10px", marginBottom: "10px" },
54
- children: "Status Pages"
55
- }
56
- ),
57
- /* @__PURE__ */ jsxRuntime.jsx(
58
- CustomSubNavLink,
59
- {
60
- as: reactRouterDom.NavLink,
61
- to: `settings`,
62
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cog, {}),
63
- style: { marginLeft: "10px", marginBottom: "10px" },
64
- children: "Settings"
65
- }
66
- )
67
- ] })
68
- ] });
69
- };
70
18
  const PLAN_TYPES = {
71
19
  FREE: "free",
72
20
  PRO: "pro",
@@ -202,248 +150,56 @@ const generateRandomColor = () => {
202
150
  ];
203
151
  return colors2[Math.floor(Math.random() * colors2.length)];
204
152
  };
205
- const STORAGE_KEY = "selectedMonitor";
206
- function getUserData() {
207
- if (typeof window === "undefined") return null;
208
- try {
209
- const userDataString = localStorage.getItem("userDetails");
210
- if (!userDataString) return null;
211
- const userData = JSON.parse(userDataString);
212
- return userData;
213
- } catch (error) {
214
- console.error("Error parsing userData from localStorage:", error);
215
- return null;
216
- }
217
- }
218
- async function getUserDetailsCached(forceFetchFromMicroservice = false) {
219
- if (typeof window === "undefined") return null;
220
- try {
221
- const userDetailsString = localStorage.getItem("userDetails");
222
- if (!userDetailsString) return null;
223
- if (!forceFetchFromMicroservice) {
224
- try {
225
- const cached2 = JSON.parse(userDetailsString);
226
- if (cached2.updated_at) {
227
- const cachedTime = Date.parse(cached2.updated_at);
228
- if (!isNaN(cachedTime)) {
229
- const ageMs = Date.now() - cachedTime;
230
- if (ageMs < 5 * 60 * 1e3) {
231
- return cached2;
232
- }
233
- }
153
+ const SideNav = () => {
154
+ const CustomSubNavLink = designSystem.SubNavLink;
155
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNav, { "aria-label": "Upsnap navigation", children: [
156
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavHeader, { label: "Upsnap" }),
157
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNavSection, { label: "", children: [
158
+ /* @__PURE__ */ jsxRuntime.jsx(
159
+ CustomSubNavLink,
160
+ {
161
+ as: reactRouterDom.NavLink,
162
+ to: `dashboard`,
163
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.House, {}),
164
+ padding: 2,
165
+ marginBottom: 1,
166
+ marginLeft: 2,
167
+ style: { marginLeft: "10px", marginBottom: "10px" },
168
+ children: "Dashboard"
234
169
  }
235
- } catch (e) {
236
- console.error("Error parsing cached user details:", e);
237
- }
238
- }
239
- const data = await getUserDetails();
240
- if (!data) {
241
- return null;
242
- }
243
- setUserDetails(data);
244
- return data;
245
- } catch (error) {
246
- console.error("Error parsing userDetails from localStorage:", error);
247
- return null;
248
- }
249
- }
250
- function setUserDetails(details) {
251
- if (typeof window === "undefined") return;
252
- try {
253
- const toStore = { ...details, updated_at: (/* @__PURE__ */ new Date()).toISOString() };
254
- localStorage.setItem("userDetails", JSON.stringify(toStore));
255
- } catch (error) {
256
- console.error("Error storing userDetails in localStorage:", error);
257
- }
258
- }
259
- const clearAllStoredMonitors = () => {
260
- if (typeof window === "undefined") return;
261
- Object.keys(localStorage).forEach((key) => {
262
- if (key.startsWith(`${STORAGE_KEY}`)) {
263
- localStorage.removeItem(key);
264
- }
265
- });
266
- };
267
- const request = async (url, options = {}) => {
268
- const response = await axios__default.default({
269
- url: `/upsnap${url}`,
270
- ...options
271
- });
272
- if (options?.responseType === "blob") {
273
- return response;
274
- }
275
- return response.data;
276
- };
277
- const formatDate = (dateString) => {
278
- const date2 = new Date(dateString);
279
- if (isNaN(date2.getTime())) {
280
- return "N/A";
281
- }
282
- return date2.toLocaleString(void 0, {
283
- year: "numeric",
284
- month: "2-digit",
285
- day: "2-digit",
286
- hour: "2-digit",
287
- minute: "2-digit",
288
- second: "2-digit",
289
- hour12: false
290
- });
291
- };
292
- const formatTitleToUppercase = (title) => {
293
- const words = title.split("_");
294
- const capitalizedWords = words.map((word) => word.charAt(0).toUpperCase() + word.slice(1));
295
- return capitalizedWords.join(" ");
296
- };
297
- const getRangeTimestamps = (range) => {
298
- const now = Math.floor(Date.now() / 1e3);
299
- const ranges = {
300
- last_hour: 60 * 60,
301
- last_24_hours: 60 * 60 * 24,
302
- last_7_days: 60 * 60 * 24 * 7,
303
- last_30_days: 60 * 60 * 24 * 30,
304
- last_year: 60 * 60 * 24 * 365
305
- };
306
- const duration2 = ranges[range];
307
- return {
308
- start: now - duration2,
309
- end: now
310
- };
311
- };
312
- const formatCheckType = (key) => {
313
- if (!key) return "";
314
- const k = String(key).toLowerCase().trim();
315
- const exceptions = ["ssl"];
316
- if (exceptions.includes(k)) return k.toUpperCase();
317
- const parts = k.split("_").filter(Boolean);
318
- return parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
319
- };
320
- function formatDateTime(isoTimestamp) {
321
- if (!isoTimestamp) return "-";
322
- const date2 = new Date(isoTimestamp);
323
- return new Intl.DateTimeFormat("en-US", {
324
- dateStyle: "medium",
325
- timeStyle: "short"
326
- }).format(date2);
327
- }
328
- const getUserDetails = async () => {
329
- try {
330
- const result = await request("/user/details", {
331
- method: "GET"
332
- });
333
- if (!result || result?.userDetailsData?.status !== "success") {
334
- console.error("Failed to fetch user details");
335
- } else {
336
- setUserDetails(result?.userDetailsData.data);
337
- return result?.userDetailsData.data;
338
- }
339
- return null;
340
- } catch (error) {
341
- console.error("Error while fetching user details ", error);
342
- return null;
343
- }
344
- };
345
- async function fetchMonitorSettings(monitorId) {
346
- try {
347
- const result = await request(`/monitor/settings/${monitorId}`);
348
- if (!result) {
349
- console.error("Failed to fetch monitor settings");
350
- return null;
351
- }
352
- if (result?.monitorSettingsData?.status === "success" && result?.monitorSettingsData?.data) {
353
- return {
354
- monitor_id: result.monitorSettingsData.data.monitor_id,
355
- settings: result.monitorSettingsData.data.settings
356
- };
357
- }
358
- console.error("Invalid response from monitor settings API:", result);
359
- return null;
360
- } catch (error) {
361
- console.error("Error fetching monitor settings:", error);
362
- return null;
363
- }
364
- }
365
- function settingsToConfig(settings) {
366
- return {
367
- meta: settings.meta,
368
- services: settings.services
369
- };
370
- }
371
- async function setPrimaryMonitorId(monitorId) {
372
- try {
373
- const result = await request(`/settings/set-primary-monitor-id`, {
374
- method: "POST",
375
- data: { monitorId }
376
- });
377
- if (!result) return false;
378
- if (result?.ok) {
379
- return true;
380
- }
381
- return false;
382
- } catch (error) {
383
- console.error("Error setting primary monitor ID:", error);
384
- return false;
385
- }
386
- }
387
- async function getPrimaryMonitorId() {
388
- try {
389
- const result = await request(`/settings/get-primary-monitor-id`, {
390
- method: "GET"
391
- });
392
- if (!result) return null;
393
- if (result?.primaryMonitorId) {
394
- return result.primaryMonitorId;
395
- }
396
- console.error("Failed to get primary monitor ID:", result);
397
- return null;
398
- } catch (error) {
399
- console.error("Error getting primary monitor ID:", error);
400
- return null;
401
- }
402
- }
403
- async function handleLogout() {
404
- try {
405
- await setPrimaryMonitorId("");
406
- const res = await request("/settings", {
407
- method: "POST",
408
- data: { token: null, logOut: true }
409
- });
410
- if (res.ok) {
411
- return true;
412
- }
413
- return false;
414
- } catch (err) {
415
- console.log("Error while logging out ", err);
416
- return;
417
- }
418
- }
419
- const fetchRegionsData = async () => {
420
- try {
421
- const result = await request(`/regions`);
422
- if (!result) return [];
423
- if (result?.regionsData?.status === "success" && Array.isArray(result?.regionsData?.data)) {
424
- return result?.regionsData?.data;
425
- }
426
- return [];
427
- } catch (error) {
428
- console.error("Error fetching regions:", error);
429
- return [];
430
- }
431
- };
432
- const fetchTags = async (setIsLoading, setTags) => {
433
- setIsLoading(true);
434
- try {
435
- const result = await request("/tags", {
436
- method: "GET"
437
- });
438
- if (!result?.tagsData) {
439
- throw new Error("Failed to fetch tags");
440
- }
441
- setTags(result?.tagsData?.data);
442
- } catch (error) {
443
- console.error("Error fetching tags:", error);
444
- } finally {
445
- setIsLoading(false);
446
- }
170
+ ),
171
+ /* @__PURE__ */ jsxRuntime.jsx(
172
+ CustomSubNavLink,
173
+ {
174
+ as: reactRouterDom.NavLink,
175
+ to: `incidents`,
176
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.BulletList, {}),
177
+ style: { marginLeft: "10px", marginBottom: "10px" },
178
+ children: "Incidents"
179
+ }
180
+ ),
181
+ /* @__PURE__ */ jsxRuntime.jsx(
182
+ CustomSubNavLink,
183
+ {
184
+ as: reactRouterDom.NavLink,
185
+ to: `status-pages`,
186
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Monitor, {}),
187
+ style: { marginLeft: "10px", marginBottom: "10px" },
188
+ children: "Status Pages"
189
+ }
190
+ ),
191
+ /* @__PURE__ */ jsxRuntime.jsx(
192
+ CustomSubNavLink,
193
+ {
194
+ as: reactRouterDom.NavLink,
195
+ to: `settings`,
196
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cog, {}),
197
+ style: { marginLeft: "10px", marginBottom: "10px" },
198
+ children: "Settings"
199
+ }
200
+ )
201
+ ] })
202
+ ] });
447
203
  };
448
204
  function MonitorsTable({
449
205
  monitors = [],
@@ -459,12 +215,12 @@ function MonitorsTable({
459
215
  const [availableTags, setAvailableTags] = React.useState([]);
460
216
  const navigate = reactRouterDom.useNavigate();
461
217
  React.useEffect(() => {
462
- fetchTags(setLoading, setAvailableTags);
218
+ index.fetchTags(setLoading, setAvailableTags);
463
219
  }, [monitors]);
464
220
  React.useEffect(() => {
465
221
  async function fetchPrimaryMonitorId() {
466
222
  try {
467
- const id = await getPrimaryMonitorId();
223
+ const id = await index.getPrimaryMonitorId();
468
224
  if (id) setPrimaryMonitorIdState(id);
469
225
  } catch (err) {
470
226
  console.error("Error fetching primary monitor ID:", err);
@@ -500,7 +256,7 @@ function MonitorsTable({
500
256
  }, [selected, onChange]);
501
257
  const handleSetPrimary = async (monitor) => {
502
258
  try {
503
- const result = await setPrimaryMonitorId(monitor.id);
259
+ const result = await index.setPrimaryMonitorId(monitor.id);
504
260
  if (result) {
505
261
  reactToastify.toast.success("Primary monitor set successfully");
506
262
  setPrimaryMonitorIdState(monitor.id);
@@ -529,7 +285,7 @@ function MonitorsTable({
529
285
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "Status" }) }),
530
286
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: "Actions" }) })
531
287
  ] }) }),
532
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: monitors.map((monitor, index) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
288
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: monitors.map((monitor, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
533
289
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
534
290
  designSystem.Checkbox,
535
291
  {
@@ -552,7 +308,7 @@ function MonitorsTable({
552
308
  ),
553
309
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: monitor.config.meta.url }),
554
310
  monitor.tag_ids && monitor.tag_ids.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { wrap: "wrap", gap: 1, width: "300px", children: monitor.tag_ids.map((tagId) => {
555
- const tag = availableTags.find((tag2) => tag2.id === tagId);
311
+ const tag = availableTags?.find((tag2) => tag2.id === tagId);
556
312
  if (!tag) return null;
557
313
  return /* @__PURE__ */ jsxRuntime.jsx(
558
314
  designSystem.Badge,
@@ -2143,11 +1899,11 @@ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
2143
1899
  return payload;
2144
1900
  };
2145
1901
  });
2146
- function handleArrayResult(result, final, index) {
1902
+ function handleArrayResult(result, final, index2) {
2147
1903
  if (result.issues.length) {
2148
- final.issues.push(...prefixIssues(index, result.issues));
1904
+ final.issues.push(...prefixIssues(index2, result.issues));
2149
1905
  }
2150
- final.value[index] = result.value;
1906
+ final.value[index2] = result.value;
2151
1907
  }
2152
1908
  const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
2153
1909
  $ZodType.init(inst, def);
@@ -2518,14 +2274,14 @@ function mergeValues(a, b) {
2518
2274
  return { valid: false, mergeErrorPath: [] };
2519
2275
  }
2520
2276
  const newArray = [];
2521
- for (let index = 0; index < a.length; index++) {
2522
- const itemA = a[index];
2523
- const itemB = b[index];
2277
+ for (let index2 = 0; index2 < a.length; index2++) {
2278
+ const itemA = a[index2];
2279
+ const itemB = b[index2];
2524
2280
  const sharedValue = mergeValues(itemA, itemB);
2525
2281
  if (!sharedValue.valid) {
2526
2282
  return {
2527
2283
  valid: false,
2528
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
2284
+ mergeErrorPath: [index2, ...sharedValue.mergeErrorPath]
2529
2285
  };
2530
2286
  }
2531
2287
  newArray.push(sharedValue.data);
@@ -5208,7 +4964,7 @@ function AdvancedSettings({
5208
4964
  React.useEffect(() => {
5209
4965
  async function fetchUser() {
5210
4966
  try {
5211
- const details = await getUserDetailsCached(true);
4967
+ const details = await index.getUserDetailsCached(true);
5212
4968
  const minIntervalMins = details?.plan_limits?.min_monitoring_interval;
5213
4969
  setMinMonitoringInterval(minIntervalMins ? minIntervalMins * 60 : 300);
5214
4970
  setUserPlan(details?.user?.subscription_type || PLAN_TYPES.TRIAL);
@@ -5397,9 +5153,9 @@ const NotificationIcon = ({ className = "" }) => /* @__PURE__ */ jsxRuntime.jsxs
5397
5153
  const getIntegrationIcon = (iconName, className = "tw-w-6 tw-h-6") => {
5398
5154
  return /* @__PURE__ */ jsxRuntime.jsx(NotificationIcon, { className });
5399
5155
  };
5400
- const DEFAULT_EMAIL = getUserData()?.user?.email ?? "";
5156
+ const DEFAULT_EMAIL = index.getUserData()?.user?.email ?? "";
5401
5157
  async function apiGetChannels() {
5402
- const res = await request("/notification-channels", {
5158
+ const res = await index.request("/notification-channels", {
5403
5159
  method: "GET"
5404
5160
  });
5405
5161
  if (!res) return;
@@ -5407,7 +5163,7 @@ async function apiGetChannels() {
5407
5163
  return res.notificationChannelsData.data;
5408
5164
  }
5409
5165
  async function apiCreateChannel(payload) {
5410
- const res = await request("/notification-channels", {
5166
+ const res = await index.request("/notification-channels", {
5411
5167
  method: "POST",
5412
5168
  data: payload
5413
5169
  });
@@ -5456,7 +5212,7 @@ function NotificationChannelsIntegration({
5456
5212
  }
5457
5213
  }
5458
5214
  load();
5459
- getUserDetails();
5215
+ index.getUserDetails();
5460
5216
  }, []);
5461
5217
  const toggle = async (row) => {
5462
5218
  if (row.isDefaultEmail && row.id === null) {
@@ -5613,12 +5369,12 @@ const TagMultiSelect = ({
5613
5369
  const dropdownRef = React.useRef(null);
5614
5370
  const inputRef = React.useRef(null);
5615
5371
  React.useEffect(() => {
5616
- fetchTags(setIsLoading, setAvailableTags);
5372
+ index.fetchTags(setIsLoading, setAvailableTags);
5617
5373
  }, []);
5618
5374
  const createTag = async (tagName) => {
5619
5375
  setIsCreating(true);
5620
5376
  try {
5621
- const result = await request(apiEndpoint, {
5377
+ const result = await index.request(apiEndpoint, {
5622
5378
  method: "POST",
5623
5379
  data: {
5624
5380
  name: tagName,
@@ -5717,7 +5473,7 @@ const TagMultiSelect = ({
5717
5473
  border: `1px solid ${tag.color}40`
5718
5474
  },
5719
5475
  children: [
5720
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", style: { color: tag.color }, children: formatTitleToUppercase(tag.name) }),
5476
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", style: { color: tag.color }, children: index.formatTitleToUppercase(tag.name) }),
5721
5477
  /* @__PURE__ */ jsxRuntime.jsx(
5722
5478
  designSystem.IconButton,
5723
5479
  {
@@ -5806,7 +5562,7 @@ const TagMultiSelect = ({
5806
5562
  }
5807
5563
  }
5808
5564
  ),
5809
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { flex: "1", children: formatTitleToUppercase(tag.name) })
5565
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { flex: "1", children: index.formatTitleToUppercase(tag.name) })
5810
5566
  ]
5811
5567
  },
5812
5568
  tag.id
@@ -5860,13 +5616,13 @@ const RegionsMultiSelect = ({
5860
5616
  const fetchRegions = async () => {
5861
5617
  setIsLoading(true);
5862
5618
  try {
5863
- let userDetails = await getUserDetailsCached();
5619
+ let userDetails = await index.getUserDetailsCached();
5864
5620
  if (!userDetails) {
5865
- userDetails = await getUserDetails();
5621
+ userDetails = await index.getUserDetails();
5866
5622
  }
5867
5623
  const isTrial = userDetails?.user?.subscription_type === PLAN_TYPES.TRIAL;
5868
5624
  setIsTrialUser(isTrial);
5869
- const result = await request("/regions", {
5625
+ const result = await index.request("/regions", {
5870
5626
  method: "GET"
5871
5627
  });
5872
5628
  if (!result) return;
@@ -6097,7 +5853,7 @@ function PortAdvancedSettings({
6097
5853
  React.useEffect(() => {
6098
5854
  async function fetchUser() {
6099
5855
  try {
6100
- const details = await getUserDetailsCached(true);
5856
+ const details = await index.getUserDetailsCached(true);
6101
5857
  const userMinMonitoringIntervalInMins = details?.plan_limits?.min_monitoring_interval;
6102
5858
  setMinMonitoringInterval(
6103
5859
  userMinMonitoringIntervalInMins ? userMinMonitoringIntervalInMins * 60 : 60
@@ -6220,12 +5976,12 @@ function KeywordInput({
6220
5976
  setKeywordInput("");
6221
5977
  };
6222
5978
  const handleRemoveKeyword = (indexToRemove) => {
6223
- onKeywordsChange(keywords.filter((_, index) => index !== indexToRemove));
5979
+ onKeywordsChange(keywords.filter((_, index2) => index2 !== indexToRemove));
6224
5980
  };
6225
- const handleKeywordChange = (index, field, value) => {
5981
+ const handleKeywordChange = (index2, field, value) => {
6226
5982
  const updatedKeywords = [...keywords];
6227
- updatedKeywords[index] = {
6228
- ...updatedKeywords[index],
5983
+ updatedKeywords[index2] = {
5984
+ ...updatedKeywords[index2],
6229
5985
  [field]: value
6230
5986
  };
6231
5987
  onKeywordsChange(updatedKeywords);
@@ -6272,7 +6028,7 @@ function KeywordInput({
6272
6028
  keywords.length,
6273
6029
  ")"
6274
6030
  ] }) }),
6275
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, width: "800px", children: keywords.map((keyword, index) => /* @__PURE__ */ jsxRuntime.jsxs(
6031
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", gap: 2, width: "800px", children: keywords.map((keyword, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
6276
6032
  designSystem.Box,
6277
6033
  {
6278
6034
  padding: 4,
@@ -6317,7 +6073,7 @@ function KeywordInput({
6317
6073
  height: "32px"
6318
6074
  },
6319
6075
  variant: "tertiary",
6320
- onClick: () => handleRemoveKeyword(index),
6076
+ onClick: () => handleRemoveKeyword(index2),
6321
6077
  title: "Remove keyword",
6322
6078
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
6323
6079
  }
@@ -6338,7 +6094,7 @@ function KeywordInput({
6338
6094
  value: keyword.type,
6339
6095
  onChange: (value) => {
6340
6096
  handleKeywordChange(
6341
- index,
6097
+ index2,
6342
6098
  "type",
6343
6099
  value
6344
6100
  );
@@ -6355,7 +6111,7 @@ function KeywordInput({
6355
6111
  designSystem.Switch,
6356
6112
  {
6357
6113
  checked: keyword.is_regex,
6358
- onCheckedChange: (checked) => handleKeywordChange(index, "is_regex", checked)
6114
+ onCheckedChange: (checked) => handleKeywordChange(index2, "is_regex", checked)
6359
6115
  }
6360
6116
  ),
6361
6117
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "500", children: "Regex" })
@@ -6368,7 +6124,7 @@ function KeywordInput({
6368
6124
  designSystem.Switch,
6369
6125
  {
6370
6126
  checked: keyword.case_sensitive,
6371
- onCheckedChange: (checked) => handleKeywordChange(index, "case_sensitive", checked)
6127
+ onCheckedChange: (checked) => handleKeywordChange(index2, "case_sensitive", checked)
6372
6128
  }
6373
6129
  ),
6374
6130
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "500", children: "Case Sensitive" })
@@ -6380,7 +6136,7 @@ function KeywordInput({
6380
6136
  )
6381
6137
  ]
6382
6138
  },
6383
- index
6139
+ index2
6384
6140
  )) })
6385
6141
  ] })
6386
6142
  ] });
@@ -6400,7 +6156,7 @@ function KeywordAdvancedSettings({
6400
6156
  React.useEffect(() => {
6401
6157
  async function fetchUser() {
6402
6158
  try {
6403
- const details = await getUserDetailsCached(true);
6159
+ const details = await index.getUserDetailsCached(true);
6404
6160
  const userMinMonitoringIntervalInMins = details?.plan_limits?.min_monitoring_interval;
6405
6161
  setMinMonitoringInterval(
6406
6162
  userMinMonitoringIntervalInMins ? userMinMonitoringIntervalInMins * 60 : 60
@@ -6586,7 +6342,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6586
6342
  React.useEffect(() => {
6587
6343
  const fetchRegions = async () => {
6588
6344
  try {
6589
- const result = await request("/regions", {
6345
+ const result = await index.request("/regions", {
6590
6346
  method: "GET"
6591
6347
  });
6592
6348
  if (!result) {
@@ -6603,11 +6359,11 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6603
6359
  if (monitor && mode === "edit") {
6604
6360
  const loadMonitorSettings = async () => {
6605
6361
  try {
6606
- const settings = await fetchMonitorSettings(monitor.id);
6362
+ const settings = await index.fetchMonitorSettings(monitor.id);
6607
6363
  if (settings) {
6608
6364
  const serviceType = monitor.service_type || MONITOR_TYPE.WEBSITE;
6609
6365
  setMonitorType(serviceType);
6610
- const config2 = settingsToConfig(settings.settings);
6366
+ const config2 = index.settingsToConfig(settings.settings);
6611
6367
  if (serviceType === MONITOR_TYPE.PORT) {
6612
6368
  setPortFormData({
6613
6369
  name: monitor.name || "",
@@ -6799,7 +6555,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6799
6555
  tag_ids: selectedTagIds,
6800
6556
  ...mode === "create" ? { is_enabled: true } : { id: monitor?.id }
6801
6557
  };
6802
- result = await request(url, {
6558
+ result = await index.request(url, {
6803
6559
  method,
6804
6560
  data: payload
6805
6561
  });
@@ -6847,7 +6603,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6847
6603
  tag_ids: selectedTagIds,
6848
6604
  ...mode === "create" ? { is_enabled: true } : { id: monitor?.id }
6849
6605
  };
6850
- result = await request(url, {
6606
+ result = await index.request(url, {
6851
6607
  method,
6852
6608
  data: payload
6853
6609
  });
@@ -6870,7 +6626,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6870
6626
  regions: buildRegionsPayload(),
6871
6627
  is_enabled: true
6872
6628
  };
6873
- result = await request(url, {
6629
+ result = await index.request(url, {
6874
6630
  method,
6875
6631
  data: payload
6876
6632
  });
@@ -6890,7 +6646,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6890
6646
  tag_ids: selectedTagIds,
6891
6647
  regions: buildRegionsPayload()
6892
6648
  };
6893
- result = await request(url, {
6649
+ result = await index.request(url, {
6894
6650
  method,
6895
6651
  data: payload
6896
6652
  });
@@ -6899,7 +6655,7 @@ function MonitorForm({ monitor, mode, handleCancelEdit, load }) {
6899
6655
  if (!result) return;
6900
6656
  if (result.monitorsData.status === "success") {
6901
6657
  const monitorId = result.monitorsData.data.monitor.id;
6902
- clearAllStoredMonitors();
6658
+ index.clearAllStoredMonitors();
6903
6659
  reactToastify.toast.success(
6904
6660
  mode === "create" ? "Monitor created successfully" : "Monitor updated successfully"
6905
6661
  );
@@ -7468,7 +7224,7 @@ const ConfirmationModal = ({
7468
7224
  ] }) });
7469
7225
  };
7470
7226
  async function getMonitors() {
7471
- const res = await request("/monitors", {
7227
+ const res = await index.request("/monitors", {
7472
7228
  method: "GET"
7473
7229
  });
7474
7230
  if (!res) return;
@@ -7484,11 +7240,11 @@ function Monitors({ onTabChange }) {
7484
7240
  const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
7485
7241
  const [bulkDeleteIds, setBulkDeleteIds] = React.useState([]);
7486
7242
  const [bulkDeleteModalOpen, setBulkDeleteModalOpen] = React.useState(false);
7487
- const userDetails = getUserData();
7243
+ const userDetails = index.getUserData();
7488
7244
  const [alertMessage, setAlertMessage] = React.useState("");
7489
7245
  React.useEffect(() => {
7490
7246
  (async () => {
7491
- const fetchedMonitorId = await getPrimaryMonitorId();
7247
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
7492
7248
  if (!fetchedMonitorId) setAlertMessage("Please select a primary monitor to continue!");
7493
7249
  })();
7494
7250
  }, []);
@@ -7509,13 +7265,13 @@ function Monitors({ onTabChange }) {
7509
7265
  };
7510
7266
  React.useEffect(() => {
7511
7267
  load();
7512
- getUserDetails();
7268
+ index.getUserDetails();
7513
7269
  }, []);
7514
7270
  const handleAddMonitor = async () => {
7515
7271
  let userPlan = userDetails?.user?.subscription_type;
7516
7272
  let maxMonitorsAllowed = userDetails?.plan_limits?.max_monitors;
7517
7273
  if (!userPlan) {
7518
- const user = await getUserDetails();
7274
+ const user = await index.getUserDetails();
7519
7275
  userPlan = user?.user?.subscription_type;
7520
7276
  maxMonitorsAllowed = user?.plan_limits?.max_monitors;
7521
7277
  }
@@ -7546,7 +7302,7 @@ function Monitors({ onTabChange }) {
7546
7302
  }
7547
7303
  setLoading(true);
7548
7304
  try {
7549
- const result = await request(`/monitors/${selectedMonitor.id}`, {
7305
+ const result = await index.request(`/monitors/${selectedMonitor.id}`, {
7550
7306
  method: "DELETE"
7551
7307
  });
7552
7308
  if (!result) return;
@@ -7578,7 +7334,7 @@ function Monitors({ onTabChange }) {
7578
7334
  }
7579
7335
  setLoading(true);
7580
7336
  try {
7581
- const result = await request("/monitors/bulk-delete", {
7337
+ const result = await index.request("/monitors/bulk-delete", {
7582
7338
  method: "POST",
7583
7339
  data: { monitorIds: bulkDeleteIds }
7584
7340
  });
@@ -7684,8 +7440,8 @@ const setNestedValue = (obj, path, value) => {
7684
7440
  const keys = path.split(".");
7685
7441
  const result = { ...obj };
7686
7442
  let current = result;
7687
- for (let index = 0; index < keys.length - 1; index++) {
7688
- const key = keys[index];
7443
+ for (let index2 = 0; index2 < keys.length - 1; index2++) {
7444
+ const key = keys[index2];
7689
7445
  current[key] = current[key] ? { ...current[key] } : {};
7690
7446
  current = current[key];
7691
7447
  }
@@ -7704,14 +7460,14 @@ function IntegrationFormModal({
7704
7460
  name: ""
7705
7461
  });
7706
7462
  const [errors, setErrors] = React.useState({});
7707
- const [userDetails, setUserDetails2] = React.useState(null);
7463
+ const [userDetails, setUserDetails] = React.useState(null);
7708
7464
  const [userDataEmail, setUserDataEmail] = React.useState("");
7709
7465
  const [showPassword, setShowPassword] = React.useState({});
7710
7466
  React.useEffect(() => {
7711
- const userData = getUserData();
7467
+ const userData = index.getUserData();
7712
7468
  setUserDataEmail(userData?.user?.email || "");
7713
7469
  (async () => {
7714
- setUserDetails2(await getUserDetailsCached());
7470
+ setUserDetails(await index.getUserDetailsCached());
7715
7471
  })();
7716
7472
  }, []);
7717
7473
  const buildInitialFormData = React.useCallback(() => {
@@ -7723,11 +7479,11 @@ function IntegrationFormModal({
7723
7479
  } else {
7724
7480
  const keys = field.name.split(".");
7725
7481
  let current = initialData;
7726
- for (let index = 0; index < keys.length - 1; index++) {
7727
- if (!current[keys[index]]) {
7728
- current[keys[index]] = {};
7482
+ for (let index2 = 0; index2 < keys.length - 1; index2++) {
7483
+ if (!current[keys[index2]]) {
7484
+ current[keys[index2]] = {};
7729
7485
  }
7730
- current = current[keys[index]];
7486
+ current = current[keys[index2]];
7731
7487
  }
7732
7488
  current[keys[keys.length - 1]] = "";
7733
7489
  }
@@ -7751,11 +7507,11 @@ function IntegrationFormModal({
7751
7507
  if (value !== void 0) {
7752
7508
  const keys = field.name.split(".");
7753
7509
  let current = populatedData;
7754
- for (let index = 0; index < keys.length - 1; index++) {
7755
- if (!current[keys[index]]) {
7756
- current[keys[index]] = {};
7510
+ for (let index2 = 0; index2 < keys.length - 1; index2++) {
7511
+ if (!current[keys[index2]]) {
7512
+ current[keys[index2]] = {};
7757
7513
  }
7758
- current = current[keys[index]];
7514
+ current = current[keys[index2]];
7759
7515
  }
7760
7516
  current[keys[keys.length - 1]] = value;
7761
7517
  }
@@ -7837,11 +7593,11 @@ function IntegrationFormModal({
7837
7593
  if (value !== void 0 && value !== "") {
7838
7594
  const keys = field.name.split(".");
7839
7595
  let current = config2;
7840
- for (let index = 0; index < keys.length - 1; index++) {
7841
- if (!current[keys[index]]) {
7842
- current[keys[index]] = {};
7596
+ for (let index2 = 0; index2 < keys.length - 1; index2++) {
7597
+ if (!current[keys[index2]]) {
7598
+ current[keys[index2]] = {};
7843
7599
  }
7844
- current = current[keys[index]];
7600
+ current = current[keys[index2]];
7845
7601
  }
7846
7602
  current[keys[keys.length - 1]] = value;
7847
7603
  }
@@ -7889,7 +7645,7 @@ function IntegrationFormModal({
7889
7645
  url = `/notification-channels/${editData.id}`;
7890
7646
  method = "PUT";
7891
7647
  }
7892
- const result = await request(url, {
7648
+ const result = await index.request(url, {
7893
7649
  method,
7894
7650
  data: payload
7895
7651
  });
@@ -8083,7 +7839,7 @@ function useSupportedIntegrations() {
8083
7839
  try {
8084
7840
  setLoading(true);
8085
7841
  setError(null);
8086
- const data = await request("/integrations/supported", {
7842
+ const data = await index.request("/integrations/supported", {
8087
7843
  method: "GET"
8088
7844
  });
8089
7845
  if (!data) return;
@@ -8139,7 +7895,7 @@ function useSupportedIntegrations() {
8139
7895
  };
8140
7896
  }
8141
7897
  async function apiDeleteChannel(id) {
8142
- const res = await request(`/notification-channels/${id}`, {
7898
+ const res = await index.request(`/notification-channels/${id}`, {
8143
7899
  method: "DELETE"
8144
7900
  });
8145
7901
  if (!res) return;
@@ -8263,7 +8019,7 @@ const IntegrationsPage = () => {
8263
8019
  const [deleteTarget, setDeleteTarget] = React.useState(null);
8264
8020
  const [isDeleting, setIsDeleting] = React.useState(false);
8265
8021
  React.useEffect(() => {
8266
- getUserDetails();
8022
+ index.getUserDetails();
8267
8023
  }, []);
8268
8024
  const handleEdit = (integration) => {
8269
8025
  const channel = getChannelByType(integration.channel_type);
@@ -8278,7 +8034,7 @@ const IntegrationsPage = () => {
8278
8034
  };
8279
8035
  const handleTest = async (integration) => {
8280
8036
  try {
8281
- const result = await request(`/notification-channels/${integration.id}/test`, {
8037
+ const result = await index.request(`/notification-channels/${integration.id}/test`, {
8282
8038
  method: "POST"
8283
8039
  });
8284
8040
  if (!result) return;
@@ -8312,7 +8068,7 @@ const IntegrationsPage = () => {
8312
8068
  async function fetchUserIntegrations() {
8313
8069
  try {
8314
8070
  setLoading(true);
8315
- const data = await request("/notification-channels");
8071
+ const data = await index.request("/notification-channels");
8316
8072
  if (!data) return;
8317
8073
  const userChannels = data.notificationChannelsData.data?.channels ?? [];
8318
8074
  const limits = data.notificationChannelsData.data?.plan_limits ?? null;
@@ -8343,7 +8099,7 @@ const IntegrationsPage = () => {
8343
8099
  };
8344
8100
  const handleToggleIntegration = async (integration) => {
8345
8101
  try {
8346
- const res = await request(`/notification-channels/${integration.id}`, {
8102
+ const res = await index.request(`/notification-channels/${integration.id}`, {
8347
8103
  method: "PUT",
8348
8104
  data: {
8349
8105
  is_enabled: !integration.is_enabled
@@ -8588,7 +8344,7 @@ function SettingsTabs({
8588
8344
  gap: { initial: "2px", medium: "0px" },
8589
8345
  alignItems: { initial: "start", medium: "center" },
8590
8346
  width: "100%",
8591
- children: tabs && tabs.map((tab, index) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: tab.value.toLocaleLowerCase(), children: tab.name }, index))
8347
+ children: tabs && tabs.map((tab, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: tab.value.toLocaleLowerCase(), children: tab.name }, index2))
8592
8348
  }
8593
8349
  ) }),
8594
8350
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Content, { value: activeTab, children: [
@@ -8619,7 +8375,7 @@ function LogInForm({
8619
8375
  return;
8620
8376
  }
8621
8377
  setErrors(null);
8622
- request("/login", {
8378
+ index.request("/login", {
8623
8379
  method: "POST",
8624
8380
  data: {
8625
8381
  email: email2,
@@ -8647,7 +8403,7 @@ function LogInForm({
8647
8403
  return;
8648
8404
  }
8649
8405
  setForgotPasswordError("");
8650
- request("/forgot-password", {
8406
+ index.request("/forgot-password", {
8651
8407
  method: "POST",
8652
8408
  data: {
8653
8409
  email: email2
@@ -8686,7 +8442,7 @@ function LogInForm({
8686
8442
  designSystem.Field.Root,
8687
8443
  {
8688
8444
  width: "100%",
8689
- error: errors?.issues.find((issue2) => issue2.path[0] === "email")?.message || forgotPasswordError,
8445
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "email")?.message || forgotPasswordError,
8690
8446
  required: true,
8691
8447
  children: [
8692
8448
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Email" }),
@@ -8707,7 +8463,7 @@ function LogInForm({
8707
8463
  designSystem.Field.Root,
8708
8464
  {
8709
8465
  width: "100%",
8710
- error: errors?.issues.find((issue2) => issue2.path[0] === "password")?.message,
8466
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "password")?.message,
8711
8467
  required: true,
8712
8468
  children: [
8713
8469
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Password" }),
@@ -8774,7 +8530,7 @@ function RegisterForm({
8774
8530
  }
8775
8531
  setErrors(null);
8776
8532
  const domainUrl = window.strapi?.backendURL || window.location.origin;
8777
- request("/signup", {
8533
+ index.request("/signup", {
8778
8534
  method: "POST",
8779
8535
  data: {
8780
8536
  email: email2,
@@ -8820,7 +8576,7 @@ function RegisterForm({
8820
8576
  designSystem.Field.Root,
8821
8577
  {
8822
8578
  width: "100%",
8823
- error: errors?.issues.find((issue2) => issue2.path[0] === "fullName")?.message,
8579
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "fullName")?.message,
8824
8580
  required: true,
8825
8581
  children: [
8826
8582
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Full Name" }),
@@ -8841,7 +8597,7 @@ function RegisterForm({
8841
8597
  designSystem.Field.Root,
8842
8598
  {
8843
8599
  width: "100%",
8844
- error: errors?.issues.find((issue2) => issue2.path[0] === "email")?.message,
8600
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "email")?.message,
8845
8601
  required: true,
8846
8602
  children: [
8847
8603
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Email" }),
@@ -8862,7 +8618,7 @@ function RegisterForm({
8862
8618
  designSystem.Field.Root,
8863
8619
  {
8864
8620
  width: "100%",
8865
- error: errors?.issues.find((issue2) => issue2.path[0] === "password")?.message,
8621
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "password")?.message,
8866
8622
  required: true,
8867
8623
  children: [
8868
8624
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Password" }),
@@ -8886,7 +8642,7 @@ function RegisterForm({
8886
8642
  designSystem.Field.Root,
8887
8643
  {
8888
8644
  width: "100%",
8889
- error: errors?.issues.find((issue2) => issue2.path[0] === "confirmPassword")?.message || confirmPasswordError,
8645
+ error: errors?.issues?.find((issue2) => issue2.path[0] === "confirmPassword")?.message || confirmPasswordError,
8890
8646
  required: true,
8891
8647
  children: [
8892
8648
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Confirm Password" }),
@@ -8933,7 +8689,7 @@ function Settings() {
8933
8689
  const [showExpiredMessage, setShowExpiredMessage] = React.useState("");
8934
8690
  const [loading, setLoading] = React.useState(false);
8935
8691
  React.useEffect(() => {
8936
- request("/settings", {
8692
+ index.request("/settings", {
8937
8693
  method: "GET"
8938
8694
  }).then((res) => {
8939
8695
  if (!res?.token) {
@@ -8952,7 +8708,7 @@ function Settings() {
8952
8708
  };
8953
8709
  const logOut = async () => {
8954
8710
  setLoading(true);
8955
- const result = await handleLogout();
8711
+ const result = await index.handleLogout();
8956
8712
  if (result) {
8957
8713
  reactToastify.toast.success("Logged out successfully.");
8958
8714
  setLoading(false);
@@ -9103,7 +8859,7 @@ const StatisticsCards = ({ monitorData, uptimeStats, histogramData, isLoading })
9103
8859
  ] }) }) }) }),
9104
8860
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { width: { initial: "100%", medium: "240px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.CardContent, { paddingLeft: 1, children: [
9105
8861
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardTitle, { fontSize: 3, children: "Last check" }),
9106
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardSubtitle, { marginTop: 1, fontSize: 3, children: formatDate(
8862
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardSubtitle, { marginTop: 1, fontSize: 3, children: index.formatDate(
9107
8863
  monitorData?.monitor?.service_last_checks?.default?.uptime?.last_checked_at || "N/A"
9108
8864
  ) })
9109
8865
  ] }) }) }) }),
@@ -9184,37 +8940,37 @@ const HealthCards = ({ monitorData, isLoading }) => {
9184
8940
  React.useEffect(() => {
9185
8941
  const monitorUrl = monitorData?.monitor?.config?.meta?.url;
9186
8942
  if (!monitorUrl) return;
9187
- request("/monitor/health-check/uptime", {
8943
+ index.request("/monitor/health-check/uptime", {
9188
8944
  method: "POST",
9189
8945
  data: { monitorUrl }
9190
8946
  }).then((res) => {
9191
8947
  setUptimeHealthCheck(res.uptimeHealthCheckData || null);
9192
8948
  });
9193
- request("/monitor/health-check/ssl", {
8949
+ index.request("/monitor/health-check/ssl", {
9194
8950
  method: "POST",
9195
8951
  data: { monitorUrl }
9196
8952
  }).then((res) => {
9197
8953
  setSslHealthCheck(res.sslHealthCheckData || null);
9198
8954
  });
9199
- request("/monitor/health-check/lighthouse", {
8955
+ index.request("/monitor/health-check/lighthouse", {
9200
8956
  method: "POST",
9201
8957
  data: { monitorUrl }
9202
8958
  }).then((res) => {
9203
8959
  setLighthouseHealthCheck(res.lighthouseHealthCheckData || null);
9204
8960
  });
9205
- request("/monitor/health-check/domain", {
8961
+ index.request("/monitor/health-check/domain", {
9206
8962
  method: "POST",
9207
8963
  data: { monitorUrl }
9208
8964
  }).then((res) => {
9209
8965
  setDomainHealthCheck(res.domainHealthCheckData || null);
9210
8966
  });
9211
- request("/monitor/health-check/broken-links", {
8967
+ index.request("/monitor/health-check/broken-links", {
9212
8968
  method: "POST",
9213
8969
  data: { monitorUrl }
9214
8970
  }).then((res) => {
9215
8971
  setBrokenLinksHealthCheck(res.brokenLinksHealthCheckData || null);
9216
8972
  });
9217
- request("/monitor/health-check/mixed-content", {
8973
+ index.request("/monitor/health-check/mixed-content", {
9218
8974
  method: "POST",
9219
8975
  data: { monitorUrl }
9220
8976
  }).then((res) => {
@@ -9226,7 +8982,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9226
8982
  const monitorUrl = monitorData?.monitor?.config?.meta?.url;
9227
8983
  switch (type) {
9228
8984
  case "reachability":
9229
- request("/monitor/health-check/uptime", {
8985
+ index.request("/monitor/health-check/uptime", {
9230
8986
  method: "POST",
9231
8987
  data: { monitorUrl }
9232
8988
  }).then((res) => {
@@ -9235,7 +8991,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9235
8991
  });
9236
8992
  break;
9237
8993
  case "broken_links":
9238
- request("/monitor/health-check/broken-links", {
8994
+ index.request("/monitor/health-check/broken-links", {
9239
8995
  method: "POST",
9240
8996
  data: { monitorUrl }
9241
8997
  }).then((res) => {
@@ -9244,7 +9000,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9244
9000
  });
9245
9001
  break;
9246
9002
  case "security_certificates":
9247
- request("/monitor/health-check/ssl", {
9003
+ index.request("/monitor/health-check/ssl", {
9248
9004
  method: "POST",
9249
9005
  data: { monitorUrl }
9250
9006
  }).then((res) => {
@@ -9253,7 +9009,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9253
9009
  });
9254
9010
  break;
9255
9011
  case "domain_check":
9256
- request("/monitor/health-check/domain", {
9012
+ index.request("/monitor/health-check/domain", {
9257
9013
  method: "POST",
9258
9014
  data: { monitorUrl }
9259
9015
  }).then((res) => {
@@ -9262,7 +9018,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9262
9018
  });
9263
9019
  break;
9264
9020
  case "lighthouse":
9265
- request("/monitor/health-check/lighthouse", {
9021
+ index.request("/monitor/health-check/lighthouse", {
9266
9022
  method: "POST",
9267
9023
  data: { monitorUrl }
9268
9024
  }).then((res) => {
@@ -9271,7 +9027,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9271
9027
  });
9272
9028
  break;
9273
9029
  case "mixed_content":
9274
- request("/monitor/health-check/mixed-content", {
9030
+ index.request("/monitor/health-check/mixed-content", {
9275
9031
  method: "POST",
9276
9032
  data: { monitorUrl }
9277
9033
  }).then((res) => {
@@ -9304,7 +9060,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9304
9060
  }
9305
9061
  };
9306
9062
  const RenderHealthCard = ({ data, name }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { paddingLeft: 1, width: "100%", children: loading === name ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9307
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardHeader, { fontSize: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "start", width: "100%", children: formatTitleToUppercase(name) }) }),
9063
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardHeader, { fontSize: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "start", width: "100%", children: index.formatTitleToUppercase(name) }) }),
9308
9064
  data && (data?.status === "error" || data?.status === "warning" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardTitle, { marginTop: 3, fontSize: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "row", alignItems: "center", gap: 1, children: [
9309
9065
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { width: "20px", children: [
9310
9066
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -9330,7 +9086,7 @@ const HealthCards = ({ monitorData, isLoading }) => {
9330
9086
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.CardSubtitle, { marginTop: 1, fontSize: 3, children: [
9331
9087
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "Last checked at: " }),
9332
9088
  " ",
9333
- formatDate(data?.data?.checkedAt),
9089
+ index.formatDate(data?.data?.checkedAt),
9334
9090
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { marginTop: 2, justifyContent: "space-between", children: [
9335
9091
  /* @__PURE__ */ jsxRuntime.jsx(
9336
9092
  designSystem.Link,
@@ -9678,7 +9434,7 @@ const IncidentsTable = ({
9678
9434
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { fontSize: 3, children: [
9679
9435
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: showMonitorName(monitorName) ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: showMonitorName(monitorName), children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { cursor: "pointer" }, children: formatMonitorName(monitorName) }) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: formatMonitorName(monitorName) }) }),
9680
9436
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: incident.region || "N/A" }) }),
9681
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { textTransform: "capitalize" }, children: formatCheckType ? formatCheckType(incident.check_type) : incident.check_type }) }),
9437
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { textTransform: "capitalize" }, children: index.formatCheckType ? index.formatCheckType(incident.check_type) : incident.check_type }) }),
9682
9438
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
9683
9439
  designSystem.Badge,
9684
9440
  {
@@ -9848,7 +9604,7 @@ function Dashboard() {
9848
9604
  const MAX_MONITOR_RETRIES = 3;
9849
9605
  React.useEffect(() => {
9850
9606
  (async () => {
9851
- const fetchedMonitorId = await getPrimaryMonitorId();
9607
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
9852
9608
  if (!fetchedMonitorId) {
9853
9609
  setShowImageBlur(true);
9854
9610
  return;
@@ -9873,8 +9629,8 @@ function Dashboard() {
9873
9629
  }
9874
9630
  const handleTimeRangeChange = (range) => {
9875
9631
  setResponseTimeRange(String(range));
9876
- const { start, end } = getRangeTimestamps(String(range) || "last_24_hours");
9877
- request(
9632
+ const { start, end } = index.getRangeTimestamps(String(range) || "last_24_hours");
9633
+ index.request(
9878
9634
  `/monitor/${monitorId}/response-time?start=${start}&end=${end}&region=${selectedRegion}`,
9879
9635
  {
9880
9636
  method: "GET"
@@ -9892,7 +9648,7 @@ function Dashboard() {
9892
9648
  const fetchMonitorDataWithRetry = async (retries = MAX_MONITOR_RETRIES) => {
9893
9649
  for (let attempt = 0; attempt < retries; attempt++) {
9894
9650
  try {
9895
- const res = await request(`/monitor/${monitorId}`, { method: "GET" });
9651
+ const res = await index.request(`/monitor/${monitorId}`, { method: "GET" });
9896
9652
  if (res?.monitor?.message === "Invalid authentication token" || res?.monitor?.status === "error") {
9897
9653
  navigate("/plugins/upsnap/settings");
9898
9654
  return null;
@@ -9907,23 +9663,23 @@ function Dashboard() {
9907
9663
  return null;
9908
9664
  };
9909
9665
  const handleRefresh = async () => {
9910
- const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
9666
+ const { start, end } = index.getRangeTimestamps(responseTimeRange || "last_24_hours");
9911
9667
  setIsLoading(true);
9912
9668
  if (!monitorId) return;
9913
9669
  const monitor = await fetchMonitorDataWithRetry();
9914
9670
  setMonitorData(monitor);
9915
- request(`/monitor/${monitorId}/uptime-stats?region=${selectedRegion}`, {
9671
+ index.request(`/monitor/${monitorId}/uptime-stats?region=${selectedRegion}`, {
9916
9672
  method: "GET"
9917
9673
  }).then((res) => {
9918
9674
  setUptimeStats(res.uptimeStatsData?.data || null);
9919
9675
  });
9920
- request(`/monitor/${monitorId}/histogram?region=${selectedRegion}`, {
9676
+ index.request(`/monitor/${monitorId}/histogram?region=${selectedRegion}`, {
9921
9677
  method: "GET"
9922
9678
  }).then((res) => {
9923
9679
  setHistogramData(res.histogramData?.data || null);
9924
9680
  setIsLoading(false);
9925
9681
  });
9926
- request(
9682
+ index.request(
9927
9683
  `/monitor/${monitorId}/response-time?start=${start}&end=${end}&region=${selectedRegion}`,
9928
9684
  {
9929
9685
  method: "GET"
@@ -9931,7 +9687,7 @@ function Dashboard() {
9931
9687
  ).then((res) => {
9932
9688
  setResponseTimeData(res.responseTimeData?.data || null);
9933
9689
  });
9934
- request(`/monitor/${monitorId}/incidents`, {
9690
+ index.request(`/monitor/${monitorId}/incidents`, {
9935
9691
  method: "GET"
9936
9692
  }).then((res) => {
9937
9693
  setMonitorIncidents(res.incidentsData?.data || null);
@@ -10034,7 +9790,7 @@ const DetailRow = ({ label, value, isUrl = false, isChip = false }) => {
10034
9790
  const renderValue = () => {
10035
9791
  if (value === void 0 || value === null) return "N/A";
10036
9792
  if (Array.isArray(value)) {
10037
- return value.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral800", style: { display: "block" }, children: item }, index));
9793
+ return value.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral800", style: { display: "block" }, children: item }, index2));
10038
9794
  }
10039
9795
  if (isUrl) {
10040
9796
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { isExternal: true, href: value, rel: "noopener noreferrer", style: { color: "#4945ff" }, children: value });
@@ -10111,7 +9867,7 @@ const StatusCard = ({ status, message, error, cardData }) => {
10111
9867
  ] }),
10112
9868
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral500", children: [
10113
9869
  "Last updated: ",
10114
- formatDateTime(cardData?.checkedAt)
9870
+ index.formatDateTime(cardData?.checkedAt)
10115
9871
  ] })
10116
9872
  ]
10117
9873
  }
@@ -10130,7 +9886,7 @@ function RegionWiseCards({
10130
9886
  const isPrimary = (region) => region.is_primary;
10131
9887
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Card, { children: [
10132
9888
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: "Response Time by Region" }) }) }),
10133
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { width: "100%", children: regions.map((region, index) => {
9889
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { width: "100%", children: regions.map((region, index2) => {
10134
9890
  const isLoading = loadingRegions.has(region.id);
10135
9891
  const data = regionResponseTimeData[region.id];
10136
9892
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { marginBottom: 16, borderRadius: 8, padding: 12 }, children: [
@@ -10142,7 +9898,7 @@ function RegionWiseCards({
10142
9898
  width: 12,
10143
9899
  height: 12,
10144
9900
  borderRadius: "50%",
10145
- background: colors[index % colors.length],
9901
+ background: colors[index2 % colors.length],
10146
9902
  marginRight: 8
10147
9903
  }
10148
9904
  }
@@ -10412,18 +10168,18 @@ function Reachability() {
10412
10168
  const [monitorId, setMonitorId] = React.useState();
10413
10169
  React.useEffect(() => {
10414
10170
  (async () => {
10415
- const fetchedMonitorId = await getPrimaryMonitorId();
10171
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
10416
10172
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
10417
10173
  setMonitorId(fetchedMonitorId);
10418
10174
  })();
10419
10175
  }, []);
10420
10176
  const fetchResponseTimeDataForRegions = async (regions2, timeRange) => {
10421
10177
  if (!regions2 || regions2.length === 0) return;
10422
- const { start, end } = getRangeTimestamps(timeRange);
10178
+ const { start, end } = index.getRangeTimestamps(timeRange);
10423
10179
  setRegionResponseTimeData({});
10424
10180
  for (const region of regions2) {
10425
10181
  try {
10426
- const res = await request(
10182
+ const res = await index.request(
10427
10183
  `/monitor/${monitorId}/response-time?start=${start}&end=${end}&region=${region.id}`,
10428
10184
  { method: "GET" }
10429
10185
  );
@@ -10442,7 +10198,7 @@ function Reachability() {
10442
10198
  if (monitorId) {
10443
10199
  setLoading(true);
10444
10200
  try {
10445
- const res = await request(`/monitor/${monitorId}`, { method: "GET" });
10201
+ const res = await index.request(`/monitor/${monitorId}`, { method: "GET" });
10446
10202
  if (res?.monitor?.message === "Invalid authentication token") {
10447
10203
  setSelectedMonitor(null);
10448
10204
  navigate("/plugins/upsnap/settings");
@@ -10470,7 +10226,7 @@ function Reachability() {
10470
10226
  const stateSetter = loading ? setLoading : setRefreshing;
10471
10227
  stateSetter(true);
10472
10228
  try {
10473
- const res = await request("/monitor/health-check/uptime", {
10229
+ const res = await index.request("/monitor/health-check/uptime", {
10474
10230
  method: "POST",
10475
10231
  data: { monitorUrl: url }
10476
10232
  });
@@ -10483,7 +10239,7 @@ function Reachability() {
10483
10239
  };
10484
10240
  const fetchResponseTimeForRegion = async (regionId2, start, end) => {
10485
10241
  try {
10486
- const res = await request(
10242
+ const res = await index.request(
10487
10243
  `/monitor/${monitorId}/response-time?start=${start}&end=${end}&region=${regionId2}`,
10488
10244
  { method: "GET" }
10489
10245
  );
@@ -10503,7 +10259,7 @@ function Reachability() {
10503
10259
  const fetchAll = async () => {
10504
10260
  const regions2 = Array.isArray(selectedMonitor?.monitor?.regions) ? selectedMonitor?.monitor?.regions : [];
10505
10261
  if (!regions2.length) return;
10506
- const { start, end } = getRangeTimestamps(responseTimeRange || "last_24_hours");
10262
+ const { start, end } = index.getRangeTimestamps(responseTimeRange || "last_24_hours");
10507
10263
  setRegionResponseTimeData({});
10508
10264
  setLoadingRegions(new Set(regions2.map((r) => r.id)));
10509
10265
  for (const region of regions2) {
@@ -10634,7 +10390,7 @@ function CertificateChain({ chain }) {
10634
10390
  if (type === "intermediate") return "Intermediate Certificate";
10635
10391
  return "Root Certificate";
10636
10392
  };
10637
- const formatDate2 = (dateString) => {
10393
+ const formatDate = (dateString) => {
10638
10394
  const date2 = new Date(dateString);
10639
10395
  return date2.toLocaleDateString("en-GB", {
10640
10396
  day: "2-digit",
@@ -10647,7 +10403,7 @@ function CertificateChain({ chain }) {
10647
10403
  }
10648
10404
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, children: [
10649
10405
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", marginBottom: 4, children: "Certificate Chain" }),
10650
- chain.map((cert, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10406
+ chain.map((cert, index2) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10651
10407
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { width: { initial: "100%", medium: "842px" }, marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.CardContent, { width: { initial: "100%", medium: "842px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
10652
10408
  designSystem.Flex,
10653
10409
  {
@@ -10692,7 +10448,7 @@ function CertificateChain({ chain }) {
10692
10448
  ] }),
10693
10449
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { marginBottom: 2, gap: 2, children: [
10694
10450
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral500", children: "Not Before" }),
10695
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatDate2(cert.info.notBefore) })
10451
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatDate(cert.info.notBefore) })
10696
10452
  ] }),
10697
10453
  cert.info.issuer.organizationName && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { marginBottom: 2, gap: 2, children: [
10698
10454
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral500", children: "Organization" }),
@@ -10721,7 +10477,7 @@ function CertificateChain({ chain }) {
10721
10477
  ] }),
10722
10478
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { marginBottom: 2, gap: 2, children: [
10723
10479
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral500", children: "Not After" }),
10724
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatDate2(cert.info.notAfter) })
10480
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: formatDate(cert.info.notAfter) })
10725
10481
  ] }),
10726
10482
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { marginBottom: 2, gap: 2, children: [
10727
10483
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral500", children: "Issued By" }),
@@ -10732,8 +10488,8 @@ function CertificateChain({ chain }) {
10732
10488
  ]
10733
10489
  }
10734
10490
  ) }) }) }),
10735
- index < chain.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", paddingTop: 4, paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDown, { color: "#a3a3a3" }) })
10736
- ] }, index))
10491
+ index2 < chain.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", paddingTop: 4, paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDown, { color: "#a3a3a3" }) })
10492
+ ] }, index2))
10737
10493
  ] });
10738
10494
  }
10739
10495
  function SecurityCertificates() {
@@ -10746,14 +10502,14 @@ function SecurityCertificates() {
10746
10502
  const [monitorId, setMonitorId] = React.useState();
10747
10503
  React.useEffect(() => {
10748
10504
  (async () => {
10749
- const fetchedMonitorId = await getPrimaryMonitorId();
10505
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
10750
10506
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
10751
10507
  setMonitorId(fetchedMonitorId);
10752
10508
  })();
10753
10509
  }, []);
10754
10510
  React.useEffect(() => {
10755
10511
  setLoading(true);
10756
- request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
10512
+ index.request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
10757
10513
  if (res?.monitor?.message === "Invalid authentication token") {
10758
10514
  setSelectedMonitor(null);
10759
10515
  navigate("/plugins/upsnap/settings");
@@ -10765,7 +10521,7 @@ function SecurityCertificates() {
10765
10521
  const getSecurityCertificatesData = async (url, forceFetch = false) => {
10766
10522
  try {
10767
10523
  setLoading(true);
10768
- const res = await request("/monitor/health-check/ssl", {
10524
+ const res = await index.request("/monitor/health-check/ssl", {
10769
10525
  method: "POST",
10770
10526
  data: { monitorUrl: url, force_fetch: forceFetch }
10771
10527
  });
@@ -11081,14 +10837,14 @@ function BrokenLinks() {
11081
10837
  const navigate = reactRouterDom.useNavigate();
11082
10838
  React.useEffect(() => {
11083
10839
  (async () => {
11084
- const fetchedMonitorId = await getPrimaryMonitorId();
10840
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
11085
10841
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
11086
10842
  setMonitorId(fetchedMonitorId);
11087
10843
  })();
11088
10844
  }, []);
11089
10845
  React.useEffect(() => {
11090
10846
  setLoading(true);
11091
- request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
10847
+ index.request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11092
10848
  if (res?.monitor?.message === "Invalid authentication token") {
11093
10849
  setSelectedMonitor(null);
11094
10850
  navigate("/plugins/upsnap/settings");
@@ -11100,7 +10856,7 @@ function BrokenLinks() {
11100
10856
  const getBrokenLinksData = async (url, forceFetch = false) => {
11101
10857
  try {
11102
10858
  setLoading(true);
11103
- const res = await request("/monitor/health-check/broken-links", {
10859
+ const res = await index.request("/monitor/health-check/broken-links", {
11104
10860
  method: "POST",
11105
10861
  data: { monitorUrl: url, force_fetch: forceFetch }
11106
10862
  });
@@ -11296,14 +11052,14 @@ function Lighthouse() {
11296
11052
  const [monitorId, setMonitorId] = React.useState();
11297
11053
  React.useEffect(() => {
11298
11054
  (async () => {
11299
- const fetchedMonitorId = await getPrimaryMonitorId();
11055
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
11300
11056
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
11301
11057
  setMonitorId(fetchedMonitorId);
11302
11058
  })();
11303
11059
  }, []);
11304
11060
  React.useEffect(() => {
11305
11061
  setLoading(true);
11306
- request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11062
+ index.request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11307
11063
  if (res?.monitor?.message === "Invalid authentication token") {
11308
11064
  setSelectedMonitor(null);
11309
11065
  navigate("/plugins/upsnap/settings");
@@ -11316,7 +11072,7 @@ function Lighthouse() {
11316
11072
  const getLighthouseData = async (selectedStrategy, url, forceFetch = false) => {
11317
11073
  try {
11318
11074
  setLoading(true);
11319
- const res = await request("/monitor/health-check/lighthouse", {
11075
+ const res = await index.request("/monitor/health-check/lighthouse", {
11320
11076
  method: "POST",
11321
11077
  data: { monitorUrl: url, strategy: selectedStrategy, force_fetch: forceFetch }
11322
11078
  });
@@ -11495,7 +11251,7 @@ function DomainCheck() {
11495
11251
  const navigate = reactRouterDom.useNavigate();
11496
11252
  React.useEffect(() => {
11497
11253
  (async () => {
11498
- const fetchedMonitorId = await getPrimaryMonitorId();
11254
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
11499
11255
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
11500
11256
  setMonitorId(fetchedMonitorId);
11501
11257
  })();
@@ -11503,7 +11259,7 @@ function DomainCheck() {
11503
11259
  const getDomainCheckData = async (url, forceFetch = false) => {
11504
11260
  try {
11505
11261
  setLoading(true);
11506
- const res = await request("/monitor/health-check/domain", {
11262
+ const res = await index.request("/monitor/health-check/domain", {
11507
11263
  method: "POST",
11508
11264
  data: { monitorUrl: url, force_fetch: forceFetch }
11509
11265
  });
@@ -11516,7 +11272,7 @@ function DomainCheck() {
11516
11272
  };
11517
11273
  React.useEffect(() => {
11518
11274
  setLoading(true);
11519
- request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11275
+ index.request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11520
11276
  if (res?.monitor?.message === "Invalid authentication token") {
11521
11277
  setSelectedMonitor(null);
11522
11278
  navigate("/plugins/upsnap/settings");
@@ -11579,17 +11335,17 @@ function DomainCheck() {
11579
11335
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5 }),
11580
11336
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "bold", children: "Domain Lifecycle" }),
11581
11337
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 3, marginBottom: 4 }),
11582
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Registered On", value: formatDate(meta.domainRegistered) }),
11583
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Expiration Date", value: formatDate(meta.domainExpirationDate) }),
11338
+ /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Registered On", value: index.formatDate(meta.domainRegistered) }),
11339
+ /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Expiration Date", value: index.formatDate(meta.domainExpirationDate) }),
11584
11340
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Days Until Expiration", value: meta.domainDays ?? "–" }),
11585
11341
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Expired", value: meta.expired ? "Yes" : "No" }),
11586
11342
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Expiring Soon", value: meta.expiringSoon ? "Yes" : "No" }),
11587
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Last Changed", value: formatDate(meta.lastChanged) }),
11343
+ /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { label: "Last Changed", value: index.formatDate(meta.lastChanged) }),
11588
11344
  /* @__PURE__ */ jsxRuntime.jsx(
11589
11345
  DetailRow,
11590
11346
  {
11591
11347
  label: "Last Updated in RDAP DB",
11592
- value: formatDate(meta.lastUpdatedInRDAP)
11348
+ value: index.formatDate(meta.lastUpdatedInRDAP)
11593
11349
  }
11594
11350
  ),
11595
11351
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5 }),
@@ -11609,7 +11365,7 @@ function MixedContent() {
11609
11365
  const [monitorId, setMonitorId] = React.useState();
11610
11366
  React.useEffect(() => {
11611
11367
  (async () => {
11612
- const fetchedMonitorId = await getPrimaryMonitorId();
11368
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
11613
11369
  if (!fetchedMonitorId) navigate("/plugins/upsnap/settings");
11614
11370
  setMonitorId(fetchedMonitorId);
11615
11371
  })();
@@ -11617,7 +11373,7 @@ function MixedContent() {
11617
11373
  const getMixedContentData = async (url, forceFetch = false) => {
11618
11374
  try {
11619
11375
  setLoading(true);
11620
- const res = await request("/monitor/health-check/mixed-content", {
11376
+ const res = await index.request("/monitor/health-check/mixed-content", {
11621
11377
  method: "POST",
11622
11378
  data: { monitorUrl: url, force_fetch: forceFetch }
11623
11379
  });
@@ -11630,7 +11386,7 @@ function MixedContent() {
11630
11386
  };
11631
11387
  React.useEffect(() => {
11632
11388
  setLoading(true);
11633
- request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11389
+ index.request(`/monitor/${monitorId}`, { method: "GET" }).then((res) => {
11634
11390
  if (res?.monitor?.message === "Invalid authentication token") {
11635
11391
  setSelectedMonitor(null);
11636
11392
  navigate("/plugins/upsnap/settings");
@@ -11717,7 +11473,7 @@ function ListStatusPages() {
11717
11473
  const [showImageBlur, setShowImageBlur] = React.useState(false);
11718
11474
  React.useEffect(() => {
11719
11475
  (async () => {
11720
- const fetchedMonitorId = await getPrimaryMonitorId();
11476
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
11721
11477
  if (!fetchedMonitorId) {
11722
11478
  setShowImageBlur(true);
11723
11479
  return;
@@ -11730,7 +11486,7 @@ function ListStatusPages() {
11730
11486
  const fetchStatusPages = async () => {
11731
11487
  try {
11732
11488
  setIsLoading(true);
11733
- const response = await request("/status-pages");
11489
+ const response = await index.request("/status-pages");
11734
11490
  if (!response) return;
11735
11491
  setStatusPages(response?.statusPagesData?.data?.status_pages || []);
11736
11492
  } catch (error) {
@@ -11743,7 +11499,7 @@ function ListStatusPages() {
11743
11499
  if (!selectedPageId) return;
11744
11500
  setIsDeleting(true);
11745
11501
  try {
11746
- const result = await request(`/status-pages/${selectedPageId}`, {
11502
+ const result = await index.request(`/status-pages/${selectedPageId}`, {
11747
11503
  method: "DELETE"
11748
11504
  });
11749
11505
  if (!result) return;
@@ -11768,7 +11524,7 @@ function ListStatusPages() {
11768
11524
  id: page.id,
11769
11525
  is_published: isPublished
11770
11526
  };
11771
- const result = await request("/status-pages", {
11527
+ const result = await index.request("/status-pages", {
11772
11528
  method: "PUT",
11773
11529
  data: payload
11774
11530
  });
@@ -11790,7 +11546,7 @@ function ListStatusPages() {
11790
11546
  };
11791
11547
  const resetShareableLink = async (page) => {
11792
11548
  try {
11793
- const result = await request(`/status-pages/reset`, {
11549
+ const result = await index.request(`/status-pages/reset`, {
11794
11550
  method: "POST",
11795
11551
  data: { id: page.id }
11796
11552
  });
@@ -11812,7 +11568,7 @@ function ListStatusPages() {
11812
11568
  };
11813
11569
  const handleAddStatusPage = async () => {
11814
11570
  try {
11815
- const userDetails = await getUserDetailsCached();
11571
+ const userDetails = await index.getUserDetailsCached();
11816
11572
  const maxStatusPagesLimit = userDetails?.plan_limits?.max_status_pages || PLAN_LIMITS.TRIAL.max_status_pages;
11817
11573
  if (maxStatusPagesLimit !== void 0 && statusPages.length >= maxStatusPagesLimit) {
11818
11574
  reactToastify.toast.error(
@@ -11872,7 +11628,7 @@ function ListStatusPages() {
11872
11628
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Status" }) }),
11873
11629
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "Actions" }) }) })
11874
11630
  ] }) }),
11875
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {}) }) }) : statusPages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", padding: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "No status pages found" }) }) }) }) : statusPages.map((page, index) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
11631
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {}) }) }) : statusPages.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", padding: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "No status pages found" }) }) }) }) : statusPages.map((page, index2) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
11876
11632
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, alignItems: "flex-start", children: [
11877
11633
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", children: page.name }),
11878
11634
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
@@ -12020,7 +11776,7 @@ function CreateUpdateForm({ statusPage, mode }) {
12020
11776
  const fetchMonitors = React__default.default.useCallback(async () => {
12021
11777
  setIsLoading(true);
12022
11778
  try {
12023
- const data = await request("/monitors", {
11779
+ const data = await index.request("/monitors", {
12024
11780
  method: "GET"
12025
11781
  });
12026
11782
  if (!data) return;
@@ -12045,7 +11801,7 @@ function CreateUpdateForm({ statusPage, mode }) {
12045
11801
  monitor_ids: validated.monitor_ids,
12046
11802
  is_published: true
12047
11803
  };
12048
- result = await request("/status-pages", {
11804
+ result = await index.request("/status-pages", {
12049
11805
  method: "POST",
12050
11806
  data: payload
12051
11807
  });
@@ -12055,7 +11811,7 @@ function CreateUpdateForm({ statusPage, mode }) {
12055
11811
  name: validated.name,
12056
11812
  monitor_ids: validated.monitor_ids
12057
11813
  };
12058
- result = await request("/status-pages", {
11814
+ result = await index.request("/status-pages", {
12059
11815
  method: "PUT",
12060
11816
  data: payload
12061
11817
  });
@@ -12169,7 +11925,7 @@ function UpdateStatusPage() {
12169
11925
  if (!id) return;
12170
11926
  const fetchStatusPage = async () => {
12171
11927
  try {
12172
- const result = await request(`/status-pages/${id}`, {
11928
+ const result = await index.request(`/status-pages/${id}`, {
12173
11929
  method: "GET"
12174
11930
  });
12175
11931
  if (!result) return;
@@ -12201,7 +11957,7 @@ function CreateMonitor() {
12201
11957
  const fetchIncidentsFromBackend = async (params, timeout = 1e4) => {
12202
11958
  try {
12203
11959
  try {
12204
- const result = await request(`/monitor/all-incidents`, {
11960
+ const result = await index.request(`/monitor/all-incidents`, {
12205
11961
  method: "POST",
12206
11962
  data: params
12207
11963
  });
@@ -12266,7 +12022,7 @@ function IncidentsFilter({
12266
12022
  React__default.default.useEffect(() => {
12267
12023
  const fetchUserData = async () => {
12268
12024
  try {
12269
- const userDetails = await getUserDetailsCached();
12025
+ const userDetails = await index.getUserDetailsCached();
12270
12026
  const isTrial = userDetails?.user?.subscription_type === PLAN_TYPES.TRIAL;
12271
12027
  setIsTrialUser(isTrial);
12272
12028
  } catch (error) {
@@ -12317,12 +12073,12 @@ function IncidentsFilter({
12317
12073
  gap: 3,
12318
12074
  justifyContent: "start",
12319
12075
  alignItems: "start",
12320
- children: incidentTypeItems.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
12076
+ children: incidentTypeItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
12321
12077
  designSystem.Flex,
12322
12078
  {
12323
12079
  alignItems: "center",
12324
12080
  gap: 2,
12325
- paddingBottom: index !== incidentTypeItems.length - 1 ? 2 : 0,
12081
+ paddingBottom: index2 !== incidentTypeItems.length - 1 ? 2 : 0,
12326
12082
  children: [
12327
12083
  /* @__PURE__ */ jsxRuntime.jsx(
12328
12084
  designSystem.Checkbox,
@@ -12350,7 +12106,7 @@ function IncidentsFilter({
12350
12106
  gap: 3,
12351
12107
  justifyContent: "start",
12352
12108
  alignItems: "start",
12353
- children: regions.map((region, index) => {
12109
+ children: regions.map((region, index2) => {
12354
12110
  const isDisabled = isTrialUser && region.id !== DEFAULT_REGION.id;
12355
12111
  const regionContent = /* @__PURE__ */ jsxRuntime.jsxs(
12356
12112
  designSystem.Flex,
@@ -12421,7 +12177,7 @@ function IncidentsList({ defaultMonitorId }) {
12421
12177
  return { backgroundColor: "neutral100", textColor: "neutral600" };
12422
12178
  };
12423
12179
  const getRegionName = (regionId) => {
12424
- const region = regions.find((item) => item?.id === regionId);
12180
+ const region = regions?.find((item) => item?.id === regionId);
12425
12181
  return region?.name || regionId || "N/A";
12426
12182
  };
12427
12183
  const [searchParams] = reactRouterDom.useSearchParams();
@@ -12432,7 +12188,7 @@ function IncidentsList({ defaultMonitorId }) {
12432
12188
  React.useEffect(() => {
12433
12189
  const loadRegions = async () => {
12434
12190
  try {
12435
- const regionsData = await fetchRegionsData();
12191
+ const regionsData = await index.fetchRegionsData();
12436
12192
  const sortedRegions = regionsData.sort((a, b) => {
12437
12193
  if (a.id === DEFAULT_REGION.id) return -1;
12438
12194
  if (b.id === DEFAULT_REGION.id) return 1;
@@ -12478,7 +12234,7 @@ function IncidentsList({ defaultMonitorId }) {
12478
12234
  })();
12479
12235
  React.useEffect(() => {
12480
12236
  (async () => {
12481
- const fetchedMonitorId = await getPrimaryMonitorId();
12237
+ const fetchedMonitorId = await index.getPrimaryMonitorId();
12482
12238
  if (!fetchedMonitorId) {
12483
12239
  setHasNoMonitors(true);
12484
12240
  setIsLoading(false);
@@ -12551,7 +12307,7 @@ function IncidentsList({ defaultMonitorId }) {
12551
12307
  }, [defaultMonitorId, monitorIdFromParams]);
12552
12308
  const fetchMonitors = async () => {
12553
12309
  try {
12554
- const response = await request("/monitors", {
12310
+ const response = await index.request("/monitors", {
12555
12311
  method: "GET"
12556
12312
  });
12557
12313
  const fetchedMonitors = response?.monitorsData?.data?.monitors || [];
@@ -12580,7 +12336,7 @@ function IncidentsList({ defaultMonitorId }) {
12580
12336
  const fetchMonitor = async () => {
12581
12337
  try {
12582
12338
  if (!effectiveMonitorId) return;
12583
- const result = await request(`/monitor/${effectiveMonitorId}`);
12339
+ const result = await index.request(`/monitor/${effectiveMonitorId}`);
12584
12340
  if (result) {
12585
12341
  setMonitor(result.monitor?.data?.monitor);
12586
12342
  }
@@ -12713,7 +12469,7 @@ function IncidentsList({ defaultMonitorId }) {
12713
12469
  const startDate = new Date(start * 1e3).toISOString().slice(0, 10);
12714
12470
  const fileName = `incidents_${monitorName}_${startDate}`;
12715
12471
  const url = "/monitor/incidents/export";
12716
- const response = await request(url, { method: "POST", data: params2, responseType: "blob" });
12472
+ const response = await index.request(url, { method: "POST", data: params2, responseType: "blob" });
12717
12473
  const blob = response.data;
12718
12474
  const fileExtension = format2 === INCIDENTS_EXPORT_TYPES.pdf ? "pdf" : "csv";
12719
12475
  const successMessage = format2 === INCIDENTS_EXPORT_TYPES.pdf ? "PDF exported successfully" : "CSV exported successfully";
@@ -12877,7 +12633,7 @@ function IncidentsList({ defaultMonitorId }) {
12877
12633
  );
12878
12634
  }) }) }),
12879
12635
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(LoadingCard, {}) }) }) : incidents.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.EmptyStateLayout, { content: "No incidents found" }) }) }) : incidents.map((incident) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
12880
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatCheckType(incident.check_type) }) }),
12636
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: index.formatCheckType(incident.check_type) }) }),
12881
12637
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getRegionName(incident.region) }) }),
12882
12638
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: incident.error_message || "N/A" }) }),
12883
12639
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: incident.status_code ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeColor2(incident.status_code), children: incident.status_code }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "N/A" }) }),