@fluid-topics/ft-reader-feedback 1.0.26 → 1.0.27

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.
@@ -1177,7 +1177,7 @@ const ue=Symbol.for(""),be=t=>{if((null==t?void 0:t.r)===ue)return null==t?void
1177
1177
  <ft-icon>INFO</ft-icon>
1178
1178
  </ft-tooltip>
1179
1179
  </div>
1180
- `:i.nothing}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}Di.elementDefinitions={"ft-button":li,"ft-typography":_e,"ft-icon":Ie,"ft-tooltip":De,"ft-switch":We,"ft-switch-option":Pe,"ft-text-area":ni},Di.styles=Ot,Ai([o.property({type:Boolean})],Di.prototype,"editorMode",void 0),Ai([o.property({type:Boolean})],Di.prototype,"hideTitle",void 0),Ai([o.property({type:Boolean})],Di.prototype,"ratingAllowed",void 0),Ai([o.property({attribute:!1})],Di.prototype,"i18nProperties",void 0),Ai([o.property({attribute:!1})],Di.prototype,"ratingSummary",void 0),Ai([o.property({attribute:!1})],Di.prototype,"user",void 0),Ai([o.query(".ft-reader-feedback--feedback-input")],Di.prototype,"feedbackInput",void 0),Ai([o.state()],Di.prototype,"feedbackMessage",void 0),Ai([o.property()],Di.prototype,"iconVariant",void 0),Ai([o.property()],Di.prototype,"emptyStarIcon",void 0),Ai([o.property()],Di.prototype,"filledStarIcon",void 0),Ai([o.property()],Di.prototype,"emptyLikeIcon",void 0),Ai([o.property()],Di.prototype,"filledLikeIcon",void 0),Ai([o.property()],Di.prototype,"emptyDislikeIcon",void 0),Ai([o.property()],Di.prototype,"filledDislikeIcon",void 0),Ai([o.property()],Di.prototype,"feedbackMailLinkBuilder",void 0);const Bi=Ci.fromGwt("server");class Ui{constructor(){this.subject="",this.url="",this.allMetadata="",this.subjectMetadata="",this.isAuthenticated=!1}update(t,e,i,o,s){this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=s,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),s=encodeURIComponent(`\n${this.allMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${Bi.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${o}&body=${s}`}}var ji=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(s=t[a])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Mi extends(ki(d)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=we.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 Ui,this.i18nProperties={feedbackMainTitle:Oi.properties.mapFeedbackMainTitle(),ratingSectionTitle:Oi.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:Oi.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:Oi.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new e.Debouncer(100),this.sendRatingDebouncer=new e.Debouncer(500),this.addStore(pi)}render(){return this.map&&(this.editorMode||this.componentVisible)?i.html`
1180
+ `:i.nothing}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}Di.elementDefinitions={"ft-button":li,"ft-typography":_e,"ft-icon":Ie,"ft-tooltip":De,"ft-switch":We,"ft-switch-option":Pe,"ft-text-area":ni},Di.styles=Ot,Ai([o.property({type:Boolean})],Di.prototype,"editorMode",void 0),Ai([o.property({type:Boolean})],Di.prototype,"hideTitle",void 0),Ai([o.property({type:Boolean})],Di.prototype,"ratingAllowed",void 0),Ai([o.property({attribute:!1})],Di.prototype,"i18nProperties",void 0),Ai([o.property({attribute:!1})],Di.prototype,"ratingSummary",void 0),Ai([o.property({attribute:!1})],Di.prototype,"user",void 0),Ai([o.query(".ft-reader-feedback--feedback-input")],Di.prototype,"feedbackInput",void 0),Ai([o.state()],Di.prototype,"feedbackMessage",void 0),Ai([o.property()],Di.prototype,"iconVariant",void 0),Ai([o.property()],Di.prototype,"emptyStarIcon",void 0),Ai([o.property()],Di.prototype,"filledStarIcon",void 0),Ai([o.property()],Di.prototype,"emptyLikeIcon",void 0),Ai([o.property()],Di.prototype,"filledLikeIcon",void 0),Ai([o.property()],Di.prototype,"emptyDislikeIcon",void 0),Ai([o.property()],Di.prototype,"filledDislikeIcon",void 0),Ai([o.property()],Di.prototype,"feedbackMailLinkBuilder",void 0);const Bi=Ci.fromGwt("server");class Ui{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,o,s){var n;this.subject=t,this.url=e,this.configuration=o,this.isAuthenticated=s,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))}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),s=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${Bi.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${o}&body=${s}`}}var ji=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(s=t[a])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class Mi extends(ki(d)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=we.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 Ui,this.i18nProperties={feedbackMainTitle:Oi.properties.mapFeedbackMainTitle(),ratingSectionTitle:Oi.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:Oi.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:Oi.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new e.Debouncer(100),this.sendRatingDebouncer=new e.Debouncer(500),this.addStore(pi)}render(){return this.map&&(this.editorMode||this.componentVisible)?i.html`
1181
1181
  <ft-reader-feedback
1182
1182
  ratingAllowed
1183
1183
  .i18nProperties=${this.i18nProperties}
@@ -1300,7 +1300,7 @@ const{I:sr}=bt,ar=()=>document.createComment(""),lr=(t,e,i)=>{var n;const o=t._$
1300
1300
  <ft-icon>INFO</ft-icon>
1301
1301
  </ft-tooltip>
1302
1302
  </div>
1303
- `:it}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}Wr.elementDefinitions={"ft-button":br,"ft-typography":po,"ft-icon":Oo,"ft-tooltip":To,"ft-switch":Ko,"ft-switch-option":Lo,"ft-text-area":rr},Wr.styles=ro,Lr([s({type:Boolean})],Wr.prototype,"editorMode",void 0),Lr([s({type:Boolean})],Wr.prototype,"hideTitle",void 0),Lr([s({type:Boolean})],Wr.prototype,"ratingAllowed",void 0),Lr([s({attribute:!1})],Wr.prototype,"i18nProperties",void 0),Lr([s({attribute:!1})],Wr.prototype,"ratingSummary",void 0),Lr([s({attribute:!1})],Wr.prototype,"user",void 0),Lr([c(".ft-reader-feedback--feedback-input")],Wr.prototype,"feedbackInput",void 0),Lr([a()],Wr.prototype,"feedbackMessage",void 0),Lr([s()],Wr.prototype,"iconVariant",void 0),Lr([s()],Wr.prototype,"emptyStarIcon",void 0),Lr([s()],Wr.prototype,"filledStarIcon",void 0),Lr([s()],Wr.prototype,"emptyLikeIcon",void 0),Lr([s()],Wr.prototype,"filledLikeIcon",void 0),Lr([s()],Wr.prototype,"emptyDislikeIcon",void 0),Lr([s()],Wr.prototype,"filledDislikeIcon",void 0),Lr([s()],Wr.prototype,"feedbackMailLinkBuilder",void 0);const Hr=Ur.fromGwt("server");class Kr{constructor(){this.subject="",this.url="",this.allMetadata="",this.subjectMetadata="",this.isAuthenticated=!1}update(t,e,i,n,o){this.subject=t,this.url=e,this.configuration=n,this.isAuthenticated=o,this.subjectMetadata=n.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 n=encodeURIComponent(this.subject+" "+this.subjectMetadata),o=encodeURIComponent(`\n${this.allMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${Hr.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${n}&body=${o}`}}var Zr=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Vr extends(Nr(zi)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=So.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 Kr,this.i18nProperties={feedbackMainTitle:zr.properties.mapFeedbackMainTitle(),ratingSectionTitle:zr.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:zr.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:zr.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(mr)}render(){return this.map&&(this.editorMode||this.componentVisible)?tt`
1303
+ `:it}clearFeedbackInput(){setTimeout((()=>this.feedbackInput.value=""),0)}}Wr.elementDefinitions={"ft-button":br,"ft-typography":po,"ft-icon":Oo,"ft-tooltip":To,"ft-switch":Ko,"ft-switch-option":Lo,"ft-text-area":rr},Wr.styles=ro,Lr([s({type:Boolean})],Wr.prototype,"editorMode",void 0),Lr([s({type:Boolean})],Wr.prototype,"hideTitle",void 0),Lr([s({type:Boolean})],Wr.prototype,"ratingAllowed",void 0),Lr([s({attribute:!1})],Wr.prototype,"i18nProperties",void 0),Lr([s({attribute:!1})],Wr.prototype,"ratingSummary",void 0),Lr([s({attribute:!1})],Wr.prototype,"user",void 0),Lr([c(".ft-reader-feedback--feedback-input")],Wr.prototype,"feedbackInput",void 0),Lr([a()],Wr.prototype,"feedbackMessage",void 0),Lr([s()],Wr.prototype,"iconVariant",void 0),Lr([s()],Wr.prototype,"emptyStarIcon",void 0),Lr([s()],Wr.prototype,"filledStarIcon",void 0),Lr([s()],Wr.prototype,"emptyLikeIcon",void 0),Lr([s()],Wr.prototype,"filledLikeIcon",void 0),Lr([s()],Wr.prototype,"emptyDislikeIcon",void 0),Lr([s()],Wr.prototype,"filledDislikeIcon",void 0),Lr([s()],Wr.prototype,"feedbackMailLinkBuilder",void 0);const Hr=Ur.fromGwt("server");class Kr{constructor(){this.subject="",this.url="",this.subjectMetadata="",this.bodyMetadata="",this.isAuthenticated=!1}update(t,e,i,n,o){var r;this.subject=t,this.url=e,this.configuration=n,this.isAuthenticated=o,this.subjectMetadata=this.filterMetadata(i,n.subjectMetadataIds).map((t=>"["+t.values[t.values.length-1]+"]")).join(""),this.bodyMetadata=this.filterMetadata(i,null!==(r=n.bodyMetadataIds)&&void 0!==r?r:[]).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))}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 n=encodeURIComponent(this.subject+" "+this.subjectMetadata),o=encodeURIComponent(`\n${this.bodyMetadata}\n${this.url}\n_________________________________________________________________\n\n${t}\n\n_________________________________________________________________\n${Hr.messages["mail.feedback.disclaimer"]()}`);return`mailto:${null===(i=this.configuration)||void 0===i?void 0:i.recipients.join(",")}?subject=${n}&body=${o}`}}var Zr=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Vr extends(Nr(zi)){constructor(){super(),this.editorMode=!1,this.hideTitle=!1,this.iconVariant=So.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 Kr,this.i18nProperties={feedbackMainTitle:zr.properties.mapFeedbackMainTitle(),ratingSectionTitle:zr.properties.mapRatingSectionTitle(),dichotomousRatingSectionTitle:zr.properties.mapDichotomousRatingSectionTitle(),feedbackSectionTitle:zr.properties.mapFeedbackSectionTitle()},this.updateDebouncer=new o(100),this.sendRatingDebouncer=new o(500),this.addStore(mr)}render(){return this.map&&(this.editorMode||this.componentVisible)?tt`
1304
1304
  <ft-reader-feedback
1305
1305
  ratingAllowed
1306
1306
  .i18nProperties=${this.i18nProperties}
@@ -2,10 +2,11 @@ import { FtMetadata, FtReaderFeedbackConfiguration } from "@fluid-topics/public-
2
2
  export declare class FeedbackMailLinkBuilder {
3
3
  private subject;
4
4
  private url;
5
- private allMetadata;
6
5
  private subjectMetadata;
6
+ private bodyMetadata;
7
7
  private configuration?;
8
8
  private isAuthenticated;
9
9
  update(subject: string, url: string, metadata: Array<FtMetadata>, configuration: FtReaderFeedbackConfiguration, isAuthenticated: boolean): void;
10
+ private filterMetadata;
10
11
  build(feedbackMessage: string): string | undefined;
11
12
  }
@@ -3,24 +3,27 @@ export class FeedbackMailLinkBuilder {
3
3
  constructor() {
4
4
  this.subject = "";
5
5
  this.url = "";
6
- this.allMetadata = "";
7
6
  this.subjectMetadata = "";
7
+ this.bodyMetadata = "";
8
8
  this.isAuthenticated = false;
9
9
  }
10
10
  update(subject, url, metadata, configuration, isAuthenticated) {
11
+ var _a;
11
12
  this.subject = subject;
12
13
  this.url = url;
13
14
  this.configuration = configuration;
14
15
  this.isAuthenticated = isAuthenticated;
15
- this.subjectMetadata = configuration.subjectMetadataIds
16
- .map(key => metadata.find(m => m.key === key))
17
- .filter(m => m != null)
18
- .map(m => "[" + m.values.join(", ") + "]")
16
+ this.subjectMetadata = this.filterMetadata(metadata, configuration.subjectMetadataIds)
17
+ .map(m => "[" + m.values[m.values.length - 1] + "]")
19
18
  .join("");
20
- this.allMetadata = metadata.filter(m => !m.key.startsWith("ft:"))
19
+ this.bodyMetadata = this.filterMetadata(metadata, (_a = configuration.bodyMetadataIds) !== null && _a !== void 0 ? _a : [])
21
20
  .map(m => "[" + m.values.join(", ") + "]")
22
21
  .join(" ");
23
22
  }
23
+ filterMetadata(metadata, metadataIds) {
24
+ return metadataIds.map(key => metadata.find(m => m.key === key))
25
+ .filter(m => m != null && m.values.length > 0);
26
+ }
24
27
  build(feedbackMessage) {
25
28
  var _a, _b;
26
29
  if (feedbackMessage.length === 0 || this.isAuthenticated && (this.configuration == null || ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopics))) {
@@ -28,7 +31,7 @@ export class FeedbackMailLinkBuilder {
28
31
  }
29
32
  const subject = encodeURIComponent(this.subject + " " + this.subjectMetadata);
30
33
  const body = encodeURIComponent(`
31
- ${this.allMetadata}
34
+ ${this.bodyMetadata}
32
35
  ${this.url}
33
36
  _________________________________________________________________
34
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
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": "1.0.26",
23
- "@fluid-topics/ft-reader-context": "1.0.26",
24
- "@fluid-topics/ft-wc-utils": "1.0.26",
22
+ "@fluid-topics/ft-app-context": "1.0.27",
23
+ "@fluid-topics/ft-reader-context": "1.0.27",
24
+ "@fluid-topics/ft-wc-utils": "1.0.27",
25
25
  "lit": "2.7.2"
26
26
  },
27
- "gitHead": "c7cb9f427774f5e53e8badbc05fc1024c737d7bc"
27
+ "gitHead": "6b4e3bcc50463a1e20749c148495bfe7bbc97e6d"
28
28
  }