@fluid-topics/ft-reader-feedback 1.0.57 → 1.0.59

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.
@@ -3,13 +3,13 @@ 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";
5
5
  import { FeedbackI18nProperties, FtReaderFeedback } from "./ft-reader-feedback";
6
- import { FtMap, FtPublicationRatingSummary, FtReaderFeedbackConfiguration, FtUserProfile } from "@fluid-topics/public-api";
6
+ import { FtMap, FtPublicationRatingSummary, FtReaderFeedbackConfiguration, FtSession } from "@fluid-topics/public-api";
7
7
  import { FtIconVariants } from "@fluid-topics/ft-icon";
8
8
  import { FeedbackMailLinkBuilder } from "./utils/mail";
9
9
  declare const FtReaderMapFeedback_base: typeof FtReaderComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
10
10
  export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implements FtReaderFeedbackProperties {
11
11
  static elementDefinitions: ElementDefinitionsMap;
12
- user?: FtUserProfile;
12
+ session?: FtSession;
13
13
  map?: FtMap;
14
14
  editorMode: boolean;
15
15
  configuration?: FtReaderFeedbackConfiguration;
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
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
- import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
10
+ import { FtReaderComponent, FtReaderFeatures } from "@fluid-topics/ft-reader-context/build/registration";
11
11
  import { FtReaderFeedback } from "./ft-reader-feedback";
12
12
  import { FtIconVariants } from "@fluid-topics/ft-icon";
13
13
  import { FeedbackMailLinkBuilder } from "./utils/mail";
@@ -56,7 +56,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
56
56
  .editorMode=${this.editorMode}
57
57
  ?hideTitle=${this.hideTitle}
58
58
  .ratingSummary=${this.ratingSummary}
59
- .user=${this.user}
59
+ .session=${this.session}
60
60
  .iconVariant=${this.iconVariant}
61
61
  .emptyStarIcon=${this.emptyStarIcon}
62
62
  .filledStarIcon=${this.filledStarIcon}
@@ -72,18 +72,18 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
72
72
  `;
73
73
  }
74
74
  get componentVisible() {
75
- var _a;
76
- return (!!this.user && this.user.roles.includes("FEEDBACK_USER"))
77
- || (!!this.user && this.user.roles.includes("RATING_USER") && ((_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) !== "NO_RATING");
75
+ var _a, _b, _c;
76
+ return ((_a = this.service) === null || _a === void 0 ? void 0 : _a.isFeatureAccessible(FtReaderFeatures.FEEDBACK, { session: this.session }))
77
+ || ((_b = this.service) === null || _b === void 0 ? void 0 : _b.isFeatureAccessible(FtReaderFeatures.RATING, { session: this.session, ratingType: (_c = this.ratingSummary) === null || _c === void 0 ? void 0 : _c.type }));
78
78
  }
79
79
  update(props) {
80
- var _a, _b, _c;
80
+ var _a, _b, _c, _d;
81
81
  super.update(props);
82
82
  if (props.has("map") && this.map) {
83
83
  this.updateData();
84
84
  }
85
85
  if (["map", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.configuration) {
86
- this.feedbackLinkBuilder.update(this.mailSubject, (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getLink()) !== null && _b !== void 0 ? _b : "", this.map.metadata, this.configuration, ((_c = this.user) === null || _c === void 0 ? void 0 : _c.userId) != null);
86
+ this.feedbackLinkBuilder.update(this.mailSubject, (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getLink()) !== null && _b !== void 0 ? _b : "", this.map.metadata, this.configuration, ((_d = (_c = this.session) === null || _c === void 0 ? void 0 : _c.profile) === null || _d === void 0 ? void 0 : _d.userId) != null);
87
87
  }
88
88
  }
89
89
  connectedCallback() {
@@ -96,9 +96,9 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
96
96
  }
97
97
  updateData() {
98
98
  this.updateDebouncer.run(async () => {
99
- var _a, _b;
100
- if (this.map && (((_a = this.user) === null || _a === void 0 ? void 0 : _a.userId) || this.ratingSummary == null)) {
101
- this.ratingSummary = await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.getMapRating());
99
+ var _a, _b, _c;
100
+ if (this.map && (((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.userId) || this.ratingSummary == null)) {
101
+ this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getMapRating());
102
102
  }
103
103
  });
104
104
  }
@@ -174,11 +174,8 @@ FtReaderMapFeedback.elementDefinitions = {
174
174
  "ft-reader-feedback": FtReaderFeedback
175
175
  };
176
176
  __decorate([
177
- redux({
178
- store: ftAppInfoStore.name,
179
- selector: (s) => { var _a; return (_a = s.session) === null || _a === void 0 ? void 0 : _a.profile; }
180
- })
181
- ], FtReaderMapFeedback.prototype, "user", void 0);
177
+ redux({ store: ftAppInfoStore.name })
178
+ ], FtReaderMapFeedback.prototype, "session", void 0);
182
179
  __decorate([
183
180
  redux({ store: "reader" })
184
181
  ], FtReaderMapFeedback.prototype, "map", void 0);
@@ -3,7 +3,7 @@ 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";
5
5
  import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
6
- import type { FtMap, FtUserProfile } from "@fluid-topics/public-api";
6
+ import type { FtMap, FtSession } from "@fluid-topics/public-api";
7
7
  import { FtReaderFeedbackConfiguration } from "@fluid-topics/public-api";
8
8
  import { FtTopicRatingSummary } from "@fluid-topics/ft-reader-context/build/store/model";
9
9
  import { FtIconVariants } from "@fluid-topics/ft-icon";
@@ -11,7 +11,7 @@ import { FeedbackMailLinkBuilder } from "./utils/mail";
11
11
  declare const FtReaderTopicFeedback_base: typeof FtReaderTopicComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
12
12
  export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base implements FtReaderFeedbackProperties {
13
13
  static elementDefinitions: ElementDefinitionsMap;
14
- user?: FtUserProfile;
14
+ session?: FtSession;
15
15
  map?: FtMap;
16
16
  editorMode: boolean;
17
17
  configuration?: FtReaderFeedbackConfiguration;
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
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
+ import { FtReaderFeatures } from "@fluid-topics/ft-reader-context/build/registration";
10
11
  import { FtReaderFeedback } from "./ft-reader-feedback";
11
12
  import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
12
13
  import { FtIconVariants } from "@fluid-topics/ft-icon";
@@ -56,7 +57,7 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
56
57
  .editorMode=${this.editorMode}
57
58
  ?hideTitle=${this.hideTitle}
58
59
  .ratingSummary=${this.ratingSummary}
59
- .user=${this.user}
60
+ .session=${this.session}
60
61
  .iconVariant=${this.iconVariant}
61
62
  .emptyStarIcon=${this.emptyStarIcon}
62
63
  .filledStarIcon=${this.filledStarIcon}
@@ -72,18 +73,18 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
72
73
  `;
73
74
  }
74
75
  get componentVisible() {
75
- var _a;
76
- return (!!this.user && this.user.roles.includes("FEEDBACK_USER"))
77
- || (!!this.user && this.user.roles.includes("RATING_USER") && ((_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) !== "NO_RATING");
76
+ var _a, _b, _c;
77
+ return ((_a = this.service) === null || _a === void 0 ? void 0 : _a.isFeatureAccessible(FtReaderFeatures.FEEDBACK, { session: this.session }))
78
+ || ((_b = this.service) === null || _b === void 0 ? void 0 : _b.isFeatureAccessible(FtReaderFeatures.RATING, { session: this.session, ratingType: (_c = this.ratingSummary) === null || _c === void 0 ? void 0 : _c.type }));
78
79
  }
79
80
  update(props) {
80
- var _a, _b, _c;
81
+ var _a, _b, _c, _d;
81
82
  super.update(props);
82
83
  if (["tocNode", "user"].some(p => props.has(p)) && this.tocNode) {
83
84
  this.updateData();
84
85
  }
85
86
  if (["map", "tocNode", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.tocNode && this.configuration) {
86
- this.feedbackLinkBuilder.update(this.mailSubject, (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getLink(this.tocNode.tocId)) !== null && _b !== void 0 ? _b : "", this.map.metadata, this.configuration, ((_c = this.user) === null || _c === void 0 ? void 0 : _c.userId) != null);
87
+ this.feedbackLinkBuilder.update(this.mailSubject, (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getLink(this.tocNode.tocId)) !== null && _b !== void 0 ? _b : "", this.map.metadata, this.configuration, ((_d = (_c = this.session) === null || _c === void 0 ? void 0 : _c.profile) === null || _d === void 0 ? void 0 : _d.userId) != null);
87
88
  }
88
89
  }
89
90
  connectedCallback() {
@@ -92,9 +93,9 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
92
93
  }
93
94
  updateData() {
94
95
  this.updateDebouncer.run(async () => {
95
- var _a, _b;
96
- if (this.tocNode && (((_a = this.user) === null || _a === void 0 ? void 0 : _a.userId) || this.ratingSummary == null)) {
97
- this.ratingSummary = await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.getTopicRating(this.tocNode.tocId));
96
+ var _a, _b, _c;
97
+ if (this.tocNode && (((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.userId) || this.ratingSummary == null)) {
98
+ this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getTopicRating(this.tocNode.tocId));
98
99
  }
99
100
  });
100
101
  }
@@ -176,11 +177,8 @@ FtReaderTopicFeedback.elementDefinitions = {
176
177
  "ft-reader-feedback": FtReaderFeedback
177
178
  };
178
179
  __decorate([
179
- redux({
180
- store: ftAppInfoStore.name,
181
- selector: (s) => { var _a; return (_a = s.session) === null || _a === void 0 ? void 0 : _a.profile; }
182
- })
183
- ], FtReaderTopicFeedback.prototype, "user", void 0);
180
+ redux({ store: ftAppInfoStore.name })
181
+ ], FtReaderTopicFeedback.prototype, "session", void 0);
184
182
  __decorate([
185
183
  redux({ store: "reader" })
186
184
  ], FtReaderTopicFeedback.prototype, "map", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
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.0.57",
23
- "@fluid-topics/ft-reader-context": "1.0.57",
24
- "@fluid-topics/ft-wc-utils": "1.0.57",
22
+ "@fluid-topics/ft-app-context": "1.0.59",
23
+ "@fluid-topics/ft-reader-context": "1.0.59",
24
+ "@fluid-topics/ft-wc-utils": "1.0.59",
25
25
  "lit": "2.7.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluid-topics/public-api": "1.0.45"
29
29
  },
30
- "gitHead": "f4480503246fb16f02f9e0265e15b7e53e09a23a"
30
+ "gitHead": "9412dc7c29ebc722b1b133bba63b1744f4bfdf60"
31
31
  }