@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.
- package/README.md +2 -5
- package/dist/templates.d.ts +1 -1
- package/dist/templates.js +121 -3
- package/package.json +1 -1
- package/templates/full/dashboard/src/components/notifications/NotificationDropdown.tsx +130 -0
- package/templates/full/dashboard/src/components/notifications/NotificationItem.tsx +264 -0
- package/templates/full/dashboard/src/components/patterns/PatternInfoButton.tsx +60 -0
- package/templates/full/dashboard/src/components/reports/FeatureUsageReport.tsx +339 -0
- package/templates/full/dashboard/src/components/search/SearchResultGroup.tsx +46 -0
- package/templates/full/dashboard/src/components/search/SearchResultItem.tsx +212 -0
- package/templates/full/dashboard/src/pages/api/patterns/[id]/approve.ts +49 -0
- package/templates/full/dashboard/src/pages/api/patterns/[id]/reject.ts +50 -0
- package/templates/full/dashboard/src/pages/api/reports/digests/stats.ts +38 -0
- package/templates/full/dashboard/src/pages/api/reports/digests.ts +39 -0
- package/templates/full/dashboard/src/pages/api/search/reindex/[type].ts +56 -0
- package/templates/full/dashboard/src/pages/api/test-reports/[id].ts +102 -0
- package/templates/full/dashboard/src/pages/feedback.astro +365 -0
- package/templates/full/dashboard/src/pages/kiosk.astro +206 -0
- package/templates/full/dashboard/src/pages/map.astro +561 -0
- package/templates/full/dashboard/src/pages/revenue.astro +72 -0
- package/templates/full/dashboard/src/pages/tests.astro +431 -0
- package/templates/full/scripts/ops/audit-cost-anomaly.ts +430 -0
- package/templates/full/scripts/ops/verify-account-total.ts +256 -0
- package/templates/full/tests/integration/feedback-schema.test.ts +361 -0
- package/templates/full/tests/integration/r2-archive.test.ts +108 -0
- package/templates/shared/.github/workflows/dependabot-automerge.yml +41 -0
- package/templates/shared/.github/workflows/validate-controls.yml +27 -0
- package/templates/shared/dashboard/src/components/Breadcrumbs.astro +101 -0
- package/templates/shared/dashboard/src/components/EmptyState.astro +46 -0
- package/templates/shared/dashboard/src/components/ErrorBoundary.astro +79 -0
- package/templates/shared/dashboard/src/components/LoadingSkeleton.astro +105 -0
- package/templates/shared/dashboard/src/components/PageShell.astro +72 -0
- package/templates/shared/dashboard/src/components/SkipLinks.astro +22 -0
- package/templates/shared/dashboard/src/components/Toast.astro +170 -0
- package/templates/shared/dashboard/src/components/ToastContainer.astro +156 -0
- package/templates/shared/dashboard/src/components/costs/ProviderCostsGrid.tsx +401 -0
- package/templates/shared/dashboard/src/components/costs/index.ts +4 -0
- package/templates/shared/dashboard/src/components/overview/AlertBanner.tsx +94 -0
- package/templates/shared/dashboard/src/components/overview/index.ts +9 -0
- package/templates/shared/dashboard/src/components/resources/CostChart.tsx +170 -0
- package/templates/shared/dashboard/src/components/resources/ProviderCard.tsx +272 -0
- package/templates/shared/dashboard/src/components/resources/ProviderDetail.tsx +293 -0
- package/templates/shared/dashboard/src/components/settings/SettingsCard.astro +102 -0
- package/templates/shared/dashboard/src/components/usage/AllowanceGauge.astro +170 -0
- package/templates/shared/dashboard/src/components/usage/AnomalyAlerts.astro +633 -0
- package/templates/shared/dashboard/src/components/usage/BillingCycleCountdown.astro +192 -0
- package/templates/shared/dashboard/src/components/usage/BurnRateHero.astro +539 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerEventLog.astro +542 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerPanel.tsx +292 -0
- package/templates/shared/dashboard/src/components/usage/CircuitBreakerStatus.astro +669 -0
- package/templates/shared/dashboard/src/components/usage/CompactThresholdBanner.astro +531 -0
- package/templates/shared/dashboard/src/components/usage/ComparisonModeSelector.astro +651 -0
- package/templates/shared/dashboard/src/components/usage/CostBreakdownChart.astro +381 -0
- package/templates/shared/dashboard/src/components/usage/CostBreakdownTable.astro +210 -0
- package/templates/shared/dashboard/src/components/usage/CostDataTable.astro +0 -0
- package/templates/shared/dashboard/src/components/usage/CostDonutChart.astro +311 -0
- package/templates/shared/dashboard/src/components/usage/DailyCostChart.astro +632 -0
- package/templates/shared/dashboard/src/components/usage/ExportButton.astro +114 -0
- package/templates/shared/dashboard/src/components/usage/FeatureBudgetsTable.astro +872 -0
- package/templates/shared/dashboard/src/components/usage/FilterBar.astro +190 -0
- package/templates/shared/dashboard/src/components/usage/FilterToggles.astro +175 -0
- package/templates/shared/dashboard/src/components/usage/GitHubUsageCard.astro +537 -0
- package/templates/shared/dashboard/src/components/usage/OverageCostCard.astro +212 -0
- package/templates/shared/dashboard/src/components/usage/PlanUtilizationCard.astro +193 -0
- package/templates/shared/dashboard/src/components/usage/ProjectCard.astro +640 -0
- package/templates/shared/dashboard/src/components/usage/ProjectCardsGrid.astro +272 -0
- package/templates/shared/dashboard/src/components/usage/ResourceSearch.astro +279 -0
- package/templates/shared/dashboard/src/components/usage/ServiceUtilizationList.astro +604 -0
- package/templates/shared/dashboard/src/components/usage/SparklineCard.astro +399 -0
- package/templates/shared/dashboard/src/components/usage/StatsHero.astro +600 -0
- package/templates/shared/dashboard/src/components/usage/TableFilters.astro +1033 -0
- package/templates/shared/dashboard/src/components/usage/ThresholdAlert.astro +271 -0
- package/templates/shared/dashboard/src/components/usage/ThresholdSettings.astro +618 -0
- package/templates/shared/dashboard/src/components/usage/TopSpenderCard.astro +170 -0
- package/templates/shared/dashboard/src/components/usage/UnifiedResourceTable.astro +1737 -0
- package/templates/shared/dashboard/src/components/usage/UsageCard.astro +135 -0
- package/templates/shared/dashboard/src/components/usage/UsageHealthBanner.astro +387 -0
- package/templates/shared/dashboard/src/components/usage/UtilizationBar.astro +159 -0
- package/templates/shared/dashboard/src/components/usage/WorkersBreakdownTable.astro +659 -0
- package/templates/shared/dashboard/src/components/usage/daily/CostChart.astro +461 -0
- package/templates/shared/dashboard/src/components/usage/daily/CostTable.astro +946 -0
- package/templates/shared/dashboard/src/components/usage/daily/DailyOverview.astro +1079 -0
- package/templates/shared/dashboard/src/components/usage/design-tokens.ts +187 -0
- package/templates/shared/dashboard/src/components/usage/filters/InlineDateRange.astro +285 -0
- package/templates/shared/dashboard/src/components/usage/filters/PeriodButtons.astro +157 -0
- package/templates/shared/dashboard/src/components/usage/filters/ProjectSelect.astro +284 -0
- package/templates/shared/dashboard/src/components/usage/scripts/ai-tab-controller.ts +419 -0
- package/templates/shared/dashboard/src/components/usage/scripts/constants.ts +60 -0
- package/templates/shared/dashboard/src/components/usage/scripts/formatters.ts +62 -0
- package/templates/shared/dashboard/src/components/usage/scripts/overview-controller.ts +1633 -0
- package/templates/shared/dashboard/src/components/usage/scripts/resource-table-builder.ts +294 -0
- package/templates/shared/dashboard/src/components/usage/scripts/tabs-filters-controller.ts +464 -0
- package/templates/shared/dashboard/src/components/usage/state/index.ts +55 -0
- package/templates/shared/dashboard/src/components/usage/state/usageActions.ts +439 -0
- package/templates/shared/dashboard/src/components/usage/state/usageStore.ts +376 -0
- package/templates/shared/dashboard/src/components/usage/types.ts +283 -0
- package/templates/shared/dashboard/src/components/usage/usage-colors.ts +292 -0
- package/templates/shared/dashboard/src/pages/api/usage/ai-models.ts +235 -0
- package/templates/shared/dashboard/src/pages/api/usage/billing-context.ts +296 -0
- package/templates/shared/scripts/test-telemetry-flow.ts +464 -0
- package/templates/shared/tests/e2e/usage-export.test.ts +784 -0
- package/templates/shared/tests/e2e/usage-mobile.test.ts +531 -0
- package/templates/standard/dashboard/src/components/errors/PriorityBadge.astro +27 -0
- package/templates/standard/dashboard/src/components/infrastructure/HealthchecksStatus.tsx +293 -0
- package/templates/standard/dashboard/src/components/infrastructure/InfrastructureTabs.tsx +268 -0
- package/templates/standard/dashboard/src/pages/analytics.astro +64 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/alerts.ts +85 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks/[id]/flips.ts +110 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/healthchecks.ts +101 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/uptime/[id]/response-times.ts +121 -0
- package/templates/standard/dashboard/src/pages/api/infrastructure/uptime.ts +89 -0
- package/templates/standard/dashboard/src/pages/api/test/service-auth.ts +178 -0
- package/templates/standard/tests/integration/connectors.test.ts +241 -0
- package/templates/standard/tests/integration/github-monitor.test.ts +143 -0
- 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>
|