@fluid-topics/public-api 1.0.34 → 1.0.36
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 +7 -1
- package/dist/cjs/types/ft-common/public.js +65 -2
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +5 -1
- package/dist/mjs/index.js +7 -1
- package/dist/mjs/types/ft-common/public.d.ts +49 -0
- package/dist/mjs/types/ft-common/public.js +57 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -115,8 +115,11 @@ class FluidTopicsApi {
|
|
|
115
115
|
collectionId: (collectionId) => ({
|
|
116
116
|
documents: `api/users/${userId}/collections/${collectionId}/documents`,
|
|
117
117
|
})
|
|
118
|
+
},
|
|
119
|
+
searches: {
|
|
120
|
+
list: `api/users/${userId}/searches`
|
|
118
121
|
}
|
|
119
|
-
})
|
|
122
|
+
}),
|
|
120
123
|
},
|
|
121
124
|
stylesheets: {
|
|
122
125
|
fonts: `api/stylesheets/fonts.css`,
|
|
@@ -286,6 +289,9 @@ class FluidTopicsApi {
|
|
|
286
289
|
getCustomMessageContext(locale, name) {
|
|
287
290
|
return this.get(this.endpoints.messages.locale(locale).custom.contextName(name).endpoint);
|
|
288
291
|
}
|
|
292
|
+
listMySearches(userId) {
|
|
293
|
+
return this.get(this.endpoints.users.userId(userId).searches.list);
|
|
294
|
+
}
|
|
289
295
|
get(endpoint) {
|
|
290
296
|
return this.makeRequest("GET", endpoint);
|
|
291
297
|
}
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = void 0;
|
|
3
|
+
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.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = 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 = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
|
|
4
|
+
exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = 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 = 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";
|
|
8
8
|
const isString = (o) => typeof o === "string";
|
|
9
|
+
// From: MyLibraryColors
|
|
10
|
+
var FtMyLibraryColors;
|
|
11
|
+
(function (FtMyLibraryColors) {
|
|
12
|
+
FtMyLibraryColors["black"] = "black";
|
|
13
|
+
FtMyLibraryColors["green"] = "green";
|
|
14
|
+
FtMyLibraryColors["blue"] = "blue";
|
|
15
|
+
FtMyLibraryColors["purple"] = "purple";
|
|
16
|
+
FtMyLibraryColors["red"] = "red";
|
|
17
|
+
FtMyLibraryColors["orange"] = "orange";
|
|
18
|
+
FtMyLibraryColors["yellow"] = "yellow";
|
|
19
|
+
})(FtMyLibraryColors = exports.FtMyLibraryColors || (exports.FtMyLibraryColors = {}));
|
|
20
|
+
const isFtMyLibraryColors = (o) => {
|
|
21
|
+
return ["black", "green", "blue", "purple", "red", "orange", "yellow"].includes(o);
|
|
22
|
+
};
|
|
23
|
+
exports.isFtMyLibraryColors = isFtMyLibraryColors;
|
|
9
24
|
const isFtCredentials = (o) => {
|
|
10
25
|
return isObject(o)
|
|
11
26
|
&& (isString(o.password))
|
|
@@ -184,6 +199,29 @@ const isFtMetadata = (o) => {
|
|
|
184
199
|
&& (isString(o.key));
|
|
185
200
|
};
|
|
186
201
|
exports.isFtMetadata = isFtMetadata;
|
|
202
|
+
const isFtMySearch = (o) => {
|
|
203
|
+
return isObject(o)
|
|
204
|
+
&& ((0, exports.isFtMySearchRequest)(o.searchRequest))
|
|
205
|
+
&& ((0, exports.isFtMyLibraryColors)(o.color))
|
|
206
|
+
&& (isBoolean(o.alert))
|
|
207
|
+
&& (isString(o.description))
|
|
208
|
+
&& (isString(o.id))
|
|
209
|
+
&& (isString(o.ownerId))
|
|
210
|
+
&& (isString(o.title))
|
|
211
|
+
&& (isString(o.creationDate));
|
|
212
|
+
};
|
|
213
|
+
exports.isFtMySearch = isFtMySearch;
|
|
214
|
+
const isFtMySearchRequest = (o) => {
|
|
215
|
+
return isObject(o)
|
|
216
|
+
&& (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
|
|
217
|
+
&& (isString(o.query))
|
|
218
|
+
&& ((Array.isArray(o.filters)
|
|
219
|
+
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
220
|
+
&& ((Array.isArray(o.sort)
|
|
221
|
+
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
222
|
+
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
223
|
+
};
|
|
224
|
+
exports.isFtMySearchRequest = isFtMySearchRequest;
|
|
187
225
|
// From: RatingType
|
|
188
226
|
var FtRatingType;
|
|
189
227
|
(function (FtRatingType) {
|
|
@@ -259,6 +297,30 @@ const isFtSearchPreferencesConfiguration = (o) => {
|
|
|
259
297
|
&& Object.values(o.metadata).every((v) => (0, exports.isFtMetadataPreferenceConfiguration)(v))));
|
|
260
298
|
};
|
|
261
299
|
exports.isFtSearchPreferencesConfiguration = isFtSearchPreferencesConfiguration;
|
|
300
|
+
const isFtPeriod = (o) => {
|
|
301
|
+
return isObject(o)
|
|
302
|
+
&& (isString(o.from))
|
|
303
|
+
&& (isString(o.to));
|
|
304
|
+
};
|
|
305
|
+
exports.isFtPeriod = isFtPeriod;
|
|
306
|
+
const isFtPeriodFilter = (o) => {
|
|
307
|
+
return isObject(o)
|
|
308
|
+
&& (o.period == null || (0, exports.isFtPeriod)(o.period))
|
|
309
|
+
&& ((0, exports.isFtPeriodFilterType)(o.periodType));
|
|
310
|
+
};
|
|
311
|
+
exports.isFtPeriodFilter = isFtPeriodFilter;
|
|
312
|
+
// From: PeriodFilterType
|
|
313
|
+
var FtPeriodFilterType;
|
|
314
|
+
(function (FtPeriodFilterType) {
|
|
315
|
+
FtPeriodFilterType["LAST_WEEK"] = "LAST_WEEK";
|
|
316
|
+
FtPeriodFilterType["LAST_MONTH"] = "LAST_MONTH";
|
|
317
|
+
FtPeriodFilterType["LAST_YEAR"] = "LAST_YEAR";
|
|
318
|
+
FtPeriodFilterType["CUSTOM"] = "CUSTOM";
|
|
319
|
+
})(FtPeriodFilterType = exports.FtPeriodFilterType || (exports.FtPeriodFilterType = {}));
|
|
320
|
+
const isFtPeriodFilterType = (o) => {
|
|
321
|
+
return ["LAST_WEEK", "LAST_MONTH", "LAST_YEAR", "CUSTOM"].includes(o);
|
|
322
|
+
};
|
|
323
|
+
exports.isFtPeriodFilterType = isFtPeriodFilterType;
|
|
262
324
|
const isFtSearchFilter = (o) => {
|
|
263
325
|
return isObject(o)
|
|
264
326
|
&& (isBoolean(o.negative))
|
|
@@ -342,6 +404,7 @@ const isFtSearchPrior = (o) => {
|
|
|
342
404
|
exports.isFtSearchPrior = isFtSearchPrior;
|
|
343
405
|
const isFtSearchRequest = (o) => {
|
|
344
406
|
return isObject(o)
|
|
407
|
+
&& (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
|
|
345
408
|
&& (isString(o.query))
|
|
346
409
|
&& ((0, exports.isFtPageRequest)(o.paging))
|
|
347
410
|
&& ((Array.isArray(o.filters)
|
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:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];g.redirect=function(e,t){if(-1===b.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function A(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new g(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}A.polyfill=!0,e.fetch||(e.fetch=A,e.Headers=l,e.Request=f,e.Response=g),t.Headers=l,t.Request=f,t.Response=g,t.fetch=A,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e,a=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>a(e)))&&(null==e.topicLink||o(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),o=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),l=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),u=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>u(e)))&&s(e.contentId)&&s(e.title);var c;e.FtTopicContentTarget=void 0,(c=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",c.OFF_THE_GRID="OFF_THE_GRID",c.CONTENT_PACKAGER="CONTENT_PACKAGER",c.PAGES="PAGES",c.DESIGNED_READER="DESIGNED_READER";const d=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),p=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key);var h;e.FtRatingType=void 0,(h=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",h.LIKE="LIKE",h.DICHOTOMOUS="DICHOTOMOUS",h.NO_RATING="NO_RATING";const y=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),f=e=>r(e)&&s(e.date)&&y(e.type)&&n(e.value),m=e=>r(e)&&(null==e.rating||f(e.rating))&&y(e.type),g=e=>r(e)&&s(e.date)&&s(e.tocId)&&y(e.type)&&n(e.value),b=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>g(e)))&&y(e.type),A=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),E=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key),T=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var R;e.FtEditorialType=void 0,(R=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",R.BOOK="BOOK";const S=e=>["ARTICLE","BOOK"].includes(e);var I;e.FtOpenMode=void 0,(I=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",I.EXTERNAL="EXTERNAL";const U=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),v=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var O;e.FtCollectionDocumentType=void 0,(O=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",O.DOCUMENT="DOCUMENT",O.TOPIC="TOPIC",O.PERSONAL_BOOK="PERSONAL_BOOK",O.SHARED_BOOK="SHARED_BOOK";const _=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),F=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),C=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>P(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),P=e=>r(e)&&(null==e.document||D(e.document))&&(null==e.topic||w(e.topic))&&N(e.type)&&(null==e.map||k(e.map)),D=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&U(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),k=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&(null==e.openMode||U(e.openMode))&&S(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),w=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&U(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>j(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var L;e.FtSearchResultType=void 0,(L=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",L.DOCUMENT="DOCUMENT",L.TOPIC="TOPIC";const N=e=>["MAP","DOCUMENT","TOPIC"].includes(e),B=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>x(e))),M=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),x=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>x(e)))&&s(e.label)&&s(e.value)&&i(e.selected),H=e=>r(e)&&s(e.key),$=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),j=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),K=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||S(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&N(e.type)&&s(e.value);var G;e.FtUserRole=void 0,(G=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",G.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",G.HTML_EXPORT_USER="HTML_EXPORT_USER",G.PDF_EXPORT_USER="PDF_EXPORT_USER",G.SAVED_SEARCH_USER="SAVED_SEARCH_USER",G.COLLECTION_USER="COLLECTION_USER",G.OFFLINE_USER="OFFLINE_USER",G.ANALYTICS_USER="ANALYTICS_USER",G.BETA_USER="BETA_USER",G.DEBUG_USER="DEBUG_USER",G.PRINT_USER="PRINT_USER",G.RATING_USER="RATING_USER",G.FEEDBACK_USER="FEEDBACK_USER",G.CONTENT_PUBLISHER="CONTENT_PUBLISHER",G.KHUB_ADMIN="KHUB_ADMIN",G.USERS_ADMIN="USERS_ADMIN",G.PORTAL_ADMIN="PORTAL_ADMIN",G.ADMIN="ADMIN",G.DEVELOPER="DEVELOPER";const V=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),q=e=>r(e)&&s(e.identifier)&&s(e.realm),X=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>V(e)))&&(null==e.userId||s(e.userId)),z=e=>"object"==typeof e&&null!=e,J=e=>"boolean"==typeof e,Y=e=>"number"==typeof e,Q=e=>"string"==typeof e,W=e=>z(e)&&J(e.mailsSentByFluidTopics)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Q(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Q(e))),Z=e=>z(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>J(e))))&&J(e.isVisible),ee=e=>z(e)&&(null==e.prettyUrl||Q(e.prettyUrl))&&(null==e.hasRating||J(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Q(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ee(e)))&&(null==e.pageConfiguration||Z(e.pageConfiguration))&&(null==e.contentId||Q(e.contentId))&&(null==e.title||Q(e.title)),te=e=>z(e)&&J(e.splitCurrentPageToc),re="undefined"==typeof window?globalThis:window;function ie(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function ne(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const se="undefined"==typeof window?globalThis:window;class ae extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function oe(e){if(!e.ok)throw new ae(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"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??se.__gwt_ft_moduleBase??se.fluidtopicsclient?.__moduleBase??se.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==se.location&&se.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new ae(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(oe).then(le)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(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=ae,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(re.localStorage){const r=ne(e),i=e=>{e.storageArea===re.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return re.addEventListener("storage",i),{removeHandler:()=>re.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=ue,e.getUnauthenticatedUserSearchPreferences=function(e){if(re.localStorage)return JSON.parse(re.localStorage.getItem(ne(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&q(e.authenticationIdentifier)&&X(e.profile),e.isFtAuthenticationIdentifier=q,e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&_(e.type),e.isFtCollectionDocumentType=_,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=S,e.isFtFeedbackCreation=e=>r(e)&&s(e.message),e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&U(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&S(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&l(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>z(e)&&Q(e.file)&&(null==e.size||Y(e.size))&&J(e.externalLink)&&Q(e.name)&&Q(e.id)&&(null==e.mimeType||Q(e.mimeType))&&(null==e.viewerUrl||Q(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=l,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=p,e.isFtMetadataPreferenceConfiguration=A,e.isFtOpenMode=U,e.isFtPageConfiguration=Z,e.isFtPageRequest=v,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.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.nodes)&&e.nodes.every((e=>a(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookNodeCreation=a,e.isFtPersonalBookTopicLinkCreation=o,e.isFtPublicationRating=f,e.isFtPublicationRatingSummary=m,e.isFtRatingCreation=e=>r(e)&&y(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||b(e.topics))&&m(e.publication),e.isFtRatingType=y,e.isFtReaderConfiguration=e=>z(e)&&W(e.feedback)&&Y(e.loadAfterLastVisibleTopic)&&Y(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=W,e.isFtSearchFacet=B,e.isFtSearchFacetConf=M,e.isFtSearchFacetEntry=x,e.isFtSearchFilter=E,e.isFtSearchLocale=d,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>d(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>A(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>E(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=F,e.isFtSearchRequest=e=>r(e)&&s(e.query)&&v(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>E(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>H(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>F(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>M(e))),e.isFtSearchResultCluster=C,e.isFtSearchResultClusterEntry=P,e.isFtSearchResultMap=k,e.isFtSearchResultTopic=w,e.isFtSearchResultType=N,e.isFtSearchResultUnstructuredDocument=D,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||$(e.spellcheck))&&T(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>C(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>B(e))),e.isFtSearchResultsPageInfo=T,e.isFtSearchSortCriterion=H,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||q(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&X(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=$,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>E(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>H(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=K,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>K(e))),e.isFtTocNode=u,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=g,e.isFtTopicResource=j,e.isFtTopicsRatingSummary=b,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>p(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=X,e.isFtUserRole=V,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(re.localStorage){let r={...t,metadata:ie(t.metadata??{})};const i=ne(e),n=JSON.stringify(r);return re.localStorage.setItem(i,n),re.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:re.localStorage,url:re.location.href})),r}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:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function a(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=a(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function f(e,t){var r,i,n=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var b=[301,302,303,307,308];g.redirect=function(e,t){if(-1===b.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function A(e,i){return new Promise((function(n,s){var a=new f(e,i);if(a.signal&&a.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new g(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}A.polyfill=!0,e.fetch||(e.fetch=A,e.Headers=l,e.Request=f,e.Response=g),t.Headers=l,t.Request=f,t.Response=g,t.fetch=A,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e),l=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>l(e)))&&(null==e.topicLink||u(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),u=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),c=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),d=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&s(e.contentId)&&s(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)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),y=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key),f=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&Array.isArray(e.filters)&&e.filters.every((e=>_(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>X(e)))&&(null==e.contentLocale||s(e.contentLocale));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),b=e=>r(e)&&s(e.date)&&g(e.type)&&n(e.value),A=e=>r(e)&&(null==e.rating||b(e.rating))&&g(e.type),E=e=>r(e)&&s(e.date)&&s(e.tocId)&&g(e.type)&&n(e.value),T=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>E(e)))&&g(e.type),R=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),S=e=>r(e)&&s(e.from)&&s(e.to),F=e=>r(e)&&(null==e.period||S(e.period))&&U(e.periodType);var I;e.FtPeriodFilterType=void 0,(I=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",I.LAST_MONTH="LAST_MONTH",I.LAST_YEAR="LAST_YEAR",I.CUSTOM="CUSTOM";const U=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),_=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key),v=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var O;e.FtEditorialType=void 0,(O=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",O.BOOK="BOOK";const C=e=>["ARTICLE","BOOK"].includes(e);var P;e.FtOpenMode=void 0,(P=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",P.EXTERNAL="EXTERNAL";const D=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),k=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var L;e.FtCollectionDocumentType=void 0,(L=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",L.DOCUMENT="DOCUMENT",L.TOPIC="TOPIC",L.PERSONAL_BOOK="PERSONAL_BOOK",L.SHARED_BOOK="SHARED_BOOK";const w=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),N=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),M=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>B(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),B=e=>r(e)&&(null==e.document||x(e.document))&&(null==e.topic||$(e.topic))&&K(e.type)&&(null==e.map||H(e.map)),x=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&D(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),H=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&(null==e.openMode||D(e.openMode))&&C(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),$=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&D(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>Y(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var j;e.FtSearchResultType=void 0,(j=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",j.DOCUMENT="DOCUMENT",j.TOPIC="TOPIC";const K=e=>["MAP","DOCUMENT","TOPIC"].includes(e),G=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>q(e))),V=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),q=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>q(e)))&&s(e.label)&&s(e.value)&&i(e.selected),X=e=>r(e)&&s(e.key),z=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),Y=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),J=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||C(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&K(e.type)&&s(e.value);var W;e.FtUserRole=void 0,(W=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",W.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",W.HTML_EXPORT_USER="HTML_EXPORT_USER",W.PDF_EXPORT_USER="PDF_EXPORT_USER",W.SAVED_SEARCH_USER="SAVED_SEARCH_USER",W.COLLECTION_USER="COLLECTION_USER",W.OFFLINE_USER="OFFLINE_USER",W.ANALYTICS_USER="ANALYTICS_USER",W.BETA_USER="BETA_USER",W.DEBUG_USER="DEBUG_USER",W.PRINT_USER="PRINT_USER",W.RATING_USER="RATING_USER",W.FEEDBACK_USER="FEEDBACK_USER",W.CONTENT_PUBLISHER="CONTENT_PUBLISHER",W.KHUB_ADMIN="KHUB_ADMIN",W.USERS_ADMIN="USERS_ADMIN",W.PORTAL_ADMIN="PORTAL_ADMIN",W.ADMIN="ADMIN",W.DEVELOPER="DEVELOPER";const Q=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),Z=e=>r(e)&&s(e.identifier)&&s(e.realm),ee=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Q(e)))&&(null==e.userId||s(e.userId)),te=e=>"object"==typeof e&&null!=e,re=e=>"boolean"==typeof e,ie=e=>"number"==typeof e,ne=e=>"string"==typeof e,se=e=>te(e)&&re(e.mailsSentByFluidTopics)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ne(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ne(e))),ae=e=>te(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>re(e))))&&re(e.isVisible),oe=e=>te(e)&&(null==e.prettyUrl||ne(e.prettyUrl))&&(null==e.hasRating||re(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ne(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>oe(e)))&&(null==e.pageConfiguration||ae(e.pageConfiguration))&&(null==e.contentId||ne(e.contentId))&&(null==e.title||ne(e.title)),le=e=>te(e)&&re(e.splitCurrentPageToc),ue="undefined"==typeof window?globalThis:window;function ce(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function de(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const pe="undefined"==typeof window?globalThis:window;class he extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ye(e){if(!e.ok)throw new he(e.status,e.statusText,await e.text());return e}function fe(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class me{tenantBaseUrl;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`}})},stylesheets:{fonts:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??pe.__gwt_ft_moduleBase??pe.fluidtopicsclient?.__moduleBase??pe.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==pe.location&&pe.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e){return this.get(this.endpoints.khub.maps.mapId(e).info)}getTableOfContent(e){return this.get(this.endpoints.khub.maps.mapId(e).toc)}getPages(e){return this.get(this.endpoints.khub.maps.mapId(e).pages)}getTopic(e,t){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info)}getTopicHTMLContent(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""))}getMapAttachments(e){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list)}getMapAttachmentContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content)}getMapResources(e){return this.get(this.endpoints.khub.maps.mapId(e).resources.list)}getMapResourceContent(e,t){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content)}getUnstructuredDocument(e){return this.get(this.endpoints.khub.documents.documentId(e).info)}getUnstructuredDocumentContent(e){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content)}getUnstructuredDocumentTextContent(e){return this.get(this.endpoints.khub.documents.documentId(e).text)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.khub.locales)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new he(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(ye).then(fe)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then(ye).then(fe)}fetchRawData(e){return fetch(this.makeAbsolute(e),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ye).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=me,e.HttpError=he,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(ue.localStorage){const r=de(e),i=e=>{e.storageArea===ue.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return ue.addEventListener("storage",i),{removeHandler:()=>ue.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=me,e.getUnauthenticatedUserSearchPreferences=function(e){if(ue.localStorage)return JSON.parse(ue.localStorage.getItem(de(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&Z(e.authenticationIdentifier)&&ee(e.profile),e.isFtAuthenticationIdentifier=Z,e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&w(e.type),e.isFtCollectionDocumentType=w,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=C,e.isFtFeedbackCreation=e=>r(e)&&s(e.message),e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&D(e.openMode)&&s(e.topicsApiEndpoint)&&(null==e.description||s(e.description))&&s(e.attachmentsApiEndpoint)&&C(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&s(e.rightsApiEndpoint)&&c(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>te(e)&&ne(e.file)&&(null==e.size||ie(e.size))&&re(e.externalLink)&&ne(e.name)&&ne(e.id)&&(null==e.mimeType||ne(e.mimeType))&&(null==e.viewerUrl||ne(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=c,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=y,e.isFtMetadataPreferenceConfiguration=R,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&f(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=f,e.isFtOpenMode=D,e.isFtPageConfiguration=ae,e.isFtPageRequest=k,e.isFtPaginatedToc=e=>te(e)&&le(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>oe(e))),e.isFtPaginatedTocNode=oe,e.isFtPaginationConfiguration=le,e.isFtPeriod=S,e.isFtPeriodFilter=F,e.isFtPeriodFilterType=U,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.nodes)&&e.nodes.every((e=>l(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookNodeCreation=l,e.isFtPersonalBookTopicLinkCreation=u,e.isFtPublicationRating=b,e.isFtPublicationRatingSummary=A,e.isFtRatingCreation=e=>r(e)&&g(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||T(e.topics))&&A(e.publication),e.isFtRatingType=g,e.isFtReaderConfiguration=e=>te(e)&&se(e.feedback)&&ie(e.loadAfterLastVisibleTopic)&&ie(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=se,e.isFtSearchFacet=G,e.isFtSearchFacetConf=V,e.isFtSearchFacetEntry=q,e.isFtSearchFilter=_,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=>s(e)))&&Object.values(e.metadata).every((e=>R(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>_(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=N,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||F(e.periodFilter))&&s(e.query)&&k(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>_(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>X(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>N(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>V(e))),e.isFtSearchResultCluster=M,e.isFtSearchResultClusterEntry=B,e.isFtSearchResultMap=H,e.isFtSearchResultTopic=$,e.isFtSearchResultType=K,e.isFtSearchResultUnstructuredDocument=x,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||z(e.spellcheck))&&v(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>M(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>G(e))),e.isFtSearchResultsPageInfo=v,e.isFtSearchSortCriterion=X,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||Z(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&ee(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=z,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>_(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>X(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=J,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>J(e))),e.isFtTocNode=d,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicRating=E,e.isFtTopicResource=Y,e.isFtTopicsRatingSummary=T,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ee,e.isFtUserRole=Q,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(ue.localStorage){let r={...t,metadata:ce(t.metadata??{})};const i=de(e),n=JSON.stringify(r);return ue.localStorage.setItem(i,n),ue.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:ue.localStorage,url:ue.location.href})),r}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 { FtAuthenticatedSession, FtCollectionDocument, FtMap, FtMapResource, FtMessageContext, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public";
|
|
2
|
+
import { FtAuthenticatedSession, FtCollectionDocument, FtMap, FtMapResource, FtMessageContext, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument, FtMySearch } from "./types/ft-common/public";
|
|
3
3
|
import { FtMapAttachment, FtPaginatedToc, FtReaderConfiguration } from "./types/ft-server/public";
|
|
4
4
|
export * from "./types/ft-common/public";
|
|
5
5
|
export * from "./types/ft-server/public";
|
|
@@ -73,6 +73,9 @@ export declare class FluidTopicsApi {
|
|
|
73
73
|
documents: string;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
+
searches: {
|
|
77
|
+
list: string;
|
|
78
|
+
};
|
|
76
79
|
};
|
|
77
80
|
};
|
|
78
81
|
stylesheets: {
|
|
@@ -145,6 +148,7 @@ export declare class FluidTopicsApi {
|
|
|
145
148
|
sendDocumentFeedback(docId: string, message: string): Promise<void>;
|
|
146
149
|
getFluidTopicsMessageContext(locale: string, name: string): Promise<FtMessageContext>;
|
|
147
150
|
getCustomMessageContext(locale: string, name: string): Promise<FtMessageContext>;
|
|
151
|
+
listMySearches(userId: string): Promise<FtMySearch[]>;
|
|
148
152
|
get<T>(endpoint: string): Promise<T>;
|
|
149
153
|
post<T>(endpoint: string, data?: any): Promise<T>;
|
|
150
154
|
put<T>(endpoint: string, data?: any): Promise<T>;
|
package/dist/mjs/index.js
CHANGED
|
@@ -88,8 +88,11 @@ export class FluidTopicsApi {
|
|
|
88
88
|
collectionId: (collectionId) => ({
|
|
89
89
|
documents: `api/users/${userId}/collections/${collectionId}/documents`,
|
|
90
90
|
})
|
|
91
|
+
},
|
|
92
|
+
searches: {
|
|
93
|
+
list: `api/users/${userId}/searches`
|
|
91
94
|
}
|
|
92
|
-
})
|
|
95
|
+
}),
|
|
93
96
|
},
|
|
94
97
|
stylesheets: {
|
|
95
98
|
fonts: `api/stylesheets/fonts.css`,
|
|
@@ -267,6 +270,9 @@ export class FluidTopicsApi {
|
|
|
267
270
|
getCustomMessageContext(locale, name) {
|
|
268
271
|
return this.get(this.endpoints.messages.locale(locale).custom.contextName(name).endpoint);
|
|
269
272
|
}
|
|
273
|
+
listMySearches(userId) {
|
|
274
|
+
return this.get(this.endpoints.users.userId(userId).searches.list);
|
|
275
|
+
}
|
|
270
276
|
get(endpoint) {
|
|
271
277
|
return this.makeRequest("GET", endpoint);
|
|
272
278
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
export declare enum FtMyLibraryColors {
|
|
2
|
+
black = "black",
|
|
3
|
+
green = "green",
|
|
4
|
+
blue = "blue",
|
|
5
|
+
purple = "purple",
|
|
6
|
+
red = "red",
|
|
7
|
+
orange = "orange",
|
|
8
|
+
yellow = "yellow"
|
|
9
|
+
}
|
|
10
|
+
export type FtMyLibraryColorsKeys = keyof typeof FtMyLibraryColors;
|
|
11
|
+
export declare const isFtMyLibraryColors: (o: any) => o is FtMyLibraryColors;
|
|
1
12
|
export interface FtCredentials {
|
|
2
13
|
password: string;
|
|
3
14
|
newPassword?: string;
|
|
@@ -144,6 +155,25 @@ export interface FtMetadata {
|
|
|
144
155
|
key: string;
|
|
145
156
|
}
|
|
146
157
|
export declare const isFtMetadata: (o: any) => o is FtMetadata;
|
|
158
|
+
export interface FtMySearch {
|
|
159
|
+
searchRequest: FtMySearchRequest;
|
|
160
|
+
color: FtMyLibraryColorsKeys | FtMyLibraryColors;
|
|
161
|
+
alert: boolean;
|
|
162
|
+
description: string;
|
|
163
|
+
id: string;
|
|
164
|
+
ownerId: string;
|
|
165
|
+
title: string;
|
|
166
|
+
creationDate: Date | string;
|
|
167
|
+
}
|
|
168
|
+
export declare const isFtMySearch: (o: any) => o is FtMySearch;
|
|
169
|
+
export interface FtMySearchRequest {
|
|
170
|
+
periodFilter?: FtPeriodFilter;
|
|
171
|
+
query: string;
|
|
172
|
+
filters: Array<FtSearchFilter>;
|
|
173
|
+
sort: Array<FtSearchSortCriterion>;
|
|
174
|
+
contentLocale?: string;
|
|
175
|
+
}
|
|
176
|
+
export declare const isFtMySearchRequest: (o: any) => o is FtMySearchRequest;
|
|
147
177
|
export declare enum FtRatingType {
|
|
148
178
|
STARS = "STARS",
|
|
149
179
|
LIKE = "LIKE",
|
|
@@ -201,6 +231,24 @@ export interface FtSearchPreferencesConfiguration {
|
|
|
201
231
|
metadata: Record<string, FtMetadataPreferenceConfiguration>;
|
|
202
232
|
}
|
|
203
233
|
export declare const isFtSearchPreferencesConfiguration: (o: any) => o is FtSearchPreferencesConfiguration;
|
|
234
|
+
export interface FtPeriod {
|
|
235
|
+
from: string;
|
|
236
|
+
to: string;
|
|
237
|
+
}
|
|
238
|
+
export declare const isFtPeriod: (o: any) => o is FtPeriod;
|
|
239
|
+
export interface FtPeriodFilter {
|
|
240
|
+
period?: FtPeriod;
|
|
241
|
+
periodType: FtPeriodFilterTypeKeys | FtPeriodFilterType;
|
|
242
|
+
}
|
|
243
|
+
export declare const isFtPeriodFilter: (o: any) => o is FtPeriodFilter;
|
|
244
|
+
export declare enum FtPeriodFilterType {
|
|
245
|
+
LAST_WEEK = "LAST_WEEK",
|
|
246
|
+
LAST_MONTH = "LAST_MONTH",
|
|
247
|
+
LAST_YEAR = "LAST_YEAR",
|
|
248
|
+
CUSTOM = "CUSTOM"
|
|
249
|
+
}
|
|
250
|
+
export type FtPeriodFilterTypeKeys = keyof typeof FtPeriodFilterType;
|
|
251
|
+
export declare const isFtPeriodFilterType: (o: any) => o is FtPeriodFilterType;
|
|
204
252
|
export interface FtSearchFilter {
|
|
205
253
|
negative: boolean;
|
|
206
254
|
values: Array<string>;
|
|
@@ -261,6 +309,7 @@ export interface FtSearchPrior {
|
|
|
261
309
|
}
|
|
262
310
|
export declare const isFtSearchPrior: (o: any) => o is FtSearchPrior;
|
|
263
311
|
export interface FtSearchRequest {
|
|
312
|
+
periodFilter?: FtPeriodFilter;
|
|
264
313
|
query: string;
|
|
265
314
|
paging: FtPageRequest;
|
|
266
315
|
filters: Array<FtSearchFilter>;
|
|
@@ -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
|
+
// From: MyLibraryColors
|
|
6
|
+
export var FtMyLibraryColors;
|
|
7
|
+
(function (FtMyLibraryColors) {
|
|
8
|
+
FtMyLibraryColors["black"] = "black";
|
|
9
|
+
FtMyLibraryColors["green"] = "green";
|
|
10
|
+
FtMyLibraryColors["blue"] = "blue";
|
|
11
|
+
FtMyLibraryColors["purple"] = "purple";
|
|
12
|
+
FtMyLibraryColors["red"] = "red";
|
|
13
|
+
FtMyLibraryColors["orange"] = "orange";
|
|
14
|
+
FtMyLibraryColors["yellow"] = "yellow";
|
|
15
|
+
})(FtMyLibraryColors || (FtMyLibraryColors = {}));
|
|
16
|
+
export const isFtMyLibraryColors = (o) => {
|
|
17
|
+
return ["black", "green", "blue", "purple", "red", "orange", "yellow"].includes(o);
|
|
18
|
+
};
|
|
5
19
|
export const isFtCredentials = (o) => {
|
|
6
20
|
return isObject(o)
|
|
7
21
|
&& (isString(o.password))
|
|
@@ -163,6 +177,27 @@ export const isFtMetadata = (o) => {
|
|
|
163
177
|
&& (isString(o.label))
|
|
164
178
|
&& (isString(o.key));
|
|
165
179
|
};
|
|
180
|
+
export const isFtMySearch = (o) => {
|
|
181
|
+
return isObject(o)
|
|
182
|
+
&& (isFtMySearchRequest(o.searchRequest))
|
|
183
|
+
&& (isFtMyLibraryColors(o.color))
|
|
184
|
+
&& (isBoolean(o.alert))
|
|
185
|
+
&& (isString(o.description))
|
|
186
|
+
&& (isString(o.id))
|
|
187
|
+
&& (isString(o.ownerId))
|
|
188
|
+
&& (isString(o.title))
|
|
189
|
+
&& (isString(o.creationDate));
|
|
190
|
+
};
|
|
191
|
+
export const isFtMySearchRequest = (o) => {
|
|
192
|
+
return isObject(o)
|
|
193
|
+
&& (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
|
|
194
|
+
&& (isString(o.query))
|
|
195
|
+
&& ((Array.isArray(o.filters)
|
|
196
|
+
&& o.filters.every((v) => isFtSearchFilter(v))))
|
|
197
|
+
&& ((Array.isArray(o.sort)
|
|
198
|
+
&& o.sort.every((v) => isFtSearchSortCriterion(v))))
|
|
199
|
+
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
200
|
+
};
|
|
166
201
|
// From: RatingType
|
|
167
202
|
export var FtRatingType;
|
|
168
203
|
(function (FtRatingType) {
|
|
@@ -228,6 +263,27 @@ export const isFtSearchPreferencesConfiguration = (o) => {
|
|
|
228
263
|
&& Object.keys(o.metadata).every((k) => isString(k))
|
|
229
264
|
&& Object.values(o.metadata).every((v) => isFtMetadataPreferenceConfiguration(v))));
|
|
230
265
|
};
|
|
266
|
+
export const isFtPeriod = (o) => {
|
|
267
|
+
return isObject(o)
|
|
268
|
+
&& (isString(o.from))
|
|
269
|
+
&& (isString(o.to));
|
|
270
|
+
};
|
|
271
|
+
export const isFtPeriodFilter = (o) => {
|
|
272
|
+
return isObject(o)
|
|
273
|
+
&& (o.period == null || isFtPeriod(o.period))
|
|
274
|
+
&& (isFtPeriodFilterType(o.periodType));
|
|
275
|
+
};
|
|
276
|
+
// From: PeriodFilterType
|
|
277
|
+
export var FtPeriodFilterType;
|
|
278
|
+
(function (FtPeriodFilterType) {
|
|
279
|
+
FtPeriodFilterType["LAST_WEEK"] = "LAST_WEEK";
|
|
280
|
+
FtPeriodFilterType["LAST_MONTH"] = "LAST_MONTH";
|
|
281
|
+
FtPeriodFilterType["LAST_YEAR"] = "LAST_YEAR";
|
|
282
|
+
FtPeriodFilterType["CUSTOM"] = "CUSTOM";
|
|
283
|
+
})(FtPeriodFilterType || (FtPeriodFilterType = {}));
|
|
284
|
+
export const isFtPeriodFilterType = (o) => {
|
|
285
|
+
return ["LAST_WEEK", "LAST_MONTH", "LAST_YEAR", "CUSTOM"].includes(o);
|
|
286
|
+
};
|
|
231
287
|
export const isFtSearchFilter = (o) => {
|
|
232
288
|
return isObject(o)
|
|
233
289
|
&& (isBoolean(o.negative))
|
|
@@ -302,6 +358,7 @@ export const isFtSearchPrior = (o) => {
|
|
|
302
358
|
};
|
|
303
359
|
export const isFtSearchRequest = (o) => {
|
|
304
360
|
return isObject(o)
|
|
361
|
+
&& (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
|
|
305
362
|
&& (isString(o.query))
|
|
306
363
|
&& (isFtPageRequest(o.paging))
|
|
307
364
|
&& ((Array.isArray(o.filters)
|