@fluid-topics/ft-copy-block 1.1.67 → 1.1.68
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.
|
@@ -843,9 +843,9 @@ const zo=Symbol.for(""),Ko=t=>{if(t?.r===zo)return t?._$litStatic$},Fo=t=>({_$li
|
|
|
843
843
|
|
|
844
844
|
`,gr=e.css`
|
|
845
845
|
`,yr=e.css`
|
|
846
|
-
`,ur=o.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,openExternalDocumentInNewTab:!1}});class br{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ur.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=br.get(t);if(e)o(e);else{const r=ur.subscribe((()=>{e=br.get(t),e&&(r(),o(e))}))}}))}}class mr{constructor(t=!0,e){var r;this.overrideApi=e;let i=this.constructor;i.commonCache=null!==(r=i.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?i.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:br.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:br.await()}clearCache(){this.cache.clearAll()}}var xr;const vr=Symbol("clearAfterUnitTest");class Or extends mr{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[xr]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=ur.getState().uiLocale,ur.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ur.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const i={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var i,a,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(a=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==a?a:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}xr=vr,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Or{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Or{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Nr=window.FluidTopicsI18nService,Sr=window.FluidTopicsCustomI18nService;var wr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Cr extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.
|
|
846
|
+
`,ur=o.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,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class br{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ur.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=br.get(t);if(e)o(e);else{const r=ur.subscribe((()=>{e=br.get(t),e&&(r(),o(e))}))}}))}}class mr{constructor(t=!0,e){var r;this.overrideApi=e;let i=this.constructor;i.commonCache=null!==(r=i.commonCache)&&void 0!==r?r:new o.CacheRegistry,this.cache=t?i.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:br.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:br.await()}clearCache(){this.cache.clearAll()}}var xr;const vr=Symbol("clearAfterUnitTest");class Or extends mr{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[xr]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=ur.getState().uiLocale,ur.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ur.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var r;if(t=t.toLowerCase(),Object.keys(e).length>0){const i={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...e};o.deepEqual(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...r){var i,a,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(a=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==a?a:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...r)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}xr=vr,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Or{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Or{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Nr=window.FluidTopicsI18nService,Sr=window.FluidTopicsCustomI18nService;var wr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Cr extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>br.get(),this.messageContexts=[],this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
847
847
|
<slot></slot>
|
|
848
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(ur.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ur.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ur.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ur.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ur.actions.noCustom(this.noCustom),t.has("editorMode")&&ur.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ur.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ur.actions.session(this.session),t.has("availableUiLocales")&&ur.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Nr.addContext(t))),t.has("openExternalDocumentInNewTab")&&ur.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),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()))}}Cr.elementDefinitions={},Cr.styles=yr,wr([r.property()],Cr.prototype,"baseUrl",void 0),wr([r.property()],Cr.prototype,"apiIntegrationIdentifier",void 0),wr([r.property()],Cr.prototype,"uiLocale",void 0),wr([o.jsonProperty(null)],Cr.prototype,"availableUiLocales",void 0),wr([o.jsonProperty(null)],Cr.prototype,"metadataConfiguration",void 0),wr([r.property({type:Boolean})],Cr.prototype,"editorMode",void 0),wr([r.property({type:Boolean})],Cr.prototype,"noCustom",void 0),wr([r.property({type:Boolean})],Cr.prototype,"openExternalDocumentInNewTab",void 0),wr([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Cr.prototype,"noCustomComponent",void 0),wr([r.property({type:Boolean})],Cr.prototype,"withManualResources",void 0),wr([
|
|
848
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(ur.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ur.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ur.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ur.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ur.actions.noCustom(this.noCustom),t.has("editorMode")&&ur.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ur.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ur.actions.session(this.session),t.has("availableUiLocales")&&ur.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Nr.addContext(t))),t.has("openExternalDocumentInNewTab")&&ur.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&ur.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&ur.actions.forcedOffline(this.forcedOffline),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()))}}Cr.elementDefinitions={},Cr.styles=yr,wr([r.property()],Cr.prototype,"baseUrl",void 0),wr([r.property()],Cr.prototype,"apiIntegrationIdentifier",void 0),wr([r.property()],Cr.prototype,"uiLocale",void 0),wr([o.jsonProperty(null)],Cr.prototype,"availableUiLocales",void 0),wr([o.jsonProperty(null)],Cr.prototype,"metadataConfiguration",void 0),wr([r.property({type:Boolean})],Cr.prototype,"editorMode",void 0),wr([r.property({type:Boolean})],Cr.prototype,"noCustom",void 0),wr([r.property({type:Boolean})],Cr.prototype,"openExternalDocumentInNewTab",void 0),wr([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Cr.prototype,"noCustomComponent",void 0),wr([r.property({type:Boolean})],Cr.prototype,"withManualResources",void 0),wr([r.property({type:Boolean})],Cr.prototype,"navigatorOnline",void 0),wr([r.property({type:Boolean})],Cr.prototype,"forcedOffline",void 0),wr([r.property({type:Object})],Cr.prototype,"apiProvider",void 0),wr([o.jsonProperty([])],Cr.prototype,"messageContexts",void 0),wr([o.jsonProperty(void 0)],Cr.prototype,"session",void 0);class Ir extends mr{async listMySearches(){let t=ur.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class $r extends mr{async listMyBookmarks(){let t=ur.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Er=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=ur.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new $r,this.savedSearchesService=new Ir,ur.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=ur.getState();o.deepEqual(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(){this.savedSearchesService.clearCache(),Er.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Er.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Er.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Er.actions.bookmarks(o)}}},o.customElement("ft-app-context")(Cr);var Wr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};const Ur=Symbol("i18nAttributes"),kr=Symbol("i18nProperties"),Rr=Symbol("i18nUnsubs");function Lr(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?Sr:Nr}i18n(t,o,...e){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);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 o,e;null===(o=this[Ur])||void 0===o||o.forEach(((o,e)=>{var r;const i=this.getI18nAttributeValue(e);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,i,o)})),null===(e=this[kr])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[Ur])||void 0===o||o.forEach(((o,e)=>{const r=this.getI18nAttributeValue(e);(null==r?void 0:r.context)&&r.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(e,r,o))})),null===(e=this[kr])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,r;super.connectedCallback(),new Set([...null!==(o=null===(t=this[kr])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(r=null===(e=this[Ur])||void 0===e?void 0:e.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[Rr].has(t)||this[Rr].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[Rr].forEach((t=>t())),this[Rr].clear()}}return o=Rr,Wr([r.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class Zr extends(Lr(o.FtLitElement)){}class zr extends(Lr(o.FtLitElementRedux)){}var Kr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Fr extends zr{constructor(){super(),this.editorMode=!1,this.addStore(ur)}render(){return this.key&&this.context?e.html`
|
|
849
849
|
<span class="ft-i18n">
|
|
850
850
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
851
851
|
</span>
|
|
@@ -1012,9 +1012,9 @@ const Jl=Symbol.for(""),Xl=t=>{if(t?.r===Jl)return t?._$litStatic$},Ql=t=>({_$li
|
|
|
1012
1012
|
|
|
1013
1013
|
`,Rc=dt`
|
|
1014
1014
|
`,kc=dt`
|
|
1015
|
-
`,Lc=Qa.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,openExternalDocumentInNewTab:!1}});class Uc{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=Lc.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=Uc.get(t);if(e)o(e);else{const r=Lc.subscribe((()=>{e=Uc.get(t),e&&(r(),o(e))}))}}))}}class Wc{constructor(t=!0,o){var e;this.overrideApi=o;let r=this.constructor;r.commonCache=null!==(e=r.commonCache)&&void 0!==e?e:new re,this.cache=t?r.commonCache:new re}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Uc.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Uc.await()}clearCache(){this.cache.clearAll()}}var zc;const Bc=Symbol("clearAfterUnitTest");class Fc extends Wc{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[zc]=()=>{this.defaultMessages={},this.cache=new re,this.listeners={}},this.currentUiLocale=Lc.getState().uiLocale,Lc.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Lc.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};de(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){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 Qi(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>ce(0).then((()=>t())).catch((()=>null)))))}}zc=Bc,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Fc{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Fc{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Ac=window.FluidTopicsI18nService,jc=window.FluidTopicsCustomI18nService;var Pc=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class _c extends Pi{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.
|
|
1015
|
+
`,Lc=Qa.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,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class Uc{static get(t){const{baseUrl:o,apiIntegrationIdentifier:e}=Lc.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static await(t){return new Promise((o=>{let e=Uc.get(t);if(e)o(e);else{const r=Lc.subscribe((()=>{e=Uc.get(t),e&&(r(),o(e))}))}}))}}class Wc{constructor(t=!0,o){var e;this.overrideApi=o;let r=this.constructor;r.commonCache=null!==(e=r.commonCache)&&void 0!==e?e:new re,this.cache=t?r.commonCache:new re}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Uc.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Uc.await()}clearCache(){this.cache.clearAll()}}var zc;const Bc=Symbol("clearAfterUnitTest");class Fc extends Wc{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[zc]=()=>{this.defaultMessages={},this.cache=new re,this.listeners={}},this.currentUiLocale=Lc.getState().uiLocale,Lc.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Lc.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};de(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){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 Qi(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>ce(0).then((()=>t())).catch((()=>null)))))}}zc=Bc,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Fc{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Fc{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Ac=window.FluidTopicsI18nService,jc=window.FluidTopicsCustomI18nService;var Pc=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class _c extends Pi{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>Uc.get(),this.messageContexts=[],this.cache=new re,this.cleanSessionDebouncer=new se}render(){return Jt`
|
|
1016
1016
|
<slot></slot>
|
|
1017
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(Lc.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Lc.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Lc.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Lc.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Lc.actions.noCustom(this.noCustom),t.has("editorMode")&&Lc.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Lc.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Lc.actions.session(this.session),t.has("availableUiLocales")&&Lc.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ac.addContext(t))),t.has("openExternalDocumentInNewTab")&&Lc.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),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()))}}_c.elementDefinitions={},_c.styles=kc,Pc([So()],_c.prototype,"baseUrl",void 0),Pc([So()],_c.prototype,"apiIntegrationIdentifier",void 0),Pc([So()],_c.prototype,"uiLocale",void 0),Pc([ye(null)],_c.prototype,"availableUiLocales",void 0),Pc([ye(null)],_c.prototype,"metadataConfiguration",void 0),Pc([So({type:Boolean})],_c.prototype,"editorMode",void 0),Pc([So({type:Boolean})],_c.prototype,"noCustom",void 0),Pc([So({type:Boolean})],_c.prototype,"openExternalDocumentInNewTab",void 0),Pc([So({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],_c.prototype,"noCustomComponent",void 0),Pc([So({type:Boolean})],_c.prototype,"withManualResources",void 0),Pc([
|
|
1017
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Lc.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Lc.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Lc.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Lc.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Lc.actions.noCustom(this.noCustom),t.has("editorMode")&&Lc.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Lc.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Lc.actions.session(this.session),t.has("availableUiLocales")&&Lc.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ac.addContext(t))),t.has("openExternalDocumentInNewTab")&&Lc.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Lc.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Lc.actions.forcedOffline(this.forcedOffline),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()))}}_c.elementDefinitions={},_c.styles=kc,Pc([So()],_c.prototype,"baseUrl",void 0),Pc([So()],_c.prototype,"apiIntegrationIdentifier",void 0),Pc([So()],_c.prototype,"uiLocale",void 0),Pc([ye(null)],_c.prototype,"availableUiLocales",void 0),Pc([ye(null)],_c.prototype,"metadataConfiguration",void 0),Pc([So({type:Boolean})],_c.prototype,"editorMode",void 0),Pc([So({type:Boolean})],_c.prototype,"noCustom",void 0),Pc([So({type:Boolean})],_c.prototype,"openExternalDocumentInNewTab",void 0),Pc([So({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],_c.prototype,"noCustomComponent",void 0),Pc([So({type:Boolean})],_c.prototype,"withManualResources",void 0),Pc([So({type:Boolean})],_c.prototype,"navigatorOnline",void 0),Pc([So({type:Boolean})],_c.prototype,"forcedOffline",void 0),Pc([So({type:Object})],_c.prototype,"apiProvider",void 0),Pc([ye([])],_c.prototype,"messageContexts",void 0),Pc([ye(void 0)],_c.prototype,"session",void 0);class Mc extends Wc{async listMySearches(){let t=Lc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class Zc extends Wc{async listMyBookmarks(){let t=Lc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Kc=Qa.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Lc.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Zc,this.savedSearchesService=new Mc,Lc.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Lc.getState();de(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(){this.savedSearchesService.clearCache(),Kc.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Kc.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Kc.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Kc.actions.bookmarks(o)}}},ue("ft-app-context")(_c);var Dc=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};const Hc=Symbol("i18nAttributes"),Tc=Symbol("i18nProperties"),Gc=Symbol("i18nUnsubs");function Vc(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?jc:Ac}i18n(t,o,...e){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);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 o,e;null===(o=this[Hc])||void 0===o||o.forEach(((o,e)=>{var r;const i=this.getI18nAttributeValue(e);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,i,o)})),null===(e=this[Tc])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[Hc])||void 0===o||o.forEach(((o,e)=>{const r=this.getI18nAttributeValue(e);(null==r?void 0:r.context)&&r.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(e,r,o))})),null===(e=this[Tc])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,r;super.connectedCallback(),new Set([...null!==(o=null===(t=this[Tc])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(r=null===(e=this[Hc])||void 0===e?void 0:e.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[Gc].has(t)||this[Gc].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[Gc].forEach((t=>t())),this[Gc].clear()}}return o=Gc,Dc([So({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class qc extends(Vc(Pi)){}class Yc extends(Vc(pn)){}var Jc=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Xc extends Yc{constructor(){super(),this.editorMode=!1,this.addStore(Lc)}render(){return this.key&&this.context?Jt`
|
|
1018
1018
|
<span class="ft-i18n">
|
|
1019
1019
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1020
1020
|
</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-copy-block",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.68",
|
|
4
4
|
"description": "Copy block",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-i18n": "1.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-i18n": "1.1.68",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.1.68",
|
|
24
24
|
"lit": "3.1.0"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "d10171ba718cee726044d0cc44820ebbb1ab7cbc"
|
|
27
27
|
}
|