1"use strict"; 2(self["webpackChunk_mlssoccer_netcore"] = self["webpackChunk_mlssoccer_netcore"] || []).push([["scripts_react_shared_components_Picture_index_js-scripts_react_shared_containers_ReactApp_index_js"],{ 3
4/***/ "./scripts/react/shared/api/geoLocationEndpoints.js": 5/*!**********************************************************!*\ 6 !*** ./scripts/react/shared/api/geoLocationEndpoints.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 */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 13/* harmony export */ }); 14const geoLocationEndpoints = { 15 baseUrl: "https://mlssoccer.com", 16 geolocation: "/api/v1/geolocation" 17}; 18/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (geoLocationEndpoints); 19 20 21/***/ }), 22
23/***/ "./scripts/react/shared/components/Image/Image.js": 24/*!********************************************************!*\ 25 !*** ./scripts/react/shared/components/Image/Image.js ***! 26 \********************************************************/ 27/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 28 29__webpack_require__.r(__webpack_exports__); 30/* harmony export */ __webpack_require__.d(__webpack_exports__, { 31/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 32/* harmony export */ }); 33/* 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"); 34/* harmony import */ var react_image__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-image */ "./.yarn/__virtual__/react-image-virtual-7ff7d10ba4/0/cache/react-image-npm-4.1.0-4197c12852-825649bd71.zip/node_modules/react-image/umd/index.js"); 35/* harmony import */ var react_image__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_image__WEBPACK_IMPORTED_MODULE_1__); 36 37 38function Image({ src, title, extraClasses, ...otherProps }) { 39 const { src: composedSrc, error } = (0,react_image__WEBPACK_IMPORTED_MODULE_1__.useImage)({ 40 srcList: src 41 }); 42 const renderEmptyAltAttr = otherProps.hasOwnProperty("role") && otherProps.role === "presentation"; 43 if (error) { 44 throw new Error(`image error: ${error}`); 45 } 46 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 47 "img", 48 { 49 className: `img-responsive ${extraClasses ? extraClasses : ""}`, 50 alt: renderEmptyAltAttr ? "" : title ? title : "image unavailable", 51 ...otherProps, 52 src: composedSrc 53 } 54 ); 55} 56/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Image); 57 58 59/***/ }), 60
61/***/ "./scripts/react/shared/components/Image/index.js": 62/*!********************************************************!*\ 63 !*** ./scripts/react/shared/components/Image/index.js ***! 64 \********************************************************/ 65/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 66 67__webpack_require__.r(__webpack_exports__); 68/* harmony export */ __webpack_require__.d(__webpack_exports__, { 69/* harmony export */ "default": () => (/* reexport safe */ _Image__WEBPACK_IMPORTED_MODULE_0__["default"]) 70/* harmony export */ }); 71/* harmony import */ var _Image__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Image */ "./scripts/react/shared/components/Image/Image.js"); 72 73 74 75/***/ }), 76
77/***/ "./scripts/react/shared/components/Picture/Picture.js": 78/*!************************************************************!*\ 79 !*** ./scripts/react/shared/components/Picture/Picture.js ***! 80 \************************************************************/ 81/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 82 83__webpack_require__.r(__webpack_exports__); 84/* harmony export */ __webpack_require__.d(__webpack_exports__, { 85/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 86/* harmony export */ }); 87/* 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"); 88/* harmony import */ var _Image__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Image */ "./scripts/react/shared/components/Image/index.js"); 89/* harmony import */ var react_error_boundary__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-error-boundary */ "./.yarn/__virtual__/react-error-boundary-virtual-1d3c98507c/0/cache/react-error-boundary-npm-3.1.4-2310dba89e-7418637bf3.zip/node_modules/react-error-boundary/dist/react-error-boundary.umd.js"); 90/* harmony import */ var react_error_boundary__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_error_boundary__WEBPACK_IMPORTED_MODULE_2__); 91 92 93 94const Picture = ({ src, title, extraClasses, fallbackSrc = "/assets/images/Fallbacklogo-grey.png", loadingSrc = "/assets/images/Fallbacklogo-grey.png", ...otherProps }) => { 95 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("picture", null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Suspense, { fallback: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", { src: loadingSrc, className: `${otherProps.className} img-responsive mls-o-loading mls-o-loading--glow`, alt: `${title}-loading`, ...otherProps }) }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 96 react_error_boundary__WEBPACK_IMPORTED_MODULE_2__.ErrorBoundary, 97 { 98 fallback: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement("img", { src: fallbackSrc, className: `${otherProps.className} img-responsive`, alt: `${title ? title : "fallback"}`, ...otherProps }) 99 }, 100 src ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Image__WEBPACK_IMPORTED_MODULE_1__["default"], { src, title, extraClasses, ...otherProps }) : null 101 ))); 102}; 103/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Picture); 104 105 106/***/ }), 107
108/***/ "./scripts/react/shared/components/Picture/index.js": 109/*!**********************************************************!*\ 110 !*** ./scripts/react/shared/components/Picture/index.js ***! 111 \**********************************************************/ 112/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 113 114__webpack_require__.r(__webpack_exports__); 115/* harmony export */ __webpack_require__.d(__webpack_exports__, { 116/* harmony export */ "default": () => (/* reexport safe */ _Picture__WEBPACK_IMPORTED_MODULE_0__["default"]) 117/* harmony export */ }); 118/* harmony import */ var _Picture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Picture */ "./scripts/react/shared/components/Picture/Picture.js"); 119 120 121 122/***/ }), 123
124/***/ "./scripts/react/shared/containers/ReactApp/MatchHandler.js": 125/*!******************************************************************!*\ 126 !*** ./scripts/react/shared/containers/ReactApp/MatchHandler.js ***! 127 \******************************************************************/ 128/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 129 130__webpack_require__.r(__webpack_exports__); 131/* harmony export */ __webpack_require__.d(__webpack_exports__, { 132/* harmony export */ "dateWithBeforeAndAfter": () => (/* binding */ dateWithBeforeAndAfter), 133/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), 134/* harmony export */ "parseDateWithBeforeAndAfter": () => (/* binding */ parseDateWithBeforeAndAfter) 135/* harmony export */ }); 136/* 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"); 137/* 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"); 138/* 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"); 139/* 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"); 140/* 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"); 141/* 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"); 142/* 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"); 143/* harmony import */ var _hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../hooks/useScheduledMatchRefetch */ "./scripts/react/shared/hooks/useScheduledMatchRefetch.js"); 144/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./scripts/react/shared/containers/utils.js"); 145/* harmony import */ var _api_variables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../api/variables */ "./scripts/react/shared/api/variables.js"); 146/* harmony import */ var _api_fetching__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../api/fetching */ "./scripts/react/shared/api/fetching.js"); 147/* harmony import */ var _mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../mls-horizontal-scoreboard/utils */ "./scripts/react/mls-horizontal-scoreboard/utils.js"); 148/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 149/* 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"); 150 151 152 153 154 155 156 157 158 159 160function MatchHandler({ children, queryClient }) { 161 const { apiList } = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.useReactAppState)(); 162 const { forgeMatchDate, matchSportecId, seasonSportecId } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 163 return { 164 forgeMatchDate: window?.forgeVariables?.match?.matchDateTime, 165 matchSportecId: window?.forgeVariables?.match?.sportecId, 166 seasonSportecId: window?.forgeVariables?.match?.season 167 }; 168 }, []); 169 const { from, to } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => { 170 const { dayBefore: from2, dayAfter: to2 } = parseDateWithBeforeAndAfter( 171 forgeMatchDate 172 ); 173 return { from: from2, to: to2 }; 174 }, [forgeMatchDate]); 175 const { data: mlsMatch, isError: mlsMatchError } = (0,_mls_match_list_hooks_useMLSMatch__WEBPACK_IMPORTED_MODULE_7__["default"])({ 176 matchSportecId 177 }); 178 const mlsMatchesEndpoint = (0,_api_variables__WEBPACK_IMPORTED_MODULE_3__.mlsGetMatches)({ from, to, seasonSportecId }); 179 const { data: mlsMatchByDate } = (0,react_query__WEBPACK_IMPORTED_MODULE_8__.useQuery)({ 180 queryKey: ["mls-matches-date-range", { from, to }], 181 queryFn: () => (0,_api_fetching__WEBPACK_IMPORTED_MODULE_4__.fetchClient)({ endpoint: mlsMatchesEndpoint, apiURL: apiList?.statsAPI }), 182 refetchOnWindowFocus: false, 183 select: (response) => { 184 if (response?.schedule) { 185 const sortedMatches = [ 186 ...response?.schedule?.sort( 187 (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) 188 ) 189 ]; 190 const matches = (0,_mls_horizontal_scoreboard_utils__WEBPACK_IMPORTED_MODULE_5__.formatStatsAPIMatches)( 191 (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_6__.filterMlsMatchesByCompetitionsToSkip)(sortedMatches) 192 ); 193 const match = matches.find( 194 (match2) => match2.match_id === matchSportecId 195 ); 196 if (match) { 197 return match; 198 } 199 } 200 return []; 201 }, 202 enabled: !!from && !!to && mlsMatchError, 203 staleTime: Infinity 204 }); 205 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
206 if (mlsMatchError && mlsMatchByDate) { 207 queryClient.setQueryData(["mls-match", matchSportecId], mlsMatchByDate); 208 } 209 }, [mlsMatchByDate, matchSportecId, mlsMatchError]); 210 (0,_hooks_useScheduledMatchRefetch__WEBPACK_IMPORTED_MODULE_1__["default"])({ 211 matchDate: mlsMatchByDate?.planned_kickoff_time, 212 minutesBefore: 60, 213 // 1 hour before match 214 queryKey: ["mls-match", matchSportecId], 215 queryClient, 216 enabled: !!mlsMatchError && !!mlsMatchByDate?.planned_kickoff_time, 217 onSchedule: ({ scheduledRefetchTime }) => { 218 console.log( 219 `MatchHandler scheduled refetch for match ${matchSportecId} at ${scheduledRefetchTime.toLocaleString()}` 220 ); 221 }, 222 onRefetch: () => { 223 console.log(`MatchHandler executing refetch for match ${matchSportecId}`); 224 } 225 }); 226 return mlsMatchByDate || mlsMatch ? children : null; 227} 228const parseDateWithBeforeAndAfter = (dateTimeString) => { 229 const [dateString] = dateTimeString.split(" "); 230 const parsedDate = (0,date_fns__WEBPACK_IMPORTED_MODULE_10__["default"])(dateString, "MM/dd/yyyy", /* @__PURE__ */ new Date()); 231 const dayBefore = (0,date_fns__WEBPACK_IMPORTED_MODULE_11__["default"])(parsedDate, 1); 232 const dayAfter = (0,date_fns__WEBPACK_IMPORTED_MODULE_12__["default"])(parsedDate, 1); 233 return { 234 originalDate: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(parsedDate, "yyyy-MM-dd"), 235 dayBefore: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayBefore, "yyyy-MM-dd"), 236 dayAfter: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayAfter, "yyyy-MM-dd") 237 }; 238}; 239const dateWithBeforeAndAfter = (date) => { 240 const dayBefore = (0,date_fns__WEBPACK_IMPORTED_MODULE_11__["default"])(date, 1); 241 const dayAfter = (0,date_fns__WEBPACK_IMPORTED_MODULE_12__["default"])(date, 1); 242 return { 243 originalDate: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(date, "yyyy-MM-dd"), 244 dayBefore: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayBefore, "yyyy-MM-dd"), 245 dayAfter: (0,date_fns__WEBPACK_IMPORTED_MODULE_13__["default"])(dayAfter, "yyyy-MM-dd") 246 }; 247}; 248/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MatchHandler); 249 250 251/***/ }), 252
253/***/ "./scripts/react/shared/containers/ReactApp/ReactApp.js": 254/*!**************************************************************!*\ 255 !*** ./scripts/react/shared/containers/ReactApp/ReactApp.js ***! 256 \**************************************************************/ 257/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 258 259__webpack_require__.r(__webpack_exports__); 260/* harmony export */ __webpack_require__.d(__webpack_exports__, { 261/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 262/* harmony export */ }); 263/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_7__ = __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"); 264/* 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"); 265/* harmony import */ var react_query_devtools__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-query/devtools */ "./.yarn/__virtual__/react-query-virtual-cd72c42dd3/0/cache/react-query-npm-3.12.0-415d3b7722-bd1075ac15.zip/node_modules/react-query/devtools/index.js"); 266/* harmony import */ var _libraries_helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../libraries/_helpers */ "./scripts/libraries/_helpers/index.js"); 267/* harmony import */ var _ReactDataLayer_ReactDataLayer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../ReactDataLayer/ReactDataLayer */ "./scripts/react/shared/containers/ReactDataLayer/ReactDataLayer.js"); 268/* harmony import */ var _hooks_useMedia__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../hooks/useMedia */ "./scripts/react/shared/hooks/useMedia.js"); 269/* harmony import */ var _api_variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../api/variables */ "./scripts/react/shared/api/variables.js"); 270/* harmony import */ var _MatchHandler__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./MatchHandler */ "./scripts/react/shared/containers/ReactApp/MatchHandler.js"); 271 272 273 274 275 276 277 278 279function ReactApp({ children, queryClient, queryParams }) { 280 const { enableQueryTools } = queryParams || {}; 281 const forgeVariables = (0,_api_variables__WEBPACK_IMPORTED_MODULE_5__.composeForgeVariables)() || {}; 282 const { screenMediumLargeMin, screenMediumMin, screenXLargeMin, screenLargeMin } = _libraries_helpers__WEBPACK_IMPORTED_MODULE_2__.mediaQueries; 283 const mediaQueriesSizes = { 284 isXLargeMin: (0,_hooks_useMedia__WEBPACK_IMPORTED_MODULE_4__.useMedia)(screenXLargeMin), 285 isMediumLargeMin: (0,_hooks_useMedia__WEBPACK_IMPORTED_MODULE_4__.useMedia)(screenMediumLargeMin), 286 isMediumMin: (0,_hooks_useMedia__WEBPACK_IMPORTED_MODULE_4__.useMedia)(screenMediumMin), 287 isLargeMin: (0,_hooks_useMedia__WEBPACK_IMPORTED_MODULE_4__.useMedia)(screenLargeMin) 288 }; 289 const hasMatchSportecId = !!window?.forgeVariables?.match?.sportecId; 290 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_query__WEBPACK_IMPORTED_MODULE_7__.QueryClientProvider, { client: queryClient }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ReactDataLayer_ReactDataLayer__WEBPACK_IMPORTED_MODULE_3__["default"], { queryClient, mediaQueries: mediaQueriesSizes, queryParams, forgeVariables }, hasMatchSportecId ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(_MatchHandler__WEBPACK_IMPORTED_MODULE_6__["default"], { queryClient }, children) : children), enableQueryTools?.[0] === "true" ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(react_query_devtools__WEBPACK_IMPORTED_MODULE_1__.ReactQueryDevtools, { initialIsOpen: false }) : null); 291} 292ReactApp = react__WEBPACK_IMPORTED_MODULE_0__.memo(ReactApp); 293/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactApp); 294 295 296/***/ }), 297
298/***/ "./scripts/react/shared/containers/ReactApp/index.js": 299/*!***********************************************************!*\ 300 !*** ./scripts/react/shared/containers/ReactApp/index.js ***! 301 \***********************************************************/ 302/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 303 304__webpack_require__.r(__webpack_exports__); 305/* harmony export */ __webpack_require__.d(__webpack_exports__, { 306/* harmony export */ "default": () => (/* reexport safe */ _ReactApp__WEBPACK_IMPORTED_MODULE_0__["default"]) 307/* harmony export */ }); 308/* harmony import */ var _ReactApp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ReactApp */ "./scripts/react/shared/containers/ReactApp/ReactApp.js"); 309 310 311 312/***/ }), 313
314/***/ "./scripts/react/shared/containers/ReactDataLayer/ReactDataLayer.js": 315/*!**************************************************************************!*\ 316 !*** ./scripts/react/shared/containers/ReactDataLayer/ReactDataLayer.js ***! 317 \**************************************************************************/ 318/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 319 320__webpack_require__.r(__webpack_exports__); 321/* harmony export */ __webpack_require__.d(__webpack_exports__, { 322/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 323/* harmony export */ }); 324/* 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"); 325/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_10__ = __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"); 326/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react-i18next */ "./.yarn/__virtual__/react-i18next-virtual-c6e07a7a20/0/cache/react-i18next-npm-11.18.5-8f01b083c5-6910d31401.zip/node_modules/react-i18next/dist/es/useTranslation.js"); 327/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./scripts/react/shared/containers/utils.js"); 328/* harmony import */ var _shared_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../shared/i18n */ "./scripts/react/shared/i18n.js"); 329/* harmony import */ var _hooks_useModalOptions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../hooks/useModalOptions */ "./scripts/react/shared/hooks/useModalOptions.js"); 330/* harmony import */ var _mls_match_list_components_MatchModal_MatchModal__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../mls-match-list/components/MatchModal/MatchModal */ "./scripts/react/mls-match-list/components/MatchModal/MatchModal.js"); 331/* harmony import */ var _mls_match_list_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../mls-match-list/utils */ "./scripts/react/mls-match-list/utils.js"); 332/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils */ "./scripts/react/shared/utils.js"); 333/* harmony import */ var _api_fetching__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../api/fetching */ "./scripts/react/shared/api/fetching.js"); 334/* harmony import */ var _api_geoLocationEndpoints__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../api/geoLocationEndpoints */ "./scripts/react/shared/api/geoLocationEndpoints.js"); 335 336 337 338 339 340 341 342 343 344 345 346function ReactDataLayer({ forgeVariables, children, mediaQueries, queryParams, queryClient }) { 347 const { t, ready } = (0,react_i18next__WEBPACK_IMPORTED_MODULE_9__.useTranslation)(); 348 const { period } = queryParams || {}; 349 const matchStatusOverride = period?.[0] ? (0,_mls_match_list_utils__WEBPACK_IMPORTED_MODULE_5__.composeMatchStatus)({ period: period?.[0] }) : null; 350 const { status: locationStatus, data: location } = (0,react_query__WEBPACK_IMPORTED_MODULE_10__.useQuery)({ 351 queryKey: [`geolocation`], 352 queryFn: () => (0,_api_fetching__WEBPACK_IMPORTED_MODULE_7__.fetchClient)({ apiURL: _api_geoLocationEndpoints__WEBPACK_IMPORTED_MODULE_8__["default"].baseUrl, endpoint: _api_geoLocationEndpoints__WEBPACK_IMPORTED_MODULE_8__["default"].geolocation }) 353 }); 354 const { state, Component, Modal, updateModalOptions } = (0,_hooks_useModalOptions__WEBPACK_IMPORTED_MODULE_3__.useModalOptions)({ 355 initialState: { 356 label: "match modal", 357 component: _mls_match_list_components_MatchModal_MatchModal__WEBPACK_IMPORTED_MODULE_4__["default"], 358 modalType: _hooks_useModalOptions__WEBPACK_IMPORTED_MODULE_3__.modalTypes.animated 359 } 360 }); 361 const [isRecentGoal, setIsRecentGoal] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false); 362 const [roleType, setRoleType] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(_utils__WEBPACK_IMPORTED_MODULE_6__.roleTypes.clubs); 363 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 364 if (roleType === _utils__WEBPACK_IMPORTED_MODULE_6__.roleTypes.clubs) { 365 document.querySelectorAll("section[data-toggle=players]").forEach((item) => item.style.display = "none"); 366 document.querySelectorAll("section[data-toggle=clubs]").forEach((item) => item.style.display = "block"); 367 } else { 368 document.querySelectorAll("section[data-toggle=clubs]").forEach((item) => item.style.display = "none"); 369 document.querySelectorAll("section[data-toggle=players]").forEach((item) => item.style.display = "block"); 370 } 371 return () => { 372 document.querySelectorAll("section[data-toggle=players]").forEach((item) => item.style.display = "block"); 373 document.querySelectorAll("section[data-toggle=clubs]").forEach((item) => item.style.display = "block"); 374 }; 375 }, [roleType]); 376 const { show, modalData, label, modalClassName } = state || {}; 377 return locationStatus === _utils__WEBPACK_IMPORTED_MODULE_6__.queryStatusTypes.loading || !ready ? null : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 378 _utils__WEBPACK_IMPORTED_MODULE_1__.ReactAppState.Provider, 379 { 380 value: { 381 ...forgeVariables, 382 mediaQueries, 383 queryParams, 384 queryClient, 385 t, 386 updateModalOptions, 387 roles: { 388 roleType, 389 setRoleType 390 }, 391 matchStatusOverride, 392 recentGoal: { 393 isRecentGoal, 394 setIsRecentGoal 395 }, 396 location 397 } 398 }, 399 react__WEBPACK_IMPORTED_MODULE_0__.Children.map(children, (child) => { 400 return !child ? null : typeof child.type === "string" ? child : react__WEBPACK_IMPORTED_MODULE_0__.cloneElement(child); 401 }),
402 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement( 403 Modal, 404 { 405 className: modalClassName, 406 label: t(label), 407 isOpen: show, 408 onHide: () => updateModalOptions({ type: _hooks_useModalOptions__WEBPACK_IMPORTED_MODULE_3__.modalActionTypes.show, payload: false }) 409 }, 410 /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, { ...modalData, label: t(label), closeModal: () => updateModalOptions({ type: _hooks_useModalOptions__WEBPACK_IMPORTED_MODULE_3__.modalActionTypes.show, payload: false }) }) 411 ) 412 ); 413} 414ReactDataLayer = react__WEBPACK_IMPORTED_MODULE_0__.memo(ReactDataLayer); 415/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactDataLayer); 416 417 418/***/ }), 419
420/***/ "./scripts/react/shared/hooks/useMedia.js": 421/*!************************************************!*\ 422 !*** ./scripts/react/shared/hooks/useMedia.js ***! 423 \************************************************/ 424/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 425 426__webpack_require__.r(__webpack_exports__); 427/* harmony export */ __webpack_require__.d(__webpack_exports__, { 428/* harmony export */ "useMedia": () => (/* binding */ useMedia) 429/* harmony export */ }); 430/* 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"); 431 432function useMedia(query, initialState = false) { 433 const [state, setState] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(initialState); 434 react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => { 435 let mounted = true; 436 const mql = window.matchMedia(query); 437 function onChange() { 438 if (!mounted) { 439 return; 440 } 441 setState(Boolean(mql.matches)); 442 } 443 mql.addListener(onChange); 444 setState(mql.matches); 445 return () => { 446 mounted = false; 447 mql.removeListener(onChange); 448 }; 449 }, [query]); 450 return state; 451} 452 453 454/***/ }), 455
456/***/ "./scripts/react/shared/hooks/useScheduledMatchRefetch.js": 457/*!****************************************************************!*\ 458 !*** ./scripts/react/shared/hooks/useScheduledMatchRefetch.js ***! 459 \****************************************************************/ 460/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 461 462__webpack_require__.r(__webpack_exports__); 463/* harmony export */ __webpack_require__.d(__webpack_exports__, { 464/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 465/* harmony export */ }); 466/* 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"); 467/* 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"); 468/* 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"); 469/* 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"); 470/* 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"); 471/* 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"); 472/* 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"); 473 474 475const useScheduledMatchRefetch = ({ 476 matchDate, 477 minutesBefore = 60, 478 queryKey, 479 queryClient, 480 enabled = true, 481 onSchedule, 482 onRefetch 483}) => { 484 const refetchTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); 485 const scheduledTimeRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); 486 if (!queryClient && enabled) { 487 console.warn("useScheduledMatchRefetch: queryClient is required when enabled is true"); 488 return { scheduledTime: null }; 489 } 490 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { 491 if (refetchTimeoutRef.current) { 492 clearTimeout(refetchTimeoutRef.current); 493 refetchTimeoutRef.current = null; 494 scheduledTimeRef.current = null; 495 } 496 if (!enabled || !matchDate) 497 return; 498 let matchTime; 499 try { 500 matchTime = matchDate instanceof Date ? matchDate : (0,date_fns__WEBPACK_IMPORTED_MODULE_1__["default"])(matchDate); 501 } catch (error) { 502 console.error("Error parsing match date:", error); 503 return; 504 } 505 const now = /* @__PURE__ */ new Date(); 506 if (!(0,date_fns__WEBPACK_IMPORTED_MODULE_2__["default"])(matchTime)) { 507 console.warn("Invalid match date provided to useScheduledMatchRefetch:", matchDate); 508 return; 509 } 510 const scheduledRefetchTime = (0,date_fns__WEBPACK_IMPORTED_MODULE_3__["default"])(matchTime, minutesBefore); 511 scheduledTimeRef.current = scheduledRefetchTime; 512 const timeUntilRefetch = (0,date_fns__WEBPACK_IMPORTED_MODULE_4__["default"])(scheduledRefetchTime, now); 513 const ONE_HOUR_MS = 36e5; 514 if (timeUntilRefetch > 0 && timeUntilRefetch <= ONE_HOUR_MS) { 515 console.log(`Match time: ${(0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(matchTime)}`); 516 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`); 517 console.log(`Time until refetch: ${timeUntilRefetch}ms (${timeUntilRefetch / 6e4} minutes)`); 518 onSchedule?.({ 519 matchTime, 520 scheduledRefetchTime, 521 timeUntilRefetch 522 }); 523 refetchTimeoutRef.current = setTimeout(() => { 524 console.log("Executing scheduled refetch"); 525 if (queryKey) {
526 queryClient.invalidateQueries(queryKey); 527 } 528 onRefetch?.(); 529 scheduledTimeRef.current = null; 530 refetchTimeoutRef.current = null; 531 }, timeUntilRefetch); 532 } else if (timeUntilRefetch > ONE_HOUR_MS) { 533 console.log(`Match is more than an hour away (${timeUntilRefetch / 6e4} minutes), not scheduling refetch yet`); 534 } else { 535 console.log(`Scheduled refetch time (${(0,date_fns__WEBPACK_IMPORTED_MODULE_5__["default"])(scheduledRefetchTime)}) is in the past, not scheduling`); 536 } 537 return () => { 538 if (refetchTimeoutRef.current) { 539 clearTimeout(refetchTimeoutRef.current); 540 refetchTimeoutRef.current = null; 541 } 542 }; 543 }, [matchDate, minutesBefore, queryKey, enabled, queryClient, onSchedule, onRefetch]); 544 return { 545 scheduledTime: scheduledTimeRef.current 546 }; 547}; 548/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useScheduledMatchRefetch); 549 550 551/***/ }), 552
553/***/ "./scripts/react/shared/i18n.js": 554/*!**************************************!*\ 555 !*** ./scripts/react/shared/i18n.js ***! 556 \**************************************/ 557/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 558 559__webpack_require__.r(__webpack_exports__); 560/* harmony export */ __webpack_require__.d(__webpack_exports__, { 561/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 562/* harmony export */ }); 563/* harmony import */ var i18next__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! i18next */ "./.yarn/cache/i18next-npm-19.9.2-de8338ce18-a3b8da898e.zip/node_modules/i18next/dist/esm/i18next.js"); 564/* harmony import */ var i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! i18next-browser-languagedetector */ "./.yarn/cache/i18next-browser-languagedetector-npm-6.1.5-8aa079e608-d8bd6e6edc.zip/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetector.js"); 565/* harmony import */ var i18next_http_backend__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! i18next-http-backend */ "./.yarn/cache/i18next-http-backend-npm-1.4.1-a181b66ab1-1675725110.zip/node_modules/i18next-http-backend/esm/index.js"); 566/* harmony import */ var react_i18next__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-i18next */ "./.yarn/__virtual__/react-i18next-virtual-c6e07a7a20/0/cache/react-i18next-npm-11.18.5-8f01b083c5-6910d31401.zip/node_modules/react-i18next/dist/es/context.js"); 567 568 569 570 571const backendOptions = { 572 loadPath: location.origin + "/vocabs/{{lng}}" 573}; 574i18next__WEBPACK_IMPORTED_MODULE_0__["default"].use(i18next_browser_languagedetector__WEBPACK_IMPORTED_MODULE_1__["default"]).use(i18next_http_backend__WEBPACK_IMPORTED_MODULE_2__["default"]).use(react_i18next__WEBPACK_IMPORTED_MODULE_3__.initReactI18next).init({ 575 react: { 576 useSuspense: false, 577 wait: false 578 }, 579 initImmediate: false, 580 lng: window?.forgeVariables?.currentSite?.culture ? window.forgeVariables?.currentSite.culture : "en-US", 581 fallbackLng: "en-US", 582 interpolation: { 583 escapeValue: false 584 }, 585 debug: true, 586 backend: backendOptions, 587 keySeparator: true 588}); 589/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (i18next__WEBPACK_IMPORTED_MODULE_0__["default"]); 590 591 592/***/ })
592 593 594}]); 595//# sourceMappingURL=scripts_react_shared_components_Picture_index_js-scripts_react_shared_containers_ReactApp_index_js.js.map?_t=5e47bd4b4d392d36a504
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.