123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- exports.id = 12951;
- exports.ids = [12951];
- exports.modules = {
- /***/ 22817:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
- var _path;
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
- var SvgRetry = function SvgRetry(props) {
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
- width: 15,
- height: 15,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg"
- }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
- d: "M1.85 7.5c0-2.835 2.21-5.65 5.65-5.65 2.778 0 4.152 2.056 4.737 3.15H10.5a.5.5 0 0 0 0 1h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-1 0v1.813C12.296 3.071 10.666.85 7.5.85 3.437.85.85 4.185.85 7.5c0 3.315 2.587 6.65 6.65 6.65 1.944 0 3.562-.77 4.714-1.942a6.77 6.77 0 0 0 1.428-2.167.5.5 0 1 0-.925-.38 5.77 5.77 0 0 1-1.216 1.846c-.971.99-2.336 1.643-4.001 1.643-3.44 0-5.65-2.815-5.65-5.65Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })));
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgRetry);
- /***/ }),
- /***/ 23769:
- /***/ ((module) => {
- // Exports
- module.exports = {
- "container": "Error_container__1m9XV",
- "text": "Error_text__yg4kD"
- };
- /***/ }),
- /***/ 12951:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var swr_immutable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(79847);
- /* harmony import */ var _components_Error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4233);
- /* harmony import */ var _dls_Spinner_Spinner__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7190);
- /* harmony import */ var src_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92684);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([swr_immutable__WEBPACK_IMPORTED_MODULE_2__, _components_Error__WEBPACK_IMPORTED_MODULE_3__]);
- ([swr_immutable__WEBPACK_IMPORTED_MODULE_2__, _components_Error__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
- /**
- * Data fetcher is a dynamic component that serves as a container for a component
- * that depends on data from a remote API to render. This component handles:
- * 1. Calling the API.
- * 2. Caching the response (due to using useSwr).
- * 3. Handling errors if any by showing an error message.
- * 4. Handling when the user is offline while trying to fetch the API response.
- * 5. Dynamically passing the response data through render-props to the parent.
- *
- * @param {Props} props
- * @returns {JSX.Element}
- */ const DataFetcher = ({ queryKey , render , renderError , initialData , loading =()=>/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Spinner_Spinner__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {}) , fetcher: dataFetcher = src_api__WEBPACK_IMPORTED_MODULE_5__/* .fetcher */ ._i , showSpinnerOnRevalidate =true , onFetchSuccess })=>{
- const { data , error , isValidating , mutate } = (0,swr_immutable__WEBPACK_IMPORTED_MODULE_2__["default"])(queryKey, ()=>dataFetcher(queryKey).then((res)=>{
- onFetchSuccess?.(res);
- return Promise.resolve(res);
- }).catch((err)=>Promise.reject(err)), {
- fallbackData: initialData
- });
- // if showSpinnerOnRevalidate is true, we should show the spinner if we are revalidating the data.
- // otherwise, we should only show the spinner on initial loads.
- if (showSpinnerOnRevalidate ? isValidating : isValidating && !data) {
- return loading();
- }
- const onRetryClicked = ()=>{
- mutate();
- };
- /**
- * if we haven't fetched the data yet and the device is not online (because we don't want to show an offline message if the data already exists).
- * or if we had an error when calling the API.
- */ if (error) {
- // if there is a custom error renderer, use it.
- if (renderError) {
- const errorComponent = renderError(error);
- // if the custom error renderer returns false, it means that it doesn't want to render anything special.
- if (typeof errorComponent !== "undefined") {
- return errorComponent;
- }
- }
- return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_Error__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
- onRetryClicked: onRetryClicked,
- error: error
- });
- }
- return render(data);
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.memo)(DataFetcher));
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ }),
- /***/ 4233:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(60866);
- /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _Error_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(23769);
- /* harmony import */ var _Error_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_Error_module_scss__WEBPACK_IMPORTED_MODULE_6__);
- /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(50497);
- /* harmony import */ var _icons_retry_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(22817);
- /* harmony import */ var src_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92684);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__]);
- _dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
- const Error = ({ onRetryClicked , error })=>{
- const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_2___default()("common");
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
- className: (_Error_module_scss__WEBPACK_IMPORTED_MODULE_6___default().container),
- children: [
- /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
- className: (_Error_module_scss__WEBPACK_IMPORTED_MODULE_6___default().text),
- children: error.message !== src_api__WEBPACK_IMPORTED_MODULE_5__/* .OFFLINE_ERROR */ .yH ? t("error.general") : t("error.offline")
- }),
- /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .ZP, {
- prefix: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_retry_svg__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {}),
- size: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__/* .ButtonSize.Small */ .qE.Small,
- type: _dls_Button_Button__WEBPACK_IMPORTED_MODULE_3__/* .ButtonType.Secondary */ .L$.Secondary,
- onClick: onRetryClicked,
- children: t("retry")
- })
- ]
- });
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Error);
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ })
- };
- ;
- //# sourceMappingURL=12951.js.map
|