@fluid-topics/public-api 1.0.28 → 1.0.30
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 +12 -3
- package/dist/cjs/types/ft-common/public.js +29 -2
- package/dist/cjs/types/ft-server/public.js +20 -3
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +7 -3
- package/dist/mjs/index.js +13 -3
- package/dist/mjs/types/ft-common/public.d.ts +26 -3
- package/dist/mjs/types/ft-common/public.js +27 -1
- package/dist/mjs/types/ft-server/public.d.ts +15 -2
- package/dist/mjs/types/ft-server/public.js +17 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -55,7 +55,6 @@ function getBody(response) {
|
|
|
55
55
|
class FluidTopicsApi {
|
|
56
56
|
constructor(tenantBaseUrl, integrationIdentifier, overrideIdentifierIfOnTenant) {
|
|
57
57
|
var _a, _b, _c, _d, _e, _f;
|
|
58
|
-
this.authorization = {};
|
|
59
58
|
this.endpoints = {
|
|
60
59
|
authentication: {
|
|
61
60
|
login: `api/authentication/login`,
|
|
@@ -124,6 +123,9 @@ class FluidTopicsApi {
|
|
|
124
123
|
topic: `api/stylesheets/content/topic.css`,
|
|
125
124
|
},
|
|
126
125
|
},
|
|
126
|
+
configuration: {
|
|
127
|
+
reader: `api/configuration/reader`
|
|
128
|
+
},
|
|
127
129
|
};
|
|
128
130
|
//@ts-ignore
|
|
129
131
|
tenantBaseUrl = ((_f = (_c = (_a = tenantBaseUrl !== null && tenantBaseUrl !== void 0 ? tenantBaseUrl : wnd.__gwt_ft_moduleBase) !== null && _a !== void 0 ? _a : (_b = wnd.fluidtopicsclient) === null || _b === void 0 ? void 0 : _b.__moduleBase) !== null && _c !== void 0 ? _c : (_e = (_d = wnd.__gwt_activeModules) === null || _d === void 0 ? void 0 : _d.fluidtopicsclient) === null || _e === void 0 ? void 0 : _e.moduleBase) !== null && _f !== void 0 ? _f : "").trim();
|
|
@@ -172,6 +174,9 @@ class FluidTopicsApi {
|
|
|
172
174
|
getCurrentSession() {
|
|
173
175
|
return this.get(this.endpoints.authentication.currentSession);
|
|
174
176
|
}
|
|
177
|
+
getReaderConfiguration() {
|
|
178
|
+
return this.get(this.endpoints.configuration.reader);
|
|
179
|
+
}
|
|
175
180
|
getMap(mapId) {
|
|
176
181
|
return this.get(this.endpoints.khub.maps.mapId(mapId).info);
|
|
177
182
|
}
|
|
@@ -303,13 +308,17 @@ class FluidTopicsApi {
|
|
|
303
308
|
return this.fetch(endpoint, {
|
|
304
309
|
method: method,
|
|
305
310
|
headers: Object.assign({}, (data != null ? { "Content-Type": "application/json" } : {})),
|
|
306
|
-
body: data != null ? JSON.stringify(data) : undefined
|
|
311
|
+
body: data != null ? JSON.stringify(data) : undefined,
|
|
312
|
+
credentials: this.authorization == null ? "include" : undefined
|
|
307
313
|
})
|
|
308
314
|
.then(handleError)
|
|
309
315
|
.then(getBody);
|
|
310
316
|
}
|
|
311
317
|
fetchRawData(endpoint) {
|
|
312
|
-
return fetch(this.makeAbsolute(endpoint), {
|
|
318
|
+
return fetch(this.makeAbsolute(endpoint), {
|
|
319
|
+
headers: this.defaultHeaders,
|
|
320
|
+
credentials: this.authorization == null ? "include" : undefined
|
|
321
|
+
})
|
|
313
322
|
.then(handleError)
|
|
314
323
|
.then(response => response.arrayBuffer());
|
|
315
324
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = 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.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtCredentials = void 0;
|
|
4
|
-
exports.isFtAuthenticationIdentifier = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = void 0;
|
|
4
|
+
exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = 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";
|
|
@@ -36,7 +36,6 @@ const isFtMap = (o) => {
|
|
|
36
36
|
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
37
37
|
&& (isString(o.baseId))
|
|
38
38
|
&& (isString(o.clusterId))
|
|
39
|
-
&& (o.shouldSplitCurrentPageToc == null || isBoolean(o.shouldSplitCurrentPageToc))
|
|
40
39
|
&& (isString(o.title))
|
|
41
40
|
&& (isString(o.lastPublication))
|
|
42
41
|
&& (isString(o.lastEdition))
|
|
@@ -61,6 +60,7 @@ exports.isFtMapStyles = isFtMapStyles;
|
|
|
61
60
|
const isFtTocNode = (o) => {
|
|
62
61
|
return isObject(o)
|
|
63
62
|
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
63
|
+
&& (o.hasRating == null || isBoolean(o.hasRating))
|
|
64
64
|
&& (isString(o.tocId))
|
|
65
65
|
&& ((Array.isArray(o.children)
|
|
66
66
|
&& o.children.every((v) => (0, exports.isFtTocNode)(v))))
|
|
@@ -474,6 +474,33 @@ const isFtSuggestResults = (o) => {
|
|
|
474
474
|
&& o.suggestions.every((v) => (0, exports.isFtSuggestResult)(v))));
|
|
475
475
|
};
|
|
476
476
|
exports.isFtSuggestResults = isFtSuggestResults;
|
|
477
|
+
// From: Role
|
|
478
|
+
var FtUserRole;
|
|
479
|
+
(function (FtUserRole) {
|
|
480
|
+
FtUserRole["PERSONAL_BOOK_USER"] = "PERSONAL_BOOK_USER";
|
|
481
|
+
FtUserRole["PERSONAL_BOOK_SHARE_USER"] = "PERSONAL_BOOK_SHARE_USER";
|
|
482
|
+
FtUserRole["HTML_EXPORT_USER"] = "HTML_EXPORT_USER";
|
|
483
|
+
FtUserRole["PDF_EXPORT_USER"] = "PDF_EXPORT_USER";
|
|
484
|
+
FtUserRole["SAVED_SEARCH_USER"] = "SAVED_SEARCH_USER";
|
|
485
|
+
FtUserRole["COLLECTION_USER"] = "COLLECTION_USER";
|
|
486
|
+
FtUserRole["OFFLINE_USER"] = "OFFLINE_USER";
|
|
487
|
+
FtUserRole["ANALYTICS_USER"] = "ANALYTICS_USER";
|
|
488
|
+
FtUserRole["BETA_USER"] = "BETA_USER";
|
|
489
|
+
FtUserRole["DEBUG_USER"] = "DEBUG_USER";
|
|
490
|
+
FtUserRole["PRINT_USER"] = "PRINT_USER";
|
|
491
|
+
FtUserRole["RATING_USER"] = "RATING_USER";
|
|
492
|
+
FtUserRole["FEEDBACK_USER"] = "FEEDBACK_USER";
|
|
493
|
+
FtUserRole["CONTENT_PUBLISHER"] = "CONTENT_PUBLISHER";
|
|
494
|
+
FtUserRole["KHUB_ADMIN"] = "KHUB_ADMIN";
|
|
495
|
+
FtUserRole["USERS_ADMIN"] = "USERS_ADMIN";
|
|
496
|
+
FtUserRole["PORTAL_ADMIN"] = "PORTAL_ADMIN";
|
|
497
|
+
FtUserRole["ADMIN"] = "ADMIN";
|
|
498
|
+
FtUserRole["DEVELOPER"] = "DEVELOPER";
|
|
499
|
+
})(FtUserRole = exports.FtUserRole || (exports.FtUserRole = {}));
|
|
500
|
+
const isFtUserRole = (o) => {
|
|
501
|
+
return ["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(o);
|
|
502
|
+
};
|
|
503
|
+
exports.isFtUserRole = isFtUserRole;
|
|
477
504
|
const isFtAuthenticationIdentifier = (o) => {
|
|
478
505
|
return isObject(o)
|
|
479
506
|
&& (isString(o.identifier))
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFtPaginationConfiguration = exports.isFtPaginatedTocNode = exports.isFtPaginatedToc = exports.isFtPageConfiguration = exports.isFtMapAttachment = exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = void 0;
|
|
3
|
+
exports.isFtPaginationConfiguration = exports.isFtPaginatedTocNode = exports.isFtPaginatedToc = exports.isFtPageConfiguration = exports.isFtMapAttachment = exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtReaderFeedbackConfiguration = exports.isFtReaderConfiguration = void 0;
|
|
4
4
|
const isObject = (o) => typeof o === "object" && o != null;
|
|
5
5
|
const isBoolean = (o) => typeof o === "boolean";
|
|
6
6
|
const isNumber = (o) => typeof o === "number";
|
|
7
7
|
const isString = (o) => typeof o === "string";
|
|
8
|
+
const isFtReaderConfiguration = (o) => {
|
|
9
|
+
return isObject(o)
|
|
10
|
+
&& ((0, exports.isFtReaderFeedbackConfiguration)(o.feedback))
|
|
11
|
+
&& (isNumber(o.loadAfterLastVisibleTopic))
|
|
12
|
+
&& (isNumber(o.loadBeforeFirstVisibleTopic));
|
|
13
|
+
};
|
|
14
|
+
exports.isFtReaderConfiguration = isFtReaderConfiguration;
|
|
15
|
+
const isFtReaderFeedbackConfiguration = (o) => {
|
|
16
|
+
return isObject(o)
|
|
17
|
+
&& (isBoolean(o.mailsSentByFluidTopics))
|
|
18
|
+
&& ((Array.isArray(o.recipients)
|
|
19
|
+
&& o.recipients.every((v) => isString(v))))
|
|
20
|
+
&& ((Array.isArray(o.subjectMetadataIds)
|
|
21
|
+
&& o.subjectMetadataIds.every((v) => isString(v))));
|
|
22
|
+
};
|
|
23
|
+
exports.isFtReaderFeedbackConfiguration = isFtReaderFeedbackConfiguration;
|
|
8
24
|
const isFtAuthenticatedSession = (o) => {
|
|
9
25
|
return isObject(o)
|
|
10
26
|
&& ((0, exports.isFtUserProfile)(o.profile));
|
|
@@ -13,7 +29,7 @@ exports.isFtAuthenticatedSession = isFtAuthenticatedSession;
|
|
|
13
29
|
const isFtSession = (o) => {
|
|
14
30
|
return isObject(o)
|
|
15
31
|
&& (isNumber(o.idleTimeoutInMillis))
|
|
16
|
-
&& (
|
|
32
|
+
&& ((0, exports.isFtUserProfile)(o.profile))
|
|
17
33
|
&& (isBoolean(o.sessionAuthenticated));
|
|
18
34
|
};
|
|
19
35
|
exports.isFtSession = isFtSession;
|
|
@@ -22,7 +38,7 @@ const isFtUserProfile = (o) => {
|
|
|
22
38
|
&& (o.emailAddress == null || isString(o.emailAddress))
|
|
23
39
|
&& (o.displayName == null || isString(o.displayName))
|
|
24
40
|
&& ((Array.isArray(o.roles)))
|
|
25
|
-
&& (isString(o.userId));
|
|
41
|
+
&& (o.userId == null || isString(o.userId));
|
|
26
42
|
};
|
|
27
43
|
exports.isFtUserProfile = isFtUserProfile;
|
|
28
44
|
const isFtMapAttachment = (o) => {
|
|
@@ -53,6 +69,7 @@ exports.isFtPaginatedToc = isFtPaginatedToc;
|
|
|
53
69
|
const isFtPaginatedTocNode = (o) => {
|
|
54
70
|
return isObject(o)
|
|
55
71
|
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
72
|
+
&& (o.hasRating == null || isBoolean(o.hasRating))
|
|
56
73
|
&& (o.pageToc == null || (Array.isArray(o.pageToc)))
|
|
57
74
|
&& (o.tocId == null || isString(o.tocId))
|
|
58
75
|
&& ((Array.isArray(o.children)
|
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:{},n={exports:{}},a={exports:{}};!function(e,t){var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();e.exports=t=n.fetch,n.fetch&&(t.default=n.fetch.bind(n)),t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response}(a,a.exports),function(e,t){const n=a.exports,i=n.default||n,s=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),i.call(this,e,t)};s.ponyfill=!0,e.exports=t=s,t.fetch=s,t.Headers=n.Headers,t.Request=n.Request,t.Response=n.Response,t.default=s}(n,n.exports);const i=n.exports,s=i.fetch.bind({});s.polyfill=!0,t.fetch||(t.fetch=s,t.Response=i.Response,t.Headers=i.Headers,t.Request=i.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))),p=e=>r(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>p(e)))&&u(e.contentId)&&u(e.title);var d;e.FtTopicContentTarget=void 0,(d=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",d.OFF_THE_GRID="OFF_THE_GRID",d.CONTENT_PACKAGER="CONTENT_PACKAGER",d.PAGES="PAGES",d.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 m;e.FtRatingType=void 0,(m=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",m.LIKE="LIKE",m.DICHOTOMOUS="DICHOTOMOUS",m.NO_RATING="NO_RATING";const g=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),f=e=>r(e)&&u(e.date)&&g(e.type)&&l(e.value),A=e=>r(e)&&(null==e.rating||f(e.rating))&&g(e.type),b=e=>r(e)&&u(e.date)&&u(e.tocId)&&g(e.type)&&l(e.value),T=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>b(e)))&&g(e.type),I=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e))),F=e=>r(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key),R=e=>r(e)&&l(e.totalResultsCount)&&o(e.lastPage)&&l(e.currentPage)&&l(e.totalClustersCount);var S;e.FtEditorialType=void 0,(S=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",S.BOOK="BOOK";const k=e=>["ARTICLE","BOOK"].includes(e);var v;e.FtOpenMode=void 0,(v=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",v.EXTERNAL="EXTERNAL";const C=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),E=e=>r(e)&&(null==e.perPage||l(e.perPage))&&l(e.page);var U;e.FtCollectionDocumentType=void 0,(U=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",U.DOCUMENT="DOCUMENT",U.TOPIC="TOPIC",U.PERSONAL_BOOK="PERSONAL_BOOK",U.SHARED_BOOK="SHARED_BOOK";const O=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),P=e=>r(e)&&l(e.weight)&&u(e.value)&&u(e.key),D=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>M(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),M=e=>r(e)&&(null==e.document||w(e.document))&&(null==e.topic||N(e.topic))&&$(e.type)&&(null==e.map||L(e.map)),w=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&C(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||C(e.openMode))&&k(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),N=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&C(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>K(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 x;e.FtSearchResultType=void 0,(x=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",x.DOCUMENT="DOCUMENT",x.TOPIC="TOPIC";const $=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=>B(e))),H=e=>r(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),B=e=>r(e)&&l(e.totalResultsCount)&&o(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>B(e)))&&u(e.label)&&u(e.value)&&o(e.selected),q=e=>r(e)&&u(e.key),G=e=>r(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),K=e=>r(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),V=e=>r(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||k(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&$(e.type)&&u(e.value),j=e=>"object"==typeof e&&null!=e,z=e=>"boolean"==typeof e,J=e=>"number"==typeof e,X=e=>"string"==typeof e,Y=e=>j(e)&&(null==e.emailAddress||X(e.emailAddress))&&(null==e.displayName||X(e.displayName))&&Array.isArray(e.roles)&&X(e.userId),Q=e=>j(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>z(e))))&&z(e.isVisible),W=e=>j(e)&&(null==e.prettyUrl||X(e.prettyUrl))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||X(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>W(e)))&&(null==e.pageConfiguration||Q(e.pageConfiguration))&&(null==e.contentId||X(e.contentId))&&(null==e.title||X(e.title)),Z=e=>j(e)&&z(e.splitCurrentPageToc),ee="undefined"==typeof window?globalThis:window;function te(e){let t={};for(let n in e){let a=e[n];("object"!=typeof a||Array.isArray(a))&&(a={prior:a});for(let e of["prior","filter"])a[e]=Array.isArray(a[e])?a[e]:[a[e]],a[e]=a[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[n]=a}return t}function ne(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const ae="undefined"==typeof window?globalThis:window;class ie extends Error{status;statusText;body;constructor(e,t,n){super(`${e} - ${t}: ${n}`),this.status=e,this.statusText=t,this.body=n}}async function se(e){if(!e.ok)throw new ie(e.status,e.statusText,await e.text());return e}function re(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class oe{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"}}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,n){e=(e??ae.__gwt_ft_moduleBase??ae.fluidtopicsclient?.__moduleBase??ae.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",n&&void 0!==ae.location&&ae.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 n;this.authorization={Authorization:"Basic "+(n=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(n).toString("base64"):btoa(n))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let n={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,n).then((n=>(this.setCredentials(e,t),n)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}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,n){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(n?"?target="+n:""))}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,n){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:n})}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,n,a){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:n,value:a})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,n){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:n})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,n){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:n})}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})}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 n=t;return await fetch(this.makeAbsolute(e),{...n??{},headers:{...this.defaultHeaders,...n?.headers??{}}})}upload(e,t,n,a=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((i,s)=>{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;i(e)}else s(new ie(r.status,r.statusText,r.responseText))},r.upload.onprogress=e=>a(e),r.open(e,this.makeAbsolute(t),!0),r.send(n)})):this.fetch(t,{method:e,body:n}).then(se).then(re)}makeRequest(e,t,n){return this.fetch(t,{method:e,headers:{...null!=n?{"Content-Type":"application/json"}:{}},body:null!=n?JSON.stringify(n):void 0}).then(se).then(re)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders}).then(se).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=oe,e.HttpError=ie,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(ee.localStorage){const n=ne(e),a=e=>{e.storageArea===ee.localStorage&&e.key===n&&t(JSON.parse(e.newValue??"{}"))};return ee.addEventListener("storage",a),{removeHandler:()=>ee.removeEventListener("storage",a)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=oe,e.getUnauthenticatedUserSearchPreferences=function(e){if(ee.localStorage)return JSON.parse(ee.localStorage.getItem(ne(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>j(e)&&Y(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)&&O(e.type),e.isFtCollectionDocumentType=O,e.isFtCredentials=e=>r(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=k,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)))&&C(e.openMode)&&u(e.topicsApiEndpoint)&&(null==e.description||u(e.description))&&u(e.attachmentsApiEndpoint)&&k(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&(null==e.shouldSplitCurrentPageToc||o(e.shouldSplitCurrentPageToc))&&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=>j(e)&&X(e.file)&&(null==e.size||J(e.size))&&z(e.externalLink)&&X(e.name)&&X(e.id)&&(null==e.mimeType||X(e.mimeType))&&(null==e.viewerUrl||X(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=c,e.isFtMetadata=y,e.isFtMetadataPreferenceConfiguration=I,e.isFtOpenMode=C,e.isFtPageConfiguration=Q,e.isFtPageRequest=E,e.isFtPaginatedToc=e=>j(e)&&Z(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>W(e))),e.isFtPaginatedTocNode=W,e.isFtPaginationConfiguration=Z,e.isFtPublicationRating=f,e.isFtPublicationRatingSummary=A,e.isFtRatingCreation=e=>r(e)&&g(e.type)&&l(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||T(e.topics))&&A(e.publication),e.isFtRatingType=g,e.isFtSearchFacet=_,e.isFtSearchFacetConf=H,e.isFtSearchFacetEntry=B,e.isFtSearchFilter=F,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=>I(e))),e.isFtSearchPreset=e=>r(e)&&u(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>F(e)))&&l(e.priority)&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSearchPrior=P,e.isFtSearchRequest=e=>r(e)&&u(e.query)&&E(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>F(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>q(e)))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>P(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>H(e))),e.isFtSearchResultCluster=D,e.isFtSearchResultClusterEntry=M,e.isFtSearchResultMap=L,e.isFtSearchResultTopic=N,e.isFtSearchResultType=$,e.isFtSearchResultUnstructuredDocument=w,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||G(e.spellcheck))&&R(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>D(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>_(e))),e.isFtSearchResultsPageInfo=R,e.isFtSearchSortCriterion=q,e.isFtSession=e=>j(e)&&J(e.idleTimeoutInMillis)&&(null==e.profile||Y(e.profile))&&z(e.sessionAuthenticated),e.isFtSpellcheck=G,e.isFtSuggestRequest=e=>r(e)&&u(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>F(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>q(e)))&&(null==e.maxCount||l(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=V,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>V(e))),e.isFtTocNode=p,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=b,e.isFtTopicResource=K,e.isFtTopicsRatingSummary=T,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=Y,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(ee.localStorage){let n={...t,metadata:te(t.metadata??{})};const a=ne(e),i=JSON.stringify(n);return ee.localStorage.setItem(a,i),ee.dispatchEvent(new StorageEvent("storage",{key:a,newValue:i,storageArea:ee.localStorage,url:ee.location.href})),n}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:{}},a={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}(a,a.exports),function(e,t){const i=a.exports,n=i.default||i,r=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),n.call(this,e,t)};r.ponyfill=!0,e.exports=t=r,t.fetch=r,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,t.default=r}(i,i.exports);const n=i.exports,r=n.fetch.bind({});r.polyfill=!0,t.fetch||(t.fetch=r,t.Response=n.Response,t.Headers=n.Headers,t.Request=n.Request);const s=e=>"object"==typeof e&&null!=e,o=e=>"boolean"==typeof e,l=e=>"number"==typeof e,u=e=>"string"==typeof e,c=e=>s(e)&&u(e.topicStylesheetUrl)&&u(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>u(e))),d=e=>s(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=>s(e)&&l(e.count)&&u(e.label)&&(null==e.lang||u(e.lang)),y=e=>s(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=>s(e)&&u(e.date)&&m(e.type)&&l(e.value),f=e=>s(e)&&(null==e.rating||A(e.rating))&&m(e.type),R=e=>s(e)&&u(e.date)&&u(e.tocId)&&m(e.type)&&l(e.value),E=e=>s(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>R(e)))&&m(e.type),T=e=>s(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e))),S=e=>s(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key),b=e=>s(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=>s(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=>s(e)&&l(e.weight)&&u(e.value)&&u(e.key),P=e=>s(e)&&Array.isArray(e.entries)&&e.entries.every((e=>D(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),D=e=>s(e)&&(null==e.document||N(e.document))&&(null==e.topic||M(e.topic))&&B(e.type)&&(null==e.map||L(e.map)),N=e=>s(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=>s(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=>s(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=>s(e)&&o(e.hierarchical)&&u(e.label)&&o(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>$(e))),x=e=>s(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),$=e=>s(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=>s(e)&&u(e.key),V=e=>s(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),G=e=>s(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),q=e=>s(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 ae(e){let t={};for(let i in e){let a=e[i];("object"!=typeof a||Array.isArray(a))&&(a={prior:a});for(let e of["prior","filter"])a[e]=Array.isArray(a[e])?a[e]:[a[e]],a[e]=a[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[i]=a}return t}function ne(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const re="undefined"==typeof window?globalThis:window;class se 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 se(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"}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,i){e=(e??re.__gwt_ft_moduleBase??re.fluidtopicsclient?.__moduleBase??re.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",i&&void 0!==re.location&&re.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,a){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:i,value:a})}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})}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,a=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,r)=>{let s=new XMLHttpRequest;s.onload=()=>{if(s.status>=200&&s.status<300){let e="application/json"===s.getResponseHeader("Content-Type")?JSON.parse(s.responseText):s.responseText;n(e)}else r(new se(s.status,s.statusText,s.responseText))},s.upload.onprogress=e=>a(e),s.open(e,this.makeAbsolute(t),!0),s.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=se,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(ie.localStorage){const i=ne(e),a=e=>{e.storageArea===ie.localStorage&&e.key===i&&t(JSON.parse(e.newValue??"{}"))};return ie.addEventListener("storage",a),{removeHandler:()=>ie.removeEventListener("storage",a)}}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(ne(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>z(e)&&W(e.profile),e.isFtAuthenticationIdentifier=e=>s(e)&&u(e.identifier)&&u(e.realm),e.isFtCollectionDocument=e=>s(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=>s(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=U,e.isFtFeedbackCreation=e=>s(e)&&u(e.message),e.isFtMap=e=>s(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=>s(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=c,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=>s(e)&&m(e.type)&&l(e.value),e.isFtRatingSummary=e=>s(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=>s(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>h(e))),e.isFtSearchPreferencesConfiguration=e=>s(e)&&s(e.metadata)&&Object.keys(e.metadata).every((e=>u(e)))&&Object.values(e.metadata).every((e=>T(e))),e.isFtSearchPreset=e=>s(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=>s(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=>s(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=>s(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=>s(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>q(e))),e.isFtTocNode=d,e.isFtTopic=e=>s(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=>s(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:ae(t.metadata??{})};const a=ne(e),n=JSON.stringify(i);return ie.localStorage.setItem(a,n),ie.dispatchEvent(new StorageEvent("storage",{key:a,newValue:n,storageArea:ie.localStorage,url:ie.location.href})),i}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")}}));
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "cross-fetch/polyfill";
|
|
2
2
|
import { FtCollectionDocument, FtMap, FtMapResource, FtRatingSummary, FtRatingType, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUnstructuredDocument } from "./types/ft-common/public";
|
|
3
|
-
import { FtAuthenticatedSession, FtMapAttachment, FtPaginatedToc, FtSession } from "./types/ft-server/public";
|
|
3
|
+
import { FtAuthenticatedSession, FtMapAttachment, FtPaginatedToc, FtReaderConfiguration, FtSession } from "./types/ft-server/public";
|
|
4
4
|
export * from "./types/ft-common/public";
|
|
5
5
|
export * from "./types/ft-server/public";
|
|
6
6
|
export * from "./preferences/unauthenticated-preferences";
|
|
@@ -13,8 +13,8 @@ export declare class HttpError extends Error {
|
|
|
13
13
|
export declare class FluidTopicsApi {
|
|
14
14
|
readonly tenantBaseUrl: string;
|
|
15
15
|
private readonly ftCallingApp;
|
|
16
|
-
private authorization
|
|
17
|
-
private searchLabel
|
|
16
|
+
private authorization?;
|
|
17
|
+
private searchLabel?;
|
|
18
18
|
readonly endpoints: {
|
|
19
19
|
authentication: {
|
|
20
20
|
login: string;
|
|
@@ -83,6 +83,9 @@ export declare class FluidTopicsApi {
|
|
|
83
83
|
topic: string;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
|
+
configuration: {
|
|
87
|
+
reader: string;
|
|
88
|
+
};
|
|
86
89
|
};
|
|
87
90
|
private get defaultHeaders();
|
|
88
91
|
constructor(tenantBaseUrl: string, integrationIdentifier: string, overrideIdentifierIfOnTenant?: boolean);
|
|
@@ -94,6 +97,7 @@ export declare class FluidTopicsApi {
|
|
|
94
97
|
login(login: string, password: string): Promise<FtAuthenticatedSession>;
|
|
95
98
|
logout(): Promise<void>;
|
|
96
99
|
getCurrentSession(): Promise<FtSession>;
|
|
100
|
+
getReaderConfiguration(): Promise<FtReaderConfiguration>;
|
|
97
101
|
getMap(mapId: string): Promise<FtMap>;
|
|
98
102
|
getTableOfContent(mapId: string): Promise<Array<FtTocNode>>;
|
|
99
103
|
getPages(mapId: string): Promise<FtPaginatedToc>;
|
package/dist/mjs/index.js
CHANGED
|
@@ -29,7 +29,7 @@ function getBody(response) {
|
|
|
29
29
|
export class FluidTopicsApi {
|
|
30
30
|
tenantBaseUrl;
|
|
31
31
|
ftCallingApp;
|
|
32
|
-
authorization
|
|
32
|
+
authorization;
|
|
33
33
|
searchLabel;
|
|
34
34
|
endpoints = {
|
|
35
35
|
authentication: {
|
|
@@ -99,6 +99,9 @@ export class FluidTopicsApi {
|
|
|
99
99
|
topic: `api/stylesheets/content/topic.css`,
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
|
+
configuration: {
|
|
103
|
+
reader: `api/configuration/reader`
|
|
104
|
+
},
|
|
102
105
|
};
|
|
103
106
|
get defaultHeaders() {
|
|
104
107
|
return {
|
|
@@ -152,6 +155,9 @@ export class FluidTopicsApi {
|
|
|
152
155
|
getCurrentSession() {
|
|
153
156
|
return this.get(this.endpoints.authentication.currentSession);
|
|
154
157
|
}
|
|
158
|
+
getReaderConfiguration() {
|
|
159
|
+
return this.get(this.endpoints.configuration.reader);
|
|
160
|
+
}
|
|
155
161
|
getMap(mapId) {
|
|
156
162
|
return this.get(this.endpoints.khub.maps.mapId(mapId).info);
|
|
157
163
|
}
|
|
@@ -288,13 +294,17 @@ export class FluidTopicsApi {
|
|
|
288
294
|
headers: {
|
|
289
295
|
...(data != null ? { "Content-Type": "application/json" } : {})
|
|
290
296
|
},
|
|
291
|
-
body: data != null ? JSON.stringify(data) : undefined
|
|
297
|
+
body: data != null ? JSON.stringify(data) : undefined,
|
|
298
|
+
credentials: this.authorization == null ? "include" : undefined
|
|
292
299
|
})
|
|
293
300
|
.then(handleError)
|
|
294
301
|
.then(getBody);
|
|
295
302
|
}
|
|
296
303
|
fetchRawData(endpoint) {
|
|
297
|
-
return fetch(this.makeAbsolute(endpoint), {
|
|
304
|
+
return fetch(this.makeAbsolute(endpoint), {
|
|
305
|
+
headers: this.defaultHeaders,
|
|
306
|
+
credentials: this.authorization == null ? "include" : undefined
|
|
307
|
+
})
|
|
298
308
|
.then(handleError)
|
|
299
309
|
.then(response => response.arrayBuffer());
|
|
300
310
|
}
|
|
@@ -24,7 +24,6 @@ export interface FtMap {
|
|
|
24
24
|
editorialType: FtEditorialType;
|
|
25
25
|
baseId: string;
|
|
26
26
|
clusterId: string;
|
|
27
|
-
shouldSplitCurrentPageToc?: boolean;
|
|
28
27
|
title: string;
|
|
29
28
|
lastPublication: string;
|
|
30
29
|
lastEdition: string;
|
|
@@ -46,6 +45,7 @@ export interface FtMapStyles {
|
|
|
46
45
|
export declare const isFtMapStyles: (o: any) => o is FtMapStyles;
|
|
47
46
|
export interface FtTocNode {
|
|
48
47
|
prettyUrl?: string;
|
|
48
|
+
hasRating?: boolean;
|
|
49
49
|
tocId: string;
|
|
50
50
|
children: Array<FtTocNode>;
|
|
51
51
|
contentId: string;
|
|
@@ -120,7 +120,7 @@ export declare enum FtRatingType {
|
|
|
120
120
|
export declare type FtRatingTypeKeys = keyof typeof FtRatingType;
|
|
121
121
|
export declare const isFtRatingType: (o: any) => o is FtRatingType;
|
|
122
122
|
export interface FtPublicationRating {
|
|
123
|
-
date: Date;
|
|
123
|
+
date: Date | string;
|
|
124
124
|
type: FtRatingType;
|
|
125
125
|
value: number;
|
|
126
126
|
}
|
|
@@ -141,7 +141,7 @@ export interface FtRatingSummary {
|
|
|
141
141
|
}
|
|
142
142
|
export declare const isFtRatingSummary: (o: any) => o is FtRatingSummary;
|
|
143
143
|
export interface FtTopicRating {
|
|
144
|
-
date: Date;
|
|
144
|
+
date: Date | string;
|
|
145
145
|
tocId: string;
|
|
146
146
|
type: FtRatingType;
|
|
147
147
|
value: number;
|
|
@@ -374,6 +374,29 @@ export interface FtSuggestResults {
|
|
|
374
374
|
suggestions: Array<FtSuggestResult>;
|
|
375
375
|
}
|
|
376
376
|
export declare const isFtSuggestResults: (o: any) => o is FtSuggestResults;
|
|
377
|
+
export declare enum FtUserRole {
|
|
378
|
+
PERSONAL_BOOK_USER = "PERSONAL_BOOK_USER",
|
|
379
|
+
PERSONAL_BOOK_SHARE_USER = "PERSONAL_BOOK_SHARE_USER",
|
|
380
|
+
HTML_EXPORT_USER = "HTML_EXPORT_USER",
|
|
381
|
+
PDF_EXPORT_USER = "PDF_EXPORT_USER",
|
|
382
|
+
SAVED_SEARCH_USER = "SAVED_SEARCH_USER",
|
|
383
|
+
COLLECTION_USER = "COLLECTION_USER",
|
|
384
|
+
OFFLINE_USER = "OFFLINE_USER",
|
|
385
|
+
ANALYTICS_USER = "ANALYTICS_USER",
|
|
386
|
+
BETA_USER = "BETA_USER",
|
|
387
|
+
DEBUG_USER = "DEBUG_USER",
|
|
388
|
+
PRINT_USER = "PRINT_USER",
|
|
389
|
+
RATING_USER = "RATING_USER",
|
|
390
|
+
FEEDBACK_USER = "FEEDBACK_USER",
|
|
391
|
+
CONTENT_PUBLISHER = "CONTENT_PUBLISHER",
|
|
392
|
+
KHUB_ADMIN = "KHUB_ADMIN",
|
|
393
|
+
USERS_ADMIN = "USERS_ADMIN",
|
|
394
|
+
PORTAL_ADMIN = "PORTAL_ADMIN",
|
|
395
|
+
ADMIN = "ADMIN",
|
|
396
|
+
DEVELOPER = "DEVELOPER"
|
|
397
|
+
}
|
|
398
|
+
export declare type FtUserRoleKeys = keyof typeof FtUserRole;
|
|
399
|
+
export declare const isFtUserRole: (o: any) => o is FtUserRole;
|
|
377
400
|
export interface FtAuthenticationIdentifier {
|
|
378
401
|
identifier: string;
|
|
379
402
|
realm: string;
|
|
@@ -30,7 +30,6 @@ export const isFtMap = (o) => {
|
|
|
30
30
|
&& (isFtEditorialType(o.editorialType))
|
|
31
31
|
&& (isString(o.baseId))
|
|
32
32
|
&& (isString(o.clusterId))
|
|
33
|
-
&& (o.shouldSplitCurrentPageToc == null || isBoolean(o.shouldSplitCurrentPageToc))
|
|
34
33
|
&& (isString(o.title))
|
|
35
34
|
&& (isString(o.lastPublication))
|
|
36
35
|
&& (isString(o.lastEdition))
|
|
@@ -53,6 +52,7 @@ export const isFtMapStyles = (o) => {
|
|
|
53
52
|
export const isFtTocNode = (o) => {
|
|
54
53
|
return isObject(o)
|
|
55
54
|
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
55
|
+
&& (o.hasRating == null || isBoolean(o.hasRating))
|
|
56
56
|
&& (isString(o.tocId))
|
|
57
57
|
&& ((Array.isArray(o.children)
|
|
58
58
|
&& o.children.every((v) => isFtTocNode(v))))
|
|
@@ -423,6 +423,32 @@ export const isFtSuggestResults = (o) => {
|
|
|
423
423
|
&& ((Array.isArray(o.suggestions)
|
|
424
424
|
&& o.suggestions.every((v) => isFtSuggestResult(v))));
|
|
425
425
|
};
|
|
426
|
+
// From: Role
|
|
427
|
+
export var FtUserRole;
|
|
428
|
+
(function (FtUserRole) {
|
|
429
|
+
FtUserRole["PERSONAL_BOOK_USER"] = "PERSONAL_BOOK_USER";
|
|
430
|
+
FtUserRole["PERSONAL_BOOK_SHARE_USER"] = "PERSONAL_BOOK_SHARE_USER";
|
|
431
|
+
FtUserRole["HTML_EXPORT_USER"] = "HTML_EXPORT_USER";
|
|
432
|
+
FtUserRole["PDF_EXPORT_USER"] = "PDF_EXPORT_USER";
|
|
433
|
+
FtUserRole["SAVED_SEARCH_USER"] = "SAVED_SEARCH_USER";
|
|
434
|
+
FtUserRole["COLLECTION_USER"] = "COLLECTION_USER";
|
|
435
|
+
FtUserRole["OFFLINE_USER"] = "OFFLINE_USER";
|
|
436
|
+
FtUserRole["ANALYTICS_USER"] = "ANALYTICS_USER";
|
|
437
|
+
FtUserRole["BETA_USER"] = "BETA_USER";
|
|
438
|
+
FtUserRole["DEBUG_USER"] = "DEBUG_USER";
|
|
439
|
+
FtUserRole["PRINT_USER"] = "PRINT_USER";
|
|
440
|
+
FtUserRole["RATING_USER"] = "RATING_USER";
|
|
441
|
+
FtUserRole["FEEDBACK_USER"] = "FEEDBACK_USER";
|
|
442
|
+
FtUserRole["CONTENT_PUBLISHER"] = "CONTENT_PUBLISHER";
|
|
443
|
+
FtUserRole["KHUB_ADMIN"] = "KHUB_ADMIN";
|
|
444
|
+
FtUserRole["USERS_ADMIN"] = "USERS_ADMIN";
|
|
445
|
+
FtUserRole["PORTAL_ADMIN"] = "PORTAL_ADMIN";
|
|
446
|
+
FtUserRole["ADMIN"] = "ADMIN";
|
|
447
|
+
FtUserRole["DEVELOPER"] = "DEVELOPER";
|
|
448
|
+
})(FtUserRole || (FtUserRole = {}));
|
|
449
|
+
export const isFtUserRole = (o) => {
|
|
450
|
+
return ["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(o);
|
|
451
|
+
};
|
|
426
452
|
export const isFtAuthenticationIdentifier = (o) => {
|
|
427
453
|
return isObject(o)
|
|
428
454
|
&& (isString(o.identifier))
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
export interface FtReaderConfiguration {
|
|
2
|
+
feedback: FtReaderFeedbackConfiguration;
|
|
3
|
+
loadAfterLastVisibleTopic: number;
|
|
4
|
+
loadBeforeFirstVisibleTopic: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const isFtReaderConfiguration: (o: any) => o is FtReaderConfiguration;
|
|
7
|
+
export interface FtReaderFeedbackConfiguration {
|
|
8
|
+
mailsSentByFluidTopics: boolean;
|
|
9
|
+
recipients: Array<string>;
|
|
10
|
+
subjectMetadataIds: Array<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare const isFtReaderFeedbackConfiguration: (o: any) => o is FtReaderFeedbackConfiguration;
|
|
1
13
|
export interface FtAuthenticatedSession {
|
|
2
14
|
authenticationIdentifier: any;
|
|
3
15
|
profile: FtUserProfile;
|
|
@@ -6,7 +18,7 @@ export declare const isFtAuthenticatedSession: (o: any) => o is FtAuthenticatedS
|
|
|
6
18
|
export interface FtSession {
|
|
7
19
|
authenticationIdentifier?: any;
|
|
8
20
|
idleTimeoutInMillis: number;
|
|
9
|
-
profile
|
|
21
|
+
profile: FtUserProfile;
|
|
10
22
|
sessionAuthenticated: boolean;
|
|
11
23
|
}
|
|
12
24
|
export declare const isFtSession: (o: any) => o is FtSession;
|
|
@@ -14,7 +26,7 @@ export interface FtUserProfile {
|
|
|
14
26
|
emailAddress?: string;
|
|
15
27
|
displayName?: string;
|
|
16
28
|
roles: Array<any>;
|
|
17
|
-
userId
|
|
29
|
+
userId?: string;
|
|
18
30
|
}
|
|
19
31
|
export declare const isFtUserProfile: (o: any) => o is FtUserProfile;
|
|
20
32
|
export interface FtMapAttachment {
|
|
@@ -39,6 +51,7 @@ export interface FtPaginatedToc {
|
|
|
39
51
|
export declare const isFtPaginatedToc: (o: any) => o is FtPaginatedToc;
|
|
40
52
|
export interface FtPaginatedTocNode {
|
|
41
53
|
prettyUrl?: string;
|
|
54
|
+
hasRating?: boolean;
|
|
42
55
|
pageToc?: Array<any>;
|
|
43
56
|
tocId?: string;
|
|
44
57
|
children: Array<FtPaginatedTocNode>;
|
|
@@ -2,6 +2,20 @@ const isObject = (o) => typeof o === "object" && o != null;
|
|
|
2
2
|
const isBoolean = (o) => typeof o === "boolean";
|
|
3
3
|
const isNumber = (o) => typeof o === "number";
|
|
4
4
|
const isString = (o) => typeof o === "string";
|
|
5
|
+
export const isFtReaderConfiguration = (o) => {
|
|
6
|
+
return isObject(o)
|
|
7
|
+
&& (isFtReaderFeedbackConfiguration(o.feedback))
|
|
8
|
+
&& (isNumber(o.loadAfterLastVisibleTopic))
|
|
9
|
+
&& (isNumber(o.loadBeforeFirstVisibleTopic));
|
|
10
|
+
};
|
|
11
|
+
export const isFtReaderFeedbackConfiguration = (o) => {
|
|
12
|
+
return isObject(o)
|
|
13
|
+
&& (isBoolean(o.mailsSentByFluidTopics))
|
|
14
|
+
&& ((Array.isArray(o.recipients)
|
|
15
|
+
&& o.recipients.every((v) => isString(v))))
|
|
16
|
+
&& ((Array.isArray(o.subjectMetadataIds)
|
|
17
|
+
&& o.subjectMetadataIds.every((v) => isString(v))));
|
|
18
|
+
};
|
|
5
19
|
export const isFtAuthenticatedSession = (o) => {
|
|
6
20
|
return isObject(o)
|
|
7
21
|
&& (isFtUserProfile(o.profile));
|
|
@@ -9,7 +23,7 @@ export const isFtAuthenticatedSession = (o) => {
|
|
|
9
23
|
export const isFtSession = (o) => {
|
|
10
24
|
return isObject(o)
|
|
11
25
|
&& (isNumber(o.idleTimeoutInMillis))
|
|
12
|
-
&& (
|
|
26
|
+
&& (isFtUserProfile(o.profile))
|
|
13
27
|
&& (isBoolean(o.sessionAuthenticated));
|
|
14
28
|
};
|
|
15
29
|
export const isFtUserProfile = (o) => {
|
|
@@ -17,7 +31,7 @@ export const isFtUserProfile = (o) => {
|
|
|
17
31
|
&& (o.emailAddress == null || isString(o.emailAddress))
|
|
18
32
|
&& (o.displayName == null || isString(o.displayName))
|
|
19
33
|
&& ((Array.isArray(o.roles)))
|
|
20
|
-
&& (isString(o.userId));
|
|
34
|
+
&& (o.userId == null || isString(o.userId));
|
|
21
35
|
};
|
|
22
36
|
export const isFtMapAttachment = (o) => {
|
|
23
37
|
return isObject(o)
|
|
@@ -44,6 +58,7 @@ export const isFtPaginatedToc = (o) => {
|
|
|
44
58
|
export const isFtPaginatedTocNode = (o) => {
|
|
45
59
|
return isObject(o)
|
|
46
60
|
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
61
|
+
&& (o.hasRating == null || isBoolean(o.hasRating))
|
|
47
62
|
&& (o.pageToc == null || (Array.isArray(o.pageToc)))
|
|
48
63
|
&& (o.tocId == null || isString(o.tocId))
|
|
49
64
|
&& ((Array.isArray(o.children)
|