@fluid-topics/ft-reader-feedback 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.
|
@@ -1305,7 +1305,7 @@ const we=Symbol.for(""),Oe=t=>{if(t?.r===we)return t?._$litStatic$},$e=t=>({_$li
|
|
|
1305
1305
|
`,Ni=o.css`
|
|
1306
1306
|
`,Ci=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 ki{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Ci.getState(),i=null!=t?t:o;if(e&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,i,!0)}static get(t){var e;return null!=t?ki.build(t):null!==(e=ki.API)&&void 0!==e?e:ki.API=ki.build()}static await(t){return new Promise((e=>{let o=ki.get(t);if(o)e(o);else{const i=Ci.subscribe((()=>{o=ki.get(t),o&&(i(),e(o))}))}}))}}var Ii;const Ei=Symbol("clearAfterUnitTest");class Ri{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={},this.currentUiLocale="",this[Ii]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=Ci.getState().uiLocale,Ci.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Ci.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,o){var i;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...o};e.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...i){var r,n,a;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},s).resolve(o,...i)}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=>e.delay(0).then((()=>t())).catch((()=>null)))))}}Ii=Ei,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Ri((async(t,e)=>(await ki.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Ri((async(t,e)=>(await ki.await()).getCustomMessageContext(t,e))));const Ui=window.FluidTopicsI18nService,Li=window.FluidTopicsCustomI18nService;var Ti=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Wi 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=()=>ki.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return o.html`
|
|
1307
1307
|
<slot></slot>
|
|
1308
|
-
`}update(t){super.update(t),t.has("baseUrl")&&Ci.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Ci.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ci.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Ci.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Ci.actions.noCustom(this.noCustom),t.has("editorMode")&&Ci.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Ci.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Ci.actions.session(this.session),t.has("availableUiLocales")&&Ci.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.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()))}}Wi.elementDefinitions={},Wi.styles=Ni,Ti([i.property()],Wi.prototype,"baseUrl",void 0),Ti([i.property()],Wi.prototype,"apiIntegrationIdentifier",void 0),Ti([i.property()],Wi.prototype,"uiLocale",void 0),Ti([e.jsonProperty(null)],Wi.prototype,"availableUiLocales",void 0),Ti([e.jsonProperty(null)],Wi.prototype,"metadataConfiguration",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"editorMode",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"noCustom",void 0),Ti([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Wi.prototype,"noCustomComponent",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"withManualResources",void 0),Ti([e.jsonProperty([])],Wi.prototype,"messageContexts",void 0),Ti([e.jsonProperty(void 0)],Wi.prototype,"session",void 0),Ti([i.property({type:Object})],Wi.prototype,"apiProvider",void 0);class _i{async listMySearches(){var t;return(null===(t=Ci.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await ki.await()).listMySearches(Ci.getState().session.profile.userId):[]}}const Di=new e.CacheRegistry;class Ai{async listMyBookmarks(){return Di.get("bookmarks",(async()=>(await ki.await()).listMyBookmarks(Ci.getState().session.profile.userId)))}clearCache(){Di.clear("bookmarks")}}const zi=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Bi=new class{constructor(){this.currentSession=Ci.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ai,Ci.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Ci.getState();e.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){zi.actions.savedSearches(void 0)}clearMyBookmarks(){zi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new _i,e=await t.listMySearches();zi.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;zi.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Wi);var Fi=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Ki=Symbol("i18nProperties"),Zi=Symbol("i18nUnsubs");function Pi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Li:Ui}i18n(t,e,...o){var i;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const r=null!==(i=t.args)&&void 0!==i?i:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}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[Zi].has(t)||this[Zi].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[Zi].forEach((t=>t())),this[Zi].clear()}}return e=Zi,Fi([i.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Mi extends(Pi(e.FtLitElement)){}class Hi extends(Pi(e.FtLitElementRedux)){}var ji=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Gi extends Hi{constructor(){super(),this.editorMode=!1,this.addStore(Ci)}render(){return this.key&&this.context?o.html`
|
|
1308
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Ci.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Ci.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Ci.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Ci.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Ci.actions.noCustom(this.noCustom),t.has("editorMode")&&Ci.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Ci.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Ci.actions.session(this.session),t.has("availableUiLocales")&&Ci.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.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()))}}Wi.elementDefinitions={},Wi.styles=Ni,Ti([i.property()],Wi.prototype,"baseUrl",void 0),Ti([i.property()],Wi.prototype,"apiIntegrationIdentifier",void 0),Ti([i.property()],Wi.prototype,"uiLocale",void 0),Ti([e.jsonProperty(null)],Wi.prototype,"availableUiLocales",void 0),Ti([e.jsonProperty(null)],Wi.prototype,"metadataConfiguration",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"editorMode",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"noCustom",void 0),Ti([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Wi.prototype,"noCustomComponent",void 0),Ti([i.property({type:Boolean})],Wi.prototype,"withManualResources",void 0),Ti([e.jsonProperty([])],Wi.prototype,"messageContexts",void 0),Ti([e.jsonProperty(void 0)],Wi.prototype,"session",void 0),Ti([i.property({type:Object})],Wi.prototype,"apiProvider",void 0);class _i{async listMySearches(){var t;return(null===(t=Ci.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await ki.await()).listMySearches(Ci.getState().session.profile.userId):[]}}const Di=new e.CacheRegistry;class Ai{async listMyBookmarks(){return Di.get("bookmarks",(async()=>(await ki.await()).listMyBookmarks(Ci.getState().session.profile.userId)))}clearCache(){Di.clear("bookmarks")}}const zi=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Bi=new class{constructor(){this.currentSession=Ci.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Ai,Ci.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Ci.getState();e.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){zi.actions.savedSearches(void 0)}clearMyBookmarks(){zi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new _i,e=await t.listMySearches();zi.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;zi.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Wi);var Fi=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Ki=Symbol("i18nProperties"),Zi=Symbol("i18nUnsubs");function Pi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Li:Ui}i18n(t,e,...o){var i;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const r=null!==(i=t.args)&&void 0!==i?i:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}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[Zi].has(t)||this[Zi].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[Zi].forEach((t=>t())),this[Zi].clear()}}return e=Zi,Fi([i.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Mi extends(Pi(e.FtLitElement)){}class Hi extends(Pi(e.FtLitElementRedux)){}var ji=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Gi extends Hi{constructor(){super(),this.editorMode=!1,this.addStore(Ci)}render(){return this.key&&this.context?o.html`
|
|
1309
1309
|
<span class="ft-i18n">
|
|
1310
1310
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1311
1311
|
</span>
|
|
@@ -1458,7 +1458,7 @@ const{D:Rs}=wt,Is=()=>document.createComment(""),Us=(t,e,i)=>{const o=t._$AA.par
|
|
|
1458
1458
|
`,Hs=Rt`
|
|
1459
1459
|
`,Gs=qr.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 Vs{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Gs.getState(),o=null!=t?t:i;if(e&&o&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,o,!0)}static get(t){var e;return null!=t?Vs.build(t):null!==(e=Vs.API)&&void 0!==e?e:Vs.API=Vs.build()}static await(t){return new Promise((e=>{let i=Vs.get(t);if(i)e(i);else{const o=Gs.subscribe((()=>{i=Vs.get(t),i&&(o(),e(i))}))}}))}}var qs;const Ys=Symbol("clearAfterUnitTest");class Xs{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new o,this.listeners={},this.currentUiLocale="",this[qs]=()=>{this.defaultMessages={},this.cache=new o,this.listeners={}},this.currentUiLocale=Gs.getState().uiLocale,Gs.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Gs.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 i;if(t=t.toLowerCase(),Object.keys(e).length>0){const o={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};D(this.defaultMessages[t],o)||(this.defaultMessages[t]=o,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var o,r,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==r?r:{};return new Yi(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...i)}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=>_(0).then((()=>t())).catch((()=>null)))))}}qs=Ys,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Xs((async(t,e)=>(await Vs.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Xs((async(t,e)=>(await Vs.await()).getCustomMessageContext(t,e))));const Js=window.FluidTopicsI18nService,Qs=window.FluidTopicsCustomI18nService;var tl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class el extends Hi{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=()=>Vs.get(),this.cache=new o,this.cleanSessionDebouncer=new r}render(){return he`
|
|
1460
1460
|
<slot></slot>
|
|
1461
|
-
`}update(t){super.update(t),t.has("baseUrl")&&Gs.actions.baseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Gs.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gs.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Gs.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Gs.actions.noCustom(this.noCustom),t.has("editorMode")&&Gs.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Gs.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Gs.actions.session(this.session),t.has("availableUiLocales")&&Gs.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Js.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()))}}el.elementDefinitions={},el.styles=Hs,tl([k()],el.prototype,"baseUrl",void 0),tl([k()],el.prototype,"apiIntegrationIdentifier",void 0),tl([k()],el.prototype,"uiLocale",void 0),tl([F(null)],el.prototype,"availableUiLocales",void 0),tl([F(null)],el.prototype,"metadataConfiguration",void 0),tl([k({type:Boolean})],el.prototype,"editorMode",void 0),tl([k({type:Boolean})],el.prototype,"noCustom",void 0),tl([k({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],el.prototype,"noCustomComponent",void 0),tl([k({type:Boolean})],el.prototype,"withManualResources",void 0),tl([F([])],el.prototype,"messageContexts",void 0),tl([F(void 0)],el.prototype,"session",void 0),tl([k({type:Object})],el.prototype,"apiProvider",void 0);class il{async listMySearches(){var t;return(null===(t=Gs.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Vs.await()).listMySearches(Gs.getState().session.profile.userId):[]}}const ol=new o;class rl{async listMyBookmarks(){return ol.get("bookmarks",(async()=>(await Vs.await()).listMyBookmarks(Gs.getState().session.profile.userId)))}clearCache(){ol.clear("bookmarks")}}const nl=qr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const al=new class{constructor(){this.currentSession=Gs.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new rl,Gs.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Gs.getState();D(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(){nl.actions.savedSearches(void 0)}clearMyBookmarks(){nl.actions.bookmarks(void 0)}async reloadMySearches(){const t=new il,e=await t.listMySearches();nl.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;nl.actions.bookmarks(e)}}};W("ft-app-context")(el);var sl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const ll=Symbol("i18nProperties"),cl=Symbol("i18nUnsubs");function fl(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Qs:Js}i18n(t,e,...i){var o;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const r=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var e;null===(e=this[ll])||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[ll])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[ll]&&new Set([...this[ll].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[cl].has(t)||this[cl].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[cl].forEach((t=>t())),this[cl].clear()}}return e=cl,sl([k({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class hl extends(fl(Hi)){}class dl extends(fl(ao)){}var ul=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class pl extends dl{constructor(){super(),this.editorMode=!1,this.addStore(Gs)}render(){return this.key&&this.context?he`
|
|
1461
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Gs.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Gs.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gs.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Gs.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Gs.actions.noCustom(this.noCustom),t.has("editorMode")&&Gs.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Gs.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Gs.actions.session(this.session),t.has("availableUiLocales")&&Gs.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Js.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()))}}el.elementDefinitions={},el.styles=Hs,tl([k()],el.prototype,"baseUrl",void 0),tl([k()],el.prototype,"apiIntegrationIdentifier",void 0),tl([k()],el.prototype,"uiLocale",void 0),tl([F(null)],el.prototype,"availableUiLocales",void 0),tl([F(null)],el.prototype,"metadataConfiguration",void 0),tl([k({type:Boolean})],el.prototype,"editorMode",void 0),tl([k({type:Boolean})],el.prototype,"noCustom",void 0),tl([k({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],el.prototype,"noCustomComponent",void 0),tl([k({type:Boolean})],el.prototype,"withManualResources",void 0),tl([F([])],el.prototype,"messageContexts",void 0),tl([F(void 0)],el.prototype,"session",void 0),tl([k({type:Object})],el.prototype,"apiProvider",void 0);class il{async listMySearches(){var t;return(null===(t=Gs.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Vs.await()).listMySearches(Gs.getState().session.profile.userId):[]}}const ol=new o;class rl{async listMyBookmarks(){return ol.get("bookmarks",(async()=>(await Vs.await()).listMyBookmarks(Gs.getState().session.profile.userId)))}clearCache(){ol.clear("bookmarks")}}const nl=qr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const al=new class{constructor(){this.currentSession=Gs.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new rl,Gs.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Gs.getState();D(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(){nl.actions.savedSearches(void 0)}clearMyBookmarks(){nl.actions.bookmarks(void 0)}async reloadMySearches(){const t=new il,e=await t.listMySearches();nl.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;nl.actions.bookmarks(e)}}};W("ft-app-context")(el);var sl=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};const ll=Symbol("i18nProperties"),cl=Symbol("i18nUnsubs");function fl(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Qs:Js}i18n(t,e,...i){var o;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const r=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var e;null===(e=this[ll])||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[ll])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[ll]&&new Set([...this[ll].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[cl].has(t)||this[cl].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[cl].forEach((t=>t())),this[cl].clear()}}return e=cl,sl([k({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class hl extends(fl(Hi)){}class dl extends(fl(ao)){}var ul=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class pl extends dl{constructor(){super(),this.editorMode=!1,this.addStore(Gs)}render(){return this.key&&this.context?he`
|
|
1462
1462
|
<span class="ft-i18n">
|
|
1463
1463
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1464
1464
|
</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-feedback",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.26",
|
|
4
4
|
"description": "Feedback forms for a map and its topics in an integrated reader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-reader-context": "1.1.
|
|
24
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.26",
|
|
23
|
+
"@fluid-topics/ft-reader-context": "1.1.26",
|
|
24
|
+
"@fluid-topics/ft-wc-utils": "1.1.26",
|
|
25
25
|
"lit": "3.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@fluid-topics/public-api": "1.0.
|
|
28
|
+
"@fluid-topics/public-api": "1.0.56"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "6734976f5a7f6b986917a085be0c38ca3ae562a0"
|
|
31
31
|
}
|