@financial-times/qanda-ui 0.0.1-beta.12 → 0.0.1-beta.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.
- package/dist/cjs/components/Author/index.js +2 -2
- package/dist/cjs/components/EmbedFormField/index.js +0 -4
- package/dist/cjs/components/QandaBlock/index.js +3 -2
- package/dist/cjs/components/QandaContainer.js +1 -1
- package/dist/esm/components/Author/index.js +1 -1
- package/dist/esm/components/EmbedFormField/index.js +1 -5
- package/dist/esm/components/QandaBlock/index.js +2 -1
- package/dist/esm/components/QandaContainer.js +1 -1
- package/dist/types/components/Author/index.d.ts +1 -1
- package/dist/types/components/Calendar/CalendarList.d.ts +1 -1
- package/dist/types/components/EmbedFormField/index.d.ts +1 -1
- package/dist/types/components/Loader/index.d.ts +1 -1
- package/dist/types/components/Overlay/index.d.ts +1 -1
- package/dist/types/components/Qanda.d.ts +1 -1
- package/dist/types/components/QuestionForm/messagesByUserType.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
7
7
|
const Headshot_1 = __importDefault(require("@financial-times/cp-content-pipeline-ui/lib/components/Headshot"));
|
|
8
|
-
const
|
|
8
|
+
const Byline_1 = __importDefault(require("@financial-times/cp-content-pipeline-ui/lib/components/Byline"));
|
|
9
9
|
function Author({ byline, headshot, prefLabel, role, streamPage, }) {
|
|
10
10
|
const hasHeadshot = headshot && prefLabel;
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__answer__author", "data-testid": "qanda-block__answer__author", children: [hasHeadshot ? ((0, jsx_runtime_1.jsx)("div", { className: "qanda-block__answer__author-headshot", children: (0, jsx_runtime_1.jsx)(Headshot_1.default, { headshot: headshot, prefLabel: prefLabel, streamPage: streamPage, className: "qanda-block__answer__author-headshot" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "qanda-block__answer__author-opinion-icon" })), (0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__answer__author-info", children: [(0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-highlight qanda-block__answer__author-name", children: (0, jsx_runtime_1.jsx)(
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__answer__author", "data-testid": "qanda-block__answer__author", children: [hasHeadshot ? ((0, jsx_runtime_1.jsx)("div", { className: "qanda-block__answer__author-headshot", children: (0, jsx_runtime_1.jsx)(Headshot_1.default, { headshot: headshot, prefLabel: prefLabel, streamPage: streamPage, className: "qanda-block__answer__author-headshot" }) })) : ((0, jsx_runtime_1.jsx)("div", { className: "qanda-block__answer__author-opinion-icon" })), (0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__answer__author-info", children: [(0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-highlight qanda-block__answer__author-name", children: (0, jsx_runtime_1.jsx)(Byline_1.default, { structuredContent: byline, showEditedBy: false }) }), (0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-base", children: role })] })] }));
|
|
12
12
|
}
|
|
13
13
|
Author.defaultProps = {
|
|
14
14
|
byline: '',
|
|
@@ -8,10 +8,6 @@ const react_dom_1 = require("react-dom");
|
|
|
8
8
|
function EmbedFormField({ container }) {
|
|
9
9
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
10
10
|
const [portalTarget, setPortalTarget] = (0, react_1.useState)();
|
|
11
|
-
const expertView = (0, react_redux_1.useSelector)((state) => state.expert.expertView);
|
|
12
|
-
if (expertView) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
11
|
(0, react_1.useEffect)(() => {
|
|
16
12
|
if (container) {
|
|
17
13
|
const portalContainer = document.createElement('div');
|
|
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("preact/jsx-runtime");
|
|
7
|
-
const
|
|
7
|
+
const Byline_1 = __importDefault(require("@financial-times/cp-content-pipeline-ui/lib/components/Byline"));
|
|
8
|
+
const RichText_1 = __importDefault(require("@financial-times/cp-content-pipeline-ui/lib/components/RichText"));
|
|
8
9
|
require("../Expander/index");
|
|
9
10
|
const index_1 = __importDefault(require("../Expander/index"));
|
|
10
11
|
const Author_1 = __importDefault(require("../Author"));
|
|
@@ -71,6 +72,6 @@ function QandaBlock({ id, body, children, byline, subtitle, showAnswerTime = fal
|
|
|
71
72
|
observer.disconnect();
|
|
72
73
|
};
|
|
73
74
|
}, []);
|
|
74
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-block", children: [(0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__comment qanda-block__question", id: id, "data-testid": `qanda-block__question-${id}`, "data-trackable": "liveqa_question", children: [subtitle && ((0, jsx_runtime_1.jsx)("div", { className: "o3-type-headline-sm qanda-block__question-subtitle", children: subtitle })), (0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-highlight qanda-block__comment-byline", children: (0, jsx_runtime_1.jsx)(
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-block", children: [(0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__comment qanda-block__question", id: id, "data-testid": `qanda-block__question-${id}`, "data-trackable": "liveqa_question", children: [subtitle && ((0, jsx_runtime_1.jsx)("div", { className: "o3-type-headline-sm qanda-block__question-subtitle", children: subtitle })), (0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-highlight qanda-block__comment-byline", children: (0, jsx_runtime_1.jsx)(Byline_1.default, { structuredContent: byline, showEditedBy: false }) }), (0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-base qanda-block__comment-text", children: (0, jsx_runtime_1.jsx)(index_1.default, { className: "qanda-block__text", expandLabel: "Expand question", collapseLabel: "Collapse question", id: id, children: (0, jsx_runtime_1.jsx)(RichText_1.default, { structuredContent: body.structured }) }) })] }, id), children?.map((child) => child.body && ((0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__comment qanda-block__answer", "data-testid": `qanda-block__answer-${child.id}`, "data-trackable": "liveqa_answer", children: [(0, jsx_runtime_1.jsxs)("div", { className: "qanda-block__answer-header", children: [(0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-highlight qanda-block__comment-byline", children: child.author ? ((0, jsx_runtime_1.jsx)(Author_1.default, { byline: child.byline, headshot: child.author.headshot, prefLabel: child.author.prefLabel, role: child.author.role, streamPage: child.author.streamPage })) : ((0, jsx_runtime_1.jsx)(Byline_1.default, { structuredContent: child.byline, showEditedBy: false })) }), showAnswerTime && ((0, jsx_runtime_1.jsx)("span", { className: "o3-type-detail", children: renderTime(child.publishedDate) }))] }), (0, jsx_runtime_1.jsx)("div", { className: "o3-type-body-base qanda-block__comment-text", children: (0, jsx_runtime_1.jsx)(index_1.default, { className: "qanda-block__text", expandLabel: "Expand answer", collapseLabel: "Collapse answer", id: id, children: (0, jsx_runtime_1.jsx)(RichText_1.default, { structuredContent: child.body.structured }) }) })] }, child.id)))] }));
|
|
75
76
|
}
|
|
76
77
|
exports.default = QandaBlock;
|
|
@@ -54,6 +54,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
54
54
|
dispatch(comments_api_1.nextCommentsApi.util.resetApiState());
|
|
55
55
|
};
|
|
56
56
|
}, [dispatch, storyId]);
|
|
57
|
-
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 }), status !== 'close' && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(UserInfo_1.default, {}) })), status === 'live' && (0, jsx_runtime_1.jsx)(FloatingActionBar_1.default, {}), (0, jsx_runtime_1.jsx)(EmbedFormField_1.default, { container: embedFormFieldContainer })] }))] }));
|
|
57
|
+
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 }), status !== 'close' && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(UserInfo_1.default, {}) })), status === 'live' && (0, jsx_runtime_1.jsx)(FloatingActionBar_1.default, {}), status !== 'close' && !showExpertView && ((0, jsx_runtime_1.jsx)(EmbedFormField_1.default, { container: embedFormFieldContainer }))] }))] }));
|
|
58
58
|
}
|
|
59
59
|
exports.default = QandaContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
import Headshot from '@financial-times/cp-content-pipeline-ui/lib/components/Headshot';
|
|
3
|
-
import
|
|
3
|
+
import Byline from '@financial-times/cp-content-pipeline-ui/lib/components/Byline';
|
|
4
4
|
function Author({ byline, headshot, prefLabel, role, streamPage, }) {
|
|
5
5
|
const hasHeadshot = headshot && prefLabel;
|
|
6
6
|
return (_jsxs("div", { className: "qanda-block__answer__author", "data-testid": "qanda-block__answer__author", children: [hasHeadshot ? (_jsx("div", { className: "qanda-block__answer__author-headshot", children: _jsx(Headshot, { headshot: headshot, prefLabel: prefLabel, streamPage: streamPage, className: "qanda-block__answer__author-headshot" }) })) : (_jsx("div", { className: "qanda-block__answer__author-opinion-icon" })), _jsxs("div", { className: "qanda-block__answer__author-info", children: [_jsx("div", { className: "o3-type-body-highlight qanda-block__answer__author-name", children: _jsx(Byline, { structuredContent: byline, showEditedBy: false }) }), _jsx("div", { className: "o3-type-body-base", children: role })] })] }));
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
-
import { useDispatch
|
|
2
|
+
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
6
|
function EmbedFormField({ container }) {
|
|
7
7
|
const dispatch = useDispatch();
|
|
8
8
|
const [portalTarget, setPortalTarget] = useState();
|
|
9
|
-
const expertView = useSelector((state) => state.expert.expertView);
|
|
10
|
-
if (expertView) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
9
|
useEffect(() => {
|
|
14
10
|
if (container) {
|
|
15
11
|
const portalContainer = document.createElement('div');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import Byline from '@financial-times/cp-content-pipeline-ui/lib/components/Byline';
|
|
3
|
+
import RichText from '@financial-times/cp-content-pipeline-ui/lib/components/RichText';
|
|
3
4
|
import '../Expander/index';
|
|
4
5
|
import Expander from '../Expander/index';
|
|
5
6
|
import Author from '../Author';
|
|
@@ -49,6 +49,6 @@ function QandaContainer({ embedFormFieldContainer, countdownTimerContainer, }) {
|
|
|
49
49
|
dispatch(nextCommentsApi.util.resetApiState());
|
|
50
50
|
};
|
|
51
51
|
}, [dispatch, storyId]);
|
|
52
|
-
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 }), status !== 'close' && (_jsx(_Fragment, { children: _jsx(UserInfo, {}) })), status === 'live' && _jsx(FloatingActionBar, {}), _jsx(EmbedFormField, { container: embedFormFieldContainer })] }))] }));
|
|
52
|
+
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 }), status !== 'close' && (_jsx(_Fragment, { children: _jsx(UserInfo, {}) })), status === 'live' && _jsx(FloatingActionBar, {}), status !== 'close' && !showExpertView && (_jsx(EmbedFormField, { container: embedFormFieldContainer }))] }))] }));
|
|
53
53
|
}
|
|
54
54
|
export default QandaContainer;
|
|
@@ -6,7 +6,7 @@ type AuthorProps = {
|
|
|
6
6
|
role: string;
|
|
7
7
|
streamPage?: string;
|
|
8
8
|
};
|
|
9
|
-
declare function Author({ byline, headshot, prefLabel, role, streamPage, }: AuthorProps): import("
|
|
9
|
+
declare function Author({ byline, headshot, prefLabel, role, streamPage, }: AuthorProps): import("preact").JSX.Element;
|
|
10
10
|
declare namespace Author {
|
|
11
11
|
var defaultProps: {
|
|
12
12
|
byline: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function CalendarList(): import("
|
|
1
|
+
declare function CalendarList(): import("preact").JSX.Element;
|
|
2
2
|
export default CalendarList;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type EmbedFormFieldProps = {
|
|
2
2
|
container?: HTMLElement;
|
|
3
3
|
};
|
|
4
|
-
declare function EmbedFormField({ container }: EmbedFormFieldProps): import("react").JSX.Element
|
|
4
|
+
declare function EmbedFormField({ container }: EmbedFormFieldProps): import("react").JSX.Element;
|
|
5
5
|
export default EmbedFormField;
|
|
@@ -11,4 +11,4 @@ export type LoaderProps = {
|
|
|
11
11
|
theme?: 'dark' | 'light';
|
|
12
12
|
extraClassNames?: string;
|
|
13
13
|
};
|
|
14
|
-
export default function Loader({ size, theme, extraClassNames, }: LoaderProps): import("
|
|
14
|
+
export default function Loader({ size, theme, extraClassNames, }: LoaderProps): import("preact").JSX.Element;
|
|
@@ -8,5 +8,5 @@ type OverlayProps = {
|
|
|
8
8
|
closeCallback: () => void;
|
|
9
9
|
options?: OverlayOptions;
|
|
10
10
|
};
|
|
11
|
-
declare function Overlay({ title, children, closeCallback, options, }: OverlayProps): import("
|
|
11
|
+
declare function Overlay({ title, children, closeCallback, options, }: OverlayProps): import("preact").JSX.Element;
|
|
12
12
|
export default Overlay;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { QandaProps } from '../types/qanda';
|
|
2
|
-
declare function Qanda({ storyId, useStaging, title, commentsAPIHost, commentsAPIVersion, maxQuestionLength, embedFormFieldContainer, countdownTimerContainer, }: QandaProps): import("
|
|
2
|
+
declare function Qanda({ storyId, useStaging, title, commentsAPIHost, commentsAPIVersion, maxQuestionLength, embedFormFieldContainer, countdownTimerContainer, }: QandaProps): import("preact").JSX.Element | null;
|
|
3
3
|
export default Qanda;
|
|
@@ -4,4 +4,4 @@ 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
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";
|
|
7
|
-
export declare function getTextByUser(profile: UserDetails): import("
|
|
7
|
+
export declare function getTextByUser(profile: UserDetails): import("preact").JSX.Element;
|