@e-llm-studio/citation 0.0.140 → 0.0.142
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.
- package/README.md +21 -26
- package/dist/assests/svg/PdfViewerIcons.js +2 -0
- package/dist/assests/svg/PdfViewerIcons.js.map +1 -0
- package/dist/cjs/assests/svg/PdfViewerIcons.js +2 -0
- package/dist/cjs/assests/svg/PdfViewerIcons.js.map +1 -0
- package/dist/cjs/features/Bookemon/BookCopyrightsCard/BookCopyrightsCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookDetailsCard/BookDetailsCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookElementsCard/BookElementsCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/cjs/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.js +1 -1
- package/dist/cjs/features/Bookemon/Bookemon.js +1 -1
- package/dist/cjs/features/Bookemon/BookemonContent.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/cjs/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/features/Bookemon/BookCopyrightsCard/BookCopyrightsCard.js +1 -1
- package/dist/features/Bookemon/BookDetailsCard/BookDetailsCard.js +1 -1
- package/dist/features/Bookemon/BookElementsCard/BookElementsCard.js +1 -1
- package/dist/features/Bookemon/BookOverviewCard/BookOverviewCard.js +1 -1
- package/dist/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.js +1 -1
- package/dist/features/Bookemon/Bookemon.js +1 -1
- package/dist/features/Bookemon/BookemonContent.js +1 -1
- package/dist/features/PdfViewer/PdfContainer.js +1 -1
- package/dist/features/PdfViewer/PdfStyle.js +1 -1
- package/dist/features/PdfViewer/PdfToolbar.js +1 -1
- package/dist/features/PdfViewer/PdfViewer.js +1 -1
- package/dist/types/src/BookemonTest.d.ts.map +1 -1
- package/dist/types/src/PdfViewerTest.d.ts.map +1 -1
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts +5 -0
- package/dist/types/src/assests/svg/PdfViewerIcons.d.ts.map +1 -0
- package/dist/types/src/features/Bookemon/BookCopyrightsCard/BookCopyrightsCard.d.ts +2 -1
- package/dist/types/src/features/Bookemon/BookCopyrightsCard/BookCopyrightsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookDetailsCard/BookDetailsCard.d.ts +5 -2
- package/dist/types/src/features/Bookemon/BookDetailsCard/BookDetailsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookElementsCard/BookElementsCard.d.ts +5 -1
- package/dist/types/src/features/Bookemon/BookElementsCard/BookElementsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookOverviewCard/BookOverviewCard.d.ts +2 -1
- package/dist/types/src/features/Bookemon/BookOverviewCard/BookOverviewCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.d.ts +2 -1
- package/dist/types/src/features/Bookemon/BookPeopleAwardsCard/BookPeopleAwardsCard.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/Bookemon.d.ts +1 -1
- package/dist/types/src/features/Bookemon/Bookemon.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/BookemonContent.d.ts +1 -1
- package/dist/types/src/features/Bookemon/BookemonContent.d.ts.map +1 -1
- package/dist/types/src/features/Bookemon/types/citation.types.d.ts +2 -0
- package/dist/types/src/features/Bookemon/types/citation.types.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts +3 -1
- package/dist/types/src/features/PdfViewer/PdfContainer.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts +29 -1
- package/dist/types/src/features/PdfViewer/PdfStyle.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts +10 -1
- package/dist/types/src/features/PdfViewer/PdfToolbar.d.ts.map +1 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts +34 -1
- package/dist/types/src/features/PdfViewer/PdfViewer.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1086,32 +1086,29 @@ import PaginatedTable from '@e-llm-studio/citation/PaginatedTable'
|
|
|
1086
1086
|
|
|
1087
1087
|
|
|
1088
1088
|
## PdfViewer
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
PdfViewer is a specialized React component designed to render PDF documents with built-in capabilities for text highlighting and highlight navigation. It is built on top of the @react-pdf-viewer library and is optimized for review workflows. It takes a specific list of keywords to highlight and a list of relevant pages, allowing users to "jump" directly between pages that contain relevant information.
|
|
1093
|
-
|
|
1094
|
-
### Features
|
|
1095
|
-
|
|
1096
|
-
- **Text highlighting** - Automatically highlight keywords within the document
|
|
1097
|
-
- **Highlight navigation** - Jump between pages with relevant content
|
|
1098
|
-
- **Zoom controls** - In/out zoom and popover zoom options
|
|
1099
|
-
- **Page navigation** - Navigate between highlighted pages
|
|
1100
|
-
- **Custom toolbar** - Sticky header with navigation controls
|
|
1101
|
-
- **Responsive design** - Works well on various screen sizes
|
|
1089
|
+
### Overview
|
|
1090
|
+
PdfViewer is a specialized, highly customizable React component designed to render PDF documents with built-in capabilities for text highlighting and highlight navigation. It is built on top of the @react-pdf-viewer library and is optimized for review workflows. It takes a specific list of keywords to highlight and a list of relevant pages, allowing users to "jump" directly between pages that contain relevant information. It supports deep UI overrides via custom classes, styles, and icons to fit seamlessly into any theme.FeaturesText highlighting - Automatically highlight keywords within the documentHighlight navigation - Jump between pages with relevant contentZoom controls - In/out zoom and popover zoom optionsPage navigation - Navigate between highlighted pagesCustom toolbar - Sticky header with navigation controlsDeep UI Customization - Extensive customization through customStyles, customClasses, and customIcons propsResponsive design - Works well on various screen sizesUsageTypeScriptimport PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
1102
1091
|
|
|
1103
1092
|
### Usage
|
|
1104
|
-
|
|
1105
1093
|
```tsx
|
|
1106
1094
|
import PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
1107
|
-
|
|
1108
1095
|
<PdfViewer
|
|
1109
1096
|
pdfUrl="https://example.com/contract.pdf"
|
|
1110
1097
|
highlightText={["confidential", "termination", "liability"]}
|
|
1111
1098
|
highlightPages={[3, 8, 12]}
|
|
1112
1099
|
jumpToPageValue={3}
|
|
1100
|
+
// Optional Customization Hooks
|
|
1101
|
+
customStyles={{
|
|
1102
|
+
pdfIconWrapper: { background: "#ffe4e6", border: "6px solid #fff1f2" },
|
|
1103
|
+
pdfName: { color: "#e11d48", fontWeight: "bold" },
|
|
1104
|
+
}}
|
|
1105
|
+
customClasses={{
|
|
1106
|
+
actionButton: "p-2 hover:bg-red-100 rounded-lg transition-colors text-red-500",
|
|
1107
|
+
}}
|
|
1108
|
+
customIcons={{
|
|
1109
|
+
pdfIcon: <MyCustomIcon />
|
|
1110
|
+
}}
|
|
1113
1111
|
/>
|
|
1114
|
-
```
|
|
1115
1112
|
|
|
1116
1113
|
### Navigation Behavior
|
|
1117
1114
|
- "Next" button jumps to next page with highlights
|
|
@@ -1119,17 +1116,15 @@ import PdfViewer from '@e-llm-studio/citation/PdfViewer'
|
|
|
1119
1116
|
- Direct page navigation based on highlightPages array
|
|
1120
1117
|
- Auto-zoom to actual size on load
|
|
1121
1118
|
|
|
1122
|
-
|
|
1123
1119
|
### Props
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
---
|
|
1120
|
+
Prop Name Type Description
|
|
1121
|
+
pdfUrl - string - The direct URL to the PDF file to be rendered
|
|
1122
|
+
highlightText - string[] - An array of keywords or phrases to automatically highlight
|
|
1123
|
+
highlightPages - number[] - An object of page numbers (1-based) where highlights appear
|
|
1124
|
+
jumpToPageValue - number - The specific page number to open the document at initially
|
|
1125
|
+
customStyles - CustomStylesType - Optional object to override default inline styles for elements like the viewer wrapper, header, or icons
|
|
1126
|
+
customClasses - CustomClassesType - Optional object to inject custom CSS or Tailwind classes
|
|
1127
|
+
customIcons - CustomIconsType - Optional object to replace default SVG icons (pdfIcon, fullScreenIcon, downloadIcon, closeIcon)
|
|
1133
1128
|
|
|
1134
1129
|
## ProjectAccordion
|
|
1135
1130
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";var t=function(){return n("svg",e({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))},o=function(){return n("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},r=function(){return i("svg",e({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n("polyline",{points:"7 10 12 15 17 10"}),n("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},h=function(){return i("svg",e({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))};export{h as DefaultCloseIcon,r as DefaultDownloadIcon,o as DefaultFullScreenIcon,t as DefaultPdfIcon};
|
|
2
|
+
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewerIcons.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime");exports.DefaultCloseIcon=function(){return n.jsxs("svg",e.__assign({width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}))},exports.DefaultDownloadIcon=function(){return n.jsxs("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}))},exports.DefaultFullScreenIcon=function(){return n.jsx("svg",e.__assign({width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#475467",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:n.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})}))},exports.DefaultPdfIcon=function(){return n.jsx("svg",e.__assign({xmlns:"http://www.w3.org/2000/svg",style:{width:"12px",height:"15px"},viewBox:"0 0 14 17",fill:"none"},{children:n.jsx("path",{d:"M8.25 0.952148V4.05005C8.25 4.47009 8.25 4.68011 8.33175 4.84055C8.40365 4.98167 8.51839 5.0964 8.65951 5.16831C8.81994 5.25005 9.02996 5.25005 9.45 5.25005H12.5479M9.75 9H3.75M9.75 12H3.75M5.25 6H3.75M8.25 0.75H4.35C3.08988 0.75 2.45982 0.75 1.97852 0.995235C1.55516 1.21095 1.21095 1.55516 0.995235 1.97852C0.75 2.45982 0.75 3.08988 0.75 4.35V12.15C0.75 13.4101 0.75 14.0402 0.995235 14.5215C1.21095 14.9448 1.55516 15.289 1.97852 15.5048C2.45982 15.75 3.08988 15.75 4.35 15.75H9.15C10.4101 15.75 11.0402 15.75 11.5215 15.5048C11.9448 15.289 12.289 14.9448 12.5048 14.5215C12.75 14.0402 12.75 13.4101 12.75 12.15V5.25L8.25 0.75Z",stroke:"#0019FF",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}))};
|
|
2
|
+
//# sourceMappingURL=PdfViewerIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdfViewerIcons.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("react"),n=require("../utils/highlight.js"),l=require("../../../utils/sanitizeHtml.js"),r={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},textBlock:{fontSize:"14px",fontWeight:400,color:"#64748B",marginBottom:"24px"}};exports.default=function(s){var o,h,u,d,a,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("react"),n=require("../utils/highlight.js"),l=require("../../../utils/sanitizeHtml.js"),r={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},textBlock:{fontSize:"14px",fontWeight:400,color:"#64748B",marginBottom:"24px"}};exports.default=function(s){var o,h,u,g,d,a,c,v,p=s.data,x=s.highlightTerms,y=s.onHighlightMatch,m=s.highlightEnabled,j=p.copyright,_=p.salesRights,f=t.useRef(null);return t.useEffect(function(){var i,e,t,n,l,r,s;if(x&&0!==x.length&&m){var o=[String(null!==(e=null===(i=p.copyright)||void 0===i?void 0:i.year)&&void 0!==e?e:""),null!==(n=null===(t=p.copyright)||void 0===t?void 0:t.owner)&&void 0!==n?n:"",null!==(r=null===(l=p.salesRights)||void 0===l?void 0:l.description)&&void 0!==r?r:"",null===(s=p.salesRights)||void 0===s?void 0:s.territory.join(", ")].some(function(i){return!!i&&x.some(function(e){return i.toLowerCase().includes(e.toLowerCase())})});null==y||y(o)}},[x,p]),e.jsxs("div",i.__assign({ref:f},{children:[e.jsx("p",i.__assign({style:r.sectionTitle},{children:"Copyrights"})),e.jsxs("div",i.__assign({style:r.textBlock},{children:[e.jsxs("p",{children:["Copyright Year:"," ",x&&x.length>0&&m?e.jsx("span",{dangerouslySetInnerHTML:{__html:l.sanitizeHtml(n.highlightTermsFunc(String(null!==(o=j.year)&&void 0!==o?o:"NA"),x))}}):null!==(h=j.year)&&void 0!==h?h:"NA"]}),e.jsxs("p",{children:["Copyright Owner:"," ",x&&x.length>0&&m?e.jsx("span",{dangerouslySetInnerHTML:{__html:l.sanitizeHtml(n.highlightTermsFunc(null!==(u=j.owner)&&void 0!==u?u:"NA",x))}}):null!==(g=j.owner)&&void 0!==g?g:"NA"]})]})),e.jsx("p",i.__assign({style:r.sectionTitle},{children:"Sales Rights"})),e.jsxs("div",i.__assign({style:r.textBlock},{children:[e.jsx("p",{children:x&&x.length>0&&m?e.jsx("span",{dangerouslySetInnerHTML:{__html:l.sanitizeHtml(n.highlightTermsFunc(null!==(d=_.description)&&void 0!==d?d:"",x))}}):null!==(a=_.description)&&void 0!==a?a:""}),e.jsxs("p",{children:["Sales Territory:"," ",x&&x.length>0&&m?e.jsx("span",{dangerouslySetInnerHTML:{__html:l.sanitizeHtml(n.highlightTermsFunc(null!==(c=_.territory.join(", "))&&void 0!==c?c:"NA",x))}}):null!==(v=_.territory.join(", "))&&void 0!==v?v:"NA"]})]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookCopyrightsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("../utils/highlight.js"),s=require("../../../utils/sanitizeHtml.js"),l={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}};exports.default=function(r){var o,a,g,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("../utils/highlight.js"),s=require("../../../utils/sanitizeHtml.js"),l={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}};exports.default=function(r){var o,a,c,g,u,d,h,p,x,m,_,b,v,f=r.data,y=r.highlightTerms,j=r.onHighlightMatch,T=r.highlightEnabled;r.citationType;var C,w=r.citationSubTitle,N=i.useState(!1),S=N[0],k=N[1],L=i.useState(!1),H=L[0],I=L[1],M=i.useRef(null),z=null!==(o=null==y?void 0:y.map(function(e){return e.split(",")}).flat())&&void 0!==o?o:[],A=i.useMemo(function(){return S?f.subjectCategories||[]:(f.subjectCategories||[]).slice(0,10)},[S,f.subjectCategories]);return i.useEffect(function(){var e,t;if((null==y?void 0:y.length)&&T){var i="genre_details"==w?z.map(function(e){return e.toLowerCase()}):y.map(function(e){return e.toLowerCase()}),n=function(e){return e&&i.some(function(t){return e.toLowerCase().includes(t)})},s=[f.isbn,f.isbn10,f.imprint,f.publisher,f.publishingDate,f.age].some(n),l=(null!==(e=f.subjectCategories)&&void 0!==e?e:[]).some(n);console.log("categoriesMatch",l);var r=(null!==(t=f.reviews)&&void 0!==t?t:[]).some(function(e){return n(e.replace(/<[^>]+>/g,""))}),o=s||l||r;null==j||j(o),o&&(l&&!S&&k(!0),r&&!H&&I(!0))}},[y,f]),t.jsxs("div",e.__assign({ref:M,style:l.container,className:"book-details-container"},{children:[t.jsx("p",e.__assign({style:l.sectionTitle,className:"book-details-section-title"},{children:"Product Details"})),t.jsxs("div",e.__assign({style:l.detailsContainer,className:"book-details-details-container"},{children:[t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"ISBN:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(a=f.isbn)&&void 0!==a?a:"NA",y))}}):null!==(c=f.isbn)&&void 0!==c?c:"NA"]})),t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"ISBN 10:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(g=f.isbn10)&&void 0!==g?g:"NA",y))}}):null!==(u=f.isbn10)&&void 0!==u?u:"NA"]})),t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"Imprint:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(d=f.imprint)&&void 0!==d?d:"NA",y))}}):null!==(h=f.imprint)&&void 0!==h?h:"NA"]})),t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"Publisher:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(p=f.publisher)&&void 0!==p?p:"NA",y))}}):null!==(x=f.publisher)&&void 0!==x?x:"NA"]})),t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"Publishing Date:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(m=f.publishingDate)&&void 0!==m?m:"NA",y))}}):null!==(_=f.publishingDate)&&void 0!==_?_:"NA"]})),t.jsxs("p",e.__assign({style:l.detailsContainerItem},{children:[t.jsx("span",e.__assign({style:l.boldText},{children:"Age:"}))," ",y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(null!==(b=f.age)&&void 0!==b?b:"NA",y))}}):null!==(v=f.age)&&void 0!==v?v:"NA"]}))]})),t.jsxs("div",e.__assign({style:l.categoriesContainer},{children:[t.jsx("p",e.__assign({style:l.sectionTitle,className:"book-details-section-title"},{children:"Subject Categories"})),t.jsxs("div",e.__assign({style:l.categoriesList,className:"book-details-categories-list"},{children:[A.map(function(i,r){return t.jsx("span",e.__assign({style:l.category,className:"book-details-category"},{children:y&&y.length>0&&T?t.jsx("span",{dangerouslySetInnerHTML:{__html:s.sanitizeHtml(n.highlightTermsFunc(i,z))}}):i}),r)}),f.subjectCategories&&f.subjectCategories.length>10&&t.jsx("button",e.__assign({style:l.button,onClick:function(){return k(!S)},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:S?"View less":"View more"}))]}))]})),t.jsxs("div",e.__assign({style:l.reviewsContainer},{children:[t.jsx("p",e.__assign({style:l.sectionTitle,className:"book-details-section-title"},{children:"Book Marketing Collateral"})),t.jsxs("div",e.__assign({style:l.reviewsList,className:"book-details-reviews-list"},{children:[f.reviews&&f.reviews.length>0?(C=f.reviews.filter(function(e){return e.replace(/<[^>]+>/g,"").trim().replace(/&[#A-Za-z0-9]+;/g,"").trim().length>0}),(H?C:C.slice(0,3)).map(function(i,r){return t.jsx("div",e.__assign({style:l.reviewCard,className:"book-details-review-card"},{children:t.jsx("div",{style:l.reviewText,dangerouslySetInnerHTML:{__html:y&&y.length>0&&T?s.sanitizeHtml(n.highlightTermsFunc(i,y)):i}})}),r)})):t.jsx("p",e.__assign({style:l.reviewText},{children:"No Book Marketing Collateral available for this book."})),f.reviews&&f.reviews.length>3&&t.jsx("button",e.__assign({style:l.button,onClick:function(){return I(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:H?"View less":"View more"}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookDetailsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material/Pagination"),a=require("@mui/material/Skeleton"),s=require("react"),i=require("react-markdown"),o=require("rehype-raw"),r=require("remark-breaks"),l=require("../utils/highlight.js"),c=require("../../../utils/sanitizeHtml.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(n),g=u(a),x=u(i),h=u(o),p=u(r),f={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},quotesPadding:{paddingLeft:"12px"},quoteCard:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"16px",backgroundColor:"#F8FAFC",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",marginBottom:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},quoteText:{fontStyle:"italic",color:"#475569",fontSize:"14px",fontWeight:400,marginBottom:"12px"},quoteMeta:{color:"#475569",fontSize:"12px",fontWeight:400},quoteAuthor:{fontSize:"10px",fontWeight:600,color:"#475569",marginTop:"8px",marginBottom:"18px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},geoLocationsContainer:{marginTop:"24px",marginBottom:"24px"},geoText:{fontSize:"14px",fontWeight:500,cursor:"pointer",color:"#532BED"},geoDivider:{margin:"0 8px",color:"#475abb",backgroundColor:"#475abb",width:"1px",height:"18px",display:"inline-block"},geoLocationFlex:{display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"8px"},charactersContainer:{marginTop:"16px"},charactersGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px",marginBottom:"16px",paddingLeft:"12px"},characterCard:{border:"1px solid #E5E7EB",borderRadius:"8px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",display:"flex",alignItems:"flex-start",gap:"12px",padding:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},avatar:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"9999px",fontSize:"14px",fontWeight:600,flexShrink:0},charName:{fontStyle:"normal",fontWeight:600,color:"#101827",fontSize:"16px"},charDesc:{fontStyle:"normal",fontWeight:400,fontSize:"14px",color:"#6B7280"},retryButton:{backgroundColor:"#5928EC",color:"#fff",padding:"6px 10px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:"500"}};exports.default=function(n){var a,i,o;n.data;var r=n.updateQuotesToHighLight,u=n.handleFetchManuscriptElements,_=n.BookIsbn,m=n.title,y=n.highlightTerms,v=n.onHighlightMatch,b=n.defaultPages,j=s.useRef(!0);s.useEffect(function(){return function(){j.current=!1}},[]);var k=s.useState([]),T=k[0],S=k[1],C=s.useState(null!==(a=null==b?void 0:b.quotes)&&void 0!==a?a:1),q=C[0],w=C[1],L=s.useState(!1),N=L[0],B=L[1],E=s.useState(!0),D=E[0],F=E[1],M=s.useState(0),H=M[0],P=M[1],W=s.useState([]),z=W[0],I=W[1],R=s.useState(null!==(i=null==b?void 0:b.characters)&&void 0!==i?i:1),G=R[0],K=R[1],Y=s.useState(!1),A=Y[0],O=Y[1],Q=s.useState(!0),J=Q[0],U=Q[1],V=s.useState(0),X=V[0],Z=V[1],$=s.useState([]),ee=$[0],te=$[1],ne=s.useState(null!==(o=null==b?void 0:b.locations)&&void 0!==o?o:1),ae=ne[0],se=ne[1],ie=s.useState(!1),oe=ie[0],re=ie[1],le=s.useState(!0),ce=le[0],ue=le[1],de=s.useState(0),ge=de[0],xe=de[1],he=s.useState({list:"",index:-1,page:1}),pe=he[0],fe=he[1],_e=s.useRef(!1),me=s.useRef(null);s.useEffect(function(){if(null==y?void 0:y.length){var e=y.map(function(e){return e.toLowerCase()}),t=function(t){return t&&e.some(function(e){return t.toLowerCase().includes(e)})},n=!1;T.forEach(function(e,a){!n&&t(e.text)&&(fe({list:"notable",index:a,page:q}),null==v||v(!0),n=!0)}),ee.forEach(function(e,a){!n&&t(e.name)&&(fe({list:"geo_location",index:a,page:ae}),null==v||v(!0),n=!0)}),z.forEach(function(e,a){n||!t(e.name)&&!t(e.description)||(fe({list:"key_character",index:a,page:G}),null==v||v(!0),n=!0)})}},[y,T,ee,z,q,ae,G]),s.useEffect(function(){b&&(b.quotes&&w(b.quotes),b.locations&&se(b.locations),b.characters&&K(b.characters))},[b]),s.useEffect(function(){_e.current=!1},[y]);var ye=function(t){var n=t.endpoint,a=t.page,s=t.isbn,i=t.setData,o=t.setLoading,r=t.setHasMore,l=t.setTotalPage,c=t.title;return e.__awaiter(void 0,void 0,void 0,function(){var t,d,g,x;return e.__generator(this,function(e){switch(e.label){case 0:o(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,u({endpoint:n,page:a,pageSize:10,isbn:s,title:c})];case 2:return t=e.sent(),j.current?(i((null==t?void 0:t.data)||[]),l((null===(d=null==t?void 0:t.pagination)||void 0===d?void 0:d.totalPages)||0),r(!(null===(g=null==t?void 0:t.pagination)||void 0===g?void 0:g.hasNext)&&!(null===(x=null==t?void 0:t.pagination)||void 0===x?void 0:x.hasPrevious)),[3,4]):[2];case 3:return j.current&&o(!1),[7];case 4:return[2]}})})};return s.useEffect(function(){ye({endpoint:"notable-quotes",page:q,isbn:_,setData:S,setLoading:B,setHasMore:F,setTotalPage:P,title:m})},[q]),s.useEffect(function(){ye({endpoint:"notable-characters",page:G,isbn:_,setData:I,setLoading:O,setHasMore:U,setTotalPage:Z,title:m})},[G]),s.useEffect(function(){ye({endpoint:"geo-locations",page:ae,isbn:_,setData:te,setLoading:re,setHasMore:ue,setTotalPage:xe,title:m})},[ae]),t.jsxs("div",e.__assign({ref:me,className:"book-elements-container"},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"24px"}},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Notable Quotes"})),t.jsxs("div",e.__assign({style:f.quotesPadding},{children:[N?t.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",rowGap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:f.quoteCard},{children:[t.jsx(g.default,{variant:"text",width:"60%",height:28}),t.jsx(g.default,{variant:"text",width:"40%",height:20}),t.jsx(g.default,{variant:"text",width:"25%",height:20}),t.jsx(g.default,{variant:"text",width:"30%",height:20})]}),n)})})):0===T.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic"}},{children:["No notable quotes found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return ye({endpoint:"notable-quotes",page:q,isbn:_,setData:S,setLoading:B,setHasMore:F,setTotalPage:P,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:T.map(function(n,a){var s="notable"===pe.list&&pe.page===q&&pe.index===a;return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:e.__assign(e.__assign({},f.quoteCard),{borderColor:s?"rgb(83, 43, 237)":"#CBD5E1"}),onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),fe({list:"notable",page:q,index:a}),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.text,"Notable Quotes",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight quote:",t),[3,4];case 4:return[2]}})})},"data-selected":"notable"===pe.list&&pe.page===q&&pe.index===a?"true":void 0},{children:[y&&y.length>0?t.jsx("p",{style:f.quoteText,className:"book-elements-quote-text",dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(null==n?void 0:n.text,y))}}):t.jsx("p",e.__assign({style:f.quoteText,className:"book-elements-quote-text"},{children:null==n?void 0:n.text})),t.jsxs("p",e.__assign({style:f.quoteMeta,className:"book-elements-quote-meta"},{children:[l.processTextWithHighlight(n.chapter,y)," ",t.jsx("br",{})," ",l.processTextWithHighlight(n.page,y)]})),t.jsxs("p",e.__assign({style:f.quoteAuthor},{children:["— ",l.processTextWithHighlight(null==n?void 0:n.author,y)]}))]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!D&&t.jsx(d.default,{disabled:N,count:H,page:q,onChange:function(e,t){return w(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:f.geoLocationsContainer},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Key Geo Locations"})),t.jsxs("div",e.__assign({className:"book-elements-geo-wrapper",style:e.__assign(e.__assign({},f.quotesPadding),{marginBottom:"8px"})},{children:[oe?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(e){return t.jsx(g.default,{variant:"rectangular",width:100,height:20,style:{borderRadius:"8px"}},e)})})):0===ee.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key geo locations found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return ye({endpoint:"geo-locations",page:ae,isbn:_,setData:te,setLoading:re,setHasMore:ue,setTotalPage:xe,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:ee.map(function(n,a){var s="geo_location"===pe.list&&pe.page===ae&&pe.index===a;return t.jsxs("span",e.__assign({"data-selected":"geo_location"===pe.list&&pe.page===ae&&pe.index===a?"true":void 0,style:f.geoLocationFlex},{children:[t.jsx("span",e.__assign({className:"book-elements-geo-text",style:e.__assign(e.__assign({},f.geoText),{fontWeight:s?"700":"",textDecoration:s?"underline":""}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),fe({list:"geo_location",page:ae,index:a}),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.name,"Key Geo Locations",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight location:",t),[3,4];case 4:return[2]}})})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:y&&y.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(null==n?void 0:n.name,y))}}):null==n?void 0:n.name})),a<ee.length-1&&t.jsx("span",{style:f.geoDivider})]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!ce&&t.jsx(d.default,{disabled:oe,count:ge,page:ae,onChange:function(e,t){return se(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:f.charactersContainer},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Key Characters"})),A?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},f.characterCard),{flexBasis:"40%"})},{children:[t.jsx(g.default,{variant:"circular",style:e.__assign(e.__assign({},f.avatar),{flexShrink:0})}),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsx(g.default,{variant:"text",style:{flex:"1",flexShrink:0}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}})]}))]}),n)})})):0===z.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key characters found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return ye({endpoint:"notable-characters",page:G,isbn:_,setData:I,setLoading:O,setHasMore:U,setTotalPage:Z,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:t.jsx("div",e.__assign({className:"book-elements-characters-grid",style:f.charactersGrid},{children:z.map(function(n,a){var s=e.__assign(e.__assign({},f.avatar),{backgroundColor:n.bg,color:n.color}),i="key_character"===pe.list&&pe.page===G&&pe.index===a;return t.jsxs("div",e.__assign({onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},className:"book-elements-character-card",style:e.__assign(e.__assign({},f.characterCard),{borderColor:i?"rgb(83, 43, 237)":"#E5E7EB"}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:fe({list:"key_character",page:G,index:a}),e.label=1;case 1:return e.trys.push([1,4,,5]),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.name,"Key Characters",n.chunkIds,0)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[3,5];case 4:return t=e.sent(),console.error("Failed to highlight character:",t),[3,5];case 5:return[2]}})})},"data-selected":"key_character"===pe.list&&pe.page===G&&pe.index===a?"true":void 0},{children:[t.jsx("div",e.__assign({style:s},{children:n.initials})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column"}},{children:[t.jsx("p",e.__assign({className:"book-elements-char-name",style:e.__assign(e.__assign({},f.charName),{margin:0})},{children:y&&y.length>0?t.jsx("span",{dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(n.name,y))}}):n.name})),t.jsx("p",e.__assign({className:"book-elements-char-desc",style:e.__assign(e.__assign({},f.charDesc),{margin:0,marginTop:"4px"})},{children:t.jsx(x.default,e.__assign({remarkPlugins:[p.default],rehypePlugins:[h.default],components:{p:function(n){n.node;var a=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:0}},a))}}},{children:l.processTextWithHighlight(null==n?void 0:n.description,y)}))}))]}))]}),a)})}))}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!J&&t.jsx(d.default,{count:X,disabled:A,page:G,onChange:function(e,t){return K(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("@mui/material/Pagination"),a=require("@mui/material/Skeleton"),s=require("react"),i=require("react-markdown"),o=require("rehype-raw"),r=require("remark-breaks"),l=require("../utils/highlight.js"),c=require("../../../utils/sanitizeHtml.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(n),g=u(a),x=u(i),h=u(o),p=u(r),f={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},quotesPadding:{paddingLeft:"12px"},quoteCard:{border:"1px solid #CBD5E1",borderRadius:"8px",padding:"16px",backgroundColor:"#F8FAFC",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",marginBottom:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},quoteText:{fontStyle:"italic",color:"#475569",fontSize:"14px",fontWeight:400,marginBottom:"12px"},quoteMeta:{color:"#475569",fontSize:"12px",fontWeight:400},quoteAuthor:{fontSize:"10px",fontWeight:600,color:"#475569",marginTop:"8px",marginBottom:"18px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},geoLocationsContainer:{marginTop:"24px",marginBottom:"24px"},geoText:{fontSize:"14px",fontWeight:500,cursor:"pointer",color:"#532BED"},geoDivider:{margin:"0 8px",color:"#475abb",backgroundColor:"#475abb",width:"1px",height:"18px",display:"inline-block"},geoLocationFlex:{display:"inline-flex",alignItems:"center",gap:"8px",marginBottom:"8px"},charactersContainer:{marginTop:"16px"},charactersGrid:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"16px",marginBottom:"16px",paddingLeft:"12px"},characterCard:{border:"1px solid #E5E7EB",borderRadius:"8px",backgroundColor:"#FFFFFF",boxShadow:"0 1px 2px rgba(0,0,0,0.05)",display:"flex",alignItems:"flex-start",gap:"12px",padding:"16px",cursor:"pointer",transition:"transform 0.2s ease, box-shadow 0.2s ease"},avatar:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"9999px",fontSize:"14px",fontWeight:600,flexShrink:0},charName:{fontStyle:"normal",fontWeight:600,color:"#101827",fontSize:"16px"},charDesc:{fontStyle:"normal",fontWeight:400,fontSize:"14px",color:"#6B7280"},retryButton:{backgroundColor:"#5928EC",color:"#fff",padding:"6px 10px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"12px",fontWeight:"500"}};exports.default=function(n){var a,i,o;n.data;var r=n.updateQuotesToHighLight,u=n.handleFetchManuscriptElements,_=n.BookIsbn,m=n.title,y=n.highlightTerms,v=n.onHighlightMatch,b=n.defaultPages;n.citationType;var j=n.citationSubTitle,k=n.highlightEnabled,S=s.useRef(!0);s.useEffect(function(){return function(){S.current=!1}},[]);var T=s.useState([]),C=T[0],q=T[1],w=s.useState(null!==(a=null==b?void 0:b.quotes)&&void 0!==a?a:1),L=w[0],N=w[1],E=s.useState(!1),B=E[0],D=E[1],F=s.useState(!0),M=F[0],P=F[1],H=s.useState(0),z=H[0],I=H[1],W=s.useState([]),R=W[0],G=W[1],K=s.useState(null!==(i=null==b?void 0:b.characters)&&void 0!==i?i:1),Y=K[0],A=K[1],O=s.useState(!1),Q=O[0],J=O[1],U=s.useState(!0),V=U[0],X=U[1],Z=s.useState(0),$=Z[0],ee=Z[1],te=s.useState([]),ne=te[0],ae=te[1],se=s.useState(null!==(o=null==b?void 0:b.locations)&&void 0!==o?o:1),ie=se[0],oe=se[1],re=s.useState(!1),le=re[0],ce=re[1],ue=s.useState(!0),de=ue[0],ge=ue[1],xe=s.useState(0),he=xe[0],pe=xe[1],fe=s.useState({list:"",index:-1,page:1}),_e=fe[0],me=fe[1],ye=s.useRef(!1),ve=s.useRef(null);s.useEffect(function(){if((null==y?void 0:y.length)&&k){var e=y.map(function(e){return e.toLowerCase()}),t=function(t){return t&&e.some(function(e){return t.toLowerCase().includes(e)})},n=!1;"notable_quotes"==j&&C.forEach(function(e,a){!n&&t(e.text)&&(null==v||v(!0),n=!0)}),"location_details"==j&&ne.forEach(function(e,a){!n&&t(e.name)&&(null==v||v(!0),n=!0)}),"notable_characters"==j&&R.forEach(function(t,a){var s;!n&&((s=t.name)&&e[0]===s.toLowerCase())&&(null==v||v(!0),n=!0)})}},[y,C,ne,R,L,ie,Y]),s.useEffect(function(){b&&(b.quotes&&N(b.quotes),b.locations&&oe(b.locations),b.characters&&A(b.characters))},[b]),s.useEffect(function(){ye.current=!1},[y]);var be=function(t){var n=t.endpoint,a=t.page,s=t.isbn,i=t.setData,o=t.setLoading,r=t.setHasMore,l=t.setTotalPage,c=t.title;return e.__awaiter(void 0,void 0,void 0,function(){var t,d,g,x;return e.__generator(this,function(e){switch(e.label){case 0:o(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,u({endpoint:n,page:a,pageSize:10,isbn:s,title:c})];case 2:return t=e.sent(),S.current?(i((null==t?void 0:t.data)||[]),l((null===(d=null==t?void 0:t.pagination)||void 0===d?void 0:d.totalPages)||0),r(!(null===(g=null==t?void 0:t.pagination)||void 0===g?void 0:g.hasNext)&&!(null===(x=null==t?void 0:t.pagination)||void 0===x?void 0:x.hasPrevious)),[3,4]):[2];case 3:return S.current&&o(!1),[7];case 4:return[2]}})})};return s.useEffect(function(){be({endpoint:"notable-quotes",page:L,isbn:_,setData:q,setLoading:D,setHasMore:P,setTotalPage:I,title:m})},[L]),s.useEffect(function(){be({endpoint:"notable-characters",page:Y,isbn:_,setData:G,setLoading:J,setHasMore:X,setTotalPage:ee,title:m})},[Y]),s.useEffect(function(){be({endpoint:"geo-locations",page:ie,isbn:_,setData:ae,setLoading:ce,setHasMore:ge,setTotalPage:pe,title:m})},[ie]),t.jsxs("div",e.__assign({ref:ve,className:"book-elements-container"},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"24px"}},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Notable Quotes"})),t.jsxs("div",e.__assign({style:f.quotesPadding},{children:[B?t.jsx("div",e.__assign({style:{display:"flex",flexDirection:"column",rowGap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:f.quoteCard},{children:[t.jsx(g.default,{variant:"text",width:"60%",height:28}),t.jsx(g.default,{variant:"text",width:"40%",height:20}),t.jsx(g.default,{variant:"text",width:"25%",height:20}),t.jsx(g.default,{variant:"text",width:"30%",height:20})]}),n)})})):0===C.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic"}},{children:["No notable quotes found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return be({endpoint:"notable-quotes",page:L,isbn:_,setData:q,setLoading:D,setHasMore:P,setTotalPage:I,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:C.map(function(n,a){var s="notable"===_e.list&&_e.page===L&&_e.index===a;return t.jsxs("div",e.__assign({className:"book-elements-quote-card",style:e.__assign(e.__assign({},f.quoteCard),{borderColor:s?"rgb(83, 43, 237)":"#CBD5E1"}),onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),me({list:"notable",page:L,index:a}),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.text,"Notable Quotes",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight quote:",t),[3,4];case 4:return[2]}})})},"data-selected":"notable"===_e.list&&_e.page===L&&_e.index===a?"true":void 0},{children:[y&&y.length>0&&"notable_quotes"==j&&k?t.jsx("p",{style:f.quoteText,className:"book-elements-quote-text",dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(null==n?void 0:n.text,y))}}):t.jsx("p",e.__assign({style:f.quoteText,className:"book-elements-quote-text"},{children:null==n?void 0:n.text})),t.jsxs("p",e.__assign({style:f.quoteMeta,className:"book-elements-quote-meta"},{children:[n.chapter,t.jsx("br",{}),n.page]})),t.jsxs("p",e.__assign({style:f.quoteAuthor},{children:["— ",null==n?void 0:n.author]}))]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!M&&t.jsx(d.default,{disabled:B,count:z,page:L,onChange:function(e,t){return N(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:f.geoLocationsContainer},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Key Geo Locations"})),t.jsxs("div",e.__assign({className:"book-elements-geo-wrapper",style:e.__assign(e.__assign({},f.quotesPadding),{marginBottom:"8px"})},{children:[le?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(e){return t.jsx(g.default,{variant:"rectangular",width:100,height:20,style:{borderRadius:"8px"}},e)})})):0===ne.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key geo locations found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return be({endpoint:"geo-locations",page:ie,isbn:_,setData:ae,setLoading:ce,setHasMore:ge,setTotalPage:pe,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:ne.map(function(n,a){var s="geo_location"===_e.list&&_e.page===ie&&_e.index===a;return t.jsxs("span",e.__assign({"data-selected":"geo_location"===_e.list&&_e.page===ie&&_e.index===a?"true":void 0,style:f.geoLocationFlex},{children:[t.jsx("span",e.__assign({className:"book-elements-geo-text",style:e.__assign(e.__assign({},f.geoText),{fontWeight:s?"700":"",textDecoration:s?"underline":""}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),me({list:"geo_location",page:ie,index:a}),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.name,"Key Geo Locations",n.chunkIds,0)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[3,4];case 3:return t=e.sent(),console.error("Failed to highlight location:",t),[3,4];case 4:return[2]}})})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:y&&y.length>0&&"location_details"==j&&k?t.jsx("span",{dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(null==n?void 0:n.name,y))}}):null==n?void 0:n.name})),a<ne.length-1&&t.jsx("span",{style:f.geoDivider})]}),a)})}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!de&&t.jsx(d.default,{disabled:le,count:he,page:ie,onChange:function(e,t){return oe(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]})),t.jsxs("div",e.__assign({style:f.charactersContainer},{children:[t.jsx("p",e.__assign({style:f.sectionTitle,className:"book-elements-section-title"},{children:"Key Characters"})),Q?t.jsx("div",e.__assign({style:{display:"flex",flexWrap:"wrap",gap:"8px"}},{children:[1,2,3,4,5,6,7,8,9,10].map(function(n){return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},f.characterCard),{flexBasis:"40%"})},{children:[t.jsx(g.default,{variant:"circular",style:e.__assign(e.__assign({},f.avatar),{flexShrink:0})}),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsx(g.default,{variant:"text",style:{flex:"1",flexShrink:0}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}}),t.jsx(g.default,{variant:"text",style:{flex:"1"}})]}))]}),n)})})):0===R.length?t.jsxs("p",e.__assign({style:{color:"#6B7280",fontStyle:"italic",paddingLeft:"12px"}},{children:["No key characters found. ",t.jsx("button",e.__assign({style:f.retryButton,onClick:function(){return be({endpoint:"notable-characters",page:Y,isbn:_,setData:G,setLoading:J,setHasMore:X,setTotalPage:ee,title:m})}},{children:"Retry"}))]})):t.jsx(t.Fragment,{children:t.jsx("div",e.__assign({className:"book-elements-characters-grid",style:f.charactersGrid},{children:R.map(function(n,a){var s=e.__assign(e.__assign({},f.avatar),{backgroundColor:n.bg,color:n.color}),i="key_character"===_e.list&&_e.page===Y&&_e.index===a;return t.jsxs("div",e.__assign({onMouseEnter:function(e){e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"},onMouseLeave:function(e){e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.1)"},className:"book-elements-character-card",style:e.__assign(e.__assign({},f.characterCard),{borderColor:i?"rgb(83, 43, 237)":"#E5E7EB"}),onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,s;return e.__generator(this,function(e){switch(e.label){case 0:me({list:"key_character",page:Y,index:a}),e.label=1;case 1:return e.trys.push([1,4,,5]),(null===(s=null==n?void 0:n.chunkIds)||void 0===s?void 0:s.length)>0?[4,r(n.name,"Key Characters",n.chunkIds,0)]:[3,3];case 2:e.sent(),e.label=3;case 3:return[3,5];case 4:return t=e.sent(),console.error("Failed to highlight character:",t),[3,5];case 5:return[2]}})})},"data-selected":"key_character"===_e.list&&_e.page===Y&&_e.index===a?"true":void 0},{children:[t.jsx("div",e.__assign({style:s},{children:n.initials})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column"}},{children:[t.jsx("p",e.__assign({className:"book-elements-char-name",style:e.__assign(e.__assign({},f.charName),{margin:0})},{children:y&&y.length>0&&"notable_characters"==j&&n.name.toLowerCase()===y[0].toLowerCase()&&k?t.jsx("span",{dangerouslySetInnerHTML:{__html:c.sanitizeHtml(l.highlightTermsFunc(n.name,y))}}):n.name})),t.jsx("p",e.__assign({className:"book-elements-char-desc",style:e.__assign(e.__assign({},f.charDesc),{margin:0,marginTop:"4px"})},{children:t.jsx(x.default,e.__assign({remarkPlugins:[p.default],rehypePlugins:[h.default],components:{p:function(n){n.node;var a=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:0}},a))}}},{children:null==n?void 0:n.description}))}))]}))]}),a)})}))}),t.jsx("div",e.__assign({className:"book-elements-pagination",style:{display:"flex",justifyContent:"flex-end",width:"100%"}},{children:!V&&t.jsx(d.default,{count:$,disabled:Q,page:Y,onChange:function(e,t){return A(t)},shape:"rounded",style:{marginTop:"8px"}})}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookElementsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),l=require("remark-breaks"),o=require("rehype-raw"),s=require("../utils/highlight.js"),r=require("../../../utils/sanitizeHtml.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(i),c=a(l),d=a(o),g={card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",padding:"24px"},title:{fontSize:"16px",fontWeight:"bold",marginBottom:"24px"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:"24px",marginBottom:"24px"},gridItem:{backgroundColor:"#F8FAFC",border:"1px solid #DFE5EC",borderRadius:"8px",padding:"12px 8px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px"},gridItemHeight:{height:"50px"},label:{fontSize:"14px",fontWeight:400,color:"#64748B",margin:0},value:{fontWeight:"bold",fontSize:"14px",color:"#434C55",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px"},section:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",border:"1px solid #DEE4EB"},sectionLabel:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"8px",whiteSpace:"pre-line"},summaryText:{marginTop:"0px"},sectionText:{fontSize:"16px",fontWeight:400,lineHeight:"1.625",color:"#64748B",marginBottom:"8px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none"},lineClamp:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},container:{fontFamily:"Inter, sans-serif",color:"#434C54",marginBottom:"8px"},partContainer:{marginBottom:"8px"},partTitle:{fontSize:"16px",fontWeight:"600",marginBottom:"10px"},chapterList:{listStyle:"none",paddingLeft:"20px",margin:0},chapterItem:{marginBottom:"6px"},chapterLink:{textDecoration:"none",color:"#63748A",fontSize:"16px",lineHeight:"1.5"},chapterLinkHover:{textDecoration:"underline"},singleChapter:{marginBottom:"4px",fontSize:"16px"},chapterNumber:{color:"#63748A"}};exports.default=function(i){var l,o,a,h,m,p,_,x,v,f,y,b,j,k,T,S=i.data,C=i.highlightTerms,N=i.onHighlightMatch,H=n.useState(!1),L=H[0],B=H[1],w=n.useState(!1),F=w[0],I=w[1],z=n.useState(!1),M=z[0],D=z[1],O=n.useState(!1),A=O[0],E=O[1],W=n.useRef(null),q=n.useRef(null),P=(null==S?void 0:S.tableOfContent)&&S.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),R=null===(h=null===(a=null===(o=null===(l=null==S?void 0:S.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===o?void 0:o.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===a?void 0:a.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===h?void 0:h.replace(/overflow:\s*hidden;?/g,""),V=function(e){return null!=e?String(e):""};return n.useLayoutEffect(function(){if(W.current){var e=W.current.scrollHeight>W.current.clientHeight;E(e)}},[null==S?void 0:S.bookDescription,F]),n.useEffect(function(){var e;if(null==C?void 0:C.length){var t=C.map(function(e){return e.toLowerCase()}),n=function(e){return e&&t.some(function(t){return e.toLowerCase().includes(t)})},i=n(S.title),l=n(S.author),o=n(S.bookDescription),s=n(S.summary),r=n(V(null==S?void 0:S.totalSectionCount)),a=n(V(null==S?void 0:S.totalPages)),u=n(S.readingTime),c=null===(e=null==S?void 0:S.tableOfContent)||void 0===e?void 0:e.some(function(e){var t;return n(null==e?void 0:e.title)||(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.some(function(e){return n(null==e?void 0:e.title)}))}),d=i||l||o||s||r||a||u||c;null==N||N(d),d&&(o&&I(!0),s&&B(!0),c&&D(!0))}},[C,S]),t.jsxs("div",e.__assign({ref:q,style:g.card,className:"book-card-container"},{children:[t.jsxs("div",e.__assign({style:g.grid,className:"book-card-grid"},{children:[t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Title"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.title,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(m=null==S?void 0:S.title)&&void 0!==m?m:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.title},{children:null!==(p=null==S?void 0:S.title)&&void 0!==p?p:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Author"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.author,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(_=null==S?void 0:S.author)&&void 0!==_?_:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.author},{children:null!==(x=null==S?void 0:S.author)&&void 0!==x?x:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Sections"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(v=String(null==S?void 0:S.totalSectionCount))&&void 0!==v?v:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(f=null==S?void 0:S.totalSectionCount)&&void 0!==f?f:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Pages"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(y=null==S?void 0:S.totalPages)&&void 0!==y?y:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(b=null==S?void 0:S.totalPages)&&void 0!==b?b:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Reading Time"})),C&&C.length>0?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(j=null==S?void 0:S.readingTime)&&void 0!==j?j:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(k=null==S?void 0:S.readingTime)&&void 0!==k?k:"NA"}))]}))]})),(null==S?void 0:S.bookDescription)&&(null==S?void 0:S.bookDescription.length)>0&&t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"Book Description"})),t.jsx("div",e.__assign({ref:W,className:"book-card-section-text",style:e.__assign(e.__assign(e.__assign({},g.sectionText),g.summaryText),F?{}:g.lineClamp)},{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(R||"",C)):R}})})),(A||F)&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return I(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:F?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"AI Book Summary"})),t.jsx("p",e.__assign({className:"book-card-section-text",style:e.__assign(e.__assign({},g.sectionText),L?{}:g.lineClamp)},{children:t.jsx(u.default,e.__assign({remarkPlugins:[c.default],rehypePlugins:[d.default],components:{p:function(n){n.node;var i=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:s.processTextWithHighlight(null==S?void 0:S.summary,C)}))})),(null==S?void 0:S.summary)&&(null==S?void 0:S.summary.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return B(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:L?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.section),{marginTop:"10px"})},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),t.jsx("div",e.__assign({style:e.__assign(e.__assign({},g.container),M?{}:g.lineClamp)},{children:(null==S?void 0:S.tableOfContent)&&!P?null===(T=null==S?void 0:S.tableOfContent)||void 0===T?void 0:T.map(function(n,i){return t.jsx("div",e.__assign({style:g.partContainer},{children:n.children?t.jsxs(t.Fragment,{children:[t.jsx("p",{style:g.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}}),t.jsx("ul",e.__assign({style:g.chapterList},{children:n.children.map(function(n,i){return t.jsx("li",e.__assign({style:g.chapterItem},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}),i)})}))]}):t.jsx("div",e.__assign({style:g.singleChapter},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}))}),i)}):t.jsx("p",e.__assign({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==S?void 0:S.tableOfContent)&&!P&&(null==S?void 0:S.tableOfContent.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return D(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:M?"View Less":"View More"}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),i=require("react-markdown"),l=require("remark-breaks"),o=require("rehype-raw"),s=require("../utils/highlight.js"),r=require("../../../utils/sanitizeHtml.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(i),d=a(l),c=a(o),g={card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",padding:"24px"},title:{fontSize:"16px",fontWeight:"bold",marginBottom:"24px"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:"24px",marginBottom:"24px"},gridItem:{backgroundColor:"#F8FAFC",border:"1px solid #DFE5EC",borderRadius:"8px",padding:"12px 8px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"12px"},gridItemHeight:{height:"50px"},label:{fontSize:"14px",fontWeight:400,color:"#64748B",margin:0},value:{fontWeight:"bold",fontSize:"14px",color:"#434C55",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"120px"},section:{marginBottom:"12px",padding:"8px 12px",borderRadius:"8px",border:"1px solid #DEE4EB"},sectionLabel:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"8px",whiteSpace:"pre-line"},summaryText:{marginTop:"0px"},sectionText:{fontSize:"16px",fontWeight:400,lineHeight:"1.625",color:"#64748B",marginBottom:"8px"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none"},lineClamp:{display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",overflow:"hidden"},container:{fontFamily:"Inter, sans-serif",color:"#434C54",marginBottom:"8px"},partContainer:{marginBottom:"8px"},partTitle:{fontSize:"16px",fontWeight:"600",marginBottom:"10px"},chapterList:{listStyle:"none",paddingLeft:"20px",margin:0},chapterItem:{marginBottom:"6px"},chapterLink:{textDecoration:"none",color:"#63748A",fontSize:"16px",lineHeight:"1.5"},chapterLinkHover:{textDecoration:"underline"},singleChapter:{marginBottom:"4px",fontSize:"16px"},chapterNumber:{color:"#63748A"}};exports.default=function(i){var l,o,a,h,m,p,_,x,v,f,y,b,j,k,T,S=i.data,C=i.highlightTerms,N=i.onHighlightMatch,H=i.highlightEnabled,L=n.useState(!1),B=L[0],w=L[1],F=n.useState(!1),I=F[0],z=F[1],M=n.useState(!1),D=M[0],O=M[1],A=n.useState(!1),E=A[0],W=A[1],q=n.useRef(null),P=n.useRef(null),R=(null==S?void 0:S.tableOfContent)&&S.tableOfContent.every(function(e){return!e.title||""===e.title.trim()}),V=null===(h=null===(a=null===(o=null===(l=null==S?void 0:S.bookDescription)||void 0===l?void 0:l.replace(/display:\s*-webkit-box;?/g,""))||void 0===o?void 0:o.replace(/-webkit-line-clamp:\s*\d+;?/g,""))||void 0===a?void 0:a.replace(/-webkit-box-orient:\s*vertical;?/g,""))||void 0===h?void 0:h.replace(/overflow:\s*hidden;?/g,""),G=function(e){return null!=e?String(e):""};return n.useLayoutEffect(function(){if(q.current){var e=q.current.scrollHeight>q.current.clientHeight;W(e)}},[null==S?void 0:S.bookDescription,I]),n.useEffect(function(){var e;if((null==C?void 0:C.length)&&H){var t=C.map(function(e){return e.toLowerCase()}),n=function(e){return e&&t.some(function(t){return e.toLowerCase().includes(t)})},i=n(S.title),l=n(S.author),o=n(S.bookDescription),s=n(S.summary),r=n(G(null==S?void 0:S.totalSectionCount)),a=n(G(null==S?void 0:S.totalPages)),u=n(S.readingTime),d=null===(e=null==S?void 0:S.tableOfContent)||void 0===e?void 0:e.some(function(e){var t;return n(null==e?void 0:e.title)||(null===(t=null==e?void 0:e.children)||void 0===t?void 0:t.some(function(e){return n(null==e?void 0:e.title)}))}),c=i||l||o||s||r||a||u||d;null==N||N(c),c&&(o&&z(!0),s&&w(!0),d&&O(!0))}},[C,S]),t.jsxs("div",e.__assign({ref:P,style:g.card,className:"book-card-container"},{children:[t.jsxs("div",e.__assign({style:g.grid,className:"book-card-grid"},{children:[t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Title"})),C&&C.length>0&&H?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.title,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(m=null==S?void 0:S.title)&&void 0!==m?m:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.title},{children:null!==(p=null==S?void 0:S.title)&&void 0!==p?p:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Book Author"})),C&&C.length>0&&H?t.jsx("p",{style:g.value,className:"book-card-value",title:null==S?void 0:S.author,dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(_=null==S?void 0:S.author)&&void 0!==_?_:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value",title:null==S?void 0:S.author},{children:null!==(x=null==S?void 0:S.author)&&void 0!==x?x:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Sections"})),C&&C.length>0&&H?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(null!==(v=String(null==S?void 0:S.totalSectionCount))&&void 0!==v?v:"NA",C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(f=null==S?void 0:S.totalSectionCount)&&void 0!==f?f:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Total Pages"})),C&&C.length>0&&H?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(y=null==S?void 0:S.totalPages)&&void 0!==y?y:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(b=null==S?void 0:S.totalPages)&&void 0!==b?b:"NA"}))]})),t.jsxs("div",e.__assign({style:g.gridItem},{children:[t.jsx("p",e.__assign({style:g.label},{children:"Reading Time"})),C&&C.length>0&&H?t.jsx("p",{style:g.value,className:"book-card-value",dangerouslySetInnerHTML:{__html:r.sanitizeHtml(s.highlightTermsFunc(String(null!==(j=null==S?void 0:S.readingTime)&&void 0!==j?j:"NA"),C))}}):t.jsx("p",e.__assign({style:g.value,className:"book-card-value"},{children:null!==(k=null==S?void 0:S.readingTime)&&void 0!==k?k:"NA"}))]}))]})),(null==S?void 0:S.bookDescription)&&(null==S?void 0:S.bookDescription.length)>0&&t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"Book Description"})),t.jsx("div",e.__assign({ref:q,className:"book-card-section-text",style:e.__assign(e.__assign(e.__assign({},g.sectionText),g.summaryText),I?{}:g.lineClamp)},{children:t.jsx("div",{dangerouslySetInnerHTML:{__html:C&&C.length>0&&H?r.sanitizeHtml(s.highlightTermsFunc(V||"",C)):V}})})),(E||I)&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return z(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:I?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:g.section,className:"book-card-section"},{children:[t.jsx("p",e.__assign({style:g.sectionLabel},{children:"AI Book Summary"})),t.jsx("p",e.__assign({className:"book-card-section-text",style:e.__assign(e.__assign({},g.sectionText),B?{}:g.lineClamp)},{children:t.jsx(u.default,e.__assign({remarkPlugins:[d.default],rehypePlugins:[c.default],components:{p:function(n){n.node;var i=e.__rest(n,["node"]);return t.jsx("p",e.__assign({style:{marginTop:"0"}},i))}}},{children:s.processTextWithHighlight(null==S?void 0:S.summary,C)}))})),(null==S?void 0:S.summary)&&(null==S?void 0:S.summary.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return w(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:B?"View Less":"View More"}))]})),t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},g.section),{marginTop:"10px"})},{children:[t.jsx("p",e.__assign({style:e.__assign(e.__assign({},g.sectionLabel),{marginBottom:"18px"})},{children:"Table Of Content"})),t.jsx("div",e.__assign({style:e.__assign(e.__assign({},g.container),D?{}:g.lineClamp)},{children:(null==S?void 0:S.tableOfContent)&&!R?null===(T=null==S?void 0:S.tableOfContent)||void 0===T?void 0:T.map(function(n,i){return t.jsx("div",e.__assign({style:g.partContainer},{children:n.children?t.jsxs(t.Fragment,{children:[t.jsx("p",{style:g.partTitle,className:"book-card-part-title",dangerouslySetInnerHTML:{__html:C&&C.length>0&&H?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}}),t.jsx("ul",e.__assign({style:g.chapterList},{children:n.children.map(function(n,i){return t.jsx("li",e.__assign({style:g.chapterItem},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0&&H?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}),i)})}))]}):t.jsx("div",e.__assign({style:g.singleChapter},{children:t.jsx("span",{style:g.chapterLink,className:"book-card-chapter-link",dangerouslySetInnerHTML:{__html:C&&C.length>0&&H?r.sanitizeHtml(s.highlightTermsFunc(n.title,C)):n.title}})}))}),i)}):t.jsx("p",e.__assign({style:{fontStyle:"italic",fontSize:"16px",color:"#6B7280",margin:"8px 0"}},{children:"Table of Contents not found for this book."}))})),(null==S?void 0:S.tableOfContent)&&!R&&(null==S?void 0:S.tableOfContent.length)>0&&t.jsx("button",e.__assign({style:e.__assign(e.__assign({},g.button),{marginBottom:"10px"}),onClick:function(){return O(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:D?"View Less":"View More"}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookOverviewCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),l=require("../utils/highlight.js"),t=require("../../../utils/sanitizeHtml.js"),r={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},card:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:500,fontSize:"14px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word",marginBottom:"24px",width:"fit-content"},tag:{padding:"4px 12px",fontSize:"14px",fontWeight:500,color:"#3B82F6",backgroundColor:"#F3F8FF",borderRadius:"6px"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",height:"35px",width:"35px",borderRadius:"50%",backgroundColor:"#E5E7EB",color:"#4B5563",fontWeight:600,flexShrink:0,fontSize:"12px"},contributorName:{fontWeight:600,color:"#111827",marginTop:"8px",fontSize:"14px"},contributorRole:{fontSize:"12px",color:"#6B7280"},grid:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"24px",marginBottom:"24px",padding:"0 12px"},awardMeta:{fontSize:"14px",color:"#4B5563"},awardDesc:{fontSize:"14px",color:"#4B5563"},awardContainer:{display:"flex",gap:"8px"},awardInfo:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:600,fontSize:"12px",borderRadius:"4px",color:"#434C54",maxWidth:"100%",wordBreak:"break-word",width:"fit-content"},listContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"30px",marginBottom:"24px"},awardContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"16px"}};exports.default=function(a){var o,s,d,p=a.data,u=a.highlightTerms,c=a.onHighlightMatch,g=p.publisher,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),l=require("../utils/highlight.js"),t=require("../../../utils/sanitizeHtml.js"),r={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},card:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:500,fontSize:"14px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word",marginBottom:"24px",width:"fit-content"},tag:{padding:"4px 12px",fontSize:"14px",fontWeight:500,color:"#3B82F6",backgroundColor:"#F3F8FF",borderRadius:"6px"},avatar:{display:"flex",alignItems:"center",justifyContent:"center",height:"35px",width:"35px",borderRadius:"50%",backgroundColor:"#E5E7EB",color:"#4B5563",fontWeight:600,flexShrink:0,fontSize:"12px"},contributorName:{fontWeight:600,color:"#111827",marginTop:"8px",fontSize:"14px"},contributorRole:{fontSize:"12px",color:"#6B7280"},grid:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:"24px",marginBottom:"24px",padding:"0 12px"},awardMeta:{fontSize:"14px",color:"#4B5563"},awardDesc:{fontSize:"14px",color:"#4B5563"},awardContainer:{display:"flex",gap:"8px"},awardInfo:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:600,fontSize:"12px",borderRadius:"4px",color:"#434C54",maxWidth:"100%",wordBreak:"break-word",width:"fit-content"},listContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"30px",marginBottom:"24px"},awardContainerWrapper:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"16px"}};exports.default=function(a){var o,s,d,p=a.data,u=a.highlightTerms,c=a.onHighlightMatch,g=a.highlightEnabled,h=p.publisher,m=p.contributors,x=p.awards,v=void 0===x?[]:x,_=i.useRef(null),f=function(e){var n=e.trim().split(/\s+/).map(function(e){var n;return null===(n=e[0])||void 0===n?void 0:n.toUpperCase()}).join("");return n.length>3?"".concat(n.slice(0,3)):n};return i.useEffect(function(){var n,i,l,t,r,a,o,s,d,h,m,x;if(u&&0!==u.length&&g){var v=e.__spreadArray(e.__spreadArray(e.__spreadArray(e.__spreadArray([null!==(i=null===(n=p.publisher)||void 0===n?void 0:n.name)&&void 0!==i?i:""],null!==(t=null===(l=p.publisher)||void 0===l?void 0:l.tags)&&void 0!==t?t:[],!0),null!==(o=null===(a=null===(r=p.contributors)||void 0===r?void 0:r.primary)||void 0===a?void 0:a.flatMap(function(n){var i;return e.__spreadArray([n.name,n.role],null!==(i=n.tags)&&void 0!==i?i:[],!0)}))&&void 0!==o?o:[],!0),null!==(h=null===(d=null===(s=p.contributors)||void 0===s?void 0:s.additional)||void 0===d?void 0:d.flatMap(function(n){var i;return e.__spreadArray([n.name,n.role],null!==(i=n.tags)&&void 0!==i?i:[],!0)}))&&void 0!==h?h:[],!0),null!==(x=null===(m=p.awards)||void 0===m?void 0:m.flatMap(function(e){return[e.title,e.org,String(e.year),e.country]}))&&void 0!==x?x:[],!0).some(function(e){return!!e&&u.some(function(n){return e.toLowerCase().includes(n.toLowerCase())})});null==c||c(v)}},[u,p]),n.jsxs("div",e.__assign({ref:_,className:"book-people-container"},{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Publishers"})),n.jsxs("div",e.__assign({style:r.card,className:"book-people-card"},{children:[n.jsx("span",e.__assign({style:{color:"rgb(67, 76, 85)"}},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(h.name,u))}}):h.name})),(null==h?void 0:h.tags)&&(null==h?void 0:h.tags.length)>0&&n.jsx("div",e.__assign({style:{display:"flex",gap:"8px",marginTop:"18px"}},{children:null===(o=null==h?void 0:h.tags)||void 0===o?void 0:o.map(function(i,a){return n.jsx("span",e.__assign({style:r.tag},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(i,u))}}):i}),a)})}))]})),n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Contributors"})),n.jsx("div",e.__assign({style:r.listContainerWrapper,className:"book-people-list-wrapper"},{children:null===(s=null==m?void 0:m.primary)||void 0===s?void 0:s.map(function(i,a){var o;return n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},{children:[n.jsx("div",e.__assign({style:r.avatar,className:"book-people-avatar"},{children:f(null==i?void 0:i.name)})),n.jsx("span",e.__assign({style:r.contributorName,className:"book-people-name"},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.name,u))}}):null==i?void 0:i.name})),n.jsx("span",e.__assign({style:r.contributorRole,className:"book-people-role"},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.role,u))}}):null==i?void 0:i.role})),n.jsx("div",e.__assign({style:{display:"flex",gap:"8px",marginTop:"8px"}},{children:null===(o=null==i?void 0:i.tags)||void 0===o?void 0:o.map(function(i,a){return n.jsx("span",e.__assign({style:r.tag},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(i,u))}}):i}),a)})}))]}),a)})})),m.additional&&m.additional.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Additional Contributors"})),n.jsx("div",e.__assign({style:r.listContainerWrapper,className:"book-people-list-wrapper"},{children:null===(d=null==m?void 0:m.additional)||void 0===d?void 0:d.map(function(i,a){return n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"}},{children:[n.jsx("div",e.__assign({style:r.avatar,className:"book-people-avatar"},{children:f(null==i?void 0:i.name)})),n.jsx("span",e.__assign({style:r.contributorName,className:"book-people-name"},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.name,u))}}):null==i?void 0:i.name})),n.jsx("span",e.__assign({style:r.contributorRole,className:"book-people-role"},{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.role,u))}}):null==i?void 0:i.role}))]}),a)})}))]}),v.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("p",e.__assign({style:r.sectionTitle,className:"book-people-section-title"},{children:"Awards"})),n.jsx("div",e.__assign({style:r.awardContainerWrapper,className:"book-people-award-wrapper"},{children:null==v?void 0:v.map(function(i,a){return n.jsx("div",e.__assign({style:r.awardInfo},{children:n.jsx("span",{children:u&&u.length>0&&g?n.jsx("span",{dangerouslySetInnerHTML:{__html:t.sanitizeHtml(l.highlightTermsFunc(null==i?void 0:i.title,u))}}):null==i?void 0:i.title})}),a)})}))]})]}))};
|
|
2
2
|
//# sourceMappingURL=BookPeopleAwardsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),t=require("@mui/material/Dialog"),o=require("@mui/material/DialogContent"),n=require("./BookemonContent.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t),r=l(o),a={maxWidth:"none",fontFamily:"Inter, sans-serif"},g={wrapper:{alignItems:"center",justifyContent:"center",textAlign:"center"},inner:{width:"100%"},iconWrapper:{width:"80px",height:"80px",background:"linear-gradient(to right, #3B82F6, #9333EA)",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px auto"},icon:{width:"40px",height:"40px",color:"#FFFFFF"},heading:{fontSize:"36px",fontWeight:"bold",color:"#9333EA",marginBottom:"16px"},text:{fontSize:"18px",color:"#4B5563",lineHeight:1.6,textAlign:"center"},errorState:{color:"#CE3928",padding:"18px 0px",display:"flex",justifyContent:"center",width:"100%"}},d=i.jsx("svg",e.__assign({style:g.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},{children:i.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}));exports.comingSoonStyles=g,exports.default=function(t){var o=t.open,l=t.onClose,g=t.isDialog,h=void 0===g||g,u=t.isBookPreview,c=void 0===u||u,m=t.isNonHighlightedBlur,p=t.isBookemon,x=t.getHighlightContent,f=t.handleFetchManuscriptElements,B=t.data,y=t.showComingSoon,C=void 0!==y&&y,v=t.comingSoonData,S=void 0===v?{header:"Bookemon Coming Soon!!",subheader:"We're working on something amazing. Stay tuned for updates!",icon:d}:v,k=t.customStyle,j=void 0===k?{}:k,w=t.isBlurToggleVisible,_=void 0!==w&&w,b=t.highlightTerms,F=t.defaultElementPages,T=t.citationType,D=t.citationSubTitle,E=null!=o&&o,P=null!=l?l:function(){};return h?i.jsx(s.default,e.__assign({open:E,fullWidth:!0,PaperProps:{style:e.__assign(e.__assign({},a),null==j?void 0:j.dialogDimension)}},{children:i.jsx(r.default,e.__assign({style:{padding:0}},{children:i.jsx(n.BookemonContent,{data:B,customStyle:j,comingSoonData:S,showComingSoon:C,isNonHighlightedBlur:m,isBlurToggleVisible:_,isBookemon:p,highlightTerms:b,getHighlightContent:x,handleFetchManuscriptElements:f,isBookPreview:c,isDialog:h,onClose:P,defaultElementPages:F})}))})):i.jsx("div",e.__assign({style:{width:"100%",height:"100%"}},{children:i.jsx(n.BookemonContent,{data:B,customStyle:j,comingSoonData:S,showComingSoon:C,isNonHighlightedBlur:m,isBlurToggleVisible:_,isBookemon:p,highlightTerms:b,getHighlightContent:x,handleFetchManuscriptElements:f,isBookPreview:c,isDialog:h,onClose:P,defaultElementPages:F,citationType:T,citationSubTitle:D})}))},exports.defaultIcon=d;
|
|
2
2
|
//# sourceMappingURL=Bookemon.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("react-resizable-panels"),o=require("@mui/material/Accordion"),r=require("@mui/material/AccordionSummary"),a=require("@mui/material/Typography"),l=require("@mui/material/AccordionDetails"),s=require("@mui/material/IconButton"),d=require("./BookDetailsCard/BookDetailsCard.js"),u=require("./BookOverviewCard/BookOverviewCard.js"),c=require("./BookElementsCard/BookElementsCard.js"),g=require("./BookCopyrightsCard/BookCopyrightsCard.js"),h=require("./BookPeopleAwardsCard/BookPeopleAwardsCard.js"),x=require("./BookPreview/BookPreview.js"),f=require("@mui/icons-material/ExpandMore"),p=require("@mui/icons-material/Close");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=v(o),m=v(r),y=v(a),b=v(l),j=v(s),k=v(f),C=v(p),w={dialogPaper:{maxWidth:"none",fontFamily:"Inter, sans-serif"},dialogHeight:{overflow:"hidden",height:"90vh",position:"relative"},dialogContent:{padding:0,backgroundColor:"#FFFFFF"},container:{display:"flex",height:"100%",width:"100%",alignItems:"flex-start"},leftPanel:{height:"100%",padding:"24px",overflowY:"auto",backgroundColor:"#F3F4F6",borderRadius:"12px",boxSizing:"border-box"},rightPanel:{width:"40%",backgroundColor:"#FFFFFF",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-start",overflow:"auto",flex:1,boxSizing:"border-box",overflowY:"auto"},accordion:{borderRadius:"12px",boxShadow:"none",marginBottom:"24px"},accordionSummary:{paddingLeft:"16px",paddingRight:"16px"},accordionDetails:{paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"},heading:{fontWeight:"bold",color:"#000000",fontSize:"16px"},blurOverlay:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",backgroundColor:"rgba(255, 255, 255, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,borderRadius:"12px"},closeButton:{position:"absolute",top:"8px",right:"8px",color:"#111827"},resizeHandle:{width:"10px",backgroundColor:"#e5e7eb",cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center"},iconContainer:{display:"flex",flexDirection:"column",gap:"4px"},dot:{width:"4px",height:"4px",backgroundColor:"#6b7280",borderRadius:"50%"},resizeHandleBar:{width:"2px",height:"24px",backgroundColor:"#666",borderRadius:"2px"}},S={wrapper:{alignItems:"center",justifyContent:"center",textAlign:"center"},inner:{width:"100%"},iconWrapper:{width:"80px",height:"80px",background:"linear-gradient(to right, #3B82F6, #9333EA)",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px auto"},icon:{width:"40px",height:"40px",color:"#FFFFFF"},heading:{fontSize:"36px",fontWeight:"bold",color:"#9333EA",marginBottom:"16px"},text:{fontSize:"18px",color:"#4B5563",lineHeight:1.6,textAlign:"center"},errorState:{color:"#CE3928",padding:"18px 0px",display:"flex",justifyContent:"center",width:"100%"}},B=function(i){var n=i.header,o=i.subheader,r=i.icon;return t.jsx("div",e.__assign({style:S.wrapper},{children:t.jsxs("div",e.__assign({style:S.inner},{children:[t.jsx("div",e.__assign({style:{marginBottom:"32px"}},{children:t.jsx("div",e.__assign({style:S.iconWrapper},{children:r}))})),t.jsxs("div",{children:[t.jsx("h1",e.__assign({style:S.heading},{children:n})),t.jsx("p",e.__assign({style:S.text},{children:o}))]})]}))}))};exports.BookemonContent=function(o){var r=o.showComingSoon,a=o.onClose,l=o.highlightTerms,s=o.data,f=o.customStyle,p=o.comingSoonData,v=o.isNonHighlightedBlur,S=o.isBlurToggleVisible,D=o.isBookemon,F=o.getHighlightContent,P=o.handleFetchManuscriptElements,q=o.isBookPreview,H=o.isDialog,I=o.defaultElementPages,z=i.useState({textToHighLight:"",content:""}),E=z[0],M=z[1],R=i.useState(1),T=R[0],A=R[1],O=i.useState(!1),L=O[0],V=O[1],W=i.useState("Book Preview"),N=W[0],Q=W[1],Y=i.useState(70),G=Y[0],J=Y[1],K=i.useRef(null),U=i.useState(!1),X=U[0],Z=U[1],$=i.useRef(null),ee=i.useRef(null),te=i.useRef(null),ie=i.useRef(null),ne=i.useRef(null),oe=function(t,i,n,o){return void 0===o&&(o=0),e.__awaiter(void 0,void 0,void 0,function(){var r,a,l,s,d,u,c,g,h,x,f,p,v,_,m,y;return e.__generator(this,function(e){switch(e.label){case 0:M({textToHighLight:"",content:""}),Z(!1),V(!0),Q(i),e.label=1;case 1:return e.trys.push([1,5,6,7]),n&&0!==n.length?[4,null==F?void 0:F([n[o]])]:(V(!1),J(70),null===(m=K.current)||void 0===m||m.resize(70),[2]);case 2:if(r=e.sent(),a=(null==r?void 0:r.data)||r||[],!Array.isArray(a)||0===a.length)return Z(!0),V(!1),[2];for(s=(l=function(e){return e?e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/[\u2013\u2014]/g,"-").replace(/[.,!?;:'"(){}\[\]—–…\/\\@#&*_|\^~%=+<>`]/g,"").replace(/\s+/g," ").trim().toLowerCase():""})(t),d=null,u=0,c=a;u<c.length;u++)if(p=c[u],l(p.normalizedContent||p.htmlContent).includes(s)){d=p;break}if(!d)for(g=s.split(" ").filter(Boolean);g.length>0;){for(h=g.join(" "),x=0,f=a;x<f.length;x++)if(p=f[x],l(p.normalizedContent||p.htmlContent).includes(h)){d=p;break}if(d)break;g.pop()}return v=a.map(function(e){return e.htmlContent}).join("\n"),M({textToHighLight:d?d.htmlContent:"",content:v}),J(50),null===(y=K.current)||void 0===y||y.resize(50),!d&&o+1<n.length?[4,oe(t,i,n,o+1)]:[3,4];case 3:return[2,e.sent()];case 4:return[2];case 5:return _=e.sent(),console.error("Highlight error:",_),Z(!0),[3,7];case 6:return V(!1),[7];case 7:return[2]}})})},re=i.useState(!1),ae=re[0],le=re[1],se=i.useState(!1),de=se[0],ue=se[1],ce=i.useState(!1),ge=ce[0],he=ce[1],xe=i.useState(!1),fe=xe[0],pe=xe[1],ve=i.useState(!1),_e=ve[0],me=ve[1],ye=i.useState(!1),be=ye[0],je=ye[1],ke=i.useState(!1),Ce=ke[0],we=ke[1],Se=i.useState(!1),Be=Se[0],De=Se[1],Fe=i.useState(!1),Pe=Fe[0],qe=Fe[1],He=i.useState(!1),Ie=He[0],ze=He[1];i.useEffect(function(){ae&&je(!0),de&&we(!0),ge&&De(!0),fe&&qe(!0),_e&&ze(!0)},[ae,de,ge,fe,_e]);var Ee=s.bookAwards,Me=s.bookCopyRight,Re=s.bookDetails,Te=s.bookElements,Ae=s.bookOverView,Oe=s.bookCoverImage,Le=null==Re?void 0:Re.isbn,Ve=null!=a?a:function(){};return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},w.dialogContent),H?w.dialogHeight:{})},{children:[!r&&t.jsx("div",e.__assign({style:w.container},{children:t.jsxs(n.PanelGroup,e.__assign({direction:"horizontal"},{children:[t.jsx(n.Panel,e.__assign({order:1,ref:K,defaultSize:G||70},{children:t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},null==w?void 0:w.leftPanel),null==f?void 0:f.leftPanel)},{children:[t.jsx("div",e.__assign({ref:$,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(_.default,e.__assign({expanded:be,onChange:function(e,t){return je(t)},slotProps:{transition:{onEntered:function(){var e=$.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}},elevation:0,style:w.accordion},{children:[t.jsx(m.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(y.default,e.__assign({style:w.heading},{children:"Book Overview"}))})),t.jsx(b.default,e.__assign({style:w.accordionDetails},{children:Ae&&Object.keys(Ae).length>0?t.jsx(u.default,{data:Ae,highlightTerms:l,onHighlightMatch:le}):t.jsx("div",e.__assign({style:w.errorState},{children:"No overview data available."}))}))]}))})),t.jsx("div",e.__assign({ref:ee,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(_.default,e.__assign({elevation:0,style:w.accordion,expanded:Ce,onChange:function(e,t){return we(t)},slotProps:{transition:{onEntered:function(){var e=ee.current;if(e){var t=e.querySelector('[data-highlight="true"]');if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var i=new MutationObserver(function(){var t=e.querySelector('[data-highlight="true"]');t&&t.scrollIntoView({behavior:"auto",block:"center"}),i.disconnect()});i.observe(e,{childList:!0,subtree:!0})}}}}}},{children:[t.jsx(m.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(y.default,e.__assign({style:w.heading},{children:"Book Manuscript Elements"}))})),t.jsx(b.default,e.__assign({style:w.accordionDetails},{children:t.jsx(c.default,{data:Te,title:(null==Ae?void 0:Ae.title)||"",handleFetchManuscriptElements:P,BookIsbn:Le,updateQuotesToHighLight:oe,highlightTerms:l,onHighlightMatch:ue,defaultPages:I})}))]}))})),t.jsx("div",e.__assign({ref:te,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(_.default,e.__assign({expanded:Be,onChange:function(e,t){return De(t)},elevation:0,style:w.accordion,slotProps:{transition:{onEntered:function(){var e=te.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(m.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(y.default,e.__assign({style:w.heading},{children:"Book Metadata Details"}))})),t.jsx(b.default,e.__assign({style:w.accordionDetails},{children:Re&&Object.keys(Re).length>0?t.jsx(d.default,{data:Re,highlightTerms:l,onHighlightMatch:he}):t.jsx("div",e.__assign({style:w.errorState},{children:"No Book Metadata data available."}))}))]}))})),t.jsx("div",e.__assign({ref:ie,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(_.default,e.__assign({elevation:0,style:w.accordion,expanded:Pe,onChange:function(e,t){return qe(t)},slotProps:{transition:{onEntered:function(){var e=ie.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(m.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(y.default,e.__assign({style:w.heading},{children:"Copyrights & Marketing"}))})),t.jsx(b.default,e.__assign({style:w.accordionDetails},{children:Me&&Object.keys(Me).length>0?t.jsx(g.default,{data:Me,highlightTerms:l,onHighlightMatch:pe}):t.jsx("div",e.__assign({style:w.errorState},{children:"No Copyrights & Marketing data available."}))}))]}))})),t.jsx("div",e.__assign({ref:ne},{children:t.jsxs(_.default,e.__assign({elevation:0,style:w.accordion,expanded:Ie,onChange:function(e,t){return ze(t)},slotProps:{transition:{onEntered:function(){var e=ne.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(m.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(y.default,e.__assign({style:w.heading},{children:"People & Awards"}))})),t.jsx(b.default,e.__assign({style:w.accordionDetails},{children:Ee&&Object.keys(Ee).length>0?t.jsx(h.default,{data:Ee,highlightTerms:l,onHighlightMatch:me}):t.jsx("div",e.__assign({style:w.errorState},{children:"No People & Awards data available."}))}))]}))}))]}))})),q&&t.jsx(n.PanelResizeHandle,{style:{width:"3px",background:"#D1D5DC",cursor:"col-resize"}}),q&&t.jsx(n.Panel,e.__assign({order:2,minSize:30,maxSize:50,style:{overflow:"visible",position:"relative",transition:"all 300ms ease-in-out",WebkitTransition:"all 300ms ease-in-out"}},{children:t.jsx(x.default,{bookOverView:Ae,bookCoverImage:Oe,onClose:Ve,clickableElementCategory:N,quotesToHighLightData:E,updateQuotesToHighLight:oe,citationLoad:L,previewPage:T,setPreviewPage:A,customStyle:f,comingSoonData:p,isNonHighlightedBlur:v,isBlurToggleVisible:S,isBookemon:D,noHtmlContent:X})}))]}))})),r&&t.jsxs("div",e.__assign({style:w.blurOverlay},{children:[t.jsx(j.default,e.__assign({style:w.closeButton,onClick:a,size:"large"},{children:t.jsx(C.default,{})})),t.jsx(B,{header:null==p?void 0:p.header,subheader:null==p?void 0:p.subheader,icon:null==p?void 0:p.icon})]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),n=require("react-resizable-panels"),o=require("@mui/material/Accordion"),r=require("@mui/material/AccordionSummary"),a=require("@mui/material/Typography"),l=require("@mui/material/AccordionDetails"),s=require("@mui/material/IconButton"),d=require("./BookDetailsCard/BookDetailsCard.js"),u=require("./BookOverviewCard/BookOverviewCard.js"),c=require("./BookElementsCard/BookElementsCard.js"),h=require("./BookCopyrightsCard/BookCopyrightsCard.js"),g=require("./BookPeopleAwardsCard/BookPeopleAwardsCard.js"),x=require("./BookPreview/BookPreview.js"),p=require("@mui/icons-material/ExpandMore"),f=require("@mui/icons-material/Close");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=_(o),b=_(r),m=_(a),y=_(l),j=_(s),k=_(p),C=_(f),w={dialogPaper:{maxWidth:"none",fontFamily:"Inter, sans-serif"},dialogHeight:{overflow:"hidden",height:"90vh",position:"relative"},dialogContent:{padding:0,backgroundColor:"#FFFFFF"},container:{display:"flex",height:"100%",width:"100%",alignItems:"flex-start"},leftPanel:{height:"100%",padding:"24px",overflowY:"auto",backgroundColor:"#F3F4F6",borderRadius:"12px",boxSizing:"border-box"},rightPanel:{width:"40%",backgroundColor:"#FFFFFF",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-start",overflow:"auto",flex:1,boxSizing:"border-box",overflowY:"auto"},accordion:{borderRadius:"12px",boxShadow:"none",marginBottom:"24px"},accordionSummary:{paddingLeft:"16px",paddingRight:"16px"},accordionDetails:{paddingLeft:"16px",paddingRight:"16px",paddingBottom:"16px"},heading:{fontWeight:"bold",color:"#000000",fontSize:"16px"},blurOverlay:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)",backgroundColor:"rgba(255, 255, 255, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,borderRadius:"12px"},closeButton:{position:"absolute",top:"8px",right:"8px",color:"#111827"},resizeHandle:{width:"10px",backgroundColor:"#e5e7eb",cursor:"col-resize",display:"flex",alignItems:"center",justifyContent:"center"},iconContainer:{display:"flex",flexDirection:"column",gap:"4px"},dot:{width:"4px",height:"4px",backgroundColor:"#6b7280",borderRadius:"50%"},resizeHandleBar:{width:"2px",height:"24px",backgroundColor:"#666",borderRadius:"2px"}},S={wrapper:{alignItems:"center",justifyContent:"center",textAlign:"center"},inner:{width:"100%"},iconWrapper:{width:"80px",height:"80px",background:"linear-gradient(to right, #3B82F6, #9333EA)",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px auto"},icon:{width:"40px",height:"40px",color:"#FFFFFF"},heading:{fontSize:"36px",fontWeight:"bold",color:"#9333EA",marginBottom:"16px"},text:{fontSize:"18px",color:"#4B5563",lineHeight:1.6,textAlign:"center"},errorState:{color:"#CE3928",padding:"18px 0px",display:"flex",justifyContent:"center",width:"100%"}},B=function(i){var n=i.header,o=i.subheader,r=i.icon;return t.jsx("div",e.__assign({style:S.wrapper},{children:t.jsxs("div",e.__assign({style:S.inner},{children:[t.jsx("div",e.__assign({style:{marginBottom:"32px"}},{children:t.jsx("div",e.__assign({style:S.iconWrapper},{children:r}))})),t.jsxs("div",{children:[t.jsx("h1",e.__assign({style:S.heading},{children:n})),t.jsx("p",e.__assign({style:S.text},{children:o}))]})]}))}))};exports.BookemonContent=function(o){var r=o.showComingSoon,a=o.onClose,l=o.highlightTerms,s=o.data,p=o.customStyle,f=o.comingSoonData,_=o.isNonHighlightedBlur,S=o.isBlurToggleVisible,D=o.isBookemon,F=o.getHighlightContent,P=o.handleFetchManuscriptElements,q=o.isBookPreview,E=o.isDialog,H=o.defaultElementPages,I=o.citationType,T=o.citationSubTitle,z=i.useState({textToHighLight:"",content:""}),M=z[0],R=z[1],A=i.useState(1),O=A[0],L=A[1],V=i.useState(!1),W=V[0],N=V[1],Q=i.useState("Book Preview"),Y=Q[0],G=Q[1],J=i.useState(70),K=J[0],U=J[1],X=i.useRef(null),Z=i.useState(!1),$=Z[0],ee=Z[1],te=i.useRef(null),ie=i.useRef(null),ne=i.useRef(null),oe=i.useRef(null),re=i.useRef(null),ae=function(t,i,n,o){return void 0===o&&(o=0),e.__awaiter(void 0,void 0,void 0,function(){var r,a,l,s,d,u,c,h,g,x,p,f,_,v,b,m;return e.__generator(this,function(e){switch(e.label){case 0:R({textToHighLight:"",content:""}),ee(!1),N(!0),G(i),e.label=1;case 1:return e.trys.push([1,5,6,7]),n&&0!==n.length?[4,null==F?void 0:F([n[o]])]:(N(!1),U(70),null===(b=X.current)||void 0===b||b.resize(70),[2]);case 2:if(r=e.sent(),a=(null==r?void 0:r.data)||r||[],!Array.isArray(a)||0===a.length)return ee(!0),N(!1),[2];for(s=(l=function(e){return e?e.replace(/<[^>]*>/g," ").replace(/ /g," ").replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/[\u2013\u2014]/g,"-").replace(/[.,!?;:'"(){}\[\]—–…\/\\@#&*_|\^~%=+<>`]/g,"").replace(/\s+/g," ").trim().toLowerCase():""})(t),d=null,u=0,c=a;u<c.length;u++)if(f=c[u],l(f.normalizedContent||f.htmlContent).includes(s)){d=f;break}if(!d)for(h=s.split(" ").filter(Boolean);h.length>0;){for(g=h.join(" "),x=0,p=a;x<p.length;x++)if(f=p[x],l(f.normalizedContent||f.htmlContent).includes(g)){d=f;break}if(d)break;h.pop()}return _=a.map(function(e){return e.htmlContent}).join("\n"),R({textToHighLight:d?d.htmlContent:"",content:_}),U(50),null===(m=X.current)||void 0===m||m.resize(50),!d&&o+1<n.length?[4,ae(t,i,n,o+1)]:[3,4];case 3:return[2,e.sent()];case 4:return[2];case 5:return v=e.sent(),console.error("Highlight error:",v),ee(!0),[3,7];case 6:return N(!1),[7];case 7:return[2]}})})},le=i.useState(!1),se=le[0],de=le[1],ue=i.useState(!1),ce=ue[0],he=ue[1],ge=i.useState(!1),xe=ge[0],pe=ge[1],fe=i.useState(!1),_e=fe[0],ve=fe[1],be=i.useState(!1),me=be[0],ye=be[1],je=i.useState(!1),ke=je[0],Ce=je[1],we=i.useState(!1),Se=we[0],Be=we[1],De=i.useState(!1),Fe=De[0],Pe=De[1],qe=i.useState(!1),Ee=qe[0],He=qe[1],Ie=i.useState(!1),Te=Ie[0],ze=Ie[1];i.useEffect(function(){se&&Ce(!0),ce&&Be(!0),xe&&Pe(!0),_e&&He(!0),me&&ze(!0)},[se,ce,xe,_e,me]);var Me=s.bookAwards,Re=s.bookCopyRight,Ae=s.bookDetails,Oe=s.bookElements,Le=s.bookOverView,Ve=s.bookCoverImage,We=null==Ae?void 0:Ae.isbn,Ne=null!=a?a:function(){},Qe=void 0!==T&&!!T.length&&["notable_quotes","location_details","notable_characters"].includes(T);return t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},w.dialogContent),E?w.dialogHeight:{})},{children:[!r&&t.jsx("div",e.__assign({style:w.container},{children:t.jsxs(n.PanelGroup,e.__assign({direction:"horizontal"},{children:[t.jsx(n.Panel,e.__assign({order:1,ref:X,defaultSize:K||70},{children:t.jsxs("div",e.__assign({style:e.__assign(e.__assign({},null==w?void 0:w.leftPanel),null==p?void 0:p.leftPanel)},{children:[t.jsx("div",e.__assign({ref:te,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(v.default,e.__assign({expanded:ke,onChange:function(e,t){return Ce(t)},slotProps:{transition:{onEntered:function(){var e=te.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}},elevation:0,style:w.accordion},{children:[t.jsx(b.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(m.default,e.__assign({style:w.heading},{children:"Book Overview"}))})),t.jsx(y.default,e.__assign({style:w.accordionDetails},{children:Le&&Object.keys(Le).length>0?t.jsx(u.default,{data:Le,highlightTerms:l,onHighlightMatch:de,highlightEnabled:!Qe}):t.jsx("div",e.__assign({style:w.errorState},{children:"No overview data available."}))}))]}))})),t.jsx("div",e.__assign({ref:ie,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(v.default,e.__assign({elevation:0,style:w.accordion,expanded:Se,onChange:function(e,t){return Be(t)},slotProps:{transition:{onEntered:function(){var e=ie.current;if(e){var t=e.querySelector('[data-highlight="true"]');if(t){t.scrollIntoView({behavior:"smooth",block:"center"});var i=new MutationObserver(function(){var t=e.querySelector('[data-highlight="true"]');t&&t.scrollIntoView({behavior:"auto",block:"center"}),i.disconnect()});i.observe(e,{childList:!0,subtree:!0})}}}}}},{children:[t.jsx(b.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(m.default,e.__assign({style:w.heading},{children:"Book Manuscript Elements"}))})),t.jsx(y.default,e.__assign({style:w.accordionDetails},{children:t.jsx(c.default,{data:Oe,title:(null==Le?void 0:Le.title)||"",handleFetchManuscriptElements:P,BookIsbn:We,updateQuotesToHighLight:ae,highlightTerms:l,onHighlightMatch:he,defaultPages:H,citationType:I,citationSubTitle:T,highlightEnabled:Qe})}))]}))})),t.jsx("div",e.__assign({ref:ne,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(v.default,e.__assign({expanded:Fe,onChange:function(e,t){return Pe(t)},elevation:0,style:w.accordion,slotProps:{transition:{onEntered:function(){var e=ne.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(b.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(m.default,e.__assign({style:w.heading},{children:"Book Metadata Details"}))})),t.jsx(y.default,e.__assign({style:w.accordionDetails},{children:Ae&&Object.keys(Ae).length>0?t.jsx(d.default,{data:Ae,highlightTerms:l,onHighlightMatch:pe,highlightEnabled:!Qe,citationType:I,citationSubTitle:T}):t.jsx("div",e.__assign({style:w.errorState},{children:"No Book Metadata data available."}))}))]}))})),t.jsx("div",e.__assign({ref:oe,style:{marginBottom:"24px"},onMouseDown:function(e){return e.preventDefault()}},{children:t.jsxs(v.default,e.__assign({elevation:0,style:w.accordion,expanded:Ee,onChange:function(e,t){return He(t)},slotProps:{transition:{onEntered:function(){var e=oe.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(b.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(m.default,e.__assign({style:w.heading},{children:"Copyrights & Marketing"}))})),t.jsx(y.default,e.__assign({style:w.accordionDetails},{children:Re&&Object.keys(Re).length>0?t.jsx(h.default,{data:Re,highlightTerms:l,onHighlightMatch:ve,highlightEnabled:!Qe}):t.jsx("div",e.__assign({style:w.errorState},{children:"No Copyrights & Marketing data available."}))}))]}))})),t.jsx("div",e.__assign({ref:re},{children:t.jsxs(v.default,e.__assign({elevation:0,style:w.accordion,expanded:Te,onChange:function(e,t){return ze(t)},slotProps:{transition:{onEntered:function(){var e=re.current,t=null==e?void 0:e.querySelector('[data-highlight="true"]');t&&e&&!e.dataset.scrolled&&(t.scrollIntoView({behavior:"smooth",block:"center"}),e.dataset.scrolled="true")}}}},{children:[t.jsx(b.default,e.__assign({expandIcon:t.jsx(k.default,{}),style:w.accordionSummary},{children:t.jsx(m.default,e.__assign({style:w.heading},{children:"People & Awards"}))})),t.jsx(y.default,e.__assign({style:w.accordionDetails},{children:Me&&Object.keys(Me).length>0?t.jsx(g.default,{data:Me,highlightTerms:l,onHighlightMatch:ye,highlightEnabled:!Qe}):t.jsx("div",e.__assign({style:w.errorState},{children:"No People & Awards data available."}))}))]}))}))]}))})),q&&t.jsx(n.PanelResizeHandle,{style:{width:"3px",background:"#D1D5DC",cursor:"col-resize"}}),q&&t.jsx(n.Panel,e.__assign({order:2,minSize:30,maxSize:50,style:{overflow:"visible",position:"relative",transition:"all 300ms ease-in-out",WebkitTransition:"all 300ms ease-in-out"}},{children:t.jsx(x.default,{bookOverView:Le,bookCoverImage:Ve,onClose:Ne,clickableElementCategory:Y,quotesToHighLightData:M,updateQuotesToHighLight:ae,citationLoad:W,previewPage:O,setPreviewPage:L,customStyle:p,comingSoonData:f,isNonHighlightedBlur:_,isBlurToggleVisible:S,isBookemon:D,noHtmlContent:$})}))]}))})),r&&t.jsxs("div",e.__assign({style:w.blurOverlay},{children:[t.jsx(j.default,e.__assign({style:w.closeButton,onClick:a,size:"large"},{children:t.jsx(C.default,{})})),t.jsx(B,{header:null==f?void 0:f.header,subheader:null==f?void 0:f.subheader,icon:null==f?void 0:f.icon})]}))]}))};
|
|
2
2
|
//# sourceMappingURL=BookemonContent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),s=require("@react-pdf-viewer/core"),i=require("./PdfStyle.js"),t="https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";exports.default=function(l){var n=l.pdfUrl,o=l.plugins,d=l.onLoad,u=l.customStyles;return r.jsx("div",e.__assign({style:e.__assign(e.__assign({},i.pdfStyles.pdfConatiner),null==u?void 0:u.pdfContainer)},{children:r.jsx(s.Worker,e.__assign({workerUrl:t},{children:r.jsx(s.Viewer,{fileUrl:n,defaultScale:s.SpecialZoomLevel.ActualSize,plugins:o,onDocumentLoad:d})}))}))},exports.pdfWorker=t;
|
|
2
2
|
//# sourceMappingURL=PdfContainer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.pdfStyles={pdfViewer:{borderRadius:"12px",padding:"16px",width:"100%",height:"100%"},card:{border:"2px solid #E5E7EB",backgroundColor:"#FFFFFF",borderRadius:"12px",width:"100%"},header:{display:"flex",justifyContent:"space-between",alignItems:"center",position:"relative"},title:{fontSize:"14px",fontWeight:600,color:"#60A3F8",fontFamily:'Roboto, "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif'},toolbar:{display:"flex",alignItems:"center",gap:"8px",position:"relative"},button:{border:"1px solid #DFE5EC",borderRadius:"6px",padding:"4px 8px",fontSize:"14px",cursor:"pointer",backgroundColor:"#FFFFFF"},buttonDisabled:{opacity:.4,cursor:"not-allowed"},counter:{fontSize:"13px",color:"#64748B",margin:"0 6px"},viewerWrapper:{height:"30rem",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center",border:"1px solid #DEE4EB",borderRadius:"8px"},emptyState:{fontSize:"14px",color:"#EF4444"},pdfConatiner:{height:"100%",overflow:"auto",display:"flex",justifyContent:"center",alignItems:"center"}};
|
|
2
2
|
//# sourceMappingURL=PdfStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),n=require("./PdfStyle.js"),t=require("../../assests/svg/PdfViewerIcons.js");exports.default=function(l){l.highlightIndex,l.totalHighlights;var o=l.controls;l.currentPosition;var r=l.pdfName,i=l.onClose,a=l.pdfUrl,c=l.viewerRef,d=l.customStyles,u=l.customClasses,x=l.customIcons,g=o.ZoomInButton,m=o.ZoomOutButton,f=o.ZoomPopover;o.goToPrevious,o.goToNext;var _=(null==u?void 0:u.actionButton)||"p-1 hover:bg-gray-200 rounded-md transition-colors";return s.jsxs("div",e.__assign({className:(null==u?void 0:u.header)||"flex items-center justify-between mb-3 bg-[#FAFAFA] border-b border-gray-100 rounded-t-xl",style:e.__assign(e.__assign({},n.pdfStyles.header),null==d?void 0:d.header)},{children:[s.jsxs("div",e.__assign({className:"flex items-center gap-3"},{children:[s.jsx("div",e.__assign({style:e.__assign(e.__assign({},{borderRadius:"21px",border:"6px solid #E8F3FF",background:"#D5E8FF",display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",boxSizing:"content-box"}),null==d?void 0:d.pdfIconWrapper)},{children:(null==x?void 0:x.pdfIcon)||s.jsx(t.DefaultPdfIcon,{})})),s.jsx("span",e.__assign({className:(null==u?void 0:u.pdfName)||"text-gray-800 text-sm",style:e.__assign({fontWeight:500},null==d?void 0:d.pdfName)},{children:r}))]})),s.jsxs("div",e.__assign({className:"flex items-center gap-4 text-gray-600"},{children:[s.jsxs("div",e.__assign({className:"flex items-center gap-1"},{children:[s.jsx(m,{}),s.jsx("div",e.__assign({className:"text-sm font-medium w-14 text-center"},{children:s.jsx(f,{})})),s.jsx(g,{})]})),s.jsx("div",{className:"w-px h-5 bg-gray-300 mx-1"}),s.jsxs("div",e.__assign({className:"flex items-center gap-2"},{children:[s.jsx("button",e.__assign({onClick:function(){var e=null==c?void 0:c.current;e&&(document.fullscreenElement?document.exitFullscreen():e.requestFullscreen().catch(function(e){console.error("Error attempting to enable fullscreen: ".concat(e.message))}))},className:_,title:"Full Screen"},{children:(null==x?void 0:x.fullScreenIcon)||s.jsx(t.DefaultFullScreenIcon,{})})),a&&s.jsx("a",e.__assign({href:a,target:"_blank",rel:"noopener noreferrer",className:_,title:"Open in new tab"},{children:(null==x?void 0:x.downloadIcon)||s.jsx(t.DefaultDownloadIcon,{})})),i&&s.jsx("button",e.__assign({onClick:i,className:"".concat(_," ml-1"),title:"Close"},{children:(null==x?void 0:x.closeIcon)||s.jsx(t.DefaultCloseIcon,{})}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=PdfToolbar.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),i=require("@react-pdf-viewer/core"),r=require("./PdfContainer.js"),t=require("./PdfToolbar.js"),l=require("./PdfStyle.js"),o=require("./usePdfHighlight.js");require("@react-pdf-viewer/zoom/lib/styles/index.css"),require("@react-pdf-viewer/page-navigation/lib/styles/index.css"),require("@react-pdf-viewer/core/lib/styles/index.css"),require("@react-pdf-viewer/search/lib/styles/index.css");var a=require("react");exports.default=function(n){var u=n.pdfUrl,d=n.highlightText,c=n.highlightPages,f=n.jumpToPageValue,g=void 0===f?0:f,p=n.pdfName,h=n.onClose,m=n.customStyles,v=n.customClasses,x=n.customIcons,y=o.PdfHighlightControls(d,c),_=y.highlightIndex,q=y.cursorIndex,j=y.setCursorIndex,P=y.orderedKeys,w=y.totalHighlights,S=y.getValidPosition,b=y.tryJump,C=y.jumpToPage,I=y.zoomTo,A=y.plugins,F=y.controls,T=S(q),V=a.useRef(null);if(!u)return s.jsx("div",e.__assign({style:e.__assign(e.__assign({},l.pdfStyles.emptyState),null==m?void 0:m.emptyState)},{children:"PDF is not available for this selection"}));return s.jsxs("div",e.__assign({ref:V,className:(null==v?void 0:v.pdfViewerWrapper)||"",style:e.__assign(e.__assign(e.__assign({},l.pdfStyles.pdfViewer),{display:"flex",flexDirection:"column",height:"100%",width:"100%",backgroundColor:"#FAFAFA"}),null==m?void 0:m.pdfViewer)},{children:[s.jsx(t.default,{highlightIndex:_,totalHighlights:w,controls:F,currentPosition:T,pdfName:p,onClose:h,pdfUrl:u,viewerRef:V,customStyles:m,customClasses:v,customIcons:x}),s.jsx(r.default,{pdfUrl:u,plugins:A,customStyles:m,onLoad:function(){if(I(i.SpecialZoomLevel.ActualSize),g>0){var e=g-1,s=P[e],r=c[s];j(e),r>0&&C(r-1)}requestAnimationFrame(b)}})]}))};
|
|
2
2
|
//# sourceMappingURL=PdfViewer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as t,jsx as l}from"react/jsx-runtime";import{useRef as n,useEffect as e}from"react";import{highlightTermsFunc as o}from"../utils/highlight.js";import{sanitizeHtml as r}from"../../../utils/sanitizeHtml.js";var s={sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},textBlock:{fontSize:"14px",fontWeight:400,color:"#64748B",marginBottom:"24px"}},d=function(d){var h,a,g,u,c,p,v,m,y=d.data,f=d.highlightTerms,S=d.onHighlightMatch,x=d.highlightEnabled,T=y.copyright,_=y.salesRights,j=n(null);return e(function(){var i,t,l,n,e,o,r;if(f&&0!==f.length&&x){var s=[String(null!==(t=null===(i=y.copyright)||void 0===i?void 0:i.year)&&void 0!==t?t:""),null!==(n=null===(l=y.copyright)||void 0===l?void 0:l.owner)&&void 0!==n?n:"",null!==(o=null===(e=y.salesRights)||void 0===e?void 0:e.description)&&void 0!==o?o:"",null===(r=y.salesRights)||void 0===r?void 0:r.territory.join(", ")].some(function(i){return!!i&&f.some(function(t){return i.toLowerCase().includes(t.toLowerCase())})});null==S||S(s)}},[f,y]),t("div",i({ref:j},{children:[l("p",i({style:s.sectionTitle},{children:"Copyrights"})),t("div",i({style:s.textBlock},{children:[t("p",{children:["Copyright Year:"," ",f&&f.length>0&&x?l("span",{dangerouslySetInnerHTML:{__html:r(o(String(null!==(h=T.year)&&void 0!==h?h:"NA"),f))}}):null!==(a=T.year)&&void 0!==a?a:"NA"]}),t("p",{children:["Copyright Owner:"," ",f&&f.length>0&&x?l("span",{dangerouslySetInnerHTML:{__html:r(o(null!==(g=T.owner)&&void 0!==g?g:"NA",f))}}):null!==(u=T.owner)&&void 0!==u?u:"NA"]})]})),l("p",i({style:s.sectionTitle},{children:"Sales Rights"})),t("div",i({style:s.textBlock},{children:[l("p",{children:f&&f.length>0&&x?l("span",{dangerouslySetInnerHTML:{__html:r(o(null!==(c=_.description)&&void 0!==c?c:"",f))}}):null!==(p=_.description)&&void 0!==p?p:""}),t("p",{children:["Sales Territory:"," ",f&&f.length>0&&x?l("span",{dangerouslySetInnerHTML:{__html:r(o(null!==(v=_.territory.join(", "))&&void 0!==v?v:"NA",f))}}):null!==(m=_.territory.join(", "))&&void 0!==m?m:"NA"]})]}))]}))};export{d as default};
|
|
2
2
|
//# sourceMappingURL=BookCopyrightsCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as o,useMemo as r,useEffect as l}from"react";import{highlightTermsFunc as s}from"../utils/highlight.js";import{sanitizeHtml as a}from"../../../utils/sanitizeHtml.js";var d={container:{width:"100%"},sectionTitle:{fontSize:"14px",fontWeight:600,color:"#667085",marginBottom:"12px"},detailsContainer:{marginBottom:"24px",fontSize:"14px",fontWeight:400,color:"#64748B",display:"flex",flexDirection:"column",gap:"4px",paddingLeft:"12px"},detailsContainerItem:{margin:"4px 0"},boldText:{fontWeight:"bold"},categoriesContainer:{marginBottom:"24px"},categoriesList:{display:"flex",flexWrap:"wrap",gap:"12px",marginBottom:"8px",paddingLeft:"12px"},category:{backgroundColor:"#ECEEF1",padding:"8px 12px",fontWeight:400,fontSize:"12px",borderRadius:"4px",color:"#64748B",maxWidth:"100%",wordBreak:"break-word"},button:{color:"#5928ED",fontSize:"14px",fontWeight:600,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"none",paddingLeft:"12px"},reviewsList:{paddingLeft:"12px"},reviewCard:{border:"1px solid #CBD5E1",borderRadius:"6px",padding:"16px",marginBottom:"12px",backgroundColor:"#F8FAFC"},reviewText:{fontSize:"14px",fontStyle:"italic",fontWeight:400,color:"#475569",marginBottom:"8px"},reviewSource:{fontSize:"10px",color:"#475569",fontWeight:600}},c=function(c){var u,g,p,h,m,b,f,v,x,y,C,T,w,N=c.data,k=c.highlightTerms,S=c.onHighlightMatch,L=c.highlightEnabled;c.citationType;var I,_=c.citationSubTitle,M=i(!1),A=M[0],B=M[1],D=i(!1),j=D[0],H=D[1],W=o(null),z=null!==(u=null==k?void 0:k.map(function(e){return e.split(",")}).flat())&&void 0!==u?u:[],E=r(function(){return A?N.subjectCategories||[]:(N.subjectCategories||[]).slice(0,10)},[A,N.subjectCategories]);return l(function(){var e,t;if((null==k?void 0:k.length)&&L){var n="genre_details"==_?z.map(function(e){return e.toLowerCase()}):k.map(function(e){return e.toLowerCase()}),i=function(e){return e&&n.some(function(t){return e.toLowerCase().includes(t)})},o=[N.isbn,N.isbn10,N.imprint,N.publisher,N.publishingDate,N.age].some(i),r=(null!==(e=N.subjectCategories)&&void 0!==e?e:[]).some(i);console.log("categoriesMatch",r);var l=(null!==(t=N.reviews)&&void 0!==t?t:[]).some(function(e){return i(e.replace(/<[^>]+>/g,""))}),s=o||r||l;null==S||S(s),s&&(r&&!A&&B(!0),l&&!j&&H(!0))}},[k,N]),t("div",e({ref:W,style:d.container,className:"book-details-container"},{children:[n("p",e({style:d.sectionTitle,className:"book-details-section-title"},{children:"Product Details"})),t("div",e({style:d.detailsContainer,className:"book-details-details-container"},{children:[t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"ISBN:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(g=N.isbn)&&void 0!==g?g:"NA",k))}}):null!==(p=N.isbn)&&void 0!==p?p:"NA"]})),t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"ISBN 10:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(h=N.isbn10)&&void 0!==h?h:"NA",k))}}):null!==(m=N.isbn10)&&void 0!==m?m:"NA"]})),t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"Imprint:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(b=N.imprint)&&void 0!==b?b:"NA",k))}}):null!==(f=N.imprint)&&void 0!==f?f:"NA"]})),t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"Publisher:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(v=N.publisher)&&void 0!==v?v:"NA",k))}}):null!==(x=N.publisher)&&void 0!==x?x:"NA"]})),t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"Publishing Date:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(y=N.publishingDate)&&void 0!==y?y:"NA",k))}}):null!==(C=N.publishingDate)&&void 0!==C?C:"NA"]})),t("p",e({style:d.detailsContainerItem},{children:[n("span",e({style:d.boldText},{children:"Age:"}))," ",k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(null!==(T=N.age)&&void 0!==T?T:"NA",k))}}):null!==(w=N.age)&&void 0!==w?w:"NA"]}))]})),t("div",e({style:d.categoriesContainer},{children:[n("p",e({style:d.sectionTitle,className:"book-details-section-title"},{children:"Subject Categories"})),t("div",e({style:d.categoriesList,className:"book-details-categories-list"},{children:[E.map(function(t,i){return n("span",e({style:d.category,className:"book-details-category"},{children:k&&k.length>0&&L?n("span",{dangerouslySetInnerHTML:{__html:a(s(t,z))}}):t}),i)}),N.subjectCategories&&N.subjectCategories.length>10&&n("button",e({style:d.button,onClick:function(){return B(!A)},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:A?"View less":"View more"}))]}))]})),t("div",e({style:d.reviewsContainer},{children:[n("p",e({style:d.sectionTitle,className:"book-details-section-title"},{children:"Book Marketing Collateral"})),t("div",e({style:d.reviewsList,className:"book-details-reviews-list"},{children:[N.reviews&&N.reviews.length>0?(I=N.reviews.filter(function(e){return e.replace(/<[^>]+>/g,"").trim().replace(/&[#A-Za-z0-9]+;/g,"").trim().length>0}),(j?I:I.slice(0,3)).map(function(t,i){return n("div",e({style:d.reviewCard,className:"book-details-review-card"},{children:n("div",{style:d.reviewText,dangerouslySetInnerHTML:{__html:k&&k.length>0&&L?a(s(t,k)):t}})}),i)})):n("p",e({style:d.reviewText},{children:"No Book Marketing Collateral available for this book."})),N.reviews&&N.reviews.length>3&&n("button",e({style:d.button,onClick:function(){return H(function(e){return!e})},onMouseOver:function(e){return e.currentTarget.style.textDecoration="underline"},onMouseOut:function(e){return e.currentTarget.style.textDecoration="none"}},{children:j?"View less":"View more"}))]}))]}))]}))};export{c as default};
|
|
2
2
|
//# sourceMappingURL=BookDetailsCard.js.map
|