@fluid-topics/ft-reader-feedback 2.1.20 → 2.1.22
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-base-feedback.d.ts +55 -0
- package/build/ft-base-feedback.js +332 -0
- package/build/{ft-reader-feedback.properties.d.ts → ft-base-feedback.properties.d.ts} +1 -1
- package/build/ft-base-feedback.styles.d.ts +13 -0
- package/build/ft-base-feedback.styles.js +67 -0
- package/build/ft-reader-feedback.d.ts +2 -57
- package/build/ft-reader-feedback.js +5 -344
- package/build/ft-reader-feedback.light.js +692 -699
- package/build/ft-reader-feedback.min.js +664 -671
- package/build/ft-reader-feedback.styles.d.ts +2 -12
- package/build/ft-reader-feedback.styles.js +1 -62
- package/build/ft-reader-map-feedback.d.ts +8 -4
- package/build/ft-reader-map-feedback.js +28 -15
- package/build/ft-reader-topic-feedback.d.ts +8 -4
- package/build/ft-reader-topic-feedback.js +26 -13
- package/build/index.d.ts +6 -1
- package/build/index.js +6 -1
- package/build/utils/IntegratedFeedbackComponentMessages.d.ts +4 -0
- package/build/utils/IntegratedFeedbackComponentMessages.js +4 -0
- package/build/utils/ServerMessages.d.ts +2 -0
- package/package.json +6 -6
- /package/build/{ft-reader-feedback.properties.js → ft-base-feedback.properties.js} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { nothing } from "lit";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElementRedux } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FtFeedbackProperties } from "./ft-base-feedback.properties";
|
|
4
|
+
import { FtTopicRatingSummary } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
5
|
+
import { FtPublicationRatingSummary, FtRatingType, FtReaderFeedbackConfiguration, FtSession } from "@fluid-topics/public-api";
|
|
6
|
+
import { FtTextArea } from "@fluid-topics/ft-text-area";
|
|
7
|
+
import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
|
|
8
|
+
import { I18nPropertyInit } from "@fluid-topics/ft-i18n";
|
|
9
|
+
export interface FeedbackI18nProperties {
|
|
10
|
+
feedbackMainTitle: I18nPropertyInit;
|
|
11
|
+
ratingSectionTitle: I18nPropertyInit;
|
|
12
|
+
feedbackSectionTitle: I18nPropertyInit;
|
|
13
|
+
dichotomousRatingSectionTitle: I18nPropertyInit;
|
|
14
|
+
}
|
|
15
|
+
declare const FtBaseFeedback_base: typeof FtLitElementRedux & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
16
|
+
export declare class FtBaseFeedback extends FtBaseFeedback_base implements FtFeedbackProperties {
|
|
17
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
18
|
+
hideTitle: boolean;
|
|
19
|
+
withMoreOptionsButton: boolean;
|
|
20
|
+
iconVariant?: FtIconVariants;
|
|
21
|
+
emptyStarIcon?: string;
|
|
22
|
+
filledStarIcon?: string;
|
|
23
|
+
emptyLikeIcon?: string;
|
|
24
|
+
filledLikeIcon?: string;
|
|
25
|
+
emptyDislikeIcon?: string;
|
|
26
|
+
filledDislikeIcon?: string;
|
|
27
|
+
canAccessFeedback: boolean;
|
|
28
|
+
canRateThisContent: boolean;
|
|
29
|
+
i18nProperties?: FeedbackI18nProperties;
|
|
30
|
+
ratingSummary?: FtPublicationRatingSummary | FtTopicRatingSummary;
|
|
31
|
+
configuration?: FtReaderFeedbackConfiguration;
|
|
32
|
+
feedbackMailLinkBuilder: (feedbackMessage: string) => string | undefined;
|
|
33
|
+
session?: FtSession;
|
|
34
|
+
feedbackInput: FtTextArea;
|
|
35
|
+
from: string;
|
|
36
|
+
feedbackMessage: string;
|
|
37
|
+
constructor();
|
|
38
|
+
get configuredRatingType(): FtRatingType | "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
|
|
39
|
+
get ratingTypeOfDoneRatingOfThisContent(): FtRatingType.NO_RATING | "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
|
|
40
|
+
get ratingValue(): number;
|
|
41
|
+
get ratingDate(): Date | undefined;
|
|
42
|
+
protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
43
|
+
private renderRatingSection;
|
|
44
|
+
private renderRatingDate;
|
|
45
|
+
private renderRating;
|
|
46
|
+
private rate;
|
|
47
|
+
private renderFeedbackSection;
|
|
48
|
+
private onFormSubmitEvent;
|
|
49
|
+
private validFromEmail;
|
|
50
|
+
private sendFeedback;
|
|
51
|
+
private onMailerFeedbackSent;
|
|
52
|
+
private onOpenMoreDetails;
|
|
53
|
+
clearFeedbackInput(): void;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing, } from "lit";
|
|
8
|
+
import { property, query, state, } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElementRedux, parseDate, redux, } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { FtRatingType, } from "@fluid-topics/public-api";
|
|
11
|
+
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
12
|
+
import { FtSwitch, FtSwitchOption, } from "@fluid-topics/ft-switch";
|
|
13
|
+
import { FtTextArea } from "@fluid-topics/ft-text-area";
|
|
14
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
15
|
+
import { FtButton } from "@fluid-topics/ft-button";
|
|
16
|
+
import { defaultMessages, feedback, } from "./utils/IntegratedFeedbackComponentMessages";
|
|
17
|
+
import { withI18n, } from "@fluid-topics/ft-i18n";
|
|
18
|
+
import { FtTextField } from "@fluid-topics/ft-text-field";
|
|
19
|
+
import { SendFeedbackEvent } from "./utils/events";
|
|
20
|
+
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
21
|
+
export class FtBaseFeedback extends withI18n(FtLitElementRedux) {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.hideTitle = false;
|
|
25
|
+
this.withMoreOptionsButton = false;
|
|
26
|
+
this.emptyStarIcon = "STAR";
|
|
27
|
+
this.filledStarIcon = "STAR_PLAIN";
|
|
28
|
+
this.emptyLikeIcon = "THUMBS_UP";
|
|
29
|
+
this.filledLikeIcon = "THUMBS_UP_PLAIN";
|
|
30
|
+
this.emptyDislikeIcon = "THUMBS_DOWN";
|
|
31
|
+
this.filledDislikeIcon = "THUMBS_DOWN_PLAIN";
|
|
32
|
+
this.canAccessFeedback = false;
|
|
33
|
+
this.canRateThisContent = false;
|
|
34
|
+
this.from = "";
|
|
35
|
+
this.feedbackMessage = "";
|
|
36
|
+
this.addI18nContext(feedback, defaultMessages);
|
|
37
|
+
this.addStore(ftAppInfoStore);
|
|
38
|
+
}
|
|
39
|
+
get configuredRatingType() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
return (_b = (_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : FtRatingType.NO_RATING;
|
|
42
|
+
}
|
|
43
|
+
get ratingTypeOfDoneRatingOfThisContent() {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
return (_c = (_b = (_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.rating) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : FtRatingType.NO_RATING;
|
|
46
|
+
}
|
|
47
|
+
get ratingValue() {
|
|
48
|
+
var _a, _b, _c;
|
|
49
|
+
return (_c = (_b = (_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.rating) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : -1;
|
|
50
|
+
}
|
|
51
|
+
get ratingDate() {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const date = (_b = (_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.rating) === null || _b === void 0 ? void 0 : _b.date;
|
|
54
|
+
return typeof date === "string" ? parseDate(date) : date;
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
if (!this.canAccessFeedback && !this.canRateThisContent) {
|
|
58
|
+
return nothing;
|
|
59
|
+
}
|
|
60
|
+
return html `
|
|
61
|
+
<div part="container">
|
|
62
|
+
${this.hideTitle ? nothing : html `
|
|
63
|
+
<ft-typography variant="${FtTypographyVariants.title}" part="main-title">
|
|
64
|
+
${this.i18n(this.i18nProperties.feedbackMainTitle)}
|
|
65
|
+
</ft-typography>
|
|
66
|
+
`}
|
|
67
|
+
${this.renderRatingSection()}
|
|
68
|
+
${this.renderFeedbackSection()}
|
|
69
|
+
</div>
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
renderRatingSection() {
|
|
73
|
+
var _a;
|
|
74
|
+
if (this.canRateThisContent) {
|
|
75
|
+
return html `
|
|
76
|
+
<div part="rating-container">
|
|
77
|
+
<ft-typography variant="${FtTypographyVariants.title_dense}" part="section-title">
|
|
78
|
+
${this.i18n(((_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type) === FtRatingType.DICHOTOMOUS
|
|
79
|
+
? this.i18nProperties.dichotomousRatingSectionTitle
|
|
80
|
+
: this.i18nProperties.ratingSectionTitle)}
|
|
81
|
+
</ft-typography>
|
|
82
|
+
${this.renderRating()}
|
|
83
|
+
<ft-typography variant="${FtTypographyVariants.caption}" part="rating-date">
|
|
84
|
+
${this.renderRatingDate()}
|
|
85
|
+
</ft-typography>
|
|
86
|
+
</div>
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
return nothing;
|
|
90
|
+
}
|
|
91
|
+
renderRatingDate() {
|
|
92
|
+
const ratingDate = this.ratingDate;
|
|
93
|
+
if (ratingDate == null) {
|
|
94
|
+
return feedback.messages.notRated();
|
|
95
|
+
}
|
|
96
|
+
if (ratingDate.getTime() > (new Date().getTime() - 60000)) { // Less than 1 min ago
|
|
97
|
+
return feedback.messages.ratedNow();
|
|
98
|
+
}
|
|
99
|
+
const today = new Date().toLocaleDateString();
|
|
100
|
+
const formattedDate = ratingDate.toLocaleDateString();
|
|
101
|
+
if (today === formattedDate) {
|
|
102
|
+
return feedback.messages.ratedToday();
|
|
103
|
+
}
|
|
104
|
+
return feedback.messages.ratedOn(ratingDate);
|
|
105
|
+
}
|
|
106
|
+
renderRating() {
|
|
107
|
+
switch (this.configuredRatingType) {
|
|
108
|
+
case FtRatingType.STARS:
|
|
109
|
+
return html `
|
|
110
|
+
<div part="rating rating-stars">
|
|
111
|
+
${repeat(new Array(5), (_, index) => index, (_, index) => {
|
|
112
|
+
const active = this.ratingTypeOfDoneRatingOfThisContent === FtRatingType.STARS && this.ratingValue > index;
|
|
113
|
+
const ratingValue = index + 1;
|
|
114
|
+
return html `
|
|
115
|
+
<ft-button round part="rating-stars-${ratingValue}"
|
|
116
|
+
label="${feedback.messages.starsRating(ratingValue)}"
|
|
117
|
+
tooltipPosition="top"
|
|
118
|
+
.iconVariant=${this.iconVariant}
|
|
119
|
+
icon="${active ? this.filledStarIcon : this.emptyStarIcon}"
|
|
120
|
+
class="rating-stars--${active ? "active" : "inactive"}"
|
|
121
|
+
@click=${() => this.rate(this.ratingValue === ratingValue ? undefined : ratingValue)}
|
|
122
|
+
></ft-button>
|
|
123
|
+
`;
|
|
124
|
+
})}
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
case FtRatingType.LIKE: {
|
|
128
|
+
const disliked = this.ratingTypeOfDoneRatingOfThisContent === FtRatingType.LIKE && this.ratingValue === 0;
|
|
129
|
+
const liked = this.ratingTypeOfDoneRatingOfThisContent === FtRatingType.LIKE && this.ratingValue === 1;
|
|
130
|
+
return html `
|
|
131
|
+
<ft-switch unselectable
|
|
132
|
+
@change=${(e) => this.rate(e.detail)}
|
|
133
|
+
part="rating rating-like"
|
|
134
|
+
label="${this.i18n(this.i18nProperties.ratingSectionTitle)}">
|
|
135
|
+
<ft-switch-option .value=${1}
|
|
136
|
+
?selected=${liked}
|
|
137
|
+
.iconVariant=${this.iconVariant}
|
|
138
|
+
icon="${liked ? this.filledLikeIcon : this.emptyLikeIcon}"
|
|
139
|
+
role="radio">
|
|
140
|
+
${feedback.messages.like()}
|
|
141
|
+
</ft-switch-option>
|
|
142
|
+
<ft-switch-option .value=${0}
|
|
143
|
+
?selected=${disliked}
|
|
144
|
+
.iconVariant=${this.iconVariant}
|
|
145
|
+
icon="${disliked ? this.filledDislikeIcon : this.emptyDislikeIcon}"
|
|
146
|
+
role="radio">
|
|
147
|
+
${feedback.messages.dislike()}
|
|
148
|
+
</ft-switch-option>
|
|
149
|
+
</ft-switch>
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
case FtRatingType.DICHOTOMOUS: {
|
|
153
|
+
const no = this.ratingTypeOfDoneRatingOfThisContent === FtRatingType.DICHOTOMOUS && this.ratingValue === 0;
|
|
154
|
+
const yes = this.ratingTypeOfDoneRatingOfThisContent === FtRatingType.DICHOTOMOUS && this.ratingValue === 1;
|
|
155
|
+
return html `
|
|
156
|
+
<ft-switch unselectable
|
|
157
|
+
@change=${(e) => this.rate(e.detail)}
|
|
158
|
+
part="rating rating-dichotomous">
|
|
159
|
+
<ft-switch-option .value=${1}
|
|
160
|
+
?selected=${yes}>
|
|
161
|
+
${feedback.messages.dichotomousYes()}
|
|
162
|
+
</ft-switch-option>
|
|
163
|
+
<ft-switch-option .value=${0}
|
|
164
|
+
?selected=${no}>
|
|
165
|
+
${feedback.messages.dichotomousNo()}
|
|
166
|
+
</ft-switch-option>
|
|
167
|
+
</ft-switch>
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return nothing;
|
|
172
|
+
}
|
|
173
|
+
rate(value) {
|
|
174
|
+
if ((value !== null && value !== void 0 ? value : -1) !== this.ratingValue) {
|
|
175
|
+
this.dispatchEvent(new CustomEvent("rate", { detail: value }));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
renderFeedbackSection() {
|
|
179
|
+
var _a, _b, _c, _d, _e;
|
|
180
|
+
if (this.canAccessFeedback) {
|
|
181
|
+
const mailLink = this.feedbackMailLinkBuilder(this.feedbackMessage);
|
|
182
|
+
let submitButton = html `
|
|
183
|
+
<ft-button primary
|
|
184
|
+
type="submit" name="submit"
|
|
185
|
+
?disabled=${!this.feedbackMessage || !this.validFromEmail()}
|
|
186
|
+
part="send-feedback">
|
|
187
|
+
${feedback.messages.okButton()}
|
|
188
|
+
</ft-button>
|
|
189
|
+
`;
|
|
190
|
+
if (mailLink) {
|
|
191
|
+
submitButton = html `
|
|
192
|
+
<a part="send-feedback-link" href="${mailLink}">
|
|
193
|
+
${submitButton}
|
|
194
|
+
</a>
|
|
195
|
+
`;
|
|
196
|
+
}
|
|
197
|
+
const moreOptionsButton = this.withMoreOptionsButton && (((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopics) || ((_b = this.configuration) === null || _b === void 0 ? void 0 : _b.mailsSentByFluidTopicsForUnauthenticatedUsers))
|
|
198
|
+
? html `
|
|
199
|
+
<ft-button outlined
|
|
200
|
+
type="button" name="more-options"
|
|
201
|
+
@click=${this.onOpenMoreDetails}
|
|
202
|
+
part="more-options">
|
|
203
|
+
${feedback.messages.moreOptionsButton()}
|
|
204
|
+
</ft-button>
|
|
205
|
+
`
|
|
206
|
+
: nothing;
|
|
207
|
+
return html `
|
|
208
|
+
<form part="feedback-container" autocomplete="on"
|
|
209
|
+
@submit=${(e) => this.onFormSubmitEvent(e, !!mailLink)}>
|
|
210
|
+
<ft-typography variant="${FtTypographyVariants.title_dense}" part="section-title">
|
|
211
|
+
${this.i18n(this.i18nProperties.feedbackSectionTitle)}
|
|
212
|
+
</ft-typography>
|
|
213
|
+
${((_d = (_c = this.session) === null || _c === void 0 ? void 0 : _c.profile) === null || _d === void 0 ? void 0 : _d.userId) == null && ((_e = this.configuration) === null || _e === void 0 ? void 0 : _e.mailsSentByFluidTopicsForUnauthenticatedUsers) ? html `
|
|
214
|
+
<ft-text-field outlined name="email" type="email" autocomplete="email"
|
|
215
|
+
part="feedback-from-input"
|
|
216
|
+
label="${feedback.messages.feedbackfromEmail()}"
|
|
217
|
+
@change=${(e) => this.from = e.detail.trim()}
|
|
218
|
+
?error=${this.from && !this.validFromEmail()}
|
|
219
|
+
helper="${this.from && !this.validFromEmail() ? feedback.messages.feedbackfromEmailInvalid() : ""}"
|
|
220
|
+
></ft-text-field>
|
|
221
|
+
` : nothing}
|
|
222
|
+
<ft-text-area outlined
|
|
223
|
+
part="feedback-input"
|
|
224
|
+
label="${feedback.messages.feedbackInputLabel()}"
|
|
225
|
+
@live-change=${(e) => this.feedbackMessage = e.detail.trim()}
|
|
226
|
+
></ft-text-area>
|
|
227
|
+
<div part="buttons-container">
|
|
228
|
+
${moreOptionsButton}
|
|
229
|
+
${submitButton}
|
|
230
|
+
</div>
|
|
231
|
+
</form>
|
|
232
|
+
`;
|
|
233
|
+
}
|
|
234
|
+
return nothing;
|
|
235
|
+
}
|
|
236
|
+
onFormSubmitEvent(event, isUsingMailLink) {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
if (isUsingMailLink) {
|
|
239
|
+
this.onMailerFeedbackSent();
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this.sendFeedback();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
validFromEmail() {
|
|
246
|
+
var _a, _b, _c;
|
|
247
|
+
const expression = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;
|
|
248
|
+
return !(((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.userId) == null && ((_c = this.configuration) === null || _c === void 0 ? void 0 : _c.mailsSentByFluidTopicsForUnauthenticatedUsers))
|
|
249
|
+
|| expression.test(this.from);
|
|
250
|
+
}
|
|
251
|
+
sendFeedback() {
|
|
252
|
+
var _a;
|
|
253
|
+
this.dispatchEvent(new SendFeedbackEvent({
|
|
254
|
+
message: this.feedbackInput.value,
|
|
255
|
+
...(((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopicsForUnauthenticatedUsers) && { from: this.from }),
|
|
256
|
+
}));
|
|
257
|
+
}
|
|
258
|
+
onMailerFeedbackSent() {
|
|
259
|
+
this.dispatchEvent(new CustomEvent("mailer-feedback"));
|
|
260
|
+
}
|
|
261
|
+
onOpenMoreDetails() {
|
|
262
|
+
this.dispatchEvent(new CustomEvent("open-more-options"));
|
|
263
|
+
}
|
|
264
|
+
clearFeedbackInput() {
|
|
265
|
+
setTimeout(() => this.feedbackInput.setValue("", true), 0);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
FtBaseFeedback.elementDefinitions = {
|
|
269
|
+
"ft-button": FtButton,
|
|
270
|
+
"ft-typography": FtTypography,
|
|
271
|
+
"ft-switch": FtSwitch,
|
|
272
|
+
"ft-switch-option": FtSwitchOption,
|
|
273
|
+
"ft-text-area": FtTextArea,
|
|
274
|
+
"ft-text-field": FtTextField,
|
|
275
|
+
};
|
|
276
|
+
__decorate([
|
|
277
|
+
property({ type: Boolean })
|
|
278
|
+
], FtBaseFeedback.prototype, "hideTitle", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
property({ type: Boolean })
|
|
281
|
+
], FtBaseFeedback.prototype, "withMoreOptionsButton", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
property()
|
|
284
|
+
], FtBaseFeedback.prototype, "iconVariant", void 0);
|
|
285
|
+
__decorate([
|
|
286
|
+
property()
|
|
287
|
+
], FtBaseFeedback.prototype, "emptyStarIcon", void 0);
|
|
288
|
+
__decorate([
|
|
289
|
+
property()
|
|
290
|
+
], FtBaseFeedback.prototype, "filledStarIcon", void 0);
|
|
291
|
+
__decorate([
|
|
292
|
+
property()
|
|
293
|
+
], FtBaseFeedback.prototype, "emptyLikeIcon", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
property()
|
|
296
|
+
], FtBaseFeedback.prototype, "filledLikeIcon", void 0);
|
|
297
|
+
__decorate([
|
|
298
|
+
property()
|
|
299
|
+
], FtBaseFeedback.prototype, "emptyDislikeIcon", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
property()
|
|
302
|
+
], FtBaseFeedback.prototype, "filledDislikeIcon", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ type: Boolean })
|
|
305
|
+
], FtBaseFeedback.prototype, "canAccessFeedback", void 0);
|
|
306
|
+
__decorate([
|
|
307
|
+
property({ type: Boolean })
|
|
308
|
+
], FtBaseFeedback.prototype, "canRateThisContent", void 0);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ attribute: false })
|
|
311
|
+
], FtBaseFeedback.prototype, "i18nProperties", void 0);
|
|
312
|
+
__decorate([
|
|
313
|
+
property({ attribute: false })
|
|
314
|
+
], FtBaseFeedback.prototype, "ratingSummary", void 0);
|
|
315
|
+
__decorate([
|
|
316
|
+
property()
|
|
317
|
+
], FtBaseFeedback.prototype, "configuration", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property()
|
|
320
|
+
], FtBaseFeedback.prototype, "feedbackMailLinkBuilder", void 0);
|
|
321
|
+
__decorate([
|
|
322
|
+
redux({ store: ftAppInfoStore.name })
|
|
323
|
+
], FtBaseFeedback.prototype, "session", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
query("[part='feedback-input']")
|
|
326
|
+
], FtBaseFeedback.prototype, "feedbackInput", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
state()
|
|
329
|
+
], FtBaseFeedback.prototype, "from", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
state()
|
|
332
|
+
], FtBaseFeedback.prototype, "feedbackMessage", void 0);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FtUserProfile } from "@fluid-topics/public-api";
|
|
2
2
|
import { FtIconVariants } from "@fluid-topics/ft-icon";
|
|
3
|
-
export interface
|
|
3
|
+
export interface FtFeedbackProperties {
|
|
4
4
|
editorMode?: boolean;
|
|
5
5
|
user?: FtUserProfile;
|
|
6
6
|
iconVariant?: FtIconVariants;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FtCssVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
export type FtBaseFeedbackCssVariables = {
|
|
3
|
+
feedbackInputMinWidth: FtCssVariable;
|
|
4
|
+
ratedDateColor: FtCssVariable;
|
|
5
|
+
sendFeedbackColor: FtCssVariable;
|
|
6
|
+
sendFeedbackBackgroundColor: FtCssVariable;
|
|
7
|
+
filledRatingColor: FtCssVariable;
|
|
8
|
+
emptyRatingColor: FtCssVariable;
|
|
9
|
+
mainTitleFontSize: FtCssVariable;
|
|
10
|
+
sectionTitleFontSize: FtCssVariable;
|
|
11
|
+
starsBackgroundColor: FtCssVariable;
|
|
12
|
+
};
|
|
13
|
+
export declare function generateFeedbackStyles(variables: FtBaseFeedbackCssVariables): import("lit").CSSResult;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
2
|
+
import { FtSwitchCssVariables } from "@fluid-topics/ft-switch";
|
|
3
|
+
import { setVariable } from "@fluid-topics/ft-wc-utils";
|
|
4
|
+
import { css } from "lit";
|
|
5
|
+
// language=CSS
|
|
6
|
+
export function generateFeedbackStyles(variables) {
|
|
7
|
+
return css `
|
|
8
|
+
[part="container"] {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[part="rating rating-stars"] {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-items: center;
|
|
19
|
+
margin-left: -6px;
|
|
20
|
+
${setVariable(FtButtonCssVariables.backgroundColor, variables.starsBackgroundColor)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
[part="rating-container"],
|
|
24
|
+
[part="feedback-container"] {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[part="rating-container"] [part="section-title"] {
|
|
30
|
+
margin-bottom: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[part="rating-container"] {
|
|
34
|
+
${setVariable(FtButtonCssVariables.color, variables.emptyRatingColor)};
|
|
35
|
+
${setVariable(FtButtonCssVariables.rippleColor, variables.filledRatingColor)};
|
|
36
|
+
${setVariable(FtSwitchCssVariables.textColor, variables.emptyRatingColor)};
|
|
37
|
+
${setVariable(FtSwitchCssVariables.selectedTextColor, variables.filledRatingColor)};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[part="rating-container"] .rating-stars--active {
|
|
41
|
+
${setVariable(FtButtonCssVariables.color, variables.filledRatingColor)};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[part="feedback-container"] {
|
|
45
|
+
gap: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[part="rating-date"] {
|
|
49
|
+
color: ${variables.ratedDateColor};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part="feedback-container"] ft-text-area {
|
|
53
|
+
min-width: ${variables.feedbackInputMinWidth};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
[part="send-feedback"],
|
|
58
|
+
[part="send-feedback-link"] {
|
|
59
|
+
${setVariable(FtButtonCssVariables.color, variables.sendFeedbackColor)};
|
|
60
|
+
${setVariable(FtButtonCssVariables.backgroundColor, variables.sendFeedbackBackgroundColor)};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[part="buttons-container"] {
|
|
64
|
+
align-self: flex-end;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { FtReaderFeedbackProperties } from "./ft-reader-feedback.properties";
|
|
4
|
-
import { FtTopicRatingSummary } from "@fluid-topics/ft-reader-context/build/store/model";
|
|
5
|
-
import { FtPublicationRatingSummary, FtRatingType, FtReaderFeedbackConfiguration, FtSession } from "@fluid-topics/public-api";
|
|
6
|
-
import { FtTextArea } from "@fluid-topics/ft-text-area";
|
|
7
|
-
import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
|
|
8
|
-
import { I18nPropertyInit } from "@fluid-topics/ft-i18n";
|
|
9
|
-
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
10
|
-
export interface FeedbackI18nProperties {
|
|
11
|
-
feedbackMainTitle: I18nPropertyInit;
|
|
12
|
-
ratingSectionTitle: I18nPropertyInit;
|
|
13
|
-
feedbackSectionTitle: I18nPropertyInit;
|
|
14
|
-
dichotomousRatingSectionTitle: I18nPropertyInit;
|
|
15
|
-
}
|
|
16
|
-
declare const FtReaderFeedback_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
|
|
17
|
-
export declare class FtReaderFeedback extends FtReaderFeedback_base implements FtReaderFeedbackProperties {
|
|
18
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
1
|
+
import { FtBaseFeedback } from "./ft-base-feedback";
|
|
2
|
+
export declare class FtReaderFeedback extends FtBaseFeedback {
|
|
19
3
|
static styles: import("lit").CSSResult;
|
|
20
|
-
editorMode: boolean;
|
|
21
|
-
hideTitle: boolean;
|
|
22
|
-
withMoreOptionsButton: boolean;
|
|
23
|
-
ratingAllowed: boolean;
|
|
24
|
-
i18nProperties: FeedbackI18nProperties;
|
|
25
|
-
ratingSummary?: FtPublicationRatingSummary | FtTopicRatingSummary;
|
|
26
|
-
session?: FtSession;
|
|
27
|
-
feedbackInput: FtTextArea;
|
|
28
|
-
from: string;
|
|
29
|
-
feedbackMessage: string;
|
|
30
|
-
iconVariant?: FtIconVariants;
|
|
31
|
-
emptyStarIcon?: string;
|
|
32
|
-
filledStarIcon?: string;
|
|
33
|
-
emptyLikeIcon?: string;
|
|
34
|
-
filledLikeIcon?: string;
|
|
35
|
-
emptyDislikeIcon?: string;
|
|
36
|
-
filledDislikeIcon?: string;
|
|
37
|
-
configuration?: FtReaderFeedbackConfiguration;
|
|
38
|
-
feedbackMailLinkBuilder: (feedbackMessage: string) => string | undefined;
|
|
39
|
-
constructor();
|
|
40
|
-
get canAccessFeedback(): boolean | undefined;
|
|
41
|
-
get canRateThisContent(): boolean | undefined;
|
|
42
|
-
get configuredRatingType(): FtRatingType | "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
|
|
43
|
-
get ratingTypeOfDoneRatingOfThisContent(): FtRatingType.NO_RATING | "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
|
|
44
|
-
get ratingValue(): number;
|
|
45
|
-
get ratingDate(): Date | undefined;
|
|
46
|
-
protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
47
|
-
private renderRatingSection;
|
|
48
|
-
private renderRatingDate;
|
|
49
|
-
private renderRating;
|
|
50
|
-
private rate;
|
|
51
|
-
private renderFeedbackSection;
|
|
52
|
-
private onFormSubmitEvent;
|
|
53
|
-
private validFromEmail;
|
|
54
|
-
private sendFeedback;
|
|
55
|
-
private onMailerFeedbackSent;
|
|
56
|
-
private onOpenMoreDetails;
|
|
57
|
-
clearFeedbackInput(): void;
|
|
58
4
|
}
|
|
59
|
-
export {};
|