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

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.
@@ -15,6 +15,7 @@ export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implem
15
15
  configuration?: FtReaderFeedbackConfiguration;
16
16
  ratingSummary?: FtPublicationRatingSummary;
17
17
  hideTitle: boolean;
18
+ withMoreOptionsButton: boolean;
18
19
  iconVariant: FtIconVariants;
19
20
  emptyStarIcon?: string;
20
21
  filledStarIcon?: string;
@@ -33,10 +34,12 @@ export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implem
33
34
  onStoreAvailable(name?: string): void;
34
35
  private updateDebouncer;
35
36
  private updateData;
37
+ private fetchRatingSummary;
36
38
  private sendRatingDebouncer;
37
39
  private rate;
38
40
  private sendRating;
39
41
  private sendFeedback;
40
42
  private onMailerFeedbackSent;
43
+ private openMoreOptions;
41
44
  }
42
45
  export {};
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
- import { Debouncer, FtNotificationEvent, redux } from "@fluid-topics/ft-wc-utils";
9
+ import { Debouncer, FtNotificationEvent, redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
11
11
  import { FtReaderFeedback } from "./ft-reader-feedback";
12
+ import { FtRatingType } from "@fluid-topics/public-api";
12
13
  import { FtIconVariants } from "@fluid-topics/ft-icon";
13
14
  import { FeedbackMailLinkBuilder } from "./utils/mail";
14
15
  import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
@@ -16,11 +17,13 @@ import { server } from "./utils/ServerMessages";
16
17
  import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
17
18
  import { i18n, withI18n } from "@fluid-topics/ft-i18n";
18
19
  import { defaultDesignerMessages, designer } from "./utils/InDesignerFeedbackComponentMessages";
20
+ import { OpenMapFeedbackDrawerEvent, SendMailerMapFeedbackEvent } from "./utils/events";
19
21
  class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
20
22
  constructor() {
21
23
  super();
22
24
  this.editorMode = false;
23
25
  this.hideTitle = false;
26
+ this.withMoreOptionsButton = false;
24
27
  this.iconVariant = FtIconVariants.fluid_topics;
25
28
  this.emptyStarIcon = "STAR";
26
29
  this.filledStarIcon = "STAR_PLAIN";
@@ -46,6 +49,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
46
49
  .i18nProperties=${this.i18nProperties}
47
50
  .editorMode=${this.editorMode}
48
51
  ?hideTitle=${this.hideTitle}
52
+ ?withMoreOptionsButton=${this.withMoreOptionsButton}
49
53
  .ratingSummary=${this.ratingSummary}
50
54
  .session=${this.session}
51
55
  .iconVariant=${this.iconVariant}
@@ -59,6 +63,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
59
63
  @rate=${this.rate}
60
64
  @send-feedback=${this.sendFeedback}
61
65
  @mailer-feedback=${this.onMailerFeedbackSent}
66
+ @open-more-options=${this.openMoreOptions}
62
67
  ></ft-reader-feedback>
63
68
  `;
64
69
  }
@@ -85,12 +90,16 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
85
90
  }
86
91
  updateData() {
87
92
  this.updateDebouncer.run(async () => {
88
- var _a, _b, _c;
93
+ var _a, _b;
89
94
  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)) {
90
- this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getMapRating());
95
+ await this.fetchRatingSummary();
91
96
  }
92
97
  });
93
98
  }
99
+ async fetchRatingSummary() {
100
+ var _a;
101
+ this.ratingSummary = await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.getMapRating());
102
+ }
94
103
  rate(ratingEvent) {
95
104
  if (this.ratingSummary) {
96
105
  this.ratingSummary = {
@@ -156,7 +165,17 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
156
165
  }
157
166
  }
158
167
  onMailerFeedbackSent() {
159
- this.dispatchEvent(new CustomEvent("ft-reader-mailer-map-feedback", { composed: true, bubbles: true }));
168
+ this.dispatchEvent(new SendMailerMapFeedbackEvent());
169
+ }
170
+ openMoreOptions() {
171
+ var _a, _b, _c;
172
+ this.dispatchEvent(new OpenMapFeedbackDrawerEvent({
173
+ mapId: this.map.id,
174
+ mapTitle: this.map.title,
175
+ mapMetadata: ((_a = this.map) === null || _a === void 0 ? void 0 : _a.metadata) || [],
176
+ ratingType: ((_b = this.ratingSummary) === null || _b === void 0 ? void 0 : _b.type) || FtRatingType.NO_RATING,
177
+ ratingValue: (_c = this.ratingSummary) === null || _c === void 0 ? void 0 : _c.rating
178
+ }));
160
179
  }
161
180
  }
162
181
  FtReaderMapFeedback.elementDefinitions = {
@@ -183,6 +202,9 @@ __decorate([
183
202
  __decorate([
184
203
  property({ type: Boolean })
185
204
  ], FtReaderMapFeedback.prototype, "hideTitle", void 0);
205
+ __decorate([
206
+ property({ type: Boolean })
207
+ ], FtReaderMapFeedback.prototype, "withMoreOptionsButton", void 0);
186
208
  __decorate([
187
209
  property()
188
210
  ], FtReaderMapFeedback.prototype, "iconVariant", void 0);
@@ -210,4 +232,7 @@ __decorate([
210
232
  __decorate([
211
233
  i18n(server.properties["mail.map_feedback.subject"]((self) => { var _a; return [(_a = self.map) === null || _a === void 0 ? void 0 : _a.title]; }))
212
234
  ], FtReaderMapFeedback.prototype, "mailSubject", void 0);
235
+ __decorate([
236
+ reduxEventListener({ eventName: "rating-changed" })
237
+ ], FtReaderMapFeedback.prototype, "fetchRatingSummary", null);
213
238
  export { FtReaderMapFeedback };
@@ -17,6 +17,7 @@ export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base im
17
17
  configuration?: FtReaderFeedbackConfiguration;
18
18
  ratingSummary?: FtTopicRatingSummary;
19
19
  hideTitle: boolean;
20
+ withMoreOptionsButton: boolean;
20
21
  iconVariant: FtIconVariants;
21
22
  emptyStarIcon?: string;
22
23
  filledStarIcon?: string;
@@ -34,10 +35,12 @@ export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base im
34
35
  connectedCallback(): void;
35
36
  private updateDebouncer;
36
37
  private updateData;
38
+ private fetchRatingSummary;
37
39
  private sendRatingDebouncer;
38
40
  private rate;
39
41
  private sendRating;
40
42
  private sendFeedback;
41
43
  private onMailerFeedbackSent;
44
+ private openMoreOptions;
42
45
  }
43
46
  export {};
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
- import { Debouncer, FtNotificationEvent, redux } from "@fluid-topics/ft-wc-utils";
9
+ import { Debouncer, FtNotificationEvent, redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtReaderFeedback } from "./ft-reader-feedback";
11
11
  import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
12
+ import { FtRatingType } from "@fluid-topics/public-api";
12
13
  import { FtIconVariants } from "@fluid-topics/ft-icon";
13
14
  import { FeedbackMailLinkBuilder } from "./utils/mail";
14
15
  import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
@@ -16,11 +17,13 @@ import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
16
17
  import { server } from "./utils/ServerMessages";
17
18
  import { i18n, withI18n } from "@fluid-topics/ft-i18n";
18
19
  import { defaultDesignerMessages, designer } from "./utils/InDesignerFeedbackComponentMessages";
20
+ import { OpenTopicFeedbackDrawerEvent, SendMailerTopicFeedbackEvent } from "./utils/events";
19
21
  class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
20
22
  constructor() {
21
23
  super();
22
24
  this.editorMode = false;
23
25
  this.hideTitle = false;
26
+ this.withMoreOptionsButton = false;
24
27
  this.iconVariant = FtIconVariants.fluid_topics;
25
28
  this.emptyStarIcon = "STAR";
26
29
  this.filledStarIcon = "STAR_PLAIN";
@@ -47,6 +50,7 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
47
50
  ?ratingAllowed=${(_a = this.tocNode) === null || _a === void 0 ? void 0 : _a.hasRating}
48
51
  .editorMode=${this.editorMode}
49
52
  ?hideTitle=${this.hideTitle}
53
+ ?withMoreOptionsButton=${this.withMoreOptionsButton}
50
54
  .ratingSummary=${this.ratingSummary}
51
55
  .session=${this.session}
52
56
  .iconVariant=${this.iconVariant}
@@ -60,6 +64,7 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
60
64
  @rate=${this.rate}
61
65
  @send-feedback=${this.sendFeedback}
62
66
  @mailer-feedback=${this.onMailerFeedbackSent}
67
+ @open-more-options=${this.openMoreOptions}
63
68
  ></ft-reader-feedback>
64
69
  `;
65
70
  }
@@ -82,12 +87,16 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
82
87
  }
83
88
  updateData() {
84
89
  this.updateDebouncer.run(async () => {
85
- var _a, _b, _c;
90
+ var _a, _b;
86
91
  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)) {
87
- this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getTopicRating(this.tocNode.tocId));
92
+ await this.fetchRatingSummary();
88
93
  }
89
94
  });
90
95
  }
96
+ async fetchRatingSummary() {
97
+ var _a;
98
+ this.ratingSummary = await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.getTopicRating(this.tocNode.tocId));
99
+ }
91
100
  rate(ratingEvent) {
92
101
  if (this.ratingSummary && this.tocNode) {
93
102
  this.ratingSummary = {
@@ -155,10 +164,20 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
155
164
  }
156
165
  onMailerFeedbackSent() {
157
166
  const topic = this.tocNode;
158
- this.dispatchEvent(new CustomEvent("ft-reader-mailer-topic-feedback", {
159
- detail: { topic },
160
- composed: true,
161
- bubbles: true
167
+ this.dispatchEvent(new SendMailerTopicFeedbackEvent(topic));
168
+ }
169
+ openMoreOptions() {
170
+ var _a, _b, _c, _d, _e, _f, _g, _h;
171
+ this.dispatchEvent(new OpenTopicFeedbackDrawerEvent({
172
+ mapId: this.map.id,
173
+ mapTitle: this.map.title,
174
+ tocId: this.tocNode.tocId,
175
+ topicTitle: this.tocNode.title,
176
+ topicUrl: (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getLink(this.tocNode.tocId)) !== null && _b !== void 0 ? _b : "",
177
+ mapMetadata: ((_c = this.map) === null || _c === void 0 ? void 0 : _c.metadata) || [],
178
+ breadcrumb: ((_e = (_d = this.stateManager) === null || _d === void 0 ? void 0 : _d.service) === null || _e === void 0 ? void 0 : _e.buildBreadcrumb(this.tocNode.tocId)) || [],
179
+ ratingType: (((_f = this.tocNode) === null || _f === void 0 ? void 0 : _f.hasRating) ? (_g = this.ratingSummary) === null || _g === void 0 ? void 0 : _g.type : FtRatingType.NO_RATING) || FtRatingType.NO_RATING,
180
+ ratingValue: (_h = this.ratingSummary) === null || _h === void 0 ? void 0 : _h.rating
162
181
  }));
163
182
  }
164
183
  }
@@ -186,6 +205,9 @@ __decorate([
186
205
  __decorate([
187
206
  property({ type: Boolean })
188
207
  ], FtReaderTopicFeedback.prototype, "hideTitle", void 0);
208
+ __decorate([
209
+ property({ type: Boolean })
210
+ ], FtReaderTopicFeedback.prototype, "withMoreOptionsButton", void 0);
189
211
  __decorate([
190
212
  property()
191
213
  ], FtReaderTopicFeedback.prototype, "iconVariant", void 0);
@@ -213,4 +235,7 @@ __decorate([
213
235
  __decorate([
214
236
  i18n(server.properties["mail.feedback.subject"]((self) => { var _a, _b; return [(_a = self.tocNode) === null || _a === void 0 ? void 0 : _a.title, (_b = self.map) === null || _b === void 0 ? void 0 : _b.title]; }))
215
237
  ], FtReaderTopicFeedback.prototype, "mailSubject", void 0);
238
+ __decorate([
239
+ reduxEventListener({ eventName: "rating-changed" })
240
+ ], FtReaderTopicFeedback.prototype, "fetchRatingSummary", null);
216
241
  export { FtReaderTopicFeedback };
@@ -13,6 +13,7 @@ export interface IntegratedFeedbackComponentMessages extends I18nMessages {
13
13
  feedbackfromEmail(): string;
14
14
  feedbackfromEmailInvalid(): string;
15
15
  okButton(): string;
16
+ moreOptionsButton(): string;
16
17
  feedbackSuccess(): string;
17
18
  feedbackFailure(): string;
18
19
  ratingSuccess(): string;
@@ -16,6 +16,7 @@ export const defaultMessages = {
16
16
  feedbackfromEmailInvalid: "Please enter a valid email address",
17
17
  okButton: "Send feedback",
18
18
  cancelButton: "Cancel",
19
+ moreOptionsButton: "More options",
19
20
  feedbackSuccess: "Feedback successfully sent. Thank you!",
20
21
  feedbackFailure: "Failed to send feedback. Please try again later.",
21
22
  ratingSuccess: "Rating successfully sent. Thank you!",
@@ -0,0 +1,40 @@
1
+ import { FtReaderBreadcrumb, FtReaderTocNode } from "@fluid-topics/ft-reader-context";
2
+ import { FtMetadata, FtPublicationRating, FtRatingTypeKeys, FtTopicRating } from "@fluid-topics/public-api";
3
+ export interface FtFeedbackEventDetail {
4
+ message: string;
5
+ from?: string;
6
+ }
7
+ export declare class SendFeedbackEvent extends CustomEvent<FtFeedbackEventDetail> {
8
+ constructor(detail: FtFeedbackEventDetail);
9
+ }
10
+ interface OpenTopicFeedbackDrawerEventDetail {
11
+ mapId: string;
12
+ mapTitle: string;
13
+ tocId: string;
14
+ topicTitle: string;
15
+ topicUrl: string;
16
+ mapMetadata: FtMetadata[];
17
+ breadcrumb: Array<FtReaderBreadcrumb>;
18
+ ratingType: FtRatingTypeKeys;
19
+ ratingValue?: FtTopicRating | undefined;
20
+ }
21
+ export declare class OpenTopicFeedbackDrawerEvent extends CustomEvent<OpenTopicFeedbackDrawerEventDetail> {
22
+ constructor(detail: OpenTopicFeedbackDrawerEventDetail);
23
+ }
24
+ interface OpenMapFeedbackDrawerEventDetail {
25
+ mapId: string;
26
+ mapTitle: string;
27
+ mapMetadata: FtMetadata[];
28
+ ratingType: FtRatingTypeKeys;
29
+ ratingValue: FtPublicationRating | undefined;
30
+ }
31
+ export declare class OpenMapFeedbackDrawerEvent extends CustomEvent<OpenMapFeedbackDrawerEventDetail> {
32
+ constructor(detail: OpenMapFeedbackDrawerEventDetail);
33
+ }
34
+ export declare class SendMailerTopicFeedbackEvent extends CustomEvent<FtReaderTocNode | undefined> {
35
+ constructor(detail?: FtReaderTocNode);
36
+ }
37
+ export declare class SendMailerMapFeedbackEvent extends CustomEvent<any> {
38
+ constructor();
39
+ }
40
+ export {};
@@ -0,0 +1,42 @@
1
+ export class SendFeedbackEvent extends CustomEvent {
2
+ constructor(detail) {
3
+ super("send-feedback", {
4
+ detail
5
+ });
6
+ }
7
+ }
8
+ export class OpenTopicFeedbackDrawerEvent extends CustomEvent {
9
+ constructor(detail) {
10
+ super("ft-reader-topic-feedback", {
11
+ composed: true,
12
+ bubbles: true,
13
+ detail
14
+ });
15
+ }
16
+ }
17
+ export class OpenMapFeedbackDrawerEvent extends CustomEvent {
18
+ constructor(detail) {
19
+ super("ft-reader-feedback", {
20
+ composed: true,
21
+ bubbles: true,
22
+ detail
23
+ });
24
+ }
25
+ }
26
+ export class SendMailerTopicFeedbackEvent extends CustomEvent {
27
+ constructor(detail) {
28
+ super("ft-reader-mailer-topic-feedback", {
29
+ composed: true,
30
+ bubbles: true,
31
+ detail
32
+ });
33
+ }
34
+ }
35
+ export class SendMailerMapFeedbackEvent extends CustomEvent {
36
+ constructor() {
37
+ super("ft-reader-mailer-map-feedback", {
38
+ composed: true,
39
+ bubbles: true
40
+ });
41
+ }
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
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.30",
23
- "@fluid-topics/ft-reader-context": "1.1.30",
24
- "@fluid-topics/ft-wc-utils": "1.1.30",
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",
25
25
  "lit": "3.1.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@fluid-topics/public-api": "1.0.57"
28
+ "@fluid-topics/public-api": "1.0.58"
29
29
  },
30
- "gitHead": "2eadc3ab5cdc677c1db2564a74d18440cd553d42"
30
+ "gitHead": "7aceb8fb7c61e391e77ab55affab94df9d3f91aa"
31
31
  }