@sensiblestats/widget-react 0.32.0 → 0.32.1
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.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -412,11 +412,15 @@ function toChipVM(intent) {
|
|
|
412
412
|
function chipFromText(text) {
|
|
413
413
|
return { text };
|
|
414
414
|
}
|
|
415
|
+
function joinSelection(label, line) {
|
|
416
|
+
if (label && line && label.includes(line)) return label;
|
|
417
|
+
return [label, line].filter(Boolean).join(" ") || void 0;
|
|
418
|
+
}
|
|
415
419
|
function toInsightVM(insight) {
|
|
416
420
|
const market = str(insight.marketLabel) ?? str(insight.marketDeveloperName) ?? "";
|
|
417
421
|
const selectionLabel = str(insight.selectionLabel);
|
|
418
422
|
const selectionLine = str(insight.line);
|
|
419
|
-
const selection = (selectionLabel
|
|
423
|
+
const selection = joinSelection(selectionLabel, selectionLine);
|
|
420
424
|
const value = insight.odds?.value;
|
|
421
425
|
const odds = typeof value === "number" && Number.isFinite(value) ? value.toFixed(2) : void 0;
|
|
422
426
|
const oddsValue = insight.odds?.value;
|
|
@@ -479,7 +483,7 @@ function toSlipSelection(vm, conversationId) {
|
|
|
479
483
|
function toMarketOddsVM(card) {
|
|
480
484
|
const rows = Array.isArray(card.rows) ? card.rows : [];
|
|
481
485
|
const toRow = (r, i) => {
|
|
482
|
-
const selection =
|
|
486
|
+
const selection = joinSelection(str(r.selectionLabel), str(r.line)) ?? "";
|
|
483
487
|
const price = typeof r.price === "number" && Number.isFinite(r.price) ? r.price : void 0;
|
|
484
488
|
const previous = typeof r.previousPrice === "number" && Number.isFinite(r.previousPrice) ? r.previousPrice : void 0;
|
|
485
489
|
const direction = r.movementDirection === "shortened" || r.movementDirection === "drifted" ? r.movementDirection : void 0;
|
|
@@ -538,7 +542,7 @@ function toOddsMovementVM(card) {
|
|
|
538
542
|
const current = asNumber(card.currentPrice);
|
|
539
543
|
const home = str(card.homeTeamName);
|
|
540
544
|
const away = str(card.awayTeamName);
|
|
541
|
-
const selection =
|
|
545
|
+
const selection = joinSelection(str(card.selectionLabel), str(card.line)) ?? "";
|
|
542
546
|
const bookmakerId = typeof card.bookmakerId === "number" ? card.bookmakerId : "";
|
|
543
547
|
return {
|
|
544
548
|
id: `${typeof card.matchId === "number" ? card.matchId : 0}:${str(card.marketDeveloperName) ?? ""}:${selection}:${bookmakerId}`,
|