@fluid-topics/ft-reader-feedback 1.1.32 → 1.1.34

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.
@@ -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<FtReaderTocNode | undefined> {
35
- constructor(detail?: FtReaderTocNode);
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();
@@ -24,11 +24,11 @@ export class OpenMapFeedbackDrawerEvent extends CustomEvent {
24
24
  }
25
25
  }
26
26
  export class SendMailerTopicFeedbackEvent extends CustomEvent {
27
- constructor(detail) {
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
  }
@@ -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
- build(feedbackMessage: string): string | undefined;
11
+ shouldUseMailer(): boolean;
12
+ build(feedbackMessage?: string): string | undefined;
12
13
  }
@@ -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, _b, _c;
29
- if (feedbackMessage.length === 0 || this.isAuthenticated && (this.configuration == null || ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopics)) || ((_b = this.configuration) === null || _b === void 0 ? void 0 : _b.mailsSentByFluidTopicsForUnauthenticatedUsers)) {
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:${(_c = this.configuration) === null || _c === void 0 ? void 0 : _c.recipients.join(",")}?subject=${subject}&body=${body}`;
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.32",
3
+ "version": "1.1.34",
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.32",
23
- "@fluid-topics/ft-reader-context": "1.1.32",
24
- "@fluid-topics/ft-wc-utils": "1.1.32",
22
+ "@fluid-topics/ft-app-context": "1.1.34",
23
+ "@fluid-topics/ft-reader-context": "1.1.34",
24
+ "@fluid-topics/ft-wc-utils": "1.1.34",
25
25
  "lit": "3.1.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@fluid-topics/public-api": "1.0.58"
28
+ "@fluid-topics/public-api": "1.0.59"
29
29
  },
30
- "gitHead": "7aceb8fb7c61e391e77ab55affab94df9d3f91aa"
30
+ "gitHead": "1e947e93e937ded84f056955b14b760e9dea7058"
31
31
  }