@fluid-topics/ft-reader-feedback 1.1.11 → 1.1.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.
@@ -22,27 +22,6 @@ export const styles = css `
22
22
  gap: 16px;
23
23
  }
24
24
 
25
- .ft-reader-feedback--placeholder {
26
- display: flex;
27
- flex-direction: row;
28
- gap: 8px;
29
- padding: 8px;
30
- border: 1px dashed #e1e1e1;
31
- color: #444444;
32
- background: #f1f1f1;
33
- border-radius: 4px;
34
- align-items: center;
35
- }
36
-
37
- .ft-reader-feedback--placeholder ft-typography {
38
- flex-grow: 1;
39
- }
40
-
41
- .ft-reader-feedback--placeholder ft-tooltip {
42
- flex-grow: 0;
43
- flex-shrink: 0;
44
- }
45
-
46
25
  .ft-reader-feedback--stars {
47
26
  display: flex;
48
27
  flex-direction: row;
@@ -18,7 +18,7 @@ export interface FtFeedbackEventDetail {
18
18
  message: string;
19
19
  from?: string;
20
20
  }
21
- declare const FtReaderFeedback_base: typeof FtReaderComponent & (new (...args: any[]) => import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface);
21
+ declare const FtReaderFeedback_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
22
22
  export declare class FtReaderFeedback extends FtReaderFeedback_base implements FtReaderFeedbackProperties {
23
23
  static elementDefinitions: ElementDefinitionsMap;
24
24
  static styles: import("lit").CSSResult;
@@ -43,7 +43,6 @@ export declare class FtReaderFeedback extends FtReaderFeedback_base implements F
43
43
  constructor();
44
44
  get canAccessFeedback(): boolean | undefined;
45
45
  get canAccessRating(): boolean | undefined;
46
- get userHasRatingRole(): boolean | undefined;
47
46
  get configuredRatingType(): import("@fluid-topics/public-api").FtRatingType | "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
48
47
  get ratingType(): "STARS" | "LIKE" | "DICHOTOMOUS" | "NO_RATING";
49
48
  get ratingValue(): number;
@@ -57,7 +56,6 @@ export declare class FtReaderFeedback extends FtReaderFeedback_base implements F
57
56
  private onFormSubmitEvent;
58
57
  private validFromEmail;
59
58
  private sendFeedback;
60
- private placeholderInEditor;
61
59
  private onMailerFeedbackSent;
62
60
  clearFeedbackInput(): void;
63
61
  }
@@ -8,17 +8,13 @@ import { html, nothing } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
  import { parseDate, redux, } from "@fluid-topics/ft-wc-utils";
10
10
  import { styles } from "./ft-reader-feedback.css";
11
- import { userHasRole } from "@fluid-topics/public-api";
12
11
  import { FtTypography } from "@fluid-topics/ft-typography";
13
- import { FtIcon } from "@fluid-topics/ft-icon";
14
- import { FtTooltip } from "@fluid-topics/ft-tooltip";
15
12
  import { FtSwitch, FtSwitchOption } from "@fluid-topics/ft-switch";
16
13
  import { FtTextArea } from "@fluid-topics/ft-text-area";
17
14
  import { repeat } from "lit/directives/repeat.js";
18
15
  import { FtButton } from "@fluid-topics/ft-button";
19
16
  import { defaultMessages, feedback } from "./utils/IntegratedFeedbackComponentMessages";
20
17
  import { withI18n } from "@fluid-topics/ft-i18n";
21
- import { defaultDesignerMessages, designer } from "./utils/InDesignerFeedbackComponentMessages";
22
18
  import { FtTextField } from "@fluid-topics/ft-text-field";
23
19
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
24
20
  import { FtReaderFeatures } from "@fluid-topics/ft-reader-context";
@@ -37,7 +33,6 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
37
33
  this.emptyDislikeIcon = "THUMBS_DOWN";
38
34
  this.filledDislikeIcon = "THUMBS_DOWN_PLAIN";
39
35
  this.addI18nContext(feedback, defaultMessages);
40
- this.addI18nContext(designer, defaultDesignerMessages);
41
36
  }
42
37
  get canAccessFeedback() {
43
38
  var _a;
@@ -47,9 +42,6 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
47
42
  var _a, _b;
48
43
  return (_a = this.service) === null || _a === void 0 ? void 0 : _a.isFeatureAccessible(FtReaderFeatures.RATING, { session: this.session, ratingType: (_b = this.ratingSummary) === null || _b === void 0 ? void 0 : _b.type });
49
44
  }
50
- get userHasRatingRole() {
51
- return this.session && userHasRole(this.session, "RATING_USER");
52
- }
53
45
  get configuredRatingType() {
54
46
  var _a, _b;
55
47
  return (_b = (this.ratingAllowed ? (_a = this.ratingSummary) === null || _a === void 0 ? void 0 : _a.type : "NO_RATING")) !== null && _b !== void 0 ? _b : "NO_RATING";
@@ -68,16 +60,16 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
68
60
  return typeof date === "string" ? parseDate(date) : date;
69
61
  }
70
62
  render() {
71
- if (!this.editorMode && !this.canAccessFeedback && !this.canAccessRating) {
63
+ if (!this.canAccessFeedback && !this.canAccessRating) {
72
64
  return nothing;
73
65
  }
74
66
  return html `
75
67
  <div class="ft-reader-feedback">
76
68
  ${this.hideTitle ? nothing : html `
77
- <ft-typography variant="title" part="main-title">
78
- ${this.i18n(this.i18nProperties.feedbackMainTitle)}
79
- </ft-typography>
80
- `}
69
+ <ft-typography variant="title" part="main-title">
70
+ ${this.i18n(this.i18nProperties.feedbackMainTitle)}
71
+ </ft-typography>
72
+ `}
81
73
  ${this.renderRatingSection()}
82
74
  ${this.renderFeedbackSection()}
83
75
  </div>
@@ -99,9 +91,7 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
99
91
  </div>
100
92
  `;
101
93
  }
102
- return this.placeholderInEditor((this.userHasRatingRole
103
- ? designer.messages.ratingNotConfigured()
104
- : designer.messages.missingRatingRole()));
94
+ return nothing;
105
95
  }
106
96
  renderRatingDate() {
107
97
  const ratingDate = this.ratingDate;
@@ -127,17 +117,15 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
127
117
  let active = this.ratingType === "STARS" && this.ratingValue > index;
128
118
  const ratingValue = index + 1;
129
119
  return html `
130
- <ft-button round part="rating-stars-${ratingValue}"
131
- label="${feedback.messages.starsRating(ratingValue)}"
132
- tooltipPosition="top"
133
- .iconVariant=${this.iconVariant}
134
- icon="${active ? this.filledStarIcon : this.emptyStarIcon}"
135
- class="ft-reader-feedback--${active ? "active" : "inactive"}"
136
- @click=${() => this.rate(this.ratingValue === ratingValue
137
- ? undefined
138
- : ratingValue)}
139
- ></ft-button>
140
- `;
120
+ <ft-button round part="rating-stars-${ratingValue}"
121
+ label="${feedback.messages.starsRating(ratingValue)}"
122
+ tooltipPosition="top"
123
+ .iconVariant=${this.iconVariant}
124
+ icon="${active ? this.filledStarIcon : this.emptyStarIcon}"
125
+ class="ft-reader-feedback--${active ? "active" : "inactive"}"
126
+ @click=${() => this.rate(this.ratingValue === ratingValue ? undefined : ratingValue)}
127
+ ></ft-button>
128
+ `;
141
129
  })}
142
130
  </div>
143
131
  `;
@@ -231,7 +219,7 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
231
219
  </form>
232
220
  `;
233
221
  }
234
- return this.placeholderInEditor(designer.messages.missingFeedbackRole());
222
+ return nothing;
235
223
  }
236
224
  onFormSubmitEvent(event, isUsingMailLink) {
237
225
  event.preventDefault();
@@ -252,17 +240,6 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
252
240
  }
253
241
  }));
254
242
  }
255
- placeholderInEditor(message) {
256
- return this.editorMode ? html `
257
- <div class="ft-reader-feedback--placeholder">
258
- <ft-typography variant="caption">${message}</ft-typography>
259
- <ft-tooltip position="left"
260
- text="${designer.messages.inDesignerOnlyNotice()}">
261
- <ft-icon>INFO</ft-icon>
262
- </ft-tooltip>
263
- </div>
264
- ` : nothing;
265
- }
266
243
  onMailerFeedbackSent() {
267
244
  this.dispatchEvent(new CustomEvent("mailer-feedback"));
268
245
  }
@@ -273,8 +250,6 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
273
250
  FtReaderFeedback.elementDefinitions = {
274
251
  "ft-button": FtButton,
275
252
  "ft-typography": FtTypography,
276
- "ft-icon": FtIcon,
277
- "ft-tooltip": FtTooltip,
278
253
  "ft-switch": FtSwitch,
279
254
  "ft-switch-option": FtSwitchOption,
280
255
  "ft-text-area": FtTextArea,