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SAAU,aAC9G,UAAY,SAAW,IAE1C,EAAqB,SAAUhE,GAC/B,IAAIkB,EAAelB,EAAGkB,aAAca,EAAW/B,EAAG+B,SAAUoB,EAAaZ,EAAOvC,EAAI,CAAC,eAAgB,aACrG,OAAQ,SAAK,MAAOhB,EAAS,CAAE6D,UAAW,2BAA6B,CAAEd,UAAU,UAAM,IAAU/C,EAAS,GAAImE,EAAY,CAAEpB,SAAU,CAACA,EAAUb,IAAiB,SAAK,MAAOlC,EAAS,CAAE6D,UAAW,QAAU,CAAEd,UAAU,SAAKuB,EAAA,EAAW,QAAI,UAAY,WAAc,UAAY","sources":["webpack://ucn/./src/react/components/modules/FavoriteCollection/FavoriteCollection.tsx","webpack://ucn/./src/react/components/modules/FavoriteCollection/useFavoriteCollection.ts","webpack://ucn/./src/react/components/primitives/Collection/CollectionFilters/CollectionFilters.tsx","webpack://ucn/./src/react/components/ui/Collection/Collection.tsx","webpack://ucn/./src/react/components/ui/Cards/getCardTypeByAlias.ts"],"sourcesContent":["var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport \"./styles.scss\";\nimport { useFavoriteCollection } from \"@react-components/modules/FavoriteCollection/useFavoriteCollection\";\nimport { favoriteCookieService } from \"@services/favorites/favorite-cookie-service\";\nimport { CollectionEntries, CollectionLoadMore, CollectionRoot, } from \"@react-components/ui/Collection/Collection\";\nimport { CardTypes } from \"@react-components/ui/Cards/card-types\";\nvar FavoriteCollection = function (_a) {\n var _b, _c;\n var dictionary = _a.dictionary;\n var _d = useFavoriteCollection((_c = (_b = favoriteCookieService.get()) === null || _b === void 0 ? void 0 : _b.collection) !== null && _c !== void 0 ? _c : []), favoriteCollection = _d.favoriteCollection, isLastPage = _d.isLastPage, error = _d.error, setSize = _d.setSize, isValidating = _d.isValidating;\n if (error) {\n console.log({ error: error });\n return null;\n }\n if (!favoriteCollection)\n return null;\n return (_jsxs(CollectionRoot, { children: [_jsx(CollectionEntries, { keyPrefix: \"favorite-collection\", collection: favoriteCollection.flatMap(function (x) { return x.pagedCollection; }), defaultCardType: CardTypes.FavoriteCard }, void 0), _jsx(CollectionLoadMore, __assign({ disable: isLastPage, isValidating: isValidating, onClick: function () { return !isLastPage && setSize(function (size) { return size + 1; }); } }, { children: (dictionary === null || dictionary === void 0 ? void 0 : dictionary.loadMore) && (dictionary === null || dictionary === void 0 ? void 0 : dictionary.loadMore) }), void 0)] }, void 0));\n};\nexport { FavoriteCollection };\n","import { apiFetcher } from \"@common/fetchers/api-fetcher\";\nimport { ENDPOINTS } from \"@common/constants/endpoints\";\nimport useSWRInfinite from \"swr/infinite\";\nimport { useMemo } from \"react\";\nvar PAGE_SIZE = 10;\nvar useFavoriteCollection = function (favorites) {\n var requestOptions = useMemo(function () { return ({\n method: \"POST\",\n body: JSON.stringify({ collection: favorites }),\n }); }, []);\n var getKey = function (pageIndex, previousPageData) {\n var _a;\n if (previousPageData && !((_a = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagedCollection) === null || _a === void 0 ? void 0 : _a.length))\n return null;\n if (!favorites || (favorites === null || favorites === void 0 ? void 0 : favorites.length) < 1)\n return null;\n return [\n ENDPOINTS.favorites + \"?pageNumber=\" + (pageIndex + 1) + \"&pageSize=\" + PAGE_SIZE,\n requestOptions,\n ];\n };\n var _a = useSWRInfinite(getKey, apiFetcher), data = _a.data, error = _a.error, isValidating = _a.isValidating, mutate = _a.mutate, size = _a.size, setSize = _a.setSize;\n return {\n favoriteCollection: data,\n isLastPage: !!(data === null || data === void 0 ? void 0 : data.find(function (x) { return !x.hasNextPage; })),\n error: error,\n isValidating: isValidating,\n mutate: mutate,\n size: size,\n setSize: setSize,\n };\n};\nexport { useFavoriteCollection };\n","import { Fragment as _Fragment, jsx as _jsx } from \"react/jsx-runtime\";\nvar CollectionFilters = function (_a) {\n var children = _a.children;\n return _jsx(_Fragment, { children: children }, void 0);\n};\nexport { CollectionFilters };\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport \"./styles.scss\";\nimport { CollectionRoot as Root } from \"@react-components/primitives/Collection/CollectionRoot/CollectionRoot\";\nimport { CollectionEntries as Entries } from \"@react-components/primitives/Collection/CollectionEntries/CollectionEntries\";\nimport { CollectionLoadMore as LoadMore } from \"@react-components/primitives/Collection/CollectionPagination/CollectionLoadMore/CollectionLoadMore\";\nimport { CollectionFilters as Filters } from \"@react-components/primitives/Collection/CollectionFilters/CollectionFilters\";\nimport { CardRenderer } from \"@react-components/ui/Cards/CardRenderer\";\nimport { DotLoader } from \"@react-components/ui/Loaders/DotLoader/DotLoader\";\nimport { getCardTypeByAlias } from \"@react-components/ui/Cards/getCardTypeByAlias\";\nimport { generateColumns, } from \"@react-common/helpers/generate-columns\";\nimport { useDictionaryContext } from \"@contexts/dictionary-context/useDictionaryContext\";\nvar CollectionRoot = function (_a) {\n var _b;\n var children = _a.children, columnSizes = _a.columnSizes;\n return (_jsx(Root, { children: _jsx(\"div\", __assign({ className: \"collection container\" }, { children: _jsx(\"div\", __assign({ className: \"row justify-content-center\" }, { children: _jsx(\"div\", __assign({ className: \"col-12\" }, { children: _jsx(\"div\", __assign({ className: \"collection__bg\" }, { children: _jsx(\"div\", __assign({ className: \"row justify-content-center\" }, { children: _jsx(\"div\", __assign({ className: ((_b = generateColumns(columnSizes)) !== null && _b !== void 0 ? _b : \"col-11 col-md-10\") + \" collection__column\" }, { children: _jsx(\"div\", __assign({ className: \"collection__container\" }, { children: children }), void 0) }), void 0) }), void 0) }), void 0) }), void 0) }), void 0) }), void 0) }, void 0));\n};\nvar CollectionEntries = function (_a) {\n var defaultCardType = _a.defaultCardType, collection = _a.collection, showLoader = _a.showLoader, renderEntry = _a.renderEntry, columnSizes = _a.columnSizes, totalCollectionSize = _a.totalCollectionSize, HeaderComponent = _a.renderEntryHeader, otherProps = __rest(_a, [\"defaultCardType\", \"collection\", \"showLoader\", \"renderEntry\", \"columnSizes\", \"totalCollectionSize\", \"renderEntryHeader\"]);\n var dictionary = useDictionaryContext().dictionary;\n return (_jsxs(\"div\", __assign({ className: \"row\" }, { children: [_jsx(\"div\", __assign({ className: \"col-12\" }, { children: _jsx(\"div\", __assign({ className: \"collection__total\" }, { children: HeaderComponent ? (_jsx(HeaderComponent, {}, void 0)) : (_jsxs(_Fragment, { children: [totalCollectionSize, \" \", dictionary.totalResultsCount] }, void 0)) }), void 0) }), void 0), showLoader ? (_jsx(\"div\", __assign({ className: \"col-12\" }, { children: _jsx(\"div\", __assign({ className: \"row justify-content-center\" }, { children: _jsx(DotLoader, { size: 12 }, void 0) }), void 0) }), void 0)) : (_jsx(Entries, __assign({ collection: collection !== null && collection !== void 0 ? collection : [], renderEntry: function (entry) {\n var _a;\n return (_jsx(\"div\", __assign({ className: ((_a = generateColumns(columnSizes)) !== null && _a !== void 0 ? _a : \"col-12 col-md-6 col-lg-4\") + \" collection__entry-wrap\" }, { children: renderEntry ? (renderEntry(entry)) : (_jsx(CardRenderer, { componentType: defaultCardType !== null && defaultCardType !== void 0 ? defaultCardType : getCardTypeByAlias(entry), imageWidth: [\n 576,\n 250,\n null,\n null,\n 308,\n 367,\n ], imageHeight: [\n 195,\n 195,\n null,\n null,\n 195,\n 195,\n ], useRatio: true, props: entry }, void 0)) }), void 0));\n } }, otherProps), void 0))] }), void 0));\n};\nvar CollectionFilters = function (_a) {\n var children = _a.children;\n return (_jsx(Filters, { children: _jsx(\"div\", __assign({ className: \"filters\" }, { children: _jsx(\"div\", __assign({ className: \"filters__row\" }, { children: React.Children.map(children, function (child) {\n return React.isValidElement(child) && (_jsx(\"div\", __assign({ className: \"filters__col\" }, { children: child }), void 0));\n }) }), void 0) }), void 0) }, void 0));\n};\nvar CollectionLoadMore = function (_a) {\n var isValidating = _a.isValidating, children = _a.children, otherProps = __rest(_a, [\"isValidating\", \"children\"]);\n return (_jsx(\"div\", __assign({ className: \"collection__button-wrap\" }, { children: _jsxs(LoadMore, __assign({}, otherProps, { children: [children, isValidating && (_jsx(\"div\", __assign({ className: \"ml-2\" }, { children: _jsx(DotLoader, {}, void 0) }), void 0))] }), void 0) }), void 0));\n};\nexport { CollectionRoot, CollectionEntries, CollectionLoadMore, CollectionFilters, };\n","import { CardTypes, } from \"@react-components/ui/Cards/card-types\";\nvar getCardTypeByAlias = function (card) {\n switch (card.alias) {\n case \"contentPage\":\n return CardTypes.ContentCard;\n default:\n return null;\n }\n};\nexport { getCardTypeByAlias };\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","FavoriteCollection","_a","_b","_c","dictionary","_d","favorites","requestOptions","useMemo","method","body","JSON","stringify","collection","pageIndex","previousPageData","pagedCollection","data","error","isValidating","mutate","size","setSize","favoriteCollection","isLastPage","find","x","hasNextPage","useFavoriteCollection","console","log","Collection","children","keyPrefix","flatMap","defaultCardType","disable","onClick","loadMore","CollectionFilters","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","columnSizes","className","showLoader","renderEntry","totalCollectionSize","HeaderComponent","renderEntryHeader","otherProps","useDictionaryContext","totalResultsCount","DotLoader","entry","card","CardRenderer","componentType","alias","imageWidth","imageHeight","useRatio","props","child"],"sourceRoot":""}