@pagerduty/backstage-plugin 0.12.1-next.98 → 0.12.1-next.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/api/client.esm.js +151 -0
  2. package/dist/api/client.esm.js.map +1 -0
  3. package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js +17 -0
  4. package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js.map +1 -0
  5. package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js +17 -0
  6. package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js.map +1 -0
  7. package/dist/components/ChangeEvents/ChangeEventListItem.esm.js +70 -0
  8. package/dist/components/ChangeEvents/ChangeEventListItem.esm.js.map +1 -0
  9. package/dist/components/ChangeEvents/ChangeEvents.esm.js +45 -0
  10. package/dist/components/ChangeEvents/ChangeEvents.esm.js.map +1 -0
  11. package/dist/components/EntityPagerDutyCard/index.esm.js +29 -0
  12. package/dist/components/EntityPagerDutyCard/index.esm.js.map +1 -0
  13. package/dist/components/EntityPagerDutySmallCard/index.esm.js +29 -0
  14. package/dist/components/EntityPagerDutySmallCard/index.esm.js.map +1 -0
  15. package/dist/components/Errors/ForbiddenError.esm.js +24 -0
  16. package/dist/components/Errors/ForbiddenError.esm.js.map +1 -0
  17. package/dist/components/Errors/MissingTokenError.esm.js +24 -0
  18. package/dist/components/Errors/MissingTokenError.esm.js.map +1 -0
  19. package/dist/components/Errors/ServiceNotFoundError.esm.js +24 -0
  20. package/dist/components/Errors/ServiceNotFoundError.esm.js.map +1 -0
  21. package/dist/components/Escalation/EscalationPolicy.esm.js +64 -0
  22. package/dist/components/Escalation/EscalationPolicy.esm.js.map +1 -0
  23. package/dist/components/Escalation/EscalationUser.esm.js +98 -0
  24. package/dist/components/Escalation/EscalationUser.esm.js.map +1 -0
  25. package/dist/components/Escalation/EscalationUsersEmptyState.esm.js +20 -0
  26. package/dist/components/Escalation/EscalationUsersEmptyState.esm.js.map +1 -0
  27. package/dist/components/Escalation/EscalationUsersForbiddenState.esm.js +20 -0
  28. package/dist/components/Escalation/EscalationUsersForbiddenState.esm.js.map +1 -0
  29. package/dist/components/HomePagePagerDutyCard/Content.esm.js +9 -0
  30. package/dist/components/HomePagePagerDutyCard/Content.esm.js.map +1 -0
  31. package/dist/components/HomePagePagerDutyCard/index.esm.js +2 -0
  32. package/dist/components/HomePagePagerDutyCard/index.esm.js.map +1 -0
  33. package/dist/components/Incident/IncidentEmptyState.esm.js +27 -0
  34. package/dist/components/Incident/IncidentEmptyState.esm.js.map +1 -0
  35. package/dist/components/Incident/IncidentForbiddenState.esm.js +17 -0
  36. package/dist/components/Incident/IncidentForbiddenState.esm.js.map +1 -0
  37. package/dist/components/Incident/IncidentListItem.esm.js +114 -0
  38. package/dist/components/Incident/IncidentListItem.esm.js.map +1 -0
  39. package/dist/components/Incident/Incidents.esm.js +41 -0
  40. package/dist/components/Incident/Incidents.esm.js.map +1 -0
  41. package/dist/components/PagerDutyCard/index.esm.js +193 -0
  42. package/dist/components/PagerDutyCard/index.esm.js.map +1 -0
  43. package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js +35 -0
  44. package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js.map +1 -0
  45. package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js +42 -0
  46. package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js.map +1 -0
  47. package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js +95 -0
  48. package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js.map +1 -0
  49. package/dist/components/PagerDutyCardCommon/StatusCard.esm.js +102 -0
  50. package/dist/components/PagerDutyCardCommon/StatusCard.esm.js.map +1 -0
  51. package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js +59 -0
  52. package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js.map +1 -0
  53. package/dist/components/PagerDutySmallCard/index.esm.js +209 -0
  54. package/dist/components/PagerDutySmallCard/index.esm.js.map +1 -0
  55. package/dist/components/TriggerButton/index.esm.js +48 -0
  56. package/dist/components/TriggerButton/index.esm.js.map +1 -0
  57. package/dist/components/TriggerDialog/TriggerDialog.esm.js +94 -0
  58. package/dist/components/TriggerDialog/TriggerDialog.esm.js.map +1 -0
  59. package/dist/components/constants.esm.js +5 -0
  60. package/dist/components/constants.esm.js.map +1 -0
  61. package/dist/components/pagerDutyEntity.esm.js +13 -0
  62. package/dist/components/pagerDutyEntity.esm.js.map +1 -0
  63. package/dist/deprecated.esm.js +10 -0
  64. package/dist/deprecated.esm.js.map +1 -0
  65. package/dist/hooks/index.esm.js +10 -0
  66. package/dist/hooks/index.esm.js.map +1 -0
  67. package/dist/index.d.ts +1 -1
  68. package/dist/index.esm.js +6 -30
  69. package/dist/index.esm.js.map +1 -1
  70. package/dist/plugin.esm.js +71 -0
  71. package/dist/plugin.esm.js.map +1 -0
  72. package/package.json +12 -10
  73. package/dist/esm/index-b1b65bd2.esm.js +0 -37
  74. package/dist/esm/index-b1b65bd2.esm.js.map +0 -1
  75. package/dist/esm/index-b56f9c4b.esm.js +0 -1595
  76. package/dist/esm/index-b56f9c4b.esm.js.map +0 -1
@@ -0,0 +1,151 @@
1
+ import { createApiRef } from '@backstage/core-plugin-api';
2
+ import { NotFoundError } from '@backstage/errors';
3
+ import { getPagerDutyEntity } from '../components/pagerDutyEntity.esm.js';
4
+
5
+ class UnauthorizedError extends Error {
6
+ }
7
+ class ForbiddenError extends Error {
8
+ }
9
+ const pagerDutyApiRef = createApiRef({
10
+ id: "plugin.pagerduty.api"
11
+ });
12
+ class PagerDutyClient {
13
+ constructor(config) {
14
+ this.config = config;
15
+ }
16
+ static fromConfig(configApi, dependencies) {
17
+ var _a;
18
+ const { discoveryApi, fetchApi } = dependencies;
19
+ const eventsBaseUrl = (_a = configApi.getOptionalString("pagerDuty.eventsBaseUrl")) != null ? _a : "https://events.pagerduty.com/v2";
20
+ return new PagerDutyClient({
21
+ eventsBaseUrl,
22
+ discoveryApi,
23
+ fetchApi
24
+ });
25
+ }
26
+ async getServiceByPagerDutyEntity(pagerDutyEntity) {
27
+ const { integrationKey, serviceId } = pagerDutyEntity;
28
+ let response;
29
+ let url;
30
+ if (integrationKey) {
31
+ url = `${await this.config.discoveryApi.getBaseUrl(
32
+ "pagerduty"
33
+ )}/services?integration_key=${integrationKey}`;
34
+ const serviceResponse = await this.findByUrl(url);
35
+ if (serviceResponse.service === void 0)
36
+ throw new NotFoundError();
37
+ response = serviceResponse;
38
+ } else if (serviceId) {
39
+ url = `${await this.config.discoveryApi.getBaseUrl(
40
+ "pagerduty"
41
+ )}/services/${serviceId}`;
42
+ response = await this.findByUrl(url);
43
+ } else {
44
+ throw new NotFoundError();
45
+ }
46
+ return response;
47
+ }
48
+ async getServiceByEntity(entity) {
49
+ return await this.getServiceByPagerDutyEntity(getPagerDutyEntity(entity));
50
+ }
51
+ async getServiceById(serviceId) {
52
+ const url = `${await this.config.discoveryApi.getBaseUrl(
53
+ "pagerduty"
54
+ )}/services/${serviceId}`;
55
+ return await this.findByUrl(url);
56
+ }
57
+ async getIncidentsByServiceId(serviceId) {
58
+ const url = `${await this.config.discoveryApi.getBaseUrl(
59
+ "pagerduty"
60
+ )}/services/${serviceId}/incidents`;
61
+ return await this.findByUrl(url);
62
+ }
63
+ async getChangeEventsByServiceId(serviceId) {
64
+ const url = `${await this.config.discoveryApi.getBaseUrl(
65
+ "pagerduty"
66
+ )}/services/${serviceId}/change-events`;
67
+ return await this.findByUrl(url);
68
+ }
69
+ async getServiceStandardsByServiceId(serviceId) {
70
+ const url = `${await this.config.discoveryApi.getBaseUrl(
71
+ "pagerduty"
72
+ )}/services/${serviceId}/standards`;
73
+ return await this.findByUrl(url);
74
+ }
75
+ async getServiceMetricsByServiceId(serviceId) {
76
+ const url = `${await this.config.discoveryApi.getBaseUrl(
77
+ "pagerduty"
78
+ )}/services/${serviceId}/metrics`;
79
+ return await this.findByUrl(url);
80
+ }
81
+ async getOnCallByPolicyId(policyId) {
82
+ const params = `escalation_policy_ids[]=${policyId}`;
83
+ const url = `${await this.config.discoveryApi.getBaseUrl(
84
+ "pagerduty"
85
+ )}/oncall-users?${params}`;
86
+ const response = await this.findByUrl(url);
87
+ return response.users;
88
+ }
89
+ triggerAlarm(request) {
90
+ var _a;
91
+ const { integrationKey, source, description, userName } = request;
92
+ const body = JSON.stringify({
93
+ event_action: "trigger",
94
+ routing_key: integrationKey,
95
+ client: "Backstage",
96
+ client_url: source,
97
+ payload: {
98
+ summary: description,
99
+ source,
100
+ severity: "error",
101
+ class: "manual trigger",
102
+ custom_details: {
103
+ user: userName
104
+ }
105
+ }
106
+ });
107
+ const options = {
108
+ method: "POST",
109
+ headers: {
110
+ "Content-Type": "application/json; charset=UTF-8",
111
+ Accept: "application/json, text/plain, */*"
112
+ },
113
+ body
114
+ };
115
+ const url = (_a = this.config.eventsBaseUrl) != null ? _a : "https://events.pagerduty.com/v2";
116
+ return this.request(`${url}/enqueue`, options);
117
+ }
118
+ async findByUrl(url) {
119
+ const options = {
120
+ method: "GET",
121
+ headers: {
122
+ Accept: "application/vnd.pagerduty+json;version=2",
123
+ "Content-Type": "application/json"
124
+ }
125
+ };
126
+ const response = await this.request(url, options);
127
+ return response.json();
128
+ }
129
+ async request(url, options) {
130
+ const response = await this.config.fetchApi.fetch(url, options);
131
+ if (response.status === 401) {
132
+ throw new UnauthorizedError("Unauthorized: You don't have access to this resource");
133
+ }
134
+ if (response.status === 403) {
135
+ throw new ForbiddenError("Forbidden: You are not allowed to perform this action");
136
+ }
137
+ if (response.status === 404) {
138
+ throw new NotFoundError("Not Found: Resource not found");
139
+ }
140
+ if (!response.ok) {
141
+ const payload = await response.json();
142
+ const errors = payload.errors.map((error) => error).join(" ");
143
+ const message = `Request failed with ${response.status}, ${errors}`;
144
+ throw new Error(message);
145
+ }
146
+ return response;
147
+ }
148
+ }
149
+
150
+ export { ForbiddenError, PagerDutyClient, UnauthorizedError, pagerDutyApiRef };
151
+ //# sourceMappingURL=client.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PagerDutyApi,\n PagerDutyTriggerAlarmRequest,\n PagerDutyClientApiDependencies,\n PagerDutyClientApiConfig,\n RequestOptions,\n} from './types';\nimport { PagerDutyChangeEventsResponse, \n PagerDutyOnCallUsersResponse, \n PagerDutyUser, \n PagerDutyServiceResponse,\n PagerDutyIncidentsResponse,\n PagerDutyServiceStandardsResponse,\n PagerDutyServiceMetricsResponse\n} from '@pagerduty/backstage-plugin-common';\nimport { createApiRef, ConfigApi } from '@backstage/core-plugin-api';\nimport { NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { getPagerDutyEntity } from '../components/pagerDutyEntity';\nimport { PagerDutyEntity } from '../types';\n\n/** @public */\nexport class UnauthorizedError extends Error {}\n\n/** @public */\nexport class ForbiddenError extends Error { }\n\n/** @public */\nexport const pagerDutyApiRef = createApiRef<PagerDutyApi>({\n id: 'plugin.pagerduty.api',\n});\n\n/** @public */\nexport class PagerDutyClient implements PagerDutyApi {\n static fromConfig(\n configApi: ConfigApi,\n dependencies: PagerDutyClientApiDependencies,\n ) {\n const { discoveryApi, fetchApi } = dependencies;\n\n const eventsBaseUrl: string =\n configApi.getOptionalString('pagerDuty.eventsBaseUrl') ??\n 'https://events.pagerduty.com/v2';\n\n return new PagerDutyClient({\n eventsBaseUrl,\n discoveryApi,\n fetchApi,\n });\n }\n\n constructor(private readonly config: PagerDutyClientApiConfig) {}\n\n async getServiceByPagerDutyEntity(\n pagerDutyEntity: PagerDutyEntity,\n ): Promise<PagerDutyServiceResponse> {\n const { integrationKey, serviceId } = pagerDutyEntity;\n\n let response: PagerDutyServiceResponse;\n let url: string;\n\n if (integrationKey) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services?integration_key=${integrationKey}`;\n const serviceResponse = await this.findByUrl<PagerDutyServiceResponse>(url);\n\n if (serviceResponse.service === undefined) throw new NotFoundError();\n\n response = serviceResponse;\n } else if (serviceId) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n response = await this.findByUrl<PagerDutyServiceResponse>(url);\n } else {\n throw new NotFoundError();\n }\n\n return response;\n }\n\n async getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse> {\n return await this.getServiceByPagerDutyEntity(getPagerDutyEntity(entity));\n }\n\n async getServiceById(serviceId: string): Promise<PagerDutyServiceResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n return await this.findByUrl<PagerDutyServiceResponse>(url);\n }\n\n async getIncidentsByServiceId(\n serviceId: string,\n ): Promise<PagerDutyIncidentsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/incidents`;\n\n return await this.findByUrl<PagerDutyIncidentsResponse>(url);\n }\n\n async getChangeEventsByServiceId(\n serviceId: string,\n ): Promise<PagerDutyChangeEventsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/change-events`;\n\n return await this.findByUrl<PagerDutyChangeEventsResponse>(url);\n }\n\n async getServiceStandardsByServiceId(\n serviceId: string,\n ): Promise<PagerDutyServiceStandardsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/standards`;\n\n return await this.findByUrl<PagerDutyServiceStandardsResponse>(url);\n }\n\n async getServiceMetricsByServiceId(\n serviceId: string,\n ): Promise<PagerDutyServiceMetricsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/metrics`;\n\n return await this.findByUrl<PagerDutyServiceMetricsResponse>(url);\n }\n\n async getOnCallByPolicyId(\n policyId: string,\n ): Promise<PagerDutyUser[]> {\n const params = `escalation_policy_ids[]=${policyId}`;\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/oncall-users?${params}`;\n\n const response: PagerDutyOnCallUsersResponse = await this.findByUrl<PagerDutyOnCallUsersResponse>(url);\n return response.users;\n }\n\n triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response> {\n const { integrationKey, source, description, userName } = request;\n\n const body = JSON.stringify({\n event_action: 'trigger',\n routing_key: integrationKey,\n client: 'Backstage',\n client_url: source,\n payload: {\n summary: description,\n source: source,\n severity: 'error',\n class: 'manual trigger',\n custom_details: {\n user: userName,\n },\n },\n });\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = this.config.eventsBaseUrl ?? 'https://events.pagerduty.com/v2';\n\n return this.request(`${url}/enqueue`, options);\n }\n\n private async findByUrl<T>(url: string): Promise<T> {\n const options = {\n method: 'GET',\n headers: {\n Accept: 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n const response = await this.request(url, options);\n return response.json();\n }\n\n private async request(\n url: string,\n options: RequestOptions,\n ): Promise<Response> {\n const response = await this.config.fetchApi.fetch(url, options);\n if (response.status === 401) {\n throw new UnauthorizedError(\"Unauthorized: You don't have access to this resource\");\n }\n\n if (response.status === 403) {\n throw new ForbiddenError(\"Forbidden: You are not allowed to perform this action\");\n }\n\n if (response.status === 404) {\n throw new NotFoundError(\"Not Found: Resource not found\");\n }\n\n if (!response.ok) {\n const payload = await response.json();\n const errors = payload.errors.map((error: string) => error).join(' ');\n const message = `Request failed with ${response.status}, ${errors}`;\n throw new Error(message);\n }\n return response;\n }\n}\n"],"names":[],"mappings":";;;;AAsCO,MAAM,0BAA0B,KAAM,CAAA;AAAC,CAAA;AAGvC,MAAM,uBAAuB,KAAM,CAAA;AAAE,CAAA;AAGrC,MAAM,kBAAkB,YAA2B,CAAA;AAAA,EACxD,EAAI,EAAA,sBAAA;AACN,CAAC,EAAA;AAGM,MAAM,eAAwC,CAAA;AAAA,EAkBnD,YAA6B,MAAkC,EAAA;AAAlC,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAAmC;AAAA,EAjBhE,OAAO,UACL,CAAA,SAAA,EACA,YACA,EAAA;AArDJ,IAAA,IAAA,EAAA,CAAA;AAsDI,IAAM,MAAA,EAAE,YAAc,EAAA,QAAA,EAAa,GAAA,YAAA,CAAA;AAEnC,IAAA,MAAM,aACJ,GAAA,CAAA,EAAA,GAAA,SAAA,CAAU,iBAAkB,CAAA,yBAAyB,MAArD,IACA,GAAA,EAAA,GAAA,iCAAA,CAAA;AAEF,IAAA,OAAO,IAAI,eAAgB,CAAA;AAAA,MACzB,aAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AAAA,EAIA,MAAM,4BACJ,eACmC,EAAA;AACnC,IAAM,MAAA,EAAE,cAAgB,EAAA,SAAA,EAAc,GAAA,eAAA,CAAA;AAEtC,IAAI,IAAA,QAAA,CAAA;AACJ,IAAI,IAAA,GAAA,CAAA;AAEJ,IAAA,IAAI,cAAgB,EAAA;AAClB,MAAA,GAAA,GAAM,CAAG,EAAA,MAAM,IAAK,CAAA,MAAA,CAAO,YAAa,CAAA,UAAA;AAAA,QACtC,WAAA;AAAA,OACD,6BAA6B,cAAc,CAAA,CAAA,CAAA;AAC5C,MAAA,MAAM,eAAkB,GAAA,MAAM,IAAK,CAAA,SAAA,CAAoC,GAAG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,OACZ,CAAA,GAAA,EACA,OACmB,EAAA;AACnB,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,OAAO,QAAS,CAAA,KAAA,CAAM,KAAK,OAAO,CAAA,CAAA;AAC9D,IAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,MAAM,MAAA,IAAI,kBAAkB,sDAAsD,CAAA,CAAA;AAAA,KACpF;AAEA,IAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,MAAM,MAAA,IAAI,eAAe,uDAAuD,CAAA,CAAA;AAAA,KAClF;AAEA,IAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,MAAM,MAAA,IAAI,cAAc,+BAA+B,CAAA,CAAA;AAAA,KACzD;AAEA,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,OAAA,GAAU,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACpC,MAAM,MAAA,MAAA,GAAS,QAAQ,MAAO,CAAA,GAAA,CAAI,CAAC,KAAkB,KAAA,KAAK,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACpE,MAAA,MAAM,OAAU,GAAA,CAAA,oBAAA,EAAuB,QAAS,CAAA,MAAM,KAAK,MAAM,CAAA,CAAA,CAAA;AACjE,MAAM,MAAA,IAAI,MAAM,OAAO,CAAA,CAAA;AAAA,KACzB;AACA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Grid, Typography } from '@material-ui/core';
3
+ import EmptyStateImage from '../../assets/emptystate.svg';
4
+
5
+ const ChangeEventEmptyState = () => {
6
+ return /* @__PURE__ */ React.createElement(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "No change events to display yet.")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
7
+ "img",
8
+ {
9
+ src: EmptyStateImage,
10
+ alt: "EmptyState",
11
+ "data-testid": "emptyStateImg"
12
+ }
13
+ )));
14
+ };
15
+
16
+ export { ChangeEventEmptyState };
17
+ //# sourceMappingURL=ChangeEventEmptyState.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeEventEmptyState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Grid, Typography } from '@material-ui/core';\nimport EmptyStateImage from '../../assets/emptystate.svg';\n\nexport const ChangeEventEmptyState = () => {\n return (\n <Grid container justifyContent=\"center\" direction=\"column\" alignItems=\"center\">\n <Grid item xs={12}>\n <Typography variant=\"h5\">No change events to display yet.</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={EmptyStateImage}\n alt=\"EmptyState\"\n data-testid=\"emptyStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,wBAAwB,MAAM;AACzC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,cAAe,EAAA,QAAA,EAAS,SAAU,EAAA,QAAA,EAAS,UAAW,EAAA,QAAA,EAAA,kBACnE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAA,EAAK,kCAAgC,CAC3D,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,eAAA;AAAA,MACL,GAAI,EAAA,YAAA;AAAA,MACJ,aAAY,EAAA,eAAA;AAAA,KAAA;AAAA,GAEhB,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { Grid, Typography } from '@material-ui/core';
3
+ import ForbiddenStateImage from '../../assets/forbiddenstate.svg';
4
+
5
+ const ChangeEventForbiddenState = () => {
6
+ return /* @__PURE__ */ React.createElement(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Feature not available with your account or token.")), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
7
+ "img",
8
+ {
9
+ src: ForbiddenStateImage,
10
+ alt: "ForbiddenState",
11
+ "data-testid": "forbiddenStateImg"
12
+ }
13
+ )));
14
+ };
15
+
16
+ export { ChangeEventForbiddenState };
17
+ //# sourceMappingURL=ChangeEventForbiddenState.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeEventForbiddenState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventForbiddenState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Grid, Typography } from '@material-ui/core';\nimport ForbiddenStateImage from '../../assets/forbiddenstate.svg';\n\nexport const ChangeEventForbiddenState = () => {\n return (\n <Grid container justifyContent=\"center\" direction=\"column\" alignItems=\"center\">\n <Grid item xs={12}>\n <Typography variant=\"h5\">Feature not available with your account or token.</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={ForbiddenStateImage}\n alt=\"ForbiddenState\"\n data-testid=\"forbiddenStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAqBO,MAAM,4BAA4B,MAAM;AAC7C,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,cAAe,EAAA,QAAA,EAAS,SAAU,EAAA,QAAA,EAAS,UAAW,EAAA,QAAA,EAAA,kBACnE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,EAAI,EAAA,EAAA,EAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAA,EAAK,mDAAiD,CAC5E,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IAAC,EAAA,EAAA,EAAI,EACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,mBAAA;AAAA,MACL,GAAI,EAAA,gBAAA;AAAA,MACJ,aAAY,EAAA,mBAAA;AAAA,KAAA;AAAA,GAEhB,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { Link } from '@backstage/core-components';
3
+ import { makeStyles, Tooltip, IconButton, ListItem, ListItemText, Typography, ListItemSecondaryAction } from '@material-ui/core';
4
+ import { DateTime, Duration } from 'luxon';
5
+ import OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';
6
+ import LinkIcon from '@material-ui/icons/Link';
7
+
8
+ const useStyles = makeStyles((theme) => ({
9
+ denseListIcon: {
10
+ marginRight: 0,
11
+ display: "flex",
12
+ flexDirection: "column",
13
+ alignItems: "center",
14
+ justifyContent: "center"
15
+ },
16
+ listItemPrimary: {
17
+ fontWeight: "bold"
18
+ },
19
+ smallExternalLinkIconStyle: {
20
+ color: theme.palette.text.primary
21
+ },
22
+ smallExternalLinkWithoutMarginIconStyle: {
23
+ color: theme.palette.text.primary,
24
+ marginRight: "-20px"
25
+ },
26
+ smallIconStyle: {
27
+ color: theme.palette.text.primary,
28
+ marginRight: "-20px"
29
+ }
30
+ }));
31
+ const ChangeEventListItem = ({ changeEvent }) => {
32
+ const classes = useStyles();
33
+ const duration = (/* @__PURE__ */ new Date()).getTime() - new Date(changeEvent.timestamp).getTime();
34
+ const changedAt = DateTime.local().minus(Duration.fromMillis(duration)).toRelative({ locale: "en" });
35
+ let externalLinkElem;
36
+ if (changeEvent.links.length > 0) {
37
+ const text = changeEvent.links[0].text;
38
+ externalLinkElem = /* @__PURE__ */ React.createElement(Tooltip, { title: text, placement: "top" }, /* @__PURE__ */ React.createElement(
39
+ IconButton,
40
+ {
41
+ component: Link,
42
+ to: changeEvent.links[0].href,
43
+ className: changeEvent.html_url === void 0 ? classes.smallExternalLinkWithoutMarginIconStyle : classes.smallExternalLinkIconStyle
44
+ },
45
+ /* @__PURE__ */ React.createElement(LinkIcon, null)
46
+ ));
47
+ }
48
+ return /* @__PURE__ */ React.createElement(ListItem, { dense: true, key: changeEvent.id }, /* @__PURE__ */ React.createElement(
49
+ ListItemText,
50
+ {
51
+ primary: /* @__PURE__ */ React.createElement(React.Fragment, null, changeEvent.summary),
52
+ primaryTypographyProps: {
53
+ variant: "body1",
54
+ className: classes.listItemPrimary
55
+ },
56
+ secondary: /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "Triggered from ", changeEvent.source, " ", changedAt, ".")
57
+ }
58
+ ), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, externalLinkElem, changeEvent.html_url === void 0 ? null : /* @__PURE__ */ React.createElement(Tooltip, { title: "View in PagerDuty", placement: "top" }, /* @__PURE__ */ React.createElement(
59
+ IconButton,
60
+ {
61
+ component: Link,
62
+ to: changeEvent.html_url,
63
+ className: classes.smallIconStyle
64
+ },
65
+ /* @__PURE__ */ React.createElement(OpenInBrowserIcon, null)
66
+ ))));
67
+ };
68
+
69
+ export { ChangeEventListItem };
70
+ //# sourceMappingURL=ChangeEventListItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeEventListItem.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Link } from '@backstage/core-components';\nimport {\n ListItem,\n ListItemSecondaryAction,\n Tooltip,\n ListItemText,\n makeStyles,\n IconButton,\n Typography,\n} from '@material-ui/core';\nimport { DateTime, Duration } from 'luxon';\nimport { PagerDutyChangeEvent } from '@pagerduty/backstage-plugin-common';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>((theme) => ({\n denseListIcon: {\n marginRight: 0,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n listItemPrimary: {\n fontWeight: \"bold\",\n },\n smallExternalLinkIconStyle: {\n color: theme.palette.text.primary,\n },\n smallExternalLinkWithoutMarginIconStyle: {\n color: theme.palette.text.primary,\n marginRight: \"-20px\",\n },\n smallIconStyle: {\n color: theme.palette.text.primary,\n marginRight: \"-20px\",\n },\n}));\n\ntype Props = {\n changeEvent: PagerDutyChangeEvent;\n};\n\nexport const ChangeEventListItem = ({ changeEvent }: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(changeEvent.timestamp).getTime();\n const changedAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n \n let externalLinkElem: JSX.Element | undefined;\n if (changeEvent.links.length > 0) {\n const text: string = changeEvent.links[0].text;\n externalLinkElem = (\n <Tooltip title={text} placement=\"top\">\n <IconButton\n component={Link}\n to={changeEvent.links[0].href}\n className={\n changeEvent.html_url === undefined\n ? classes.smallExternalLinkWithoutMarginIconStyle\n : classes.smallExternalLinkIconStyle\n }\n >\n <LinkIcon />\n </IconButton>\n </Tooltip>\n );\n }\n\n return (\n <ListItem dense key={changeEvent.id}>\n <ListItemText\n primary={<>{changeEvent.summary}</>}\n primaryTypographyProps={{\n variant: 'body1',\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography variant=\"body2\" color=\"textSecondary\">\n Triggered from {changeEvent.source} {changedAt}.\n </Typography>\n }\n />\n <ListItemSecondaryAction>\n {externalLinkElem}\n {changeEvent.html_url === undefined ? null : (\n <Tooltip title=\"View in PagerDuty\" placement=\"top\">\n <IconButton\n component={Link}\n to={changeEvent.html_url}\n className={classes.smallIconStyle}\n >\n <OpenInBrowserIcon />\n </IconButton>\n </Tooltip>\n )}\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAkCA,MAAM,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A,CAAA,OAAA,EAAA,EAAQ,KAAM,EAAA,mBAAA,EAAoB,WAAU,KAC3C,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,IAAI,WAAY,CAAA,QAAA;AAAA,MAChB,WAAW,OAAQ,CAAA,cAAA;AAAA,KAAA;AAAA,wCAElB,iBAAkB,EAAA,IAAA,CAAA;AAAA,GAEvB,CAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,45 @@
1
+ import React, { useEffect } from 'react';
2
+ import { List } from '@material-ui/core';
3
+ import { ChangeEventListItem } from './ChangeEventListItem.esm.js';
4
+ import { ChangeEventEmptyState } from './ChangeEventEmptyState.esm.js';
5
+ import { ChangeEventForbiddenState } from './ChangeEventForbiddenState.esm.js';
6
+ import useAsyncFn from 'react-use/lib/useAsyncFn';
7
+ import { pagerDutyApiRef } from '../../api/client.esm.js';
8
+ import { useApi } from '@backstage/core-plugin-api';
9
+ import { Progress } from '@backstage/core-components';
10
+ import { Alert } from '@material-ui/lab';
11
+
12
+ const ChangeEvents = ({ serviceId, refreshEvents }) => {
13
+ const api = useApi(pagerDutyApiRef);
14
+ const [{ value: changeEvents, loading, error }, getChangeEvents] = useAsyncFn(
15
+ async () => {
16
+ const { change_events } = await api.getChangeEventsByServiceId(serviceId);
17
+ return change_events;
18
+ }
19
+ );
20
+ useEffect(() => {
21
+ getChangeEvents();
22
+ }, [refreshEvents, getChangeEvents]);
23
+ if (error) {
24
+ if (error.message.includes("Forbidden")) {
25
+ return /* @__PURE__ */ React.createElement(ChangeEventForbiddenState, null);
26
+ }
27
+ return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Error encountered while fetching information. ", error.message);
28
+ }
29
+ if (loading) {
30
+ return /* @__PURE__ */ React.createElement(Progress, null);
31
+ }
32
+ if (!(changeEvents == null ? void 0 : changeEvents.length)) {
33
+ return /* @__PURE__ */ React.createElement(ChangeEventEmptyState, null);
34
+ }
35
+ return /* @__PURE__ */ React.createElement(List, { dense: true }, changeEvents.map((changeEvent, index) => /* @__PURE__ */ React.createElement(
36
+ ChangeEventListItem,
37
+ {
38
+ key: changeEvent.id + index,
39
+ changeEvent
40
+ }
41
+ )));
42
+ };
43
+
44
+ export { ChangeEvents };
45
+ //# sourceMappingURL=ChangeEvents.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeEvents.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEvents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React, { useEffect } from 'react';\nimport { List } from '@material-ui/core';\nimport { ChangeEventListItem } from './ChangeEventListItem';\nimport { ChangeEventEmptyState } from './ChangeEventEmptyState';\nimport { ChangeEventForbiddenState } from './ChangeEventForbiddenState';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { pagerDutyApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\nimport { Alert } from '@material-ui/lab';\n\ntype Props = {\n serviceId: string;\n refreshEvents: boolean;\n};\n\nexport const ChangeEvents = ({ serviceId, refreshEvents }: Props) => {\n const api = useApi(pagerDutyApiRef);\n\n const [{ value: changeEvents, loading, error }, getChangeEvents] = useAsyncFn(\n async () => {\n const { change_events } = await api.getChangeEventsByServiceId(serviceId);\n return change_events;\n },\n );\n\n useEffect(() => {\n getChangeEvents();\n }, [refreshEvents, getChangeEvents]);\n\n if (error) {\n if (error.message.includes('Forbidden')) {\n return <ChangeEventForbiddenState />;\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!changeEvents?.length) {\n return <ChangeEventEmptyState />;\n }\n\n return (\n <List dense>\n {changeEvents!.map((changeEvent, index) => (\n <ChangeEventListItem\n key={changeEvent.id + index}\n changeEvent={changeEvent}\n />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiCO,MAAM,YAAe,GAAA,CAAC,EAAE,SAAA,EAAW,eAA2B,KAAA;AACnE,EAAM,MAAA,GAAA,GAAM,OAAO,eAAe,CAAA,CAAA;AAElC,EAAM,MAAA,CAAC,EAAE,KAAO,EAAA,YAAA,EAAc,SAAS,KAAM,EAAA,EAAG,eAAe,CAAI,GAAA,UAAA;AAAA,IACjE,YAAY;AACV,MAAA,MAAM,EAAE,aAAc,EAAA,GAAI,MAAM,GAAA,CAAI,2BAA2B,SAAS,CAAA,CAAA;AACxE,MAAO,OAAA,aAAA,CAAA;AAAA,KACT;AAAA,GACF,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAgB,eAAA,EAAA,CAAA;AAAA,GACf,EAAA,CAAC,aAAe,EAAA,eAAe,CAAC,CAAA,CAAA;AAEnC,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,IAAI,KAAM,CAAA,OAAA,CAAQ,QAAS,CAAA,WAAW,CAAG,EAAA;AACvC,MAAA,2CAAQ,yBAA0B,EAAA,IAAA,CAAA,CAAA;AAAA,KACpC;AAEA,IAAA,2CACG,KAAM,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,EAAA,gDAAA,EACyB,MAAM,OACvD,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AAEA,EAAI,IAAA,EAAC,6CAAc,MAAQ,CAAA,EAAA;AACzB,IAAA,2CAAQ,qBAAsB,EAAA,IAAA,CAAA,CAAA;AAAA,GAChC;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,KAAK,EAAA,IAAA,EAAA,EACR,aAAc,GAAI,CAAA,CAAC,aAAa,KAC/B,qBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,YAAY,EAAK,GAAA,KAAA;AAAA,MACtB,WAAA;AAAA,KAAA;AAAA,GAEH,CACH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants.esm.js';
3
+ import { useEntity } from '@backstage/plugin-catalog-react';
4
+ import { getPagerDutyEntity } from '../pagerDutyEntity.esm.js';
5
+ import { PagerDutyCard } from '../PagerDutyCard/index.esm.js';
6
+
7
+ const isPluginApplicableToEntity = (entity) => {
8
+ var _a, _b;
9
+ return Boolean(
10
+ ((_a = entity.metadata.annotations) == null ? void 0 : _a[PAGERDUTY_INTEGRATION_KEY]) || ((_b = entity.metadata.annotations) == null ? void 0 : _b[PAGERDUTY_SERVICE_ID])
11
+ );
12
+ };
13
+ const EntityPagerDutyCard = (props) => {
14
+ const { readOnly, disableChangeEvents, disableOnCall } = props;
15
+ const { entity } = useEntity();
16
+ const pagerDutyEntity = getPagerDutyEntity(entity);
17
+ return /* @__PURE__ */ React.createElement(
18
+ PagerDutyCard,
19
+ {
20
+ ...pagerDutyEntity,
21
+ readOnly,
22
+ disableChangeEvents,
23
+ disableOnCall
24
+ }
25
+ );
26
+ };
27
+
28
+ export { EntityPagerDutyCard, isPluginApplicableToEntity };
29
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutyCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutyCard } from '../PagerDutyCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutyCardProps = {\n readOnly?: boolean;\n disableChangeEvents?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutyCard = (props: EntityPagerDutyCardProps) => {\n const { readOnly, disableChangeEvents, disableOnCall } = props;\n const { entity } = useEntity();\n const pagerDutyEntity = getPagerDutyEntity(entity);\n return (\n <PagerDutyCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableChangeEvents={disableChangeEvents}\n disableOnCall={disableOnCall}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwBa,MAAA,0BAAA,GAA6B,CAAC,MAAgB,KAAA;AAxB3D,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAyBE,EAAA,OAAA,OAAA;AAAA,IACE,CAAA,CAAA,EAAA,GAAA,MAAA,CAAO,SAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,iCAC5B,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,gBAAhB,IAA8B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,CAAA;AAAA,GAClC,CAAA;AAAA,EAAA;AAUW,MAAA,mBAAA,GAAsB,CAAC,KAAoC,KAAA;AACtE,EAAA,MAAM,EAAE,QAAA,EAAU,mBAAqB,EAAA,aAAA,EAAkB,GAAA,KAAA,CAAA;AACzD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAM,MAAA,eAAA,GAAkB,mBAAmB,MAAM,CAAA,CAAA;AACjD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,QAAA;AAAA,MACA,mBAAA;AAAA,MACA,aAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants.esm.js';
3
+ import { useEntity } from '@backstage/plugin-catalog-react';
4
+ import { getPagerDutyEntity } from '../pagerDutyEntity.esm.js';
5
+ import { PagerDutySmallCard } from '../PagerDutySmallCard/index.esm.js';
6
+
7
+ const isPluginApplicableToEntity = (entity) => {
8
+ var _a, _b;
9
+ return Boolean(
10
+ ((_a = entity.metadata.annotations) == null ? void 0 : _a[PAGERDUTY_INTEGRATION_KEY]) || ((_b = entity.metadata.annotations) == null ? void 0 : _b[PAGERDUTY_SERVICE_ID])
11
+ );
12
+ };
13
+ const EntityPagerDutySmallCard = (props) => {
14
+ const { readOnly, disableInsights, disableOnCall } = props;
15
+ const { entity } = useEntity();
16
+ const pagerDutyEntity = getPagerDutyEntity(entity);
17
+ return /* @__PURE__ */ React.createElement(
18
+ PagerDutySmallCard,
19
+ {
20
+ ...pagerDutyEntity,
21
+ readOnly,
22
+ disableInsights,
23
+ disableOnCall
24
+ }
25
+ );
26
+ };
27
+
28
+ export { EntityPagerDutySmallCard, isPluginApplicableToEntity };
29
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutySmallCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutySmallCard } from '../PagerDutySmallCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutySmallCardProps = {\n readOnly?: boolean;\n disableInsights?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutySmallCard = (props: EntityPagerDutySmallCardProps) => {\n const { readOnly, disableInsights, disableOnCall } = props;\n const { entity } = useEntity();\n const pagerDutyEntity = getPagerDutyEntity(entity);\n return (\n <PagerDutySmallCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableInsights={disableInsights}\n disableOnCall={disableOnCall}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAwBa,MAAA,0BAAA,GAA6B,CAAC,MAAgB,KAAA;AAxB3D,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAyBE,EAAA,OAAA,OAAA;AAAA,IACE,CAAA,CAAA,EAAA,GAAA,MAAA,CAAO,SAAS,WAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA8B,iCAC5B,EAAO,GAAA,MAAA,CAAA,QAAA,CAAS,gBAAhB,IAA8B,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,CAAA;AAAA,GAClC,CAAA;AAAA,EAAA;AAUW,MAAA,wBAAA,GAA2B,CAAC,KAAyC,KAAA;AAChF,EAAA,MAAM,EAAE,QAAA,EAAU,eAAiB,EAAA,aAAA,EAAkB,GAAA,KAAA,CAAA;AACrD,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAM,MAAA,eAAA,GAAkB,mBAAmB,MAAM,CAAA,CAAA;AACjD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,QAAA;AAAA,MACA,eAAA;AAAA,MACA,aAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Button } from '@material-ui/core';
3
+ import { EmptyState } from '@backstage/core-components';
4
+
5
+ const ForbiddenError = () => /* @__PURE__ */ React.createElement(
6
+ EmptyState,
7
+ {
8
+ missing: "info",
9
+ title: "Unauthorized",
10
+ description: "You don't have the required permissions to perform this action. See README for more details.",
11
+ action: /* @__PURE__ */ React.createElement(
12
+ Button,
13
+ {
14
+ color: "primary",
15
+ variant: "contained",
16
+ href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
17
+ },
18
+ "Read More"
19
+ )
20
+ }
21
+ );
22
+
23
+ export { ForbiddenError };
24
+ //# sourceMappingURL=ForbiddenError.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForbiddenError.esm.js","sources":["../../../src/components/Errors/ForbiddenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const ForbiddenError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Unauthorized\"\n description=\"You don't have the required permissions to perform this action. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAoBO,MAAM,iBAAiB,sBAC5B,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,cAAA;AAAA,IACN,WAAY,EAAA,8FAAA;AAAA,IACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,8EAAA;AAAA,OAAA;AAAA,MACN,WAAA;AAAA,KAED;AAAA,GAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Button } from '@material-ui/core';
3
+ import { EmptyState } from '@backstage/core-components';
4
+
5
+ const MissingTokenError = () => /* @__PURE__ */ React.createElement(
6
+ EmptyState,
7
+ {
8
+ missing: "info",
9
+ title: "Missing or invalid PagerDuty Token",
10
+ description: "The request to fetch data needs a valid token. See README for more details.",
11
+ action: /* @__PURE__ */ React.createElement(
12
+ Button,
13
+ {
14
+ color: "primary",
15
+ variant: "contained",
16
+ href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
17
+ },
18
+ "Read More"
19
+ )
20
+ }
21
+ );
22
+
23
+ export { MissingTokenError };
24
+ //# sourceMappingURL=MissingTokenError.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MissingTokenError.esm.js","sources":["../../../src/components/Errors/MissingTokenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingTokenError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid PagerDuty Token\"\n description=\"The request to fetch data needs a valid token. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAoBO,MAAM,oBAAoB,sBAC/B,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,oCAAA;AAAA,IACN,WAAY,EAAA,6EAAA;AAAA,IACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,8EAAA;AAAA,OAAA;AAAA,MACN,WAAA;AAAA,KAED;AAAA,GAAA;AAEJ;;;;"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Button } from '@material-ui/core';
3
+ import { EmptyState } from '@backstage/core-components';
4
+
5
+ const ServiceNotFoundError = () => /* @__PURE__ */ React.createElement(
6
+ EmptyState,
7
+ {
8
+ missing: "data",
9
+ title: "PagerDuty Service Not Found",
10
+ description: "A service could not be found within PagerDuty based on the provided service id. Please verify your configuration.",
11
+ action: /* @__PURE__ */ React.createElement(
12
+ Button,
13
+ {
14
+ color: "primary",
15
+ variant: "contained",
16
+ href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
17
+ },
18
+ "Read More"
19
+ )
20
+ }
21
+ );
22
+
23
+ export { ServiceNotFoundError };
24
+ //# sourceMappingURL=ServiceNotFoundError.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServiceNotFoundError.esm.js","sources":["../../../src/components/Errors/ServiceNotFoundError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from 'react';\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const ServiceNotFoundError = () => (\n <EmptyState\n missing=\"data\"\n title=\"PagerDuty Service Not Found\"\n description=\"A service could not be found within PagerDuty based on the provided service id. Please verify your configuration.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAoBO,MAAM,uBAAuB,sBAClC,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,MAAA;AAAA,IACR,KAAM,EAAA,6BAAA;AAAA,IACN,WAAY,EAAA,mHAAA;AAAA,IACZ,MACE,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,SAAA;AAAA,QACN,OAAQ,EAAA,WAAA;AAAA,QACR,IAAK,EAAA,8EAAA;AAAA,OAAA;AAAA,MACN,WAAA;AAAA,KAED;AAAA,GAAA;AAEJ;;;;"}
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import { makeStyles, createStyles, List, ListSubheader } from '@material-ui/core';
3
+ import { EscalationUsersEmptyState } from './EscalationUsersEmptyState.esm.js';
4
+ import { EscalationUsersForbiddenState } from './EscalationUsersForbiddenState.esm.js';
5
+ import { EscalationUser } from './EscalationUser.esm.js';
6
+ import useAsync from 'react-use/lib/useAsync';
7
+ import { pagerDutyApiRef } from '../../api/client.esm.js';
8
+ import { Alert } from '@material-ui/lab';
9
+ import { useApi } from '@backstage/core-plugin-api';
10
+ import { Progress } from '@backstage/core-components';
11
+
12
+ const useStyles = makeStyles(
13
+ () => createStyles({
14
+ listStyle: {
15
+ marginLeft: "-15px"
16
+ }
17
+ })
18
+ );
19
+ const EscalationPolicy = ({
20
+ policyId,
21
+ policyUrl,
22
+ policyName
23
+ }) => {
24
+ const api = useApi(pagerDutyApiRef);
25
+ const classes = useStyles();
26
+ const {
27
+ value: users,
28
+ loading,
29
+ error
30
+ } = useAsync(async () => {
31
+ return await api.getOnCallByPolicyId(policyId);
32
+ });
33
+ if (error) {
34
+ if (error.message.includes("Forbidden")) {
35
+ return /* @__PURE__ */ React.createElement(List, { dense: true, subheader: /* @__PURE__ */ React.createElement(ListSubheader, null, "ON CALL") }, /* @__PURE__ */ React.createElement(EscalationUsersForbiddenState, null));
36
+ }
37
+ return /* @__PURE__ */ React.createElement(Alert, { severity: "error" }, "Error encountered while fetching information. ", error.message);
38
+ }
39
+ if (loading) {
40
+ return /* @__PURE__ */ React.createElement(Progress, null);
41
+ }
42
+ if (!(users == null ? void 0 : users.length)) {
43
+ return /* @__PURE__ */ React.createElement(EscalationUsersEmptyState, null);
44
+ }
45
+ return /* @__PURE__ */ React.createElement(
46
+ List,
47
+ {
48
+ dense: true,
49
+ className: classes.listStyle
50
+ },
51
+ users.map((user, index) => /* @__PURE__ */ React.createElement(
52
+ EscalationUser,
53
+ {
54
+ key: index,
55
+ user,
56
+ policyUrl,
57
+ policyName
58
+ }
59
+ ))
60
+ );
61
+ };
62
+
63
+ export { EscalationPolicy };
64
+ //# sourceMappingURL=EscalationPolicy.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EscalationPolicy.esm.js","sources":["../../../src/components/Escalation/EscalationPolicy.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport React from \"react\";\nimport { List, ListSubheader, createStyles, makeStyles } from \"@material-ui/core\";\nimport { EscalationUsersEmptyState } from \"./EscalationUsersEmptyState\";\nimport { EscalationUsersForbiddenState } from \"./EscalationUsersForbiddenState\";\nimport { EscalationUser } from \"./EscalationUser\";\nimport useAsync from \"react-use/lib/useAsync\";\nimport { pagerDutyApiRef } from \"../../api\";\nimport { Alert } from \"@material-ui/lab\";\n\nimport { useApi } from \"@backstage/core-plugin-api\";\nimport { Progress } from \"@backstage/core-components\";\nimport { BackstageTheme } from \"@backstage/theme\";\n\ntype Props = {\n policyId: string;\n policyUrl: string;\n policyName: string;\n};\nconst useStyles = makeStyles<BackstageTheme>(() =>\n createStyles({\n listStyle: {\n marginLeft: \"-15px\",\n },\n })\n);\n\nexport const EscalationPolicy = ({\n policyId,\n policyUrl,\n policyName,\n}: Props) => {\n const api = useApi(pagerDutyApiRef);\n const classes = useStyles();\n\n const {\n value: users,\n loading,\n error,\n } = useAsync(async () => {\n return await api.getOnCallByPolicyId(policyId);\n });\n\n if (error) {\n if (error.message.includes(\"Forbidden\")) {\n return (\n <List dense subheader={<ListSubheader>ON CALL</ListSubheader>}>\n <EscalationUsersForbiddenState />\n </List>\n );\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!users?.length) {\n return <EscalationUsersEmptyState />;\n }\n\n return (\n <List\n dense\n className={classes.listStyle}\n >\n {users!.map((user, index) => (\n <EscalationUser\n key={index}\n user={user}\n policyUrl={policyUrl}\n policyName={policyName}\n />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAA2B,MAC3C,YAAa,CAAA;AAAA,IACX,SAAW,EAAA;AAAA,MACT,UAAY,EAAA,OAAA;AAAA,KACd;AAAA,GACD,CAAA;AACH,CAAA,CAAA;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,QAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AACF,CAAa,KAAA;AACX,EAAM,MAAA,GAAA,GAAM,OAAO,eAAe,CAAA,CAAA;AAClC,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAM,MAAA;AAAA,IACJ,KAAO,EAAA,KAAA;AA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