@fluid-topics/ft-reader-topic-content 1.1.25 → 1.1.26
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.
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
`,$=i.css`
|
|
78
78
|
`,M=e.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class U{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=M.getState(),s=null!=t?t:i;if(e&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,s,!0)}static get(t){var e;return null!=t?U.build(t):null!==(e=U.API)&&void 0!==e?e:U.API=U.build()}static await(t){return new Promise((e=>{let i=U.get(t);if(i)e(i);else{const s=M.subscribe((()=>{i=U.get(t),i&&(s(),e(i))}))}}))}}var N;const T=Symbol("clearAfterUnitTest");class A{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[N]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=M.getState().uiLocale,M.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=M.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,i){var s;if(t=t.toLowerCase(),Object.keys(i).length>0){const o={...null!==(s=this.defaultMessages[t])&&void 0!==s?s:{},...i};e.deepEqual(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,i,...s){var o,n,a;t=t.toLowerCase(),this.fetchContext(t);const r=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},r).resolve(i,...s)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var i;return t=t.toLowerCase(),this.listeners[t]=null!==(i=this.listeners[t])&&void 0!==i?i:new Set,this.listeners[t].add(e),()=>{var i;return null===(i=this.listeners[t])||void 0===i?void 0:i.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>e.delay(0).then((()=>t())).catch((()=>null)))))}}N=T,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new A((async(t,e)=>(await U.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new A((async(t,e)=>(await U.await()).getCustomMessageContext(t,e))));const L=window.FluidTopicsI18nService,B=window.FluidTopicsCustomI18nService;var z=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class P extends e.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>U.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return i.html`
|
|
79
79
|
<slot></slot>
|
|
80
|
-
`}update(t){super.update(t),t.has("baseUrl")&&M.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&M.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&M.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&M.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&M.actions.noCustom(this.noCustom),t.has("editorMode")&&M.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&M.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&M.actions.session(this.session),t.has("availableUiLocales")&&M.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}P.elementDefinitions={},P.styles=$,z([s.property()],P.prototype,"baseUrl",void 0),z([s.property()],P.prototype,"apiIntegrationIdentifier",void 0),z([s.property()],P.prototype,"uiLocale",void 0),z([e.jsonProperty(null)],P.prototype,"availableUiLocales",void 0),z([e.jsonProperty(null)],P.prototype,"metadataConfiguration",void 0),z([s.property({type:Boolean})],P.prototype,"editorMode",void 0),z([s.property({type:Boolean})],P.prototype,"noCustom",void 0),z([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],P.prototype,"noCustomComponent",void 0),z([s.property({type:Boolean})],P.prototype,"withManualResources",void 0),z([e.jsonProperty([])],P.prototype,"messageContexts",void 0),z([e.jsonProperty(void 0)],P.prototype,"session",void 0),z([s.property({type:Object})],P.prototype,"apiProvider",void 0);class R{async listMySearches(){var t;return(null===(t=M.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await U.await()).listMySearches(M.getState().session.profile.userId):[]}}const _=new e.CacheRegistry;class E{async listMyBookmarks(){return _.get("bookmarks",(async()=>(await U.await()).listMyBookmarks(M.getState().session.profile.userId)))}clearCache(){_.clear("bookmarks")}}const K=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=M.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new E,M.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=M.getState();e.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==i?void 0:i.profile)||(this.currentSession=i,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){K.actions.savedSearches(void 0)}clearMyBookmarks(){K.actions.bookmarks(void 0)}async reloadMySearches(){const t=new R,e=await t.listMySearches();K.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;K.actions.bookmarks(e)}}},e.customElement("ft-app-context")(P);var G=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const W=Symbol("i18nProperties"),D=Symbol("i18nUnsubs");function q(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?B:L}i18n(t,e,...i){var s;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const o=null!==(s=t.args)&&void 0!==s?s:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...o)}onI18nUpdate(t){var e;null===(e=this[W])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[W])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[W]&&new Set([...this[W].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[D].has(t)||this[D].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[D].forEach((t=>t())),this[D].clear()}}return e=D,G([s.property({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class F extends(q(e.FtLitElement)){}class Q extends(q(e.FtLitElementRedux)){}var Z=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class H extends Q{constructor(){super(),this.editorMode=!1,this.addStore(M)}render(){return this.key&&this.context?i.html`
|
|
80
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(M.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&M.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&M.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&M.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&M.actions.noCustom(this.noCustom),t.has("editorMode")&&M.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&M.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&M.actions.session(this.session),t.has("availableUiLocales")&&M.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>L.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}P.elementDefinitions={},P.styles=$,z([s.property()],P.prototype,"baseUrl",void 0),z([s.property()],P.prototype,"apiIntegrationIdentifier",void 0),z([s.property()],P.prototype,"uiLocale",void 0),z([e.jsonProperty(null)],P.prototype,"availableUiLocales",void 0),z([e.jsonProperty(null)],P.prototype,"metadataConfiguration",void 0),z([s.property({type:Boolean})],P.prototype,"editorMode",void 0),z([s.property({type:Boolean})],P.prototype,"noCustom",void 0),z([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],P.prototype,"noCustomComponent",void 0),z([s.property({type:Boolean})],P.prototype,"withManualResources",void 0),z([e.jsonProperty([])],P.prototype,"messageContexts",void 0),z([e.jsonProperty(void 0)],P.prototype,"session",void 0),z([s.property({type:Object})],P.prototype,"apiProvider",void 0);class R{async listMySearches(){var t;return(null===(t=M.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await U.await()).listMySearches(M.getState().session.profile.userId):[]}}const _=new e.CacheRegistry;class E{async listMyBookmarks(){return _.get("bookmarks",(async()=>(await U.await()).listMyBookmarks(M.getState().session.profile.userId)))}clearCache(){_.clear("bookmarks")}}const K=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=M.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new E,M.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=M.getState();e.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==i?void 0:i.profile)||(this.currentSession=i,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){K.actions.savedSearches(void 0)}clearMyBookmarks(){K.actions.bookmarks(void 0)}async reloadMySearches(){const t=new R,e=await t.listMySearches();K.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;K.actions.bookmarks(e)}}},e.customElement("ft-app-context")(P);var G=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const W=Symbol("i18nProperties"),D=Symbol("i18nUnsubs");function q(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?B:L}i18n(t,e,...i){var s;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const o=null!==(s=t.args)&&void 0!==s?s:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...o)}onI18nUpdate(t){var e;null===(e=this[W])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[W])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[W]&&new Set([...this[W].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[D].has(t)||this[D].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[D].forEach((t=>t())),this[D].clear()}}return e=D,G([s.property({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class F extends(q(e.FtLitElement)){}class Q extends(q(e.FtLitElementRedux)){}var Z=function(t,e,i,s){for(var o,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(n<3?o(a):n>3?o(e,i,a):o(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class H extends Q{constructor(){super(),this.editorMode=!1,this.addStore(M)}render(){return this.key&&this.context?i.html`
|
|
81
81
|
<span class="ft-i18n">
|
|
82
82
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
83
83
|
</span>
|
|
@@ -201,7 +201,7 @@ let ve=class extends Zt{constructor(){super(...arguments),this.renderOptions={ho
|
|
|
201
201
|
`,yi=wt`
|
|
202
202
|
`,gi=Br.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class bi{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=gi.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?bi.build(t):null!==(e=bi.API)&&void 0!==e?e:bi.API=bi.build()}static await(t){return new Promise((e=>{let o=bi.get(t);if(o)e(o);else{const r=gi.subscribe((()=>{o=bi.get(t),o&&(r(),e(o))}))}}))}}var mi;const vi=Symbol("clearAfterUnitTest");class Oi{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[mi]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=gi.getState().uiLocale,gi.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=gi.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};K(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new Fe(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>W(0).then((()=>t())).catch((()=>null)))))}}mi=vi,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Oi((async(t,e)=>(await bi.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Oi((async(t,e)=>(await bi.await()).getCustomMessageContext(t,e))));const xi=window.FluidTopicsI18nService,wi=window.FluidTopicsCustomI18nService;var Ni=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Si extends Ke{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>bi.get(),this.cache=new r,this.cleanSessionDebouncer=new i}render(){return ie`
|
|
203
203
|
<slot></slot>
|
|
204
|
-
`}update(t){super.update(t),t.has("baseUrl")&&gi.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&gi.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&gi.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&gi.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&gi.actions.noCustom(this.noCustom),t.has("editorMode")&&gi.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&gi.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&gi.actions.session(this.session),t.has("availableUiLocales")&&gi.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>xi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Si.elementDefinitions={},Si.styles=yi,Ni([U()],Si.prototype,"baseUrl",void 0),Ni([U()],Si.prototype,"apiIntegrationIdentifier",void 0),Ni([U()],Si.prototype,"uiLocale",void 0),Ni([$(null)],Si.prototype,"availableUiLocales",void 0),Ni([$(null)],Si.prototype,"metadataConfiguration",void 0),Ni([U({type:Boolean})],Si.prototype,"editorMode",void 0),Ni([U({type:Boolean})],Si.prototype,"noCustom",void 0),Ni([U({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Si.prototype,"noCustomComponent",void 0),Ni([U({type:Boolean})],Si.prototype,"withManualResources",void 0),Ni([$([])],Si.prototype,"messageContexts",void 0),Ni([$(void 0)],Si.prototype,"session",void 0),Ni([U({type:Object})],Si.prototype,"apiProvider",void 0);class Ci{async listMySearches(){var t;return(null===(t=gi.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await bi.await()).listMySearches(gi.getState().session.profile.userId):[]}}const Ei=new r;class Ri{async listMyBookmarks(){return Ei.get("bookmarks",(async()=>(await bi.await()).listMyBookmarks(gi.getState().session.profile.userId)))}clearCache(){Ei.clear("bookmarks")}}const Ui=Br.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=gi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ri,gi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=gi.getState();K(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){Ui.actions.savedSearches(void 0)}clearMyBookmarks(){Ui.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Ci,e=await t.listMySearches();Ui.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Ui.actions.bookmarks(e)}}},j("ft-app-context")(Si);var Ii=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const ki=Symbol("i18nProperties"),Li=Symbol("i18nUnsubs");function Wi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?wi:xi}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e;null===(e=this[ki])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[ki])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[ki]&&new Set([...this[ki].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Li].has(t)||this[Li].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Li].forEach((t=>t())),this[Li].clear()}}return e=Li,Ii([U({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Ai extends(Wi(Ke)){}class Ki extends(Wi(Ye)){}var ji=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class $i extends Ki{constructor(){super(),this.editorMode=!1,this.addStore(gi)}render(){return this.key&&this.context?ie`
|
|
204
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(gi.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&gi.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&gi.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&gi.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&gi.actions.noCustom(this.noCustom),t.has("editorMode")&&gi.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&gi.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&gi.actions.session(this.session),t.has("availableUiLocales")&&gi.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>xi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Si.elementDefinitions={},Si.styles=yi,Ni([U()],Si.prototype,"baseUrl",void 0),Ni([U()],Si.prototype,"apiIntegrationIdentifier",void 0),Ni([U()],Si.prototype,"uiLocale",void 0),Ni([$(null)],Si.prototype,"availableUiLocales",void 0),Ni([$(null)],Si.prototype,"metadataConfiguration",void 0),Ni([U({type:Boolean})],Si.prototype,"editorMode",void 0),Ni([U({type:Boolean})],Si.prototype,"noCustom",void 0),Ni([U({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Si.prototype,"noCustomComponent",void 0),Ni([U({type:Boolean})],Si.prototype,"withManualResources",void 0),Ni([$([])],Si.prototype,"messageContexts",void 0),Ni([$(void 0)],Si.prototype,"session",void 0),Ni([U({type:Object})],Si.prototype,"apiProvider",void 0);class Ci{async listMySearches(){var t;return(null===(t=gi.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await bi.await()).listMySearches(gi.getState().session.profile.userId):[]}}const Ei=new r;class Ri{async listMyBookmarks(){return Ei.get("bookmarks",(async()=>(await bi.await()).listMyBookmarks(gi.getState().session.profile.userId)))}clearCache(){Ei.clear("bookmarks")}}const Ui=Br.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=gi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ri,gi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=gi.getState();K(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){Ui.actions.savedSearches(void 0)}clearMyBookmarks(){Ui.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Ci,e=await t.listMySearches();Ui.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Ui.actions.bookmarks(e)}}},j("ft-app-context")(Si);var Ii=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const ki=Symbol("i18nProperties"),Li=Symbol("i18nUnsubs");function Wi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?wi:xi}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e;null===(e=this[ki])||void 0===e||e.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}update(t){var e;super.update(t),null===(e=this[ki])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[ki]&&new Set([...this[ki].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Li].has(t)||this[Li].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Li].forEach((t=>t())),this[Li].clear()}}return e=Li,Ii([U({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Ai extends(Wi(Ke)){}class Ki extends(Wi(Ye)){}var ji=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class $i extends Ki{constructor(){super(),this.editorMode=!1,this.addStore(gi)}render(){return this.key&&this.context?ie`
|
|
205
205
|
<span class="ft-i18n">
|
|
206
206
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
207
207
|
</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-topic-content",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "Content of a topic in integrated reader.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-chip": "1.1.
|
|
23
|
-
"@fluid-topics/ft-i18n": "1.1.
|
|
24
|
-
"@fluid-topics/ft-reader-context": "1.1.
|
|
25
|
-
"@fluid-topics/ft-reader-topic-context": "1.1.
|
|
26
|
-
"@fluid-topics/ft-tooltip": "1.1.
|
|
27
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
28
|
-
"@fluid-topics/public-api": "1.0.
|
|
22
|
+
"@fluid-topics/ft-chip": "1.1.26",
|
|
23
|
+
"@fluid-topics/ft-i18n": "1.1.26",
|
|
24
|
+
"@fluid-topics/ft-reader-context": "1.1.26",
|
|
25
|
+
"@fluid-topics/ft-reader-topic-context": "1.1.26",
|
|
26
|
+
"@fluid-topics/ft-tooltip": "1.1.26",
|
|
27
|
+
"@fluid-topics/ft-wc-utils": "1.1.26",
|
|
28
|
+
"@fluid-topics/public-api": "1.0.56",
|
|
29
29
|
"lit": "3.1.0"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "6734976f5a7f6b986917a085be0c38ca3ae562a0"
|
|
32
32
|
}
|