@fluid-topics/ft-reader-feedback 0.3.58 → 0.3.61

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.
@@ -2,17 +2,18 @@ import { nothing, 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";
5
- import { FtReaderFeedback } from "./ft-reader-feedback";
5
+ import { FeedbackI18nProperties, FtReaderFeedback } from "./ft-reader-feedback";
6
6
  import { FtMap, FtPublicationRatingSummary, FtReaderFeedbackConfiguration, FtUserProfile } from "@fluid-topics/public-api";
7
7
  import { FtIconVariants } from "@fluid-topics/ft-icon";
8
8
  import { FeedbackMailLinkBuilder } from "./utils/mail";
9
- export declare class FtReaderMapFeedback extends FtReaderComponent implements FtReaderFeedbackProperties {
9
+ declare const FtReaderMapFeedback_base: typeof FtReaderComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
10
+ export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implements FtReaderFeedbackProperties {
10
11
  static elementDefinitions: ElementDefinitionsMap;
12
+ user?: FtUserProfile;
11
13
  map?: FtMap;
12
14
  editorMode: boolean;
13
15
  configuration?: FtReaderFeedbackConfiguration;
14
16
  ratingSummary?: FtPublicationRatingSummary;
15
- user?: FtUserProfile;
16
17
  hideTitle: boolean;
17
18
  iconVariant: FtIconVariants;
18
19
  emptyStarIcon?: string;
@@ -23,6 +24,9 @@ export declare class FtReaderMapFeedback extends FtReaderComponent implements Ft
23
24
  filledDislikeIcon?: string;
24
25
  readerFeedback: FtReaderFeedback;
25
26
  feedbackLinkBuilder: FeedbackMailLinkBuilder;
27
+ mailSubject: string;
28
+ i18nProperties: FeedbackI18nProperties;
29
+ constructor();
26
30
  protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
27
31
  protected updated(props: PropertyValues): void;
28
32
  connectedCallback(): void;
@@ -34,4 +38,5 @@ export declare class FtReaderMapFeedback extends FtReaderComponent implements Ft
34
38
  private sendRating;
35
39
  private sendFeedback;
36
40
  }
41
+ export {};
37
42
  //# sourceMappingURL=ft-reader-map-feedback.d.ts.map
@@ -10,11 +10,15 @@ import { Debouncer, FtNotificationEvent, redux } 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
12
  import { FtIconVariants } from "@fluid-topics/ft-icon";
13
- import { mapLabelResolver } from "./utils/labels";
14
13
  import { FeedbackMailLinkBuilder } from "./utils/mail";
15
- export class FtReaderMapFeedback extends FtReaderComponent {
14
+ import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
15
+ import { server } from "./utils/ServerMessages";
16
+ import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
17
+ import { i18n, withI18n } from "@fluid-topics/ft-i18n";
18
+ import { designer } from "./utils/InDesignerFeedbackComponentMessages";
19
+ export class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
16
20
  constructor() {
17
- super(...arguments);
21
+ super();
18
22
  this.editorMode = false;
19
23
  this.hideTitle = false;
20
24
  this.iconVariant = FtIconVariants.fluid_topics;
@@ -24,9 +28,16 @@ export class FtReaderMapFeedback extends FtReaderComponent {
24
28
  this.filledLikeIcon = "THUMBS_UP_PLAIN";
25
29
  this.emptyDislikeIcon = "THUMBS_DOWN";
26
30
  this.filledDislikeIcon = "THUMBS_DOWN_PLAIN";
27
- this.feedbackLinkBuilder = new FeedbackMailLinkBuilder(mapLabelResolver.resolve("mailDisclaimer"));
31
+ this.feedbackLinkBuilder = new FeedbackMailLinkBuilder();
32
+ this.i18nProperties = {
33
+ feedbackMainTitle: feedback.properties.mapFeedbackMainTitle(),
34
+ ratingSectionTitle: feedback.properties.mapRatingSectionTitle(),
35
+ dichotomousRatingSectionTitle: feedback.properties.mapDichotomousRatingSectionTitle(),
36
+ feedbackSectionTitle: feedback.properties.mapFeedbackSectionTitle(),
37
+ };
28
38
  this.updateDebouncer = new Debouncer(100);
29
39
  this.sendRatingDebouncer = new Debouncer(500);
40
+ this.addStore(ftAppInfoStore);
30
41
  }
31
42
  render() {
32
43
  if (this.map == null) {
@@ -35,9 +46,9 @@ export class FtReaderMapFeedback extends FtReaderComponent {
35
46
  return html `
36
47
  <ft-reader-feedback
37
48
  ratingAllowed
49
+ .i18nProperties=${this.i18nProperties}
38
50
  .editorMode=${this.editorMode}
39
51
  ?hideTitle=${this.hideTitle}
40
- .labelResolver=${mapLabelResolver}
41
52
  .ratingSummary=${this.ratingSummary}
42
53
  .user=${this.user}
43
54
  .iconVariant=${this.iconVariant}
@@ -59,8 +70,8 @@ export class FtReaderMapFeedback extends FtReaderComponent {
59
70
  if (props.has("map") && this.map) {
60
71
  this.updateData();
61
72
  }
62
- if (["map", "configuration", "user"].some(p => props.has(p)) && this.map && this.configuration) {
63
- this.feedbackLinkBuilder.update(mapLabelResolver.resolve("mailSubject", this.map.title), (_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);
73
+ if (["map", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.configuration) {
74
+ 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);
64
75
  }
65
76
  }
66
77
  connectedCallback() {
@@ -73,10 +84,9 @@ export class FtReaderMapFeedback extends FtReaderComponent {
73
84
  }
74
85
  updateData() {
75
86
  this.updateDebouncer.run(async () => {
76
- var _a, _b, _c;
77
- this.user = await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.getSession().then(s => s.profile));
78
- if (this.map && (((_b = this.user) === null || _b === void 0 ? void 0 : _b.userId) || this.ratingSummary == null)) {
79
- this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getMapRating());
87
+ var _a, _b;
88
+ if (this.map && (((_a = this.user) === null || _a === void 0 ? void 0 : _a.userId) || this.ratingSummary == null)) {
89
+ this.ratingSummary = await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.getMapRating());
80
90
  }
81
91
  });
82
92
  }
@@ -107,7 +117,7 @@ export class FtReaderMapFeedback extends FtReaderComponent {
107
117
  catch {
108
118
  this.dispatchEvent(new FtNotificationEvent({
109
119
  type: "error",
110
- message: mapLabelResolver.resolve("ratingFailure")
120
+ message: feedback.messages.ratingFailure()
111
121
  }));
112
122
  }
113
123
  this.updateData();
@@ -115,7 +125,7 @@ export class FtReaderMapFeedback extends FtReaderComponent {
115
125
  else if (this.editorMode) {
116
126
  this.dispatchEvent(new FtNotificationEvent({
117
127
  type: "info",
118
- message: mapLabelResolver.resolve("feedbackAndRatingDisabledInEditor")
128
+ message: designer.messages.feedbackAndRatingDisabledInEditor()
119
129
  }));
120
130
  }
121
131
  }
@@ -126,13 +136,13 @@ export class FtReaderMapFeedback extends FtReaderComponent {
126
136
  await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.sendMapFeedback(ratingEvent.detail));
127
137
  this.dispatchEvent(new FtNotificationEvent({
128
138
  type: "info",
129
- message: mapLabelResolver.resolve("feedbackSuccess")
139
+ message: feedback.messages.feedbackSuccess()
130
140
  }));
131
141
  }
132
142
  else {
133
143
  this.dispatchEvent(new FtNotificationEvent({
134
144
  type: "info",
135
- message: mapLabelResolver.resolve("feedbackAndRatingDisabledInEditor")
145
+ message: designer.messages.feedbackAndRatingDisabledInEditor()
136
146
  }));
137
147
  }
138
148
  this.readerFeedback.clearFeedbackInput();
@@ -140,7 +150,7 @@ export class FtReaderMapFeedback extends FtReaderComponent {
140
150
  catch {
141
151
  this.dispatchEvent(new FtNotificationEvent({
142
152
  type: "error",
143
- message: mapLabelResolver.resolve("feedbackFailure")
153
+ message: feedback.messages.feedbackFailure()
144
154
  }));
145
155
  }
146
156
  }
@@ -149,20 +159,26 @@ FtReaderMapFeedback.elementDefinitions = {
149
159
  "ft-reader-feedback": FtReaderFeedback
150
160
  };
151
161
  __decorate([
152
- redux()
162
+ redux({
163
+ store: ftAppInfoStore.name,
164
+ selector: (s) => { var _a; return (_a = s.session) === null || _a === void 0 ? void 0 : _a.profile; }
165
+ })
166
+ ], FtReaderMapFeedback.prototype, "user", void 0);
167
+ __decorate([
168
+ redux({ store: "reader" })
153
169
  ], FtReaderMapFeedback.prototype, "map", void 0);
154
170
  __decorate([
155
- property({ attribute: false })
171
+ redux({ store: ftAppInfoStore.name })
156
172
  ], FtReaderMapFeedback.prototype, "editorMode", void 0);
157
173
  __decorate([
158
- redux((state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; })
174
+ redux({
175
+ store: "reader",
176
+ selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; }
177
+ })
159
178
  ], FtReaderMapFeedback.prototype, "configuration", void 0);
160
179
  __decorate([
161
180
  state()
162
181
  ], FtReaderMapFeedback.prototype, "ratingSummary", void 0);
163
- __decorate([
164
- state()
165
- ], FtReaderMapFeedback.prototype, "user", void 0);
166
182
  __decorate([
167
183
  property({ type: Boolean })
168
184
  ], FtReaderMapFeedback.prototype, "hideTitle", void 0);
@@ -190,4 +206,7 @@ __decorate([
190
206
  __decorate([
191
207
  query("ft-reader-feedback")
192
208
  ], FtReaderMapFeedback.prototype, "readerFeedback", void 0);
209
+ __decorate([
210
+ i18n(server.properties["mail.map_feedback.subject"]((self) => { var _a; return [(_a = self.map) === null || _a === void 0 ? void 0 : _a.title]; }))
211
+ ], FtReaderMapFeedback.prototype, "mailSubject", void 0);
193
212
  //# sourceMappingURL=ft-reader-map-feedback.js.map
@@ -1,20 +1,21 @@
1
1
  import { nothing, PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
3
3
  import { FtReaderFeedbackProperties } from "./ft-reader-feedback.properties";
4
- import { FtReaderFeedback } from "./ft-reader-feedback";
4
+ import { FeedbackI18nProperties, FtReaderFeedback } from "./ft-reader-feedback";
5
5
  import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/build/registration";
6
6
  import type { FtMap, FtUserProfile } 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";
10
10
  import { FeedbackMailLinkBuilder } from "./utils/mail";
11
- export declare class FtReaderTopicFeedback extends FtReaderTopicComponent implements FtReaderFeedbackProperties {
11
+ declare const FtReaderTopicFeedback_base: typeof FtReaderTopicComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
12
+ export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base implements FtReaderFeedbackProperties {
12
13
  static elementDefinitions: ElementDefinitionsMap;
14
+ user?: FtUserProfile;
13
15
  map?: FtMap;
14
16
  editorMode: boolean;
15
17
  configuration?: FtReaderFeedbackConfiguration;
16
18
  ratingSummary?: FtTopicRatingSummary;
17
- user?: FtUserProfile;
18
19
  hideTitle: boolean;
19
20
  iconVariant: FtIconVariants;
20
21
  emptyStarIcon?: string;
@@ -25,13 +26,18 @@ export declare class FtReaderTopicFeedback extends FtReaderTopicComponent implem
25
26
  filledDislikeIcon?: string;
26
27
  readerFeedback: FtReaderFeedback;
27
28
  feedbackLinkBuilder: FeedbackMailLinkBuilder;
29
+ mailSubject: string;
30
+ i18nProperties: FeedbackI18nProperties;
31
+ constructor();
28
32
  protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
29
33
  protected updated(props: PropertyValues): void;
30
34
  connectedCallback(): void;
35
+ private updateDebouncer;
31
36
  private updateData;
32
37
  private sendRatingDebouncer;
33
38
  private rate;
34
39
  private sendRating;
35
40
  private sendFeedback;
36
41
  }
42
+ export {};
37
43
  //# sourceMappingURL=ft-reader-topic-feedback.d.ts.map
@@ -10,11 +10,15 @@ import { Debouncer, FtNotificationEvent, redux } 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
12
  import { FtIconVariants } from "@fluid-topics/ft-icon";
13
- import { topicLabelResolver } from "./utils/labels";
14
13
  import { FeedbackMailLinkBuilder } from "./utils/mail";
15
- export class FtReaderTopicFeedback extends FtReaderTopicComponent {
14
+ import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
15
+ import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
16
+ import { server } from "./utils/ServerMessages";
17
+ import { i18n, withI18n } from "@fluid-topics/ft-i18n";
18
+ import { designer } from "./utils/InDesignerFeedbackComponentMessages";
19
+ export class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
16
20
  constructor() {
17
- super(...arguments);
21
+ super();
18
22
  this.editorMode = false;
19
23
  this.hideTitle = false;
20
24
  this.iconVariant = FtIconVariants.fluid_topics;
@@ -24,8 +28,16 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
24
28
  this.filledLikeIcon = "THUMBS_UP_PLAIN";
25
29
  this.emptyDislikeIcon = "THUMBS_DOWN";
26
30
  this.filledDislikeIcon = "THUMBS_DOWN_PLAIN";
27
- this.feedbackLinkBuilder = new FeedbackMailLinkBuilder(topicLabelResolver.resolve("mailDisclaimer"));
31
+ this.feedbackLinkBuilder = new FeedbackMailLinkBuilder();
32
+ this.i18nProperties = {
33
+ feedbackMainTitle: feedback.properties.topicFeedbackMainTitle(),
34
+ ratingSectionTitle: feedback.properties.topicRatingSectionTitle(),
35
+ dichotomousRatingSectionTitle: feedback.properties.topicDichotomousRatingSectionTitle(),
36
+ feedbackSectionTitle: feedback.properties.topicFeedbackSectionTitle(),
37
+ };
38
+ this.updateDebouncer = new Debouncer(100);
28
39
  this.sendRatingDebouncer = new Debouncer(500);
40
+ this.addStore(ftAppInfoStore);
29
41
  }
30
42
  render() {
31
43
  if (this.map == null || this.tocNode == null) {
@@ -33,10 +45,10 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
33
45
  }
34
46
  return html `
35
47
  <ft-reader-feedback
48
+ .i18nProperties=${this.i18nProperties}
36
49
  ?ratingAllowed=${this.tocNode.hasRating}
37
50
  .editorMode=${this.editorMode}
38
51
  ?hideTitle=${this.hideTitle}
39
- .labelResolver=${topicLabelResolver}
40
52
  .ratingSummary=${this.ratingSummary}
41
53
  .user=${this.user}
42
54
  .iconVariant=${this.iconVariant}
@@ -55,23 +67,24 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
55
67
  updated(props) {
56
68
  var _a, _b, _c;
57
69
  super.updated(props);
58
- if (props.has("tocNode") && this.tocNode) {
70
+ if (["tocNode", "user"].some(p => props.has(p)) && this.tocNode) {
59
71
  this.updateData();
60
72
  }
61
- if (["map", "tocNode", "configuration", "user"].some(p => props.has(p)) && this.map && this.tocNode && this.configuration) {
62
- this.feedbackLinkBuilder.update(topicLabelResolver.resolve("mailSubject", this.tocNode.title, this.map.title), (_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);
73
+ if (["map", "tocNode", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.tocNode && this.configuration) {
74
+ 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);
63
75
  }
64
76
  }
65
77
  connectedCallback() {
66
78
  super.connectedCallback();
67
79
  this.updateData();
68
80
  }
69
- async updateData() {
70
- var _a, _b, _c;
71
- this.user = await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.getSession().then(s => s.profile));
72
- if (this.tocNode && (((_b = this.user) === null || _b === void 0 ? void 0 : _b.userId) || this.ratingSummary == null)) {
73
- this.ratingSummary = await ((_c = this.service) === null || _c === void 0 ? void 0 : _c.getTopicRating(this.tocNode.tocId));
74
- }
81
+ updateData() {
82
+ this.updateDebouncer.run(async () => {
83
+ var _a, _b;
84
+ if (this.tocNode && (((_a = this.user) === null || _a === void 0 ? void 0 : _a.userId) || this.ratingSummary == null)) {
85
+ this.ratingSummary = await ((_b = this.service) === null || _b === void 0 ? void 0 : _b.getTopicRating(this.tocNode.tocId));
86
+ }
87
+ });
75
88
  }
76
89
  rate(ratingEvent) {
77
90
  if (this.ratingSummary && this.tocNode) {
@@ -101,7 +114,7 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
101
114
  catch {
102
115
  this.dispatchEvent(new FtNotificationEvent({
103
116
  type: "error",
104
- message: topicLabelResolver.resolve("ratingFailure")
117
+ message: feedback.messages.ratingFailure()
105
118
  }));
106
119
  }
107
120
  this.updateData();
@@ -109,7 +122,7 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
109
122
  else if (this.editorMode) {
110
123
  this.dispatchEvent(new FtNotificationEvent({
111
124
  type: "info",
112
- message: topicLabelResolver.resolve("feedbackAndRatingDisabledInEditor")
125
+ message: designer.messages.feedbackAndRatingDisabledInEditor()
113
126
  }));
114
127
  }
115
128
  }
@@ -120,21 +133,21 @@ export class FtReaderTopicFeedback extends FtReaderTopicComponent {
120
133
  await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.sendTopicFeedback(this.tocNode.tocId, ratingEvent.detail));
121
134
  this.dispatchEvent(new FtNotificationEvent({
122
135
  type: "info",
123
- message: topicLabelResolver.resolve("feedbackSuccess")
136
+ message: feedback.messages.feedbackSuccess()
124
137
  }));
125
138
  this.readerFeedback.clearFeedbackInput();
126
139
  }
127
140
  else if (this.editorMode) {
128
141
  this.dispatchEvent(new FtNotificationEvent({
129
142
  type: "info",
130
- message: topicLabelResolver.resolve("feedbackAndRatingDisabledInEditor")
143
+ message: designer.messages.feedbackAndRatingDisabledInEditor()
131
144
  }));
132
145
  }
133
146
  }
134
147
  catch {
135
148
  this.dispatchEvent(new FtNotificationEvent({
136
149
  type: "error",
137
- message: topicLabelResolver.resolve("feedbackFailure")
150
+ message: feedback.messages.feedbackFailure()
138
151
  }));
139
152
  }
140
153
  }
@@ -143,20 +156,26 @@ FtReaderTopicFeedback.elementDefinitions = {
143
156
  "ft-reader-feedback": FtReaderFeedback
144
157
  };
145
158
  __decorate([
146
- redux()
159
+ redux({
160
+ store: ftAppInfoStore.name,
161
+ selector: (s) => { var _a; return (_a = s.session) === null || _a === void 0 ? void 0 : _a.profile; }
162
+ })
163
+ ], FtReaderTopicFeedback.prototype, "user", void 0);
164
+ __decorate([
165
+ redux({ store: "reader" })
147
166
  ], FtReaderTopicFeedback.prototype, "map", void 0);
148
167
  __decorate([
149
- property({ attribute: false })
168
+ redux({ store: ftAppInfoStore.name })
150
169
  ], FtReaderTopicFeedback.prototype, "editorMode", void 0);
151
170
  __decorate([
152
- redux((state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; })
171
+ redux({
172
+ store: "reader",
173
+ selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; }
174
+ })
153
175
  ], FtReaderTopicFeedback.prototype, "configuration", void 0);
154
176
  __decorate([
155
177
  state()
156
178
  ], FtReaderTopicFeedback.prototype, "ratingSummary", void 0);
157
- __decorate([
158
- state()
159
- ], FtReaderTopicFeedback.prototype, "user", void 0);
160
179
  __decorate([
161
180
  property({ type: Boolean })
162
181
  ], FtReaderTopicFeedback.prototype, "hideTitle", void 0);
@@ -184,4 +203,7 @@ __decorate([
184
203
  __decorate([
185
204
  query("ft-reader-feedback")
186
205
  ], FtReaderTopicFeedback.prototype, "readerFeedback", void 0);
206
+ __decorate([
207
+ 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]; }))
208
+ ], FtReaderTopicFeedback.prototype, "mailSubject", void 0);
187
209
  //# sourceMappingURL=ft-reader-topic-feedback.js.map
@@ -0,0 +1,11 @@
1
+ import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
2
+ export interface InDesignerFeedbackComponentMessages extends I18nMessages {
3
+ ratingNotConfigured(): string;
4
+ missingRatingRole(): string;
5
+ missingFeedbackRole(): string;
6
+ inDesignerOnlyNotice(): string;
7
+ feedbackAndRatingDisabledInEditor(): string;
8
+ }
9
+ export declare const designer: I18nMessageContext<InDesignerFeedbackComponentMessages>;
10
+ export declare const defaultDesignerMessages: DefaultI18nMessages<InDesignerFeedbackComponentMessages>;
11
+ //# sourceMappingURL=InDesignerFeedbackComponentMessages.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { I18nMessageContext } from "@fluid-topics/ft-i18n";
2
+ export const designer = I18nMessageContext.build("inDesignerFeedbackComponent");
3
+ export const defaultDesignerMessages = {
4
+ ratingNotConfigured: "Rating unavailable: no rating configured for this content.",
5
+ missingRatingRole: "Rating unavailable: missing role RATING_USER.",
6
+ missingFeedbackRole: "Feedback unavailable: missing role FEEDBACK_USER.",
7
+ inDesignerOnlyNotice: "This notice will not appear outside this designer.",
8
+ feedbackAndRatingDisabledInEditor: "Feedback and ratings performed here are not taken into account."
9
+ };
10
+ //# sourceMappingURL=InDesignerFeedbackComponentMessages.js.map
@@ -0,0 +1,29 @@
1
+ import { DefaultI18nMessages, I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
2
+ export interface IntegratedFeedbackComponentMessages extends I18nMessages {
3
+ starsRating(value: number): string;
4
+ like(): string;
5
+ dislike(): string;
6
+ dichotomousYes(): string;
7
+ dichotomousNo(): string;
8
+ notRated(): string;
9
+ ratedNow(): string;
10
+ ratedToday(): string;
11
+ ratedOn(date: Date): string;
12
+ feedbackInputLabel(): string;
13
+ okButton(): string;
14
+ feedbackSuccess(): string;
15
+ feedbackFailure(): string;
16
+ ratingSuccess(): string;
17
+ ratingFailure(): string;
18
+ mapFeedbackMainTitle(): string;
19
+ mapRatingSectionTitle(): string;
20
+ mapFeedbackSectionTitle(): string;
21
+ mapDichotomousRatingSectionTitle(): string;
22
+ topicFeedbackMainTitle(): string;
23
+ topicRatingSectionTitle(): string;
24
+ topicFeedbackSectionTitle(): string;
25
+ topicDichotomousRatingSectionTitle(): string;
26
+ }
27
+ export declare const feedback: I18nMessageContext<IntegratedFeedbackComponentMessages>;
28
+ export declare const defaultMessages: DefaultI18nMessages<IntegratedFeedbackComponentMessages>;
29
+ //# sourceMappingURL=IntegratedFeedbackComponentMessages.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { I18nMessageContext } from "@fluid-topics/ft-i18n";
2
+ export const feedback = I18nMessageContext.build("integratedFeedbackComponent");
3
+ export const defaultMessages = {
4
+ starsRating: "{0} stars",
5
+ "starsRating[\\=1]": "1 star",
6
+ like: "Like",
7
+ dislike: "Dislike",
8
+ dichotomousYes: "Yes",
9
+ dichotomousNo: "No",
10
+ notRated: "Not rated",
11
+ ratedNow: "Rated now",
12
+ ratedToday: "Rated today",
13
+ ratedOn: "Rated on {0, date}",
14
+ feedbackInputLabel: "How can we improve it?",
15
+ okButton: "Send feedback",
16
+ cancelButton: "Cancel",
17
+ feedbackSuccess: "Feedback successfully sent. Thank you!",
18
+ feedbackFailure: "Failed to send feedback. Please try again later.",
19
+ ratingSuccess: "Rating successfully sent. Thank you!",
20
+ ratingFailure: "Failed to send rating. Please try again later.",
21
+ mapFeedbackMainTitle: "Send feedback",
22
+ mapRatingSectionTitle: "Rate this document",
23
+ mapDichotomousRatingSectionTitle: "Did it solve your problem?",
24
+ mapFeedbackSectionTitle: "Write your review",
25
+ topicFeedbackMainTitle: "Send feedback",
26
+ topicRatingSectionTitle: "Rate this content",
27
+ topicDichotomousRatingSectionTitle: "Did this content solve your problem?",
28
+ topicFeedbackSectionTitle: "Write your review",
29
+ };
30
+ //# sourceMappingURL=IntegratedFeedbackComponentMessages.js.map
@@ -0,0 +1,21 @@
1
+ import { I18nMessageContext, I18nMessages } from "@fluid-topics/ft-i18n";
2
+ interface ServerMessages extends I18nMessages {
3
+ ["mail.feedback.subject"](topicTitle: string, mapTitle: string): string;
4
+ ["mail.feedback.title"](topicTitle: string, mapTitle: string): string;
5
+ ["mail.map_feedback.subject"](mapTitle: string): string;
6
+ ["mail.map_feedback.title"](mapTitle: string): string;
7
+ ["mail.feedback.disclaimer"](): string;
8
+ ["mail.feedback.ratingStarsMessage0"](): string;
9
+ ["mail.feedback.ratingStarsMessage1"](): string;
10
+ ["mail.feedback.ratingStarsMessage2"](): string;
11
+ ["mail.feedback.ratingStarsMessage3"](): string;
12
+ ["mail.feedback.ratingStarsMessage4"](): string;
13
+ ["mail.feedback.ratingStarsMessage5"](): string;
14
+ ["mail.feedback.ratingNoLikeMessage"](): string;
15
+ ["mail.feedback.ratingLikeMessage"](): string;
16
+ ["mail.feedback.ratingDichotomousNoMessage"](): string;
17
+ ["mail.feedback.ratingDichotomousYesMessage"](): string;
18
+ }
19
+ export declare const server: I18nMessageContext<ServerMessages>;
20
+ export {};
21
+ //# sourceMappingURL=ServerMessages.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { I18nMessageContext } from "@fluid-topics/ft-i18n";
2
+ export const server = I18nMessageContext.fromGwt("server");
3
+ //# sourceMappingURL=ServerMessages.js.map
@@ -1,13 +1,11 @@
1
1
  import { FtMetadata, FtReaderFeedbackConfiguration } from "@fluid-topics/public-api";
2
2
  export declare class FeedbackMailLinkBuilder {
3
- private disclaimer;
4
3
  private subject;
5
4
  private url;
6
5
  private allMetadata;
7
6
  private subjectMetadata;
8
7
  private configuration?;
9
8
  private isAuthenticated;
10
- constructor(disclaimer: string);
11
9
  update(subject: string, url: string, metadata: Array<FtMetadata>, configuration: FtReaderFeedbackConfiguration, isAuthenticated: boolean): void;
12
10
  build(feedbackMessage: string): string | undefined;
13
11
  }
@@ -1,6 +1,6 @@
1
+ import { server } from "./ServerMessages";
1
2
  export class FeedbackMailLinkBuilder {
2
- constructor(disclaimer) {
3
- this.disclaimer = disclaimer;
3
+ constructor() {
4
4
  this.subject = "";
5
5
  this.url = "";
6
6
  this.allMetadata = "";
@@ -35,7 +35,7 @@ _________________________________________________________________
35
35
  ${feedbackMessage}
36
36
 
37
37
  _________________________________________________________________
38
- ${this.disclaimer}`);
38
+ ${server.messages["mail.feedback.disclaimer"]()}`);
39
39
  return `mailto:${(_b = this.configuration) === null || _b === void 0 ? void 0 : _b.recipients.join(",")}?subject=${subject}&body=${body}`;
40
40
  }
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-feedback",
3
- "version": "0.3.58",
3
+ "version": "0.3.61",
4
4
  "description": "Feedback forms for a map and its topics in an integrated reader",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,8 +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-wc-utils": "0.3.58",
22
+ "@fluid-topics/ft-app-context": "0.3.61",
23
+ "@fluid-topics/ft-reader-context": "0.3.61",
24
+ "@fluid-topics/ft-wc-utils": "0.3.61",
23
25
  "lit": "2.2.8"
24
26
  },
25
- "gitHead": "c053ee1216238ba6b2c62e5add329343f735c77e"
27
+ "gitHead": "12a4024fb3084b17772a3aef10723d22ae56c877"
26
28
  }
@@ -1,30 +0,0 @@
1
- import { ParametrizedLabelResolver, ParametrizedLabels } from "@fluid-topics/ft-wc-utils";
2
- export interface FtReaderFeedbackLabels extends ParametrizedLabels {
3
- feedbackMainTitle?: string;
4
- ratingSectionTitle?: string;
5
- feedbackSectionTitle?: string;
6
- starsRating?: string;
7
- "starsRating[\\=1]"?: string;
8
- like?: string;
9
- dislike?: string;
10
- dichotomousRatingSectionTitle?: string;
11
- dichotomousYes?: string;
12
- dichotomousNo?: string;
13
- notRated?: string;
14
- ratedNow?: string;
15
- ratedToday?: string;
16
- ratedOn?: string;
17
- feedbackInputLabel?: string;
18
- okButton?: string;
19
- cancelButton?: string;
20
- mailSubject?: string;
21
- mailDisclaimer?: string;
22
- feedbackSuccess?: string;
23
- feedbackFailure?: string;
24
- ratingSuccess?: string;
25
- ratingFailure?: string;
26
- feedbackAndRatingDisabledInEditor?: string;
27
- }
28
- export declare const topicLabelResolver: ParametrizedLabelResolver<FtReaderFeedbackLabels>;
29
- export declare const mapLabelResolver: ParametrizedLabelResolver<FtReaderFeedbackLabels>;
30
- //# sourceMappingURL=labels.d.ts.map
@@ -1,40 +0,0 @@
1
- import { ParametrizedLabelResolver } from "@fluid-topics/ft-wc-utils";
2
- const DEFAULT_LABELS = {
3
- starsRating: "{0} stars",
4
- "starsRating[\\=1]": "1 star",
5
- like: "Like",
6
- dislike: "Dislike",
7
- dichotomousYes: "Yes",
8
- dichotomousNo: "No",
9
- notRated: "Not rated",
10
- ratedNow: "Rated now",
11
- ratedToday: "Rated today",
12
- ratedOn: "Rated on {0, date}",
13
- feedbackInputLabel: "How can we improve it?",
14
- okButton: "Send feedback",
15
- cancelButton: "Cancel",
16
- feedbackSuccess: "Feedback successfully sent. Thank you!",
17
- feedbackFailure: "Failed to send feedback. Please try again later.",
18
- ratingSuccess: "Rating successfully sent. Thank you!",
19
- ratingFailure: "Failed to send rating. Please try again later.",
20
- feedbackAndRatingDisabledInEditor: "Feedback and ratings performed here are not taken into account.",
21
- };
22
- const DEFAULT_MAP_LABELS = {
23
- ...DEFAULT_LABELS,
24
- feedbackMainTitle: "Send feedback",
25
- ratingSectionTitle: "Rate this document",
26
- dichotomousRatingSectionTitle: "Did it solve your problem?",
27
- feedbackSectionTitle: "Write your review",
28
- mailSubject: "Feedback about “{0}”",
29
- };
30
- const DEFAULT_TOPIC_LABELS = {
31
- ...DEFAULT_LABELS,
32
- feedbackMainTitle: "Send feedback",
33
- ratingSectionTitle: "Rate this content",
34
- dichotomousRatingSectionTitle: "Did this content solve your problem?",
35
- feedbackSectionTitle: "Write your review",
36
- mailSubject: "Feedback about “{0}” in “{1}”",
37
- };
38
- export const topicLabelResolver = new ParametrizedLabelResolver(DEFAULT_TOPIC_LABELS, {});
39
- export const mapLabelResolver = new ParametrizedLabelResolver(DEFAULT_MAP_LABELS, {});
40
- //# sourceMappingURL=labels.js.map