@fluid-topics/public-api
Advanced tools
Comparing version 1.0.39 to 1.0.40
@@ -261,4 +261,4 @@ "use strict"; | ||
} | ||
sendMapFeedback(mapId, message) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).feedback, { message }); | ||
sendMapFeedback(mapId, message, from) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).feedback, { message, from }); | ||
} | ||
@@ -273,4 +273,4 @@ rateTopic(mapId, tocId, type, value) { | ||
} | ||
sendTopicFeedback(mapId, tocId, message) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).feedback, { message }); | ||
sendTopicFeedback(mapId, tocId, message, from) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).feedback, { message, from }); | ||
} | ||
@@ -286,4 +286,4 @@ getDocumentRating(docId) { | ||
} | ||
sendDocumentFeedback(docId, message) { | ||
return this.post(this.endpoints.khub.documents.documentId(docId).feedback, { message }); | ||
sendDocumentFeedback(docId, message, from) { | ||
return this.post(this.endpoints.khub.documents.documentId(docId).feedback, { message, from }); | ||
} | ||
@@ -290,0 +290,0 @@ getFluidTopicsMessageContext(locale, name) { |
@@ -169,2 +169,3 @@ "use strict"; | ||
return isObject(o) | ||
&& (o.from == null || isString(o.from)) | ||
&& (isString(o.message)); | ||
@@ -171,0 +172,0 @@ }; |
@@ -18,2 +18,3 @@ "use strict"; | ||
&& (isBoolean(o.mailsSentByFluidTopics)) | ||
&& (isBoolean(o.mailsSentByFluidTopicsForUnauthenticatedUsers)) | ||
&& ((Array.isArray(o.recipients) | ||
@@ -20,0 +21,0 @@ && o.recipients.every((v) => isString(v)))) |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e),l=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),u=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>u(e)))&&(null==e.topicLink||c(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),c=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),d=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),p=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>p(e)))&&s(e.contentId)&&s(e.title);var h;e.FtTopicContentTarget=void 0,(h=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",h.OFF_THE_GRID="OFF_THE_GRID",h.CONTENT_PACKAGER="CONTENT_PACKAGER",h.PAGES="PAGES",h.DESIGNED_READER="DESIGNED_READER";const y=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),f=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),m=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>w(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.contentLocale||s(e.contentLocale));var A;e.FtRatingType=void 0,(A=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",A.LIKE="LIKE",A.DICHOTOMOUS="DICHOTOMOUS",A.NO_RATING="NO_RATING";const g=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),b=e=>r(e)&&s(e.date)&&g(e.type)&&n(e.value),E=e=>r(e)&&(null==e.rating||b(e.rating))&&g(e.type),T=e=>r(e)&&s(e.date)&&s(e.tocId)&&g(e.type)&&n(e.value),R=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>T(e)))&&g(e.type),S=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),U=e=>r(e)&&s(e.from)&&s(e.to),F=e=>r(e)&&(null==e.period||U(e.period))&&I(e.periodType);var _;e.FtPeriodFilterType=void 0,(_=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",_.LAST_MONTH="LAST_MONTH",_.LAST_YEAR="LAST_YEAR",_.CUSTOM="CUSTOM";const I=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),O=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key),v=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var P;e.FtEditorialType=void 0,(P=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",P.BOOK="BOOK";const C=e=>["ARTICLE","BOOK"].includes(e);var D;e.FtOpenMode=void 0,(D=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",D.EXTERNAL="EXTERNAL";const L=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),k=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var N;e.FtCollectionDocumentType=void 0,(N=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",N.DOCUMENT="DOCUMENT",N.TOPIC="TOPIC",N.PERSONAL_BOOK="PERSONAL_BOOK",N.SHARED_BOOK="SHARED_BOOK";const M=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),w=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),B=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),x=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>H(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),H=e=>r(e)&&(null==e.document||$(e.document))&&(null==e.topic||j(e.topic))&&V(e.type)&&(null==e.map||K(e.map)),$=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),K=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&(null==e.openMode||L(e.openMode))&&C(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),j=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>W(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var G;e.FtSearchResultType=void 0,(G=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",G.DOCUMENT="DOCUMENT",G.TOPIC="TOPIC";const V=e=>["MAP","DOCUMENT","TOPIC"].includes(e),q=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>z(e))),X=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),z=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>z(e)))&&s(e.label)&&s(e.value)&&i(e.selected),Y=e=>r(e)&&s(e.key),J=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),W=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),Q=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||C(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&V(e.type)&&s(e.value);var Z;e.FtUserRole=void 0,(Z=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",Z.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",Z.HTML_EXPORT_USER="HTML_EXPORT_USER",Z.PDF_EXPORT_USER="PDF_EXPORT_USER",Z.SAVED_SEARCH_USER="SAVED_SEARCH_USER",Z.COLLECTION_USER="COLLECTION_USER",Z.OFFLINE_USER="OFFLINE_USER",Z.ANALYTICS_USER="ANALYTICS_USER",Z.BETA_USER="BETA_USER",Z.DEBUG_USER="DEBUG_USER",Z.PRINT_USER="PRINT_USER",Z.RATING_USER="RATING_USER",Z.FEEDBACK_USER="FEEDBACK_USER",Z.CONTENT_PUBLISHER="CONTENT_PUBLISHER",Z.KHUB_ADMIN="KHUB_ADMIN",Z.USERS_ADMIN="USERS_ADMIN",Z.PORTAL_ADMIN="PORTAL_ADMIN",Z.ADMIN="ADMIN",Z.DEVELOPER="DEVELOPER";const ee=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),te=e=>r(e)&&s(e.identifier)&&s(e.realm),re=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>ee(e)))&&(null==e.userId||s(e.userId)),ie=e=>"object"==typeof e&&null!=e,ne=e=>"boolean"==typeof e,se=e=>"number"==typeof e,ae=e=>"string"==typeof e,oe=e=>ie(e)&&ne(e.mailsSentByFluidTopics)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ae(e))),le=e=>ie(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>ne(e))))&&ne(e.isVisible),ue=e=>ie(e)&&(null==e.prettyUrl||ae(e.prettyUrl))&&(null==e.hasRating||ne(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ue(e)))&&(null==e.pageConfiguration||le(e.pageConfiguration))&&(null==e.contentId||ae(e.contentId))&&(null==e.title||ae(e.title)),ce=e=>ie(e)&&ne(e.splitCurrentPageToc),de={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function pe(e,t){return e===t||(de[e]??[]).some((e=>pe(e,t)))}const he="undefined"==typeof window?globalThis:window;function ye(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function fe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const me="undefined"==typeof window?globalThis:window;class Ae extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ge(e){if(!e.ok)throw new Ae(e.status,e.statusText,await e.text());return e}function be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ee{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??me.__gwt_ft_moduleBase??me.fluidtopicsclient?.__moduleBase??me.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==me.location&&me.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Ae(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(ge).then(be)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(ge).then(be)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ge).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Ee,e.HttpError=Ae,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(he.localStorage){const r=fe(e),i=e=>{e.storageArea===he.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return he.addEventListener("storage",i),{removeHandler:()=>he.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ee,e.getUnauthenticatedUserSearchPreferences=function(e){if(he.localStorage)return JSON.parse(he.localStorage.getItem(fe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&te(e.authenticationIdentifier)&&re(e.profile),e.isFtAuthenticationIdentifier=te,e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&M(e.type),e.isFtCollectionDocumentType=M,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=C,e.isFtFeedbackCreation=e=>r(e)&&s(e.message),e.isFtLabeledSearchFilter=w,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&C(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&d(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.khubVersion)&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>ie(e)&&ae(e.file)&&(null==e.size||se(e.size))&&ne(e.externalLink)&&ae(e.name)&&ae(e.id)&&(null==e.mimeType||ae(e.mimeType))&&(null==e.viewerUrl||ae(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=d,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=f,e.isFtMetadataPreferenceConfiguration=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&m(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=m,e.isFtOpenMode=L,e.isFtPageConfiguration=le,e.isFtPageRequest=k,e.isFtPaginatedToc=e=>ie(e)&&ce(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ue(e))),e.isFtPaginatedTocNode=ue,e.isFtPaginationConfiguration=ce,e.isFtPeriod=U,e.isFtPeriodFilter=F,e.isFtPeriodFilterType=I,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>l(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>u(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=l,e.isFtPersonalBookNodeCreation=u,e.isFtPersonalBookTopicLinkCreation=c,e.isFtPublicationRating=b,e.isFtPublicationRatingSummary=E,e.isFtRatingCreation=e=>r(e)&&g(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||R(e.topics))&&E(e.publication),e.isFtRatingType=g,e.isFtReaderConfiguration=e=>ie(e)&&oe(e.feedback)&&se(e.loadAfterLastVisibleTopic)&&se(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=oe,e.isFtSearchFacet=q,e.isFtSearchFacetConf=X,e.isFtSearchFacetEntry=z,e.isFtSearchFilter=O,e.isFtSearchLocale=y,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>y(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>S(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=B,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&k(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>B(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>X(e))),e.isFtSearchResultCluster=x,e.isFtSearchResultClusterEntry=H,e.isFtSearchResultMap=K,e.isFtSearchResultTopic=j,e.isFtSearchResultType=V,e.isFtSearchResultUnstructuredDocument=$,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||J(e.spellcheck))&&v(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>x(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>q(e))),e.isFtSearchResultsPageInfo=v,e.isFtSearchSortCriterion=Y,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||te(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&re(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=J,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=Q,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>Q(e))),e.isFtTocNode=p,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=T,e.isFtTopicResource=W,e.isFtTopicsRatingSummary=R,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=re,e.isFtUserRole=ee,e.roleMatches=pe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(he.localStorage){let r={...t,metadata:ye(t.metadata??{})};const i=fe(e),n=JSON.stringify(r);return he.localStorage.setItem(i,n),he.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:he.localStorage,url:he.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return e.some((e=>pe(e,t)))}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var g=[301,302,303,307,308];A.redirect=function(e,t){if(-1===g.indexOf(t))throw new RangeError("Invalid status code");return new A(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function b(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,e.fetch||(e.fetch=b,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,t.fetch=b,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e),l=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),u=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>u(e)))&&(null==e.topicLink||c(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),c=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),d=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),p=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>p(e)))&&s(e.contentId)&&s(e.title);var h;e.FtTopicContentTarget=void 0,(h=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",h.OFF_THE_GRID="OFF_THE_GRID",h.CONTENT_PACKAGER="CONTENT_PACKAGER",h.PAGES="PAGES",h.DESIGNED_READER="DESIGNED_READER";const y=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),f=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),m=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>w(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.contentLocale||s(e.contentLocale));var A;e.FtRatingType=void 0,(A=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",A.LIKE="LIKE",A.DICHOTOMOUS="DICHOTOMOUS",A.NO_RATING="NO_RATING";const g=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),b=e=>r(e)&&s(e.date)&&g(e.type)&&n(e.value),E=e=>r(e)&&(null==e.rating||b(e.rating))&&g(e.type),T=e=>r(e)&&s(e.date)&&s(e.tocId)&&g(e.type)&&n(e.value),R=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>T(e)))&&g(e.type),S=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),U=e=>r(e)&&s(e.from)&&s(e.to),F=e=>r(e)&&(null==e.period||U(e.period))&&I(e.periodType);var _;e.FtPeriodFilterType=void 0,(_=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",_.LAST_MONTH="LAST_MONTH",_.LAST_YEAR="LAST_YEAR",_.CUSTOM="CUSTOM";const I=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),O=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key),v=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var P;e.FtEditorialType=void 0,(P=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",P.BOOK="BOOK";const C=e=>["ARTICLE","BOOK"].includes(e);var D;e.FtOpenMode=void 0,(D=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",D.EXTERNAL="EXTERNAL";const L=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),k=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var N;e.FtCollectionDocumentType=void 0,(N=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",N.DOCUMENT="DOCUMENT",N.TOPIC="TOPIC",N.PERSONAL_BOOK="PERSONAL_BOOK",N.SHARED_BOOK="SHARED_BOOK";const M=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),w=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),B=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),x=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>H(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),H=e=>r(e)&&(null==e.document||$(e.document))&&(null==e.topic||j(e.topic))&&V(e.type)&&(null==e.map||K(e.map)),$=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),K=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&(null==e.openMode||L(e.openMode))&&C(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),j=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>W(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var G;e.FtSearchResultType=void 0,(G=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",G.DOCUMENT="DOCUMENT",G.TOPIC="TOPIC";const V=e=>["MAP","DOCUMENT","TOPIC"].includes(e),q=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>z(e))),X=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),z=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>z(e)))&&s(e.label)&&s(e.value)&&i(e.selected),Y=e=>r(e)&&s(e.key),J=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),W=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),Q=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||C(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&V(e.type)&&s(e.value);var Z;e.FtUserRole=void 0,(Z=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",Z.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",Z.HTML_EXPORT_USER="HTML_EXPORT_USER",Z.PDF_EXPORT_USER="PDF_EXPORT_USER",Z.SAVED_SEARCH_USER="SAVED_SEARCH_USER",Z.COLLECTION_USER="COLLECTION_USER",Z.OFFLINE_USER="OFFLINE_USER",Z.ANALYTICS_USER="ANALYTICS_USER",Z.BETA_USER="BETA_USER",Z.DEBUG_USER="DEBUG_USER",Z.PRINT_USER="PRINT_USER",Z.RATING_USER="RATING_USER",Z.FEEDBACK_USER="FEEDBACK_USER",Z.CONTENT_PUBLISHER="CONTENT_PUBLISHER",Z.KHUB_ADMIN="KHUB_ADMIN",Z.USERS_ADMIN="USERS_ADMIN",Z.PORTAL_ADMIN="PORTAL_ADMIN",Z.ADMIN="ADMIN",Z.DEVELOPER="DEVELOPER";const ee=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),te=e=>r(e)&&s(e.identifier)&&s(e.realm),re=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>ee(e)))&&(null==e.userId||s(e.userId)),ie=e=>"object"==typeof e&&null!=e,ne=e=>"boolean"==typeof e,se=e=>"number"==typeof e,ae=e=>"string"==typeof e,oe=e=>ie(e)&&ne(e.mailsSentByFluidTopics)&&ne(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ae(e))),le=e=>ie(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>ne(e))))&&ne(e.isVisible),ue=e=>ie(e)&&(null==e.prettyUrl||ae(e.prettyUrl))&&(null==e.hasRating||ne(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ue(e)))&&(null==e.pageConfiguration||le(e.pageConfiguration))&&(null==e.contentId||ae(e.contentId))&&(null==e.title||ae(e.title)),ce=e=>ie(e)&&ne(e.splitCurrentPageToc),de={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function pe(e,t){return e===t||(de[e]??[]).some((e=>pe(e,t)))}const he="undefined"==typeof window?globalThis:window;function ye(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function fe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const me="undefined"==typeof window?globalThis:window;class Ae extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ge(e){if(!e.ok)throw new Ae(e.status,e.statusText,await e.text());return e}function be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ee{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??me.__gwt_ft_moduleBase??me.fluidtopicsclient?.__moduleBase??me.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==me.location&&me.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new Ae(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(ge).then(be)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(ge).then(be)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ge).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=Ee,e.HttpError=Ae,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(he.localStorage){const r=fe(e),i=e=>{e.storageArea===he.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return he.addEventListener("storage",i),{removeHandler:()=>he.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ee,e.getUnauthenticatedUserSearchPreferences=function(e){if(he.localStorage)return JSON.parse(he.localStorage.getItem(fe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&te(e.authenticationIdentifier)&&re(e.profile),e.isFtAuthenticationIdentifier=te,e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&M(e.type),e.isFtCollectionDocumentType=M,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=C,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=w,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&L(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&C(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&d(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.khubVersion)&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>ie(e)&&ae(e.file)&&(null==e.size||se(e.size))&&ne(e.externalLink)&&ae(e.name)&&ae(e.id)&&(null==e.mimeType||ae(e.mimeType))&&(null==e.viewerUrl||ae(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=d,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=f,e.isFtMetadataPreferenceConfiguration=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&m(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=m,e.isFtOpenMode=L,e.isFtPageConfiguration=le,e.isFtPageRequest=k,e.isFtPaginatedToc=e=>ie(e)&&ce(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ue(e))),e.isFtPaginatedTocNode=ue,e.isFtPaginationConfiguration=ce,e.isFtPeriod=U,e.isFtPeriodFilter=F,e.isFtPeriodFilterType=I,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>l(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>u(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=l,e.isFtPersonalBookNodeCreation=u,e.isFtPersonalBookTopicLinkCreation=c,e.isFtPublicationRating=b,e.isFtPublicationRatingSummary=E,e.isFtRatingCreation=e=>r(e)&&g(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||R(e.topics))&&E(e.publication),e.isFtRatingType=g,e.isFtReaderConfiguration=e=>ie(e)&&oe(e.feedback)&&se(e.loadAfterLastVisibleTopic)&&se(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=oe,e.isFtSearchFacet=q,e.isFtSearchFacetConf=X,e.isFtSearchFacetEntry=z,e.isFtSearchFilter=O,e.isFtSearchLocale=y,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>y(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>S(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=B,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&k(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>B(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>X(e))),e.isFtSearchResultCluster=x,e.isFtSearchResultClusterEntry=H,e.isFtSearchResultMap=K,e.isFtSearchResultTopic=j,e.isFtSearchResultType=V,e.isFtSearchResultUnstructuredDocument=$,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||J(e.spellcheck))&&v(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>x(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>q(e))),e.isFtSearchResultsPageInfo=v,e.isFtSearchSortCriterion=Y,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||te(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&re(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=J,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>O(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>Y(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=Q,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>Q(e))),e.isFtTocNode=p,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=T,e.isFtTopicResource=W,e.isFtTopicsRatingSummary=R,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>f(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=re,e.isFtUserRole=ee,e.roleMatches=pe,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(he.localStorage){let r={...t,metadata:ye(t.metadata??{})};const i=fe(e),n=JSON.stringify(r);return he.localStorage.setItem(i,n),he.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:he.localStorage,url:he.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return e.some((e=>pe(e,t)))}})); |
@@ -142,10 +142,10 @@ import "cross-fetch/polyfill"; | ||
unrateMap(mapId: string): Promise<void>; | ||
sendMapFeedback(mapId: string, message: string): Promise<void>; | ||
sendMapFeedback(mapId: string, message: string, from?: string): Promise<void>; | ||
rateTopic(mapId: string, tocId: string, type: FtRatingType | FtRatingTypeKeys, value: number): Promise<void>; | ||
unrateTopic(mapId: string, tocId: string): Promise<void>; | ||
sendTopicFeedback(mapId: string, tocId: string, message: string): Promise<void>; | ||
sendTopicFeedback(mapId: string, tocId: string, message: string, from?: string): Promise<void>; | ||
getDocumentRating(docId: string): Promise<FtRatingSummary>; | ||
rateDocument(docId: string, type: FtRatingType | FtRatingTypeKeys, value: number): Promise<void>; | ||
unrateDocument(docId: string): Promise<void>; | ||
sendDocumentFeedback(docId: string, message: string): Promise<void>; | ||
sendDocumentFeedback(docId: string, message: string, from?: string): Promise<void>; | ||
getFluidTopicsMessageContext(locale: string, name: string): Promise<FtMessageContext>; | ||
@@ -152,0 +152,0 @@ getCustomMessageContext(locale: string, name: string): Promise<FtMessageContext>; |
@@ -242,4 +242,4 @@ import "cross-fetch/polyfill"; | ||
} | ||
sendMapFeedback(mapId, message) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).feedback, { message }); | ||
sendMapFeedback(mapId, message, from) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).feedback, { message, from }); | ||
} | ||
@@ -254,4 +254,4 @@ rateTopic(mapId, tocId, type, value) { | ||
} | ||
sendTopicFeedback(mapId, tocId, message) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).feedback, { message }); | ||
sendTopicFeedback(mapId, tocId, message, from) { | ||
return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).feedback, { message, from }); | ||
} | ||
@@ -267,4 +267,4 @@ getDocumentRating(docId) { | ||
} | ||
sendDocumentFeedback(docId, message) { | ||
return this.post(this.endpoints.khub.documents.documentId(docId).feedback, { message }); | ||
sendDocumentFeedback(docId, message, from) { | ||
return this.post(this.endpoints.khub.documents.documentId(docId).feedback, { message, from }); | ||
} | ||
@@ -271,0 +271,0 @@ getFluidTopicsMessageContext(locale, name) { |
@@ -132,2 +132,3 @@ export declare enum FtMyLibraryColors { | ||
export interface FtFeedbackCreation { | ||
from?: string; | ||
message: string; | ||
@@ -134,0 +135,0 @@ } |
@@ -152,2 +152,3 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
return isObject(o) | ||
&& (o.from == null || isString(o.from)) | ||
&& (isString(o.message)); | ||
@@ -154,0 +155,0 @@ }; |
@@ -9,2 +9,3 @@ export interface FtReaderConfiguration { | ||
mailsSentByFluidTopics: boolean; | ||
mailsSentByFluidTopicsForUnauthenticatedUsers: boolean; | ||
recipients: Array<string>; | ||
@@ -11,0 +12,0 @@ bodyMetadataIds: Array<string>; |
@@ -14,2 +14,3 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
&& (isBoolean(o.mailsSentByFluidTopics)) | ||
&& (isBoolean(o.mailsSentByFluidTopicsForUnauthenticatedUsers)) | ||
&& ((Array.isArray(o.recipients) | ||
@@ -16,0 +17,0 @@ && o.recipients.every((v) => isString(v)))) |
{ | ||
"name": "@fluid-topics/public-api", | ||
"version": "1.0.39", | ||
"version": "1.0.40", | ||
"description": "Fluid Topics Public API", | ||
@@ -5,0 +5,0 @@ "author": "Fluid Topics dev team <opensource@antidot.net>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
318153
39
6232
12