@fluid-topics/public-api 1.0.31 → 1.0.32
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/dist/cjs/index.js +6 -0
- package/dist/cjs/types/ft-common/public.js +34 -2
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +5 -1
- package/dist/mjs/index.js +6 -0
- package/dist/mjs/types/ft-common/public.d.ts +27 -0
- package/dist/mjs/types/ft-common/public.js +28 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -126,6 +126,9 @@ class FluidTopicsApi {
|
|
|
126
126
|
configuration: {
|
|
127
127
|
reader: `api/configuration/reader`
|
|
128
128
|
},
|
|
129
|
+
locales: {
|
|
130
|
+
ui: `api/locales/ui`
|
|
131
|
+
},
|
|
129
132
|
messages: {
|
|
130
133
|
locale: (locale) => ({
|
|
131
134
|
fluidTopics: {
|
|
@@ -234,6 +237,9 @@ class FluidTopicsApi {
|
|
|
234
237
|
getAvailableSearchLocales() {
|
|
235
238
|
return this.get(this.endpoints.khub.locales);
|
|
236
239
|
}
|
|
240
|
+
getAvailableUiLocales() {
|
|
241
|
+
return this.get(this.endpoints.khub.locales);
|
|
242
|
+
}
|
|
237
243
|
getMapRating(mapId) {
|
|
238
244
|
return this.get(this.endpoints.khub.maps.mapId(mapId).rating);
|
|
239
245
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = void 0;
|
|
3
|
+
exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtSearchResultsPageInfo = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookCreation = exports.isFtCredentials = void 0;
|
|
4
|
+
exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = void 0;
|
|
5
5
|
const isObject = (o) => typeof o === "object" && o != null;
|
|
6
6
|
const isBoolean = (o) => typeof o === "boolean";
|
|
7
7
|
const isNumber = (o) => typeof o === "number";
|
|
@@ -14,6 +14,31 @@ const isFtCredentials = (o) => {
|
|
|
14
14
|
&& (isString(o.login));
|
|
15
15
|
};
|
|
16
16
|
exports.isFtCredentials = isFtCredentials;
|
|
17
|
+
const isFtPersonalBookCreation = (o) => {
|
|
18
|
+
return isObject(o)
|
|
19
|
+
&& ((Array.isArray(o.nodes)
|
|
20
|
+
&& o.nodes.every((v) => (0, exports.isFtPersonalBookNodeCreation)(v))))
|
|
21
|
+
&& (isString(o.description))
|
|
22
|
+
&& (isString(o.title));
|
|
23
|
+
};
|
|
24
|
+
exports.isFtPersonalBookCreation = isFtPersonalBookCreation;
|
|
25
|
+
const isFtPersonalBookNodeCreation = (o) => {
|
|
26
|
+
return isObject(o)
|
|
27
|
+
&& (isString(o.notes))
|
|
28
|
+
&& ((Array.isArray(o.children)
|
|
29
|
+
&& o.children.every((v) => (0, exports.isFtPersonalBookNodeCreation)(v))))
|
|
30
|
+
&& (o.topicLink == null || (0, exports.isFtPersonalBookTopicLinkCreation)(o.topicLink))
|
|
31
|
+
&& (isString(o.title))
|
|
32
|
+
&& (o.htmlContent == null || isString(o.htmlContent));
|
|
33
|
+
};
|
|
34
|
+
exports.isFtPersonalBookNodeCreation = isFtPersonalBookNodeCreation;
|
|
35
|
+
const isFtPersonalBookTopicLinkCreation = (o) => {
|
|
36
|
+
return isObject(o)
|
|
37
|
+
&& (isString(o.tocId))
|
|
38
|
+
&& (isString(o.contentId))
|
|
39
|
+
&& (isString(o.mapId));
|
|
40
|
+
};
|
|
41
|
+
exports.isFtPersonalBookTopicLinkCreation = isFtPersonalBookTopicLinkCreation;
|
|
17
42
|
const isFtCollectionDocument = (o) => {
|
|
18
43
|
return isObject(o)
|
|
19
44
|
&& (isBoolean(o.deleted))
|
|
@@ -132,6 +157,13 @@ const isFtSearchLocales = (o) => {
|
|
|
132
157
|
&& o.contentLocales.every((v) => (0, exports.isFtSearchLocale)(v))));
|
|
133
158
|
};
|
|
134
159
|
exports.isFtSearchLocales = isFtSearchLocales;
|
|
160
|
+
const isFtUiLocale = (o) => {
|
|
161
|
+
return isObject(o)
|
|
162
|
+
&& (isString(o.displayName))
|
|
163
|
+
&& (isString(o.languageTag))
|
|
164
|
+
&& (isBoolean(o.translated));
|
|
165
|
+
};
|
|
166
|
+
exports.isFtUiLocale = isFtUiLocale;
|
|
135
167
|
const isFtMetadata = (o) => {
|
|
136
168
|
return isObject(o)
|
|
137
169
|
&& ((Array.isArray(o.values)
|
package/dist/fluidtopics.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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:{},i={exports:{}},s={exports:{}};!function(e,t){var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();e.exports=t=i.fetch,i.fetch&&(t.default=i.fetch.bind(i)),t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response}(s,s.exports),function(e,t){const i=s.exports,a=i.default||i,n=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),a.call(this,e,t)};n.ponyfill=!0,e.exports=t=n,t.fetch=n,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,t.default=n}(i,i.exports);const a=i.exports,n=a.fetch.bind({});n.polyfill=!0,t.fetch||(t.fetch=n,t.Response=a.Response,t.Headers=a.Headers,t.Request=a.Request);const r=e=>"object"==typeof e&&null!=e,o=e=>"boolean"==typeof e,l=e=>"number"==typeof e,u=e=>"string"==typeof e,c=e=>r(e)&&u(e.topicStylesheetUrl)&&u(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>u(e))),d=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&(null==e.hasRating||o(e.hasRating))&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&u(e.contentId)&&u(e.title);var p;e.FtTopicContentTarget=void 0,(p=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",p.OFF_THE_GRID="OFF_THE_GRID",p.CONTENT_PACKAGER="CONTENT_PACKAGER",p.PAGES="PAGES",p.DESIGNED_READER="DESIGNED_READER";const h=e=>r(e)&&l(e.count)&&u(e.label)&&(null==e.lang||u(e.lang)),y=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>u(e))))))&&u(e.label)&&u(e.key);var g;e.FtRatingType=void 0,(g=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",g.LIKE="LIKE",g.DICHOTOMOUS="DICHOTOMOUS",g.NO_RATING="NO_RATING";const m=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),A=e=>r(e)&&u(e.date)&&m(e.type)&&l(e.value),f=e=>r(e)&&(null==e.rating||A(e.rating))&&m(e.type),R=e=>r(e)&&u(e.date)&&u(e.tocId)&&m(e.type)&&l(e.value),E=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>R(e)))&&m(e.type),T=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e))),S=e=>r(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key),b=e=>r(e)&&l(e.totalResultsCount)&&o(e.lastPage)&&l(e.currentPage)&&l(e.totalClustersCount);var I;e.FtEditorialType=void 0,(I=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",I.BOOK="BOOK";const U=e=>["ARTICLE","BOOK"].includes(e);var F;e.FtOpenMode=void 0,(F=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",F.EXTERNAL="EXTERNAL";const O=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),C=e=>r(e)&&(null==e.perPage||l(e.perPage))&&l(e.page);var _;e.FtCollectionDocumentType=void 0,(_=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",_.DOCUMENT="DOCUMENT",_.TOPIC="TOPIC",_.PERSONAL_BOOK="PERSONAL_BOOK",_.SHARED_BOOK="SHARED_BOOK";const v=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),k=e=>r(e)&&l(e.weight)&&u(e.value)&&u(e.key),P=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>D(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),D=e=>r(e)&&(null==e.document||N(e.document))&&(null==e.topic||M(e.topic))&&B(e.type)&&(null==e.map||L(e.map)),N=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&O(e.openMode)&&u(e.documentUrl)&&u(e.mimeType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.viewerUrl)&&u(e.contentUrl)&&u(e.filename)&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.documentId)&&u(e.lastEditionDate)&&u(e.htmlExcerpt),L=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&(null==e.openMode||O(e.openMode))&&U(e.editorialType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.mapUrl)&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt),M=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&O(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>G(e)))&&u(e.title)&&u(e.mapTitle)&&u(e.topicUrl)&&u(e.contentUrl)&&u(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt);var w;e.FtSearchResultType=void 0,(w=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",w.DOCUMENT="DOCUMENT",w.TOPIC="TOPIC";const B=e=>["MAP","DOCUMENT","TOPIC"].includes(e),H=e=>r(e)&&o(e.hierarchical)&&u(e.label)&&o(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>$(e))),x=e=>r(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),$=e=>r(e)&&l(e.totalResultsCount)&&o(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>$(e)))&&u(e.label)&&u(e.value)&&o(e.selected),K=e=>r(e)&&u(e.key),V=e=>r(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),G=e=>r(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),q=e=>r(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||U(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&B(e.type)&&u(e.value);var j;e.FtUserRole=void 0,(j=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",j.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",j.HTML_EXPORT_USER="HTML_EXPORT_USER",j.PDF_EXPORT_USER="PDF_EXPORT_USER",j.SAVED_SEARCH_USER="SAVED_SEARCH_USER",j.COLLECTION_USER="COLLECTION_USER",j.OFFLINE_USER="OFFLINE_USER",j.ANALYTICS_USER="ANALYTICS_USER",j.BETA_USER="BETA_USER",j.DEBUG_USER="DEBUG_USER",j.PRINT_USER="PRINT_USER",j.RATING_USER="RATING_USER",j.FEEDBACK_USER="FEEDBACK_USER",j.CONTENT_PUBLISHER="CONTENT_PUBLISHER",j.KHUB_ADMIN="KHUB_ADMIN",j.USERS_ADMIN="USERS_ADMIN",j.PORTAL_ADMIN="PORTAL_ADMIN",j.ADMIN="ADMIN",j.DEVELOPER="DEVELOPER";const z=e=>"object"==typeof e&&null!=e,X=e=>"boolean"==typeof e,Y=e=>"number"==typeof e,J=e=>"string"==typeof e,Q=e=>z(e)&&X(e.mailsSentByFluidTopics)&&Array.isArray(e.recipients)&&e.recipients.every((e=>J(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>J(e))),W=e=>z(e)&&(null==e.emailAddress||J(e.emailAddress))&&(null==e.displayName||J(e.displayName))&&Array.isArray(e.roles)&&(null==e.userId||J(e.userId)),Z=e=>z(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>X(e))))&&X(e.isVisible),ee=e=>z(e)&&(null==e.prettyUrl||J(e.prettyUrl))&&(null==e.hasRating||X(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||J(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ee(e)))&&(null==e.pageConfiguration||Z(e.pageConfiguration))&&(null==e.contentId||J(e.contentId))&&(null==e.title||J(e.title)),te=e=>z(e)&&X(e.splitCurrentPageToc),ie="undefined"==typeof window?globalThis:window;function se(e){let t={};for(let i in e){let s=e[i];("object"!=typeof s||Array.isArray(s))&&(s={prior:s});for(let e of["prior","filter"])s[e]=Array.isArray(s[e])?s[e]:[s[e]],s[e]=s[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[i]=s}return t}function ae(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const ne="undefined"==typeof window?globalThis:window;class re extends Error{status;statusText;body;constructor(e,t,i){super(`${e} - ${t}: ${i}`),this.status=e,this.statusText=t,this.body=i}}async function oe(e){if(!e.ok)throw new re(e.status,e.statusText,await e.text());return e}function le(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class ue{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`})}})},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"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,i){e=(e??ne.__gwt_ft_moduleBase??ne.fluidtopicsclient?.__moduleBase??ne.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",i&&void 0!==ne.location&&ne.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 i;this.authorization={Authorization:"Basic "+(i=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(i).toString("base64"):btoa(i))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let i={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,i).then((i=>(this.setCredentials(e,t),i)))}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,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(i?"?target="+i:""))}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)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,i){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:i})}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,i,s){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:i,value:s})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,i){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:i})}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)}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 i=t;return await fetch(this.makeAbsolute(e),{...i??{},headers:{...this.defaultHeaders,...i?.headers??{}}})}upload(e,t,i,s=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,n)=>{let r=new XMLHttpRequest;r.onload=()=>{if(r.status>=200&&r.status<300){let e="application/json"===r.getResponseHeader("Content-Type")?JSON.parse(r.responseText):r.responseText;a(e)}else n(new re(r.status,r.statusText,r.responseText))},r.upload.onprogress=e=>s(e),r.open(e,this.makeAbsolute(t),!0),r.send(i)})):this.fetch(t,{method:e,body:i}).then(oe).then(le)}makeRequest(e,t,i){return this.fetch(t,{method:e,headers:{...null!=i?{"Content-Type":"application/json"}:{}},body:null!=i?JSON.stringify(i):void 0,credentials:null==this.authorization?"include":void 0}).then(oe).then(le)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(oe).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=ue,e.HttpError=re,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(ie.localStorage){const i=ae(e),s=e=>{e.storageArea===ie.localStorage&&e.key===i&&t(JSON.parse(e.newValue??"{}"))};return ie.addEventListener("storage",s),{removeHandler:()=>ie.removeEventListener("storage",s)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=ue,e.getUnauthenticatedUserSearchPreferences=function(e){if(ie.localStorage)return JSON.parse(ie.localStorage.getItem(ae(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>z(e)&&W(e.profile),e.isFtAuthenticationIdentifier=e=>r(e)&&u(e.identifier)&&u(e.realm),e.isFtCollectionDocument=e=>r(e)&&o(e.deleted)&&(null==e.apiUrl||u(e.apiUrl))&&(null==e.portalUrl||u(e.portalUrl))&&u(e.id)&&u(e.title)&&v(e.type),e.isFtCollectionDocumentType=v,e.isFtCredentials=e=>r(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=U,e.isFtFeedbackCreation=e=>r(e)&&u(e.message),e.isFtMap=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&O(e.openMode)&&u(e.topicsApiEndpoint)&&(null==e.description||u(e.description))&&u(e.attachmentsApiEndpoint)&&U(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&u(e.title)&&u(e.lastPublication)&&u(e.lastEdition)&&u(e.originId)&&u(e.rightsApiEndpoint)&&c(e.contentStyles)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtMapAttachment=e=>z(e)&&J(e.file)&&(null==e.size||Y(e.size))&&X(e.externalLink)&&J(e.name)&&J(e.id)&&(null==e.mimeType||J(e.mimeType))&&(null==e.viewerUrl||J(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=c,e.isFtMessageContext=e=>z(e)&&J(e.name)&&z(e.messages)&&Object.keys(e.messages).every((e=>J(e)))&&Object.values(e.messages).every((e=>J(e)))&&J(e.locale),e.isFtMetadata=y,e.isFtMetadataPreferenceConfiguration=T,e.isFtOpenMode=O,e.isFtPageConfiguration=Z,e.isFtPageRequest=C,e.isFtPaginatedToc=e=>z(e)&&te(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ee(e))),e.isFtPaginatedTocNode=ee,e.isFtPaginationConfiguration=te,e.isFtPublicationRating=A,e.isFtPublicationRatingSummary=f,e.isFtRatingCreation=e=>r(e)&&m(e.type)&&l(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||E(e.topics))&&f(e.publication),e.isFtRatingType=m,e.isFtReaderConfiguration=e=>z(e)&&Q(e.feedback)&&Y(e.loadAfterLastVisibleTopic)&&Y(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Q,e.isFtSearchFacet=H,e.isFtSearchFacetConf=x,e.isFtSearchFacetEntry=$,e.isFtSearchFilter=S,e.isFtSearchLocale=h,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>h(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>u(e)))&&Object.values(e.metadata).every((e=>T(e))),e.isFtSearchPreset=e=>r(e)&&u(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>S(e)))&&l(e.priority)&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSearchPrior=k,e.isFtSearchRequest=e=>r(e)&&u(e.query)&&C(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>S(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>K(e)))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>k(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>x(e))),e.isFtSearchResultCluster=P,e.isFtSearchResultClusterEntry=D,e.isFtSearchResultMap=L,e.isFtSearchResultTopic=M,e.isFtSearchResultType=B,e.isFtSearchResultUnstructuredDocument=N,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||V(e.spellcheck))&&b(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>P(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>H(e))),e.isFtSearchResultsPageInfo=b,e.isFtSearchSortCriterion=K,e.isFtSession=e=>z(e)&&Y(e.idleTimeoutInMillis)&&W(e.profile)&&X(e.sessionAuthenticated),e.isFtSpellcheck=V,e.isFtSuggestRequest=e=>r(e)&&u(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>S(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>K(e)))&&(null==e.maxCount||l(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=q,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>q(e))),e.isFtTocNode=d,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&u(e.id)&&u(e.contentApiEndpoint)&&u(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=R,e.isFtTopicResource=G,e.isFtTopicsRatingSummary=E,e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&u(e.openMode)&&(null==e.description||u(e.description))&&u(e.mimeType)&&(null==e.baseId||u(e.baseId))&&(null==e.clusterId||u(e.clusterId))&&u(e.contentApiEndpoint)&&u(e.title)&&(null==e.lastPublication||u(e.lastPublication))&&u(e.viewerUrl)&&u(e.lastEdition)&&u(e.filename)&&(null==e.originId||u(e.originId))&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtUserProfile=W,e.isFtUserRole=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),e.setUnauthenticatedUserSearchPreferences=function(e,t){if(ie.localStorage){let i={...t,metadata:se(t.metadata??{})};const s=ae(e),a=JSON.stringify(i);return ie.localStorage.setItem(s,a),ie.dispatchEvent(new StorageEvent("storage",{key:s,newValue:a,storageArea:ie.localStorage,url:ie.location.href})),i}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")}}));
|
|
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:{},i={exports:{}},s={exports:{}};!function(e,t){var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();e.exports=t=i.fetch,i.fetch&&(t.default=i.fetch.bind(i)),t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response}(s,s.exports),function(e,t){const i=s.exports,a=i.default||i,n=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),a.call(this,e,t)};n.ponyfill=!0,e.exports=t=n,t.fetch=n,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,t.default=n}(i,i.exports);const a=i.exports,n=a.fetch.bind({});n.polyfill=!0,t.fetch||(t.fetch=n,t.Response=a.Response,t.Headers=a.Headers,t.Request=a.Request);const r=e=>"object"==typeof e&&null!=e,o=e=>"boolean"==typeof e,l=e=>"number"==typeof e,u=e=>"string"==typeof e,c=e=>r(e)&&u(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>c(e)))&&(null==e.topicLink||d(e.topicLink))&&u(e.title)&&(null==e.htmlContent||u(e.htmlContent)),d=e=>r(e)&&u(e.tocId)&&u(e.contentId)&&u(e.mapId),p=e=>r(e)&&u(e.topicStylesheetUrl)&&u(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>u(e))),h=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&(null==e.hasRating||o(e.hasRating))&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>h(e)))&&u(e.contentId)&&u(e.title);var y;e.FtTopicContentTarget=void 0,(y=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",y.OFF_THE_GRID="OFF_THE_GRID",y.CONTENT_PACKAGER="CONTENT_PACKAGER",y.PAGES="PAGES",y.DESIGNED_READER="DESIGNED_READER";const g=e=>r(e)&&l(e.count)&&u(e.label)&&(null==e.lang||u(e.lang)),m=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>u(e))))))&&u(e.label)&&u(e.key);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 f=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),R=e=>r(e)&&u(e.date)&&f(e.type)&&l(e.value),E=e=>r(e)&&(null==e.rating||R(e.rating))&&f(e.type),T=e=>r(e)&&u(e.date)&&u(e.tocId)&&f(e.type)&&l(e.value),S=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>T(e)))&&f(e.type),b=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e))),I=e=>r(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key),U=e=>r(e)&&l(e.totalResultsCount)&&o(e.lastPage)&&l(e.currentPage)&&l(e.totalClustersCount);var F;e.FtEditorialType=void 0,(F=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",F.BOOK="BOOK";const C=e=>["ARTICLE","BOOK"].includes(e);var O;e.FtOpenMode=void 0,(O=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",O.EXTERNAL="EXTERNAL";const _=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),v=e=>r(e)&&(null==e.perPage||l(e.perPage))&&l(e.page);var k;e.FtCollectionDocumentType=void 0,(k=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",k.DOCUMENT="DOCUMENT",k.TOPIC="TOPIC",k.PERSONAL_BOOK="PERSONAL_BOOK",k.SHARED_BOOK="SHARED_BOOK";const P=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),D=e=>r(e)&&l(e.weight)&&u(e.value)&&u(e.key),N=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>L(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),L=e=>r(e)&&(null==e.document||M(e.document))&&(null==e.topic||w(e.topic))&&x(e.type)&&(null==e.map||B(e.map)),M=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&_(e.openMode)&&u(e.documentUrl)&&u(e.mimeType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.viewerUrl)&&u(e.contentUrl)&&u(e.filename)&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.documentId)&&u(e.lastEditionDate)&&u(e.htmlExcerpt),B=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&(null==e.openMode||_(e.openMode))&&C(e.editorialType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.mapUrl)&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt),w=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&_(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>j(e)))&&u(e.title)&&u(e.mapTitle)&&u(e.topicUrl)&&u(e.contentUrl)&&u(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt);var H;e.FtSearchResultType=void 0,(H=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",H.DOCUMENT="DOCUMENT",H.TOPIC="TOPIC";const x=e=>["MAP","DOCUMENT","TOPIC"].includes(e),$=e=>r(e)&&o(e.hierarchical)&&u(e.label)&&o(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>V(e))),K=e=>r(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),V=e=>r(e)&&l(e.totalResultsCount)&&o(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>V(e)))&&u(e.label)&&u(e.value)&&o(e.selected),G=e=>r(e)&&u(e.key),q=e=>r(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),j=e=>r(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),z=e=>r(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||C(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&x(e.type)&&u(e.value);var X;e.FtUserRole=void 0,(X=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",X.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",X.HTML_EXPORT_USER="HTML_EXPORT_USER",X.PDF_EXPORT_USER="PDF_EXPORT_USER",X.SAVED_SEARCH_USER="SAVED_SEARCH_USER",X.COLLECTION_USER="COLLECTION_USER",X.OFFLINE_USER="OFFLINE_USER",X.ANALYTICS_USER="ANALYTICS_USER",X.BETA_USER="BETA_USER",X.DEBUG_USER="DEBUG_USER",X.PRINT_USER="PRINT_USER",X.RATING_USER="RATING_USER",X.FEEDBACK_USER="FEEDBACK_USER",X.CONTENT_PUBLISHER="CONTENT_PUBLISHER",X.KHUB_ADMIN="KHUB_ADMIN",X.USERS_ADMIN="USERS_ADMIN",X.PORTAL_ADMIN="PORTAL_ADMIN",X.ADMIN="ADMIN",X.DEVELOPER="DEVELOPER";const Y=e=>"object"==typeof e&&null!=e,J=e=>"boolean"==typeof e,Q=e=>"number"==typeof e,W=e=>"string"==typeof e,Z=e=>Y(e)&&J(e.mailsSentByFluidTopics)&&Array.isArray(e.recipients)&&e.recipients.every((e=>W(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>W(e))),ee=e=>Y(e)&&(null==e.emailAddress||W(e.emailAddress))&&(null==e.displayName||W(e.displayName))&&Array.isArray(e.roles)&&(null==e.userId||W(e.userId)),te=e=>Y(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>J(e))))&&J(e.isVisible),ie=e=>Y(e)&&(null==e.prettyUrl||W(e.prettyUrl))&&(null==e.hasRating||J(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||W(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ie(e)))&&(null==e.pageConfiguration||te(e.pageConfiguration))&&(null==e.contentId||W(e.contentId))&&(null==e.title||W(e.title)),se=e=>Y(e)&&J(e.splitCurrentPageToc),ae="undefined"==typeof window?globalThis:window;function ne(e){let t={};for(let i in e){let s=e[i];("object"!=typeof s||Array.isArray(s))&&(s={prior:s});for(let e of["prior","filter"])s[e]=Array.isArray(s[e])?s[e]:[s[e]],s[e]=s[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[i]=s}return t}function re(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const oe="undefined"==typeof window?globalThis:window;class le extends Error{status;statusText;body;constructor(e,t,i){super(`${e} - ${t}: ${i}`),this.status=e,this.statusText=t,this.body=i}}async function ue(e){if(!e.ok)throw new le(e.status,e.statusText,await e.text());return e}function ce(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class de{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`})}})},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}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,i){e=(e??oe.__gwt_ft_moduleBase??oe.fluidtopicsclient?.__moduleBase??oe.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",i&&void 0!==oe.location&&oe.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 i;this.authorization={Authorization:"Basic "+(i=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(i).toString("base64"):btoa(i))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let i={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,i).then((i=>(this.setCredentials(e,t),i)))}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,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(i?"?target="+i:""))}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,i){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:i})}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,i,s){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:i,value:s})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,i){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:i})}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)}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 i=t;return await fetch(this.makeAbsolute(e),{...i??{},headers:{...this.defaultHeaders,...i?.headers??{}}})}upload(e,t,i,s=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,n)=>{let r=new XMLHttpRequest;r.onload=()=>{if(r.status>=200&&r.status<300){let e="application/json"===r.getResponseHeader("Content-Type")?JSON.parse(r.responseText):r.responseText;a(e)}else n(new le(r.status,r.statusText,r.responseText))},r.upload.onprogress=e=>s(e),r.open(e,this.makeAbsolute(t),!0),r.send(i)})):this.fetch(t,{method:e,body:i}).then(ue).then(ce)}makeRequest(e,t,i){return this.fetch(t,{method:e,headers:{...null!=i?{"Content-Type":"application/json"}:{}},body:null!=i?JSON.stringify(i):void 0,credentials:null==this.authorization?"include":void 0}).then(ue).then(ce)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ue).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=de,e.HttpError=le,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(ae.localStorage){const i=re(e),s=e=>{e.storageArea===ae.localStorage&&e.key===i&&t(JSON.parse(e.newValue??"{}"))};return ae.addEventListener("storage",s),{removeHandler:()=>ae.removeEventListener("storage",s)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=de,e.getUnauthenticatedUserSearchPreferences=function(e){if(ae.localStorage)return JSON.parse(ae.localStorage.getItem(re(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>Y(e)&&ee(e.profile),e.isFtAuthenticationIdentifier=e=>r(e)&&u(e.identifier)&&u(e.realm),e.isFtCollectionDocument=e=>r(e)&&o(e.deleted)&&(null==e.apiUrl||u(e.apiUrl))&&(null==e.portalUrl||u(e.portalUrl))&&u(e.id)&&u(e.title)&&P(e.type),e.isFtCollectionDocumentType=P,e.isFtCredentials=e=>r(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=C,e.isFtFeedbackCreation=e=>r(e)&&u(e.message),e.isFtMap=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&_(e.openMode)&&u(e.topicsApiEndpoint)&&(null==e.description||u(e.description))&&u(e.attachmentsApiEndpoint)&&C(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&u(e.title)&&u(e.lastPublication)&&u(e.lastEdition)&&u(e.originId)&&u(e.rightsApiEndpoint)&&p(e.contentStyles)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtMapAttachment=e=>Y(e)&&W(e.file)&&(null==e.size||Q(e.size))&&J(e.externalLink)&&W(e.name)&&W(e.id)&&(null==e.mimeType||W(e.mimeType))&&(null==e.viewerUrl||W(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=p,e.isFtMessageContext=e=>Y(e)&&W(e.name)&&Y(e.messages)&&Object.keys(e.messages).every((e=>W(e)))&&Object.values(e.messages).every((e=>W(e)))&&W(e.locale),e.isFtMetadata=m,e.isFtMetadataPreferenceConfiguration=b,e.isFtOpenMode=_,e.isFtPageConfiguration=te,e.isFtPageRequest=v,e.isFtPaginatedToc=e=>Y(e)&&se(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ie(e))),e.isFtPaginatedTocNode=ie,e.isFtPaginationConfiguration=se,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.nodes)&&e.nodes.every((e=>c(e)))&&u(e.description)&&u(e.title),e.isFtPersonalBookNodeCreation=c,e.isFtPersonalBookTopicLinkCreation=d,e.isFtPublicationRating=R,e.isFtPublicationRatingSummary=E,e.isFtRatingCreation=e=>r(e)&&f(e.type)&&l(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||S(e.topics))&&E(e.publication),e.isFtRatingType=f,e.isFtReaderConfiguration=e=>Y(e)&&Z(e.feedback)&&Q(e.loadAfterLastVisibleTopic)&&Q(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Z,e.isFtSearchFacet=$,e.isFtSearchFacetConf=K,e.isFtSearchFacetEntry=V,e.isFtSearchFilter=I,e.isFtSearchLocale=g,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>g(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>u(e)))&&Object.values(e.metadata).every((e=>b(e))),e.isFtSearchPreset=e=>r(e)&&u(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>I(e)))&&l(e.priority)&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSearchPrior=D,e.isFtSearchRequest=e=>r(e)&&u(e.query)&&v(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>I(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>G(e)))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>D(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>K(e))),e.isFtSearchResultCluster=N,e.isFtSearchResultClusterEntry=L,e.isFtSearchResultMap=B,e.isFtSearchResultTopic=w,e.isFtSearchResultType=x,e.isFtSearchResultUnstructuredDocument=M,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||q(e.spellcheck))&&U(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>N(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>$(e))),e.isFtSearchResultsPageInfo=U,e.isFtSearchSortCriterion=G,e.isFtSession=e=>Y(e)&&Q(e.idleTimeoutInMillis)&&ee(e.profile)&&J(e.sessionAuthenticated),e.isFtSpellcheck=q,e.isFtSuggestRequest=e=>r(e)&&u(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>I(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>G(e)))&&(null==e.maxCount||l(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=z,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>z(e))),e.isFtTocNode=h,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&u(e.id)&&u(e.contentApiEndpoint)&&u(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=T,e.isFtTopicResource=j,e.isFtTopicsRatingSummary=S,e.isFtUiLocale=e=>r(e)&&u(e.displayName)&&u(e.languageTag)&&o(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>m(e)))&&u(e.openMode)&&(null==e.description||u(e.description))&&u(e.mimeType)&&(null==e.baseId||u(e.baseId))&&(null==e.clusterId||u(e.clusterId))&&u(e.contentApiEndpoint)&&u(e.title)&&(null==e.lastPublication||u(e.lastPublication))&&u(e.viewerUrl)&&u(e.lastEdition)&&u(e.filename)&&(null==e.originId||u(e.originId))&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtUserProfile=ee,e.isFtUserRole=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),e.setUnauthenticatedUserSearchPreferences=function(e,t){if(ae.localStorage){let i={...t,metadata:ne(t.metadata??{})};const s=re(e),a=JSON.stringify(i);return ae.localStorage.setItem(s,a),ae.dispatchEvent(new StorageEvent("storage",{key:s,newValue:a,storageArea:ae.localStorage,url:ae.location.href})),i}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")}}));
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "cross-fetch/polyfill";
|
|
2
|
-
import { FtCollectionDocument, FtMap, FtMapResource, FtRatingSummary, FtRatingType, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUnstructuredDocument } from "./types/ft-common/public";
|
|
2
|
+
import { FtCollectionDocument, FtMap, FtMapResource, FtRatingSummary, FtRatingType, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public";
|
|
3
3
|
import { FtAuthenticatedSession, FtMapAttachment, FtMessageContext, FtPaginatedToc, FtReaderConfiguration, FtSession } from "./types/ft-server/public";
|
|
4
4
|
export * from "./types/ft-common/public";
|
|
5
5
|
export * from "./types/ft-server/public";
|
|
@@ -86,6 +86,9 @@ export declare class FluidTopicsApi {
|
|
|
86
86
|
configuration: {
|
|
87
87
|
reader: string;
|
|
88
88
|
};
|
|
89
|
+
locales: {
|
|
90
|
+
ui: string;
|
|
91
|
+
};
|
|
89
92
|
messages: {
|
|
90
93
|
locale: (locale: string) => {
|
|
91
94
|
fluidTopics: {
|
|
@@ -123,6 +126,7 @@ export declare class FluidTopicsApi {
|
|
|
123
126
|
getSuggestions(request: FtSuggestRequest): Promise<FtSuggestResults>;
|
|
124
127
|
search(request: FtSearchRequest): Promise<FtSearchResults>;
|
|
125
128
|
getAvailableSearchLocales(): Promise<FtSearchLocales>;
|
|
129
|
+
getAvailableUiLocales(): Promise<Array<FtUiLocale>>;
|
|
126
130
|
getMapRating(mapId: string): Promise<FtRatingSummary>;
|
|
127
131
|
rateMap(mapId: string, type: FtRatingType, value: number): Promise<void>;
|
|
128
132
|
unrateMap(mapId: string): Promise<void>;
|
package/dist/mjs/index.js
CHANGED
|
@@ -102,6 +102,9 @@ export class FluidTopicsApi {
|
|
|
102
102
|
configuration: {
|
|
103
103
|
reader: `api/configuration/reader`
|
|
104
104
|
},
|
|
105
|
+
locales: {
|
|
106
|
+
ui: `api/locales/ui`
|
|
107
|
+
},
|
|
105
108
|
messages: {
|
|
106
109
|
locale: (locale) => ({
|
|
107
110
|
fluidTopics: {
|
|
@@ -215,6 +218,9 @@ export class FluidTopicsApi {
|
|
|
215
218
|
getAvailableSearchLocales() {
|
|
216
219
|
return this.get(this.endpoints.khub.locales);
|
|
217
220
|
}
|
|
221
|
+
getAvailableUiLocales() {
|
|
222
|
+
return this.get(this.endpoints.khub.locales);
|
|
223
|
+
}
|
|
218
224
|
getMapRating(mapId) {
|
|
219
225
|
return this.get(this.endpoints.khub.maps.mapId(mapId).rating);
|
|
220
226
|
}
|
|
@@ -5,6 +5,27 @@ export interface FtCredentials {
|
|
|
5
5
|
login: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const isFtCredentials: (o: any) => o is FtCredentials;
|
|
8
|
+
export interface FtPersonalBookCreation {
|
|
9
|
+
nodes: Array<FtPersonalBookNodeCreation>;
|
|
10
|
+
description: string;
|
|
11
|
+
title: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const isFtPersonalBookCreation: (o: any) => o is FtPersonalBookCreation;
|
|
14
|
+
export interface FtPersonalBookNodeCreation {
|
|
15
|
+
notes: string;
|
|
16
|
+
children: Array<FtPersonalBookNodeCreation>;
|
|
17
|
+
topicLink?: FtPersonalBookTopicLinkCreation;
|
|
18
|
+
title: string;
|
|
19
|
+
htmlContent?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const isFtPersonalBookNodeCreation: (o: any) => o is FtPersonalBookNodeCreation;
|
|
22
|
+
export interface FtPersonalBookTopicLinkCreation {
|
|
23
|
+
tocId: string;
|
|
24
|
+
contentId: string;
|
|
25
|
+
mapId: string;
|
|
26
|
+
type: any;
|
|
27
|
+
}
|
|
28
|
+
export declare const isFtPersonalBookTopicLinkCreation: (o: any) => o is FtPersonalBookTopicLinkCreation;
|
|
8
29
|
export interface FtCollectionDocument {
|
|
9
30
|
deleted: boolean;
|
|
10
31
|
apiUrl?: string;
|
|
@@ -104,6 +125,12 @@ export interface FtSearchLocales {
|
|
|
104
125
|
contentLocales: Array<FtSearchLocale>;
|
|
105
126
|
}
|
|
106
127
|
export declare const isFtSearchLocales: (o: any) => o is FtSearchLocales;
|
|
128
|
+
export interface FtUiLocale {
|
|
129
|
+
displayName: string;
|
|
130
|
+
languageTag: string;
|
|
131
|
+
translated: boolean;
|
|
132
|
+
}
|
|
133
|
+
export declare const isFtUiLocale: (o: any) => o is FtUiLocale;
|
|
107
134
|
export interface FtMetadata {
|
|
108
135
|
values: Array<string>;
|
|
109
136
|
hierarchicalValues?: Array<Array<string>>;
|
|
@@ -9,6 +9,28 @@ export const isFtCredentials = (o) => {
|
|
|
9
9
|
&& (isBoolean(o.rememberMe))
|
|
10
10
|
&& (isString(o.login));
|
|
11
11
|
};
|
|
12
|
+
export const isFtPersonalBookCreation = (o) => {
|
|
13
|
+
return isObject(o)
|
|
14
|
+
&& ((Array.isArray(o.nodes)
|
|
15
|
+
&& o.nodes.every((v) => isFtPersonalBookNodeCreation(v))))
|
|
16
|
+
&& (isString(o.description))
|
|
17
|
+
&& (isString(o.title));
|
|
18
|
+
};
|
|
19
|
+
export const isFtPersonalBookNodeCreation = (o) => {
|
|
20
|
+
return isObject(o)
|
|
21
|
+
&& (isString(o.notes))
|
|
22
|
+
&& ((Array.isArray(o.children)
|
|
23
|
+
&& o.children.every((v) => isFtPersonalBookNodeCreation(v))))
|
|
24
|
+
&& (o.topicLink == null || isFtPersonalBookTopicLinkCreation(o.topicLink))
|
|
25
|
+
&& (isString(o.title))
|
|
26
|
+
&& (o.htmlContent == null || isString(o.htmlContent));
|
|
27
|
+
};
|
|
28
|
+
export const isFtPersonalBookTopicLinkCreation = (o) => {
|
|
29
|
+
return isObject(o)
|
|
30
|
+
&& (isString(o.tocId))
|
|
31
|
+
&& (isString(o.contentId))
|
|
32
|
+
&& (isString(o.mapId));
|
|
33
|
+
};
|
|
12
34
|
export const isFtCollectionDocument = (o) => {
|
|
13
35
|
return isObject(o)
|
|
14
36
|
&& (isBoolean(o.deleted))
|
|
@@ -117,6 +139,12 @@ export const isFtSearchLocales = (o) => {
|
|
|
117
139
|
&& ((Array.isArray(o.contentLocales)
|
|
118
140
|
&& o.contentLocales.every((v) => isFtSearchLocale(v))));
|
|
119
141
|
};
|
|
142
|
+
export const isFtUiLocale = (o) => {
|
|
143
|
+
return isObject(o)
|
|
144
|
+
&& (isString(o.displayName))
|
|
145
|
+
&& (isString(o.languageTag))
|
|
146
|
+
&& (isBoolean(o.translated));
|
|
147
|
+
};
|
|
120
148
|
export const isFtMetadata = (o) => {
|
|
121
149
|
return isObject(o)
|
|
122
150
|
&& ((Array.isArray(o.values)
|