@financial-times/qanda-ui 0.0.1-beta.21 → 0.0.1-beta.23

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # QandA-UI
2
2
 
3
- A library for the Live Q&A client-side component
3
+ A library for the Live Q&A (AKA Ask an Expert) client-side component
4
4
 
5
5
  ## Usage
6
6
 
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("preact/jsx-runtime");
4
+ const qanda_1 = require("../../config/qanda");
4
5
  function formatDateForIcs(date) {
5
6
  return date.replace(/-|:|\.\d+/g, '');
6
7
  }
@@ -14,7 +15,7 @@ const CalendarLink = ({ href, children, }) => ((0, jsx_runtime_1.jsx)("a", { hre
14
15
  function itemChildren(name, icon) {
15
16
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "live-qa-calendar-list__item__icon", children: icon }), (0, jsx_runtime_1.jsx)("span", { className: "live-qa-calendar-list__item__text", children: name })] }));
16
17
  }
17
- const description = (url) => `To join the Q&A session, visit: ${url}`;
18
+ const description = (url) => `To join the ${qanda_1.PRODUCT_NAME} session, visit: ${url}`;
18
19
  const apps = [
19
20
  {
20
21
  name: 'Gmail',
@@ -5,6 +5,7 @@ const react_redux_1 = require("react-redux");
5
5
  const questionSlice_1 = require("../../store/questionSlice");
6
6
  const react_1 = require("react");
7
7
  const react_dom_1 = require("react-dom");
8
+ const qanda_1 = require("../../config/qanda");
8
9
  function EmbedFormField({ container }) {
9
10
  const dispatch = (0, react_redux_1.useDispatch)();
10
11
  const [portalTarget, setPortalTarget] = (0, react_1.useState)();
@@ -18,7 +19,7 @@ function EmbedFormField({ container }) {
18
19
  };
19
20
  }
20
21
  }, []);
21
- const portalElement = ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question to the Q&A", (0, jsx_runtime_1.jsxs)("div", { onClick: () => dispatch((0, questionSlice_1.openForm)()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [(0, jsx_runtime_1.jsx)("span", { className: "embed-form-field__icon", children: (0, jsx_runtime_1.jsx)("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
22
+ const portalElement = ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question for ", qanda_1.PRODUCT_NAME, (0, jsx_runtime_1.jsxs)("div", { onClick: () => dispatch((0, questionSlice_1.openForm)()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [(0, jsx_runtime_1.jsx)("span", { className: "embed-form-field__icon", children: (0, jsx_runtime_1.jsx)("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
22
23
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, react_dom_1.createPortal)(portalElement, portalTarget || document.body) });
23
24
  }
24
25
  exports.default = EmbedFormField;
@@ -11,6 +11,7 @@ const expertSlice_1 = require("../../store/expertSlice");
11
11
  const QandaProvider_1 = require("../QandaProvider");
12
12
  const reliability_1 = require("../../services/reliability");
13
13
  const Overlay_1 = __importDefault(require("../Overlay"));
14
+ const qanda_1 = require("../../config/qanda");
14
15
  function ExpertDrawer() {
15
16
  const dispatch = (0, react_redux_1.useDispatch)();
16
17
  const { storyId, useStaging, title } = (0, react_1.useContext)(QandaProvider_1.QandaContext);
@@ -28,9 +29,9 @@ function ExpertDrawer() {
28
29
  if (!isExpertFormOpen) {
29
30
  return null;
30
31
  }
31
- return ((0, jsx_runtime_1.jsx)(Overlay_1.default, { title: "Live Q&A", closeCallback: () => dispatch((0, expertSlice_1.closeExpertForm)()), options: {
32
+ return ((0, jsx_runtime_1.jsx)(Overlay_1.default, { title: qanda_1.PRODUCT_NAME, closeCallback: () => dispatch((0, expertSlice_1.closeExpertForm)()), options: {
32
33
  shadow: true,
33
- noBackground: true,
34
+ allowInteraction: true,
34
35
  }, children: (0, jsx_runtime_1.jsx)("div", { className: "o-comments", id: "o-comments-stream", "data-o-component": "o-comments", "data-o-comments-article-id": storyId, "data-o-comments-article-url": `https://www.ft.com/content/${storyId}`, "data-o-comments-use-staging-environment": useStaging, "data-o-comments-title": title }) }));
35
36
  }
36
37
  exports.default = ExpertDrawer;
@@ -7,10 +7,7 @@ const jsx_runtime_1 = require("preact/jsx-runtime");
7
7
  const o3_button_1 = require("@financial-times/o3-button");
8
8
  const classnames_1 = __importDefault(require("classnames"));
9
9
  function Overlay({ title, children, closeCallback, options = {}, }) {
10
- return ((0, jsx_runtime_1.jsxs)("div", { className: "overlay", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)([
11
- 'overlay__outer',
12
- { 'overlay__outer--no-background': options.noBackground },
13
- ]) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)([
10
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "overlay", children: [!options.allowInteraction && (0, jsx_runtime_1.jsx)("div", { className: "overlay__outer" }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)([
14
11
  'overlay__inner',
15
12
  { 'overlay__inner--shadow': options.shadow },
16
13
  ]), children: [(0, jsx_runtime_1.jsx)("div", { className: "overlay__header", children: (0, jsx_runtime_1.jsxs)("div", { className: "overlay__header-bar", children: [(0, jsx_runtime_1.jsx)("span", { className: "o3-type-body-highlight overlay__header-title", children: title }), (0, jsx_runtime_1.jsx)(o3_button_1.Button, { attributes: { className: 'overlay__header-close' }, iconOnly: true, icon: "cross", label: "Close", type: "ghost", theme: "mono", onClick: () => closeCallback() })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "overlay__content", children: children })] })] }));
@@ -19,6 +19,7 @@ const EmbedFormField_1 = __importDefault(require("./EmbedFormField"));
19
19
  const QandaProvider_1 = require("./QandaProvider");
20
20
  const o_tracking_1 = __importDefault(require("@financial-times/o-tracking"));
21
21
  const comments_api_1 = require("../services/comments-api");
22
+ const qanda_1 = require("../config/qanda");
22
23
  function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
23
24
  const { storyId, useStaging, commentsAPIUrl } = (0, react_1.useContext)(QandaProvider_1.QandaContext);
24
25
  const dispatch = (0, react_redux_1.useDispatch)();
@@ -32,13 +33,13 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
32
33
  const [ariaMessage, setAriaMessage] = (0, react_1.useState)('');
33
34
  (0, react_1.useEffect)(() => {
34
35
  if (isLoading) {
35
- setAriaMessage('Loading Q&A');
36
+ setAriaMessage(`Loading ${qanda_1.PRODUCT_NAME}`);
36
37
  }
37
38
  else if (error) {
38
- setAriaMessage('Error loading Q&A');
39
+ setAriaMessage(`Error loading ${qanda_1.PRODUCT_NAME}`);
39
40
  }
40
41
  else if (data) {
41
- setAriaMessage('Q&A stream has been updated');
42
+ setAriaMessage(`${qanda_1.PRODUCT_NAME} stream has been updated`);
42
43
  }
43
44
  }, [isLoading, error, data]);
44
45
  const updatedQA = (0, comments_api_1.useUpdatedQA)({
@@ -94,6 +95,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
94
95
  },
95
96
  });
96
97
  }, [data, status]);
97
- return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && ((0, jsx_runtime_1.jsxs)("p", { children: ["We are not able to load the Q&A at the moment. Please try again later. Error:", error] })), !isLoading && !error && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [status !== 'close' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showExpertView ? (0, jsx_runtime_1.jsx)(ExpertDrawer_1.default, {}) : (0, jsx_runtime_1.jsx)(QuestionForm_1.default, {}), (0, jsx_runtime_1.jsx)(CountdownTimer_1.default, { container: countdownTimerContainer })] })), status === 'pre-live' && (0, jsx_runtime_1.jsx)(Calendar_1.default, {}), (0, jsx_runtime_1.jsx)(Stream_1.default, { status: status }), (0, jsx_runtime_1.jsx)(Survey_1.default, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && ((0, jsx_runtime_1.jsx)(FloatingActionBar_1.default, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && ((0, jsx_runtime_1.jsx)(EmbedFormField_1.default, { container: embedFormFieldContainer }))] })), (0, jsx_runtime_1.jsx)("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
98
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && ((0, jsx_runtime_1.jsxs)("p", { children: ["We are not able to load ", qanda_1.PRODUCT_NAME, " at the moment. Please try again later. Error:", error] })), !isLoading && !error && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [status !== 'close' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showExpertView ? (0, jsx_runtime_1.jsx)(ExpertDrawer_1.default, {}) : (0, jsx_runtime_1.jsx)(QuestionForm_1.default, {}), (0, jsx_runtime_1.jsx)(CountdownTimer_1.default, { container: countdownTimerContainer })] })), status === 'pre-live' && (0, jsx_runtime_1.jsx)(Calendar_1.default, {}), (0, jsx_runtime_1.jsx)(Stream_1.default, { status: status }), (0, jsx_runtime_1.jsx)(Survey_1.default, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && ((0, jsx_runtime_1.jsx)(FloatingActionBar_1.default, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && ((0, jsx_runtime_1.jsx)(EmbedFormField_1.default, { container: embedFormFieldContainer }))] })), (0, jsx_runtime_1.jsx)("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
98
99
  }
99
100
  exports.default = QandaContainer;
@@ -4,13 +4,14 @@ exports.TERMS_AND_CONDITIONS_URL = exports.COMMUNITY_GUIDELINES_URL = exports.SU
4
4
  exports.getTitleByUser = getTitleByUser;
5
5
  exports.getTextByUser = getTextByUser;
6
6
  const jsx_runtime_1 = require("preact/jsx-runtime");
7
+ const qanda_1 = require("../../config/qanda");
7
8
  exports.SIGN_IN_URL = 'https://www.ft.com/login';
8
9
  exports.SUBSCRIBE_URL = 'https://subs.ft.com/products';
9
10
  exports.COMMUNITY_GUIDELINES_URL = 'https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines';
10
11
  exports.TERMS_AND_CONDITIONS_URL = 'https://help.ft.com/help/legal-privacy/terms-conditions';
11
12
  function getTitleByUser(profile) {
12
13
  if (profile.isSubscribed) {
13
- return 'Q&A guidelines';
14
+ return `${qanda_1.PRODUCT_NAME} guidelines`;
14
15
  }
15
16
  if (profile.isTrialist) {
16
17
  return 'You are still on a trial period';
@@ -28,9 +28,9 @@ function Stream({ status = 'pre-live' }) {
28
28
  const element = document.getElementById(latestAnsweredQuestionId);
29
29
  element?.scrollIntoView({ behavior: 'smooth' });
30
30
  }, [latestAnsweredQuestionId]);
31
- return ((0, jsx_runtime_1.jsxs)("section", { className: "qanda__stream", children: [(0, jsx_runtime_1.jsx)("h2", { className: "o3-type-title-md qanda__stream-title", children: data && data.status && data.status === 'pre-live'
31
+ return ((0, jsx_runtime_1.jsxs)("section", { className: "qanda__stream", children: [data && data.qandas.length > 0 && ((0, jsx_runtime_1.jsx)("h2", { className: "o3-type-title-md qanda__stream-title", children: data.status && data.status === 'pre-live'
32
32
  ? 'Top questions so far'
33
- : 'What our readers are asking' }), (0, jsx_runtime_1.jsxs)("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && ((0, jsx_runtime_1.jsx)(Loader_1.default, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
33
+ : 'What our readers are asking' })), (0, jsx_runtime_1.jsxs)("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && ((0, jsx_runtime_1.jsx)(Loader_1.default, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && ((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
34
34
  data.qandas &&
35
35
  data.qandas.map((qandaBlock) => ((0, jsx_runtime_1.jsx)(index_1.default, { id: qandaBlock.id, body: qandaBlock.body, type: "comment", publishedDate: qandaBlock.publishedDate, author: qandaBlock.author, byline: qandaBlock.byline, showAnswerTime: data.status === 'live', children: qandaBlock.children }, qandaBlock.id)))] })] }));
36
36
  }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PRODUCT_NAME = void 0;
4
+ // This file contains configuration settings for the Q&A (AKA Ask an Expert) features of the application.
5
+ // User facing product name
6
+ exports.PRODUCT_NAME = 'Ask an Expert';
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { PRODUCT_NAME } from '../../config/qanda';
2
3
  function formatDateForIcs(date) {
3
4
  return date.replace(/-|:|\.\d+/g, '');
4
5
  }
@@ -12,7 +13,7 @@ const CalendarLink = ({ href, children, }) => (_jsx("a", { href: href, target: "
12
13
  function itemChildren(name, icon) {
13
14
  return (_jsxs(_Fragment, { children: [_jsx("span", { className: "live-qa-calendar-list__item__icon", children: icon }), _jsx("span", { className: "live-qa-calendar-list__item__text", children: name })] }));
14
15
  }
15
- const description = (url) => `To join the Q&A session, visit: ${url}`;
16
+ const description = (url) => `To join the ${PRODUCT_NAME} session, visit: ${url}`;
16
17
  const apps = [
17
18
  {
18
19
  name: 'Gmail',
@@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux';
3
3
  import { openForm } from '../../store/questionSlice';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
+ import { PRODUCT_NAME } from '../../config/qanda';
6
7
  function EmbedFormField({ container }) {
7
8
  const dispatch = useDispatch();
8
9
  const [portalTarget, setPortalTarget] = useState();
@@ -16,7 +17,7 @@ function EmbedFormField({ container }) {
16
17
  };
17
18
  }
18
19
  }, []);
19
- const portalElement = (_jsxs("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question to the Q&A", _jsxs("div", { onClick: () => dispatch(openForm()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [_jsx("span", { className: "embed-form-field__icon", children: _jsx("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
20
+ const portalElement = (_jsxs("div", { className: "qanda-portal embed-form-field__container o3-type-body-highlight", children: ["Submit your question for ", PRODUCT_NAME, _jsxs("div", { onClick: () => dispatch(openForm()), className: "embed-form-field__text-input o3-type-body-lg", "data-testid": "embed-form-field", children: [_jsx("span", { className: "embed-form-field__icon", children: _jsx("i", { style: { maskImage: 'var(--o3-icon-user)' } }) }), "Enter your question"] })] }));
20
21
  return _jsx(_Fragment, { children: createPortal(portalElement, portalTarget || document.body) });
21
22
  }
22
23
  export default EmbedFormField;
@@ -6,6 +6,7 @@ import { closeExpertForm } from '../../store/expertSlice';
6
6
  import { QandaContext } from '../QandaProvider';
7
7
  import { qandaReliability } from '../../services/reliability';
8
8
  import Overlay from '../Overlay';
9
+ import { PRODUCT_NAME } from '../../config/qanda';
9
10
  function ExpertDrawer() {
10
11
  const dispatch = useDispatch();
11
12
  const { storyId, useStaging, title } = useContext(QandaContext);
@@ -23,9 +24,9 @@ function ExpertDrawer() {
23
24
  if (!isExpertFormOpen) {
24
25
  return null;
25
26
  }
26
- return (_jsx(Overlay, { title: "Live Q&A", closeCallback: () => dispatch(closeExpertForm()), options: {
27
+ return (_jsx(Overlay, { title: PRODUCT_NAME, closeCallback: () => dispatch(closeExpertForm()), options: {
27
28
  shadow: true,
28
- noBackground: true,
29
+ allowInteraction: true,
29
30
  }, children: _jsx("div", { className: "o-comments", id: "o-comments-stream", "data-o-component": "o-comments", "data-o-comments-article-id": storyId, "data-o-comments-article-url": `https://www.ft.com/content/${storyId}`, "data-o-comments-use-staging-environment": useStaging, "data-o-comments-title": title }) }));
30
31
  }
31
32
  export default ExpertDrawer;
@@ -2,10 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
2
  import { Button } from '@financial-times/o3-button';
3
3
  import classNames from 'classnames';
4
4
  function Overlay({ title, children, closeCallback, options = {}, }) {
5
- return (_jsxs("div", { className: "overlay", children: [_jsx("div", { className: classNames([
6
- 'overlay__outer',
7
- { 'overlay__outer--no-background': options.noBackground },
8
- ]) }), _jsxs("div", { className: classNames([
5
+ return (_jsxs("div", { className: "overlay", children: [!options.allowInteraction && _jsx("div", { className: "overlay__outer" }), _jsxs("div", { className: classNames([
9
6
  'overlay__inner',
10
7
  { 'overlay__inner--shadow': options.shadow },
11
8
  ]), children: [_jsx("div", { className: "overlay__header", children: _jsxs("div", { className: "overlay__header-bar", children: [_jsx("span", { className: "o3-type-body-highlight overlay__header-title", children: title }), _jsx(Button, { attributes: { className: 'overlay__header-close' }, iconOnly: true, icon: "cross", label: "Close", type: "ghost", theme: "mono", onClick: () => closeCallback() })] }) }), _jsx("div", { className: "overlay__content", children: children })] })] }));
@@ -14,6 +14,7 @@ import EmbedFormField from './EmbedFormField';
14
14
  import { QandaContext } from './QandaProvider';
15
15
  import oTracking from '@financial-times/o-tracking';
16
16
  import { useGetQandAStreamQuery, useUpdatedQA, useGetUserRolesQuery, nextCommentsApi, } from '../services/comments-api';
17
+ import { PRODUCT_NAME } from '../config/qanda';
17
18
  function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
18
19
  const { storyId, useStaging, commentsAPIUrl } = useContext(QandaContext);
19
20
  const dispatch = useDispatch();
@@ -27,13 +28,13 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
27
28
  const [ariaMessage, setAriaMessage] = useState('');
28
29
  useEffect(() => {
29
30
  if (isLoading) {
30
- setAriaMessage('Loading Q&A');
31
+ setAriaMessage(`Loading ${PRODUCT_NAME}`);
31
32
  }
32
33
  else if (error) {
33
- setAriaMessage('Error loading Q&A');
34
+ setAriaMessage(`Error loading ${PRODUCT_NAME}`);
34
35
  }
35
36
  else if (data) {
36
- setAriaMessage('Q&A stream has been updated');
37
+ setAriaMessage(`${PRODUCT_NAME} stream has been updated`);
37
38
  }
38
39
  }, [isLoading, error, data]);
39
40
  const updatedQA = useUpdatedQA({
@@ -89,6 +90,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
89
90
  },
90
91
  });
91
92
  }, [data, status]);
92
- return (_jsxs("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && (_jsxs("p", { children: ["We are not able to load the Q&A at the moment. Please try again later. Error:", error] })), !isLoading && !error && (_jsxs(_Fragment, { children: [status !== 'close' && (_jsxs(_Fragment, { children: [showExpertView ? _jsx(ExpertDrawer, {}) : _jsx(QuestionForm, {}), _jsx(CountdownTimer, { container: countdownTimerContainer })] })), status === 'pre-live' && _jsx(Calendar, {}), _jsx(Stream, { status: status }), _jsx(Survey, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && (_jsx(FloatingActionBar, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && (_jsx(EmbedFormField, { container: embedFormFieldContainer }))] })), _jsx("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
93
+ return (_jsxs("div", { className: "qanda-container", "data-trackable": "liveqa", children: [error && (_jsxs("p", { children: ["We are not able to load ", PRODUCT_NAME, " at the moment. Please try again later. Error:", error] })), !isLoading && !error && (_jsxs(_Fragment, { children: [status !== 'close' && (_jsxs(_Fragment, { children: [showExpertView ? _jsx(ExpertDrawer, {}) : _jsx(QuestionForm, {}), _jsx(CountdownTimer, { container: countdownTimerContainer })] })), status === 'pre-live' && _jsx(Calendar, {}), _jsx(Stream, { status: status }), _jsx(Survey, { storyId: storyId, status: status }), (status === 'live' || (status === 'pre-live' && showExpertView)) && (_jsx(FloatingActionBar, { showLiveIndicator: status === 'live' })), status !== 'close' && !showExpertView && (_jsx(EmbedFormField, { container: embedFormFieldContainer }))] })), _jsx("div", { "aria-live": "polite", "aria-atomic": "true", className: "o3-visually-hidden", children: ariaMessage })] }));
93
94
  }
94
95
  export default QandaContainer;
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
2
+ import { PRODUCT_NAME } from '../../config/qanda';
2
3
  export const SIGN_IN_URL = 'https://www.ft.com/login';
3
4
  export const SUBSCRIBE_URL = 'https://subs.ft.com/products';
4
5
  export const COMMUNITY_GUIDELINES_URL = 'https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines';
5
6
  export const TERMS_AND_CONDITIONS_URL = 'https://help.ft.com/help/legal-privacy/terms-conditions';
6
7
  export function getTitleByUser(profile) {
7
8
  if (profile.isSubscribed) {
8
- return 'Q&A guidelines';
9
+ return `${PRODUCT_NAME} guidelines`;
9
10
  }
10
11
  if (profile.isTrialist) {
11
12
  return 'You are still on a trial period';
@@ -23,9 +23,9 @@ function Stream({ status = 'pre-live' }) {
23
23
  const element = document.getElementById(latestAnsweredQuestionId);
24
24
  element?.scrollIntoView({ behavior: 'smooth' });
25
25
  }, [latestAnsweredQuestionId]);
26
- return (_jsxs("section", { className: "qanda__stream", children: [_jsx("h2", { className: "o3-type-title-md qanda__stream-title", children: data && data.status && data.status === 'pre-live'
26
+ return (_jsxs("section", { className: "qanda__stream", children: [data && data.qandas.length > 0 && (_jsx("h2", { className: "o3-type-title-md qanda__stream-title", children: data.status && data.status === 'pre-live'
27
27
  ? 'Top questions so far'
28
- : 'What our readers are asking' }), _jsxs("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && (_jsx(Loader, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && (_jsx(ErrorMessage, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
28
+ : 'What our readers are asking' })), _jsxs("div", { className: "qanda__blocks-container", "data-testid": "qanda__blocks-container", id: "qanda__blocks-container", "aria-busy": isLoading, children: [isLoading && (_jsx(Loader, { theme: "dark", extraClassNames: "qanda__stream-loader" })), error && (_jsx(ErrorMessage, { error: error, storyId: storyId, operation: "loading-stream" })), data &&
29
29
  data.qandas &&
30
30
  data.qandas.map((qandaBlock) => (_jsx(QandaBlock, { id: qandaBlock.id, body: qandaBlock.body, type: "comment", publishedDate: qandaBlock.publishedDate, author: qandaBlock.author, byline: qandaBlock.byline, showAnswerTime: data.status === 'live', children: qandaBlock.children }, qandaBlock.id)))] })] }));
31
31
  }
@@ -0,0 +1,3 @@
1
+ // This file contains configuration settings for the Q&A (AKA Ask an Expert) features of the application.
2
+ // User facing product name
3
+ export const PRODUCT_NAME = 'Ask an Expert';
package/dist/qanda.scss CHANGED
@@ -386,10 +386,6 @@ $app-header-color: #007acc;
386
386
  background: var(--o3-color-palette-black-90);
387
387
  }
388
388
 
389
- .overlay__outer--no-background {
390
- background: none;
391
- }
392
-
393
389
  .overlay__inner {
394
390
  border-radius: var(--o3-spacing-2xs) var(--o3-spacing-2xs) 0 0;
395
391
  background: var(--o3-color-use-case-page-background);
@@ -1,5 +1,5 @@
1
1
  type OverlayOptions = {
2
- noBackground?: boolean;
2
+ allowInteraction?: boolean;
3
3
  shadow?: boolean;
4
4
  };
5
5
  type OverlayProps = {
@@ -3,5 +3,5 @@ export declare const SIGN_IN_URL = "https://www.ft.com/login";
3
3
  export declare const SUBSCRIBE_URL = "https://subs.ft.com/products";
4
4
  export declare const COMMUNITY_GUIDELINES_URL = "https://help.ft.com/help/article-queries/commenting-on-an-article/commenting-guidelines";
5
5
  export declare const TERMS_AND_CONDITIONS_URL = "https://help.ft.com/help/legal-privacy/terms-conditions";
6
- export declare function getTitleByUser(profile: UserDetails): "Q&A guidelines" | "You are still on a trial period" | "Asking a question is only available to readers with an FT subscription";
6
+ export declare function getTitleByUser(profile: UserDetails): "Ask an Expert guidelines" | "You are still on a trial period" | "Asking a question is only available to readers with an FT subscription";
7
7
  export declare function getTextByUser(profile: UserDetails): import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const PRODUCT_NAME = "Ask an Expert";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@financial-times/qanda-ui",
3
- "version": "0.0.1-beta.21",
4
- "description": "Components for the Live Q&A UI",
3
+ "version": "0.0.1-beta.23",
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",
7
7
  "types": "dist/types/index.d.ts",