@financial-times/qanda-ui 0.0.1-beta.43 → 0.0.1-beta.45

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,6 +22,7 @@ function ExpertDrawer() {
22
22
  o_comments_1.default.init();
23
23
  }
24
24
  catch (error) {
25
+ reliability_1.qandaReliability.setArticleId(storyId);
25
26
  reliability_1.qandaReliability.failure('expert-load-coral-ui', error);
26
27
  }
27
28
  }
package/dist/cjs/index.js CHANGED
@@ -46,7 +46,31 @@ class QandaUI {
46
46
  init() {
47
47
  (0, preact_1.render)((0, jsx_runtime_1.jsx)(Qanda_1.default, { storyId: this.storyId, useStaging: this.useStaging, title: this.title, commentsAPIHost: this.commentsAPIHost, commentsAPIVersion: this.commentsAPIVersion, maxQuestionLength: this.maxQuestionLength, embedFormFieldContainer: this.embedFormFieldContainer, countdownTimerContainer: this.countdownTimerContainer }), this.containerElement);
48
48
  }
49
+ checkFooterVisibility(footerSelector) {
50
+ const footer = document.querySelector(footerSelector);
51
+ if (footer) {
52
+ this.footerObserver = new IntersectionObserver((entries) => {
53
+ const floatingActionBar = document.querySelector('.floating-action-bar__container');
54
+ if (floatingActionBar) {
55
+ entries.forEach((entry) => {
56
+ if (entry.isIntersecting &&
57
+ !floatingActionBar.classList.contains('o3-visually-hidden')) {
58
+ floatingActionBar.classList.add('o3-visually-hidden');
59
+ }
60
+ else {
61
+ floatingActionBar.classList.remove('o3-visually-hidden');
62
+ }
63
+ });
64
+ }
65
+ });
66
+ this.footerObserver.observe(footer);
67
+ }
68
+ }
49
69
  destroy() {
70
+ if (this.footerObserver) {
71
+ this.footerObserver.disconnect();
72
+ this.footerObserver = undefined;
73
+ }
50
74
  (0, preact_1.render)(null, this.containerElement);
51
75
  }
52
76
  }
@@ -66,6 +66,7 @@ exports.nextCommentsApi = (0, react_1.createApi)({
66
66
  }, { forceRefetch: true }));
67
67
  }
68
68
  catch (error) {
69
+ reliability_1.qandaReliability.setArticleId(arg.storyId);
69
70
  reliability_1.qandaReliability.failure('qa-updates', error);
70
71
  }
71
72
  };
@@ -17,6 +17,7 @@ function ExpertDrawer() {
17
17
  OComments.init();
18
18
  }
19
19
  catch (error) {
20
+ qandaReliability.setArticleId(storyId);
20
21
  qandaReliability.failure('expert-load-coral-ui', error);
21
22
  }
22
23
  }
package/dist/esm/index.js CHANGED
@@ -39,7 +39,31 @@ class QandaUI {
39
39
  init() {
40
40
  render(_jsx(Qanda, { storyId: this.storyId, useStaging: this.useStaging, title: this.title, commentsAPIHost: this.commentsAPIHost, commentsAPIVersion: this.commentsAPIVersion, maxQuestionLength: this.maxQuestionLength, embedFormFieldContainer: this.embedFormFieldContainer, countdownTimerContainer: this.countdownTimerContainer }), this.containerElement);
41
41
  }
42
+ checkFooterVisibility(footerSelector) {
43
+ const footer = document.querySelector(footerSelector);
44
+ if (footer) {
45
+ this.footerObserver = new IntersectionObserver((entries) => {
46
+ const floatingActionBar = document.querySelector('.floating-action-bar__container');
47
+ if (floatingActionBar) {
48
+ entries.forEach((entry) => {
49
+ if (entry.isIntersecting &&
50
+ !floatingActionBar.classList.contains('o3-visually-hidden')) {
51
+ floatingActionBar.classList.add('o3-visually-hidden');
52
+ }
53
+ else {
54
+ floatingActionBar.classList.remove('o3-visually-hidden');
55
+ }
56
+ });
57
+ }
58
+ });
59
+ this.footerObserver.observe(footer);
60
+ }
61
+ }
42
62
  destroy() {
63
+ if (this.footerObserver) {
64
+ this.footerObserver.disconnect();
65
+ this.footerObserver = undefined;
66
+ }
43
67
  render(null, this.containerElement);
44
68
  }
45
69
  }
@@ -63,6 +63,7 @@ export const nextCommentsApi = createApi({
63
63
  }, { forceRefetch: true }));
64
64
  }
65
65
  catch (error) {
66
+ qandaReliability.setArticleId(arg.storyId);
66
67
  qandaReliability.failure('qa-updates', error);
67
68
  }
68
69
  };
@@ -10,8 +10,10 @@ declare class QandaUI {
10
10
  commentsAPIHost: string;
11
11
  commentsAPIVersion: string;
12
12
  maxQuestionLength: number;
13
+ footerObserver?: IntersectionObserver;
13
14
  constructor(containerElement: HTMLElement, options?: QandaProps);
14
15
  init(): void;
16
+ checkFooterVisibility(footerSelector: string): void;
15
17
  destroy(): void;
16
18
  }
17
19
  export { QandaUI, QandaBlock };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/qanda-ui",
3
- "version": "0.0.1-beta.43",
3
+ "version": "0.0.1-beta.45",
4
4
  "description": "Components for the Live Q&A (AKA Ask an Expert) UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",