@littlebearapps/platform-admin-sdk 2.1.0 → 2.2.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 (115) hide show
  1. package/README.md +2 -5
  2. package/dist/templates.d.ts +1 -1
  3. package/dist/templates.js +121 -3
  4. package/package.json +1 -1
  5. package/templates/full/dashboard/src/components/notifications/NotificationDropdown.tsx +130 -0
  6. package/templates/full/dashboard/src/components/notifications/NotificationItem.tsx +264 -0
  7. package/templates/full/dashboard/src/components/patterns/PatternInfoButton.tsx +60 -0
  8. package/templates/full/dashboard/src/components/reports/FeatureUsageReport.tsx +339 -0
  9. package/templates/full/dashboard/src/components/search/SearchResultGroup.tsx +46 -0
  10. package/templates/full/dashboard/src/components/search/SearchResultItem.tsx +212 -0
  11. package/templates/full/dashboard/src/pages/api/patterns/[id]/approve.ts +49 -0
  12. package/templates/full/dashboard/src/pages/api/patterns/[id]/reject.ts +50 -0
  13. package/templates/full/dashboard/src/pages/api/reports/digests/stats.ts +38 -0
  14. package/templates/full/dashboard/src/pages/api/reports/digests.ts +39 -0
  15. package/templates/full/dashboard/src/pages/api/search/reindex/[type].ts +56 -0
  16. package/templates/full/dashboard/src/pages/api/test-reports/[id].ts +102 -0
  17. package/templates/full/dashboard/src/pages/feedback.astro +365 -0
  18. package/templates/full/dashboard/src/pages/kiosk.astro +206 -0
  19. package/templates/full/dashboard/src/pages/map.astro +561 -0
  20. package/templates/full/dashboard/src/pages/revenue.astro +72 -0
  21. package/templates/full/dashboard/src/pages/tests.astro +431 -0
  22. package/templates/full/scripts/ops/audit-cost-anomaly.ts +430 -0
  23. package/templates/full/scripts/ops/verify-account-total.ts +256 -0
  24. package/templates/full/tests/integration/feedback-schema.test.ts +361 -0
  25. package/templates/full/tests/integration/r2-archive.test.ts +108 -0
  26. package/templates/shared/.github/workflows/dependabot-automerge.yml +41 -0
  27. package/templates/shared/.github/workflows/validate-controls.yml +27 -0
  28. package/templates/shared/dashboard/src/components/Breadcrumbs.astro +101 -0
  29. package/templates/shared/dashboard/src/components/EmptyState.astro +46 -0
  30. package/templates/shared/dashboard/src/components/ErrorBoundary.astro +79 -0
  31. package/templates/shared/dashboard/src/components/LoadingSkeleton.astro +105 -0
  32. package/templates/shared/dashboard/src/components/PageShell.astro +72 -0
  33. package/templates/shared/dashboard/src/components/SkipLinks.astro +22 -0
  34. package/templates/shared/dashboard/src/components/Toast.astro +170 -0
  35. package/templates/shared/dashboard/src/components/ToastContainer.astro +156 -0
  36. package/templates/shared/dashboard/src/components/costs/ProviderCostsGrid.tsx +401 -0
  37. package/templates/shared/dashboard/src/components/costs/index.ts +4 -0
  38. package/templates/shared/dashboard/src/components/overview/AlertBanner.tsx +94 -0
  39. package/templates/shared/dashboard/src/components/overview/index.ts +9 -0
  40. package/templates/shared/dashboard/src/components/resources/CostChart.tsx +170 -0
  41. package/templates/shared/dashboard/src/components/resources/ProviderCard.tsx +272 -0
  42. package/templates/shared/dashboard/src/components/resources/ProviderDetail.tsx +293 -0
  43. package/templates/shared/dashboard/src/components/settings/SettingsCard.astro +102 -0
  44. package/templates/shared/dashboard/src/components/usage/AllowanceGauge.astro +170 -0
  45. package/templates/shared/dashboard/src/components/usage/AnomalyAlerts.astro +633 -0
  46. package/templates/shared/dashboard/src/components/usage/BillingCycleCountdown.astro +192 -0
  47. package/templates/shared/dashboard/src/components/usage/BurnRateHero.astro +539 -0
  48. package/templates/shared/dashboard/src/components/usage/CircuitBreakerEventLog.astro +542 -0
  49. package/templates/shared/dashboard/src/components/usage/CircuitBreakerPanel.tsx +292 -0
  50. package/templates/shared/dashboard/src/components/usage/CircuitBreakerStatus.astro +669 -0
  51. package/templates/shared/dashboard/src/components/usage/CompactThresholdBanner.astro +531 -0
  52. package/templates/shared/dashboard/src/components/usage/ComparisonModeSelector.astro +651 -0
  53. package/templates/shared/dashboard/src/components/usage/CostBreakdownChart.astro +381 -0
  54. package/templates/shared/dashboard/src/components/usage/CostBreakdownTable.astro +210 -0
  55. package/templates/shared/dashboard/src/components/usage/CostDataTable.astro +0 -0
  56. package/templates/shared/dashboard/src/components/usage/CostDonutChart.astro +311 -0
  57. package/templates/shared/dashboard/src/components/usage/DailyCostChart.astro +632 -0
  58. package/templates/shared/dashboard/src/components/usage/ExportButton.astro +114 -0
  59. package/templates/shared/dashboard/src/components/usage/FeatureBudgetsTable.astro +872 -0
  60. package/templates/shared/dashboard/src/components/usage/FilterBar.astro +190 -0
  61. package/templates/shared/dashboard/src/components/usage/FilterToggles.astro +175 -0
  62. package/templates/shared/dashboard/src/components/usage/GitHubUsageCard.astro +537 -0
  63. package/templates/shared/dashboard/src/components/usage/OverageCostCard.astro +212 -0
  64. package/templates/shared/dashboard/src/components/usage/PlanUtilizationCard.astro +193 -0
  65. package/templates/shared/dashboard/src/components/usage/ProjectCard.astro +640 -0
  66. package/templates/shared/dashboard/src/components/usage/ProjectCardsGrid.astro +272 -0
  67. package/templates/shared/dashboard/src/components/usage/ResourceSearch.astro +279 -0
  68. package/templates/shared/dashboard/src/components/usage/ServiceUtilizationList.astro +604 -0
  69. package/templates/shared/dashboard/src/components/usage/SparklineCard.astro +399 -0
  70. package/templates/shared/dashboard/src/components/usage/StatsHero.astro +600 -0
  71. package/templates/shared/dashboard/src/components/usage/TableFilters.astro +1033 -0
  72. package/templates/shared/dashboard/src/components/usage/ThresholdAlert.astro +271 -0
  73. package/templates/shared/dashboard/src/components/usage/ThresholdSettings.astro +618 -0
  74. package/templates/shared/dashboard/src/components/usage/TopSpenderCard.astro +170 -0
  75. package/templates/shared/dashboard/src/components/usage/UnifiedResourceTable.astro +1737 -0
  76. package/templates/shared/dashboard/src/components/usage/UsageCard.astro +135 -0
  77. package/templates/shared/dashboard/src/components/usage/UsageHealthBanner.astro +387 -0
  78. package/templates/shared/dashboard/src/components/usage/UtilizationBar.astro +159 -0
  79. package/templates/shared/dashboard/src/components/usage/WorkersBreakdownTable.astro +659 -0
  80. package/templates/shared/dashboard/src/components/usage/daily/CostChart.astro +461 -0
  81. package/templates/shared/dashboard/src/components/usage/daily/CostTable.astro +946 -0
  82. package/templates/shared/dashboard/src/components/usage/daily/DailyOverview.astro +1079 -0
  83. package/templates/shared/dashboard/src/components/usage/design-tokens.ts +187 -0
  84. package/templates/shared/dashboard/src/components/usage/filters/InlineDateRange.astro +285 -0
  85. package/templates/shared/dashboard/src/components/usage/filters/PeriodButtons.astro +157 -0
  86. package/templates/shared/dashboard/src/components/usage/filters/ProjectSelect.astro +284 -0
  87. package/templates/shared/dashboard/src/components/usage/scripts/ai-tab-controller.ts +419 -0
  88. package/templates/shared/dashboard/src/components/usage/scripts/constants.ts +60 -0
  89. package/templates/shared/dashboard/src/components/usage/scripts/formatters.ts +62 -0
  90. package/templates/shared/dashboard/src/components/usage/scripts/overview-controller.ts +1633 -0
  91. package/templates/shared/dashboard/src/components/usage/scripts/resource-table-builder.ts +294 -0
  92. package/templates/shared/dashboard/src/components/usage/scripts/tabs-filters-controller.ts +464 -0
  93. package/templates/shared/dashboard/src/components/usage/state/index.ts +55 -0
  94. package/templates/shared/dashboard/src/components/usage/state/usageActions.ts +439 -0
  95. package/templates/shared/dashboard/src/components/usage/state/usageStore.ts +376 -0
  96. package/templates/shared/dashboard/src/components/usage/types.ts +283 -0
  97. package/templates/shared/dashboard/src/components/usage/usage-colors.ts +292 -0
  98. package/templates/shared/dashboard/src/pages/api/usage/ai-models.ts +235 -0
  99. package/templates/shared/dashboard/src/pages/api/usage/billing-context.ts +296 -0
  100. package/templates/shared/scripts/test-telemetry-flow.ts +464 -0
  101. package/templates/shared/tests/e2e/usage-export.test.ts +784 -0
  102. package/templates/shared/tests/e2e/usage-mobile.test.ts +531 -0
  103. package/templates/standard/dashboard/src/components/errors/PriorityBadge.astro +27 -0
  104. package/templates/standard/dashboard/src/components/infrastructure/HealthchecksStatus.tsx +293 -0
  105. package/templates/standard/dashboard/src/components/infrastructure/InfrastructureTabs.tsx +268 -0
  106. package/templates/standard/dashboard/src/pages/analytics.astro +64 -0
  107. package/templates/standard/dashboard/src/pages/api/infrastructure/alerts.ts +85 -0
  108. package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks/[id]/flips.ts +110 -0
  109. package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks.ts +101 -0
  110. package/templates/standard/dashboard/src/pages/api/infrastructure/uptime/[id]/response-times.ts +121 -0
  111. package/templates/standard/dashboard/src/pages/api/infrastructure/uptime.ts +89 -0
  112. package/templates/standard/dashboard/src/pages/api/test/service-auth.ts +178 -0
  113. package/templates/standard/tests/integration/connectors.test.ts +241 -0
  114. package/templates/standard/tests/integration/github-monitor.test.ts +143 -0
  115. package/templates/standard/tests/integration/ingestion.test.ts +211 -0
@@ -0,0 +1,192 @@
1
+ ---
2
+ /**
3
+ * BillingCycleCountdown - Shows days until billing reset
4
+ *
5
+ * Displays "X days until billing reset" with a progress bar
6
+ * showing how far through the billing period we are.
7
+ *
8
+ * @created 2026-01-22
9
+ */
10
+
11
+ interface Props {
12
+ /** Card title */
13
+ title?: string;
14
+ /** ID for JavaScript updates */
15
+ id?: string;
16
+ /** Compact mode (inline display) */
17
+ compact?: boolean;
18
+ }
19
+
20
+ const { title = 'Billing Cycle', id = 'billing-countdown', compact = false } = Astro.props;
21
+ ---
22
+
23
+ {
24
+ compact ? (
25
+ <div id={id} class="flex items-center gap-2 text-sm">
26
+ <span class="text-gray-500 dark:text-gray-400">
27
+ <svg
28
+ class="w-4 h-4 inline-block mr-1"
29
+ fill="none"
30
+ stroke="currentColor"
31
+ viewBox="0 0 24 24"
32
+ >
33
+ <path
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ stroke-width="2"
37
+ d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
38
+ />
39
+ </svg>
40
+ </span>
41
+ <span id={`${id}-text`} class="text-gray-700 dark:text-gray-300">
42
+ -- days until reset
43
+ </span>
44
+ </div>
45
+ ) : (
46
+ <div
47
+ id={id}
48
+ class="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 shadow-sm"
49
+ >
50
+ <div class="flex items-center justify-between mb-3">
51
+ <h3 class="text-sm font-medium text-gray-500 dark:text-gray-400">{title}</h3>
52
+ <span
53
+ id={`${id}-badge`}
54
+ class="px-2 py-0.5 text-xs font-medium rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
55
+ >
56
+ Active
57
+ </span>
58
+ </div>
59
+
60
+ <div class="text-center mb-4">
61
+ <div class="flex items-center justify-center gap-1">
62
+ <span id={`${id}-days`} class="text-4xl font-bold text-gray-900 dark:text-gray-100">
63
+ --
64
+ </span>
65
+ <span class="text-lg text-gray-500 dark:text-gray-400">days</span>
66
+ </div>
67
+ <p id={`${id}-text`} class="text-sm text-gray-600 dark:text-gray-300 mt-1">
68
+ until billing reset
69
+ </p>
70
+ </div>
71
+
72
+ <div class="mb-3">
73
+ <div class="flex justify-between text-xs text-gray-500 dark:text-gray-400 mb-1">
74
+ <span id={`${id}-start`}>Jan 1</span>
75
+ <span id={`${id}-end`}>Jan 31</span>
76
+ </div>
77
+ <div class="w-full h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden">
78
+ <div
79
+ id={`${id}-progress`}
80
+ class="h-full bg-blue-500 transition-all duration-500"
81
+ style="width: 0%"
82
+ />
83
+ </div>
84
+ </div>
85
+
86
+ <div class="flex justify-between text-xs text-gray-500 dark:text-gray-400">
87
+ <span>
88
+ <span id={`${id}-elapsed`}>0</span> days elapsed
89
+ </span>
90
+ <span>
91
+ <span id={`${id}-total`}>30</span> day period
92
+ </span>
93
+ </div>
94
+ </div>
95
+ )
96
+ }
97
+
98
+ <script>
99
+ interface BillingCycleData {
100
+ startDate: string; // ISO date
101
+ endDate: string; // ISO date
102
+ daysInPeriod: number;
103
+ daysElapsed: number;
104
+ daysRemaining: number;
105
+ progress: number; // 0-1
106
+ periodFormatted?: string; // "Jan 1 - Jan 31"
107
+ }
108
+
109
+ function formatShortDate(isoDate: string): string {
110
+ const date = new Date(isoDate);
111
+ return new Intl.DateTimeFormat('en-AU', { month: 'short', day: 'numeric' }).format(date);
112
+ }
113
+
114
+ function getBadgeClasses(daysRemaining: number): string {
115
+ if (daysRemaining <= 1) {
116
+ return 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400';
117
+ }
118
+ if (daysRemaining <= 3) {
119
+ return 'bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-400';
120
+ }
121
+ if (daysRemaining <= 7) {
122
+ return 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400';
123
+ }
124
+ return 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400';
125
+ }
126
+
127
+ function getBadgeText(daysRemaining: number): string {
128
+ if (daysRemaining <= 0) return 'Reset Today';
129
+ if (daysRemaining <= 1) return 'Reset Tomorrow';
130
+ if (daysRemaining <= 3) return 'Ending Soon';
131
+ return 'Active';
132
+ }
133
+
134
+ function getCountdownText(daysRemaining: number): string {
135
+ if (daysRemaining <= 0) return 'Billing reset today';
136
+ if (daysRemaining === 1) return '1 day until billing reset';
137
+ return `${daysRemaining} days until billing reset`;
138
+ }
139
+
140
+ function updateBillingCycleCountdown(countdownId: string, data: BillingCycleData) {
141
+ const daysEl = document.getElementById(`${countdownId}-days`);
142
+ const textEl = document.getElementById(`${countdownId}-text`);
143
+ const badgeEl = document.getElementById(`${countdownId}-badge`);
144
+ const progressEl = document.getElementById(`${countdownId}-progress`);
145
+ const startEl = document.getElementById(`${countdownId}-start`);
146
+ const endEl = document.getElementById(`${countdownId}-end`);
147
+ const elapsedEl = document.getElementById(`${countdownId}-elapsed`);
148
+ const totalEl = document.getElementById(`${countdownId}-total`);
149
+
150
+ // Update days display (for full mode)
151
+ if (daysEl) {
152
+ daysEl.textContent = String(data.daysRemaining);
153
+ }
154
+
155
+ // Update countdown text
156
+ if (textEl) {
157
+ textEl.textContent = getCountdownText(data.daysRemaining);
158
+ }
159
+
160
+ // Update badge
161
+ if (badgeEl) {
162
+ badgeEl.className = `px-2 py-0.5 text-xs font-medium rounded-full ${getBadgeClasses(data.daysRemaining)}`;
163
+ badgeEl.textContent = getBadgeText(data.daysRemaining);
164
+ }
165
+
166
+ // Update progress bar
167
+ if (progressEl) {
168
+ progressEl.style.width = `${Math.min(100, data.progress * 100)}%`;
169
+ }
170
+
171
+ // Update date labels
172
+ if (startEl) {
173
+ startEl.textContent = formatShortDate(data.startDate);
174
+ }
175
+ if (endEl) {
176
+ endEl.textContent = formatShortDate(data.endDate);
177
+ }
178
+
179
+ // Update stats
180
+ if (elapsedEl) {
181
+ elapsedEl.textContent = String(data.daysElapsed);
182
+ }
183
+ if (totalEl) {
184
+ totalEl.textContent = String(data.daysInPeriod);
185
+ }
186
+ }
187
+
188
+ // Expose globally for page scripts
189
+ (
190
+ window as unknown as { updateBillingCycleCountdown: typeof updateBillingCycleCountdown }
191
+ ).updateBillingCycleCountdown = updateBillingCycleCountdown;
192
+ </script>