@fluid-topics/ft-reader-feedback 0.3.65 → 0.3.66

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.
@@ -1195,11 +1195,11 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1195
1195
  <ft-loader part="loader icon"></ft-loader> `:this.icon?X`
1196
1196
  <ft-icon part="icon" variant="${this.iconVariant}" value="${this.icon}"></ft-icon> `:Q}focus(){var t;null===(t=this.button)||void 0===t||t.focus()}getLabel(){return this.label||this.textContent}get textContent(){return this.unslotText(this.slottedContent).trim()}unslotText(t){return t instanceof HTMLSlotElement?t.assignedNodes().map((t=>this.unslotText(t))).join(""):(null==t?void 0:t.textContent)||""}hasTextContent(){return this.textContent.length>0}onSlotchange(){this.requestUpdate()}isDisabled(){return this.disabled||this.loading}}Kn.elementDefinitions={"ft-ripple":fn,"ft-tooltip":cn,"ft-typography":Lo,"ft-icon":Qo,"ft-loader":Wn},Kn.styles=[_t,No],Hn([r({type:String,reflect:!0})],Kn.prototype,"role",void 0),Hn([r({type:Boolean})],Kn.prototype,"primary",void 0),Hn([r({type:Boolean})],Kn.prototype,"outlined",void 0),Hn([r({type:Boolean})],Kn.prototype,"disabled",void 0),Hn([r({type:Boolean})],Kn.prototype,"dense",void 0),Hn([r({type:Boolean})],Kn.prototype,"round",void 0),Hn([r({type:String})],Kn.prototype,"label",void 0),Hn([r({type:String})],Kn.prototype,"icon",void 0),Hn([r({type:String})],Kn.prototype,"iconVariant",void 0),Hn([r({type:Boolean})],Kn.prototype,"trailingIcon",void 0),Hn([r({type:Boolean})],Kn.prototype,"loading",void 0),Hn([r({type:String})],Kn.prototype,"tooltipPosition",void 0),Hn([r({type:Boolean})],Kn.prototype,"hideTooltip",void 0),Hn([r({type:Boolean})],Kn.prototype,"forceTooltip",void 0),Hn([l(".ft-button")],Kn.prototype,"button",void 0),Hn([l(".ft-button--label slot")],Kn.prototype,"slottedContent",void 0),f("ft-button")(Kn);const Zn=m`
1197
1197
  `,Vn=m`
1198
- `,Gn=ci.get({name:"ft-app-info",reducers:{setBaseUrl:(t,e)=>{t.baseUrl=e.payload},setApiIntegrationIdentifier:(t,e)=>{t.apiIntegrationIdentifier=e.payload},setUiLocale:(t,e)=>{t.uiLocale=e.payload},setAvailableUiLocales:(t,e)=>{t.availableUiLocales=e.payload},setEditorMode:(t,e)=>{t.editorMode=e.payload},setNoCustom:(t,e)=>{t.noCustom=e.payload},setNoCustomComponent:(t,e)=>{t.noCustomComponent=e.payload},setSession:(t,e)=>{t.session=e.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class Jn{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Gn.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?Jn.build(t):null!==(e=Jn.API)&&void 0!==e?e:Jn.API=Jn.build()}static await(t){return new Promise((e=>{let i=Jn.get(t);if(i)e(i);else{const o=Gn.subscribe((()=>{i=Jn.get(t),i&&(o(),e(i))}))}}))}}var qn;const Xn=Symbol("clearAfterUnitTest");class Yn{constructor(t){this.apiProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[qn]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=Gn.getState().uiLocale,Gn.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Gn.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,n,r;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new Ct(null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},s).resolve(e,...i)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(async()=>{var e;return await(null===(e=this.apiProvider())||void 0===e?void 0:e.getFluidTopicsMessageContext(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=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}qn=Xn,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Yn(Jn.get));const Qn=window.FluidTopicsI18nService;var tr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class er extends St{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Jn.get(),this.cache=new i,this.cleanSessionDebouncer=new o}render(){return X`
1198
+ `,Gn=ci.get({name:"ft-app-info",reducers:{setBaseUrl:(t,e)=>{t.baseUrl=e.payload},setApiIntegrationIdentifier:(t,e)=>{t.apiIntegrationIdentifier=e.payload},setUiLocale:(t,e)=>{t.uiLocale=e.payload},setAvailableUiLocales:(t,e)=>{t.availableUiLocales=e.payload},setEditorMode:(t,e)=>{t.editorMode=e.payload},setNoCustom:(t,e)=>{t.noCustom=e.payload},setNoCustomComponent:(t,e)=>{t.noCustomComponent=e.payload},setSession:(t,e)=>{t.session=e.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class Jn{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Gn.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?Jn.build(t):null!==(e=Jn.API)&&void 0!==e?e:Jn.API=Jn.build()}static await(t){return new Promise((e=>{let i=Jn.get(t);if(i)e(i);else{const o=Gn.subscribe((()=>{i=Jn.get(t),i&&(o(),e(i))}))}}))}}var qn;const Xn=Symbol("clearAfterUnitTest");class Yn{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i,this.listeners={},this.currentUiLocale="",this[qn]=()=>{this.defaultMessages={},this.cache=new i,this.listeners={}},this.currentUiLocale=Gn.getState().uiLocale,Gn.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Gn.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,n,r;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(n=null===(o=this.cache.getNow(t))||void 0===o?void 0:o.messages)&&void 0!==n?n:{};return new Ct(null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},s).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=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}qn=Xn,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Yn((async(t,e)=>(await Jn.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Yn((async(t,e)=>(await Jn.await()).getCustomMessageContext(t,e))));const Qn=window.FluidTopicsI18nService,tr=window.FluidTopicsCustomI18nService;var er=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class ir extends St{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Jn.get(),this.cache=new i,this.cleanSessionDebouncer=new o}render(){return X`
1199
1199
  <slot></slot>
1200
- `}updated(t){super.updated(t),t.has("baseUrl")&&Gn.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Gn.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gn.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Gn.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Gn.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Gn.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Gn.actions.setSession(this.session),t.has("availableUiLocales")&&Gn.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Qn.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}er.elementDefinitions={},er.styles=Vn,tr([r()],er.prototype,"baseUrl",void 0),tr([r()],er.prototype,"apiIntegrationIdentifier",void 0),tr([r()],er.prototype,"uiLocale",void 0),tr([u([])],er.prototype,"availableUiLocales",void 0),tr([r({type:Boolean})],er.prototype,"editorMode",void 0),tr([r({type:Boolean})],er.prototype,"noCustom",void 0),tr([r({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],er.prototype,"noCustomComponent",void 0),tr([r({type:Boolean})],er.prototype,"withManualResources",void 0),tr([u([])],er.prototype,"messageContexts",void 0),tr([u(void 0)],er.prototype,"session",void 0),tr([r({type:Object})],er.prototype,"apiProvider",void 0),f("ft-app-context")(er);const ir=Symbol("i18nProperties"),or=Symbol("i18nUnsubs");function nr(t){var e;return e=or,class extends t{constructor(){super(...arguments),this[e]=new Map}i18n(t,e,...i){var o;if("string"==typeof t)return Qn.resolveMessage(t,e,...i);const n=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return Qn.resolveMessage(t.context,t.key,...n)}onI18nUpdate(t){var e;null===(e=this[ir])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updated(t){var e;super.updated(t),null===(e=this[ir])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[ir]&&new Set([...this[ir].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[or].has(t)||this[or].set(t,Qn.subscribe(t,(()=>this.onI18nUpdate(t)))),Qn.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages(t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[or].forEach((t=>t())),this[or].clear()}}}class rr extends(nr(St)){}class sr extends(nr(ai)){}var ar=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class lr extends rr{render(){return this.key&&this.context?X`
1200
+ `}updated(t){super.updated(t),t.has("baseUrl")&&Gn.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Gn.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gn.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Gn.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Gn.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Gn.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Gn.actions.setSession(this.session),t.has("availableUiLocales")&&Gn.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Qn.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}ir.elementDefinitions={},ir.styles=Vn,er([r()],ir.prototype,"baseUrl",void 0),er([r()],ir.prototype,"apiIntegrationIdentifier",void 0),er([r()],ir.prototype,"uiLocale",void 0),er([u([])],ir.prototype,"availableUiLocales",void 0),er([r({type:Boolean})],ir.prototype,"editorMode",void 0),er([r({type:Boolean})],ir.prototype,"noCustom",void 0),er([r({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ir.prototype,"noCustomComponent",void 0),er([r({type:Boolean})],ir.prototype,"withManualResources",void 0),er([u([])],ir.prototype,"messageContexts",void 0),er([u(void 0)],ir.prototype,"session",void 0),er([r({type:Object})],ir.prototype,"apiProvider",void 0),f("ft-app-context")(ir);var or=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const nr=Symbol("i18nProperties"),rr=Symbol("i18nUnsubs");function sr(t){var e;class i extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?tr:Qn}i18n(t,e,...i){var o;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...i);const n=null!==(o=t.args)&&void 0!==o?o:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...n)}onI18nUpdate(t){var e;null===(e=this[nr])||void 0===e||e.forEach(((e,i)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[i]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updated(t){var e;super.updated(t),null===(e=this[nr])||void 0===e||e.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}connectedCallback(){super.connectedCallback(),null!=this[nr]&&new Set([...this[nr].values()].map((t=>t.context))).forEach((t=>this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[rr].has(t)||this[rr].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[rr].forEach((t=>t())),this[rr].clear()}}return e=rr,or([r({type:Boolean})],i.prototype,"useCustomMessageContexts",void 0),i}class ar extends(sr(St)){}class lr extends(sr(ai)){}var cr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class hr extends lr{constructor(){super(),this.editorMode=!1,this.addStore(Gn)}render(){return this.key&&this.context?X`
1201
1201
  <span class="ft-i18n">${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}</span>
1202
- `:Q}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}lr.elementDefinitions={},lr.styles=Zn,ar([r()],lr.prototype,"context",void 0),ar([r()],lr.prototype,"key",void 0),ar([u([])],lr.prototype,"args",void 0),ar([r()],lr.prototype,"defaultMessage",void 0);class cr{constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const i=e;return t=>({context:this.name,key:i,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Qn.resolveMessage(this.name,e,...t)})}static build(t){return new cr(t)}static fromGwt(t){return new cr(t)}}const hr=t=>(e,i)=>{var o,n;e.constructor.createProperty(i,{attribute:!1,type:String});const r={...t,key:null!==(o=t.key)&&void 0!==o?o:i};e[ir]=null!==(n=e[ir])&&void 0!==n?n:new Map,e[ir].set(i,r)};f("ft-i18n")(lr);const dr=cr.build("integratedFeedbackComponent"),fr={starsRating:"{0} stars","starsRating[\\=1]":"1 star",like:"Like",dislike:"Dislike",dichotomousYes:"Yes",dichotomousNo:"No",notRated:"Not rated",ratedNow:"Rated now",ratedToday:"Rated today",ratedOn:"Rated on {0, date}",feedbackInputLabel:"How can we improve it?",okButton:"Send feedback",cancelButton:"Cancel",feedbackSuccess:"Feedback successfully sent. Thank you!",feedbackFailure:"Failed to send feedback. Please try again later.",ratingSuccess:"Rating successfully sent. Thank you!",ratingFailure:"Failed to send rating. Please try again later.",mapFeedbackMainTitle:"Send feedback",mapRatingSectionTitle:"Rate this document",mapDichotomousRatingSectionTitle:"Did it solve your problem?",mapFeedbackSectionTitle:"Write your review",topicFeedbackMainTitle:"Send feedback",topicRatingSectionTitle:"Rate this content",topicDichotomousRatingSectionTitle:"Did this content solve your problem?",topicFeedbackSectionTitle:"Write your review"},ur=cr.build("inDesignerFeedbackComponent"),pr={ratingNotConfigured:"Rating unavailable: no rating configured for this content.",missingRatingRole:"Rating unavailable: missing role RATING_USER.",missingFeedbackRole:"Feedback unavailable: missing role FEEDBACK_USER.",inDesignerOnlyNotice:"This notice will not appear outside this designer.",feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var vr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class br extends rr{constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.ratingAllowed=!1,this.feedbackMessage="",this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.addI18nContext(dr,fr),this.addI18nContext(ur,pr)}get canAccessFeedback(){return this.user&&this.user.roles.includes("FEEDBACK_USER")}get canAccessRating(){return this.userHasRatingRole&&"NO_RATING"!==this.configuredRatingType}get userHasRatingRole(){return this.user&&this.user.roles.includes("RATING_USER")}get configuredRatingType(){var t,e;return null!==(e=this.ratingAllowed?null===(t=this.ratingSummary)||void 0===t?void 0:t.type:"NO_RATING")&&void 0!==e?e:"NO_RATING"}get ratingType(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==i?i:"NO_RATING"}get ratingValue(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==i?i:-1}get ratingDate(){var t,e;const i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.date;return"string"==typeof i?((o=i).match(/^\d{4}-\d{2}-\d{2}$/)&&(o=o.replace(/-/g,"/")),o=o.replace(" ","T").replace(/^(.+)(\+\d{2})(\d{2})$/,((t,e,i,o)=>e+i+":"+o)),new Date(o)):i;var o}render(){return this.editorMode||this.canAccessFeedback||this.canAccessRating?X`
1202
+ `:this.editorMode?"Select a context and a label key.":Q}update(t){super.update(t),this.context&&this.key&&this.defaultMessage&&this.addI18nMessages(this.context,{[this.key]:this.defaultMessage})}}hr.elementDefinitions={},hr.styles=Zn,cr([si()],hr.prototype,"editorMode",void 0),cr([r()],hr.prototype,"context",void 0),cr([r()],hr.prototype,"key",void 0),cr([u([])],hr.prototype,"args",void 0),cr([r()],hr.prototype,"defaultMessage",void 0);class dr{constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const i=e;return t=>({context:this.name,key:i,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Qn.resolveMessage(this.name,e,...t)})}static build(t){return new dr(t)}static fromGwt(t){return new dr(t)}}const fr=t=>(e,i)=>{var o,n;e.constructor.createProperty(i,{attribute:!1,type:String});const r={...t,key:null!==(o=t.key)&&void 0!==o?o:i};e[nr]=null!==(n=e[nr])&&void 0!==n?n:new Map,e[nr].set(i,r)};f("ft-i18n")(hr);const ur=dr.build("integratedFeedbackComponent"),pr={starsRating:"{0} stars","starsRating[\\=1]":"1 star",like:"Like",dislike:"Dislike",dichotomousYes:"Yes",dichotomousNo:"No",notRated:"Not rated",ratedNow:"Rated now",ratedToday:"Rated today",ratedOn:"Rated on {0, date}",feedbackInputLabel:"How can we improve it?",okButton:"Send feedback",cancelButton:"Cancel",feedbackSuccess:"Feedback successfully sent. Thank you!",feedbackFailure:"Failed to send feedback. Please try again later.",ratingSuccess:"Rating successfully sent. Thank you!",ratingFailure:"Failed to send rating. Please try again later.",mapFeedbackMainTitle:"Send feedback",mapRatingSectionTitle:"Rate this document",mapDichotomousRatingSectionTitle:"Did it solve your problem?",mapFeedbackSectionTitle:"Write your review",topicFeedbackMainTitle:"Send feedback",topicRatingSectionTitle:"Rate this content",topicDichotomousRatingSectionTitle:"Did this content solve your problem?",topicFeedbackSectionTitle:"Write your review"},vr=dr.build("inDesignerFeedbackComponent"),br={ratingNotConfigured:"Rating unavailable: no rating configured for this content.",missingRatingRole:"Rating unavailable: missing role RATING_USER.",missingFeedbackRole:"Feedback unavailable: missing role FEEDBACK_USER.",inDesignerOnlyNotice:"This notice will not appear outside this designer.",feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var yr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class gr extends ar{constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.ratingAllowed=!1,this.feedbackMessage="",this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.addI18nContext(ur,pr),this.addI18nContext(vr,br)}get canAccessFeedback(){return this.user&&this.user.roles.includes("FEEDBACK_USER")}get canAccessRating(){return this.userHasRatingRole&&"NO_RATING"!==this.configuredRatingType}get userHasRatingRole(){return this.user&&this.user.roles.includes("RATING_USER")}get configuredRatingType(){var t,e;return null!==(e=this.ratingAllowed?null===(t=this.ratingSummary)||void 0===t?void 0:t.type:"NO_RATING")&&void 0!==e?e:"NO_RATING"}get ratingType(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==i?i:"NO_RATING"}get ratingValue(){var t,e,i;return null!==(i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==i?i:-1}get ratingDate(){var t,e;const i=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.date;return"string"==typeof i?((o=i).match(/^\d{4}-\d{2}-\d{2}$/)&&(o=o.replace(/-/g,"/")),o=o.replace(" ","T").replace(/^(.+)(\+\d{2})(\d{2})$/,((t,e,i,o)=>e+i+":"+o)),new Date(o)):i;var o}render(){return this.editorMode||this.canAccessFeedback||this.canAccessRating?X`
1203
1203
  <div class="ft-reader-feedback">
1204
1204
  ${this.hideTitle?Q:X`
1205
1205
  <ft-typography variant="title" part="main-title">
@@ -1219,11 +1219,11 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1219
1219
  ${this.renderRatingDate()}
1220
1220
  </ft-typography>
1221
1221
  </div>
1222
- `:this.placeholderInEditor(this.userHasRatingRole?ur.messages.ratingNotConfigured():ur.messages.missingRatingRole())}renderRatingDate(){const t=this.ratingDate;if(null==t)return dr.messages.notRated();if(t.getTime()>(new Date).getTime()-6e4)return dr.messages.ratedNow();return(new Date).toLocaleDateString()===t.toLocaleDateString()?dr.messages.ratedToday():dr.messages.ratedOn(t)}renderRating(){switch(this.configuredRatingType){case"STARS":return X`
1222
+ `:this.placeholderInEditor(this.userHasRatingRole?vr.messages.ratingNotConfigured():vr.messages.missingRatingRole())}renderRatingDate(){const t=this.ratingDate;if(null==t)return ur.messages.notRated();if(t.getTime()>(new Date).getTime()-6e4)return ur.messages.ratedNow();return(new Date).toLocaleDateString()===t.toLocaleDateString()?ur.messages.ratedToday():ur.messages.ratedOn(t)}renderRating(){switch(this.configuredRatingType){case"STARS":return X`
1223
1223
  <div class="ft-reader-feedback--stars" part="rating rating-stars">
1224
1224
  ${Ln(new Array(5),((t,e)=>e),((t,e)=>{let i="STARS"===this.ratingType&&this.ratingValue>e;const o=e+1;return X`
1225
1225
  <ft-button round part="rating-stars-${o}"
1226
- label="${dr.messages.starsRating(o)}"
1226
+ label="${ur.messages.starsRating(o)}"
1227
1227
  tooltipPosition="top"
1228
1228
  .iconVariant=${this.iconVariant}
1229
1229
  icon="${i?this.filledStarIcon:this.emptyStarIcon}"
@@ -1238,13 +1238,13 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1238
1238
  ?selected=${e}
1239
1239
  .iconVariant=${this.iconVariant}
1240
1240
  icon="${e?this.filledLikeIcon:this.emptyLikeIcon}">
1241
- ${dr.messages.like()}
1241
+ ${ur.messages.like()}
1242
1242
  </ft-switch-option>
1243
1243
  <ft-switch-option .value=${0}
1244
1244
  ?selected=${t}
1245
1245
  .iconVariant=${this.iconVariant}
1246
1246
  icon="${t?this.filledDislikeIcon:this.emptyDislikeIcon}">
1247
- ${dr.messages.dislike()}
1247
+ ${ur.messages.dislike()}
1248
1248
  </ft-switch-option>
1249
1249
  </ft-switch>
1250
1250
  `;case"DICHOTOMOUS":const i="DICHOTOMOUS"===this.ratingType&&0===this.ratingValue,o="DICHOTOMOUS"===this.ratingType&&1===this.ratingValue;return X`
@@ -1252,11 +1252,11 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1252
1252
  part="rating rating-dichotomous">
1253
1253
  <ft-switch-option .value=${1}
1254
1254
  ?selected=${o}>
1255
- ${dr.messages.dichotomousYes()}
1255
+ ${ur.messages.dichotomousYes()}
1256
1256
  </ft-switch-option>
1257
1257
  <ft-switch-option .value=${0}
1258
1258
  ?selected=${i}>
1259
- ${dr.messages.dichotomousNo()}
1259
+ ${ur.messages.dichotomousNo()}
1260
1260
  </ft-switch-option>
1261
1261
  </ft-switch>
1262
1262
  `}return Q}rate(t){(null!=t?t:-1)!==this.ratingValue&&this.dispatchEvent(new CustomEvent("rate",{detail:t}))}renderFeedbackSection(){if(this.canAccessFeedback){const t=this.feedbackMailLinkBuilder(this.feedbackMessage);let e=X`
@@ -1265,7 +1265,7 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1265
1265
  ?disabled=${!this.feedbackMessage}
1266
1266
  @click=${()=>t?this.clearFeedbackInput():this.sendFeedback()}
1267
1267
  part="send-feedback">
1268
- ${dr.messages.okButton()}
1268
+ ${ur.messages.okButton()}
1269
1269
  </ft-button>
1270
1270
  `;return t&&(e=X`
1271
1271
  <a class="ft-reader-feedback--feedback-link" href="${t}">
@@ -1278,20 +1278,20 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1278
1278
  </ft-typography>
1279
1279
  <ft-text-area outlined
1280
1280
  class="ft-reader-feedback--feedback-input" part="feedback-input"
1281
- label="${dr.messages.feedbackInputLabel()}"
1281
+ label="${ur.messages.feedbackInputLabel()}"
1282
1282
  @live-change=${t=>this.feedbackMessage=t.detail.trim()}
1283
1283
  ></ft-text-area>
1284
1284
  ${e}
1285
1285
  </div>
1286
- `}return this.placeholderInEditor(ur.messages.missingFeedbackRole())}sendFeedback(){this.dispatchEvent(new CustomEvent("send-feedback",{detail:this.feedbackInput.value}))}placeholderInEditor(t){return this.editorMode?X`
1286
+ `}return this.placeholderInEditor(vr.messages.missingFeedbackRole())}sendFeedback(){this.dispatchEvent(new CustomEvent("send-feedback",{detail:this.feedbackInput.value}))}placeholderInEditor(t){return this.editorMode?X`
1287
1287
  <div class="ft-reader-feedback--placeholder">
1288
1288
  <ft-typography variant="caption">${t}</ft-typography>
1289
1289
  <ft-tooltip position="left"
1290
- text="${ur.messages.inDesignerOnlyNotice()}">
1290
+ text="${vr.messages.inDesignerOnlyNotice()}">
1291
1291
  <ft-icon>INFO</ft-icon>
1292
1292
  </ft-tooltip>
1293
1293
  </div>
1294
- `:Q}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}br.elementDefinitions={"ft-button":Kn,"ft-typography":Lo,"ft-icon":Qo,"ft-tooltip":cn,"ft-switch":mn,"ft-switch-option":yn,"ft-text-area":Tn},br.styles=To,vr([r({type:Boolean})],br.prototype,"editorMode",void 0),vr([r({type:Boolean})],br.prototype,"hideTitle",void 0),vr([r({type:Boolean})],br.prototype,"ratingAllowed",void 0),vr([r({attribute:!1})],br.prototype,"i18nProperties",void 0),vr([r({attribute:!1})],br.prototype,"ratingSummary",void 0),vr([r({attribute:!1})],br.prototype,"user",void 0),vr([l(".ft-reader-feedback--feedback-input")],br.prototype,"feedbackInput",void 0),vr([s()],br.prototype,"feedbackMessage",void 0),vr([r()],br.prototype,"iconVariant",void 0),vr([r()],br.prototype,"emptyStarIcon",void 0),vr([r()],br.prototype,"filledStarIcon",void 0),vr([r()],br.prototype,"emptyLikeIcon",void 0),vr([r()],br.prototype,"filledLikeIcon",void 0),vr([r()],br.prototype,"emptyDislikeIcon",void 0),vr([r()],br.prototype,"filledDislikeIcon",void 0),vr([r()],br.prototype,"feedbackMailLinkBuilder",void 0);const yr=cr.fromGwt("server");class gr{constructor(){this.subject="",this.url="",this.allMetadata="",this.subjectMetadata="",this.isAuthenticated=!1}update(t,e,i,o,n){this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=n,this.subjectMetadata=o.subjectMetadataIds.map((t=>i.find((e=>e.key===t)))).filter((t=>null!=t)).map((t=>"["+t.values.join(", ")+"]")).join(""),this.allMetadata=i.filter((t=>!t.key.startsWith("ft:"))).map((t=>"["+t.values.join(", ")+"]")).join(" ")}build(t){var e,i;if(0===t.length||this.isAuthenticated&&(null==this.configuration||(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopics)))return;const o=encodeURIComponent(this.subject+" "+this.subjectMetadata),n=encodeURIComponent(`\n${this.allMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${yr.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${o}&body=${n}`}}var xr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class mr extends(nr(bi)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new gr,this.i18nProperties={feedbackMainTitle:dr.properties.mapFeedbackMainTitle(),ratingSectionTitle:dr.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:dr.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:dr.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(Gn)}render(){return null==this.map?Q:X`
1294
+ `:Q}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}gr.elementDefinitions={"ft-button":Kn,"ft-typography":Lo,"ft-icon":Qo,"ft-tooltip":cn,"ft-switch":mn,"ft-switch-option":yn,"ft-text-area":Tn},gr.styles=To,yr([r({type:Boolean})],gr.prototype,"editorMode",void 0),yr([r({type:Boolean})],gr.prototype,"hideTitle",void 0),yr([r({type:Boolean})],gr.prototype,"ratingAllowed",void 0),yr([r({attribute:!1})],gr.prototype,"i18nProperties",void 0),yr([r({attribute:!1})],gr.prototype,"ratingSummary",void 0),yr([r({attribute:!1})],gr.prototype,"user",void 0),yr([l(".ft-reader-feedback--feedback-input")],gr.prototype,"feedbackInput",void 0),yr([s()],gr.prototype,"feedbackMessage",void 0),yr([r()],gr.prototype,"iconVariant",void 0),yr([r()],gr.prototype,"emptyStarIcon",void 0),yr([r()],gr.prototype,"filledStarIcon",void 0),yr([r()],gr.prototype,"emptyLikeIcon",void 0),yr([r()],gr.prototype,"filledLikeIcon",void 0),yr([r()],gr.prototype,"emptyDislikeIcon",void 0),yr([r()],gr.prototype,"filledDislikeIcon",void 0),yr([r()],gr.prototype,"feedbackMailLinkBuilder",void 0);const xr=dr.fromGwt("server");class mr{constructor(){this.subject="",this.url="",this.allMetadata="",this.subjectMetadata="",this.isAuthenticated=!1}update(t,e,i,o,n){this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=n,this.subjectMetadata=o.subjectMetadataIds.map((t=>i.find((e=>e.key===t)))).filter((t=>null!=t)).map((t=>"["+t.values.join(", ")+"]")).join(""),this.allMetadata=i.filter((t=>!t.key.startsWith("ft:"))).map((t=>"["+t.values.join(", ")+"]")).join(" ")}build(t){var e,i;if(0===t.length||this.isAuthenticated&&(null==this.configuration||(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopics)))return;const o=encodeURIComponent(this.subject+" "+this.subjectMetadata),n=encodeURIComponent(`\n${this.allMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${xr.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${o}&body=${n}`}}var wr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class $r extends(sr(bi)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new mr,this.i18nProperties={feedbackMainTitle:ur.properties.mapFeedbackMainTitle(),ratingSectionTitle:ur.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:ur.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:ur.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(Gn)}render(){return null==this.map?Q:X`
1295
1295
  <ft-reader-feedback
1296
1296
  ratingAllowed
1297
1297
  .i18nProperties=${this.i18nProperties}
@@ -1310,7 +1310,7 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1310
1310
  @rate=${this.rate}
1311
1311
  @send-feedback=${this.sendFeedback}
1312
1312
  ></ft-reader-feedback>
1313
- `}updated(t){var e,i,o;super.updated(t),t.has("map")&&this.map&&this.updateData(),["map","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink())&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(o=this.user)||void 0===o?void 0:o.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}onStoreAvailable(t){super.onStoreAvailable(t),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.map&&((null===(t=this.user)||void 0===t?void 0:t.userId)||null==this.ratingSummary)&&(this.ratingSummary=await(null===(e=this.service)||void 0===e?void 0:e.getMapRating()))}))}rate(t){this.ratingSummary&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateMap()):await(null===(i=this.service)||void 0===i?void 0:i.rateMap(null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new $t({type:"error",message:dr.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{this.editorMode?this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackAndRatingDisabledInEditor()})):(await(null===(e=this.service)||void 0===e?void 0:e.sendMapFeedback(t.detail)),this.dispatchEvent(new $t({type:"info",message:dr.messages.feedbackSuccess()}))),this.readerFeedback.clearFeedbackInput()}catch{this.dispatchEvent(new $t({type:"error",message:dr.messages.feedbackFailure()}))}}}mr.elementDefinitions={"ft-reader-feedback":br},xr([si({store:Gn.name,selector:t=>{var e;return null===(e=t.session)||void 0===e?void 0:e.profile}})],mr.prototype,"user",void 0),xr([si({store:"reader"})],mr.prototype,"map",void 0),xr([si({store:Gn.name})],mr.prototype,"editorMode",void 0),xr([si({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],mr.prototype,"configuration",void 0),xr([s()],mr.prototype,"ratingSummary",void 0),xr([r({type:Boolean})],mr.prototype,"hideTitle",void 0),xr([r()],mr.prototype,"iconVariant",void 0),xr([r()],mr.prototype,"emptyStarIcon",void 0),xr([r()],mr.prototype,"filledStarIcon",void 0),xr([r()],mr.prototype,"emptyLikeIcon",void 0),xr([r()],mr.prototype,"filledLikeIcon",void 0),xr([r()],mr.prototype,"emptyDislikeIcon",void 0),xr([r()],mr.prototype,"filledDislikeIcon",void 0),xr([l("ft-reader-feedback")],mr.prototype,"readerFeedback",void 0),xr([hr(yr.properties["mail.map_feedback.subject"]((t=>{var e;return[null===(e=t.map)||void 0===e?void 0:e.title]})))],mr.prototype,"mailSubject",void 0);var wr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class $r extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}}class kr extends(function(t){class e extends t{constructor(){super(...arguments),this.disableContextInteractions=!1,this.registerIntervalTopic=0}connectedCallback(){super.connectedCallback(),this.registerIntervalTopic=window.setInterval((()=>this.tryToRegisterToTopicContext()),50)}tryToRegisterToTopicContext(){null!=this.tocNode?window.clearInterval(this.registerIntervalTopic):this.dispatchEvent(new $r)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return wr([s()],e.prototype,"tocNode",void 0),wr([s()],e.prototype,"disableContextInteractions",void 0),e}(bi)){}var Sr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Or extends(nr(kr)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new gr,this.i18nProperties={feedbackMainTitle:dr.properties.topicFeedbackMainTitle(),ratingSectionTitle:dr.properties.topicRatingSectionTitle(),dichotomousRatingSectionTitle:dr.properties.topicDichotomousRatingSectionTitle(),feedbackSectionTitle:dr.properties.topicFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(Gn)}render(){return null==this.map||null==this.tocNode?Q:X`
1313
+ `}updated(t){var e,i,o;super.updated(t),t.has("map")&&this.map&&this.updateData(),["map","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink())&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(o=this.user)||void 0===o?void 0:o.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}onStoreAvailable(t){super.onStoreAvailable(t),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.map&&((null===(t=this.user)||void 0===t?void 0:t.userId)||null==this.ratingSummary)&&(this.ratingSummary=await(null===(e=this.service)||void 0===e?void 0:e.getMapRating()))}))}rate(t){this.ratingSummary&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateMap()):await(null===(i=this.service)||void 0===i?void 0:i.rateMap(null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new $t({type:"error",message:ur.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new $t({type:"info",message:vr.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{this.editorMode?this.dispatchEvent(new $t({type:"info",message:vr.messages.feedbackAndRatingDisabledInEditor()})):(await(null===(e=this.service)||void 0===e?void 0:e.sendMapFeedback(t.detail)),this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackSuccess()}))),this.readerFeedback.clearFeedbackInput()}catch{this.dispatchEvent(new $t({type:"error",message:ur.messages.feedbackFailure()}))}}}$r.elementDefinitions={"ft-reader-feedback":gr},wr([si({store:Gn.name,selector:t=>{var e;return null===(e=t.session)||void 0===e?void 0:e.profile}})],$r.prototype,"user",void 0),wr([si({store:"reader"})],$r.prototype,"map",void 0),wr([si({store:Gn.name})],$r.prototype,"editorMode",void 0),wr([si({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],$r.prototype,"configuration",void 0),wr([s()],$r.prototype,"ratingSummary",void 0),wr([r({type:Boolean})],$r.prototype,"hideTitle",void 0),wr([r()],$r.prototype,"iconVariant",void 0),wr([r()],$r.prototype,"emptyStarIcon",void 0),wr([r()],$r.prototype,"filledStarIcon",void 0),wr([r()],$r.prototype,"emptyLikeIcon",void 0),wr([r()],$r.prototype,"filledLikeIcon",void 0),wr([r()],$r.prototype,"emptyDislikeIcon",void 0),wr([r()],$r.prototype,"filledDislikeIcon",void 0),wr([l("ft-reader-feedback")],$r.prototype,"readerFeedback",void 0),wr([fr(xr.properties["mail.map_feedback.subject"]((t=>{var e;return[null===(e=t.map)||void 0===e?void 0:e.title]})))],$r.prototype,"mailSubject",void 0);var kr=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Sr extends Event{constructor(){super("register-ft-reader-topic-component",{bubbles:!0,composed:!0})}}class Or extends(function(t){class e extends t{constructor(){super(...arguments),this.disableContextInteractions=!1,this.registerIntervalTopic=0}connectedCallback(){super.connectedCallback(),this.registerIntervalTopic=window.setInterval((()=>this.tryToRegisterToTopicContext()),50)}tryToRegisterToTopicContext(){null!=this.tocNode?window.clearInterval(this.registerIntervalTopic):this.dispatchEvent(new Sr)}disconnectedCallback(){super.disconnectedCallback(),this.tocNode=void 0}}return kr([s()],e.prototype,"tocNode",void 0),kr([s()],e.prototype,"disableContextInteractions",void 0),e}(bi)){}var _r=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Cr extends(sr(Or)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=Xo.fluid_topics,this.emptyStarIcon="STAR",this.filledStarIcon="STAR_PLAIN",this.emptyLikeIcon="THUMBS_UP",this.filledLikeIcon="THUMBS_UP_PLAIN",this.emptyDislikeIcon="THUMBS_DOWN",this.filledDislikeIcon="THUMBS_DOWN_PLAIN",this.feedbackLinkBuilder=new mr,this.i18nProperties={feedbackMainTitle:ur.properties.topicFeedbackMainTitle(),ratingSectionTitle:ur.properties.topicRatingSectionTitle(),dichotomousRatingSectionTitle:ur.properties.topicDichotomousRatingSectionTitle(),feedbackSectionTitle:ur.properties.topicFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(Gn)}render(){return null==this.map||null==this.tocNode?Q:X`
1314
1314
  <ft-reader-feedback
1315
1315
  .i18nProperties=${this.i18nProperties}
1316
1316
  ?ratingAllowed=${this.tocNode.hasRating}
@@ -1329,4 +1329,4 @@ const{I:An}=ut,Un=()=>document.createComment(""),zn=(t,e,i)=>{var o;const n=t._$
1329
1329
  @rate=${this.rate}
1330
1330
  @send-feedback=${this.sendFeedback}
1331
1331
  ></ft-reader-feedback>
1332
- `}updated(t){var e,i,o;super.updated(t),["tocNode","user"].some((e=>t.has(e)))&&this.tocNode&&this.updateData(),["map","tocNode","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.tocNode&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink(this.tocNode.tocId))&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(o=this.user)||void 0===o?void 0:o.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.tocNode&&((null===(t=this.user)||void 0===t?void 0:t.userId)||null==this.ratingSummary)&&(this.ratingSummary=await(null===(e=this.service)||void 0===e?void 0:e.getTopicRating(this.tocNode.tocId)))}))}rate(t){this.ratingSummary&&this.tocNode&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{tocId:this.tocNode.tocId,type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary&&this.tocNode){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateTopic(this.tocNode.tocId)):await(null===(i=this.service)||void 0===i?void 0:i.rateTopic(this.tocNode.tocId,null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new $t({type:"error",message:dr.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{!this.editorMode&&this.tocNode?(await(null===(e=this.service)||void 0===e?void 0:e.sendTopicFeedback(this.tocNode.tocId,t.detail)),this.dispatchEvent(new $t({type:"info",message:dr.messages.feedbackSuccess()})),this.readerFeedback.clearFeedbackInput()):this.editorMode&&this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackAndRatingDisabledInEditor()}))}catch{this.dispatchEvent(new $t({type:"error",message:dr.messages.feedbackFailure()}))}}}Or.elementDefinitions={"ft-reader-feedback":br},Sr([si({store:Gn.name,selector:t=>{var e;return null===(e=t.session)||void 0===e?void 0:e.profile}})],Or.prototype,"user",void 0),Sr([si({store:"reader"})],Or.prototype,"map",void 0),Sr([si({store:Gn.name})],Or.prototype,"editorMode",void 0),Sr([si({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],Or.prototype,"configuration",void 0),Sr([s()],Or.prototype,"ratingSummary",void 0),Sr([r({type:Boolean})],Or.prototype,"hideTitle",void 0),Sr([r()],Or.prototype,"iconVariant",void 0),Sr([r()],Or.prototype,"emptyStarIcon",void 0),Sr([r()],Or.prototype,"filledStarIcon",void 0),Sr([r()],Or.prototype,"emptyLikeIcon",void 0),Sr([r()],Or.prototype,"filledLikeIcon",void 0),Sr([r()],Or.prototype,"emptyDislikeIcon",void 0),Sr([r()],Or.prototype,"filledDislikeIcon",void 0),Sr([l("ft-reader-feedback")],Or.prototype,"readerFeedback",void 0),Sr([hr(yr.properties["mail.feedback.subject"]((t=>{var e,i;return[null===(e=t.tocNode)||void 0===e?void 0:e.title,null===(i=t.map)||void 0===i?void 0:i.title]})))],Or.prototype,"mailSubject",void 0),f("ft-reader-map-feedback")(mr),f("ft-reader-topic-feedback")(Or),t.FtReaderFeedbackCssVariables=Io,t.FtReaderMapFeedback=mr,t.FtReaderTopicFeedback=Or,t.styles=To,Object.defineProperty(t,"W",{value:!0})}({});
1332
+ `}updated(t){var e,i,o;super.updated(t),["tocNode","user"].some((e=>t.has(e)))&&this.tocNode&&this.updateData(),["map","tocNode","configuration","user","mailSubject"].some((e=>t.has(e)))&&this.map&&this.tocNode&&this.configuration&&this.feedbackLinkBuilder.update(this.mailSubject,null!==(i=null===(e=this.service)||void 0===e?void 0:e.getLink(this.tocNode.tocId))&&void 0!==i?i:"",this.map.metadata,this.configuration,null!=(null===(o=this.user)||void 0===o?void 0:o.userId))}connectedCallback(){super.connectedCallback(),this.updateData()}updateData(){this.updateDebouncer.run((async()=>{var t,e;this.tocNode&&((null===(t=this.user)||void 0===t?void 0:t.userId)||null==this.ratingSummary)&&(this.ratingSummary=await(null===(e=this.service)||void 0===e?void 0:e.getTopicRating(this.tocNode.tocId)))}))}rate(t){this.ratingSummary&&this.tocNode&&(this.ratingSummary={...this.ratingSummary,rating:null==t.detail?void 0:{tocId:this.tocNode.tocId,type:this.ratingSummary.type,value:t.detail,date:new Date}},this.sendRatingDebouncer.run((()=>this.sendRating(t.detail))))}async sendRating(t){var e,i,o;if(!this.editorMode&&this.ratingSummary&&this.tocNode){try{null==t?await(null===(e=this.service)||void 0===e?void 0:e.unrateTopic(this.tocNode.tocId)):await(null===(i=this.service)||void 0===i?void 0:i.rateTopic(this.tocNode.tocId,null===(o=this.ratingSummary)||void 0===o?void 0:o.type,t))}catch{this.dispatchEvent(new $t({type:"error",message:ur.messages.ratingFailure()}))}this.updateData()}else this.editorMode&&this.dispatchEvent(new $t({type:"info",message:vr.messages.feedbackAndRatingDisabledInEditor()}))}async sendFeedback(t){var e;try{!this.editorMode&&this.tocNode?(await(null===(e=this.service)||void 0===e?void 0:e.sendTopicFeedback(this.tocNode.tocId,t.detail)),this.dispatchEvent(new $t({type:"info",message:ur.messages.feedbackSuccess()})),this.readerFeedback.clearFeedbackInput()):this.editorMode&&this.dispatchEvent(new $t({type:"info",message:vr.messages.feedbackAndRatingDisabledInEditor()}))}catch{this.dispatchEvent(new $t({type:"error",message:ur.messages.feedbackFailure()}))}}}Cr.elementDefinitions={"ft-reader-feedback":gr},_r([si({store:Gn.name,selector:t=>{var e;return null===(e=t.session)||void 0===e?void 0:e.profile}})],Cr.prototype,"user",void 0),_r([si({store:"reader"})],Cr.prototype,"map",void 0),_r([si({store:Gn.name})],Cr.prototype,"editorMode",void 0),_r([si({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],Cr.prototype,"configuration",void 0),_r([s()],Cr.prototype,"ratingSummary",void 0),_r([r({type:Boolean})],Cr.prototype,"hideTitle",void 0),_r([r()],Cr.prototype,"iconVariant",void 0),_r([r()],Cr.prototype,"emptyStarIcon",void 0),_r([r()],Cr.prototype,"filledStarIcon",void 0),_r([r()],Cr.prototype,"emptyLikeIcon",void 0),_r([r()],Cr.prototype,"filledLikeIcon",void 0),_r([r()],Cr.prototype,"emptyDislikeIcon",void 0),_r([r()],Cr.prototype,"filledDislikeIcon",void 0),_r([l("ft-reader-feedback")],Cr.prototype,"readerFeedback",void 0),_r([fr(xr.properties["mail.feedback.subject"]((t=>{var e,i;return[null===(e=t.tocNode)||void 0===e?void 0:e.title,null===(i=t.map)||void 0===i?void 0:i.title]})))],Cr.prototype,"mailSubject",void 0),f("ft-reader-map-feedback")($r),f("ft-reader-topic-feedback")(Cr),t.FtReaderFeedbackCssVariables=Io,t.FtReaderMapFeedback=$r,t.FtReaderTopicFeedback=Cr,t.styles=To,Object.defineProperty(t,"W",{value:!0})}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "0.3.65",
3
+ "version": "0.3.66",
4
4
  "description": "Feedback forms for a map and its topics in an integrated reader",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,10 +19,10 @@
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": "0.3.65",
23
- "@fluid-topics/ft-reader-context": "0.3.65",
24
- "@fluid-topics/ft-wc-utils": "0.3.65",
22
+ "@fluid-topics/ft-app-context": "0.3.66",
23
+ "@fluid-topics/ft-reader-context": "0.3.66",
24
+ "@fluid-topics/ft-wc-utils": "0.3.66",
25
25
  "lit": "2.2.8"
26
26
  },
27
- "gitHead": "e19de923a28e68d55617219545fb7398511e8a77"
27
+ "gitHead": "cc454945c8f6b47494dc634da0613dabeed53c14"
28
28
  }