Description
When an invoice's split configuration is updated (e.g. a recipient is added, shares are rebalanced), the SDK replaces the entire SplitConfig without showing what changed. Invoice issuers and auditors need to see a typed diff between two split configurations — which recipients were added, removed, or had their ratio changed — before confirming the update. A change diff generator should produce this comparison on demand.
Technical Context
Extend src/splitPreview.ts. Accepts two SplitConfig objects (original and revised). Produces SplitConfigDiff added to src/types.ts with fields: added: RecipientShare[], removed: RecipientShare[], changed: { accountId, oldRatio, newRatio }[], totalRatioDelta. Integrates with src/diff.ts for the generic structural diff utilities. Exposes a generateSplitDiff(original, revised): SplitConfigDiff function exported from src/index.ts.
Acceptance Criteria
Description
When an invoice's split configuration is updated (e.g. a recipient is added, shares are rebalanced), the SDK replaces the entire
SplitConfigwithout showing what changed. Invoice issuers and auditors need to see a typed diff between two split configurations — which recipients were added, removed, or had their ratio changed — before confirming the update. A change diff generator should produce this comparison on demand.Technical Context
Extend
src/splitPreview.ts. Accepts twoSplitConfigobjects (original and revised). ProducesSplitConfigDiffadded tosrc/types.tswith fields:added: RecipientShare[],removed: RecipientShare[],changed: { accountId, oldRatio, newRatio }[],totalRatioDelta. Integrates withsrc/diff.tsfor the generic structural diff utilities. Exposes agenerateSplitDiff(original, revised): SplitConfigDifffunction exported fromsrc/index.ts.Acceptance Criteria
generateSplitDiff(original, revised)correctly identifies recipients added inrevisedbut absent inoriginaloriginalbut absent inrevisedas removedoldRatioandnewRatioin the resulttotalRatioDeltais the signed difference in sum of ratios between the two configs (should be 0 for valid rebalances)