1"use strict"; 2(self["webpackChunk_mlssoccer_netcore"] = self["webpackChunk_mlssoccer_netcore"] || []).push([["react/mls-priority-match-app"],{ 3
4/***/ "./scripts/react/mls-featured-match-v2/components/FeaturedMatchWrapper/utils.js": 5/*!**************************************************************************************!*\ 6 !*** ./scripts/react/mls-featured-match-v2/components/FeaturedMatchWrapper/utils.js ***! 7 \**************************************************************************************/ 8/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9 10__webpack_require__.r(__webpack_exports__); 11/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12/* harmony export */ "getNearestFeaturedMatch": () => (/* binding */ getNearestFeaturedMatch), 13/* harmony export */ "groupMatchesByDate": () => (/* binding */ groupMatchesByDate) 14/* harmony export */ }); 15/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ "./.yarn/cache/dayjs-npm-1.11.5-a825142dc5-cee1c2ed5f.zip/node_modules/dayjs/dayjs.min.js"); 16/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__); 17/* harmony import */ var _mls_horizontal_scoreboard_HorizontalScoreboard_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../mls-horizontal-scoreboard/HorizontalScoreboard/utils */ "./scripts/react/mls-horizontal-scoreboard/HorizontalScoreboard/utils.js"); 18/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 19 20 21 22function getNearestFeaturedMatch(groupedMatches) { 23 const todaysMatch = (0,_mls_horizontal_scoreboard_HorizontalScoreboard_utils__WEBPACK_IMPORTED_MODULE_1__.getTodaysNearestMatch)(groupedMatches); 24 if (todaysMatch) { 25 return todaysMatch; 26 } 27 const nearestDate = (0,_mls_horizontal_scoreboard_HorizontalScoreboard_utils__WEBPACK_IMPORTED_MODULE_1__.getNearestDate)({ dates: groupedMatches }); 28 const nearestGroupedMatches = (0,_mls_horizontal_scoreboard_HorizontalScoreboard_utils__WEBPACK_IMPORTED_MODULE_1__.getMatchesByDate)(groupedMatches, nearestDate); 29 const nearestMatch = (0,_mls_horizontal_scoreboard_HorizontalScoreboard_utils__WEBPACK_IMPORTED_MODULE_1__.getNearestMatch)( 30 nearestGroupedMatches.matches, 31 nearestDate 32 ); 33 return nearestMatch; 34} 35function groupMatchesByDate(matches, excludedLiveMatches = false) { 36 if (!matches?.length) 37 return null; 38 const matchesByDate = {}; 39 matches.filter( 40 (match) => excludedLiveMatches ? match?.status?.abbreviation !== _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_2__.statusTypes.live : match 41 ).forEach((match) => { 42 const date = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(match.matchDate).format("MM/DD/YYYY"); 43 matchesByDate[date] = matchesByDate[date] ? [...matchesByDate[date], match] : [match]; 44 }); 45 return Object.keys(matchesByDate).map((key) => ({ 46 date: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(key).toDate(), 47 matches: matchesByDate[key] 48 })); 49} 50 51 52/***/ }), 53
54/***/ "./scripts/react/mls-horizontal-scoreboard/HorizontalScoreboard/utils.js": 55/*!*******************************************************************************!*\ 56 !*** ./scripts/react/mls-horizontal-scoreboard/HorizontalScoreboard/utils.js ***! 57 \*******************************************************************************/ 58/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 59 60__webpack_require__.r(__webpack_exports__); 61/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62/* harmony export */ "getMatchesByDate": () => (/* binding */ getMatchesByDate), 63/* harmony export */ "getNearestDate": () => (/* binding */ getNearestDate), 64/* harmony export */ "getNearestMatch": () => (/* binding */ getNearestMatch), 65/* harmony export */ "getTodaysNearestMatch": () => (/* binding */ getTodaysNearestMatch) 66/* harmony export */ }); 67/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ "./.yarn/cache/dayjs-npm-1.11.5-a825142dc5-cee1c2ed5f.zip/node_modules/dayjs/dayjs.min.js"); 68/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__); 69/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 70/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isFuture/index.js"); 71 72 73 74const liveStatuses = [ 75 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.live, 76 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.firstHalf, 77 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.half, 78 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.secondHalf, 79 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.firstHalfExtra, 80 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.halfExtra, 81 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.secondHalfExtra, 82 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.penalty, 83 _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.prePenalty 84]; 85function getNearestDate({ baseDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(), dates }) { 86 const nearest = dates?.reduce( 87 (acc, current) => { 88 const currentDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(current.date); 89 const currentDiff = getDateDifference(baseDate, currentDate); 90 if (acc.diff > currentDiff) { 91 return { date: current.date, diff: currentDiff }; 92 } 93 return acc; 94 }, 95 { date: null, diff: Number.MAX_SAFE_INTEGER } 96 ); 97 return nearest?.date; 98} 99function getDateDifference(firstDate, secondDate) { 100 return Math.abs(firstDate.diff(secondDate)); 101} 102function isSameDay(firstDate, secondDate) { 103 return dayjs__WEBPACK_IMPORTED_MODULE_0___default()(firstDate).isSame(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(secondDate), "day"); 104} 105function getActiveMatch(matches) { 106 const activeMatch = matches.find( 107 (match) => liveStatuses.includes(match?.status?.abbreviation) 108 ); 109 if (activeMatch) { 110 return activeMatch; 111 } 112 const nextMatch = matches.find((match) => { 113 return (0,date_fns__WEBPACK_IMPORTED_MODULE_2__["default"])(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(match?.planned_kickoff_time).toDate()); 114 }); 115 return nextMatch || matches[0]; 116} 117function getMatchesByDate(matches, date) { 118 return matches.find((matches2) => { 119 return isSameDay(matches2.date, date); 120 }); 121} 122function getNearestMatch(matches, date) { 123 const isNearestBeforeToday = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(date).isBefore(dayjs__WEBPACK_IMPORTED_MODULE_0___default()()); 124 if (isNearestBeforeToday) { 125 return matches[matches.length - 1]; 126 } else { 127 return matches[0]; 128 } 129} 130function getTodaysNearestMatch(matches) { 131 let activeMatch = null; 132 matches?.forEach((matches2) => { 133 const today = isSameDay(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(), matches2?.date); 134 if (today && matches2.matches?.length) { 135 activeMatch = getActiveMatch(matches2.matches); 136 } 137 }); 138 return activeMatch; 139} 140 141 142/***/ }), 143
144/***/ "./scripts/react/mls-match-feed/utils.js": 145/*!***********************************************!*\ 146 !*** ./scripts/react/mls-match-feed/utils.js ***! 147 \***********************************************/ 148/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 149 150__webpack_require__.r(__webpack_exports__); 151/* harmony export */ __webpack_require__.d(__webpack_exports__, { 152/* harmony export */ "composeVideoList": () => (/* binding */ composeVideoList), 153/* harmony export */ "feedTypes": () => (/* binding */ feedTypes), 154/* harmony export */ "getFeedType": () => (/* binding */ getFeedType), 155/* harmony export */ "mergeFeedWithVideosAndPlayers": () => (/* binding */ mergeFeedWithVideosAndPlayers), 156/* harmony export */ "mergePages": () => (/* binding */ mergePages), 157/* harmony export */ "mergePlayers": () => (/* binding */ mergePlayers), 158/* harmony export */ "removeDuplicates": () => (/* binding */ removeDuplicates) 159/* harmony export */ }); 160/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 161/* harmony import */ var _mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mls-match-summary/utils */ "./scripts/react/mls-match-summary/utils.js"); 162/* harmony import */ var _shared_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../shared/utils */ "./scripts/react/shared/utils.js"); 163 164 165 166const feedTypes = { 167 goal: "goal" 168}; 169function getFeedType(type) { 170 switch (type) { 171 case feedTypes.goal: 172 default: { 173 return null; 174 } 175 } 176} 177function mergeFeedWithVideosAndPlayers({ feed, homeClub, mlsMatch, awayClub, videoList, players }) { 178 if (!feed || feed.length === 0) { 179 return null; 180 } 181 const { match_information } = mlsMatch; 182 const { home_team_goals = 0, away_team_goals = 0, home_team_penalty_goals = 0, away_team_penalty_goals = 0 } = match_information; 183 let homeScore = home_team_goals + home_team_penalty_goals; 184 let awayScore = away_team_goals + away_team_penalty_goals; 185 const composedFeed = []; 186 for (let i = 0; i < feed.length; i++) { 187 const current = feed[i] || {}; 188 const { player_id, team_id, second_player_id } = current; 189 const isHome = team_id === homeClub?.team_id; 190 const isAway = team_id === awayClub?.team_id; 191 const isLastTimingCommentary = current?.type === _mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_1__.matchEventTypes.startOfPeriod && current?.period === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_0__.periodTypes.FirstHalf; 192 const matchedVideo = videoList != null && videoList.length > 0 ? videoList.find((video) => { 193 const { fields } = video || {}; 194 const { sportecEventId } = fields || {};
195 return sportecEventId === current?.event_id; 196 }) : null; 197 const matchedPlayer = Array.isArray(players) ? players?.find((player) => player?.person_id === player_id) || null : null; 198 const secondMatchedPlayer = second_player_id ? Array.isArray(players) ? players?.find((player) => player?.person_id === second_player_id) || null : null : null; 199 const { thumbnail, headshotNationalTeam, headshotClub } = matchedPlayer || {}; 200 let adjustedHomeScore = homeScore; 201 let adjustedAwayScore = awayScore; 202 if (team_id) { 203 if (current.type === _mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_1__.matchEventTypes.goal) { 204 if (isHome) { 205 adjustedHomeScore = adjustedHomeScore - 1; 206 } else if (isAway) { 207 adjustedAwayScore = adjustedAwayScore - 1; 208 } 209 } 210 if (current.sub_type === _mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_1__.matchEventSubtypes.ownGoal) { 211 if (team_id == homeClub?.sportecId) { 212 adjustedAwayScore = adjustedAwayScore - 1; 213 } else if (team_id == awayClub?.sportecId) { 214 adjustedHomeScore = adjustedHomeScore - 1; 215 } 216 } 217 } 218 composedFeed.push({ 219 ...current, 220 first_player: composePlayer(matchedPlayer), 221 second_player: composePlayer(secondMatchedPlayer), 222 headshotNationalTeam: headshotNationalTeam != null ? headshotNationalTeam : null, 223 headshotClub: headshotClub != null ? headshotClub : null, 224 image: thumbnail != null ? thumbnail : null, 225 video: matchedVideo != null ? matchedVideo : null, 226 homeScore, 227 awayScore, 228 isLastTimingCommentary, 229 scoreChange: adjustedHomeScore !== homeScore ? "home" : adjustedAwayScore !== awayScore ? "away" : null 230 }); 231 homeScore = adjustedHomeScore; 232 awayScore = adjustedAwayScore; 233 } 234 return composedFeed; 235} 236function composePlayer(player = {}) { 237 return { 238 ...player, 239 known_name: player?.short_name, 240 full_name: `${player?.first_name} ${player?.last_name}`, 241 position: player?.playing_position, 242 jersey: player?.shirt_number, 243 slug: player?.slug 244 }; 245} 246function mergePlayers({ away, home }) { 247 return [...away?.players, ...home?.players]; 248} 249function mergePages(pages = []) { 250 return pages && pages.length > 0 ? pages.reduce((accum, current = []) => { 251 return [...accum, ...current]; 252 }, []) : []; 253} 254function composeVideoList(forgeVideos, validators) { 255 if (forgeVideos == null) { 256 return []; 257 } 258 const { 259 fullGameTags, 260 condensedGameTags, 261 gameHighlightsTags 262 } = validators || {}; 263 return forgeVideos.map((v) => { 264 const { tags } = v || {}; 265 if (tags == null) { 266 return v; 267 } 268 const tagList = []; 269 for (let i = 0; i < tags.length; i++) { 270 const currentTag = tags[i]; 271 const neutralSlug = currentTag?.neutralSlug; 272 if (neutralSlug != null) { 273 tagList.push(neutralSlug); 274 } 275 } 276 const isFullGame = tagValidator(tagList, fullGameTags); 277 const isCondensedGame = tagValidator(tagList, condensedGameTags); 278 const isGameHighlights = tagValidator(tagList, gameHighlightsTags); 279 return { 280 ...v, 281 fields: { 282 ...v.fields, 283 highlightType: isFullGame ? _shared_utils__WEBPACK_IMPORTED_MODULE_2__.highlightTypes.fullGame : isCondensedGame ? _shared_utils__WEBPACK_IMPORTED_MODULE_2__.highlightTypes.condensedGame : isGameHighlights ? _shared_utils__WEBPACK_IMPORTED_MODULE_2__.highlightTypes.gameHighlights : null 284 } 285 }; 286 }); 287} 288function removeDuplicates(items = [], key = "") { 289 if (!Array.isArray(items) || !key) { 290 return []; 291 } 292 const itemIds = {}; 293 items.forEach((item) => { 294 itemIds[item[key]] = item; 295 }); 296 return Object.values(itemIds); 297} 298function tagValidator(arr, target) { 299 if (arr == null || target == null) { 300 return false; 301 } 302 return target.every((v) => arr.some((x) => x.includes(v))); 303} 304 305 306/***/ }), 307
308/***/ "./scripts/react/mls-priority-match/app.js": 309/*!*************************************************!*\ 310 !*** ./scripts/react/mls-priority-match/app.js ***! 311 \*************************************************/ 312/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 313 314__webpack_require__.r(__webpack_exports__); 315/* harmony export */ __webpack_require__.d(__webpack_exports__, { 316/* harmony export */ "default": () => (/* reexport safe */ _main__WEBPACK_IMPORTED_MODULE_0__["default"]) 317/* harmony export */ }); 318/* harmony import */ var _main__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./main */ "./scripts/react/mls-priority-match/main.js"); 319 320 321 322/***/ }), 323
324/***/ "./scripts/react/mls-priority-match/components/MatchCta/MatchCta.js": 325/*!**************************************************************************!*\ 326 !*** ./scripts/react/mls-priority-match/components/MatchCta/MatchCta.js ***! 327 \**************************************************************************/ 328/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 329 330__webpack_require__.r(__webpack_exports__); 331/* harmony export */ __webpack_require__.d(__webpack_exports__, { 332/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 333/* harmony export */ }); 334/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 335/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 336/* harmony import */ var _shared_api_variables__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../shared/api/variables */ "./scripts/react/shared/api/variables.js"); 337/* harmony import */ var _shared_containers_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../shared/containers/utils */ "./scripts/react/shared/containers/utils.js"); 338/* harmony import */ var _libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../../libraries/_modules/tracking/helpers */ "./scripts/libraries/_modules/tracking/helpers.js"); 339 340 341 342 343 344function MatchCta({ 345 matchStatus, 346 appleStreamURL, 347 hasHighlights, 348 highlightsUrl, 349 matchPageUrl, 350 slug, 351 position, 352 matchId, 353 location, 354 sponsor 355}) { 356 const { t } = (0,_shared_containers_utils__WEBPACK_IMPORTED_MODULE_3__.useReactAppState)(); 357 const status = matchStatus?.abbreviation; 358 const trackInteraction = (event, ctaAction) => { 359 if (!event) 360 return null; 361 event.preventDefault(); 362 const { href, target } = event.currentTarget; 363 (0,_libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_4__.trackMatchInteraction)({ 364 event: "cta_clicked", 365 match: slug, 366 cta_action: ctaAction, 367 click_url: href, 368 position, 369 module_type: "priority_match", 370 match_id: matchId, 371 location, 372 sponsor 373 }); 374 window.open(href, target); 375 }; 376 if ((status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.pre || status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.live) && appleStreamURL) { 377 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 378 "a", 379 { 380 href: appleStreamURL, 381 target: "_blank", 382 rel: "noopener noreferrer", 383 className: "mls-c-priority-match__cta mls-c-priority-match__cta--watch", 384 onClick: (e) => trackInteraction(e, `${t("match_watch_on")} ${t("appletv")}`) 385 },
386 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 387 "img", 388 { 389 src: `/assets/images/watch-on-appletv-b-${_shared_api_variables__WEBPACK_IMPORTED_MODULE_2__.culture}.png`, 390 alt: `${t("match_watch_on")} ${t("appletv")}` 391 } 392 ) 393 ); 394 } 395 if (hasHighlights && highlightsUrl) { 396 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 397 "a", 398 { 399 href: highlightsUrl, 400 target: "_self", 401 className: "mls-c-priority-match__cta mls-c-priority-match__cta--highlights", 402 onClick: (e) => trackInteraction(e, t("highlights")) 403 }, 404 t("highlights") 405 ); 406 } 407 if (matchPageUrl) { 408 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 409 "a", 410 { 411 href: matchPageUrl, 412 target: "_self", 413 className: "mls-c-priority-match__cta mls-c-priority-match__cta--highlights", 414 onClick: (e) => trackInteraction(e, t("match_hub")) 415 }, 416 t("match_hub") 417 ); 418 } 419 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__separator" }, " ", status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.pre || status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.live ? t("priority-match-vs") : "-"); 420} 421/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchCta); 422 423 424/***/ }), 425
426/***/ "./scripts/react/mls-priority-match/components/MatchStatus/MatchStatus.js": 427/*!********************************************************************************!*\ 428 !*** ./scripts/react/mls-priority-match/components/MatchStatus/MatchStatus.js ***! 429 \********************************************************************************/ 430/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 431 432__webpack_require__.r(__webpack_exports__); 433/* harmony export */ __webpack_require__.d(__webpack_exports__, { 434/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 435/* harmony export */ }); 436/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 437/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 438/* harmony import */ var _shared_containers_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../shared/containers/utils */ "./scripts/react/shared/containers/utils.js"); 439/* harmony import */ var _shared_components_StatusStamp_StatusLiveStamp_StatusLiveStamp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../shared/components/StatusStamp/StatusLiveStamp/StatusLiveStamp */ "./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StatusLiveStamp.js"); 440 441 442 443 444function MatchStatus({ matchStatus, minutes, extraMinutes, dateLabel, matchTime, isTimeTbd }) { 445 const { t } = (0,_shared_containers_utils__WEBPACK_IMPORTED_MODULE_2__.useReactAppState)(); 446 const status = matchStatus?.abbreviation; 447 if (status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.live) { 448 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__date-time mls-c-priority-match__date-time--live" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_shared_components_StatusStamp_StatusLiveStamp_StatusLiveStamp__WEBPACK_IMPORTED_MODULE_3__["default"], { minuteDisplay: minutes, extraMinutes })); 449 } 450 if (status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.post || status === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_1__.statusTypes.finalWhistle) { 451 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__date-time" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__final" }, t("match_final"))); 452 } 453 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__date-time" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__date" }, dateLabel), !isTimeTbd && matchTime && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__time" }
453, matchTime), isTimeTbd && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__time mls-c-priority-match__time--tbd" }, t("tbd"))); 454} 455/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchStatus); 456 457 458/***/ }), 459
460/***/ "./scripts/react/mls-priority-match/components/MatchTopRow/MatchTopRow.js": 461/*!********************************************************************************!*\ 462 !*** ./scripts/react/mls-priority-match/components/MatchTopRow/MatchTopRow.js ***! 463 \********************************************************************************/ 464/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 465 466__webpack_require__.r(__webpack_exports__); 467/* harmony export */ __webpack_require__.d(__webpack_exports__, { 468/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 469/* harmony export */ }); 470/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 471/* harmony import */ var _MatchStatus_MatchStatus__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../MatchStatus/MatchStatus */ "./scripts/react/mls-priority-match/components/MatchStatus/MatchStatus.js"); 472/* harmony import */ var _shared_components_Picture__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../shared/components/Picture */ "./scripts/react/shared/components/Picture/index.js"); 473 474 475 476function MatchTopRow({ sponsorImageUrl, matchStatus, minutes, extraMinutes, dateLabel, matchTime, isTimeTbd, leagueMatchTitle }) { 477 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__top-row" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__broadcast-info" }
477, sponsorImageUrl ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_shared_components_Picture__WEBPACK_IMPORTED_MODULE_2__["default"], { src: sponsorImageUrl, title: "Sponsor" }) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__league-title" }, leagueMatchTitle)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 478 _MatchStatus_MatchStatus__WEBPACK_IMPORTED_MODULE_1__["default"], 479 { 480 matchStatus, 481 minutes, 482 extraMinutes, 483 dateLabel, 484 matchTime, 485 isTimeTbd 486 } 487 )); 488} 489/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchTopRow); 490 491 492/***/ }), 493
494/***/ "./scripts/react/mls-priority-match/components/MatchupRow/MatchupRow.js": 495/*!******************************************************************************!*\ 496 !*** ./scripts/react/mls-priority-match/components/MatchupRow/MatchupRow.js ***! 497 \******************************************************************************/ 498/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 499 500__webpack_require__.r(__webpack_exports__); 501/* harmony export */ __webpack_require__.d(__webpack_exports__, { 502/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 503/* harmony export */ }); 504/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 505/* harmony import */ var _TeamSection_TeamSection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../TeamSection/TeamSection */ "./scripts/react/mls-priority-match/components/TeamSection/TeamSection.js"); 506/* harmony import */ var _MatchCta_MatchCta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../MatchCta/Mat
506chCta */ "./scripts/react/mls-priority-match/components/MatchCta/MatchCta.js"); 507 508 509 510function MatchupRow({ 511 homeAbbreviation, 512 homeLogoUrl, 513 homeBackgroundColor, 514 homeGoals, 515 awayAbbreviation, 516 awayLogoUrl, 517 awayBackgroundColor, 518 awayGoals, 519 showScore, 520 matchStatus, 521 appleStreamURL, 522 hasHighlights, 523 highlightsUrl, 524 matchPageUrl, 525 slug, 526 position, 527 matchId, 528 location, 529 sponsor 530}) { 531 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { className: "mls-c-priority-match__matchup-row" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 532 _TeamSection_TeamSection__WEBPACK_IMPORTED_MODULE_1__["default"], 533 { 534 abbreviation: homeAbbreviation, 535 logoUrl: homeLogoUrl, 536 backgroundColor: homeBackgroundColor, 537 score: homeGoals, 538 showScore 539 } 540 ), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 541 _MatchCta_MatchCta__WEBPACK_IMPORTED_MODULE_2__["default"], 542 { 543 matchStatus, 544 appleStreamURL, 545 hasHighlights, 546 highlightsUrl, 547 matchPageUrl, 548 slug, 549 position, 550 matchId, 551 location, 552 sponsor 553 } 554 ), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 555 _TeamSection_TeamSection__WEBPACK_IMPORTED_MODULE_1__["default"], 556 { 557 abbreviation: awayAbbreviation, 558 logoUrl: awayLogoUrl, 559 backgroundColor: awayBackgroundColor, 560 score: awayGoals, 561 showScore, 562 reverse: true 563 } 564 )); 565} 566/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchupRow); 567 568 569/***/ }), 570
571/***/ "./scripts/react/mls-priority-match/components/TeamSection/TeamSection.js": 572/*!********************************************************************************!*\ 573 !*** ./scripts/react/mls-priority-match/components/TeamSection/TeamSection.js ***! 574 \********************************************************************************/ 575/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 576 577__webpack_require__.r(__webpack_exports__); 578/* harmony export */ __webpack_require__.d(__webpack_exports__, { 579/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 580/* harmony export */ }); 581/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 582/* harmony import */ var _shared_components_Picture__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../shared/components/Picture */ "./scripts/react/shared/components/Picture/index.js"); 583 584 585function TeamSection({ 586 abbreviation, 587 logoUrl, 588 backgroundColor, 589 score, 590 showScore, 591 reverse = false 592}) { 593 const scoreEl = showScore && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__score" }, score ?? 0); 594 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 595 "div", 596 { 597 className: "mls-c-priority-match__team-section", 598 style: { "--team-color": backgroundColor } 599 }, 600 reverse ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, scoreEl, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 601 _shared_components_Picture__WEBPACK_IMPORTED_MODULE_1__["default"], 602 { 603 src: logoUrl, 604 title: abbreviation, 605 extraClasses: "mls-c-priority-match__team-logo", 606 className: "mls-c-priority-match__team-logo" 607 } 608 ), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__team-abbr" }, abbreviation)) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("span", { className: "mls-c-priority-match__team-abbr" }
608, abbreviation), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 609 _shared_components_Picture__WEBPACK_IMPORTED_MODULE_1__["default"], 610 { 611 src: logoUrl, 612 title: abbreviation, 613 extraClasses: "mls-c-priority-match__team-logo", 614 className: "mls-c-priority-match__team-logo" 615 } 616 ), scoreEl) 617 ); 618} 619/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TeamSection); 620 621 622/***/ }), 623
624/***/ "./scripts/react/mls-priority-match/hooks/usePriorityMatch.js": 625/*!********************************************************************!*\ 626 !*** ./scripts/react/mls-priority-match/hooks/usePriorityMatch.js ***! 627 \********************************************************************/ 628/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 629 630__webpack_require__.r(__webpack_exports__); 631/* harmony export */ __webpack_require__.d(__webpack_exports__, { 632/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 633/* harmony export */ }); 634/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 635/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! react-query */ "./.yarn/__virtual__/react-query-virtual-cd72c42dd3/0/cache/react-query-npm-3.12.0-415d3b7722-bd1075ac15.zip/node_modules/react-query/es/index.js"); 636/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/parseISO/index.js"); 637/* harmony import */ var _shared_containers_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/containers/utils */ "./scripts/react/shared/containers/utils.js"); 638/* harmony import */ var _mls_match_list_hooks_useMLSMatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mls-match-list/hooks/useMLSMatch */ "./scripts/react/mls-match-list/hooks/useMLSMatch.js"); 639/* harmony import */ var _shared_api_variables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/api/variables */ "./scripts/react/shared/api/variables.js"); 640/* harmony import */ var _shared_api_fetching__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../shared/api/fetching */ "./scripts/react/shared/api/fetching.js"); 641/* harmony import */ var _mls_match_feed_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../mls-match-feed/utils */ "./scripts/react/mls-match-feed/utils.js"); 642/* harmony import */ var _shared_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shared/utils */ "./scripts/react/shared/utils.js"); 643/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 644/* harmony import */ var _mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../mls-match-summary/utils */ "./scripts/react/mls-match-summary/utils.js"); 645/* harmony import */ var _mls_vertical_scoreboard_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../mls-vertical-scoreboard/utils */ "./scripts/react/mls-vertical-scoreboard/utils.js"); 646/* harmony import */ var _shared_containers_ReactApp_MatchHandler__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../shared/containers/ReactApp/MatchHandler */ "./scripts/react/shared/containers/ReactApp/MatchHandler.js"); 647/* harmony import */ var _mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../mls-horizontal-scoreboard/utils */ "./scripts/react/mls-horizontal-scoreboard/utils.js"); 648/* harmony import */ var _shared_hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../shared/hooks/useScheduledMatchRefetch */ "./scripts/react/shared/hooks/useScheduledMatchRefetch.js"); 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666function usePriorityMatch({ matchSportecId, matchSlug }) { 667 const { t, apiList, urlList, directoryList, videoTags } = (0,_shared_containers_utils__WEBPACK_IMPORTED_MODULE_1__.useReactAppState)(); 668 const { d3SportsAPI } = apiList || {}; 669 const queryClient = (0,react_query__WEBPACK_IMPORTED_MODULE_13__.useQueryClient)(); 670 const [refetchInterval, setRefetchInterval] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(6e4); 671 const [matchStatus, setMatchStatus] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null); 672 const { 673 data: statsAPIMatch, 674 isLoading: isLoadingStatsAPIMatch, 675 isError: isStatsAPIMatchError 676 } = (0,_mls_match_list_hooks_useMLSMatch__WEBPACK_IMPORTED_MODULE_2__["default"])({ 677 matchSportecId, 678 options: { refetchInterval } 679 }); 680 const matchEndpoint = (0,_shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.d3SingleMatchAPI)({ matchSportecId }); 681 const { data: forgeMatch, isLoading: isLoadingForgeMatch } = (0,react_query__WEBPACK_IMPORTED_MODULE_13__.useQuery)({ 682 queryKey: ["d3-match", matchSportecId], 683 queryFn: () => (0,_shared_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ endpoint: matchEndpoint, apiURL: d3SportsAPI }), 684 enabled: !!matchSportecId 685 }); 686 const { competition_label } = statsAPIMatch?.match_information || {}; 687 const { matchDate: forgeMatchDate, leagueMatchTitle } = forgeMatch || {}; 688 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 689 const { match_status } = statsAPIMatch?.match_information || {}; 690 const status = (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.composeMatchStatus)({ period: match_status }); 691 setMatchStatus(status); 692 if (!!refetchInterval && status?.abbreviation !== _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.periodTypes.live) { 693 setRefetchInterval(null); 694 } 695 }, [statsAPIMatch]); 696 const fallbackDate = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 697 const date = statsAPIMatch?.match_information?.planned_kickoff_time || forgeMatchDate; 698 return date ? new Date(date) : /* @__PURE__ */ new Date(); 699 }, [forgeMatchDate, statsAPIMatch?.match_information?.planned_kickoff_time]); 700 const { dayBefore, dayAfter } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)( 701 () => (0,_shared_containers_ReactApp_MatchHandler__WEBPACK_IMPORTED_MODULE_10__.dateWithBeforeAndAfter)(fallbackDate), 702 [fallbackDate] 703 ); 704 const seasonSportecId = statsAPIMatch?.match_information?.season_id || window?.forgeVariables?.currentSite?.currentSeasonSportecId; 705 const fallbackEndpoint = (0,_shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.mlsGetMatches)({ 706 from: dayBefore, 707 to: dayAfter, 708 seasonSportecId 709 }); 710 const { data: matchByDate } = (0,react_query__WEBPACK_IMPORTED_MODULE_13__.useQuery)({ 711 queryKey: ["mls-matches-date-range", { from: dayBefore, to: dayAfter }], 712 queryFn: () => (0,_shared_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ endpoint: fallbackEndpoint, apiURL: apiList?.statsAPI }), 713 refetchOnWindowFocus: false, 714 select: (response) => { 715 if (!response?.schedule) 716 return null; 717 const sorted = [...response.schedule].sort( 718 (a, b) => (0,date_fns__WEBPACK_IMPORTED_MODULE_14__["default"])(a.planned_kickoff_time) - (0,date_fns__WEBPACK_IMPORTED_MODULE_14__["default"])(b.planned_kickoff_time) 719 ); 720 const matches = (0,_mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_11__.formatStatsAPIMatches)( 721 (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.filterMlsMatchesByCompetitionsToSkip)(sorted) 722 ); 723 return matches.find((m) => m.match_id === matchSportecId) || null; 724 }, 725 enabled: !!isStatsAPIMatchError && !!seasonSportecId, 726 staleTime: Infinity 727 }); 728 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 729 if (isStatsAPIMatchError && matchByDate) { 730 queryClient.setQueryData(["mls-match", matchSportecId], matchByDate); 731 } 732 }, [matchByDate, matchSportecId, isStatsAPIMatchError]); 733 (0,_shared_hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_12__["default"])({ 734 matchDate: matchByDate?.planned_kickoff_time || forgeMatchDate, 735 minutesBefore: 60, 736 queryKey: ["mls-match", matchSportecId], 737 queryClient, 738 enabled: !!isStatsAPIMatchError && !!(forgeMatchDate || matchByDate?.planned_kickoff_time) 739 }); 740 const isLoading = isLoadingStatsAPIMatch || isLoadingForgeMatch; 741 const isReady = !isLoading && !!statsAPIMatch && !!matchSportecId && !!matchSlug; 742 const { 743 away: { 744 abbreviation: awayAbbreviation, 745 logoColorUrl: awayLogoColorUrl,
746 backgroundColor: awayBackgroundColor 747 } = {}, 748 home: { 749 abbreviation: homeAbbreviation, 750 logoColorUrl: homeLogoColorUrl, 751 backgroundColor: homeBackgroundColor 752 } = {}, 753 leaguePromoImage: { assetUrl: leaguePromoImage } = {}, 754 appleStreamURL, 755 slug: forgeSlug, 756 competition: forgeCompetition, 757 season: forgeSeason 758 } = forgeMatch || { away: {}, home: {} }; 759 const { 760 minute_of_play, 761 planned_kickoff_time, 762 kickoff_time, 763 home_team_goals: homeGoals, 764 away_team_goals: awayGoals, 765 match_date_time_status 766 } = statsAPIMatch?.match_information || {}; 767 const showScore = matchStatus?.abbreviation === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.statusTypes.live || matchStatus?.abbreviation === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.statusTypes.post || matchStatus?.abbreviation === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.statusTypes.finalWhistle; 768 const isPost = matchStatus?.abbreviation === _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.statusTypes.post; 769 const forgeMatchVideosEndpoint = (0,_shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.forgeMatchVideosAPI)({ matchSportecId }); 770 const forgeMatchContentVideosEndpoint = (0,_shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.forgeMatchContentVideosAPI)({ 771 matchSlug: forgeSlug || matchSlug 772 }); 773 const { data: forgeMatchVideos } = (0,react_query__WEBPACK_IMPORTED_MODULE_13__.useQuery)({ 774 queryKey: [`forge-match-videos`, { matchSportecId }], 775 queryFn: () => (0,_shared_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ 776 apiURL: _shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.apiURL.forgeDAPI, 777 endpoint: forgeMatchVideosEndpoint 778 }), 779 select: (videos) => videos?.items, 780 enabled: !!matchSportecId && isPost, 781 refetchOnWindowFocus: false 782 }); 783 const { data: forgeMatchContentVideos } = (0,react_query__WEBPACK_IMPORTED_MODULE_13__.useQuery)({ 784 queryKey: [`forge-match-content-videos`, { slug: forgeSlug || matchSlug }], 785 queryFn: () => (0,_shared_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ 786 apiURL: _shared_api_variables__WEBPACK_IMPORTED_MODULE_3__.apiURL.forgeDAPI, 787 endpoint: forgeMatchContentVideosEndpoint 788 }), 789 select: (videos) => videos?.items, 790 enabled: !!(forgeSlug || matchSlug) && isPost, 791 refetchOnWindowFocus: false 792 }); 793 const videoList = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 794 const matchVideos = forgeMatchVideos?.length >= 0 && forgeMatchContentVideos?.length >= 0 ? [...forgeMatchVideos, ...forgeMatchContentVideos] : []; 795 return (0,_mls_match_feed_utils__WEBPACK_IMPORTED_MODULE_5__.composeVideoList)(matchVideos, videoTags); 796 }, [forgeMatchVideos, forgeMatchContentVideos, videoTags]); 797 const gameHighlights = videoList.find( 798 (video) => video?.fields?.highlightType === _shared_utils__WEBPACK_IMPORTED_MODULE_6__.highlightTypes.gameHighlights || video?.tags?.find((tag) => tag?.slug === _shared_utils__WEBPACK_IMPORTED_MODULE_6__.matchHighlightsTagSlug) 799 ); 800 const fullGame = videoList.find( 801 (video) => video?.fields?.highlightType === _shared_utils__WEBPACK_IMPORTED_MODULE_6__.highlightTypes.fullGame 802 ); 803 const condensedGame = videoList.find( 804 (video) => video?.fields?.highlightType === _shared_utils__WEBPACK_IMPORTED_MODULE_6__.highlightTypes.condensedGame 805 ); 806 const hasHighlights = isPost && !!(gameHighlights || fullGame || condensedGame); 807 const { baseUrl } = urlList || {}; 808 const { matchHubDir } = directoryList || {}; 809 const { slug: competitionSlug } = forgeCompetition || {}; 810 const { name: seasonYear } = forgeSeason || {}; 811 const matchPageUrl = (0,_shared_utils__WEBPACK_IMPORTED_MODULE_6__.getMatchesUrl)( 812 baseUrl, 813 matchHubDir, 814 competitionSlug, 815 seasonYear, 816 forgeSlug 817 ); 818 const highlightsUrl = matchPageUrl ? `${matchPageUrl}?openHighlights=true` : null; 819 const [minutes, extraMinutes] = (0,_mls_match_summary_utils__WEBPACK_IMPORTED_MODULE_8__.formatMatchMinutes)(minute_of_play); 820 const { highQuality: homeLogoUrl } = isReady ? (0,_shared_utils__WEBPACK_IMPORTED_MODULE_6__.formatImageUrl)(homeLogoColorUrl, { 821 format: "w_128,h_128,c_pad", 822 extension: "f_auto" 823 }) || { highQuality: "/assets/icons/tbd.png" } : {}; 824 const { highQuality: awayLogoUrl } = isReady ? (0,_shared_utils__WEBPACK_IMPORTED_MODULE_6__.formatImageUrl)(awayLogoColorUrl, { 825 format: "w_128,h_128,c_pad", 826 extension: "f_auto" 827 }) || { highQuality: "/assets/icons/tbd.png" } : {}; 828 const { highQuality: leaguePromoImageUrl } = leaguePromoImage ? (0,_shared_utils__WEBPACK_IMPORTED_MODULE_6__.formatImageUrl)(leaguePromoImage, { 829 format: "q_auto:best", 830 extension: "f_webp" 831 }) : {}; 832 const localTime = kickoff_time || planned_kickoff_time; 833 const dateLabel = (0,_mls_vertical_scoreboard_utils__WEBPACK_IMPORTED_MODULE_9__.getDateTranslation)(localTime, t, false); 834 const matchDateTime = (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_7__.useLocalMatchDateTime)(localTime); 835 const matchTime = matchDateTime?.time ?? null; 836 const isTimeTbd = match_date_time_status?.toLowerCase() === "time tbd" || match_date_time_status === "Day and time tbd"; 837 return { 838 isReady, 839 matchStatus, 840 homeAbbreviation, 841 homeLogoUrl,
842 homeBackgroundColor, 843 homeGoals, 844 awayAbbreviation, 845 awayLogoUrl, 846 awayBackgroundColor, 847 awayGoals, 848 showScore, 849 hasHighlights, 850 appleStreamURL, 851 highlightsUrl, 852 leaguePromoImageUrl, 853 minutes, 854 extraMinutes, 855 dateLabel, 856 matchTime, 857 isTimeTbd, 858 leagueMatchTitle: leagueMatchTitle || competition_label || "", 859 matchPageUrl 860 }; 861} 862/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (usePriorityMatch); 863 864 865/***/ }), 866
867/***/ "./scripts/react/mls-priority-match/main.js": 868/*!**************************************************!*\ 869 !*** ./scripts/react/mls-priority-match/main.js ***! 870 \**************************************************/ 871/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 872 873__webpack_require__.r(__webpack_exports__); 874/* harmony export */ __webpack_require__.d(__webpack_exports__, { 875/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 876/* harmony export */ }); 877/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 878/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! styled-components */ "./.yarn/unplugged/styled-components-virtual-66ed2408f5/node_modules/styled-components/dist/styled-components.browser.esm.js"); 879/* harmony import */ var _hooks_usePriorityMatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hooks/usePriorityMatch */ "./scripts/react/mls-priority-match/hooks/usePriorityMatch.js"); 880/* harmony import */ var _components_MatchTopRow_MatchTopRow__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/MatchTopRow/MatchTopRow */ "./scripts/react/mls-priority-match/components/MatchTopRow/MatchTopRow.js"); 881/* harmony import */ var _components_MatchupRow_MatchupRow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/MatchupRow/MatchupRow */ "./scripts/react/mls-priority-match/components/MatchupRow/MatchupRow.js"); 882/* harmony import */ var _shared_hooks_useModuleImpression__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../shared/hooks/useModuleImpression */ "./scripts/react/shared/hooks/useModuleImpression.js"); 883/* harmony import */ var _shared_styled_Theme__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../shared/styled/Theme */ "./scripts/react/shared/styled/Theme.js"); 884/* harmony import */ var _libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../libraries/_modules/tracking/helpers */ "./scripts/libraries/_modules/tracking/helpers.js"); 885 886 887 888 889 890 891 892 893function PriorityMatch({ options }) { 894 const { matchSlug, matchSportecId, position, analyticsLocation, sponsor } = options || {}; 895 const { 896 isReady, 897 matchStatus, 898 homeAbbreviation, 899 homeLogoUrl, 900 homeBackgroundColor, 901 homeGoals, 902 awayAbbreviation, 903 awayLogoUrl, 904 awayBackgroundColor, 905 awayGoals, 906 showScore, 907 hasHighlights, 908 appleStreamURL, 909 highlightsUrl, 910 matchPageUrl, 911 leaguePromoImageUrl, 912 minutes, 913 extraMinutes, 914 dateLabel, 915 matchTime, 916 isTimeTbd, 917 leagueMatchTitle 918 } = (0,_hooks_usePriorityMatch__WEBPACK_IMPORTED_MODULE_1__["default"])({ matchSportecId, matchSlug }); 919 const trackingData = { 920 module_type: "priority_match", 921 match_id: matchSportecId, 922 match: matchSlug, 923 position, 924 location: analyticsLocation || "", 925 sponsor: sponsor || "", 926 platform: "web", 927 domain: window.location.href 928 }; 929 const impressionRef = (0,_shared_hooks_useModuleImpression__WEBPACK_IMPORTED_MODULE_4__["default"])(trackingData, { enabled: isReady }); 930 const handleModuleClick = (event) => { 931 if (event.target.closest("a") || !matchPageUrl) { 932 return; 933 } 934 (0,_libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_6__.trackModuleClick)(trackingData); 935 window.location.href = matchPageUrl; 936 }; 937 if (!isReady) 938 return null; 939 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 940 styled_components__WEBPACK_IMPORTED_MODULE_7__.ThemeProvider, 941 { 942 theme: { ..._shared_styled_Theme__WEBPACK_IMPORTED_MODULE_5__.Theme, type: options?.theme || _shared_styled_Theme__WEBPACK_IMPORTED_MODULE_5__.themeTypes.light } 943 }, 944 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 945 "div", 946 { 947 ref: impressionRef, 948 role: "region", 949 className: "mls-c-priority-match", 950 onClick: handleModuleClick 951 },
952 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 953 _components_MatchTopRow_MatchTopRow__WEBPACK_IMPORTED_MODULE_2__["default"], 954 { 955 sponsorImageUrl: leaguePromoImageUrl, 956 matchStatus, 957 minutes, 958 extraMinutes, 959 dateLabel, 960 matchTime, 961 isTimeTbd, 962 leagueMatchTitle 963 } 964 ), 965 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 966 _components_MatchupRow_MatchupRow__WEBPACK_IMPORTED_MODULE_3__["default"], 967 { 968 homeAbbreviation, 969 homeLogoUrl, 970 homeBackgroundColor, 971 homeGoals, 972 awayAbbreviation, 973 awayLogoUrl, 974 awayBackgroundColor, 975 awayGoals, 976 showScore, 977 matchStatus, 978 appleStreamURL, 979 hasHighlights, 980 highlightsUrl, 981 matchPageUrl, 982 slug: matchSlug, 983 position, 984 matchId: matchSportecId, 985 location: analyticsLocation || "", 986 sponsor: sponsor || "" 987 } 988 ) 989 ) 990 ); 991} 992PriorityMatch = react__WEBPACK_IMPORTED_MODULE_0__.memo(PriorityMatch); 993/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (PriorityMatch); 994 995 996/***/ }), 997
998/***/ "./scripts/react/mls-vertical-scoreboard/utils.js": 999/*!********************************************************!*\ 1000 !*** ./scripts/react/mls-vertical-scoreboard/utils.js ***! 1001 \********************************************************/ 1002/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1003 1004__webpack_require__.r(__webpack_exports__); 1005/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1006/* harmony export */ "getDateTranslation": () => (/* binding */ getDateTranslation), 1007/* harmony export */ "getLiteRanges": () => (/* binding */ getLiteRanges), 1008/* harmony export */ "getMatchDay": () => (/* binding */ getMatchDay), 1009/* harmony export */ "getMatchDayRange": () => (/* binding */ getMatchDayRange), 1010/* harmony export */ "getMatchInitialDate": () => (/* binding */ getMatchInitialDate), 1011/* harmony export */ "getNearestMatches": () => (/* binding */ getNearestMatches), 1012/* harmony export */ "getSportecClubId": () => (/* binding */ getSportecClubId) 1013/* harmony export */ }); 1014/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/format/index.js"); 1015/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/parse/index.js"); 1016/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isToday/index.js"); 1017/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isFuture/index.js"); 1018/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isPast/index.js"); 1019/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/subDays/index.js"); 1020/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/addDays/index.js"); 1021/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/getYear/index.js"); 1022/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isValid/index.js"); 1023/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isSameDay/index.js"); 1024/* harmony import */ var date_fns_locale__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! date-fns/locale */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/locale/en-US/index.js"); 1025/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ "./.yarn/cache/dayjs-npm-1.11.5-a825142dc5-cee1c2ed5f.zip/node_modules/dayjs/dayjs.min.js"); 1026/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__); 1027/* harmony import */ var _shared_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../shared/utils */ "./scripts/react/shared/utils.js"); 1028/* harmony import */ var _mls_featured_match_v2_components_FeaturedMatchWrapper_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mls-featured-match-v2/components/FeaturedMatchWrapper/utils */ "./scripts/react/mls-featured-match-v2/components/FeaturedMatchWrapper/utils.js"); 1029 1030 1031 1032 1033 1034const getDateOrDefault = (dateString) => { 1035 if (!dateString) { 1036 const now = Date.now(); 1037 return { date: now, dateString: (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(now, "yyyy-MM-dd") }; 1038 } 1039 return { 1040 date: (0,date_fns__WEBPACK_IMPORTED_MODULE_4__["default"])(dateString, "yyyy-MM-dd", /* @__P
1040URE__ */ new Date()), 1041 dateString 1042 }; 1043}; 1044const getLiteRanges = (matches = []) => { 1045 if (!matches || !matches?.length) { 1046 return null; 1047 } 1048 const todayMatches = matches.filter( 1049 (match) => (0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(match?.matchDate).toDate()) 1050 ); 1051 const nextMatches = matches.filter( 1052 (match) => (0,date_fns__WEBPACK_IMPORTED_MODULE_6__["default"])(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(match?.matchDate).toDate()) 1053 ); 1054 const pastMatches = matches.filter( 1055 (match) => (0,date_fns__WEBPACK_IMPORTED_MODULE_7__["default"])(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(match?.matchDate).toDate()) 1056 ); 1057 if (todayMatches?.length) { 1058 const now = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(Date.now(), "yyyy-MM-dd"); 1059 return { 1060 dateFromLite: now, 1061 dateToLite: now 1062 }; 1063 } 1064 if (nextMatches?.length) { 1065 const matchDayDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])( 1066 dayjs__WEBPACK_IMPORTED_MODULE_0___default()(nextMatches[0].matchDate).toDate(), 1067 "yyyy-MM-dd" 1068 ); 1069 return { 1070 dateFromLite: matchDayDate, 1071 dateToLite: matchDayDate 1072 }; 1073 } 1074 if (pastMatches?.length) { 1075 const matchDayDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])( 1076 dayjs__WEBPACK_IMPORTED_MODULE_0___default()(pastMatches[0].matchDate).toDate(), 1077 "yyyy-MM-dd" 1078 ); 1079 return { 1080 dateFromLite: matchDayDate, 1081 dateToLite: matchDayDate 1082 }; 1083 } 1084 return { 1085 dateFromLite: null, 1086 dateToLite: null 1087 }; 1088}; 1089const getMatchDayRange = (differenceDays = 1) => { 1090 const now = Date.now(); 1091 const daysAgo = (0,date_fns__WEBPACK_IMPORTED_MODULE_8__["default"])(now, differenceDays); 1092 const daysLater = (0,date_fns__WEBPACK_IMPORTED_MODULE_9__["default"])(now, differenceDays); 1093 const from = { 1094 date: daysAgo, 1095 dateString: (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(daysAgo, "yyyy-MM-dd") 1096 }; 1097 const to = { 1098 date: daysLater, 1099 dateString: (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(daysLater, "yyyy-MM-dd") 1100 }; 1101 const formattedDateString = from.dateString === to.dateString ? (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(from.date, "PPPP", { locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() }) : `${(0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(from.date, "PPPP", { 1102 locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() 1103 })} - ${(0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(to.date, "PPPP", { locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() })}`; 1104 return { from: from.dateString, to: to.dateString, formattedDateString }; 1105}; 1106const getMatchInitialDate = (matchDateTime, dateFrom, dateTo) => { 1107 const parsedMatchDateTime = matchDateTime ? new Date(Date.parse(matchDateTime)) : null; 1108 const dateObj = parsedMatchDateTime ? { 1109 date: parsedMatchDateTime, 1110 dateString: (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(parsedMatchDateTime, "yyyy-MM-dd", { 1111 locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() 1112 }) 1113 } : null; 1114 const from = dateObj ? dateObj : getDateOrDefault(dateFrom); 1115 const to = dateObj ? dateObj : getDateOrDefault(dateTo); 1116 const formattedDateString = from.dateString === to.dateString ? (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(from.date, "PPPP", { locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() }) : `${(0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(from.date, "PPPP", { 1117 locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() 1118 })} - ${(0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(to.date, "PPPP", { locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() })}`; 1119 return { from: from.dateString, to: to.dateString, formattedDateString }; 1120}; 1121const getDateTranslation = (date, t, showDay = true) => { 1122 if (!date || !t) 1123 return null; 1124 const dayObj = new Date(date); 1125 const currentYear = (0,date_fns__WEBPACK_IMPORTED_MODULE_10__["default"])(/* @__PURE__ */ new Date()); 1126 const year = (0,date_fns__WEBPACK_IMPORTED_MODULE_10__["default"])(dayObj); 1127 const sameYear = currentYear == year; 1128 if ((0,date_fns__WEBPACK_IMPORTED_MODULE_11__["default"])(dayObj)) { 1129 const weekdayLabelFormat = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(dayObj, "cccc", { 1130 locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() 1131 })?.toLowerCase(); 1132 const dayLabelFormat = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(dayObj, "d"); 1133 const monthLabelFormat = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(dayObj, "MMMM", { 1134 locale: (0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() 1135 })?.toLowerCase(); 1136 if ((0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() !== date_fns_locale__WEBPACK_IMPORTED_MODULE_12__["default"]) { 1137 return `${showDay ? `${t(weekdayLabelFormat)} ` : ""}${dayLabelFormat} ${t( 1138 monthLabelFormat 1139 )} ${!sameYear ? year : ""}`.trim(); 1140 } 1141 if ((0,_shared_utils__WEBPACK_IMPORTED_MODULE_1__.getCultureLocalizer)() == date_fns_locale__WEBPACK_IMPORTED_MODULE_12__["default"]) { 1142 return `${showDay ? `${t(weekdayLabelFormat)} ` : ""}${t( 1143 monthLabelFormat 1144 )} ${dayLabelFormat} ${!sameYear ? year : ""}`.trim(); 1145 } 1146 } else { 1147 return `${date} ${!sameYear ? year : ""}`; 1148 } 1149}; 1150function getNearestMatches(matches) { 1151 const groupedMatches = (0,_mls_featured_match_v2_components_FeaturedMatchWrapper_utils__WEBPACK_IMPORTED_MODULE_2__.groupMatchesByDate)(matches); 1152 let preMatches = null; 1153 if (groupedMatches) { 1154 preMatches = getTodaysNearestMatches(groupedMatches, date_fns__WEBPACK_IMPORTED_MODULE_9__["default"]); 1155 if (!preMatches) { 1156 preMatches = getTodaysNearestMatches(groupedMatches, date_fns__WEBPACK_IMPORTED_MODULE_8__["default"]); 1157 } 1158 } 1159 return preMatches; 1160} 1161function getTodaysNearestMatches(groupedMatches, getDate) { 1162 const now = /* @__PURE__ */ new Date(); 1163 const MAX_DIFFERENCE_DAYS = 60; 1164 let matches = null; 1165 for (let index = 0; index <= MAX_DIFFERENCE_DAYS; index++) { 1166 const date = getDate(now, index); 1167 const matchesDate = getMatchesFromDate(groupedMatches, date); 1168 if (matchesDate) { 1169 matches = matchesDate?.matches; 1170 break; 1171 } 1172 } 1173 return matches; 1174} 1175function getMatchesFromDate(groupedMatches, date) { 1176 return groupedMatches.find((currentGroupedMatches) => { 1177 if ((0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(currentGroupedMatches.date, date)) { 1178 return true; 1179 } 1180 }); 1181} 1182function getMatchDay(matches) { 1183 const matchDays = {}; 1184 matches?.forEach((match) => { 1185 const matchDay = match?.match_day; 1186 matchDays[matchDay] = matchDays[matchDay] + 1 || 1; 1187 }); 1188 const mostCommonMatchDay = Object.keys(matchDays)?.reduce( 1189 (a, b) => matchDays[a] >
1189 matchDays[b] ? a : b, 1190 0 1191 ); 1192 return mostCommonMatchDay; 1193} 1194function getSportecClubId() { 1195 return window?.forgeVariables?.currentSite?.clubSportecId; 1196} 1197 1198 1199/***/ }), 1200
1201/***/ "./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StatusLiveStamp.js": 1202/*!****************************************************************************************!*\ 1203 !*** ./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StatusLiveStamp.js ***! 1204 \****************************************************************************************/ 1205/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1206 1207__webpack_require__.r(__webpack_exports__); 1208/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1209/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 1210/* harmony export */ }); 1211/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 1212/* harmony import */ var _StyledStatusLiveStamp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./StyledStatusLiveStamp */ "./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StyledStatusLiveStamp.js"); 1213/* harmony import */ var _containers_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../containers/utils */ "./scripts/react/shared/containers/utils.js"); 1214 1215 1216 1217const StatusLiveStamp = ({ 1218 minuteDisplay = null, 1219 extraMinutes = null, 1220 hasPenaltyKicks 1221}) => { 1222 const { t } = (0,_containers_utils__WEBPACK_IMPORTED_MODULE_2__.useReactAppState)(); 1223 if (!minuteDisplay) 1224 minuteDisplay = t("live"); 1225 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_StyledStatusLiveStamp__WEBPACK_IMPORTED_MODULE_1__.StyledStatusLiveStamp, null, hasPenaltyKicks ? "PKS" : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, minuteDisplay, !!extraMinutes && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_StyledStatusLiveStamp__WEBPACK_IMPORTED_MODULE_1__.StyledStatusExtraStamp, { className: "mls-c-status-stamp__status--extra" }, "+", extraMinutes))); 1226}; 1227/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StatusLiveStamp); 1228 1229 1230/***/ }), 1231
1232/***/ "./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StyledStatusLiveStamp.js": 1233/*!**********************************************************************************************!*\ 1234 !*** ./scripts/react/shared/components/StatusStamp/StatusLiveStamp/StyledStatusLiveStamp.js ***! 1235 \**********************************************************************************************/ 1236/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1237 1238__webpack_require__.r(__webpack_exports__); 1239/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1240/* harmony export */ "StyledStatusDateQuality": () => (/* binding */ StyledStatusDateQuality), 1241/* harmony export */ "StyledStatusExtraStamp": () => (/* binding */ StyledStatusExtraStamp), 1242/* harmony export */ "StyledStatusLiveStamp": () => (/* binding */ StyledStatusLiveStamp) 1243/* harmony export */ }); 1244/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! styled-components */ "./.yarn/unplugged/styled-components-virtual-66ed2408f5/node_modules/styled-components/dist/styled-components.browser.esm.js"); 1245 1246const StyledStatusLiveStamp = styled_components__WEBPACK_IMPORTED_MODULE_0__["default"].span` 1247 padding: 2px 8px; 1248 display: flex; 1249 justify-content: center; 1250 align-items: center; 1251 background-color: ${(props) => props.theme.figma.base.color_freshred_100}; 1252 color: ${(props) => props.theme.figma.base.color_white_100}; 1253 font-family: ${(props) => props.theme.figma.base.fontfamily_mlstifo_micro}; 1254 font-size: ${(props) => props.theme.mixins.pxToRem(10)}; 1255 font-weight: ${(props) => props.theme.figma.base.fontweight_bold}; 1256 border-radius: ${(props) => props.theme.mixins.pxToRem(props.theme.figma.base.scale_2_50)}; 1257 text-transform: uppercase; 1258 .mls-c-status-stamp__status--delay { 1259 background-color: ${(props) => props.theme.figma.base.color_white_10}; 1260 } 1261`; 1262const StyledStatusExtraStamp = styled_components__WEBPACK_IMPORTED_MODULE_0__["default"].span` 1263 opacity: 0.75; 1264 margin-left: 2px; 1265`; 1266const StyledStatusDateQuality = styled_components__WEBPACK_IMPORTED_MODULE_0__["default"].span` 1267 color: ${(props) => props.theme.figma.base.color_freshred_100}; 1268`; 1269 1270 1271/***/ }), 1272
1273/***/ "./scripts/react/shared/containers/ReactApp/MatchHandler.js": 1274/*!******************************************************************!*\ 1275 !*** ./scripts/react/shared/containers/ReactApp/MatchHandler.js ***! 1276 \******************************************************************/ 1277/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1278 1279__webpack_require__.r(__webpack_exports__); 1280/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1281/* harmony export */ "dateWithBeforeAndAfter": () => (/* binding */ dateWithBeforeAndAfter), 1282/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), 1283/* harmony export */ "parseDateWithBeforeAndAfter": () => (/* binding */ parseDateWithBeforeAndAfter) 1284/* harmony export */ }); 1285/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 1286/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! react-query */ "./.yarn/__virtual__/react-query-virtual-cd72c42dd3/0/cache/react-query-npm-3.12.0-415d3b7722-bd1075ac15.zip/node_modules/react-query/es/index.js"); 1287/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/parseISO/index.js"); 1288/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/parse/index.js"); 1289/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/subDays/index.js"); 1290/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/addDays/index.js"); 1291/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/format/index.js"); 1292/* harmony import */ var _hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../hooks/useScheduledMatchRefetch */ "./scripts/react/shared/hooks/useScheduledMatchRefetch.js"); 1293/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./scripts/react/shared/containers/utils.js"); 1294/* harmony import */ var _api_variables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../api/variables */ "./scripts/react/shared/api/variables.js"); 1295/* harmony import */ var _api_fetching__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../api/fetching */ "./scripts/react/shared/api/fetching.js"); 1296/* harmony import */ var _mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../mls-horizontal-scoreboard/utils */ "./scripts/react/mls-horizontal-scoreboard/utils.js"); 1297/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 1298/* harmony import */ var _mls_match_list_hooks_useMLSMatch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../mls-match-list/hooks/useMLSMatch */ "./scripts/react/mls-match-list/hooks/useMLSMatch.js"); 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309function MatchHandler({ children, queryClient }) { 1310 const { apiList } = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.useReactAppState)(); 1311 const { forgeMatchDate, matchSportecId, seasonSportecId } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 1312 return { 1313 forgeMatchDate: window?.forgeVariables?.match?.matchDateTime, 1314 matchSportecId: window?.forgeVariables?.match?.sportecId, 1315 seasonSportecId: window?.forgeVariables?.match?.season 1316 }; 1317 }, []); 1318 const { from, to } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 1319 const { dayBefore: from2, dayAfter: to2 } = parseDateWithBeforeAndAfter( 1320 forgeMatchDate 1321 ); 1322 return { from: from2, to: to2 }; 1323 }, [forgeMatchDate]); 1324 const { data: mlsMatch, isError: mlsMatchError } = (0,_mls_match_list_hooks_useMLSMatch__WEBPACK_IMPORTED_MODULE_7__["default"])({ 1325 matchSportecId 1326 }); 1327 const mlsMatchesEndpoint = (0,_api_variables__WEBPACK_IMPORTED_MODULE_3__.mlsGetMatches)({ from, to, seasonSportecId }); 1328 const { data: mlsMatchByDate } = (0,react_query__WEBPACK_IMPORTED_MODULE_8__.useQuery)({ 1329 queryKey: ["mls-matches-date-range", { from, to }], 1330 queryFn: () => (0,_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ endpoint: mlsMatchesEndpoint, apiURL: apiList?.statsAPI }), 1331 refetchOnWindowFocus: false, 1332 select: (response) => { 1333 if (response?.schedule) { 1334 const sortedMatches = [ 1335 ...response?.schedule?.sort( 1336 (a, b) => (0,date_fns__WEBPACK_IMPORTED_MODULE_9__["default"])(a.planned_kickoff_time) - (0,date_fns__WEBPACK_IMPORTED_MODULE_9__["default"])(b.planned_kickoff_time) 1337 ) 1338 ]; 1339 const matches = (0,_mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_5__.formatStatsAPIMatches)( 1340 (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_6__.filterMlsMatchesByCompetitionsToSkip)(sortedMatches) 1341 ); 1342 const match = matches.find( 1343 (match2) => match2.match_id === matchSportecId 1344 ); 1345 if (match) { 1346 return match; 1347 } 1348 } 1349 return []; 1350 }, 1351 enabled: !!from && !!to && mlsMatchError, 1352 staleTime: Infinity 1353 }); 1354 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
1355 if (mlsMatchError && mlsMatchByDate) { 1356 queryClient.setQueryData(["mls-match", matchSportecId], mlsMatchByDate); 1357 } 1358 }, [mlsMatchByDate, matchSportecId, mlsMatchError]); 1359 (0,_hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_1__["default"])({ 1360 matchDate: mlsMatchByDate?.planned_kickoff_time, 1361 minutesBefore: 60, 1362 // 1 hour before match 1363 queryKey: ["mls-match", matchSportecId], 1364 queryClient, 1365 enabled: !!mlsMatchError && !!mlsMatchByDate?.planned_kickoff_time, 1366 onSchedule: ({ scheduledRefetchTime }) => { 1367 console.log( 1368 `MatchHandler scheduled refetch for match ${matchSportecId} at ${scheduledRefetchTime.toLocaleString()}` 1369 ); 1370 }, 1371 onRefetch: () => { 1372 console.log(`MatchHandler executing refetch for match ${matchSportecId}`); 1373 } 1374 }); 1375 return mlsMatchByDate || mlsMatch ? children : null; 1376} 1377const parseDateWithBeforeAndAfter = (dateTimeString) => { 1378 const [dateString] = dateTimeString.split(" "); 1379 const parsedDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_10__["default"])(dateString, "MM/dd/yyyy", /* @__PURE__ */ new Date()); 1380 const dayBefore = (0,date_fns__WEBPACK_IMPORTED_MODULE_11__["default"])(parsedDate, 1); 1381 const dayAfter = (0,date_fns__WEBPACK_IMPORTED_MODULE_12__["default"])(parsedDate, 1); 1382 return { 1383 originalDate: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(parsedDate, "yyyy-MM-dd"), 1384 dayBefore: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayBefore, "yyyy-MM-dd"), 1385 dayAfter: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayAfter, "yyyy-MM-dd") 1386 }; 1387}; 1388const dateWithBeforeAndAfter = (date) => { 1389 const dayBefore = (0,date_fns__WEBPACK_IMPORTED_MODULE_11__["default"])(date, 1); 1390 const dayAfter = (0,date_fns__WEBPACK_IMPORTED_MODULE_12__["default"])(date, 1); 1391 return { 1392 originalDate: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(date, "yyyy-MM-dd"), 1393 dayBefore: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayBefore, "yyyy-MM-dd"), 1394 dayAfter: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayAfter, "yyyy-MM-dd") 1395 }; 1396}; 1397/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchHandler); 1398 1399 1400/***/ }), 1401
1402/***/ "./scripts/react/shared/hooks/useModuleImpression.js": 1403/*!***********************************************************!*\ 1404 !*** ./scripts/react/shared/hooks/useModuleImpression.js ***! 1405 \***********************************************************/ 1406/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1407 1408__webpack_require__.r(__webpack_exports__); 1409/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1410/* harmony export */ "default": () => (/* binding */ useModuleImpression) 1411/* harmony export */ }); 1412/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 1413/* harmony import */ var react_intersection_observer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-intersection-observer */ "./.yarn/__virtual__/react-intersection-observer-virtual-72f1bbc67d/0/cache/react-intersection-observer-npm-8.34.0-3972ad1cd7-99dee30614.zip/node_modules/react-intersection-observer/react-intersection-observer.m.js"); 1414/* harmony import */ var _libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../libraries/_modules/tracking/helpers */ "./scripts/libraries/_modules/tracking/helpers.js"); 1415 1416 1417 1418function useModuleImpression(trackingData, config = {}) { 1419 const { enabled = true, threshold = 0.5 } = config; 1420 const tracked = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); 1421 const { ref, inView } = (0,react_intersection_observer__WEBPACK_IMPORTED_MODULE_2__.useInView)({ 1422 threshold, 1423 triggerOnce: true 1424 }); 1425 const trackingDataRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(trackingData); 1426 trackingDataRef.current = trackingData; 1427 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 1428 if (enabled && inView && !tracked.current) { 1429 tracked.current = true; 1430 (0,_libraries_modules_tracking_helpers__WEBPACK_IMPORTED_MODULE_1__.trackModuleImpression)(trackingDataRef.current); 1431 } 1432 }, [enabled, inView]); 1433 return ref; 1434} 1435 1436 1437/***/ }), 1438
1439/***/ "./scripts/react/shared/hooks/useScheduledMatchRefetch.js": 1440/*!****************************************************************!*\ 1441 !*** ./scripts/react/shared/hooks/useScheduledMatchRefetch.js ***! 1442 \****************************************************************/ 1443/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 1444 1445__webpack_require__.r(__webpack_exports__); 1446/* harmony export */ __webpack_require__.d(__webpack_exports__, { 1447/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 1448/* harmony export */ }); 1449/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./.yarn/cache/react-npm-17.0.1-98658812fc-23ada2f8fe.zip/node_modules/react/index.js"); 1450/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/parseISO/index.js"); 1451/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/isValid/index.js"); 1452/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/subMinutes/index.js"); 1453/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/differenceInMilliseconds/index.js"); 1454/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/formatISO/index.js"); 1455/* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! date-fns */ "./.yarn/cache/date-fns-npm-2.29.2-da48c27e93-0ac440a105.zip/node_modules/date-fns/esm/differenceInMinutes/index.js"); 1456 1457 1458const useScheduledMatchRefetch = ({ 1459 matchDate, 1460 minutesBefore = 60, 1461 queryKey, 1462 queryClient, 1463 enabled = true, 1464 onSchedule, 1465 onRefetch 1466}) => { 1467 const refetchTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); 1468 const scheduledTimeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); 1469 if (!queryClient && enabled) { 1470 console.warn("useScheduledMatchRefetch: queryClient is required when enabled is true"); 1471 return { scheduledTime: null }; 1472 } 1473 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 1474 if (refetchTimeoutRef.current) { 1475 clearTimeout(refetchTimeoutRef.current); 1476 refetchTimeoutRef.current = null; 1477 scheduledTimeRef.current = null; 1478 } 1479 if (!enabled || !matchDate) 1480 return; 1481 let matchTime; 1482 try { 1483 matchTime = matchDate instanceof Date ? matchDate : (0,date_fns__WEBPACK_IMPORTED_MODULE_1__["default"])(matchDate); 1484 } catch (error) { 1485 console.error("Error parsing match date:", error); 1486 return; 1487 } 1488 const now = /* @__PURE__ */ new Date(); 1489 if (!(0,date_fns__WEBPACK_IMPORTED_MODULE_2__["default"])(matchTime)) { 1490 console.warn("Invalid match date provided to useScheduledMatchRefetch:", matchDate); 1491 return; 1492 } 1493 const scheduledRefetchTime = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(matchTime, minutesBefore); 1494 scheduledTimeRef.current = scheduledRefetchTime; 1495 const timeUntilRefetch = (0,date_fns__WEBPACK_IMPORTED_MODULE_4__["default"])(scheduledRefetchTime, now); 1496 const ONE_HOUR_MS = 36e5; 1497 if (timeUntilRefetch > 0 && timeUntilRefetch <= ONE_HOUR_MS) { 1498 console.log(`Match time: ${(0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(matchTime)}`); 1499 console.log(`Scheduling refetch for: ${(0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(scheduledRefetchTime)}, in ${(0,date_fns__WEBPACK_IMPORTED_MODULE_6__["default"])(scheduledRefetchTime, now)} minutes`); 1500 console.log(`Time until refetch: ${timeUntilRefetch}ms (${timeUntilRefetch / 6e4} minutes)`); 1501 onSchedule?.({ 1502 matchTime, 1503 scheduledRefetchTime, 1504 timeUntilRefetch 1505 }); 1506 refetchTimeoutRef.current = setTimeout(() => { 1507 console.log("Executing scheduled refetch"); 1508 if (queryKey) {
1509 queryClient.invalidateQueries(queryKey); 1510 } 1511 onRefetch?.(); 1512 scheduledTimeRef.current = null; 1513 refetchTimeoutRef.current = null; 1514 }, timeUntilRefetch); 1515 } else if (timeUntilRefetch > ONE_HOUR_MS) { 1516 console.log(`Match is more than an hour away (${timeUntilRefetch / 6e4} minutes), not scheduling refetch yet`); 1517 } else { 1518 console.log(`Scheduled refetch time (${(0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(scheduledRefetchTime)}) is in the past, not scheduling`); 1519 } 1520 return () => { 1521 if (refetchTimeoutRef.current) { 1522 clearTimeout(refetchTimeoutRef.current); 1523 refetchTimeoutRef.current = null; 1524 } 1525 }; 1526 }, [matchDate, minutesBefore, queryKey, enabled, queryClient, onSchedule, onRefetch]); 1527 return { 1528 scheduledTime: scheduledTimeRef.current 1529 }; 1530}; 1531/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useScheduledMatchRefetch); 1532 1533 1534/***/ })
1534 1535 1536}]); 1537//# sourceMappingURL=mls-priority-match-app.js.map?_t=666b2ffcb6279910201d
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.