@ludo.ninja/components 2.3.10 → 2.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,7 @@ const _4k_1 = require("@ludo.ninja/ui/build/utils/4k");
32
32
  const moment_1 = __importDefault(require("moment/moment"));
33
33
  const react_1 = require("react");
34
34
  const styled_components_1 = __importDefault(require("styled-components"));
35
+ const sanitize_html_1 = __importDefault(require("sanitize-html"));
35
36
  const SWrapperLink = styled_components_1.default.a `
36
37
  position: relative;
37
38
  background-color: ${colors_2.WhiteColor};
@@ -251,11 +252,14 @@ const OpportunityCard = ({ opportunity, toolsForRemove, }) => {
251
252
  ? opportunity.brandLudoUrl || ''
252
253
  : opportunity.projectUrl || opportunity.shareLink || "";
253
254
  const isShowParticipantsCount = typeof opportunity.availablePlacesForAirdrop === 'number' && typeof opportunity.participantsLimit === 'number';
255
+ const sanitizedHtml = (0, sanitize_html_1.default)(opportunity?.description || '', {
256
+ allowedTags: ['b', 'i', 'em', 'strong', 'br', 'div'],
257
+ });
254
258
  return ((0, jsx_runtime_1.jsxs)(SWrapperLink, { href: opportunityLink, target: "_blank", onClick: () => openOpportunityAction({ opportunityId: opportunity.opportunityId }), children: [(0, jsx_runtime_1.jsxs)(StyledCardHead, { children: [(0, jsx_runtime_1.jsx)(OpportunityImage, { alt: opportunity.name, src: opportunity.media ? `${getMediaENVDomain()}/opportunity-medias/${opportunity.media}` : "" }), (0, jsx_runtime_1.jsx)(Headicons_1.default, { isMobile: isMobile, onClick: (e) => {
255
259
  e.stopPropagation();
256
260
  e.preventDefault();
257
261
  }, children: (0, jsx_runtime_1.jsxs)("div", { className: "icons", children: [(0, jsx_runtime_1.jsx)("div", { className: "icon", onClick: () => {
258
262
  openModalSidebarPortal((0, jsx_runtime_1.jsx)(OpportunityMenu_1.OpportunityMenu, { opportunity: opportunity, onClose: closeModalSidebarPortal }));
259
- }, children: (0, jsx_runtime_1.jsx)(ShareIcon_1.ShareIcon, {}) }), !isProd() && ((0, jsx_runtime_1.jsx)(OpportunityLike, { isDefaultLiked: !!(isSignedIn && opportunity.liked), opportunityId: opportunity.opportunityId, toolsForRemove: toolsForRemove }))] }) })] }), (0, jsx_runtime_1.jsxs)(StyledCardContent, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "cardContent", children: [(0, jsx_runtime_1.jsxs)("div", { className: "cardContentWrapper", children: [(0, jsx_runtime_1.jsx)("p", { className: `secondName`, children: opportunity.name }), (0, jsx_runtime_1.jsx)("p", { className: `mainName`, children: opportunity.description }), (0, jsx_runtime_1.jsxs)("p", { className: `categoryName`, children: [opportunity.categoryName, isShowParticipantsCount && (0, jsx_runtime_1.jsx)("span", { className: 'participantsCount', children: `${opportunity.availablePlacesForAirdrop}/${opportunity.participantsLimit}` })] })] }), (0, jsx_runtime_1.jsx)(OpportunityDropDown_1.OpportunityDropDown, { opportunity: opportunity })] }), (0, jsx_runtime_1.jsxs)(index_1.Flex, { alignItems: "end", justifyContent: "space-between", className: `categoryFooter`, children: [(0, jsx_runtime_1.jsx)(CardCategory_1.default, { label: data_1.default[opportunity.opportunityType] || data_1.default.opportunity }), opportunity.activeUntil && ((0, jsx_runtime_1.jsx)("div", { className: "date", children: `till ${(0, moment_1.default)(opportunity.activeUntil).format("LL")}` }))] })] })] }));
263
+ }, children: (0, jsx_runtime_1.jsx)(ShareIcon_1.ShareIcon, {}) }), !isProd() && ((0, jsx_runtime_1.jsx)(OpportunityLike, { isDefaultLiked: !!(isSignedIn && opportunity.liked), opportunityId: opportunity.opportunityId, toolsForRemove: toolsForRemove }))] }) })] }), (0, jsx_runtime_1.jsxs)(StyledCardContent, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "cardContent", children: [(0, jsx_runtime_1.jsxs)("div", { className: "cardContentWrapper", children: [(0, jsx_runtime_1.jsx)("p", { className: `secondName`, children: opportunity.name }), (0, jsx_runtime_1.jsx)("p", { className: `mainName`, dangerouslySetInnerHTML: { __html: sanitizedHtml } }), (0, jsx_runtime_1.jsxs)("p", { className: `categoryName`, children: [opportunity.categoryName, isShowParticipantsCount && (0, jsx_runtime_1.jsx)("span", { className: 'participantsCount', children: `Free spots left: ${opportunity.availablePlacesForAirdrop}` })] })] }), (0, jsx_runtime_1.jsx)(OpportunityDropDown_1.OpportunityDropDown, { opportunity: opportunity })] }), (0, jsx_runtime_1.jsxs)(index_1.Flex, { alignItems: "end", justifyContent: "space-between", className: `categoryFooter`, children: [(0, jsx_runtime_1.jsx)(CardCategory_1.default, { label: data_1.default[opportunity.opportunityType] || data_1.default.opportunity }), opportunity.activeUntil && ((0, jsx_runtime_1.jsx)("div", { className: "date", children: `till ${(0, moment_1.default)(opportunity.activeUntil).format("LL")}` }))] })] })] }));
260
264
  };
261
265
  exports.OpportunityCard = OpportunityCard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.3.10",
3
+ "version": "2.3.12",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -52,6 +52,7 @@
52
52
  "react-hyphen": "^1.4.0",
53
53
  "react-loading-skeleton": "^3.1.1",
54
54
  "react-player": "^2.12.0",
55
+ "sanitize-html": "^2.14.0",
55
56
  "react-select": "^5.7.2",
56
57
  "react-share": "^4.4.1",
57
58
  "react-slick": "^0.29.0",
@@ -88,6 +89,7 @@
88
89
  "@types/react-window-infinite-loader": "^1.0.6",
89
90
  "@types/styled-components": "^5.1.26",
90
91
  "@types/styled-system": "^5.1.16",
92
+ "@types/sanitize-html": "^2.13.0",
91
93
  "@typescript-eslint/eslint-plugin": "^5.43.0",
92
94
  "cross-env": "^7.0.3",
93
95
  "eslint": "8.31.0",