@backstage-community/plugin-cost-insights 0.15.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/alerts/ProjectGrowthAlert.esm.js +2 -2
  3. package/dist/alerts/ProjectGrowthAlert.esm.js.map +1 -1
  4. package/dist/alerts/UnlabeledDataflowAlert.esm.js +2 -2
  5. package/dist/alerts/UnlabeledDataflowAlert.esm.js.map +1 -1
  6. package/dist/alpha/plugin.esm.js +55 -0
  7. package/dist/alpha/plugin.esm.js.map +1 -0
  8. package/dist/alpha.d.ts +85 -0
  9. package/dist/alpha.esm.js +23 -0
  10. package/dist/alpha.esm.js.map +1 -0
  11. package/dist/components/ActionItems/ActionItemCard.esm.js +3 -3
  12. package/dist/components/ActionItems/ActionItemCard.esm.js.map +1 -1
  13. package/dist/components/ActionItems/ActionItems.esm.js +52 -41
  14. package/dist/components/ActionItems/ActionItems.esm.js.map +1 -1
  15. package/dist/components/AlertInsights/AlertDialog.esm.js +79 -58
  16. package/dist/components/AlertInsights/AlertDialog.esm.js.map +1 -1
  17. package/dist/components/AlertInsights/AlertInsights.esm.js +57 -44
  18. package/dist/components/AlertInsights/AlertInsights.esm.js.map +1 -1
  19. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js +10 -2
  20. package/dist/components/AlertInsights/AlertInsightsHeader.esm.js.map +1 -1
  21. package/dist/components/AlertInsights/AlertInsightsSection.esm.js +42 -34
  22. package/dist/components/AlertInsights/AlertInsightsSection.esm.js.map +1 -1
  23. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js +23 -12
  24. package/dist/components/AlertInsights/AlertInsightsSectionHeader.esm.js.map +1 -1
  25. package/dist/components/AlertInsights/AlertStatusSummary.esm.js +63 -55
  26. package/dist/components/AlertInsights/AlertStatusSummary.esm.js.map +1 -1
  27. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js +7 -6
  28. package/dist/components/AlertInsights/AlertStatusSummaryButton.esm.js.map +1 -1
  29. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js +23 -17
  30. package/dist/components/AlertInstructionsLayout/AlertInstructionsLayout.esm.js.map +1 -1
  31. package/dist/components/BarChart/BarChart.esm.js +83 -78
  32. package/dist/components/BarChart/BarChart.esm.js.map +1 -1
  33. package/dist/components/BarChart/BarChartLabel.esm.js +8 -5
  34. package/dist/components/BarChart/BarChartLabel.esm.js.map +1 -1
  35. package/dist/components/BarChart/BarChartLegend.esm.js +20 -16
  36. package/dist/components/BarChart/BarChartLegend.esm.js.map +1 -1
  37. package/dist/components/BarChart/BarChartStepper.esm.js +51 -48
  38. package/dist/components/BarChart/BarChartStepper.esm.js.map +1 -1
  39. package/dist/components/BarChart/BarChartStepperButton.esm.js +6 -5
  40. package/dist/components/BarChart/BarChartStepperButton.esm.js.map +1 -1
  41. package/dist/components/BarChart/BarChartSteps.esm.js +3 -3
  42. package/dist/components/BarChart/BarChartSteps.esm.js.map +1 -1
  43. package/dist/components/BarChart/BarChartTick.esm.js +5 -5
  44. package/dist/components/BarChart/BarChartTick.esm.js.map +1 -1
  45. package/dist/components/BarChart/BarChartTooltip.esm.js +27 -14
  46. package/dist/components/BarChart/BarChartTooltip.esm.js.map +1 -1
  47. package/dist/components/BarChart/BarChartTooltipItem.esm.js +11 -6
  48. package/dist/components/BarChart/BarChartTooltipItem.esm.js.map +1 -1
  49. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js +3 -2
  50. package/dist/components/CopyUrlToClipboard/CopyUrlToClipboard.esm.js.map +1 -1
  51. package/dist/components/CostGrowth/CostGrowth.esm.js +26 -7
  52. package/dist/components/CostGrowth/CostGrowth.esm.js.map +1 -1
  53. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js +6 -2
  54. package/dist/components/CostGrowth/CostGrowthIndicator.esm.js.map +1 -1
  55. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js +77 -8
  56. package/dist/components/CostInsightsHeader/CostInsightsHeader.esm.js.map +1 -1
  57. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js +16 -10
  58. package/dist/components/CostInsightsLayout/CostInsightsLayout.esm.js.map +1 -1
  59. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js +41 -35
  60. package/dist/components/CostInsightsNavigation/CostInsightsNavigation.esm.js.map +1 -1
  61. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js +116 -79
  62. package/dist/components/CostInsightsPage/CostInsightsPage.esm.js.map +1 -1
  63. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js +2 -2
  64. package/dist/components/CostInsightsPage/CostInsightsPageRoot.esm.js.map +1 -1
  65. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js +5 -5
  66. package/dist/components/CostInsightsPage/CostInsightsThemeProvider.esm.js.map +1 -1
  67. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js +58 -51
  68. package/dist/components/CostInsightsTabs/CostInsightsTabs.esm.js.map +1 -1
  69. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js +74 -59
  70. package/dist/components/CostOverviewCard/CostOverviewBreakdownChart.esm.js.map +1 -1
  71. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js +45 -35
  72. package/dist/components/CostOverviewCard/CostOverviewCard.esm.js.map +1 -1
  73. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js +86 -73
  74. package/dist/components/CostOverviewCard/CostOverviewChart.esm.js.map +1 -1
  75. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js +11 -6
  76. package/dist/components/CostOverviewCard/CostOverviewHeader.esm.js.map +1 -1
  77. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js +21 -15
  78. package/dist/components/CostOverviewCard/CostOverviewLegend.esm.js.map +1 -1
  79. package/dist/components/CurrencySelect/CurrencySelect.esm.js +24 -21
  80. package/dist/components/CurrencySelect/CurrencySelect.esm.js.map +1 -1
  81. package/dist/components/EntityCosts/EntityCosts.esm.js +8 -7
  82. package/dist/components/EntityCosts/EntityCosts.esm.js.map +1 -1
  83. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js +65 -20
  84. package/dist/components/LabelDataflowInstructionsPage/LabelDataflowInstructionsPage.esm.js.map +1 -1
  85. package/dist/components/LegendItem/LegendItem.esm.js +34 -29
  86. package/dist/components/LegendItem/LegendItem.esm.js.map +1 -1
  87. package/dist/components/MetricSelect/MetricSelect.esm.js +19 -14
  88. package/dist/components/MetricSelect/MetricSelect.esm.js.map +1 -1
  89. package/dist/components/PeriodSelect/PeriodSelect.esm.js +15 -15
  90. package/dist/components/PeriodSelect/PeriodSelect.esm.js.map +1 -1
  91. package/dist/components/ProductInsights/ProductInsights.esm.js +12 -8
  92. package/dist/components/ProductInsights/ProductInsights.esm.js.map +1 -1
  93. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js +20 -15
  94. package/dist/components/ProductInsightsCard/ProductEntityDialog.esm.js.map +1 -1
  95. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js +9 -9
  96. package/dist/components/ProductInsightsCard/ProductEntityTable.esm.js.map +1 -1
  97. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js +25 -15
  98. package/dist/components/ProductInsightsCard/ProductInsightsCard.esm.js.map +1 -1
  99. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js +14 -14
  100. package/dist/components/ProductInsightsCard/ProductInsightsCardList.esm.js.map +1 -1
  101. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js +43 -35
  102. package/dist/components/ProductInsightsCard/ProductInsightsChart.esm.js.map +1 -1
  103. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js +5 -5
  104. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertCard.esm.js.map +1 -1
  105. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js +5 -2
  106. package/dist/components/ProjectGrowthAlertCard/ProjectGrowthAlertChart.esm.js.map +1 -1
  107. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js +55 -9
  108. package/dist/components/ProjectGrowthInstructionsPage/ProjectGrowthInstructionsPage.esm.js.map +1 -1
  109. package/dist/components/ProjectSelect/ProjectSelect.esm.js +15 -15
  110. package/dist/components/ProjectSelect/ProjectSelect.esm.js.map +1 -1
  111. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js +12 -9
  112. package/dist/components/UnlabeledDataflowAlertCard/UnlabeledDataflowAlertCard.esm.js.map +1 -1
  113. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js +40 -10
  114. package/dist/components/WhyCostsMatter/WhyCostsMatter.esm.js.map +1 -1
  115. package/dist/example/alerts/KubernetesMigrationAlert.esm.js +10 -3
  116. package/dist/example/alerts/KubernetesMigrationAlert.esm.js.map +1 -1
  117. package/dist/example/client.esm.js +1 -1
  118. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js +20 -17
  119. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationAlertCard.esm.js.map +1 -1
  120. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js +3 -2
  121. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChart.esm.js.map +1 -1
  122. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js +14 -9
  123. package/dist/example/components/KubernetesMigrationAlertCard/KubernetesMigrationBarChartLegend.esm.js.map +1 -1
  124. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js +21 -17
  125. package/dist/example/forms/KubernetesMigrationDismissForm.esm.js.map +1 -1
  126. package/dist/forms/AlertAcceptForm.esm.js +5 -4
  127. package/dist/forms/AlertAcceptForm.esm.js.map +1 -1
  128. package/dist/forms/AlertDismissForm.esm.js +47 -38
  129. package/dist/forms/AlertDismissForm.esm.js.map +1 -1
  130. package/dist/forms/AlertSnoozeForm.esm.js +20 -16
  131. package/dist/forms/AlertSnoozeForm.esm.js.map +1 -1
  132. package/dist/hooks/useConfig.esm.js +3 -2
  133. package/dist/hooks/useConfig.esm.js.map +1 -1
  134. package/dist/hooks/useCurrency.esm.js +6 -3
  135. package/dist/hooks/useCurrency.esm.js.map +1 -1
  136. package/dist/hooks/useFilters.esm.js +10 -7
  137. package/dist/hooks/useFilters.esm.js.map +1 -1
  138. package/dist/hooks/useGroups.esm.js +7 -4
  139. package/dist/hooks/useGroups.esm.js.map +1 -1
  140. package/dist/hooks/useLastCompleteBillingDate.esm.js +8 -7
  141. package/dist/hooks/useLastCompleteBillingDate.esm.js.map +1 -1
  142. package/dist/hooks/useLoading.esm.js +6 -2
  143. package/dist/hooks/useLoading.esm.js.map +1 -1
  144. package/dist/hooks/useScroll.esm.js +6 -3
  145. package/dist/hooks/useScroll.esm.js.map +1 -1
  146. package/dist/index.d.ts +17 -17
  147. package/dist/index.esm.js +2 -1
  148. package/dist/index.esm.js.map +1 -1
  149. package/dist/plugin.esm.js +3 -11
  150. package/dist/plugin.esm.js.map +1 -1
  151. package/dist/routes.esm.js +14 -0
  152. package/dist/routes.esm.js.map +1 -0
  153. package/dist/testUtils/providers.esm.js +3 -3
  154. package/dist/testUtils/providers.esm.js.map +1 -1
  155. package/dist/utils/navigation.esm.js +10 -10
  156. package/dist/utils/navigation.esm.js.map +1 -1
  157. package/dist/utils/scroll.esm.js +3 -2
  158. package/dist/utils/scroll.esm.js.map +1 -1
  159. package/package.json +44 -17
@@ -1 +1 @@
1
- {"version":3,"file":"useLastCompleteBillingDate.esm.js","sources":["../../src/hooks/useLastCompleteBillingDate.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\nimport React, {\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport * as yup from 'yup';\nimport Alert from '@material-ui/lab/Alert';\nimport { costInsightsApiRef } from '../api';\nimport { MapLoadingToProps, useLoading } from './useLoading';\nimport { DefaultLoadingAction } from '../utils/loading';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype BillingDateProviderLoadingProps = {\n dispatchLoadingBillingDate: (isLoading: boolean) => void;\n};\n\nconst mapLoadingToProps: MapLoadingToProps<BillingDateProviderLoadingProps> = ({\n dispatch,\n}) => ({\n dispatchLoadingBillingDate: (isLoading: boolean) =>\n dispatch({ [DefaultLoadingAction.LastCompleteBillingDate]: isLoading }),\n});\n\nexport type BillingDateContextProps = {\n lastCompleteBillingDate: string; // YYYY-MM-DD\n};\n\nexport const BillingDateContext = React.createContext<\n BillingDateContextProps | undefined\n>(undefined);\n\nexport const dateRegex: RegExp = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst dateFormatSchema = yup.string().matches(dateRegex, {\n message:\n 'Unsupported billing date format: ${value}. Date should be in YYYY-MM-DD format.',\n excludeEmptyString: true,\n});\n\nexport const BillingDateProvider = ({ children }: PropsWithChildren<{}>) => {\n const client = useApi(costInsightsApiRef);\n const [error, setError] = useState<Maybe<Error>>(null);\n const { dispatchLoadingBillingDate } = useLoading(mapLoadingToProps);\n\n const [lastCompleteBillingDate, setLastCompeteBillingDate] =\n useState<Maybe<string>>(null);\n\n useEffect(() => {\n dispatchLoadingBillingDate(true);\n\n async function getLastCompleteBillingDate() {\n try {\n const d = await client.getLastCompleteBillingDate();\n const validDate = await dateFormatSchema.validate(d);\n if (validDate) setLastCompeteBillingDate(validDate);\n } catch (e) {\n setError(e);\n } finally {\n dispatchLoadingBillingDate(false);\n }\n }\n\n getLastCompleteBillingDate();\n }, [client]); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n if (!lastCompleteBillingDate) return null;\n\n return (\n <BillingDateContext.Provider\n value={\n {\n lastCompleteBillingDate: lastCompleteBillingDate,\n } as BillingDateContextProps\n }\n >\n {children}\n </BillingDateContext.Provider>\n );\n};\n\nexport function useLastCompleteBillingDate(): string {\n const context = useContext(BillingDateContext);\n return context ? context.lastCompleteBillingDate : assertNever();\n}\n\nfunction assertNever(): never {\n throw Error(\n 'Cannot use useLastCompleteBillingDate outside of BillingDateProvider',\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAkCA,MAAM,oBAAwE,CAAC;AAAA,EAC7E;AACF,CAAO,MAAA;AAAA,EACL,0BAAA,EAA4B,CAAC,SAAA,KAC3B,QAAS,CAAA,EAAE,CAAC,oBAAqB,CAAA,uBAAuB,GAAG,SAAA,EAAW;AAC1E,CAAA,CAAA;AAMa,MAAA,kBAAA,GAAqB,KAAM,CAAA,aAAA,CAEtC,KAAS,CAAA;AAEJ,MAAM,SAAoB,GAAA;AACjC,MAAM,gBAAmB,GAAA,GAAA,CAAI,MAAO,EAAA,CAAE,QAAQ,SAAW,EAAA;AAAA,EACvD,OACE,EAAA,iFAAA;AAAA,EACF,kBAAoB,EAAA;AACtB,CAAC,CAAA;AAEM,MAAM,mBAAsB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AAC1E,EAAM,MAAA,MAAA,GAAS,OAAO,kBAAkB,CAAA;AACxC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAuB,IAAI,CAAA;AACrD,EAAA,MAAM,EAAE,0BAAA,EAA+B,GAAA,UAAA,CAAW,iBAAiB,CAAA;AAEnE,EAAA,MAAM,CAAC,uBAAA,EAAyB,yBAAyB,CAAA,GACvD,SAAwB,IAAI,CAAA;AAE9B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,0BAAA,CAA2B,IAAI,CAAA;AAE/B,IAAA,eAAe,0BAA6B,GAAA;AAC1C,MAAI,IAAA;AACF,QAAM,MAAA,CAAA,GAAI,MAAM,MAAA,CAAO,0BAA2B,EAAA;AAClD,QAAA,MAAM,SAAY,GAAA,MAAM,gBAAiB,CAAA,QAAA,CAAS,CAAC,CAAA;AACnD,QAAI,IAAA,SAAA,4BAAqC,SAAS,CAAA;AAAA,eAC3C,CAAG,EAAA;AACV,QAAA,QAAA,CAAS,CAAC,CAAA;AAAA,OACV,SAAA;AACA,QAAA,0BAAA,CAA2B,KAAK,CAAA;AAAA;AAClC;AAGF,IAA2B,0BAAA,EAAA;AAAA,GAC7B,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAA,EAAS,MAAM,OAAQ,CAAA;AAAA;AAGhD,EAAI,IAAA,CAAC,yBAAgC,OAAA,IAAA;AAErC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAmB,CAAA,QAAA;AAAA,IAAnB;AAAA,MACC,KACE,EAAA;AAAA,QACE;AAAA;AACF,KAAA;AAAA,IAGD;AAAA,GACH;AAEJ;AAEO,SAAS,0BAAqC,GAAA;AACnD,EAAM,MAAA,OAAA,GAAU,WAAW,kBAAkB,CAAA;AAC7C,EAAO,OAAA,OAAA,GAAU,OAAQ,CAAA,uBAAA,GAA0B,WAAY,EAAA;AACjE;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAM,MAAA,KAAA;AAAA,IACJ;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useLastCompleteBillingDate.esm.js","sources":["../../src/hooks/useLastCompleteBillingDate.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\nimport {\n createContext,\n PropsWithChildren,\n useContext,\n useEffect,\n useState,\n} from 'react';\nimport * as yup from 'yup';\nimport Alert from '@material-ui/lab/Alert';\nimport { costInsightsApiRef } from '../api';\nimport { MapLoadingToProps, useLoading } from './useLoading';\nimport { DefaultLoadingAction } from '../utils/loading';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\nimport { useApi } from '@backstage/core-plugin-api';\n\ntype BillingDateProviderLoadingProps = {\n dispatchLoadingBillingDate: (isLoading: boolean) => void;\n};\n\nconst mapLoadingToProps: MapLoadingToProps<BillingDateProviderLoadingProps> = ({\n dispatch,\n}) => ({\n dispatchLoadingBillingDate: (isLoading: boolean) =>\n dispatch({ [DefaultLoadingAction.LastCompleteBillingDate]: isLoading }),\n});\n\nexport type BillingDateContextProps = {\n lastCompleteBillingDate: string; // YYYY-MM-DD\n};\n\nexport const BillingDateContext = createContext<\n BillingDateContextProps | undefined\n>(undefined);\n\nexport const dateRegex: RegExp = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst dateFormatSchema = yup.string().matches(dateRegex, {\n message:\n 'Unsupported billing date format: ${value}. Date should be in YYYY-MM-DD format.',\n excludeEmptyString: true,\n});\n\nexport const BillingDateProvider = ({ children }: PropsWithChildren<{}>) => {\n const client = useApi(costInsightsApiRef);\n const [error, setError] = useState<Maybe<Error>>(null);\n const { dispatchLoadingBillingDate } = useLoading(mapLoadingToProps);\n\n const [lastCompleteBillingDate, setLastCompeteBillingDate] =\n useState<Maybe<string>>(null);\n\n useEffect(() => {\n dispatchLoadingBillingDate(true);\n\n async function getLastCompleteBillingDate() {\n try {\n const d = await client.getLastCompleteBillingDate();\n const validDate = await dateFormatSchema.validate(d);\n if (validDate) setLastCompeteBillingDate(validDate);\n } catch (e) {\n setError(e);\n } finally {\n dispatchLoadingBillingDate(false);\n }\n }\n\n getLastCompleteBillingDate();\n }, [client]); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (error) {\n return <Alert severity=\"error\">{error.message}</Alert>;\n }\n\n if (!lastCompleteBillingDate) return null;\n\n return (\n <BillingDateContext.Provider\n value={\n {\n lastCompleteBillingDate: lastCompleteBillingDate,\n } as BillingDateContextProps\n }\n >\n {children}\n </BillingDateContext.Provider>\n );\n};\n\nexport function useLastCompleteBillingDate(): string {\n const context = useContext(BillingDateContext);\n return context ? context.lastCompleteBillingDate : assertNever();\n}\n\nfunction assertNever(): never {\n throw Error(\n 'Cannot use useLastCompleteBillingDate outside of BillingDateProvider',\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAmCA,MAAM,oBAAwE,CAAC;AAAA,EAC7E;AACF,CAAO,MAAA;AAAA,EACL,0BAAA,EAA4B,CAAC,SAAA,KAC3B,QAAS,CAAA,EAAE,CAAC,oBAAqB,CAAA,uBAAuB,GAAG,SAAA,EAAW;AAC1E,CAAA,CAAA;AAMa,MAAA,kBAAA,GAAqB,cAEhC,KAAS,CAAA;AAEJ,MAAM,SAAoB,GAAA;AACjC,MAAM,gBAAmB,GAAA,GAAA,CAAI,MAAO,EAAA,CAAE,QAAQ,SAAW,EAAA;AAAA,EACvD,OACE,EAAA,iFAAA;AAAA,EACF,kBAAoB,EAAA;AACtB,CAAC,CAAA;AAEM,MAAM,mBAAsB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AAC1E,EAAM,MAAA,MAAA,GAAS,OAAO,kBAAkB,CAAA;AACxC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAuB,IAAI,CAAA;AACrD,EAAA,MAAM,EAAE,0BAAA,EAA+B,GAAA,UAAA,CAAW,iBAAiB,CAAA;AAEnE,EAAA,MAAM,CAAC,uBAAA,EAAyB,yBAAyB,CAAA,GACvD,SAAwB,IAAI,CAAA;AAE9B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,0BAAA,CAA2B,IAAI,CAAA;AAE/B,IAAA,eAAe,0BAA6B,GAAA;AAC1C,MAAI,IAAA;AACF,QAAM,MAAA,CAAA,GAAI,MAAM,MAAA,CAAO,0BAA2B,EAAA;AAClD,QAAA,MAAM,SAAY,GAAA,MAAM,gBAAiB,CAAA,QAAA,CAAS,CAAC,CAAA;AACnD,QAAI,IAAA,SAAA,4BAAqC,SAAS,CAAA;AAAA,eAC3C,CAAG,EAAA;AACV,QAAA,QAAA,CAAS,CAAC,CAAA;AAAA,OACV,SAAA;AACA,QAAA,0BAAA,CAA2B,KAAK,CAAA;AAAA;AAClC;AAGF,IAA2B,0BAAA,EAAA;AAAA,GAC7B,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,uBAAQ,GAAA,CAAA,KAAA,EAAA,EAAM,QAAS,EAAA,OAAA,EAAS,gBAAM,OAAQ,EAAA,CAAA;AAAA;AAGhD,EAAI,IAAA,CAAC,yBAAgC,OAAA,IAAA;AAErC,EACE,uBAAA,GAAA;AAAA,IAAC,kBAAmB,CAAA,QAAA;AAAA,IAAnB;AAAA,MACC,KACE,EAAA;AAAA,QACE;AAAA,OACF;AAAA,MAGD;AAAA;AAAA,GACH;AAEJ;AAEO,SAAS,0BAAqC,GAAA;AACnD,EAAM,MAAA,OAAA,GAAU,WAAW,kBAAkB,CAAA;AAC7C,EAAO,OAAA,OAAA,GAAU,OAAQ,CAAA,uBAAA,GAA0B,WAAY,EAAA;AACjE;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAM,MAAA,KAAA;AAAA,IACJ;AAAA,GACF;AACF;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { createContext, useMemo, useReducer, useState, useEffect, useContext } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { createContext, useMemo, useReducer, useState, useEffect, useContext } from 'react';
2
3
  import Backdrop from '@material-ui/core/Backdrop';
3
4
  import CircularProgress from '@material-ui/core/CircularProgress';
4
5
  import { INITIAL_LOADING_ACTIONS, DefaultLoadingAction, getDefaultState } from '../utils/loading.esm.js';
@@ -33,7 +34,10 @@ const LoadingProvider = ({ children }) => {
33
34
  }
34
35
  displayLoadingBackdrop();
35
36
  }, [state, setBackdropVisible]);
36
- return /* @__PURE__ */ React.createElement(LoadingContext.Provider, { value: { state, actions, dispatch } }, children, /* @__PURE__ */ React.createElement(Backdrop, { open: isBackdropVisible, classes }, /* @__PURE__ */ React.createElement(CircularProgress, null)));
37
+ return /* @__PURE__ */ jsxs(LoadingContext.Provider, { value: { state, actions, dispatch }, children: [
38
+ children,
39
+ /* @__PURE__ */ jsx(Backdrop, { open: isBackdropVisible, classes, children: /* @__PURE__ */ jsx(CircularProgress, {}) })
40
+ ] });
37
41
  };
38
42
  function useLoading(mapLoadingToProps) {
39
43
  const context = useContext(LoadingContext);
@@ -1 +1 @@
1
- {"version":3,"file":"useLoading.esm.js","sources":["../../src/hooks/useLoading.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\nimport React, {\n createContext,\n Dispatch,\n PropsWithChildren,\n SetStateAction,\n useContext,\n useEffect,\n useMemo,\n useReducer,\n useState,\n} from 'react';\nimport Backdrop from '@material-ui/core/Backdrop';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { Loading } from '../types';\nimport {\n DefaultLoadingAction,\n getDefaultState,\n INITIAL_LOADING_ACTIONS,\n} from '../utils/loading';\nimport { useBackdropStyles as useStyles } from '../utils/styles';\nimport { useConfig } from './useConfig';\n\nexport type LoadingContextProps = {\n state: Loading;\n dispatch: Dispatch<Partial<SetStateAction<Loading>>>;\n actions: Array<string>;\n};\n\nexport type MapLoadingToProps<T> = (props: LoadingContextProps) => T;\n\nexport const LoadingContext = createContext<LoadingContextProps | undefined>(\n undefined,\n);\n\nfunction reducer(prevState: Loading, action: Partial<Loading>): Loading {\n return {\n ...prevState,\n ...action,\n } as Record<string, boolean>;\n}\n\nexport const LoadingProvider = ({ children }: PropsWithChildren<{}>) => {\n const classes = useStyles();\n const { products } = useConfig();\n const actions = useMemo(\n () =>\n INITIAL_LOADING_ACTIONS.filter(\n action =>\n products.length ||\n action !== DefaultLoadingAction.CostInsightsProducts,\n ),\n [products],\n );\n const [state, dispatch] = useReducer(reducer, getDefaultState(actions));\n const [isBackdropVisible, setBackdropVisible] = useState(false);\n\n useEffect(() => {\n function displayLoadingBackdrop() {\n // Initial page loading is handled by progress bar\n setBackdropVisible(\n !state[DefaultLoadingAction.CostInsightsInitial] &&\n Object.values(state).some(l => l),\n );\n }\n displayLoadingBackdrop();\n }, [state, setBackdropVisible]);\n\n return (\n <LoadingContext.Provider value={{ state, actions, dispatch }}>\n {children}\n <Backdrop open={isBackdropVisible} classes={classes}>\n <CircularProgress />\n </Backdrop>\n </LoadingContext.Provider>\n );\n};\n\nexport function useLoading<T>(mapLoadingToProps: MapLoadingToProps<T>): T {\n const context = useContext(LoadingContext);\n\n if (!context) {\n assertNever();\n }\n\n return mapLoadingToProps({\n state: context.state,\n actions: context.actions,\n dispatch: context.dispatch,\n });\n}\n\nfunction assertNever(): never {\n throw Error('useLoading cannot be used outside of LoadingProvider');\n}\n"],"names":["useStyles"],"mappings":";;;;;;;AA8CO,MAAM,cAAiB,GAAA,aAAA;AAAA,EAC5B,KAAA;AACF;AAEA,SAAS,OAAA,CAAQ,WAAoB,MAAmC,EAAA;AACtE,EAAO,OAAA;AAAA,IACL,GAAG,SAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;AAEO,MAAM,eAAkB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AACtE,EAAA,MAAM,UAAUA,iBAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,SAAU,EAAA;AAC/B,EAAA,MAAM,OAAU,GAAA,OAAA;AAAA,IACd,MACE,uBAAwB,CAAA,MAAA;AAAA,MACtB,CACE,MAAA,KAAA,QAAA,CAAS,MACT,IAAA,MAAA,KAAW,oBAAqB,CAAA;AAAA,KACpC;AAAA,IACF,CAAC,QAAQ;AAAA,GACX;AACA,EAAM,MAAA,CAAC,OAAO,QAAQ,CAAA,GAAI,WAAW,OAAS,EAAA,eAAA,CAAgB,OAAO,CAAC,CAAA;AACtE,EAAA,MAAM,CAAC,iBAAA,EAAmB,kBAAkB,CAAA,GAAI,SAAS,KAAK,CAAA;AAE9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAS,sBAAyB,GAAA;AAEhC,MAAA,kBAAA;AAAA,QACE,CAAC,KAAM,CAAA,oBAAA,CAAqB,mBAAmB,CAAA,IAC7C,MAAO,CAAA,MAAA,CAAO,KAAK,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,KAAK,CAAC;AAAA,OACpC;AAAA;AAEF,IAAuB,sBAAA,EAAA;AAAA,GACtB,EAAA,CAAC,KAAO,EAAA,kBAAkB,CAAC,CAAA;AAE9B,EAAA,2CACG,cAAe,CAAA,QAAA,EAAf,EAAwB,KAAO,EAAA,EAAE,OAAO,OAAS,EAAA,QAAA,MAC/C,QACD,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,IAAM,EAAA,iBAAA,EAAmB,2BAChC,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,IAAiB,CACpB,CACF,CAAA;AAEJ;AAEO,SAAS,WAAc,iBAA4C,EAAA;AACxE,EAAM,MAAA,OAAA,GAAU,WAAW,cAAc,CAAA;AAEzC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAY,WAAA,EAAA;AAAA;AAGd,EAAA,OAAO,iBAAkB,CAAA;AAAA,IACvB,OAAO,OAAQ,CAAA,KAAA;AAAA,IACf,SAAS,OAAQ,CAAA,OAAA;AAAA,IACjB,UAAU,OAAQ,CAAA;AAAA,GACnB,CAAA;AACH;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAA,MAAM,MAAM,sDAAsD,CAAA;AACpE;;;;"}
1
+ {"version":3,"file":"useLoading.esm.js","sources":["../../src/hooks/useLoading.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\nimport {\n createContext,\n Dispatch,\n PropsWithChildren,\n SetStateAction,\n useContext,\n useEffect,\n useMemo,\n useReducer,\n useState,\n} from 'react';\nimport Backdrop from '@material-ui/core/Backdrop';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport { Loading } from '../types';\nimport {\n DefaultLoadingAction,\n getDefaultState,\n INITIAL_LOADING_ACTIONS,\n} from '../utils/loading';\nimport { useBackdropStyles as useStyles } from '../utils/styles';\nimport { useConfig } from './useConfig';\n\nexport type LoadingContextProps = {\n state: Loading;\n dispatch: Dispatch<Partial<SetStateAction<Loading>>>;\n actions: Array<string>;\n};\n\nexport type MapLoadingToProps<T> = (props: LoadingContextProps) => T;\n\nexport const LoadingContext = createContext<LoadingContextProps | undefined>(\n undefined,\n);\n\nfunction reducer(prevState: Loading, action: Partial<Loading>): Loading {\n return {\n ...prevState,\n ...action,\n } as Record<string, boolean>;\n}\n\nexport const LoadingProvider = ({ children }: PropsWithChildren<{}>) => {\n const classes = useStyles();\n const { products } = useConfig();\n const actions = useMemo(\n () =>\n INITIAL_LOADING_ACTIONS.filter(\n action =>\n products.length ||\n action !== DefaultLoadingAction.CostInsightsProducts,\n ),\n [products],\n );\n const [state, dispatch] = useReducer(reducer, getDefaultState(actions));\n const [isBackdropVisible, setBackdropVisible] = useState(false);\n\n useEffect(() => {\n function displayLoadingBackdrop() {\n // Initial page loading is handled by progress bar\n setBackdropVisible(\n !state[DefaultLoadingAction.CostInsightsInitial] &&\n Object.values(state).some(l => l),\n );\n }\n displayLoadingBackdrop();\n }, [state, setBackdropVisible]);\n\n return (\n <LoadingContext.Provider value={{ state, actions, dispatch }}>\n {children}\n <Backdrop open={isBackdropVisible} classes={classes}>\n <CircularProgress />\n </Backdrop>\n </LoadingContext.Provider>\n );\n};\n\nexport function useLoading<T>(mapLoadingToProps: MapLoadingToProps<T>): T {\n const context = useContext(LoadingContext);\n\n if (!context) {\n assertNever();\n }\n\n return mapLoadingToProps({\n state: context.state,\n actions: context.actions,\n dispatch: context.dispatch,\n });\n}\n\nfunction assertNever(): never {\n throw Error('useLoading cannot be used outside of LoadingProvider');\n}\n"],"names":["useStyles"],"mappings":";;;;;;;;AA8CO,MAAM,cAAiB,GAAA,aAAA;AAAA,EAC5B,KAAA;AACF;AAEA,SAAS,OAAA,CAAQ,WAAoB,MAAmC,EAAA;AACtE,EAAO,OAAA;AAAA,IACL,GAAG,SAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;AAEO,MAAM,eAAkB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AACtE,EAAA,MAAM,UAAUA,iBAAU,EAAA;AAC1B,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,SAAU,EAAA;AAC/B,EAAA,MAAM,OAAU,GAAA,OAAA;AAAA,IACd,MACE,uBAAwB,CAAA,MAAA;AAAA,MACtB,CACE,MAAA,KAAA,QAAA,CAAS,MACT,IAAA,MAAA,KAAW,oBAAqB,CAAA;AAAA,KACpC;AAAA,IACF,CAAC,QAAQ;AAAA,GACX;AACA,EAAM,MAAA,CAAC,OAAO,QAAQ,CAAA,GAAI,WAAW,OAAS,EAAA,eAAA,CAAgB,OAAO,CAAC,CAAA;AACtE,EAAA,MAAM,CAAC,iBAAA,EAAmB,kBAAkB,CAAA,GAAI,SAAS,KAAK,CAAA;AAE9D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAS,sBAAyB,GAAA;AAEhC,MAAA,kBAAA;AAAA,QACE,CAAC,KAAM,CAAA,oBAAA,CAAqB,mBAAmB,CAAA,IAC7C,MAAO,CAAA,MAAA,CAAO,KAAK,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,KAAK,CAAC;AAAA,OACpC;AAAA;AAEF,IAAuB,sBAAA,EAAA;AAAA,GACtB,EAAA,CAAC,KAAO,EAAA,kBAAkB,CAAC,CAAA;AAE9B,EACE,uBAAA,IAAA,CAAC,eAAe,QAAf,EAAA,EAAwB,OAAO,EAAE,KAAA,EAAO,OAAS,EAAA,QAAA,EAC/C,EAAA,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,wBACA,QAAS,EAAA,EAAA,IAAA,EAAM,mBAAmB,OACjC,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,CACpB,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;AAEO,SAAS,WAAc,iBAA4C,EAAA;AACxE,EAAM,MAAA,OAAA,GAAU,WAAW,cAAc,CAAA;AAEzC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAY,WAAA,EAAA;AAAA;AAGd,EAAA,OAAO,iBAAkB,CAAA;AAAA,IACvB,OAAO,OAAQ,CAAA,KAAA;AAAA,IACf,SAAS,OAAQ,CAAA,OAAA;AAAA,IACjB,UAAU,OAAQ,CAAA;AAAA,GACnB,CAAA;AACH;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAA,MAAM,MAAM,sDAAsD,CAAA;AACpE;;;;"}
@@ -1,9 +1,12 @@
1
- import React, { useState, useContext } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useState, useContext } from 'react';
2
3
 
3
- const ScrollContext = React.createContext(void 0);
4
+ const ScrollContext = createContext(
5
+ void 0
6
+ );
4
7
  const ScrollProvider = ({ children }) => {
5
8
  const [scroll, setScroll] = useState(null);
6
- return /* @__PURE__ */ React.createElement(ScrollContext.Provider, { value: { scroll, setScroll } }, children);
9
+ return /* @__PURE__ */ jsx(ScrollContext.Provider, { value: { scroll, setScroll }, children });
7
10
  };
8
11
  var ScrollType = /* @__PURE__ */ ((ScrollType2) => {
9
12
  ScrollType2["AlertSummary"] = "alert-status-summary";
@@ -1 +1 @@
1
- {"version":3,"file":"useScroll.esm.js","sources":["../../src/hooks/useScroll.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 */\nimport React, {\n Dispatch,\n SetStateAction,\n useState,\n useContext,\n PropsWithChildren,\n} from 'react';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\n\nexport type ScrollTo = Maybe<string>;\n\nexport type ScrollContextProps = {\n scroll: ScrollTo;\n setScroll: Dispatch<SetStateAction<ScrollTo>>;\n};\n\nexport const ScrollContext = React.createContext<\n ScrollContextProps | undefined\n>(undefined);\n\nexport const ScrollProvider = ({ children }: PropsWithChildren<{}>) => {\n const [scroll, setScroll] = useState<ScrollTo>(null);\n return (\n <ScrollContext.Provider value={{ scroll, setScroll }}>\n {children}\n </ScrollContext.Provider>\n );\n};\n\nexport enum ScrollType {\n AlertSummary = 'alert-status-summary',\n}\n\nexport function useScroll() {\n const context = useContext(ScrollContext);\n\n if (!context) {\n assertNever();\n }\n\n return [context.scroll, context.setScroll] as const;\n}\n\nfunction assertNever(): never {\n throw new Error(`Cannot use useScroll outside ScrollProvider`);\n}\n"],"names":["ScrollType"],"mappings":";;AA+Ba,MAAA,aAAA,GAAgB,KAAM,CAAA,aAAA,CAEjC,KAAS,CAAA;AAEJ,MAAM,cAAiB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAmB,IAAI,CAAA;AACnD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAc,QAAd,EAAA,EAAuB,OAAO,EAAE,MAAA,EAAQ,SAAU,EAAA,EAAA,EAChD,QACH,CAAA;AAEJ;AAEY,IAAA,UAAA,qBAAAA,WAAL,KAAA;AACL,EAAAA,YAAA,cAAe,CAAA,GAAA,sBAAA;AADL,EAAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAIL,SAAS,SAAY,GAAA;AAC1B,EAAM,MAAA,OAAA,GAAU,WAAW,aAAa,CAAA;AAExC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAY,WAAA,EAAA;AAAA;AAGd,EAAA,OAAO,CAAC,OAAA,CAAQ,MAAQ,EAAA,OAAA,CAAQ,SAAS,CAAA;AAC3C;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAM,MAAA,IAAI,MAAM,CAA6C,2CAAA,CAAA,CAAA;AAC/D;;;;"}
1
+ {"version":3,"file":"useScroll.esm.js","sources":["../../src/hooks/useScroll.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 */\nimport {\n createContext,\n Dispatch,\n SetStateAction,\n useState,\n useContext,\n PropsWithChildren,\n} from 'react';\nimport { Maybe } from '@backstage-community/plugin-cost-insights-common';\n\nexport type ScrollTo = Maybe<string>;\n\nexport type ScrollContextProps = {\n scroll: ScrollTo;\n setScroll: Dispatch<SetStateAction<ScrollTo>>;\n};\n\nexport const ScrollContext = createContext<ScrollContextProps | undefined>(\n undefined,\n);\n\nexport const ScrollProvider = ({ children }: PropsWithChildren<{}>) => {\n const [scroll, setScroll] = useState<ScrollTo>(null);\n return (\n <ScrollContext.Provider value={{ scroll, setScroll }}>\n {children}\n </ScrollContext.Provider>\n );\n};\n\nexport enum ScrollType {\n AlertSummary = 'alert-status-summary',\n}\n\nexport function useScroll() {\n const context = useContext(ScrollContext);\n\n if (!context) {\n assertNever();\n }\n\n return [context.scroll, context.setScroll] as const;\n}\n\nfunction assertNever(): never {\n throw new Error(`Cannot use useScroll outside ScrollProvider`);\n}\n"],"names":["ScrollType"],"mappings":";;;AAgCO,MAAM,aAAgB,GAAA,aAAA;AAAA,EAC3B,KAAA;AACF;AAEO,MAAM,cAAiB,GAAA,CAAC,EAAE,QAAA,EAAsC,KAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAmB,IAAI,CAAA;AACnD,EACE,uBAAA,GAAA,CAAC,cAAc,QAAd,EAAA,EAAuB,OAAO,EAAE,MAAA,EAAQ,SAAU,EAAA,EAChD,QACH,EAAA,CAAA;AAEJ;AAEY,IAAA,UAAA,qBAAAA,WAAL,KAAA;AACL,EAAAA,YAAA,cAAe,CAAA,GAAA,sBAAA;AADL,EAAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAIL,SAAS,SAAY,GAAA;AAC1B,EAAM,MAAA,OAAA,GAAU,WAAW,aAAa,CAAA;AAExC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAY,WAAA,EAAA;AAAA;AAGd,EAAA,OAAO,CAAC,OAAA,CAAQ,MAAQ,EAAA,OAAA,CAAQ,SAAS,CAAA;AAC3C;AAEA,SAAS,WAAqB,GAAA;AAC5B,EAAM,MAAA,IAAI,MAAM,CAA6C,2CAAA,CAAA,CAAA;AAC/D;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
- import * as React from 'react';
3
- import React__default, { ForwardRefExoticComponent, RefAttributes, ReactNode, PropsWithChildren, Dispatch, SetStateAction } from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
3
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
5
4
  import * as common from '@backstage-community/plugin-cost-insights-common';
6
5
  import { Maybe as Maybe$1, ChangeStatistic as ChangeStatistic$1, Group as Group$1, Project as Project$1, Cost as Cost$1, MetricData as MetricData$1, Entity as Entity$1, Metric as Metric$1, Product as Product$1 } from '@backstage-community/plugin-cost-insights-common';
6
+ import { ForwardRefExoticComponent, RefAttributes, ReactNode, PropsWithChildren, Dispatch, SetStateAction } from 'react';
7
7
  import { TooltipProps } from 'recharts';
8
8
  import { TypographyProps } from '@material-ui/core/Typography';
9
9
  import { BackstagePalette, BackstageTheme } from '@backstage/theme';
@@ -16,17 +16,17 @@ declare const costInsightsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
16
16
  unlabeledDataflowAlerts: _backstage_core_plugin_api.RouteRef<undefined>;
17
17
  }, {}, {}>;
18
18
  /** @public */
19
- declare const CostInsightsPage: () => React.JSX.Element;
19
+ declare const CostInsightsPage: () => react_jsx_runtime.JSX.Element;
20
20
  /**
21
21
  * An extension for displaying costs on an entity page.
22
22
  *
23
23
  * @public
24
24
  */
25
- declare const EntityCostInsightsContent: () => React.JSX.Element;
25
+ declare const EntityCostInsightsContent: () => react_jsx_runtime.JSX.Element;
26
26
  /** @public */
27
- declare const CostInsightsProjectGrowthInstructionsPage: () => React.JSX.Element;
27
+ declare const CostInsightsProjectGrowthInstructionsPage: () => react_jsx_runtime.JSX.Element;
28
28
  /** @public */
29
- declare const CostInsightsLabelDataflowInstructionsPage: () => React.JSX.Element;
29
+ declare const CostInsightsLabelDataflowInstructionsPage: () => react_jsx_runtime.JSX.Element;
30
30
 
31
31
  /**
32
32
  * Time periods for cost comparison; slight abuse of ISO 8601 periods. We take P3M to mean
@@ -522,7 +522,7 @@ type BarChartProps = {
522
522
  onMouseMove?: (...args: any[]) => void;
523
523
  };
524
524
  /** @public */
525
- declare const BarChart: (props: BarChartProps) => React__default.JSX.Element;
525
+ declare const BarChart: (props: BarChartProps) => react_jsx_runtime.JSX.Element;
526
526
 
527
527
  /** @public */
528
528
  type BarChartLegendOptions = {
@@ -539,7 +539,7 @@ type BarChartLegendProps = {
539
539
  options?: Partial<BarChartLegendOptions>;
540
540
  };
541
541
  /** @public */
542
- declare const BarChartLegend: (props: PropsWithChildren<BarChartLegendProps>) => React__default.JSX.Element;
542
+ declare const BarChartLegend: (props: PropsWithChildren<BarChartLegendProps>) => react_jsx_runtime.JSX.Element;
543
543
 
544
544
  /** @public */
545
545
  type BarChartTooltipProps = {
@@ -550,7 +550,7 @@ type BarChartTooltipProps = {
550
550
  actions?: ReactNode;
551
551
  };
552
552
  /** @public */
553
- declare const BarChartTooltip: (props: PropsWithChildren<BarChartTooltipProps>) => React__default.JSX.Element;
553
+ declare const BarChartTooltip: (props: PropsWithChildren<BarChartTooltipProps>) => react_jsx_runtime.JSX.Element;
554
554
 
555
555
  /** @public */
556
556
  type TooltipItem = {
@@ -563,7 +563,7 @@ type BarChartTooltipItemProps = {
563
563
  item: TooltipItem;
564
564
  };
565
565
  /** @public */
566
- declare const BarChartTooltipItem: (props: BarChartTooltipItemProps) => React__default.JSX.Element;
566
+ declare const BarChartTooltipItem: (props: BarChartTooltipItemProps) => react_jsx_runtime.JSX.Element;
567
567
 
568
568
  /** @public */
569
569
  type CostGrowthProps = {
@@ -571,7 +571,7 @@ type CostGrowthProps = {
571
571
  duration: Duration;
572
572
  };
573
573
  /** @public */
574
- declare const CostGrowth: (props: CostGrowthProps) => React__default.JSX.Element;
574
+ declare const CostGrowth: (props: CostGrowthProps) => react_jsx_runtime.JSX.Element;
575
575
 
576
576
  /** @public */
577
577
  type CostGrowthIndicatorProps = TypographyProps & {
@@ -581,7 +581,7 @@ type CostGrowthIndicatorProps = TypographyProps & {
581
581
  }) => Maybe$1<string>;
582
582
  };
583
583
  /** @public */
584
- declare const CostGrowthIndicator: (props: CostGrowthIndicatorProps) => React__default.JSX.Element;
584
+ declare const CostGrowthIndicator: (props: CostGrowthIndicatorProps) => react_jsx_runtime.JSX.Element;
585
585
 
586
586
  /** @public */
587
587
  type LegendItemProps = {
@@ -590,7 +590,7 @@ type LegendItemProps = {
590
590
  markerColor?: string;
591
591
  };
592
592
  /** @public */
593
- declare const LegendItem: (props: PropsWithChildren<LegendItemProps>) => React__default.JSX.Element;
593
+ declare const LegendItem: (props: PropsWithChildren<LegendItemProps>) => react_jsx_runtime.JSX.Element;
594
594
 
595
595
  /** @public */
596
596
  type ConfigContextProps = {
@@ -613,11 +613,11 @@ type CurrencyContextProps = {
613
613
  /** @public */
614
614
  type MockConfigProviderProps = PropsWithChildren<Partial<ConfigContextProps>>;
615
615
  /** @public */
616
- declare const MockConfigProvider: (props: MockConfigProviderProps) => React__default.JSX.Element;
616
+ declare const MockConfigProvider: (props: MockConfigProviderProps) => react_jsx_runtime.JSX.Element;
617
617
  /** @public */
618
618
  type MockCurrencyProviderProps = PropsWithChildren<Partial<CurrencyContextProps>>;
619
619
  /** @public */
620
- declare const MockCurrencyProvider: (props: MockCurrencyProviderProps) => React__default.JSX.Element;
620
+ declare const MockCurrencyProvider: (props: MockCurrencyProviderProps) => react_jsx_runtime.JSX.Element;
621
621
 
622
622
  /**
623
623
  * The alert below is an example of an Alert implementation; the CostInsightsApi permits returning
@@ -632,7 +632,7 @@ declare class ProjectGrowthAlert implements Alert {
632
632
  get url(): string;
633
633
  get title(): string;
634
634
  get subtitle(): string;
635
- get element(): React__default.JSX.Element;
635
+ get element(): react_jsx_runtime.JSX.Element;
636
636
  }
637
637
 
638
638
  /**
@@ -649,7 +649,7 @@ declare class UnlabeledDataflowAlert implements Alert {
649
649
  get url(): string;
650
650
  get title(): string;
651
651
  get subtitle(): string;
652
- get element(): React__default.JSX.Element;
652
+ get element(): react_jsx_runtime.JSX.Element;
653
653
  }
654
654
 
655
655
  export { type Alert, type AlertCost, type AlertDismissFormData, type AlertDismissOption, AlertDismissOptions, AlertDismissReason, type AlertForm, type AlertFormProps, type AlertOptions, type AlertSnoozeFormData, type AlertSnoozeOption, AlertSnoozeOptions, AlertStatus, BarChart, type BarChartData, BarChartLegend, type BarChartLegendOptions, type BarChartLegendProps, type BarChartOptions, type BarChartProps, BarChartTooltip, BarChartTooltipItem, type BarChartTooltipItemProps, type BarChartTooltipProps, type ChangeStatistic, ChangeThreshold, type ChartData, type ConfigContextProps, type Cost, CostGrowth, CostGrowthIndicator, type CostGrowthIndicatorProps, type CostGrowthProps, type CostInsightsApi, CostInsightsLabelDataflowInstructionsPage, CostInsightsPage, type CostInsightsPalette, type CostInsightsPaletteAdditions, type CostInsightsPaletteOptions, CostInsightsProjectGrowthInstructionsPage, type CostInsightsTheme, type CostInsightsThemeOptions, type CostInsightsTooltipOptions, type Currency, type CurrencyContextProps, CurrencyType, DEFAULT_DATE_FORMAT, DataKey, type DateAggregation, Duration, EngineerThreshold, type Entity, EntityCostInsightsContent, ExampleCostInsightsClient, type Group, GrowthType, type Icon, IconType, LegendItem, type LegendItemProps, type Loading, type Maybe, type Metric, type MetricData, MockConfigProvider, type MockConfigProviderProps, MockCurrencyProvider, type MockCurrencyProviderProps, type PageFilters, type Product, type ProductFilters, type ProductInsightsOptions, type ProductPeriod, type Project, ProjectGrowthAlert, type ProjectGrowthData, type ResourceData, type TooltipItem, type TooltipRenderer, type Trendline, UnlabeledDataflowAlert, type UnlabeledDataflowAlertProject, type UnlabeledDataflowData, costInsightsApiRef, costInsightsPlugin, costInsightsPlugin as plugin };
package/dist/index.esm.js CHANGED
@@ -1,9 +1,10 @@
1
1
  export { CostInsightsLabelDataflowInstructionsPage, CostInsightsPage, CostInsightsProjectGrowthInstructionsPage, EntityCostInsightsContent, costInsightsPlugin, costInsightsPlugin as plugin } from './plugin.esm.js';
2
- import 'react';
2
+ import 'react/jsx-runtime';
3
3
  import 'pluralize';
4
4
  import '@material-ui/core/Typography';
5
5
  import '@material-ui/core/Box';
6
6
  import '@material-ui/core/styles';
7
+ import 'react';
7
8
  import '@material-ui/core/Avatar';
8
9
  import '@material-ui/core/Tooltip';
9
10
  import '@material-ui/core/IconButton';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,14 +1,6 @@
1
- import { createRouteRef, createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
1
+ import { createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
2
+ import { rootRouteRef, projectGrowthAlertRef, unlabeledDataflowAlertRef } from './routes.esm.js';
2
3
 
3
- const rootRouteRef = createRouteRef({
4
- id: "cost-insights"
5
- });
6
- const projectGrowthAlertRef = createRouteRef({
7
- id: "cost-insights:investigating-growth"
8
- });
9
- const unlabeledDataflowAlertRef = createRouteRef({
10
- id: "cost-insights:labeling-jobs"
11
- });
12
4
  const costInsightsPlugin = createPlugin({
13
5
  id: "cost-insights",
14
6
  featureFlags: [{ name: "cost-insights-currencies" }],
@@ -51,5 +43,5 @@ const CostInsightsLabelDataflowInstructionsPage = costInsightsPlugin.provide(
51
43
  })
52
44
  );
53
45
 
54
- export { CostInsightsLabelDataflowInstructionsPage, CostInsightsPage, CostInsightsProjectGrowthInstructionsPage, EntityCostInsightsContent, costInsightsPlugin, projectGrowthAlertRef, rootRouteRef, unlabeledDataflowAlertRef };
46
+ export { CostInsightsLabelDataflowInstructionsPage, CostInsightsPage, CostInsightsProjectGrowthInstructionsPage, EntityCostInsightsContent, costInsightsPlugin };
55
47
  //# sourceMappingURL=plugin.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 createPlugin,\n createRouteRef,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'cost-insights',\n});\n\nexport const projectGrowthAlertRef = createRouteRef({\n id: 'cost-insights:investigating-growth',\n});\n\nexport const unlabeledDataflowAlertRef = createRouteRef({\n id: 'cost-insights:labeling-jobs',\n});\n\n/** @public */\nexport const costInsightsPlugin = createPlugin({\n id: 'cost-insights',\n featureFlags: [{ name: 'cost-insights-currencies' }],\n routes: {\n root: rootRouteRef,\n growthAlerts: projectGrowthAlertRef,\n unlabeledDataflowAlerts: unlabeledDataflowAlertRef,\n },\n});\n\n/** @public */\nexport const CostInsightsPage = costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsPage',\n component: () =>\n import('./components/CostInsightsPage').then(m => m.CostInsightsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * An extension for displaying costs on an entity page.\n *\n * @public\n */\nexport const EntityCostInsightsContent = costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityCostInsightsContent',\n component: () =>\n import('./components/EntityCosts').then(m => m.EntityCosts),\n mountPoint: rootRouteRef,\n }),\n);\n\n/** @public */\nexport const CostInsightsProjectGrowthInstructionsPage =\n costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsProjectGrowthInstructionsPage',\n component: () =>\n import('./components/ProjectGrowthInstructionsPage').then(\n m => m.ProjectGrowthInstructionsPage,\n ),\n mountPoint: projectGrowthAlertRef,\n }),\n );\n\n/** @public */\nexport const CostInsightsLabelDataflowInstructionsPage =\n costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsLabelDataflowInstructionsPage',\n component: () =>\n import('./components/LabelDataflowInstructionsPage').then(\n m => m.LabelDataflowInstructionsPage,\n ),\n mountPoint: unlabeledDataflowAlertRef,\n }),\n );\n"],"names":[],"mappings":";;AAsBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,wBAAwB,cAAe,CAAA;AAAA,EAClD,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,4BAA4B,cAAe,CAAA;AAAA,EACtD,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,YAAc,EAAA,CAAC,EAAE,IAAA,EAAM,4BAA4B,CAAA;AAAA,EACnD,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,YAAc,EAAA,qBAAA;AAAA,IACd,uBAAyB,EAAA;AAAA;AAE7B,CAAC;AAGM,MAAM,mBAAmB,kBAAmB,CAAA,OAAA;AAAA,EACjD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,kBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,4CAA+B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,gBAAgB,CAAA;AAAA,IACtE,UAAY,EAAA;AAAA,GACb;AACH;AAOO,MAAM,4BAA4B,kBAAmB,CAAA,OAAA;AAAA,EAC1D,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2BAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,uCAA0B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,WAAW,CAAA;AAAA,IAC5D,UAAY,EAAA;AAAA,GACb;AACH;AAGO,MAAM,4CACX,kBAAmB,CAAA,OAAA;AAAA,EACjB,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2CAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yDAA4C,CAAE,CAAA,IAAA;AAAA,MACnD,OAAK,CAAE,CAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;AACH;AAGK,MAAM,4CACX,kBAAmB,CAAA,OAAA;AAAA,EACjB,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2CAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yDAA4C,CAAE,CAAA,IAAA;AAAA,MACnD,OAAK,CAAE,CAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 createPlugin,\n createRoutableExtension,\n} from '@backstage/core-plugin-api';\nimport {\n projectGrowthAlertRef,\n rootRouteRef,\n unlabeledDataflowAlertRef,\n} from './routes';\n\n/** @public */\nexport const costInsightsPlugin = createPlugin({\n id: 'cost-insights',\n featureFlags: [{ name: 'cost-insights-currencies' }],\n routes: {\n root: rootRouteRef,\n growthAlerts: projectGrowthAlertRef,\n unlabeledDataflowAlerts: unlabeledDataflowAlertRef,\n },\n});\n\n/** @public */\nexport const CostInsightsPage = costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsPage',\n component: () =>\n import('./components/CostInsightsPage').then(m => m.CostInsightsPage),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * An extension for displaying costs on an entity page.\n *\n * @public\n */\nexport const EntityCostInsightsContent = costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'EntityCostInsightsContent',\n component: () =>\n import('./components/EntityCosts').then(m => m.EntityCosts),\n mountPoint: rootRouteRef,\n }),\n);\n\n/** @public */\nexport const CostInsightsProjectGrowthInstructionsPage =\n costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsProjectGrowthInstructionsPage',\n component: () =>\n import('./components/ProjectGrowthInstructionsPage').then(\n m => m.ProjectGrowthInstructionsPage,\n ),\n mountPoint: projectGrowthAlertRef,\n }),\n );\n\n/** @public */\nexport const CostInsightsLabelDataflowInstructionsPage =\n costInsightsPlugin.provide(\n createRoutableExtension({\n name: 'CostInsightsLabelDataflowInstructionsPage',\n component: () =>\n import('./components/LabelDataflowInstructionsPage').then(\n m => m.LabelDataflowInstructionsPage,\n ),\n mountPoint: unlabeledDataflowAlertRef,\n }),\n );\n"],"names":[],"mappings":";;;AA2BO,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,YAAc,EAAA,CAAC,EAAE,IAAA,EAAM,4BAA4B,CAAA;AAAA,EACnD,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,YAAA;AAAA,IACN,YAAc,EAAA,qBAAA;AAAA,IACd,uBAAyB,EAAA;AAAA;AAE7B,CAAC;AAGM,MAAM,mBAAmB,kBAAmB,CAAA,OAAA;AAAA,EACjD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,kBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,4CAA+B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,gBAAgB,CAAA;AAAA,IACtE,UAAY,EAAA;AAAA,GACb;AACH;AAOO,MAAM,4BAA4B,kBAAmB,CAAA,OAAA;AAAA,EAC1D,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2BAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,uCAA0B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,WAAW,CAAA;AAAA,IAC5D,UAAY,EAAA;AAAA,GACb;AACH;AAGO,MAAM,4CACX,kBAAmB,CAAA,OAAA;AAAA,EACjB,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2CAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yDAA4C,CAAE,CAAA,IAAA;AAAA,MACnD,OAAK,CAAE,CAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;AACH;AAGK,MAAM,4CACX,kBAAmB,CAAA,OAAA;AAAA,EACjB,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,2CAAA;AAAA,IACN,SAAW,EAAA,MACT,OAAO,yDAA4C,CAAE,CAAA,IAAA;AAAA,MACnD,OAAK,CAAE,CAAA;AAAA,KACT;AAAA,IACF,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
@@ -0,0 +1,14 @@
1
+ import { createRouteRef } from '@backstage/core-plugin-api';
2
+
3
+ const rootRouteRef = createRouteRef({
4
+ id: "cost-insights"
5
+ });
6
+ const projectGrowthAlertRef = createRouteRef({
7
+ id: "cost-insights:investigating-growth"
8
+ });
9
+ const unlabeledDataflowAlertRef = createRouteRef({
10
+ id: "cost-insights:labeling-jobs"
11
+ });
12
+
13
+ export { projectGrowthAlertRef, rootRouteRef, unlabeledDataflowAlertRef };
14
+ //# sourceMappingURL=routes.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2025 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 */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'cost-insights',\n});\n\nexport const projectGrowthAlertRef = createRouteRef({\n id: 'cost-insights:investigating-growth',\n});\n\nexport const unlabeledDataflowAlertRef = createRouteRef({\n id: 'cost-insights:labeling-jobs',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAe,CAAA;AAAA,EACzC,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,wBAAwB,cAAe,CAAA;AAAA,EAClD,EAAI,EAAA;AACN,CAAC;AAEM,MAAM,4BAA4B,cAAe,CAAA;AAAA,EACtD,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { ConfigContext } from '../hooks/useConfig.esm.js';
3
3
  import { CurrencyContext } from '../hooks/useCurrency.esm.js';
4
4
  import '../hooks/useFilters.esm.js';
@@ -22,7 +22,7 @@ const MockConfigProvider = (props) => {
22
22
  hideTrendLine: false,
23
23
  currencies: []
24
24
  };
25
- return /* @__PURE__ */ React.createElement(ConfigContext.Provider, { value: { ...defaultContext, ...context } }, children);
25
+ return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: { ...defaultContext, ...context }, children });
26
26
  };
27
27
  const MockCurrencyProvider = (props) => {
28
28
  const { children, ...context } = props;
@@ -34,7 +34,7 @@ const MockCurrencyProvider = (props) => {
34
34
  },
35
35
  setCurrency: jest.fn()
36
36
  };
37
- return /* @__PURE__ */ React.createElement(CurrencyContext.Provider, { value: { ...defaultContext, ...context } }, children);
37
+ return /* @__PURE__ */ jsx(CurrencyContext.Provider, { value: { ...defaultContext, ...context }, children });
38
38
  };
39
39
 
40
40
  export { MockConfigProvider, MockCurrencyProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"providers.esm.js","sources":["../../src/testUtils/providers.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\nimport React, { PropsWithChildren } from 'react';\nimport {\n LoadingContext,\n LoadingContextProps,\n GroupsContext,\n GroupsContextProps,\n FilterContext,\n FilterContextProps,\n ConfigContext,\n ConfigContextProps,\n CurrencyContext,\n CurrencyContextProps,\n BillingDateContext,\n BillingDateContextProps,\n ScrollContext,\n ScrollContextProps,\n} from '../hooks';\nimport { Duration, EngineerThreshold } from '../types';\nimport { createCurrencyFormat } from '../utils/currency';\n\nexport type MockFilterProviderProps = PropsWithChildren<\n Partial<FilterContextProps>\n>;\n\nexport const MockFilterProvider = ({\n children,\n ...context\n}: MockFilterProviderProps) => {\n const defaultContext: FilterContextProps = {\n pageFilters: {\n group: 'tech',\n project: null,\n duration: Duration.P90D,\n metric: null,\n },\n productFilters: [],\n setPageFilters: jest.fn(),\n setProductFilters: jest.fn(),\n };\n return (\n <FilterContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </FilterContext.Provider>\n );\n};\n\nexport type MockLoadingProviderProps = PropsWithChildren<\n Partial<LoadingContextProps>\n>;\n\nexport const MockLoadingProvider = ({\n children,\n ...context\n}: MockLoadingProviderProps) => {\n const defaultContext: LoadingContextProps = {\n state: {},\n actions: [],\n dispatch: jest.fn(),\n };\n return (\n <LoadingContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </LoadingContext.Provider>\n );\n};\n\n/** @public */\nexport type MockConfigProviderProps = PropsWithChildren<\n Partial<ConfigContextProps>\n>;\n\n/** @public */\nexport const MockConfigProvider = (props: MockConfigProviderProps) => {\n const { children, ...context } = props;\n\n const defaultContext: ConfigContextProps = {\n baseCurrency: createCurrencyFormat(),\n metrics: [],\n products: [],\n icons: [],\n engineerCost: 0,\n engineerThreshold: EngineerThreshold,\n hideTrendLine: false,\n currencies: [],\n };\n\n return (\n <ConfigContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </ConfigContext.Provider>\n );\n};\n\n/** @public */\nexport type MockCurrencyProviderProps = PropsWithChildren<\n Partial<CurrencyContextProps>\n>;\n\n/** @public */\nexport const MockCurrencyProvider = (props: MockCurrencyProviderProps) => {\n const { children, ...context } = props;\n\n const defaultContext: CurrencyContextProps = {\n currency: {\n kind: null,\n label: 'Engineers 🛠',\n unit: 'engineer',\n },\n setCurrency: jest.fn(),\n };\n\n return (\n <CurrencyContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </CurrencyContext.Provider>\n );\n};\n\nexport type MockBillingDateProviderProps = PropsWithChildren<\n Partial<BillingDateContextProps>\n>;\n\nexport const MockBillingDateProvider = ({\n children,\n ...context\n}: MockBillingDateProviderProps) => {\n const defaultContext: BillingDateContextProps = {\n lastCompleteBillingDate: '2020-10-01',\n };\n return (\n <BillingDateContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </BillingDateContext.Provider>\n );\n};\n\nexport type MockScrollProviderProps = PropsWithChildren<{}>;\n\nexport const MockScrollProvider = ({ children }: MockScrollProviderProps) => {\n const defaultContext: ScrollContextProps = {\n scroll: null,\n setScroll: jest.fn(),\n };\n return (\n <ScrollContext.Provider value={defaultContext}>\n {children}\n </ScrollContext.Provider>\n );\n};\n\nexport type MockGroupsProviderProps = PropsWithChildren<\n Partial<GroupsContextProps>\n>;\n\nexport const MockGroupsProvider = ({\n children,\n ...context\n}: MockGroupsProviderProps) => {\n const defaultContext: GroupsContextProps = {\n groups: [],\n };\n return (\n <GroupsContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </GroupsContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwFa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,OAAA,EAAY,GAAA,KAAA;AAEjC,EAAA,MAAM,cAAqC,GAAA;AAAA,IACzC,cAAc,oBAAqB,EAAA;AAAA,IACnC,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,OAAO,EAAC;AAAA,IACR,YAAc,EAAA,CAAA;AAAA,IACd,iBAAmB,EAAA,iBAAA;AAAA,IACnB,aAAe,EAAA,KAAA;AAAA,IACf,YAAY;AAAC,GACf;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,CAAA,QAAA,EAAd,EAAuB,KAAA,EAAO,EAAE,GAAG,cAAgB,EAAA,GAAG,OAAQ,EAAA,EAAA,EAC5D,QACH,CAAA;AAEJ;AAQa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,OAAA,EAAY,GAAA,KAAA;AAEjC,EAAA,MAAM,cAAuC,GAAA;AAAA,IAC3C,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,MACN,KAAO,EAAA,qBAAA;AAAA,MACP,IAAM,EAAA;AAAA,KACR;AAAA,IACA,WAAA,EAAa,KAAK,EAAG;AAAA,GACvB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,CAAA,QAAA,EAAhB,EAAyB,KAAA,EAAO,EAAE,GAAG,cAAgB,EAAA,GAAG,OAAQ,EAAA,EAAA,EAC9D,QACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"providers.esm.js","sources":["../../src/testUtils/providers.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\nimport { PropsWithChildren } from 'react';\nimport {\n LoadingContext,\n LoadingContextProps,\n GroupsContext,\n GroupsContextProps,\n FilterContext,\n FilterContextProps,\n ConfigContext,\n ConfigContextProps,\n CurrencyContext,\n CurrencyContextProps,\n BillingDateContext,\n BillingDateContextProps,\n ScrollContext,\n ScrollContextProps,\n} from '../hooks';\nimport { Duration, EngineerThreshold } from '../types';\nimport { createCurrencyFormat } from '../utils/currency';\n\nexport type MockFilterProviderProps = PropsWithChildren<\n Partial<FilterContextProps>\n>;\n\nexport const MockFilterProvider = ({\n children,\n ...context\n}: MockFilterProviderProps) => {\n const defaultContext: FilterContextProps = {\n pageFilters: {\n group: 'tech',\n project: null,\n duration: Duration.P90D,\n metric: null,\n },\n productFilters: [],\n setPageFilters: jest.fn(),\n setProductFilters: jest.fn(),\n };\n return (\n <FilterContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </FilterContext.Provider>\n );\n};\n\nexport type MockLoadingProviderProps = PropsWithChildren<\n Partial<LoadingContextProps>\n>;\n\nexport const MockLoadingProvider = ({\n children,\n ...context\n}: MockLoadingProviderProps) => {\n const defaultContext: LoadingContextProps = {\n state: {},\n actions: [],\n dispatch: jest.fn(),\n };\n return (\n <LoadingContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </LoadingContext.Provider>\n );\n};\n\n/** @public */\nexport type MockConfigProviderProps = PropsWithChildren<\n Partial<ConfigContextProps>\n>;\n\n/** @public */\nexport const MockConfigProvider = (props: MockConfigProviderProps) => {\n const { children, ...context } = props;\n\n const defaultContext: ConfigContextProps = {\n baseCurrency: createCurrencyFormat(),\n metrics: [],\n products: [],\n icons: [],\n engineerCost: 0,\n engineerThreshold: EngineerThreshold,\n hideTrendLine: false,\n currencies: [],\n };\n\n return (\n <ConfigContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </ConfigContext.Provider>\n );\n};\n\n/** @public */\nexport type MockCurrencyProviderProps = PropsWithChildren<\n Partial<CurrencyContextProps>\n>;\n\n/** @public */\nexport const MockCurrencyProvider = (props: MockCurrencyProviderProps) => {\n const { children, ...context } = props;\n\n const defaultContext: CurrencyContextProps = {\n currency: {\n kind: null,\n label: 'Engineers 🛠',\n unit: 'engineer',\n },\n setCurrency: jest.fn(),\n };\n\n return (\n <CurrencyContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </CurrencyContext.Provider>\n );\n};\n\nexport type MockBillingDateProviderProps = PropsWithChildren<\n Partial<BillingDateContextProps>\n>;\n\nexport const MockBillingDateProvider = ({\n children,\n ...context\n}: MockBillingDateProviderProps) => {\n const defaultContext: BillingDateContextProps = {\n lastCompleteBillingDate: '2020-10-01',\n };\n return (\n <BillingDateContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </BillingDateContext.Provider>\n );\n};\n\nexport type MockScrollProviderProps = PropsWithChildren<{}>;\n\nexport const MockScrollProvider = ({ children }: MockScrollProviderProps) => {\n const defaultContext: ScrollContextProps = {\n scroll: null,\n setScroll: jest.fn(),\n };\n return (\n <ScrollContext.Provider value={defaultContext}>\n {children}\n </ScrollContext.Provider>\n );\n};\n\nexport type MockGroupsProviderProps = PropsWithChildren<\n Partial<GroupsContextProps>\n>;\n\nexport const MockGroupsProvider = ({\n children,\n ...context\n}: MockGroupsProviderProps) => {\n const defaultContext: GroupsContextProps = {\n groups: [],\n };\n return (\n <GroupsContext.Provider value={{ ...defaultContext, ...context }}>\n {children}\n </GroupsContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAwFa,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,OAAA,EAAY,GAAA,KAAA;AAEjC,EAAA,MAAM,cAAqC,GAAA;AAAA,IACzC,cAAc,oBAAqB,EAAA;AAAA,IACnC,SAAS,EAAC;AAAA,IACV,UAAU,EAAC;AAAA,IACX,OAAO,EAAC;AAAA,IACR,YAAc,EAAA,CAAA;AAAA,IACd,iBAAmB,EAAA,iBAAA;AAAA,IACnB,aAAe,EAAA,KAAA;AAAA,IACf,YAAY;AAAC,GACf;AAEA,EACE,uBAAA,GAAA,CAAC,aAAc,CAAA,QAAA,EAAd,EAAuB,KAAA,EAAO,EAAE,GAAG,cAAgB,EAAA,GAAG,OAAQ,EAAA,EAC5D,QACH,EAAA,CAAA;AAEJ;AAQa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,OAAA,EAAY,GAAA,KAAA;AAEjC,EAAA,MAAM,cAAuC,GAAA;AAAA,IAC3C,QAAU,EAAA;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,MACN,KAAO,EAAA,qBAAA;AAAA,MACP,IAAM,EAAA;AAAA,KACR;AAAA,IACA,WAAA,EAAa,KAAK,EAAG;AAAA,GACvB;AAEA,EACE,uBAAA,GAAA,CAAC,eAAgB,CAAA,QAAA,EAAhB,EAAyB,KAAA,EAAO,EAAE,GAAG,cAAgB,EAAA,GAAG,OAAQ,EAAA,EAC9D,QACH,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import MoneyIcon from '@material-ui/icons/MonetizationOn';
3
3
  import ActionIcon from '@material-ui/icons/Whatshot';
4
4
  import Settings from '@material-ui/icons/Settings';
@@ -20,14 +20,14 @@ const getDefaultNavigationItems = (alerts) => {
20
20
  const items = [
21
21
  {
22
22
  navigation: "cost-overview-card" /* CostOverviewCard */,
23
- icon: /* @__PURE__ */ React.createElement(MoneyIcon, null),
23
+ icon: /* @__PURE__ */ jsx(MoneyIcon, {}),
24
24
  title: "Cost Overview"
25
25
  }
26
26
  ];
27
27
  if (alerts > 0) {
28
28
  items.push({
29
29
  navigation: "alert-insights-header" /* AlertInsightsHeader */,
30
- icon: /* @__PURE__ */ React.createElement(ActionIcon, null),
30
+ icon: /* @__PURE__ */ jsx(ActionIcon, {}),
31
31
  title: "Action Items"
32
32
  });
33
33
  }
@@ -36,19 +36,19 @@ const getDefaultNavigationItems = (alerts) => {
36
36
  function getIcon(icon) {
37
37
  switch (icon) {
38
38
  case IconType.Compute:
39
- return /* @__PURE__ */ React.createElement(Settings, null);
39
+ return /* @__PURE__ */ jsx(Settings, {});
40
40
  case IconType.Data:
41
- return /* @__PURE__ */ React.createElement(AccountTree, null);
41
+ return /* @__PURE__ */ jsx(AccountTree, {});
42
42
  case IconType.Database:
43
- return /* @__PURE__ */ React.createElement(ViewHeadline, null);
43
+ return /* @__PURE__ */ jsx(ViewHeadline, {});
44
44
  case IconType.Storage:
45
- return /* @__PURE__ */ React.createElement(Storage, null);
45
+ return /* @__PURE__ */ jsx(Storage, {});
46
46
  case IconType.Search:
47
- return /* @__PURE__ */ React.createElement(Search, null);
47
+ return /* @__PURE__ */ jsx(Search, {});
48
48
  case IconType.ML:
49
- return /* @__PURE__ */ React.createElement(School, null);
49
+ return /* @__PURE__ */ jsx(School, {});
50
50
  default:
51
- return /* @__PURE__ */ React.createElement(CloudQueue, null);
51
+ return /* @__PURE__ */ jsx(CloudQueue, {});
52
52
  }
53
53
  }
54
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.esm.js","sources":["../../src/utils/navigation.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 */\nimport React from 'react';\nimport MoneyIcon from '@material-ui/icons/MonetizationOn';\nimport ActionIcon from '@material-ui/icons/Whatshot';\nimport Settings from '@material-ui/icons/Settings';\nimport AccountTree from '@material-ui/icons/AccountTree';\nimport Storage from '@material-ui/icons/Storage';\nimport Search from '@material-ui/icons/Search';\nimport CloudQueue from '@material-ui/icons/CloudQueue';\nimport School from '@material-ui/icons/School';\nimport ViewHeadline from '@material-ui/icons/ViewHeadline';\nimport { IconType } from '../types';\n\nexport enum DefaultNavigation {\n CostOverviewCard = 'cost-overview-card',\n AlertInsightsHeader = 'alert-insights-header',\n}\n\nexport type NavigationItem = {\n navigation: string;\n icon: JSX.Element;\n title: string;\n};\n\nexport const getDefaultNavigationItems = (alerts: number): NavigationItem[] => {\n const items = [\n {\n navigation: DefaultNavigation.CostOverviewCard,\n icon: <MoneyIcon />,\n title: 'Cost Overview',\n },\n ];\n if (alerts > 0) {\n items.push({\n navigation: DefaultNavigation.AlertInsightsHeader,\n icon: <ActionIcon />,\n title: 'Action Items',\n });\n }\n return items;\n};\n\nexport function getIcon(icon?: string): JSX.Element {\n switch (icon) {\n case IconType.Compute:\n return <Settings />;\n case IconType.Data:\n return <AccountTree />;\n case IconType.Database:\n return <ViewHeadline />;\n case IconType.Storage:\n return <Storage />;\n case IconType.Search:\n return <Search />;\n case IconType.ML:\n return <School />;\n default:\n return <CloudQueue />;\n }\n}\n"],"names":["DefaultNavigation"],"mappings":";;;;;;;;;;;;;AA2BY,IAAA,iBAAA,qBAAAA,kBAAL,KAAA;AACL,EAAAA,mBAAA,kBAAmB,CAAA,GAAA,oBAAA;AACnB,EAAAA,mBAAA,qBAAsB,CAAA,GAAA,uBAAA;AAFZ,EAAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;AAWC,MAAA,yBAAA,GAA4B,CAAC,MAAqC,KAAA;AAC7E,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ;AAAA,MACE,UAAY,EAAA,oBAAA;AAAA,MACZ,IAAA,sCAAO,SAAU,EAAA,IAAA,CAAA;AAAA,MACjB,KAAO,EAAA;AAAA;AACT,GACF;AACA,EAAA,IAAI,SAAS,CAAG,EAAA;AACd,IAAA,KAAA,CAAM,IAAK,CAAA;AAAA,MACT,UAAY,EAAA,uBAAA;AAAA,MACZ,IAAA,sCAAO,UAAW,EAAA,IAAA,CAAA;AAAA,MAClB,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AAEH,EAAO,OAAA,KAAA;AACT;AAEO,SAAS,QAAQ,IAA4B,EAAA;AAClD,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,QAAS,CAAA,OAAA;AACZ,MAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA;AAAA,IACnB,KAAK,QAAS,CAAA,IAAA;AACZ,MAAA,2CAAQ,WAAY,EAAA,IAAA,CAAA;AAAA,IACtB,KAAK,QAAS,CAAA,QAAA;AACZ,MAAA,2CAAQ,YAAa,EAAA,IAAA,CAAA;AAAA,IACvB,KAAK,QAAS,CAAA,OAAA;AACZ,MAAA,2CAAQ,OAAQ,EAAA,IAAA,CAAA;AAAA,IAClB,KAAK,QAAS,CAAA,MAAA;AACZ,MAAA,2CAAQ,MAAO,EAAA,IAAA,CAAA;AAAA,IACjB,KAAK,QAAS,CAAA,EAAA;AACZ,MAAA,2CAAQ,MAAO,EAAA,IAAA,CAAA;AAAA,IACjB;AACE,MAAA,2CAAQ,UAAW,EAAA,IAAA,CAAA;AAAA;AAEzB;;;;"}
1
+ {"version":3,"file":"navigation.esm.js","sources":["../../src/utils/navigation.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 */\nimport MoneyIcon from '@material-ui/icons/MonetizationOn';\nimport ActionIcon from '@material-ui/icons/Whatshot';\nimport Settings from '@material-ui/icons/Settings';\nimport AccountTree from '@material-ui/icons/AccountTree';\nimport Storage from '@material-ui/icons/Storage';\nimport Search from '@material-ui/icons/Search';\nimport CloudQueue from '@material-ui/icons/CloudQueue';\nimport School from '@material-ui/icons/School';\nimport ViewHeadline from '@material-ui/icons/ViewHeadline';\nimport { IconType } from '../types';\n\nexport enum DefaultNavigation {\n CostOverviewCard = 'cost-overview-card',\n AlertInsightsHeader = 'alert-insights-header',\n}\n\nexport type NavigationItem = {\n navigation: string;\n icon: JSX.Element;\n title: string;\n};\n\nexport const getDefaultNavigationItems = (alerts: number): NavigationItem[] => {\n const items = [\n {\n navigation: DefaultNavigation.CostOverviewCard,\n icon: <MoneyIcon />,\n title: 'Cost Overview',\n },\n ];\n if (alerts > 0) {\n items.push({\n navigation: DefaultNavigation.AlertInsightsHeader,\n icon: <ActionIcon />,\n title: 'Action Items',\n });\n }\n return items;\n};\n\nexport function getIcon(icon?: string): JSX.Element {\n switch (icon) {\n case IconType.Compute:\n return <Settings />;\n case IconType.Data:\n return <AccountTree />;\n case IconType.Database:\n return <ViewHeadline />;\n case IconType.Storage:\n return <Storage />;\n case IconType.Search:\n return <Search />;\n case IconType.ML:\n return <School />;\n default:\n return <CloudQueue />;\n }\n}\n"],"names":["DefaultNavigation"],"mappings":";;;;;;;;;;;;;AA0BY,IAAA,iBAAA,qBAAAA,kBAAL,KAAA;AACL,EAAAA,mBAAA,kBAAmB,CAAA,GAAA,oBAAA;AACnB,EAAAA,mBAAA,qBAAsB,CAAA,GAAA,uBAAA;AAFZ,EAAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;AAWC,MAAA,yBAAA,GAA4B,CAAC,MAAqC,KAAA;AAC7E,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ;AAAA,MACE,UAAY,EAAA,oBAAA;AAAA,MACZ,IAAA,sBAAO,SAAU,EAAA,EAAA,CAAA;AAAA,MACjB,KAAO,EAAA;AAAA;AACT,GACF;AACA,EAAA,IAAI,SAAS,CAAG,EAAA;AACd,IAAA,KAAA,CAAM,IAAK,CAAA;AAAA,MACT,UAAY,EAAA,uBAAA;AAAA,MACZ,IAAA,sBAAO,UAAW,EAAA,EAAA,CAAA;AAAA,MAClB,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AAEH,EAAO,OAAA,KAAA;AACT;AAEO,SAAS,QAAQ,IAA4B,EAAA;AAClD,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,QAAS,CAAA,OAAA;AACZ,MAAA,2BAAQ,QAAS,EAAA,EAAA,CAAA;AAAA,IACnB,KAAK,QAAS,CAAA,IAAA;AACZ,MAAA,2BAAQ,WAAY,EAAA,EAAA,CAAA;AAAA,IACtB,KAAK,QAAS,CAAA,QAAA;AACZ,MAAA,2BAAQ,YAAa,EAAA,EAAA,CAAA;AAAA,IACvB,KAAK,QAAS,CAAA,OAAA;AACZ,MAAA,2BAAQ,OAAQ,EAAA,EAAA,CAAA;AAAA,IAClB,KAAK,QAAS,CAAA,MAAA;AACZ,MAAA,2BAAQ,MAAO,EAAA,EAAA,CAAA;AAAA,IACjB,KAAK,QAAS,CAAA,EAAA;AACZ,MAAA,2BAAQ,MAAO,EAAA,EAAA,CAAA;AAAA,IACjB;AACE,MAAA,2BAAQ,UAAW,EAAA,EAAA,CAAA;AAAA;AAEzB;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useRef, useEffect } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useRef, useEffect } from 'react';
2
3
  import { useScroll } from '../hooks/useScroll.esm.js';
3
4
 
4
5
  const ScrollAnchor = ({
@@ -24,7 +25,7 @@ const ScrollAnchor = ({
24
25
  }
25
26
  scrollIntoView();
26
27
  }, [scroll, setScroll, id, behavior, block, inline]);
27
- return /* @__PURE__ */ React.createElement(
28
+ return /* @__PURE__ */ jsx(
28
29
  "div",
29
30
  {
30
31
  ref: divRef,
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.esm.js","sources":["../../src/utils/scroll.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport React, { useEffect, useRef } from 'react';\nimport { ScrollTo, useScroll } from '../hooks/useScroll';\n\n/*\n Utility component use in conjunction with useScroll that allows scrollable components to control behavior and offset.\n 1. ScrollAnchor must be a direct child of a scrollable component.\n 2. ScrollAnchor's parent position must be relative. \n 3. ScrollAnchor's id must be unique.\n*/\n\nexport interface ScrollAnchorProps extends ScrollIntoViewOptions {\n id: ScrollTo;\n top?: number;\n left?: number;\n}\n\nexport const ScrollAnchor = ({\n id,\n left = 0,\n top = -20,\n block = 'start',\n inline = 'nearest',\n behavior = 'smooth',\n}: ScrollAnchorProps) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [scroll, setScroll] = useScroll();\n\n useEffect(() => {\n function scrollIntoView() {\n if (divRef.current && scroll === id) {\n divRef.current.scrollIntoView({\n block,\n inline,\n behavior,\n });\n setScroll(null);\n }\n }\n\n scrollIntoView();\n }, [scroll, setScroll, id, behavior, block, inline]);\n\n return (\n <div\n ref={divRef}\n style={{ position: 'absolute', height: 0, width: 0, top, left }}\n data-testid={`scroll-test-${id}`}\n />\n );\n};\n"],"names":[],"mappings":";;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC3B,EAAA;AAAA,EACA,IAAO,GAAA,CAAA;AAAA,EACP,GAAM,GAAA,CAAA,EAAA;AAAA,EACN,KAAQ,GAAA,OAAA;AAAA,EACR,MAAS,GAAA,SAAA;AAAA,EACT,QAAW,GAAA;AACb,CAAyB,KAAA;AACvB,EAAM,MAAA,MAAA,GAAS,OAAuB,IAAI,CAAA;AAC1C,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAU,EAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAS,cAAiB,GAAA;AACxB,MAAI,IAAA,MAAA,CAAO,OAAW,IAAA,MAAA,KAAW,EAAI,EAAA;AACnC,QAAA,MAAA,CAAO,QAAQ,cAAe,CAAA;AAAA,UAC5B,KAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACD,CAAA;AACD,QAAA,SAAA,CAAU,IAAI,CAAA;AAAA;AAChB;AAGF,IAAe,cAAA,EAAA;AAAA,GACjB,EAAG,CAAC,MAAQ,EAAA,SAAA,EAAW,IAAI,QAAU,EAAA,KAAA,EAAO,MAAM,CAAC,CAAA;AAEnD,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,MAAA;AAAA,MACL,KAAA,EAAO,EAAE,QAAU,EAAA,UAAA,EAAY,QAAQ,CAAG,EAAA,KAAA,EAAO,CAAG,EAAA,GAAA,EAAK,IAAK,EAAA;AAAA,MAC9D,aAAA,EAAa,eAAe,EAAE,CAAA;AAAA;AAAA,GAChC;AAEJ;;;;"}
1
+ {"version":3,"file":"scroll.esm.js","sources":["../../src/utils/scroll.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 */\nimport { useEffect, useRef } from 'react';\nimport { ScrollTo, useScroll } from '../hooks/useScroll';\n\n/*\n Utility component use in conjunction with useScroll that allows scrollable components to control behavior and offset.\n 1. ScrollAnchor must be a direct child of a scrollable component.\n 2. ScrollAnchor's parent position must be relative. \n 3. ScrollAnchor's id must be unique.\n*/\n\nexport interface ScrollAnchorProps extends ScrollIntoViewOptions {\n id: ScrollTo;\n top?: number;\n left?: number;\n}\n\nexport const ScrollAnchor = ({\n id,\n left = 0,\n top = -20,\n block = 'start',\n inline = 'nearest',\n behavior = 'smooth',\n}: ScrollAnchorProps) => {\n const divRef = useRef<HTMLDivElement>(null);\n const [scroll, setScroll] = useScroll();\n\n useEffect(() => {\n function scrollIntoView() {\n if (divRef.current && scroll === id) {\n divRef.current.scrollIntoView({\n block,\n inline,\n behavior,\n });\n setScroll(null);\n }\n }\n\n scrollIntoView();\n }, [scroll, setScroll, id, behavior, block, inline]);\n\n return (\n <div\n ref={divRef}\n style={{ position: 'absolute', height: 0, width: 0, top, left }}\n data-testid={`scroll-test-${id}`}\n />\n );\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC3B,EAAA;AAAA,EACA,IAAO,GAAA,CAAA;AAAA,EACP,GAAM,GAAA,CAAA,EAAA;AAAA,EACN,KAAQ,GAAA,OAAA;AAAA,EACR,MAAS,GAAA,SAAA;AAAA,EACT,QAAW,GAAA;AACb,CAAyB,KAAA;AACvB,EAAM,MAAA,MAAA,GAAS,OAAuB,IAAI,CAAA;AAC1C,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAU,EAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAS,cAAiB,GAAA;AACxB,MAAI,IAAA,MAAA,CAAO,OAAW,IAAA,MAAA,KAAW,EAAI,EAAA;AACnC,QAAA,MAAA,CAAO,QAAQ,cAAe,CAAA;AAAA,UAC5B,KAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACD,CAAA;AACD,QAAA,SAAA,CAAU,IAAI,CAAA;AAAA;AAChB;AAGF,IAAe,cAAA,EAAA;AAAA,GACjB,EAAG,CAAC,MAAQ,EAAA,SAAA,EAAW,IAAI,QAAU,EAAA,KAAA,EAAO,MAAM,CAAC,CAAA;AAEnD,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,MAAA;AAAA,MACL,KAAA,EAAO,EAAE,QAAU,EAAA,UAAA,EAAY,QAAQ,CAAG,EAAA,KAAA,EAAO,CAAG,EAAA,GAAA,EAAK,IAAK,EAAA;AAAA,MAC9D,aAAA,EAAa,eAAe,EAAE,CAAA;AAAA;AAAA,GAChC;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-cost-insights",
3
- "version": "0.15.2",
3
+ "version": "0.17.0",
4
4
  "description": "A Backstage plugin that helps you keep track of your cloud spend",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -8,12 +8,37 @@
8
8
  "pluginPackages": [
9
9
  "@backstage-community/plugin-cost-insights",
10
10
  "@backstage-community/plugin-cost-insights-common"
11
- ]
11
+ ],
12
+ "features": {
13
+ "./alpha": "@backstage/FrontendPlugin"
14
+ }
12
15
  },
13
16
  "publishConfig": {
14
- "access": "public",
15
- "main": "dist/index.esm.js",
16
- "types": "dist/index.d.ts"
17
+ "access": "public"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.esm.js",
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.esm.js"
24
+ },
25
+ "./alpha": {
26
+ "backstage": "@backstage/FrontendPlugin",
27
+ "import": "./dist/alpha.esm.js",
28
+ "types": "./dist/alpha.d.ts",
29
+ "default": "./dist/alpha.esm.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "typesVersions": {
34
+ "*": {
35
+ "alpha": [
36
+ "dist/alpha.d.ts"
37
+ ],
38
+ "package.json": [
39
+ "package.json"
40
+ ]
41
+ }
17
42
  },
18
43
  "keywords": [
19
44
  "backstage"
@@ -26,8 +51,8 @@
26
51
  },
27
52
  "license": "Apache-2.0",
28
53
  "sideEffects": false,
29
- "main": "dist/index.esm.js",
30
- "types": "dist/index.d.ts",
54
+ "main": "./dist/index.esm.js",
55
+ "types": "./dist/index.d.ts",
31
56
  "files": [
32
57
  "dist",
33
58
  "config.d.ts"
@@ -42,13 +67,15 @@
42
67
  "test": "backstage-cli package test"
43
68
  },
44
69
  "dependencies": {
45
- "@backstage-community/plugin-cost-insights-common": "^0.4.1",
46
- "@backstage/catalog-model": "^1.7.3",
70
+ "@backstage-community/plugin-cost-insights-common": "^0.5.0",
71
+ "@backstage/catalog-model": "^1.7.4",
47
72
  "@backstage/config": "^1.3.2",
48
- "@backstage/core-components": "^0.17.0",
49
- "@backstage/core-plugin-api": "^1.10.5",
50
- "@backstage/plugin-catalog-react": "^1.16.0",
51
- "@backstage/theme": "^0.6.4",
73
+ "@backstage/core-compat-api": "^0.4.3",
74
+ "@backstage/core-components": "^0.17.3",
75
+ "@backstage/core-plugin-api": "^1.10.8",
76
+ "@backstage/frontend-plugin-api": "^0.10.3",
77
+ "@backstage/plugin-catalog-react": "^1.19.0",
78
+ "@backstage/theme": "^0.6.6",
52
79
  "@material-ui/core": "^4.12.2",
53
80
  "@material-ui/icons": "^4.9.1",
54
81
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -66,10 +93,10 @@
66
93
  "yup": "^1.0.0"
67
94
  },
68
95
  "devDependencies": {
69
- "@backstage/cli": "^0.31.0",
70
- "@backstage/core-app-api": "^1.16.0",
71
- "@backstage/dev-utils": "^1.1.8",
72
- "@backstage/test-utils": "^1.7.6",
96
+ "@backstage/cli": "^0.33.0",
97
+ "@backstage/core-app-api": "^1.17.1",
98
+ "@backstage/dev-utils": "^1.1.11",
99
+ "@backstage/test-utils": "^1.7.9",
73
100
  "@testing-library/dom": "^10.0.0",
74
101
  "@testing-library/jest-dom": "^6.0.0",
75
102
  "@testing-library/react": "^15.0.0",