feat(sdk): add toast API and Yahoo dividends endpoint for addons#625
feat(sdk): add toast API and Yahoo dividends endpoint for addons#625afadil merged 13 commits intoafadil:mainfrom
Conversation
|
Thanks for the contribution. Can you maintain this add-on in its own dedicated GitHub repository? I can then add it to the addons store |
|
@afadil there are some changes in the app which this add-on needs which is included in this PR. should i take the add-on out and leave the app changes? |
|
Yes please, keep only the app changes in this pr and move the addon to a dedicated repo you own 🙏 |
ee67f2b to
1b1561f
Compare
|
@afadil updated, thanks 🙏 |
|
please post here the link to the addon repo |
|
@codex review |
|
link to add-on: https://github.com/kwaich/dividend-tracker |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b1561f924
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub async fn fetch_yahoo_dividends( | ||
| symbol: String, | ||
| ) -> Result<Vec<wealthfolio_market_data::YahooDividend>, String> { | ||
| let provider = wealthfolio_market_data::YahooProvider::new() |
There was a problem hiding this comment.
Expose dividends endpoint through addon host API
fetch_yahoo_dividends is only introduced as a raw Tauri command, but the addon-facing API surface is not extended to call it (no corresponding method in MarketDataAPI and no bridge wiring in createSDKHostAPIBridge). As a result, addons that rely on the supported ctx.api contract cannot access this new endpoint, so the feature is effectively unreachable unless addon authors depend on internal Tauri globals.
Useful? React with 👍 / 👎.
| .and_then(|c| c.result) | ||
| .and_then(|r| r.into_iter().next()) | ||
| .and_then(|r| r.events) | ||
| .and_then(|e| e.dividends) | ||
| .unwrap_or_default(); |
There was a problem hiding this comment.
Surface Yahoo chart errors before defaulting to empty dividends
This logic converts any response without chart.result into Ok([]) via unwrap_or_default(), which masks upstream Yahoo failures when the payload contains chart.error with result: null (for example invalid/delisted symbols or auth-related responses). In those cases callers cannot distinguish a real “no dividends” result from a request failure, leading to silent data loss in dividend workflows.
Useful? React with 👍 / 👎.
Implement a new addon that identifies missing dividend activities by fetching historical data from Yahoo Finance. Features include: - Holdings-based dividend suggestions - Automated comparison with existing activities to avoid duplicates - Bulk creation of missing dividend records - Integrated history view for verified activities
…ckend Move Yahoo Finance API calls from client-side to Rust backend to avoid CORS restrictions. Refactor suggestions state to use an override Map for cleaner update patterns. Add logging for symbol mapping.
…unnecessary re-renders - Add useRef to track seen suggestion IDs - Wrap symbolMap, yahooSymbolMap, and query configs in useMemo - Only process new suggestions in useEffect instead of re-processing all
…on size Suggestions previously included all current holdings regardless of whether shares were owned at each ex-date. This adds a quantity timeline built from BUY/SELL/SPLIT/TRANSFER_IN/TRANSFER_OUT activities so only eligible dividends are surfaced, with amounts scaled to the actual position size at each ex-date. Also exposes a `toast` API on the addon SDK backed by the host's sonner instance, removing the need for addons to bundle sonner themselves.
…heck logic Extracts isDuplicate logic to a dedicated utility file with comprehensive unit tests. Adds test suites for HistoryTab, DividendPage, and yahoo-dividends fetching logic using React Testing Library and Vitest. Updates README with simplified test execution instructions.
…stom hooks Extracts data fetching and suggestion calculation logic from SuggestionsTab into a set of specialized React hooks. This simplifies the component, improves separation of concerns, and establishes a reusable pattern for addon data management. - Create useDividendSuggestions orchestrator hook - Add specialized hooks for accounts, profiles, holdings, and activities - Move DividendSuggestion interface to a shared types file - Standardize query keys using QueryKeys from addon-sdk
…ggestions - Add "Pay-Date" column to suggestions table for user input - Store ex-date in activity notes when pay-date is used - Update duplicate detection to use ex-date from notes if available - Alias 'comment' to 'notes' in backend activity model for compatibility
…cation - Replace native date input with DatePickerInput in SuggestionsTab for better pay-date selection and robust state updates. - Remove anchors from the deduplication regex to ensure ex-date detection works even if the user appends notes to the comment field.
Add sorting, account filter, totals, truncation notice, and balance\nprivacy formatting; surface suggestion fetch errors and align\nqueries/pagination for dividend data.
90fb06d to
13bd49f
Compare
|
To use Codex here, create a Codex account and connect to github. |
Description
Extends the addon platform with two new capabilities built to support the
Dividend Tracker addon.
Toast notifications (
ToastAPI)ToastAPIinterface to the addon SDK (host-api.ts) withsuccess,error,warning, andinfomethodstype-bridge.tsandaddons-runtime-context.tsusing the host app's existingsonnerinstanceYahoo Finance dividend endpoint
fetch_dividendsonYahooProviderin the market-data crate — fetches up to 2 years of dividend events from the Yahoo Finance v8 chart API using the existing crumb/cookie sessionYahooDividendas a public type fromwealthfolio-market-datafetch_yahoo_dividendsTauri command proxies the call through Rust (avoids CORS in the webview)Minor improvements
invalidateQueries/refetchQueriesin the addon runtime now passexact: falsefor broader cache invalidationNewActivity.notesgains#[serde(alias = "comment")]for backwards-compatibilityChecklist
By submitting this PR, I agree to the CLA.