Conflict Adapter (Mr. Doge SDK)
mrdoge-ui/mrdoge-conflict-adapterFreeUtility
Flags mutually incompatible picks (Match Result vs Double Chance, Over/Under threshold overlap, BTTS vs low Totals) for disabledIds or conflictingPickIds.
Install it
npx shadcn@latest add https://mrdoge.co/r/mrdoge-conflict-adapter.jsonSource
1import type { Market } from "@mrdoge/protocol"2import type { BetSlipPick } from "@/registry/mrdoge-ui/bet-slip/bet-slip"34export interface ConflictCandidate {5 id: string6 matchId: string7 /** Market sysname, e.g. "SOCCER_UNDER_OVER". */8 betType: string9 /** Outcome code, e.g. "O", "1X". */10 code: string11 /** Parsed Over/Under threshold; only set when `code` is "O"/"U". */12 threshold?: number13}1415const MATCH_RESULT_TYPES = ["SOCCER_MATCH_RESULT", "SOCCER_MATCH_RESULT_PRELIVE"]16const DOUBLE_CHANCE = "SOCCER_DOUBLE_CHANCE"17const TOTALS = ["SOCCER_UNDER_OVER", "SOCCER_UNDER_OVER_PRELIVE"]18const BTTS = ["SOCCER_BOTH_TEAMS_TO_SCORE", "SOCCER_BOTH_TEAMS_TO_SCORE_PRELIVE"]19const BTTS_YES_CODES = ["Y", "GG"]2021// Over/Under outcomes only carry a generic "O"/"U" code, no threshold in22// it. The threshold lives in the caption instead ("Over 1.5", "Under23// 1.5"), so that's what has to be parsed to compare thresholds.24function parseThreshold(caption: string | null | undefined): number | undefined {25 const match = caption?.match(/[\d.]+/)26 const value = match ? parseFloat(match[0]) : NaN27 return Number.isNaN(value) ? undefined : value28}2930/**31 * Flattens every line of every market for one match into conflict32 * candidates, parsing an Over/Under threshold from the caption where33 * applicable.34 */35export function toConflictCandidates(matchId: string, markets: Market[]): ConflictCandidate[] {36 const candidates: ConflictCandidate[] = []37 for (const market of markets) {38 for (const line of market.lines) {39 const isTotals = line.code.startsWith("O") || line.code.startsWith("U")40 candidates.push({41 id: line.id,42 matchId,43 betType: market.betType,44 code: line.code,45 threshold: isTotals ? parseThreshold(line.caption) : undefined,46 })47 }48 }49 return candidates50}5152// Pairwise incompatibility check: the three rule families this adapter53// knows about. Symmetric: conflicts(a, b) === conflicts(b, a).54function conflicts(a: ConflictCandidate, b: ConflictCandidate): boolean {55 if (a.matchId !== b.matchId) return false5657 // Double Chance is just two of Match Result's three outcomes combined:58 // the two markets describe overlapping information about the same59 // result, not independent events. Even a "compatible" pair (Home win +60 // "Home or Away") is a wasted leg, not a real parlay combination, so61 // any Match Result selection blocks the entire Double Chance market and62// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from mrdoge-ui
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Bet Slip Adapter (Mr. Doge SDK)mrdoge-bet-slip-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Mr. Doge Clientmrdoge-client | mrdoge-ui | Utilities | Free | 1 dep | |
| Match Card Adapter (Mr. Doge SDK)mrdoge-match-card-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Match Highlight Adapter (Mr. Doge SDK)mrdoge-match-highlight-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Match Timeline Adapter (Mr. Doge SDK)mrdoge-match-timeline-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Odds Selector Adapter (Mr. Doge SDK)mrdoge-odds-selector-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Stats List Adapter (Mr. Doge SDK)mrdoge-stats-list-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Rate Limitrate-limit | mrdoge-ui | Utilities | Free | no deps |
