@fluid-topics/ft-reader-feedback 1.3.12 → 1.3.13
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.
- package/build/ft-reader-feedback.light.js +123 -123
- package/build/ft-reader-feedback.min.js +141 -134
- package/build/ft-reader-map-feedback.d.ts +7 -1
- package/build/ft-reader-map-feedback.js +44 -17
- package/build/ft-reader-topic-feedback.d.ts +8 -3
- package/build/ft-reader-topic-feedback.js +46 -18
- package/package.json +5 -5
|
@@ -6,9 +6,11 @@ import { FeedbackI18nProperties, FtReaderFeedback } from "./ft-reader-feedback";
|
|
|
6
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
|
+
import { GuestLocalStorage } from "@fluid-topics/ft-app-context";
|
|
9
10
|
import { SendFeedbackEvent } from "./utils/events";
|
|
10
11
|
declare const FtReaderMapFeedback_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
11
12
|
export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implements FtReaderFeedbackProperties {
|
|
13
|
+
private readonly guestStorage;
|
|
12
14
|
static elementDefinitions: ElementDefinitionsMap;
|
|
13
15
|
session?: FtSession;
|
|
14
16
|
map?: FtMap;
|
|
@@ -28,10 +30,14 @@ export declare class FtReaderMapFeedback extends FtReaderMapFeedback_base implem
|
|
|
28
30
|
feedbackLinkBuilder: FeedbackMailLinkBuilder;
|
|
29
31
|
mailSubject: string;
|
|
30
32
|
i18nProperties: FeedbackI18nProperties;
|
|
31
|
-
|
|
33
|
+
private static storedRatingIfAuthenticated;
|
|
34
|
+
constructor(guestStorage?: GuestLocalStorage<FtPublicationRatingSummary>);
|
|
32
35
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
33
36
|
protected willUpdate(props: PropertyValues): void;
|
|
34
37
|
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
39
|
+
private readonly loadGuestRating;
|
|
40
|
+
private readonly guestRatingKey;
|
|
35
41
|
protected fetchRatingSummary(): Promise<void>;
|
|
36
42
|
protected sendRatingDebouncer: Debouncer;
|
|
37
43
|
protected rate(ratingEvent: CustomEvent<number | undefined>): void;
|
|
@@ -12,15 +12,16 @@ import { FtReaderFeedback } from "./ft-reader-feedback";
|
|
|
12
12
|
import { FtRatingType } from "@fluid-topics/public-api";
|
|
13
13
|
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
14
14
|
import { FeedbackMailLinkBuilder } from "./utils/mail";
|
|
15
|
-
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
15
|
+
import { ftAppInfoStore, GuestLocalStorage } from "@fluid-topics/ft-app-context";
|
|
16
16
|
import { server } from "./utils/ServerMessages";
|
|
17
17
|
import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
|
|
18
18
|
import { i18n, withI18n } from "@fluid-topics/ft-i18n";
|
|
19
19
|
import { defaultDesignerMessages, designer } from "./utils/InDesignerFeedbackComponentMessages";
|
|
20
20
|
import { OpenMapFeedbackDrawerEvent, SendMailerMapFeedbackEvent } from "./utils/events";
|
|
21
21
|
class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
22
|
-
constructor() {
|
|
22
|
+
constructor(guestStorage = new GuestLocalStorage()) {
|
|
23
23
|
super();
|
|
24
|
+
this.guestStorage = guestStorage;
|
|
24
25
|
this.editorMode = false;
|
|
25
26
|
this.hideTitle = false;
|
|
26
27
|
this.withMoreOptionsButton = false;
|
|
@@ -38,6 +39,16 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
38
39
|
dichotomousRatingSectionTitle: feedback.properties.mapDichotomousRatingSectionTitle(),
|
|
39
40
|
feedbackSectionTitle: feedback.properties.mapFeedbackSectionTitle(),
|
|
40
41
|
};
|
|
42
|
+
this.loadGuestRating = () => {
|
|
43
|
+
const guestRating = this.guestStorage.get(this.guestRatingKey());
|
|
44
|
+
if (guestRating) {
|
|
45
|
+
this.ratingSummary = guestRating;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.guestRatingKey = () => {
|
|
49
|
+
var _a;
|
|
50
|
+
return "ft-reader-map-feedback-guest-rating-" + ((_a = this.map) === null || _a === void 0 ? void 0 : _a.id);
|
|
51
|
+
};
|
|
41
52
|
this.sendRatingDebouncer = new Debouncer(500);
|
|
42
53
|
this.addStore(ftAppInfoStore);
|
|
43
54
|
}
|
|
@@ -60,9 +71,9 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
60
71
|
.filledDislikeIcon=${this.filledDislikeIcon}
|
|
61
72
|
.feedbackMailLinkBuilder=${(feedbackMessage) => this.feedbackLinkBuilder.build(feedbackMessage)}
|
|
62
73
|
@rate=${this.rate}
|
|
63
|
-
@send-feedback
|
|
64
|
-
@mailer-feedback
|
|
65
|
-
@open-more-options
|
|
74
|
+
@send-feedback="${this.sendFeedback}"
|
|
75
|
+
@mailer-feedback="${this.onMailerFeedbackSent}"
|
|
76
|
+
@open-more-options="${this.openMoreOptions}"
|
|
66
77
|
></ft-reader-feedback>
|
|
67
78
|
`;
|
|
68
79
|
}
|
|
@@ -75,12 +86,20 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
75
86
|
if (props.has("editorMode") && this.editorMode) {
|
|
76
87
|
this.addI18nContext(designer, defaultDesignerMessages);
|
|
77
88
|
}
|
|
78
|
-
if (["map", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.configuration) {
|
|
89
|
+
if (["map", "configuration", "user", "mailSubject"].some((p) => props.has(p)) && this.map && this.configuration) {
|
|
79
90
|
this.feedbackLinkBuilder.update(this.mailSubject, (_c = (_b = this.service) === null || _b === void 0 ? void 0 : _b.getLink()) !== null && _c !== void 0 ? _c : "", this.map.metadata, this.configuration, ((_e = (_d = this.session) === null || _d === void 0 ? void 0 : _d.profile) === null || _e === void 0 ? void 0 : _e.userId) != null);
|
|
80
91
|
}
|
|
92
|
+
if (["session", "map"].some((p) => props.has(p)) && this.session && this.map) {
|
|
93
|
+
this.loadGuestRating();
|
|
94
|
+
}
|
|
81
95
|
}
|
|
82
96
|
connectedCallback() {
|
|
83
97
|
super.connectedCallback();
|
|
98
|
+
this.guestStorage.addStoreListener(this.guestRatingKey, this.loadGuestRating);
|
|
99
|
+
}
|
|
100
|
+
disconnectedCallback() {
|
|
101
|
+
super.disconnectedCallback();
|
|
102
|
+
this.guestStorage.clearStoreListeners();
|
|
84
103
|
}
|
|
85
104
|
// Used in GWT
|
|
86
105
|
async fetchRatingSummary() {
|
|
@@ -94,9 +113,10 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
94
113
|
rating: ratingEvent.detail == null ? undefined : {
|
|
95
114
|
type: this.ratingSummary.type,
|
|
96
115
|
value: ratingEvent.detail,
|
|
97
|
-
date: new Date()
|
|
98
|
-
}
|
|
116
|
+
date: new Date(),
|
|
117
|
+
},
|
|
99
118
|
};
|
|
119
|
+
this.guestStorage.store(this.guestRatingKey(), this.ratingSummary);
|
|
100
120
|
this.sendRatingDebouncer.run(() => this.sendRating(ratingEvent.detail));
|
|
101
121
|
}
|
|
102
122
|
}
|
|
@@ -114,7 +134,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
114
134
|
catch {
|
|
115
135
|
this.dispatchEvent(new FtNotificationEvent({
|
|
116
136
|
type: "error",
|
|
117
|
-
message: feedback.messages.ratingFailure()
|
|
137
|
+
message: feedback.messages.ratingFailure(),
|
|
118
138
|
}));
|
|
119
139
|
}
|
|
120
140
|
await ((_d = this.stateManager) === null || _d === void 0 ? void 0 : _d.fetchMapRating());
|
|
@@ -122,7 +142,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
122
142
|
else if (this.editorMode) {
|
|
123
143
|
this.dispatchEvent(new FtNotificationEvent({
|
|
124
144
|
type: "info",
|
|
125
|
-
message: designer.messages.feedbackAndRatingDisabledInEditor()
|
|
145
|
+
message: designer.messages.feedbackAndRatingDisabledInEditor(),
|
|
126
146
|
}));
|
|
127
147
|
}
|
|
128
148
|
}
|
|
@@ -133,13 +153,13 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
133
153
|
await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.sendMapFeedback(ratingEvent.detail.message, ratingEvent.detail.from));
|
|
134
154
|
this.dispatchEvent(new FtNotificationEvent({
|
|
135
155
|
type: "info",
|
|
136
|
-
message: feedback.messages.feedbackSuccess()
|
|
156
|
+
message: feedback.messages.feedbackSuccess(),
|
|
137
157
|
}));
|
|
138
158
|
}
|
|
139
159
|
else {
|
|
140
160
|
this.dispatchEvent(new FtNotificationEvent({
|
|
141
161
|
type: "info",
|
|
142
|
-
message: designer.messages.feedbackAndRatingDisabledInEditor()
|
|
162
|
+
message: designer.messages.feedbackAndRatingDisabledInEditor(),
|
|
143
163
|
}));
|
|
144
164
|
}
|
|
145
165
|
this.readerFeedback.clearFeedbackInput();
|
|
@@ -147,7 +167,7 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
147
167
|
catch {
|
|
148
168
|
this.dispatchEvent(new FtNotificationEvent({
|
|
149
169
|
type: "error",
|
|
150
|
-
message: feedback.messages.feedbackFailure()
|
|
170
|
+
message: feedback.messages.feedbackFailure(),
|
|
151
171
|
}));
|
|
152
172
|
}
|
|
153
173
|
}
|
|
@@ -161,12 +181,19 @@ class FtReaderMapFeedback extends withI18n(FtReaderComponent) {
|
|
|
161
181
|
mapTitle: this.map.title,
|
|
162
182
|
mapMetadata: ((_a = this.map) === null || _a === void 0 ? void 0 : _a.metadata) || [],
|
|
163
183
|
ratingType: ((_b = this.ratingSummary) === null || _b === void 0 ? void 0 : _b.type) || FtRatingType.NO_RATING,
|
|
164
|
-
ratingValue: (_c = this.ratingSummary) === null || _c === void 0 ? void 0 : _c.rating
|
|
184
|
+
ratingValue: (_c = this.ratingSummary) === null || _c === void 0 ? void 0 : _c.rating,
|
|
165
185
|
}));
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
188
|
FtReaderMapFeedback.elementDefinitions = {
|
|
169
|
-
"ft-reader-feedback": FtReaderFeedback
|
|
189
|
+
"ft-reader-feedback": FtReaderFeedback,
|
|
190
|
+
};
|
|
191
|
+
FtReaderMapFeedback.storedRatingIfAuthenticated = (state, self) => {
|
|
192
|
+
var _a, _b;
|
|
193
|
+
if ((_a = self.session) === null || _a === void 0 ? void 0 : _a.sessionAuthenticated) {
|
|
194
|
+
return state.mapRating;
|
|
195
|
+
}
|
|
196
|
+
return (_b = self.ratingSummary) !== null && _b !== void 0 ? _b : state.mapRating;
|
|
170
197
|
};
|
|
171
198
|
__decorate([
|
|
172
199
|
redux({ store: ftAppInfoStore.name })
|
|
@@ -180,13 +207,13 @@ __decorate([
|
|
|
180
207
|
__decorate([
|
|
181
208
|
redux({
|
|
182
209
|
store: "reader",
|
|
183
|
-
selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; }
|
|
210
|
+
selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; },
|
|
184
211
|
})
|
|
185
212
|
], FtReaderMapFeedback.prototype, "configuration", void 0);
|
|
186
213
|
__decorate([
|
|
187
214
|
redux({
|
|
188
215
|
store: "reader",
|
|
189
|
-
selector:
|
|
216
|
+
selector: FtReaderMapFeedback.storedRatingIfAuthenticated,
|
|
190
217
|
})
|
|
191
218
|
], FtReaderMapFeedback.prototype, "ratingSummary", void 0);
|
|
192
219
|
__decorate([
|
|
@@ -3,14 +3,15 @@ import { Debouncer, 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
|
|
7
|
-
import { FtReaderFeedbackConfiguration } from "@fluid-topics/public-api";
|
|
6
|
+
import { FtMap, FtReaderFeedbackConfiguration, FtSession } from "@fluid-topics/public-api";
|
|
8
7
|
import { FtTopicRatingSummary } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
9
8
|
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
10
9
|
import { FeedbackMailLinkBuilder } from "./utils/mail";
|
|
10
|
+
import { GuestLocalStorage } from "@fluid-topics/ft-app-context";
|
|
11
11
|
import { SendFeedbackEvent } from "./utils/events";
|
|
12
12
|
declare const FtReaderTopicFeedback_base: typeof FtReaderTopicComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
13
13
|
export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base implements FtReaderFeedbackProperties {
|
|
14
|
+
private readonly guestStorage;
|
|
14
15
|
static elementDefinitions: ElementDefinitionsMap;
|
|
15
16
|
session?: FtSession;
|
|
16
17
|
map?: FtMap;
|
|
@@ -30,10 +31,14 @@ export declare class FtReaderTopicFeedback extends FtReaderTopicFeedback_base im
|
|
|
30
31
|
feedbackLinkBuilder: FeedbackMailLinkBuilder;
|
|
31
32
|
mailSubject: string;
|
|
32
33
|
i18nProperties: FeedbackI18nProperties;
|
|
33
|
-
|
|
34
|
+
private static storedRatingIfAuthenticated;
|
|
35
|
+
constructor(guestStorage?: GuestLocalStorage<FtTopicRatingSummary>);
|
|
34
36
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
35
37
|
protected willUpdate(props: PropertyValues): void;
|
|
36
38
|
connectedCallback(): void;
|
|
39
|
+
disconnectedCallback(): void;
|
|
40
|
+
private readonly loadGuestRating;
|
|
41
|
+
private readonly guestRatingKey;
|
|
37
42
|
protected fetchRatingSummary(): Promise<void>;
|
|
38
43
|
protected sendRatingDebouncer: Debouncer;
|
|
39
44
|
protected rate(ratingEvent: CustomEvent<number | undefined>): void;
|
|
@@ -12,15 +12,16 @@ import { FtReaderTopicComponent } from "@fluid-topics/ft-reader-topic-context/bu
|
|
|
12
12
|
import { FtRatingType } from "@fluid-topics/public-api";
|
|
13
13
|
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
14
14
|
import { FeedbackMailLinkBuilder } from "./utils/mail";
|
|
15
|
-
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
15
|
+
import { ftAppInfoStore, GuestLocalStorage } from "@fluid-topics/ft-app-context";
|
|
16
16
|
import { feedback } from "./utils/IntegratedFeedbackComponentMessages";
|
|
17
17
|
import { server } from "./utils/ServerMessages";
|
|
18
18
|
import { i18n, withI18n } from "@fluid-topics/ft-i18n";
|
|
19
19
|
import { defaultDesignerMessages, designer } from "./utils/InDesignerFeedbackComponentMessages";
|
|
20
20
|
import { OpenTopicFeedbackDrawerEvent, SendMailerTopicFeedbackEvent } from "./utils/events";
|
|
21
21
|
class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
22
|
-
constructor() {
|
|
22
|
+
constructor(guestStorage = new GuestLocalStorage()) {
|
|
23
23
|
super();
|
|
24
|
+
this.guestStorage = guestStorage;
|
|
24
25
|
this.editorMode = false;
|
|
25
26
|
this.hideTitle = false;
|
|
26
27
|
this.withMoreOptionsButton = false;
|
|
@@ -38,6 +39,16 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
38
39
|
dichotomousRatingSectionTitle: feedback.properties.topicDichotomousRatingSectionTitle(),
|
|
39
40
|
feedbackSectionTitle: feedback.properties.topicFeedbackSectionTitle(),
|
|
40
41
|
};
|
|
42
|
+
this.loadGuestRating = () => {
|
|
43
|
+
const guestRating = this.guestStorage.get(this.guestRatingKey());
|
|
44
|
+
if (guestRating) {
|
|
45
|
+
this.ratingSummary = guestRating;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.guestRatingKey = () => {
|
|
49
|
+
var _a;
|
|
50
|
+
return "ft-reader-topic-feedback-guest-rating-" + ((_a = this.tocNode) === null || _a === void 0 ? void 0 : _a.tocId);
|
|
51
|
+
};
|
|
41
52
|
this.sendRatingDebouncer = new Debouncer(500);
|
|
42
53
|
this.addStore(ftAppInfoStore);
|
|
43
54
|
}
|
|
@@ -61,27 +72,35 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
61
72
|
.filledDislikeIcon=${this.filledDislikeIcon}
|
|
62
73
|
.feedbackMailLinkBuilder=${(feedbackMessage) => this.feedbackLinkBuilder.build(feedbackMessage)}
|
|
63
74
|
@rate=${this.rate}
|
|
64
|
-
@send-feedback
|
|
65
|
-
@mailer-feedback
|
|
66
|
-
@open-more-options
|
|
75
|
+
@send-feedback="${this.sendFeedback}"
|
|
76
|
+
@mailer-feedback="${this.onMailerFeedbackSent}"
|
|
77
|
+
@open-more-options="${this.openMoreOptions}"
|
|
67
78
|
></ft-reader-feedback>
|
|
68
79
|
`;
|
|
69
80
|
}
|
|
70
81
|
willUpdate(props) {
|
|
71
82
|
var _a, _b, _c, _d, _e;
|
|
72
83
|
super.willUpdate(props);
|
|
73
|
-
if (["tocNode", "user"].some(p => props.has(p)) && this.tocNode) {
|
|
84
|
+
if (["tocNode", "user"].some((p) => props.has(p)) && this.tocNode) {
|
|
74
85
|
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.fetchTopicRating(this.tocNode.tocId);
|
|
75
86
|
}
|
|
76
87
|
if (props.has("editorMode") && this.editorMode) {
|
|
77
88
|
this.addI18nContext(designer, defaultDesignerMessages);
|
|
78
89
|
}
|
|
79
|
-
if (["map", "tocNode", "configuration", "user", "mailSubject"].some(p => props.has(p)) && this.map && this.tocNode && this.configuration) {
|
|
90
|
+
if (["map", "tocNode", "configuration", "user", "mailSubject"].some((p) => props.has(p)) && this.map && this.tocNode && this.configuration) {
|
|
80
91
|
this.feedbackLinkBuilder.update(this.mailSubject, (_c = (_b = this.service) === null || _b === void 0 ? void 0 : _b.getLink(this.tocNode.tocId)) !== null && _c !== void 0 ? _c : "", this.map.metadata, this.configuration, ((_e = (_d = this.session) === null || _d === void 0 ? void 0 : _d.profile) === null || _e === void 0 ? void 0 : _e.userId) != null);
|
|
81
92
|
}
|
|
93
|
+
if (["session", "tocNode"].some((p) => props.has(p)) && this.session && this.tocNode) {
|
|
94
|
+
this.loadGuestRating();
|
|
95
|
+
}
|
|
82
96
|
}
|
|
83
97
|
connectedCallback() {
|
|
84
98
|
super.connectedCallback();
|
|
99
|
+
this.guestStorage.addStoreListener(this.guestRatingKey, this.loadGuestRating);
|
|
100
|
+
}
|
|
101
|
+
disconnectedCallback() {
|
|
102
|
+
super.disconnectedCallback();
|
|
103
|
+
this.guestStorage.clearStoreListeners();
|
|
85
104
|
}
|
|
86
105
|
// Used in GWT
|
|
87
106
|
async fetchRatingSummary() {
|
|
@@ -96,9 +115,10 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
96
115
|
tocId: this.tocNode.tocId,
|
|
97
116
|
type: this.ratingSummary.type,
|
|
98
117
|
value: ratingEvent.detail,
|
|
99
|
-
date: new Date()
|
|
100
|
-
}
|
|
118
|
+
date: new Date(),
|
|
119
|
+
},
|
|
101
120
|
};
|
|
121
|
+
this.guestStorage.store(this.guestRatingKey(), this.ratingSummary);
|
|
102
122
|
this.sendRatingDebouncer.run(() => this.sendRating(ratingEvent.detail));
|
|
103
123
|
}
|
|
104
124
|
}
|
|
@@ -116,7 +136,7 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
116
136
|
catch {
|
|
117
137
|
this.dispatchEvent(new FtNotificationEvent({
|
|
118
138
|
type: "error",
|
|
119
|
-
message: feedback.messages.ratingFailure()
|
|
139
|
+
message: feedback.messages.ratingFailure(),
|
|
120
140
|
}));
|
|
121
141
|
}
|
|
122
142
|
await ((_d = this.stateManager) === null || _d === void 0 ? void 0 : _d.fetchTopicRating(this.tocNode.tocId));
|
|
@@ -124,7 +144,7 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
124
144
|
else if (this.editorMode) {
|
|
125
145
|
this.dispatchEvent(new FtNotificationEvent({
|
|
126
146
|
type: "info",
|
|
127
|
-
message: designer.messages.feedbackAndRatingDisabledInEditor()
|
|
147
|
+
message: designer.messages.feedbackAndRatingDisabledInEditor(),
|
|
128
148
|
}));
|
|
129
149
|
}
|
|
130
150
|
}
|
|
@@ -135,21 +155,21 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
135
155
|
await ((_a = this.service) === null || _a === void 0 ? void 0 : _a.sendTopicFeedback(this.tocNode.tocId, ratingEvent.detail.message, ratingEvent.detail.from));
|
|
136
156
|
this.dispatchEvent(new FtNotificationEvent({
|
|
137
157
|
type: "info",
|
|
138
|
-
message: feedback.messages.feedbackSuccess()
|
|
158
|
+
message: feedback.messages.feedbackSuccess(),
|
|
139
159
|
}));
|
|
140
160
|
this.readerFeedback.clearFeedbackInput();
|
|
141
161
|
}
|
|
142
162
|
else if (this.editorMode) {
|
|
143
163
|
this.dispatchEvent(new FtNotificationEvent({
|
|
144
164
|
type: "info",
|
|
145
|
-
message: designer.messages.feedbackAndRatingDisabledInEditor()
|
|
165
|
+
message: designer.messages.feedbackAndRatingDisabledInEditor(),
|
|
146
166
|
}));
|
|
147
167
|
}
|
|
148
168
|
}
|
|
149
169
|
catch {
|
|
150
170
|
this.dispatchEvent(new FtNotificationEvent({
|
|
151
171
|
type: "error",
|
|
152
|
-
message: feedback.messages.feedbackFailure()
|
|
172
|
+
message: feedback.messages.feedbackFailure(),
|
|
153
173
|
}));
|
|
154
174
|
}
|
|
155
175
|
}
|
|
@@ -168,12 +188,20 @@ class FtReaderTopicFeedback extends withI18n(FtReaderTopicComponent) {
|
|
|
168
188
|
mapMetadata: ((_c = this.map) === null || _c === void 0 ? void 0 : _c.metadata) || [],
|
|
169
189
|
breadcrumb: ((_e = (_d = this.stateManager) === null || _d === void 0 ? void 0 : _d.service) === null || _e === void 0 ? void 0 : _e.buildBreadcrumb(this.tocNode.tocId)) || [],
|
|
170
190
|
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,
|
|
171
|
-
ratingValue: (_h = this.ratingSummary) === null || _h === void 0 ? void 0 : _h.rating
|
|
191
|
+
ratingValue: (_h = this.ratingSummary) === null || _h === void 0 ? void 0 : _h.rating,
|
|
172
192
|
}));
|
|
173
193
|
}
|
|
174
194
|
}
|
|
175
195
|
FtReaderTopicFeedback.elementDefinitions = {
|
|
176
|
-
"ft-reader-feedback": FtReaderFeedback
|
|
196
|
+
"ft-reader-feedback": FtReaderFeedback,
|
|
197
|
+
};
|
|
198
|
+
FtReaderTopicFeedback.storedRatingIfAuthenticated = (state, self) => {
|
|
199
|
+
var _a, _b, _c, _d;
|
|
200
|
+
const storedRating = state.topicsRating[(_b = (_a = self.tocNode) === null || _a === void 0 ? void 0 : _a.tocId) !== null && _b !== void 0 ? _b : ""];
|
|
201
|
+
if ((_c = self.session) === null || _c === void 0 ? void 0 : _c.sessionAuthenticated) {
|
|
202
|
+
return storedRating;
|
|
203
|
+
}
|
|
204
|
+
return (_d = self.ratingSummary) !== null && _d !== void 0 ? _d : storedRating;
|
|
177
205
|
};
|
|
178
206
|
__decorate([
|
|
179
207
|
redux({ store: ftAppInfoStore.name })
|
|
@@ -187,13 +215,13 @@ __decorate([
|
|
|
187
215
|
__decorate([
|
|
188
216
|
redux({
|
|
189
217
|
store: "reader",
|
|
190
|
-
selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; }
|
|
218
|
+
selector: (state) => { var _a; return (_a = state.configuration) === null || _a === void 0 ? void 0 : _a.feedback; },
|
|
191
219
|
})
|
|
192
220
|
], FtReaderTopicFeedback.prototype, "configuration", void 0);
|
|
193
221
|
__decorate([
|
|
194
222
|
redux({
|
|
195
223
|
store: "reader",
|
|
196
|
-
selector:
|
|
224
|
+
selector: FtReaderTopicFeedback.storedRatingIfAuthenticated,
|
|
197
225
|
})
|
|
198
226
|
], FtReaderTopicFeedback.prototype, "ratingSummary", void 0);
|
|
199
227
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-feedback",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
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.3.
|
|
23
|
-
"@fluid-topics/ft-reader-context": "1.3.
|
|
24
|
-
"@fluid-topics/ft-wc-utils": "1.3.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.3.13",
|
|
23
|
+
"@fluid-topics/ft-reader-context": "1.3.13",
|
|
24
|
+
"@fluid-topics/ft-wc-utils": "1.3.13",
|
|
25
25
|
"lit": "3.1.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluid-topics/public-api": "1.0.100"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "3f7e281a9fee6f1df464e79064f917e1feec3253"
|
|
31
31
|
}
|