@fluid-topics/ft-reader-feedback 1.1.32 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-reader-feedback.js +6 -1
- package/build/ft-reader-feedback.light.js +3 -3
- package/build/ft-reader-feedback.min.js +3 -3
- package/build/utils/events.d.ts +4 -2
- package/build/utils/events.js +2 -2
- package/build/utils/mail.d.ts +2 -1
- package/build/utils/mail.js +10 -4
- package/package.json +5 -5
|
@@ -237,7 +237,12 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
|
|
|
237
237
|
}
|
|
238
238
|
onFormSubmitEvent(event, isUsingMailLink) {
|
|
239
239
|
event.preventDefault();
|
|
240
|
-
|
|
240
|
+
if (isUsingMailLink) {
|
|
241
|
+
this.onMailerFeedbackSent();
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
this.sendFeedback();
|
|
245
|
+
}
|
|
241
246
|
}
|
|
242
247
|
validFromEmail() {
|
|
243
248
|
var _a, _b, _c;
|
|
@@ -1312,7 +1312,7 @@ const we=Symbol.for(""),Oe=t=>{if(t?.r===we)return t?._$litStatic$},Se=t=>({_$li
|
|
|
1312
1312
|
<span class="ft-i18n">
|
|
1313
1313
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1314
1314
|
</span>
|
|
1315
|
-
`:this.editorMode?"Select a context and a label key.":o.nothing}update(t){var e;super.update(t),this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}Gi.elementDefinitions={},Gi.styles=$i,ji([e.redux()],Gi.prototype,"editorMode",void 0),ji([i.property()],Gi.prototype,"context",void 0),ji([i.property()],Gi.prototype,"key",void 0),ji([e.jsonProperty([])],Gi.prototype,"args",void 0),ji([i.property()],Gi.prototype,"defaultMessage",void 0);class Vi{static build(t){return new Vi(t)}static fromGwt(t){return new Vi(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Ui.resolveMessage(this.name,e,...t)})}}const Yi=(t,e)=>(o,i)=>{var r,n;o.constructor.createProperty(i,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:i};o[Ki]=null!==(n=o[Ki])&&void 0!==n?n:new Map,o[Ki].set(i,a)};e.customElement("ft-i18n")(Gi);const qi=Vi.build("integratedFeedbackComponent"),Xi={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?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",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"},Qi={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:e.FtCssVariableFactory.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:e.FtCssVariableFactory.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:e.FtCssVariableFactory.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:e.FtCssVariableFactory.extend("--ft-text-field-helper-color","",e.designSystemVariables.colorOnSurfaceMedium),colorPrimary:e.FtCssVariableFactory.external(e.designSystemVariables.colorPrimary,"Design system"),colorOnSurface:e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurface,"Design system"),colorOnSurfaceDisabled:e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurfaceDisabled,"Design system"),borderRadiusS:e.FtCssVariableFactory.external(e.designSystemVariables.borderRadiusS,"Design system"),colorError:e.FtCssVariableFactory.external(e.designSystemVariables.colorError,"Design system"),prefixColor:e.FtCssVariableFactory.extend("--ft-text-field-prefix-color","",e.designSystemVariables.colorOnSurfaceMedium),iconColor:e.FtCssVariableFactory.extend("--ft-text-field-icon-color","",e.designSystemVariables.colorOnSurfaceMedium),floatingZIndex:e.FtCssVariableFactory.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:e.FtCssVariableFactory.external(e.designSystemVariables.colorSurface,"Design system"),colorOutline:e.FtCssVariableFactory.external(e.designSystemVariables.colorOutline,"Design system"),elevation02:e.FtCssVariableFactory.external(e.designSystemVariables.elevation02,"Design system"),suggestSize:e.FtCssVariableFactory.create("--ft-text-field-suggest-size","","SIZE","300px")},Ji=o.css`
|
|
1315
|
+
`:this.editorMode?"Select a context and a label key.":o.nothing}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}Gi.elementDefinitions={},Gi.styles=$i,ji([e.redux()],Gi.prototype,"editorMode",void 0),ji([i.property()],Gi.prototype,"context",void 0),ji([i.property()],Gi.prototype,"key",void 0),ji([e.jsonProperty([])],Gi.prototype,"args",void 0),ji([i.property()],Gi.prototype,"defaultMessage",void 0);class Vi{static build(t){return new Vi(t)}static fromGwt(t){return new Vi(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Ui.resolveMessage(this.name,e,...t)})}}const Yi=(t,e)=>(o,i)=>{var r,n;o.constructor.createProperty(i,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:i};o[Ki]=null!==(n=o[Ki])&&void 0!==n?n:new Map,o[Ki].set(i,a)};e.customElement("ft-i18n")(Gi);const qi=Vi.build("integratedFeedbackComponent"),Xi={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?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",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"},Qi={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:e.FtCssVariableFactory.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:e.FtCssVariableFactory.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:e.FtCssVariableFactory.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:e.FtCssVariableFactory.extend("--ft-text-field-helper-color","",e.designSystemVariables.colorOnSurfaceMedium),colorPrimary:e.FtCssVariableFactory.external(e.designSystemVariables.colorPrimary,"Design system"),colorOnSurface:e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurface,"Design system"),colorOnSurfaceDisabled:e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurfaceDisabled,"Design system"),borderRadiusS:e.FtCssVariableFactory.external(e.designSystemVariables.borderRadiusS,"Design system"),colorError:e.FtCssVariableFactory.external(e.designSystemVariables.colorError,"Design system"),prefixColor:e.FtCssVariableFactory.extend("--ft-text-field-prefix-color","",e.designSystemVariables.colorOnSurfaceMedium),iconColor:e.FtCssVariableFactory.extend("--ft-text-field-icon-color","",e.designSystemVariables.colorOnSurfaceMedium),floatingZIndex:e.FtCssVariableFactory.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:e.FtCssVariableFactory.external(e.designSystemVariables.colorSurface,"Design system"),colorOutline:e.FtCssVariableFactory.external(e.designSystemVariables.colorOutline,"Design system"),elevation02:e.FtCssVariableFactory.external(e.designSystemVariables.elevation02,"Design system"),suggestSize:e.FtCssVariableFactory.create("--ft-text-field-suggest-size","","SIZE","300px")},Ji=o.css`
|
|
1316
1316
|
*:focus {
|
|
1317
1317
|
outline: none;
|
|
1318
1318
|
}
|
|
@@ -1565,7 +1565,7 @@ const we=Symbol.for(""),Oe=t=>{if(t?.r===we)return t?._$litStatic$},Se=t=>({_$li
|
|
|
1565
1565
|
<style>
|
|
1566
1566
|
@import "${i}"
|
|
1567
1567
|
</style>
|
|
1568
|
-
`}get stateManager(){return null==this._stateManager&&(this._stateManager=Ur.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new Wr(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new Dr(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new Tr(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new Fr),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new zr):403===e.status?this.dispatchEvent(new Br):404===e.status?this.dispatchEvent(new Ar):this.dispatchEvent(new _r(t))}reloadBookmarks(){Bi.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var Mr;Zr.styles=Lr,Kr([e.redux({store:Ci.name})],Zr.prototype,"baseUrl",void 0),Kr([i.property()],Zr.prototype,"mapId",void 0),Kr([i.property()],Zr.prototype,"tocId",void 0),Kr([i.property()],Zr.prototype,"section",void 0),Kr([i.property()],Zr.prototype,"topicPivot",void 0),Kr([i.property()],Zr.prototype,"searchInDocumentQuery",void 0),Kr([i.property({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:Mr}})],Zr.prototype,"page",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"map",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"toc",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"visibleTopics",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"currentPage",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"scrollTarget",void 0),Kr([i.property({attribute:!1})],Zr.prototype,"readerServiceProvider",void 0),e.customElement("ft-reader-context")(Zr);class Pr extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class Hr extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class jr extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class Gr extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class Vr extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var Yr=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class qr extends(Mi(f)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",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(qi,Xi)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(s.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(s.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}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,o;return null!==(o=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==o?o:"NO_RATING"}get ratingValue(){var t,e,o;return null!==(o=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==o?o:-1}get ratingDate(){var t,o;const i=null===(o=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===o?void 0:o.date;return"string"==typeof i?e.parseDate(i):i}render(){return this.canAccessFeedback||this.canAccessRating?o.html`
|
|
1568
|
+
`}get stateManager(){return null==this._stateManager&&(this._stateManager=Ur.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new Wr(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new Dr(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new Tr(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new Fr),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new zr):403===e.status?this.dispatchEvent(new Br):404===e.status?this.dispatchEvent(new Ar):this.dispatchEvent(new _r(t))}reloadBookmarks(){Bi.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var Mr;Zr.styles=Lr,Kr([e.redux({store:Ci.name})],Zr.prototype,"baseUrl",void 0),Kr([i.property()],Zr.prototype,"mapId",void 0),Kr([i.property()],Zr.prototype,"tocId",void 0),Kr([i.property()],Zr.prototype,"section",void 0),Kr([i.property()],Zr.prototype,"topicPivot",void 0),Kr([i.property()],Zr.prototype,"searchInDocumentQuery",void 0),Kr([i.property({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:Mr}})],Zr.prototype,"page",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"map",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"toc",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"visibleTopics",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"currentPage",void 0),Kr([e.redux({store:"reader"})],Zr.prototype,"scrollTarget",void 0),Kr([i.property({attribute:!1})],Zr.prototype,"readerServiceProvider",void 0),e.customElement("ft-reader-context")(Zr);class Pr extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class Hr extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class jr extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class Gr extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:{topic:t}})}}class Vr extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var Yr=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class qr extends(Mi(f)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",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(qi,Xi)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(s.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(s.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}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,o;return null!==(o=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.type)&&void 0!==o?o:"NO_RATING"}get ratingValue(){var t,e,o;return null!==(o=null===(e=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===e?void 0:e.value)&&void 0!==o?o:-1}get ratingDate(){var t,o;const i=null===(o=null===(t=this.ratingSummary)||void 0===t?void 0:t.rating)||void 0===o?void 0:o.date;return"string"==typeof i?e.parseDate(i):i}render(){return this.canAccessFeedback||this.canAccessRating?o.html`
|
|
1569
1569
|
<div class="ft-reader-feedback">
|
|
1570
1570
|
${this.hideTitle?o.nothing:o.html`
|
|
1571
1571
|
<ft-typography variant="title" part="main-title">
|
|
@@ -1673,7 +1673,7 @@ const we=Symbol.for(""),Oe=t=>{if(t?.r===we)return t?._$litStatic$},Se=t=>({_$li
|
|
|
1673
1673
|
${s}
|
|
1674
1674
|
</div>
|
|
1675
1675
|
</form>
|
|
1676
|
-
`}return o.nothing}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,o;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(o=this.configuration)||void 0===o?void 0:o.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new Pr({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}qr.elementDefinitions={"ft-button":xi,"ft-typography":ke,"ft-switch":ei,"ft-switch-option":Qo,"ft-text-area":gi,"ft-text-field":er},qr.styles=zt,Yr([i.property({type:Boolean})],qr.prototype,"editorMode",void 0),Yr([i.property({type:Boolean})],qr.prototype,"hideTitle",void 0),Yr([i.property({type:Boolean})],qr.prototype,"withMoreOptionsButton",void 0),Yr([i.property({type:Boolean})],qr.prototype,"ratingAllowed",void 0),Yr([i.property({attribute:!1})],qr.prototype,"i18nProperties",void 0),Yr([i.property({attribute:!1})],qr.prototype,"ratingSummary",void 0),Yr([i.property({attribute:!1})],qr.prototype,"session",void 0),Yr([i.query(".ft-reader-feedback--feedback-input")],qr.prototype,"feedbackInput",void 0),Yr([i.state()],qr.prototype,"from",void 0),Yr([i.state()],qr.prototype,"feedbackMessage",void 0),Yr([i.property()],qr.prototype,"iconVariant",void 0),Yr([i.property()],qr.prototype,"emptyStarIcon",void 0),Yr([i.property()],qr.prototype,"filledStarIcon",void 0),Yr([i.property()],qr.prototype,"emptyLikeIcon",void 0),Yr([i.property()],qr.prototype,"filledLikeIcon",void 0),Yr([i.property()],qr.prototype,"emptyDislikeIcon",void 0),Yr([i.property()],qr.prototype,"filledDislikeIcon",void 0),Yr([e.redux({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],qr.prototype,"configuration",void 0),Yr([i.property()],qr.prototype,"feedbackMailLinkBuilder",void 0);const Xr=Vi.fromGwt("server");class Qr{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,o,i,r){var n;this.subject=t,this.url=e,this.configuration=i,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(o,i.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(o,null!==(n=i.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}
|
|
1676
|
+
`}return o.nothing}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,o;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(o=this.configuration)||void 0===o?void 0:o.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new Pr({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}qr.elementDefinitions={"ft-button":xi,"ft-typography":ke,"ft-switch":ei,"ft-switch-option":Qo,"ft-text-area":gi,"ft-text-field":er},qr.styles=zt,Yr([i.property({type:Boolean})],qr.prototype,"editorMode",void 0),Yr([i.property({type:Boolean})],qr.prototype,"hideTitle",void 0),Yr([i.property({type:Boolean})],qr.prototype,"withMoreOptionsButton",void 0),Yr([i.property({type:Boolean})],qr.prototype,"ratingAllowed",void 0),Yr([i.property({attribute:!1})],qr.prototype,"i18nProperties",void 0),Yr([i.property({attribute:!1})],qr.prototype,"ratingSummary",void 0),Yr([i.property({attribute:!1})],qr.prototype,"session",void 0),Yr([i.query(".ft-reader-feedback--feedback-input")],qr.prototype,"feedbackInput",void 0),Yr([i.state()],qr.prototype,"from",void 0),Yr([i.state()],qr.prototype,"feedbackMessage",void 0),Yr([i.property()],qr.prototype,"iconVariant",void 0),Yr([i.property()],qr.prototype,"emptyStarIcon",void 0),Yr([i.property()],qr.prototype,"filledStarIcon",void 0),Yr([i.property()],qr.prototype,"emptyLikeIcon",void 0),Yr([i.property()],qr.prototype,"filledLikeIcon",void 0),Yr([i.property()],qr.prototype,"emptyDislikeIcon",void 0),Yr([i.property()],qr.prototype,"filledDislikeIcon",void 0),Yr([e.redux({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],qr.prototype,"configuration",void 0),Yr([i.property()],qr.prototype,"feedbackMailLinkBuilder",void 0);const Xr=Vi.fromGwt("server");class Qr{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,o,i,r){var n;this.subject=t,this.url=e,this.configuration=i,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(o,i.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(o,null!==(n=i.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}shouldUseMailer(){var t,e;const o=this.isAuthenticated&&!(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopics),i=!this.isAuthenticated&&!(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopicsForUnauthenticatedUsers);return o||i}build(t){var e;if(null!=t&&0===t.length||!this.shouldUseMailer())return;const o=encodeURIComponent(this.subject+" "+this.subjectMetadata),i=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${null!=t?t:""}\n\n_________________________________________________________________\n${Xr.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(e=this.configuration)||void 0===e?void 0:e.recipients.join(",")}?subject=${o}&body=${i}`}}const Jr=Vi.build("inDesignerFeedbackComponent"),tn={feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var en=function(t,e,o,i){for(var r,n=arguments.length,a=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,o,a):r(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class on extends(Mi(f)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=Zo.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 Qr,this.i18nProperties={feedbackMainTitle:qi.properties.mapFeedbackMainTitle(),ratingSectionTitle:qi.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:qi.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:qi.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new e.Debouncer(100),this.sendRatingDebouncer=new e.Debouncer(500),this.addStore(Ci)}render(){return o.html`
|
|
1677
1677
|
<ft-reader-feedback
|
|
1678
1678
|
ratingAllowed
|
|
1679
1679
|
.i18nProperties=${this.i18nProperties}
|
|
@@ -1465,7 +1465,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
|
|
|
1465
1465
|
<span class="ft-i18n">
|
|
1466
1466
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
1467
1467
|
</span>
|
|
1468
|
-
`:this.editorMode?"Select a context and a label key.":pe}update(t){var e;super.update(t),this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}gl.elementDefinitions={},gl.styles=Gs,yl([Ji()],gl.prototype,"editorMode",void 0),yl([I()],gl.prototype,"context",void 0),yl([I()],gl.prototype,"key",void 0),yl([F([])],gl.prototype,"args",void 0),yl([I()],gl.prototype,"defaultMessage",void 0);class bl{static build(t){return new bl(t)}static fromGwt(t){return new bl(t)}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)=>tl.resolveMessage(this.name,e,...t)})}}const vl=(t,e)=>(i,o)=>{var r,n;i.constructor.createProperty(o,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:o};i[fl]=null!==(n=i[fl])&&void 0!==n?n:new Map,i[fl].set(o,a)};M("ft-i18n")(gl);const ml=bl.build("integratedFeedbackComponent"),xl={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?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",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"},wl={fontSize:Re.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:Re.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:Re.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:Re.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:Re.extend("--ft-text-field-helper-color","",We.colorOnSurfaceMedium),colorPrimary:Re.external(We.colorPrimary,"Design system"),colorOnSurface:Re.external(We.colorOnSurface,"Design system"),colorOnSurfaceDisabled:Re.external(We.colorOnSurfaceDisabled,"Design system"),borderRadiusS:Re.external(We.borderRadiusS,"Design system"),colorError:Re.external(We.colorError,"Design system"),prefixColor:Re.extend("--ft-text-field-prefix-color","",We.colorOnSurfaceMedium),iconColor:Re.extend("--ft-text-field-icon-color","",We.colorOnSurfaceMedium),floatingZIndex:Re.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:Re.external(We.colorSurface,"Design system"),colorOutline:Re.external(We.colorOutline,"Design system"),elevation02:Re.external(We.elevation02,"Design system"),suggestSize:Re.create("--ft-text-field-suggest-size","","SIZE","300px")},Ol=Rt`
|
|
1468
|
+
`:this.editorMode?"Select a context and a label key.":pe}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}gl.elementDefinitions={},gl.styles=Gs,yl([Ji()],gl.prototype,"editorMode",void 0),yl([I()],gl.prototype,"context",void 0),yl([I()],gl.prototype,"key",void 0),yl([F([])],gl.prototype,"args",void 0),yl([I()],gl.prototype,"defaultMessage",void 0);class bl{static build(t){return new bl(t)}static fromGwt(t){return new bl(t)}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)=>tl.resolveMessage(this.name,e,...t)})}}const vl=(t,e)=>(i,o)=>{var r,n;i.constructor.createProperty(o,null!=e?e:{attribute:!1,type:String});const a={...t,key:null!==(r=t.key)&&void 0!==r?r:o};i[fl]=null!==(n=i[fl])&&void 0!==n?n:new Map,i[fl].set(o,a)};M("ft-i18n")(gl);const ml=bl.build("integratedFeedbackComponent"),xl={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?",feedbackfromEmail:"Your email",feedbackfromEmailInvalid:"Please enter a valid email address",okButton:"Send feedback",cancelButton:"Cancel",moreOptionsButton:"More options",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"},wl={fontSize:Re.create("--ft-text-field-font-size","","SIZE","14px"),labelSize:Re.create("--ft-text-field-label-size","","SIZE","11px"),verticalSpacing:Re.create("--ft-text-field-vertical-spacing","","SIZE","4px"),horizontalSpacing:Re.create("--ft-text-field-horizontal-spacing","","SIZE","16px"),helperColor:Re.extend("--ft-text-field-helper-color","",We.colorOnSurfaceMedium),colorPrimary:Re.external(We.colorPrimary,"Design system"),colorOnSurface:Re.external(We.colorOnSurface,"Design system"),colorOnSurfaceDisabled:Re.external(We.colorOnSurfaceDisabled,"Design system"),borderRadiusS:Re.external(We.borderRadiusS,"Design system"),colorError:Re.external(We.colorError,"Design system"),prefixColor:Re.extend("--ft-text-field-prefix-color","",We.colorOnSurfaceMedium),iconColor:Re.extend("--ft-text-field-icon-color","",We.colorOnSurfaceMedium),floatingZIndex:Re.create("--ft-text-field-floating-components-z-index","","NUMBER","3"),colorSurface:Re.external(We.colorSurface,"Design system"),colorOutline:Re.external(We.colorOutline,"Design system"),elevation02:Re.external(We.elevation02,"Design system"),suggestSize:Re.create("--ft-text-field-suggest-size","","SIZE","300px")},Ol=Rt`
|
|
1469
1469
|
*:focus {
|
|
1470
1470
|
outline: none;
|
|
1471
1471
|
}
|
|
@@ -1718,7 +1718,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
|
|
|
1718
1718
|
<style>
|
|
1719
1719
|
@import "${i}"
|
|
1720
1720
|
</style>
|
|
1721
|
-
`}get stateManager(){return null==this._stateManager&&(this._stateManager=tc.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new ic(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new rc(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new oc(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new cc),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new sc):403===e.status?this.dispatchEvent(new lc):404===e.status?this.dispatchEvent(new ac):this.dispatchEvent(new nc(t))}reloadBookmarks(){ll.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var dc;hc.styles=ec,fc([Ji({store:qs.name})],hc.prototype,"baseUrl",void 0),fc([I()],hc.prototype,"mapId",void 0),fc([I()],hc.prototype,"tocId",void 0),fc([I()],hc.prototype,"section",void 0),fc([I()],hc.prototype,"topicPivot",void 0),fc([I()],hc.prototype,"searchInDocumentQuery",void 0),fc([I({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:dc}})],hc.prototype,"page",void 0),fc([Ji({store:"reader"})],hc.prototype,"map",void 0),fc([Ji({store:"reader"})],hc.prototype,"toc",void 0),fc([Ji({store:"reader"})],hc.prototype,"visibleTopics",void 0),fc([Ji({store:"reader"})],hc.prototype,"currentPage",void 0),fc([Ji({store:"reader"})],hc.prototype,"scrollTarget",void 0),fc([I({attribute:!1})],hc.prototype,"readerServiceProvider",void 0),M("ft-reader-context")(hc);class uc extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class pc extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class yc extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class gc extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class bc extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var vc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class mc extends(dl(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",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(ml,xl)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}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.canAccessFeedback||this.canAccessRating?de`
|
|
1721
|
+
`}get stateManager(){return null==this._stateManager&&(this._stateManager=tc.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&(this.stateManager.setMapId(this.mapId),this.lastNotifiedNotFoundRelative=void 0),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new ic(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new rc(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new oc(this.map,e))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.lastNotifiedNotFoundRelative===this.mapId+this.topicPivot?this.lastNotifiedNotFoundRelative=void 0:(this.dispatchEvent(new cc),this.lastNotifiedNotFoundRelative=this.mapId+this.topicPivot)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;401===e.status?this.dispatchEvent(new sc):403===e.status?this.dispatchEvent(new lc):404===e.status?this.dispatchEvent(new ac):this.dispatchEvent(new nc(t))}reloadBookmarks(){ll.reloadBookmarks()}async reloadRating(){var t,e;await(null===(t=this.stateManager.service)||void 0===t?void 0:t.reloadRating()),null===(e=this.stateManager.store)||void 0===e||e.eventBus.dispatchEvent(new CustomEvent("rating-changed"))}}var dc;hc.styles=ec,fc([Ji({store:qs.name})],hc.prototype,"baseUrl",void 0),fc([I()],hc.prototype,"mapId",void 0),fc([I()],hc.prototype,"tocId",void 0),fc([I()],hc.prototype,"section",void 0),fc([I()],hc.prototype,"topicPivot",void 0),fc([I()],hc.prototype,"searchInDocumentQuery",void 0),fc([I({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:dc}})],hc.prototype,"page",void 0),fc([Ji({store:"reader"})],hc.prototype,"map",void 0),fc([Ji({store:"reader"})],hc.prototype,"toc",void 0),fc([Ji({store:"reader"})],hc.prototype,"visibleTopics",void 0),fc([Ji({store:"reader"})],hc.prototype,"currentPage",void 0),fc([Ji({store:"reader"})],hc.prototype,"scrollTarget",void 0),fc([I({attribute:!1})],hc.prototype,"readerServiceProvider",void 0),M("ft-reader-context")(hc);class uc extends CustomEvent{constructor(t){super("send-feedback",{detail:t})}}class pc extends CustomEvent{constructor(t){super("ft-reader-topic-feedback",{composed:!0,bubbles:!0,detail:t})}}class yc extends CustomEvent{constructor(t){super("ft-reader-feedback",{composed:!0,bubbles:!0,detail:t})}}class gc extends CustomEvent{constructor(t){super("ft-reader-mailer-topic-feedback",{composed:!0,bubbles:!0,detail:{topic:t}})}}class bc extends CustomEvent{constructor(){super("ft-reader-mailer-map-feedback",{composed:!0,bubbles:!0})}}var vc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class mc extends(dl(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.ratingAllowed=!1,this.from="",this.feedbackMessage="",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(ml,xl)}get canAccessFeedback(){var t;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.FEEDBACK,{session:this.session})}get canAccessRating(){var t,e;return null===(t=this.service)||void 0===t?void 0:t.isFeatureAccessible(nn.RATING,{session:this.session,ratingType:null===(e=this.ratingSummary)||void 0===e?void 0:e.type})}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.canAccessFeedback||this.canAccessRating?de`
|
|
1722
1722
|
<div class="ft-reader-feedback">
|
|
1723
1723
|
${this.hideTitle?pe:de`
|
|
1724
1724
|
<ft-typography variant="title" part="main-title">
|
|
@@ -1826,7 +1826,7 @@ const{D:Us}=Ot,Ls=()=>document.createComment(""),As=(t,e,i)=>{const o=t._$AA.par
|
|
|
1826
1826
|
${a}
|
|
1827
1827
|
</div>
|
|
1828
1828
|
</form>
|
|
1829
|
-
`}return pe}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,i;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(i=this.configuration)||void 0===i?void 0:i.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new uc({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}mc.elementDefinitions={"ft-button":js,"ft-typography":Ma,"ft-switch":gs,"ft-switch-option":us,"ft-text-area":Rs,"ft-text-field":Nl},mc.styles=Ra,vc([I({type:Boolean})],mc.prototype,"editorMode",void 0),vc([I({type:Boolean})],mc.prototype,"hideTitle",void 0),vc([I({type:Boolean})],mc.prototype,"withMoreOptionsButton",void 0),vc([I({type:Boolean})],mc.prototype,"ratingAllowed",void 0),vc([I({attribute:!1})],mc.prototype,"i18nProperties",void 0),vc([I({attribute:!1})],mc.prototype,"ratingSummary",void 0),vc([I({attribute:!1})],mc.prototype,"session",void 0),vc([A(".ft-reader-feedback--feedback-input")],mc.prototype,"feedbackInput",void 0),vc([R()],mc.prototype,"from",void 0),vc([R()],mc.prototype,"feedbackMessage",void 0),vc([I()],mc.prototype,"iconVariant",void 0),vc([I()],mc.prototype,"emptyStarIcon",void 0),vc([I()],mc.prototype,"filledStarIcon",void 0),vc([I()],mc.prototype,"emptyLikeIcon",void 0),vc([I()],mc.prototype,"filledLikeIcon",void 0),vc([I()],mc.prototype,"emptyDislikeIcon",void 0),vc([I()],mc.prototype,"filledDislikeIcon",void 0),vc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],mc.prototype,"configuration",void 0),vc([I()],mc.prototype,"feedbackMailLinkBuilder",void 0);const xc=bl.fromGwt("server");class wc{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,o,r){var n;this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(i,o.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(i,null!==(n=o.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}
|
|
1829
|
+
`}return pe}onFormSubmitEvent(t,e){t.preventDefault(),e?this.onMailerFeedbackSent():this.sendFeedback()}validFromEmail(){var t,e,i;return!(null==(null===(e=null===(t=this.session)||void 0===t?void 0:t.profile)||void 0===e?void 0:e.userId)&&(null===(i=this.configuration)||void 0===i?void 0:i.mailsSentByFluidTopicsForUnauthenticatedUsers))||/^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/.test(this.from)}sendFeedback(){var t;this.dispatchEvent(new uc({message:this.feedbackInput.value,...(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopicsForUnauthenticatedUsers)&&{from:this.from}}))}onMailerFeedbackSent(){this.dispatchEvent(new CustomEvent("mailer-feedback"))}onOpenMoreDetails(){this.dispatchEvent(new CustomEvent("open-more-options"))}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}mc.elementDefinitions={"ft-button":js,"ft-typography":Ma,"ft-switch":gs,"ft-switch-option":us,"ft-text-area":Rs,"ft-text-field":Nl},mc.styles=Ra,vc([I({type:Boolean})],mc.prototype,"editorMode",void 0),vc([I({type:Boolean})],mc.prototype,"hideTitle",void 0),vc([I({type:Boolean})],mc.prototype,"withMoreOptionsButton",void 0),vc([I({type:Boolean})],mc.prototype,"ratingAllowed",void 0),vc([I({attribute:!1})],mc.prototype,"i18nProperties",void 0),vc([I({attribute:!1})],mc.prototype,"ratingSummary",void 0),vc([I({attribute:!1})],mc.prototype,"session",void 0),vc([A(".ft-reader-feedback--feedback-input")],mc.prototype,"feedbackInput",void 0),vc([R()],mc.prototype,"from",void 0),vc([R()],mc.prototype,"feedbackMessage",void 0),vc([I()],mc.prototype,"iconVariant",void 0),vc([I()],mc.prototype,"emptyStarIcon",void 0),vc([I()],mc.prototype,"filledStarIcon",void 0),vc([I()],mc.prototype,"emptyLikeIcon",void 0),vc([I()],mc.prototype,"filledLikeIcon",void 0),vc([I()],mc.prototype,"emptyDislikeIcon",void 0),vc([I()],mc.prototype,"filledDislikeIcon",void 0),vc([Ji({store:"reader",selector:t=>{var e;return null===(e=t.configuration)||void 0===e?void 0:e.feedback}})],mc.prototype,"configuration",void 0),vc([I()],mc.prototype,"feedbackMailLinkBuilder",void 0);const xc=bl.fromGwt("server");class wc{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,o,r){var n;this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=r,this.subjectMetadata=this.filterMetadata(i,o.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(i,null!==(n=o.bodyMetadataIds)&&void 0!==n?n:[]).map((t=>"["+t.values.join(", ")+"]")).join(" ")}filterMetadata(t,e){return e.map((e=>t.find((t=>t.key===e)))).filter((t=>null!=t&&t.values.length>0))}shouldUseMailer(){var t,e;const i=this.isAuthenticated&&!(null===(t=this.configuration)||void 0===t?void 0:t.mailsSentByFluidTopics),o=!this.isAuthenticated&&!(null===(e=this.configuration)||void 0===e?void 0:e.mailsSentByFluidTopicsForUnauthenticatedUsers);return i||o}build(t){var e;if(null!=t&&0===t.length||!this.shouldUseMailer())return;const i=encodeURIComponent(this.subject+" "+this.subjectMetadata),o=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${null!=t?t:""}\n\n_________________________________________________________________\n${xc.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(e=this.configuration)||void 0===e?void 0:e.recipients.join(",")}?subject=${i}&body=${o}`}}const Oc=bl.build("inDesignerFeedbackComponent"),Sc={feedbackAndRatingDisabledInEditor:"Feedback and ratings performed here are not taken into account."};var Nc=function(t,e,i,o){for(var r,n=arguments.length,a=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,s=t.length-1;s>=0;s--)(r=t[s])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a};class $c extends(dl(cn)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.withMoreOptionsButton=!1,this.iconVariant=ns.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 wc,this.i18nProperties={feedbackMainTitle:ml.properties.mapFeedbackMainTitle(),ratingSectionTitle:ml.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:ml.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:ml.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new n(100),this.sendRatingDebouncer=new n(500),this.addStore(qs)}render(){return de`
|
|
1830
1830
|
<ft-reader-feedback
|
|
1831
1831
|
ratingAllowed
|
|
1832
1832
|
.i18nProperties=${this.i18nProperties}
|
package/build/utils/events.d.ts
CHANGED
|
@@ -31,8 +31,10 @@ interface OpenMapFeedbackDrawerEventDetail {
|
|
|
31
31
|
export declare class OpenMapFeedbackDrawerEvent extends CustomEvent<OpenMapFeedbackDrawerEventDetail> {
|
|
32
32
|
constructor(detail: OpenMapFeedbackDrawerEventDetail);
|
|
33
33
|
}
|
|
34
|
-
export declare class SendMailerTopicFeedbackEvent extends CustomEvent<
|
|
35
|
-
|
|
34
|
+
export declare class SendMailerTopicFeedbackEvent extends CustomEvent<{
|
|
35
|
+
topic: FtReaderTocNode | undefined;
|
|
36
|
+
}> {
|
|
37
|
+
constructor(topic?: FtReaderTocNode);
|
|
36
38
|
}
|
|
37
39
|
export declare class SendMailerMapFeedbackEvent extends CustomEvent<any> {
|
|
38
40
|
constructor();
|
package/build/utils/events.js
CHANGED
|
@@ -24,11 +24,11 @@ export class OpenMapFeedbackDrawerEvent extends CustomEvent {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
export class SendMailerTopicFeedbackEvent extends CustomEvent {
|
|
27
|
-
constructor(
|
|
27
|
+
constructor(topic) {
|
|
28
28
|
super("ft-reader-mailer-topic-feedback", {
|
|
29
29
|
composed: true,
|
|
30
30
|
bubbles: true,
|
|
31
|
-
detail
|
|
31
|
+
detail: { topic }
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
}
|
package/build/utils/mail.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export declare class FeedbackMailLinkBuilder {
|
|
|
8
8
|
private isAuthenticated;
|
|
9
9
|
update(subject: string, url: string, metadata: Array<FtMetadata>, configuration: FtReaderFeedbackConfiguration, isAuthenticated: boolean): void;
|
|
10
10
|
private filterMetadata;
|
|
11
|
-
|
|
11
|
+
shouldUseMailer(): boolean;
|
|
12
|
+
build(feedbackMessage?: string): string | undefined;
|
|
12
13
|
}
|
package/build/utils/mail.js
CHANGED
|
@@ -24,9 +24,15 @@ export class FeedbackMailLinkBuilder {
|
|
|
24
24
|
return metadataIds.map(key => metadata.find(m => m.key === key))
|
|
25
25
|
.filter(m => m != null && m.values.length > 0);
|
|
26
26
|
}
|
|
27
|
+
shouldUseMailer() {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const mailerIfAuthenticated = this.isAuthenticated && !((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopics);
|
|
30
|
+
const mailerIfUnauthenticated = !this.isAuthenticated && !((_b = this.configuration) === null || _b === void 0 ? void 0 : _b.mailsSentByFluidTopicsForUnauthenticatedUsers);
|
|
31
|
+
return mailerIfAuthenticated || mailerIfUnauthenticated;
|
|
32
|
+
}
|
|
27
33
|
build(feedbackMessage) {
|
|
28
|
-
var _a
|
|
29
|
-
if (feedbackMessage
|
|
34
|
+
var _a;
|
|
35
|
+
if ((feedbackMessage != null && feedbackMessage.length === 0) || !this.shouldUseMailer()) {
|
|
30
36
|
return undefined;
|
|
31
37
|
}
|
|
32
38
|
const subject = encodeURIComponent(this.subject + " " + this.subjectMetadata);
|
|
@@ -35,10 +41,10 @@ ${this.bodyMetadata}
|
|
|
35
41
|
${this.url}
|
|
36
42
|
_________________________________________________________________
|
|
37
43
|
|
|
38
|
-
${feedbackMessage}
|
|
44
|
+
${feedbackMessage !== null && feedbackMessage !== void 0 ? feedbackMessage : ""}
|
|
39
45
|
|
|
40
46
|
_________________________________________________________________
|
|
41
47
|
${server.messages["mail.feedback.disclaimer"]()}`);
|
|
42
|
-
return `mailto:${(
|
|
48
|
+
return `mailto:${(_a = this.configuration) === null || _a === void 0 ? void 0 : _a.recipients.join(",")}?subject=${subject}&body=${body}`;
|
|
43
49
|
}
|
|
44
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-feedback",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.33",
|
|
4
4
|
"description": "Feedback forms for a map and its topics in an integrated reader",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-reader-context": "1.1.
|
|
24
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.33",
|
|
23
|
+
"@fluid-topics/ft-reader-context": "1.1.33",
|
|
24
|
+
"@fluid-topics/ft-wc-utils": "1.1.33",
|
|
25
25
|
"lit": "3.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluid-topics/public-api": "1.0.58"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "25cbbfada37d7c107ea0a7742ff3230c0dc74b3b"
|
|
31
31
|
}
|