feat: add RenewalCalendar component for tracking and visualizing subs…#3
Conversation
…cription renewals with CSV/XLSX support
There was a problem hiding this comment.
Pull request overview
This PR updates the RenewalCalendar feature to stop inferring “in EST” status from billing data and instead support uploading a Partner Center AI Assist EST export CSV to track subscriptions scheduled to enter EST.
Changes:
- Removed the previous “in Extended Service Term (EST)” calculation and related calendar/list/export UI.
- Added Partner Center EST CSV upload parsing via PapaParse, including basic format validation and error display.
- Added SubscriptionId → CustomerName resolution for uploaded EST rows using existing billing data.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| complete: (results) => { | ||
| const rows = results.data as Record<string, string>[]; | ||
| if (!rows.length) { | ||
| setEstUploadError('No data rows found in the uploaded file.'); | ||
| return; |
There was a problem hiding this comment.
In the PapaParse complete handler, results.errors is ignored. Papa can return partial data alongside parse errors (e.g., malformed quotes/rows), which would currently be treated as a successful upload. Consider checking results.errors.length and surfacing a useful error (or at least a warning) before calling setEstUploadRecords.
There was a problem hiding this comment.
Done in commits 62ae92d–53eca7f. The complete handler now:
- Builds a
parseWarningstring fromresults.errors(count + sample of up to 3 issues with human-readable row numbers via the newCSV_ROW_NUMBER_OFFSETconstant). - Preserves that warning inside any subsequent validation error messages ("no data" / wrong format), so it's never silently lost.
- Shows the warning on its own when partial data is still returned and processed successfully.
- Also fixed the file input not being reset in early
completereturns and in theerrorcallback, so retrying the same file always firesonChange. - Changed
daysUntilESTtoNumber.POSITIVE_INFINITYfor missing/unparseable dates, so those rows sort to the end and render—instead of the misleading "Today".
| setEstUploadRecords(parsed); | ||
| // Reset file input so re-uploading the same file triggers onChange | ||
| if (estFileInputRef.current) estFileInputRef.current.value = ''; | ||
| }, | ||
| error: (err: any) => { | ||
| setEstUploadError(`Parse error: ${err.message}`); |
There was a problem hiding this comment.
The file input is reset only on successful complete, but not on parse error. If parsing fails, selecting the same file again may not fire onChange, making it hard to retry. Consider also clearing estFileInputRef.current.value in the error callback (and possibly in early returns that set estUploadError).
…g subscription renewal dates
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot apply changes based on the comments in this thread |
…n dates, reset file input on error Agent-Logs-Url: https://github.com/hardinxcore/CSPInsights.app/sessions/8e2b7784-bbed-4956-beea-3fd717a0ec75 Co-authored-by: hardinxcore <34623288+hardinxcore@users.noreply.github.com>
… comment Agent-Logs-Url: https://github.com/hardinxcore/CSPInsights.app/sessions/8e2b7784-bbed-4956-beea-3fd717a0ec75 Co-authored-by: hardinxcore <34623288+hardinxcore@users.noreply.github.com>
…display Agent-Logs-Url: https://github.com/hardinxcore/CSPInsights.app/sessions/8e2b7784-bbed-4956-beea-3fd717a0ec75 Co-authored-by: hardinxcore <34623288+hardinxcore@users.noreply.github.com>
results.errorsin PapaParsecompletehandler and surface parse warnings (comment_id: 3032958102)CSV_ROW_NUMBER_OFFSET = 2constant with doc comment for clarityNumber.POSITIVE_INFINITYfordaysUntilESTwhentermEndDateis missing (avoids false "Today" urgency)completereturns and in theerrorcallback so retry worksInfinityin display labels (shows—instead ofInfinityd)