@fluid-topics/ft-reader-feedback 1.1.31 → 1.1.33

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.
@@ -64,8 +64,11 @@ export const styles = css `
64
64
  }
65
65
 
66
66
  .ft-reader-feedback--send-feedback, .ft-reader-feedback--feedback-link {
67
- align-self: flex-end;
68
67
  ${setVariable(FtButtonCssVariables.color, FtReaderFeedbackCssVariables.sendFeedbackColor)};
69
68
  ${setVariable(FtButtonCssVariables.backgroundColor, FtReaderFeedbackCssVariables.sendFeedbackBackgroundColor)};
70
69
  }
70
+
71
+ [part="buttons-container"] {
72
+ align-self: flex-end;
73
+ }
71
74
  `;
@@ -14,16 +14,13 @@ export interface FeedbackI18nProperties {
14
14
  feedbackSectionTitle: I18nProperty;
15
15
  dichotomousRatingSectionTitle: I18nProperty;
16
16
  }
17
- export interface FtFeedbackEventDetail {
18
- message: string;
19
- from?: string;
20
- }
21
17
  declare const FtReaderFeedback_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>;
22
18
  export declare class FtReaderFeedback extends FtReaderFeedback_base implements FtReaderFeedbackProperties {
23
19
  static elementDefinitions: ElementDefinitionsMap;
24
20
  static styles: import("lit").CSSResult;
25
21
  editorMode: boolean;
26
22
  hideTitle: boolean;
23
+ withMoreOptionsButton: boolean;
27
24
  ratingAllowed: boolean;
28
25
  i18nProperties: FeedbackI18nProperties;
29
26
  ratingSummary?: FtPublicationRatingSummary | FtTopicRatingSummary;
@@ -57,6 +54,7 @@ export declare class FtReaderFeedback extends FtReaderFeedback_base implements F
57
54
  private validFromEmail;
58
55
  private sendFeedback;
59
56
  private onMailerFeedbackSent;
57
+ private onOpenMoreDetails;
60
58
  clearFeedbackInput(): void;
61
59
  }
62
60
  export {};
@@ -18,11 +18,13 @@ import { withI18n } from "@fluid-topics/ft-i18n";
18
18
  import { FtTextField } from "@fluid-topics/ft-text-field";
19
19
  import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
20
20
  import { FtReaderFeatures } from "@fluid-topics/ft-reader-context";
21
+ import { SendFeedbackEvent } from "./utils/events";
21
22
  class FtReaderFeedback extends withI18n(FtReaderComponent) {
22
23
  constructor() {
23
24
  super();
24
25
  this.editorMode = false;
25
26
  this.hideTitle = false;
27
+ this.withMoreOptionsButton = false;
26
28
  this.ratingAllowed = false;
27
29
  this.from = "";
28
30
  this.feedbackMessage = "";
@@ -176,10 +178,10 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
176
178
  }
177
179
  }
178
180
  renderFeedbackSection() {
179
- var _a, _b, _c;
181
+ var _a, _b, _c, _d, _e;
180
182
  if (this.canAccessFeedback) {
181
183
  const mailLink = this.feedbackMailLinkBuilder(this.feedbackMessage);
182
- let button = html `
184
+ let submitButton = html `
183
185
  <ft-button primary
184
186
  type="submit" name="submit"
185
187
  class="ft-reader-feedback--send-feedback"
@@ -189,19 +191,28 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
189
191
  </ft-button>
190
192
  `;
191
193
  if (mailLink) {
192
- button = html `
194
+ submitButton = html `
193
195
  <a class="ft-reader-feedback--feedback-link" href="${mailLink}">
194
- ${button}
196
+ ${submitButton}
195
197
  </a>
196
198
  `;
197
199
  }
200
+ let 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)) ? html `
201
+ <ft-button outlined
202
+ type="button" name="more-options"
203
+ class="ft-reader-feedback--more-options"
204
+ @click="${this.onOpenMoreDetails}"
205
+ part="more-options">
206
+ ${feedback.messages.moreOptionsButton()}
207
+ </ft-button>
208
+ ` : nothing;
198
209
  return html `
199
210
  <form class="ft-reader-feedback--feedback" part="feedback-container" autocomplete="on"
200
211
  @submit="${(e) => this.onFormSubmitEvent(e, !!mailLink)}">
201
212
  <ft-typography variant="title-dense" part="section-title" class="ft-reader-feedback--section-title">
202
213
  ${this.i18n(this.i18nProperties.feedbackSectionTitle)}
203
214
  </ft-typography>
204
- ${((_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) ? html `
215
+ ${((_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 `
205
216
  <ft-text-field outlined name="email" type="email" autocomplete="email"
206
217
  class="ft-reader-feedback--from-input"
207
218
  label=${feedback.messages.feedbackfromEmail()}
@@ -215,7 +226,10 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
215
226
  label="${feedback.messages.feedbackInputLabel()}"
216
227
  @live-change=${(e) => this.feedbackMessage = e.detail.trim()}
217
228
  ></ft-text-area>
218
- ${button}
229
+ <div part="buttons-container">
230
+ ${moreOptionsButton}
231
+ ${submitButton}
232
+ </div>
219
233
  </form>
220
234
  `;
221
235
  }
@@ -223,7 +237,12 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
223
237
  }
224
238
  onFormSubmitEvent(event, isUsingMailLink) {
225
239
  event.preventDefault();
226
- isUsingMailLink ? this.onMailerFeedbackSent() : this.sendFeedback();
240
+ if (isUsingMailLink) {
241
+ this.onMailerFeedbackSent();
242
+ }
243
+ else {
244
+ this.sendFeedback();
245
+ }
227
246
  }
228
247
  validFromEmail() {
229
248
  var _a, _b, _c;
@@ -233,16 +252,17 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
233
252
  }
234
253
  sendFeedback() {
235
254
  var _a;
236
- this.dispatchEvent(new CustomEvent("send-feedback", {
237
- detail: {
238
- message: this.feedbackInput.value,
239
- ...(((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopicsForUnauthenticatedUsers) && { from: this.from }),
240
- }
255
+ this.dispatchEvent(new SendFeedbackEvent({
256
+ message: this.feedbackInput.value,
257
+ ...(((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.mailsSentByFluidTopicsForUnauthenticatedUsers) && { from: this.from }),
241
258
  }));
242
259
  }
243
260
  onMailerFeedbackSent() {
244
261
  this.dispatchEvent(new CustomEvent("mailer-feedback"));
245
262
  }
263
+ onOpenMoreDetails() {
264
+ this.dispatchEvent(new CustomEvent("open-more-options"));
265
+ }
246
266
  clearFeedbackInput() {
247
267
  setTimeout(() => this.feedbackInput.value = "", 0);
248
268
  }
@@ -262,6 +282,9 @@ __decorate([
262
282
  __decorate([
263
283
  property({ type: Boolean })
264
284
  ], FtReaderFeedback.prototype, "hideTitle", void 0);
285
+ __decorate([
286
+ property({ type: Boolean })
287
+ ], FtReaderFeedback.prototype, "withMoreOptionsButton", void 0);
265
288
  __decorate([
266
289
  property({ type: Boolean })
267
290
  ], FtReaderFeedback.prototype, "ratingAllowed", void 0);