@wealthfolio/addon-sdk 1.0.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.
@@ -0,0 +1,1137 @@
1
+ import React__default from 'react';
2
+
3
+ /**
4
+ * Comprehensive data types for Wealthfolio addons
5
+ * These types mirror the main application types to ensure compatibility
6
+ */
7
+ declare const ActivityType: {
8
+ readonly BUY: "BUY";
9
+ readonly SELL: "SELL";
10
+ readonly DIVIDEND: "DIVIDEND";
11
+ readonly INTEREST: "INTEREST";
12
+ readonly DEPOSIT: "DEPOSIT";
13
+ readonly WITHDRAWAL: "WITHDRAWAL";
14
+ readonly ADD_HOLDING: "ADD_HOLDING";
15
+ readonly REMOVE_HOLDING: "REMOVE_HOLDING";
16
+ readonly TRANSFER_IN: "TRANSFER_IN";
17
+ readonly TRANSFER_OUT: "TRANSFER_OUT";
18
+ readonly FEE: "FEE";
19
+ readonly TAX: "TAX";
20
+ readonly SPLIT: "SPLIT";
21
+ };
22
+ type ActivityType = (typeof ActivityType)[keyof typeof ActivityType];
23
+ declare const DataSource: {
24
+ readonly YAHOO: "YAHOO";
25
+ readonly MANUAL: "MANUAL";
26
+ };
27
+ type DataSource = (typeof DataSource)[keyof typeof DataSource];
28
+ declare const AccountType: {
29
+ readonly SECURITIES: "SECURITIES";
30
+ readonly CASH: "CASH";
31
+ readonly CRYPTOCURRENCY: "CRYPTOCURRENCY";
32
+ };
33
+ type AccountType = (typeof AccountType)[keyof typeof AccountType];
34
+ declare const HoldingType: {
35
+ readonly CASH: "cash";
36
+ readonly SECURITY: "security";
37
+ };
38
+ type HoldingType = (typeof HoldingType)[keyof typeof HoldingType];
39
+ type ImportRequiredField = 'symbol' | 'quantity' | 'price' | 'date' | 'type';
40
+ interface Account {
41
+ id: string;
42
+ name: string;
43
+ accountType: AccountType;
44
+ group?: string;
45
+ balance: number;
46
+ currency: string;
47
+ isDefault: boolean;
48
+ isActive: boolean;
49
+ createdAt: Date;
50
+ updatedAt: Date;
51
+ platformId?: string;
52
+ }
53
+ interface Activity {
54
+ id: string;
55
+ type: ActivityType;
56
+ date: Date | string;
57
+ quantity: number;
58
+ unitPrice: number;
59
+ currency: string;
60
+ fee: number;
61
+ isDraft: boolean;
62
+ comment?: string | null;
63
+ accountId?: string | null;
64
+ createdAt: Date | string;
65
+ symbolProfileId: string;
66
+ updatedAt: Date | string;
67
+ }
68
+ interface ActivityDetails {
69
+ id: string;
70
+ activityType: ActivityType;
71
+ date: Date;
72
+ quantity: number;
73
+ unitPrice: number;
74
+ amount: number;
75
+ fee: number;
76
+ currency: string;
77
+ isDraft: boolean;
78
+ comment?: string;
79
+ createdAt: Date;
80
+ assetId: string;
81
+ updatedAt: Date;
82
+ accountId: string;
83
+ accountName: string;
84
+ accountCurrency: string;
85
+ assetSymbol: string;
86
+ assetName?: string;
87
+ assetDataSource?: DataSource;
88
+ subRows?: ActivityDetails[];
89
+ }
90
+ interface ActivitySearchResponse {
91
+ data: ActivityDetails[];
92
+ meta: {
93
+ totalRowCount: number;
94
+ };
95
+ }
96
+ interface ActivityCreate {
97
+ accountId: string;
98
+ activityType: string;
99
+ activityDate: string | Date;
100
+ assetId?: string;
101
+ quantity?: number;
102
+ unitPrice?: number;
103
+ amount?: number;
104
+ currency?: string;
105
+ fee?: number;
106
+ isDraft: boolean;
107
+ comment?: string | null;
108
+ }
109
+ interface ActivityUpdate extends ActivityCreate {
110
+ id: string;
111
+ }
112
+ interface ActivityImport {
113
+ id?: string;
114
+ accountId: string;
115
+ currency?: string;
116
+ activityType: ActivityType;
117
+ date?: Date | string;
118
+ symbol: string;
119
+ amount?: number;
120
+ quantity?: number;
121
+ unitPrice?: number;
122
+ fee?: number;
123
+ accountName?: string;
124
+ symbolName?: string;
125
+ errors?: Record<string, string[]>;
126
+ isValid: boolean;
127
+ lineNumber?: number;
128
+ isDraft: boolean;
129
+ comment?: string;
130
+ }
131
+ interface ImportMappingData {
132
+ accountId: string;
133
+ fieldMappings: Record<string, string>;
134
+ activityMappings: Record<string, string[]>;
135
+ symbolMappings: Record<string, string>;
136
+ accountMappings: Record<string, string>;
137
+ }
138
+ interface AssetProfile {
139
+ id: string;
140
+ isin: string | null;
141
+ name: string | null;
142
+ assetType: string | null;
143
+ symbol: string;
144
+ symbolMapping: string | null;
145
+ assetClass: string | null;
146
+ assetSubClass: string | null;
147
+ notes: string | null;
148
+ countries: string | null;
149
+ categories: string | null;
150
+ classes: string | null;
151
+ attributes: string | null;
152
+ createdAt: Date;
153
+ currency: string;
154
+ dataSource: string;
155
+ updatedAt: Date;
156
+ sectors: string | null;
157
+ url: string | null;
158
+ }
159
+ interface QuoteSummary {
160
+ exchange: string;
161
+ shortName: string;
162
+ quoteType: string;
163
+ symbol: string;
164
+ index: string;
165
+ score: number;
166
+ typeDisplay: string;
167
+ longName: string;
168
+ sector?: string;
169
+ industry?: string;
170
+ dataSource?: boolean;
171
+ }
172
+ interface MarketDataProviderInfo {
173
+ id: string;
174
+ name: string;
175
+ logoFilename: string;
176
+ lastSyncedDate: string | null;
177
+ }
178
+ interface MarketData {
179
+ createdAt: Date;
180
+ dataSource: string;
181
+ date: Date;
182
+ id: string;
183
+ marketPrice: number;
184
+ state: 'CLOSE';
185
+ symbol: string;
186
+ symbolProfileId: string;
187
+ }
188
+ interface Tag {
189
+ id: string;
190
+ name: string;
191
+ activityId: string | null;
192
+ }
193
+ interface ImportValidationResult {
194
+ activities: ActivityImport[];
195
+ validationSummary: {
196
+ totalRows: number;
197
+ validCount: number;
198
+ invalidCount: number;
199
+ };
200
+ }
201
+ type ValidationResult = {
202
+ status: 'success';
203
+ } | {
204
+ status: 'error';
205
+ errors: string[];
206
+ };
207
+ interface Sector {
208
+ name: string;
209
+ weight: number;
210
+ }
211
+ interface Country {
212
+ name: string;
213
+ weight: number;
214
+ }
215
+ interface Instrument {
216
+ id: string;
217
+ symbol: string;
218
+ name?: string | null;
219
+ currency: string;
220
+ notes?: string | null;
221
+ dataSource?: string | null;
222
+ assetClass?: string | null;
223
+ assetSubclass?: string | null;
224
+ countries?: Country[] | null;
225
+ sectors?: Sector[] | null;
226
+ }
227
+ interface MonetaryValue {
228
+ local: number;
229
+ base: number;
230
+ }
231
+ interface Lot {
232
+ id: string;
233
+ positionId: string;
234
+ acquisitionDate: string;
235
+ quantity: number;
236
+ costBasis: number;
237
+ acquisitionPrice: number;
238
+ acquisitionFees: number;
239
+ }
240
+ interface Position {
241
+ id: string;
242
+ accountId: string;
243
+ assetId: string;
244
+ quantity: number;
245
+ averageCost: number;
246
+ totalCostBasis: number;
247
+ currency: string;
248
+ inceptionDate: string;
249
+ lots: Lot[];
250
+ }
251
+ interface CashHolding {
252
+ id: string;
253
+ accountId: string;
254
+ currency: string;
255
+ amount: number;
256
+ lastUpdated: string;
257
+ }
258
+ interface Holding {
259
+ id: string;
260
+ holdingType: HoldingType;
261
+ accountId: string;
262
+ instrument?: Instrument | null;
263
+ quantity: number;
264
+ openDate?: string | Date | null;
265
+ lots?: Lot[] | null;
266
+ localCurrency: string;
267
+ baseCurrency: string;
268
+ fxRate?: number | null;
269
+ marketValue: MonetaryValue;
270
+ costBasis?: MonetaryValue | null;
271
+ price?: number | null;
272
+ unrealizedGain?: MonetaryValue | null;
273
+ unrealizedGainPct?: number | null;
274
+ realizedGain?: MonetaryValue | null;
275
+ realizedGainPct?: number | null;
276
+ totalGain?: MonetaryValue | null;
277
+ totalGainPct?: number | null;
278
+ dayChange?: MonetaryValue | null;
279
+ dayChangePct?: number | null;
280
+ prevCloseValue?: MonetaryValue | null;
281
+ weight: number;
282
+ asOfDate: string;
283
+ }
284
+ interface Asset {
285
+ id: string;
286
+ isin?: string | null;
287
+ name?: string | null;
288
+ assetType?: string | null;
289
+ symbol: string;
290
+ symbolMapping?: string | null;
291
+ assetClass?: string | null;
292
+ assetSubClass?: string | null;
293
+ notes?: string | null;
294
+ countries?: string | null;
295
+ categories?: string | null;
296
+ classes?: string | null;
297
+ attributes?: string | null;
298
+ createdAt: string;
299
+ updatedAt: string;
300
+ currency: string;
301
+ dataSource: string;
302
+ sectors?: string | null;
303
+ url?: string | null;
304
+ }
305
+ interface Quote {
306
+ id: string;
307
+ createdAt: string;
308
+ dataSource: string;
309
+ timestamp: string;
310
+ symbol: string;
311
+ open: number;
312
+ high: number;
313
+ low: number;
314
+ volume: number;
315
+ close: number;
316
+ adjclose: number;
317
+ currency: string;
318
+ }
319
+ interface QuoteUpdate {
320
+ timestamp: string;
321
+ symbol: string;
322
+ open: number;
323
+ high: number;
324
+ low: number;
325
+ volume: number;
326
+ close: number;
327
+ dataSource: string;
328
+ }
329
+ interface Settings {
330
+ theme: string;
331
+ font: string;
332
+ baseCurrency: string;
333
+ onboardingCompleted: boolean;
334
+ }
335
+ interface SettingsContextType {
336
+ settings: Settings | null;
337
+ isLoading: boolean;
338
+ isError: boolean;
339
+ updateBaseCurrency: (currency: Settings['baseCurrency']) => Promise<void>;
340
+ accountsGrouped: boolean;
341
+ setAccountsGrouped: (value: boolean) => void;
342
+ }
343
+ interface Goal {
344
+ id: string;
345
+ title: string;
346
+ description?: string;
347
+ targetAmount: number;
348
+ isAchieved?: boolean;
349
+ allocations?: GoalAllocation[];
350
+ }
351
+ interface GoalAllocation {
352
+ id: string;
353
+ goalId: string;
354
+ accountId: string;
355
+ percentAllocation: number;
356
+ }
357
+ interface GoalProgress {
358
+ name: string;
359
+ targetValue: number;
360
+ currentValue: number;
361
+ progress: number;
362
+ currency: string;
363
+ }
364
+ interface IncomeSummary {
365
+ period: string;
366
+ byMonth: Record<string, number>;
367
+ byType: Record<string, number>;
368
+ bySymbol: Record<string, number>;
369
+ byCurrency: Record<string, number>;
370
+ totalIncome: number;
371
+ currency: string;
372
+ monthlyAverage: number;
373
+ yoyGrowth: number | null;
374
+ }
375
+ type DateRange = {
376
+ from: Date | undefined;
377
+ to: Date | undefined;
378
+ };
379
+ type TimePeriod = '1D' | '1W' | '1M' | '3M' | '6M' | 'YTD' | '1Y' | '5Y' | 'ALL';
380
+ interface AccountValuation {
381
+ id: string;
382
+ accountId: string;
383
+ valuationDate: string;
384
+ accountCurrency: string;
385
+ baseCurrency: string;
386
+ fxRateToBase: number;
387
+ cashBalance: number;
388
+ investmentMarketValue: number;
389
+ totalValue: number;
390
+ costBasis: number;
391
+ netContribution: number;
392
+ calculatedAt: string;
393
+ }
394
+ interface AccountSummaryView {
395
+ accountId: string;
396
+ accountName: string;
397
+ accountType: string;
398
+ accountGroup: string | null;
399
+ accountCurrency: string;
400
+ totalValueAccountCurrency: number;
401
+ totalValueBaseCurrency: number;
402
+ baseCurrency: string;
403
+ performance: SimplePerformanceMetrics;
404
+ }
405
+ interface SimplePerformanceMetrics {
406
+ accountId: string;
407
+ totalValue?: number | null;
408
+ accountCurrency?: string | null;
409
+ baseCurrency?: string | null;
410
+ fxRateToBase?: number | null;
411
+ totalGainLossAmount?: number | null;
412
+ cumulativeReturnPercent?: number | null;
413
+ dayGainLossAmount?: number | null;
414
+ dayReturnPercentModDietz?: number | null;
415
+ portfolioWeight?: number | null;
416
+ }
417
+ interface AccountGroup {
418
+ groupName: string;
419
+ accounts: AccountSummaryView[];
420
+ totalValueBaseCurrency: number;
421
+ baseCurrency: string;
422
+ performance: SimplePerformanceMetrics;
423
+ accountCount: number;
424
+ }
425
+ interface ExchangeRate {
426
+ id: string;
427
+ fromCurrency: string;
428
+ toCurrency: string;
429
+ fromCurrencyName?: string;
430
+ toCurrencyName?: string;
431
+ rate: number;
432
+ source: string;
433
+ isLoading?: boolean;
434
+ timestamp: string;
435
+ }
436
+ interface ContributionLimit {
437
+ id: string;
438
+ groupName: string;
439
+ contributionYear: number;
440
+ limitAmount: number;
441
+ accountIds?: string | null;
442
+ startDate?: string | null;
443
+ endDate?: string | null;
444
+ createdAt?: string;
445
+ updatedAt?: string;
446
+ }
447
+ type NewContributionLimit = Omit<ContributionLimit, 'id' | 'createdAt' | 'updatedAt'>;
448
+ interface AccountDeposit {
449
+ amount: number;
450
+ currency: string;
451
+ convertedAmount: number;
452
+ }
453
+ interface DepositsCalculation {
454
+ total: number;
455
+ baseCurrency: string;
456
+ byAccount: Record<string, AccountDeposit>;
457
+ }
458
+ declare const ACTIVITY_TYPE_PREFIX_LENGTH = 12;
459
+ interface ReturnData {
460
+ date: string;
461
+ value: number;
462
+ }
463
+ interface PerformanceMetrics {
464
+ id: string;
465
+ returns: ReturnData[];
466
+ periodStartDate?: string | null;
467
+ periodEndDate?: string | null;
468
+ currency: string;
469
+ cumulativeTwr: number;
470
+ gainLossAmount?: number | null;
471
+ annualizedTwr: number;
472
+ simpleReturn: number;
473
+ annualizedSimpleReturn: number;
474
+ cumulativeMwr: number;
475
+ annualizedMwr: number;
476
+ volatility: number;
477
+ maxDrawdown: number;
478
+ }
479
+ interface UpdateAssetProfile {
480
+ symbol: string;
481
+ name?: string;
482
+ sectors: string;
483
+ countries: string;
484
+ notes: string;
485
+ assetClass: string;
486
+ assetSubClass: string;
487
+ }
488
+ type TrackedItem = {
489
+ id: string;
490
+ type: 'account' | 'symbol';
491
+ name: string;
492
+ };
493
+
494
+ /**
495
+ * Host API interface for addon development
496
+ * Provides comprehensive access to Wealthfolio functionality organized by domain
497
+ */
498
+
499
+ /**
500
+ * Account management APIs
501
+ */
502
+ interface AccountsAPI {
503
+ /**
504
+ * Get all accounts
505
+ * @returns Promise resolving to array of accounts
506
+ */
507
+ getAll(): Promise<Account[]>;
508
+ /**
509
+ * Create a new account
510
+ * @param account New account data
511
+ * @returns Promise resolving to created account
512
+ */
513
+ create(account: any): Promise<Account>;
514
+ }
515
+ /**
516
+ * Portfolio and holdings APIs
517
+ */
518
+ interface PortfolioAPI {
519
+ /**
520
+ * Get holdings for a specific account
521
+ * @param accountId Account identifier
522
+ * @returns Promise resolving to array of holdings
523
+ */
524
+ getHoldings(accountId: string): Promise<Holding[]>;
525
+ /**
526
+ * Get specific holding information
527
+ * @param accountId Account identifier
528
+ * @param assetId Asset identifier
529
+ * @returns Promise resolving to holding or null if not found
530
+ */
531
+ getHolding(accountId: string, assetId: string): Promise<Holding | null>;
532
+ /**
533
+ * Update portfolio calculations
534
+ * @returns Promise that resolves when update is complete
535
+ */
536
+ update(): Promise<void>;
537
+ /**
538
+ * Recalculate entire portfolio
539
+ * @returns Promise that resolves when recalculation is complete
540
+ */
541
+ recalculate(): Promise<void>;
542
+ /**
543
+ * Get income summary data
544
+ * @returns Promise resolving to array of income summaries
545
+ */
546
+ getIncomeSummary(): Promise<IncomeSummary[]>;
547
+ /**
548
+ * Get historical valuations
549
+ * @param accountId Optional account identifier
550
+ * @param startDate Optional start date
551
+ * @param endDate Optional end date
552
+ * @returns Promise resolving to array of account valuations
553
+ */
554
+ getHistoricalValuations(accountId?: string, startDate?: string, endDate?: string): Promise<AccountValuation[]>;
555
+ /**
556
+ * Get latest valuations for a set of accounts
557
+ * @param accountIds Array of account identifiers
558
+ * @returns Promise resolving to array of latest account valuations
559
+ */
560
+ getLatestValuations(accountIds: string[]): Promise<AccountValuation[]>;
561
+ }
562
+ /**
563
+ * Activity management APIs
564
+ */
565
+ interface ActivitiesAPI {
566
+ /**
567
+ * Get activities, optionally filtered by account
568
+ * @param accountId Optional account identifier for filtering
569
+ * @returns Promise resolving to array of activity details
570
+ */
571
+ getAll(accountId?: string): Promise<ActivityDetails[]>;
572
+ /**
573
+ * Search activities with pagination and filters
574
+ * @param page Page number
575
+ * @param pageSize Number of items per page
576
+ * @param filters Filter criteria
577
+ * @param searchKeyword Search keyword
578
+ * @param sort Sort criteria
579
+ * @returns Promise resolving to search response
580
+ */
581
+ search(page: number, pageSize: number, filters: any, searchKeyword: string, sort: any): Promise<ActivitySearchResponse>;
582
+ /**
583
+ * Create a new activity
584
+ * @param activity New activity data
585
+ * @returns Promise resolving to created activity
586
+ */
587
+ create(activity: ActivityCreate): Promise<Activity>;
588
+ /**
589
+ * Update an existing activity
590
+ * @param activity Updated activity data
591
+ * @returns Promise resolving to updated activity
592
+ */
593
+ update(activity: ActivityUpdate): Promise<Activity>;
594
+ /**
595
+ * Save multiple activities
596
+ * @param activities Array of activities to save
597
+ * @returns Promise resolving to array of saved activities
598
+ */
599
+ saveMany(activities: ActivityUpdate[]): Promise<Activity[]>;
600
+ /**
601
+ * Import activities from parsed data
602
+ * @param activities Array of activities to import
603
+ * @returns Promise resolving to imported activities
604
+ */
605
+ import(activities: ActivityImport[]): Promise<ActivityImport[]>;
606
+ /**
607
+ * Check activities before import
608
+ * @param accountId Account identifier
609
+ * @param activities Array of activities to check
610
+ * @returns Promise resolving to validated activities
611
+ */
612
+ checkImport(accountId: string, activities: ActivityImport[]): Promise<ActivityImport[]>;
613
+ /**
614
+ * Get import mapping configuration for an account
615
+ * @param accountId Account identifier
616
+ * @returns Promise resolving to import mapping data
617
+ */
618
+ getImportMapping(accountId: string): Promise<ImportMappingData>;
619
+ /**
620
+ * Save import mapping configuration
621
+ * @param mapping Import mapping data to save
622
+ * @returns Promise resolving to saved mapping data
623
+ */
624
+ saveImportMapping(mapping: ImportMappingData): Promise<ImportMappingData>;
625
+ }
626
+ /**
627
+ * Market data and asset APIs
628
+ */
629
+ interface MarketDataAPI {
630
+ /**
631
+ * Search for ticker symbols
632
+ * @param query Search query
633
+ * @returns Promise resolving to array of quote summaries
634
+ */
635
+ searchTicker(query: string): Promise<QuoteSummary[]>;
636
+ /**
637
+ * Synchronize historical quotes
638
+ * @returns Promise that resolves when sync is complete
639
+ */
640
+ syncHistory(): Promise<void>;
641
+ /**
642
+ * Synchronize market data for specific symbols
643
+ * @param symbols Array of symbols to sync
644
+ * @param refetchAll Whether to refetch all data
645
+ * @returns Promise that resolves when sync is complete
646
+ */
647
+ sync(symbols: string[], refetchAll: boolean): Promise<void>;
648
+ /**
649
+ * Get market data providers information
650
+ * @returns Promise resolving to array of provider info
651
+ */
652
+ getProviders(): Promise<MarketDataProviderInfo[]>;
653
+ }
654
+ /**
655
+ * Asset management APIs
656
+ */
657
+ interface AssetsAPI {
658
+ /**
659
+ * Get asset profile information
660
+ * @param assetId Asset identifier
661
+ * @returns Promise resolving to asset profile
662
+ */
663
+ getProfile(assetId: string): Promise<Asset>;
664
+ /**
665
+ * Update asset profile information
666
+ * @param payload Updated asset profile data
667
+ * @returns Promise resolving to updated asset
668
+ */
669
+ updateProfile(payload: UpdateAssetProfile): Promise<Asset>;
670
+ /**
671
+ * Update asset data source
672
+ * @param symbol Asset symbol
673
+ * @param dataSource New data source
674
+ * @returns Promise resolving to updated asset
675
+ */
676
+ updateDataSource(symbol: string, dataSource: string): Promise<Asset>;
677
+ }
678
+ /**
679
+ * Quote management APIs
680
+ */
681
+ interface QuotesAPI {
682
+ /**
683
+ * Update quote information
684
+ * @param symbol Asset symbol
685
+ * @param quote Updated quote data
686
+ * @returns Promise that resolves when update is complete
687
+ */
688
+ update(symbol: string, quote: Quote): Promise<void>;
689
+ /**
690
+ * Get quote history for a symbol
691
+ * @param symbol Asset symbol
692
+ * @returns Promise resolving to array of quotes
693
+ */
694
+ getHistory(symbol: string): Promise<Quote[]>;
695
+ }
696
+ /**
697
+ * Performance calculation APIs
698
+ */
699
+ interface PerformanceAPI {
700
+ /**
701
+ * Calculate performance history
702
+ * @param itemType Type of item ('account' or 'symbol')
703
+ * @param itemId Item identifier
704
+ * @param startDate Start date for calculation
705
+ * @param endDate End date for calculation
706
+ * @returns Promise resolving to performance metrics
707
+ */
708
+ calculateHistory(itemType: 'account' | 'symbol', itemId: string, startDate: string, endDate: string): Promise<PerformanceMetrics>;
709
+ /**
710
+ * Calculate performance summary
711
+ * @param args Performance calculation arguments
712
+ * @returns Promise resolving to performance metrics
713
+ */
714
+ calculateSummary(args: {
715
+ itemType: 'account' | 'symbol';
716
+ itemId: string;
717
+ startDate?: string | null;
718
+ endDate?: string | null;
719
+ }): Promise<PerformanceMetrics>;
720
+ /**
721
+ * Calculate simple performance for multiple accounts
722
+ * @param accountIds Array of account identifiers
723
+ * @returns Promise resolving to array of simple performance metrics
724
+ */
725
+ calculateAccountsSimple(accountIds: string[]): Promise<SimplePerformanceMetrics[]>;
726
+ }
727
+ /**
728
+ * Exchange rates APIs
729
+ */
730
+ interface ExchangeRatesAPI {
731
+ /**
732
+ * Get all exchange rates
733
+ * @returns Promise resolving to array of exchange rates
734
+ */
735
+ getAll(): Promise<ExchangeRate[]>;
736
+ /**
737
+ * Update an existing exchange rate
738
+ * @param updatedRate Updated exchange rate data
739
+ * @returns Promise resolving to updated exchange rate
740
+ */
741
+ update(updatedRate: ExchangeRate): Promise<ExchangeRate>;
742
+ /**
743
+ * Add a new exchange rate
744
+ * @param newRate New exchange rate data (without ID)
745
+ * @returns Promise resolving to created exchange rate
746
+ */
747
+ add(newRate: Omit<ExchangeRate, 'id'>): Promise<ExchangeRate>;
748
+ }
749
+ /**
750
+ * Contribution limits APIs
751
+ */
752
+ interface ContributionLimitsAPI {
753
+ /**
754
+ * Get all contribution limits
755
+ * @returns Promise resolving to array of contribution limits
756
+ */
757
+ getAll(): Promise<ContributionLimit[]>;
758
+ /**
759
+ * Create a new contribution limit
760
+ * @param newLimit New contribution limit data
761
+ * @returns Promise resolving to created contribution limit
762
+ */
763
+ create(newLimit: NewContributionLimit): Promise<ContributionLimit>;
764
+ /**
765
+ * Update an existing contribution limit
766
+ * @param id Contribution limit identifier
767
+ * @param updatedLimit Updated contribution limit data
768
+ * @returns Promise resolving to updated contribution limit
769
+ */
770
+ update(id: string, updatedLimit: NewContributionLimit): Promise<ContributionLimit>;
771
+ /**
772
+ * Calculate deposits for a specific contribution limit
773
+ * @param limitId Contribution limit identifier
774
+ * @returns Promise resolving to deposits calculation
775
+ */
776
+ calculateDeposits(limitId: string): Promise<DepositsCalculation>;
777
+ }
778
+ /**
779
+ * Goals management APIs
780
+ */
781
+ interface GoalsAPI {
782
+ /**
783
+ * Get all goals
784
+ * @returns Promise resolving to array of goals
785
+ */
786
+ getAll(): Promise<Goal[]>;
787
+ /**
788
+ * Create a new goal
789
+ * @param goal New goal data
790
+ * @returns Promise resolving to created goal
791
+ */
792
+ create(goal: any): Promise<Goal>;
793
+ /**
794
+ * Update an existing goal
795
+ * @param goal Updated goal data
796
+ * @returns Promise resolving to updated goal
797
+ */
798
+ update(goal: Goal): Promise<Goal>;
799
+ /**
800
+ * Update goal allocations
801
+ * @param allocations Array of goal allocations
802
+ * @returns Promise that resolves when update is complete
803
+ */
804
+ updateAllocations(allocations: GoalAllocation[]): Promise<void>;
805
+ /**
806
+ * Get goal allocations
807
+ * @returns Promise resolving to array of goal allocations
808
+ */
809
+ getAllocations(): Promise<GoalAllocation[]>;
810
+ }
811
+ /**
812
+ * Application settings APIs
813
+ */
814
+ interface SettingsAPI {
815
+ /**
816
+ * Get application settings
817
+ * @returns Promise resolving to settings
818
+ */
819
+ get(): Promise<Settings>;
820
+ /**
821
+ * Update application settings
822
+ * @param settingsUpdate Updated settings data
823
+ * @returns Promise resolving to updated settings
824
+ */
825
+ update(settingsUpdate: Settings): Promise<Settings>;
826
+ /**
827
+ * Create database backup
828
+ * @returns Promise resolving to backup file information
829
+ */
830
+ backupDatabase(): Promise<{
831
+ filename: string;
832
+ data: Uint8Array;
833
+ }>;
834
+ }
835
+ /**
836
+ * File operations APIs
837
+ */
838
+ interface FilesAPI {
839
+ /**
840
+ * Open CSV file dialog
841
+ * @returns Promise resolving to file path(s) or null if cancelled
842
+ */
843
+ openCsvDialog(): Promise<null | string | string[]>;
844
+ /**
845
+ * Open file save dialog
846
+ * @param fileContent File content to save
847
+ * @param fileName Default file name
848
+ * @returns Promise resolving to save result
849
+ */
850
+ openSaveDialog(fileContent: Uint8Array | Blob | string, fileName: string): Promise<any>;
851
+ }
852
+ /**
853
+ * Secrets management APIs
854
+ * Provides secure storage for addon secrets using the system keyring
855
+ * Each addon can only access its own secrets
856
+ */
857
+ interface SecretsAPI {
858
+ /**
859
+ * Store a secret value for this addon
860
+ * @param key Secret key identifier
861
+ * @param value Secret value to store
862
+ * @returns Promise that resolves when secret is stored
863
+ */
864
+ set(key: string, value: string): Promise<void>;
865
+ /**
866
+ * Retrieve a secret value for this addon
867
+ * @param key Secret key identifier
868
+ * @returns Promise resolving to secret value or null if not found
869
+ */
870
+ get(key: string): Promise<string | null>;
871
+ /**
872
+ * Delete a secret for this addon
873
+ * @param key Secret key identifier
874
+ * @returns Promise that resolves when secret is deleted
875
+ */
876
+ delete(key: string): Promise<void>;
877
+ }
878
+ /**
879
+ * Logger APIs
880
+ * Provides logging functionality with automatic addon prefix
881
+ * All log messages will be prefixed with the addon ID for easy identification
882
+ */
883
+ interface LoggerAPI {
884
+ /**
885
+ * Log an error message
886
+ * @param message Error message to log
887
+ */
888
+ error(message: string): void;
889
+ /**
890
+ * Log an info message
891
+ * @param message Info message to log
892
+ */
893
+ info(message: string): void;
894
+ /**
895
+ * Log a warning message
896
+ * @param message Warning message to log
897
+ */
898
+ warn(message: string): void;
899
+ /**
900
+ * Log a trace message (for detailed debugging)
901
+ * @param message Trace message to log
902
+ */
903
+ trace(message: string): void;
904
+ /**
905
+ * Log a debug message
906
+ * @param message Debug message to log
907
+ */
908
+ debug(message: string): void;
909
+ }
910
+ /**
911
+ * Event listeners APIs
912
+ */
913
+ interface EventsAPI {
914
+ /**
915
+ * Import file events
916
+ */
917
+ import: {
918
+ /**
919
+ * Listen for import file drop hover events
920
+ * @param handler Event handler
921
+ * @returns Promise resolving to unlisten function
922
+ */
923
+ onDropHover<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
924
+ /**
925
+ * Listen for import file drop events
926
+ * @param handler Event handler
927
+ * @returns Promise resolving to unlisten function
928
+ */
929
+ onDrop<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
930
+ /**
931
+ * Listen for import file drop cancelled events
932
+ * @param handler Event handler
933
+ * @returns Promise resolving to unlisten function
934
+ */
935
+ onDropCancelled<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
936
+ };
937
+ /**
938
+ * Portfolio events
939
+ */
940
+ portfolio: {
941
+ /**
942
+ * Listen for portfolio update start events
943
+ * @param handler Event handler
944
+ * @returns Promise resolving to unlisten function
945
+ */
946
+ onUpdateStart<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
947
+ /**
948
+ * Listen for portfolio update complete events
949
+ * @param handler Event handler
950
+ * @returns Promise resolving to unlisten function
951
+ */
952
+ onUpdateComplete<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
953
+ /**
954
+ * Listen for portfolio update error events
955
+ * @param handler Event handler
956
+ * @returns Promise resolving to unlisten function
957
+ */
958
+ onUpdateError<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
959
+ };
960
+ /**
961
+ * Market sync events
962
+ */
963
+ market: {
964
+ /**
965
+ * Listen for market sync start events
966
+ * @param handler Event handler
967
+ * @returns Promise resolving to unlisten function
968
+ */
969
+ onSyncStart<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
970
+ /**
971
+ * Listen for market sync complete events
972
+ * @param handler Event handler
973
+ * @returns Promise resolving to unlisten function
974
+ */
975
+ onSyncComplete<T>(handler: EventCallback<T>): Promise<UnlistenFn>;
976
+ };
977
+ }
978
+ /**
979
+ * Navigation APIs
980
+ */
981
+ interface NavigationAPI {
982
+ /**
983
+ * Navigate to a route in the application
984
+ * @param route The route path to navigate to
985
+ * @returns Promise that resolves when navigation is complete
986
+ */
987
+ navigate(route: string): Promise<void>;
988
+ }
989
+ /**
990
+ * Query management APIs for React Query integration
991
+ */
992
+ interface QueryAPI {
993
+ /**
994
+ * Get the shared QueryClient instance from the main application
995
+ * @returns The shared QueryClient instance
996
+ */
997
+ getClient(): any;
998
+ /**
999
+ * Invalidate queries by key
1000
+ * @param queryKey The query key to invalidate
1001
+ */
1002
+ invalidateQueries(queryKey: string | string[]): void;
1003
+ /**
1004
+ * Refetch queries by key
1005
+ * @param queryKey The query key to refetch
1006
+ */
1007
+ refetchQueries(queryKey: string | string[]): void;
1008
+ }
1009
+ /**
1010
+ * Comprehensive Host API interface providing access to all Wealthfolio functionality
1011
+ * Organized by functional domains for better discoverability and maintainability
1012
+ */
1013
+ interface HostAPI {
1014
+ /** Account management operations */
1015
+ accounts: AccountsAPI;
1016
+ /** Portfolio and holdings operations */
1017
+ portfolio: PortfolioAPI;
1018
+ /** Activity management operations */
1019
+ activities: ActivitiesAPI;
1020
+ /** Market data operations */
1021
+ market: MarketDataAPI;
1022
+ /** Asset management operations */
1023
+ assets: AssetsAPI;
1024
+ /** Quote management operations */
1025
+ quotes: QuotesAPI;
1026
+ /** Performance calculation operations */
1027
+ performance: PerformanceAPI;
1028
+ /** Exchange rates operations */
1029
+ exchangeRates: ExchangeRatesAPI;
1030
+ /** Contribution limits operations */
1031
+ contributionLimits: ContributionLimitsAPI;
1032
+ /** Goals management operations */
1033
+ goals: GoalsAPI;
1034
+ /** Application settings operations */
1035
+ settings: SettingsAPI;
1036
+ /** File operations */
1037
+ files: FilesAPI;
1038
+ /** Secrets management */
1039
+ secrets: SecretsAPI;
1040
+ /** Logger operations */
1041
+ logger: LoggerAPI;
1042
+ /** Event listeners */
1043
+ events: EventsAPI;
1044
+ /** Navigation operations */
1045
+ navigation: NavigationAPI;
1046
+ /** React Query operations */
1047
+ query: QueryAPI;
1048
+ }
1049
+
1050
+ /**
1051
+ * Core types for addon development
1052
+ */
1053
+ /**
1054
+ * Handle returned from sidebar item creation
1055
+ */
1056
+ interface SidebarItemHandle {
1057
+ /** Remove the sidebar item */
1058
+ remove(): void;
1059
+ }
1060
+ /**
1061
+ * Configuration for adding a sidebar item
1062
+ */
1063
+ interface SidebarItemConfig {
1064
+ /** Unique identifier for the sidebar item */
1065
+ id: string;
1066
+ /** Display text for the sidebar item */
1067
+ label: string;
1068
+ /** Optional icon name or React component */
1069
+ icon?: string | React__default.ReactNode;
1070
+ /** Optional route to navigate to when clicked */
1071
+ route?: string;
1072
+ /** Optional ordering priority (lower numbers appear first) */
1073
+ order?: number;
1074
+ /** Optional click handler (if no route provided) */
1075
+ onClick?: () => void;
1076
+ }
1077
+ /**
1078
+ * Configuration for adding a route
1079
+ */
1080
+ interface RouteConfig {
1081
+ /** Route path pattern */
1082
+ path: string;
1083
+ /** Lazy-loaded React component */
1084
+ component: React__default.LazyExoticComponent<React__default.ComponentType<any>>;
1085
+ }
1086
+ /**
1087
+ * Sidebar management interface
1088
+ */
1089
+ interface SidebarManager {
1090
+ /**
1091
+ * Add an item to the application sidebar
1092
+ * @param config Configuration for the sidebar item
1093
+ * @returns Handle to remove the item
1094
+ */
1095
+ addItem(config: SidebarItemConfig): SidebarItemHandle;
1096
+ }
1097
+ /**
1098
+ * Router management interface
1099
+ */
1100
+ interface RouterManager {
1101
+ /**
1102
+ * Register a new route in the application
1103
+ * @param route Route configuration
1104
+ */
1105
+ add(route: RouteConfig): void;
1106
+ }
1107
+ /**
1108
+ * Event callback type for Tauri events
1109
+ */
1110
+ type EventCallback<T> = (event: {
1111
+ payload: T;
1112
+ }) => void;
1113
+ /**
1114
+ * Unlisten function type for event listeners
1115
+ */
1116
+ type UnlistenFn = () => void;
1117
+ /**
1118
+ * Main addon context interface providing access to Wealthfolio APIs
1119
+ */
1120
+ interface AddonContext {
1121
+ /** Sidebar management */
1122
+ sidebar: SidebarManager;
1123
+ /** Router management */
1124
+ router: RouterManager;
1125
+ /** Register a callback for addon cleanup */
1126
+ onDisable(callback: () => void): void;
1127
+ /** Access to host application APIs */
1128
+ api: HostAPI;
1129
+ }
1130
+ /**
1131
+ * Addon enable function signature
1132
+ */
1133
+ type AddonEnableFunction = (context: AddonContext) => void | {
1134
+ disable?: () => void;
1135
+ };
1136
+
1137
+ export { type ExchangeRate as $, type AddonContext as A, type Settings as B, type Country as C, DataSource as D, type EventCallback as E, type SettingsContextType as F, type Goal as G, type HostAPI as H, type ImportRequiredField as I, type GoalAllocation as J, type GoalProgress as K, type Lot as L, type MarketDataProviderInfo as M, type IncomeSummary as N, type DateRange as O, type Position as P, type QuoteSummary as Q, type RouteConfig as R, type SidebarItemHandle as S, type Tag as T, type UnlistenFn as U, type ValidationResult as V, type TimePeriod as W, type AccountValuation as X, type AccountSummaryView as Y, type SimplePerformanceMetrics as Z, type AccountGroup as _, type AddonEnableFunction as a, type ContributionLimit as a0, type NewContributionLimit as a1, type AccountDeposit as a2, type DepositsCalculation as a3, ACTIVITY_TYPE_PREFIX_LENGTH as a4, type ReturnData as a5, type PerformanceMetrics as a6, type UpdateAssetProfile as a7, type TrackedItem as a8, type SidebarItemConfig as b, type SidebarManager as c, type RouterManager as d, ActivityType as e, AccountType as f, HoldingType as g, type Account as h, type Activity as i, type ActivityDetails as j, type ActivitySearchResponse as k, type ActivityCreate as l, type ActivityUpdate as m, type ActivityImport as n, type ImportMappingData as o, type AssetProfile as p, type MarketData as q, type ImportValidationResult as r, type Sector as s, type Instrument as t, type MonetaryValue as u, type CashHolding as v, type Holding as w, type Asset as x, type Quote as y, type QuoteUpdate as z };