@fluid-topics/ft-reader-feedback 1.0.22 → 1.0.24

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.
@@ -1,4 +1,4 @@
1
- import { nothing, PropertyValues } from "lit";
1
+ import { PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtReaderFeedbackProperties } from "./ft-reader-feedback.properties";
4
4
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
@@ -27,7 +27,8 @@ export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implem
27
27
  mailSubject: string;
28
28
  i18nProperties: FeedbackI18nProperties;
29
29
  constructor();
30
- protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
30
+ protected render(): import("lit-html").TemplateResult<1>;
31
+ private get componentVisible();
31
32
  protected updated(props: PropertyValues): void;
32
33
  connectedCallback(): void;
33
34
  onStoreAvailable(name?: string): void;
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html, nothing } from "lit";
7
+ import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
  import { Debouncer, FtNotificationEvent, redux } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
@@ -40,8 +40,14 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
40
40
  this.addStore(ftAppInfoStore);
41
41
  }
42
42
  render() {
43
- if (this.map == null) {
44
- return nothing;
43
+ if (!this.map || !this.editorMode && !this.componentVisible) {
44
+ return html `
45
+ <style>
46
+ :host {
47
+ display: none !important;
48
+ }
49
+ </style>
50
+ `;
45
51
  }
46
52
  return html `
47
53
  <ft-reader-feedback
@@ -64,6 +70,11 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
64
70
  ></ft-reader-feedback>
65
71
  `;
66
72
  }
73
+ get componentVisible() {
74
+ var _a;
75
+ return (!!this.user && this.user.roles.includes("FEEDBACK_USER"))
76
+ || (!!this.user && this.user.roles.includes("RATING_USER") && ((_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) !== "NO_RATING");
77
+ }
67
78
  updated(props) {
68
79
  var _a, _b, _c;
69
80
  super.updated(props);
@@ -1,4 +1,4 @@
1
- import { nothing, PropertyValues } from "lit";
1
+ import { PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtReaderFeedbackProperties } from "./ft-reader-feedback.properties";
4
4
  import { FeedbackI18nProperties, FtReaderFeedback } from "./ft-reader-feedback";
@@ -29,7 +29,8 @@ export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base im
29
29
  mailSubject: string;
30
30
  i18nProperties: FeedbackI18nProperties;
31
31
  constructor();
32
- protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
32
+ protected render(): import("lit-html").TemplateResult<1>;
33
+ private get componentVisible();
33
34
  protected updated(props: PropertyValues): void;
34
35
  connectedCallback(): void;
35
36
  private updateDebouncer;
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html, nothing } from "lit";
7
+ import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
  import { Debouncer, FtNotificationEvent, redux } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtReaderFeedback } from "./ft-reader-feedback";
@@ -40,8 +40,14 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
40
40
  this.addStore(ftAppInfoStore);
41
41
  }
42
42
  render() {
43
- if (this.map == null || this.tocNode == null) {
44
- return nothing;
43
+ if (!this.map || !this.tocNode || !this.editorMode && !this.componentVisible) {
44
+ return html `
45
+ <style>
46
+ :host {
47
+ display: none !important;
48
+ }
49
+ </style>
50
+ `;
45
51
  }
46
52
  return html `
47
53
  <ft-reader-feedback
@@ -64,6 +70,11 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
64
70
  ></ft-reader-feedback>
65
71
  `;
66
72
  }
73
+ get componentVisible() {
74
+ var _a;
75
+ return (!!this.user && this.user.roles.includes("FEEDBACK_USER"))
76
+ || (!!this.user && this.user.roles.includes("RATING_USER") && ((_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) !== "NO_RATING");
77
+ }
67
78
  updated(props) {
68
79
  var _a, _b, _c;
69
80
  super.updated(props);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
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.22",
23
- "@fluid-topics/ft-reader-context": "1.0.22",
24
- "@fluid-topics/ft-wc-utils": "1.0.22",
22
+ "@fluid-topics/ft-app-context": "1.0.24",
23
+ "@fluid-topics/ft-reader-context": "1.0.24",
24
+ "@fluid-topics/ft-wc-utils": "1.0.24",
25
25
  "lit": "2.7.2"
26
26
  },
27
- "gitHead": "d68f9748c223f9e8eb8da2da4f410e02a2121d36"
27
+ "gitHead": "e8a11308219b004caea5b4d992dd36d6f5ca430b"
28
28
  }