@talkfurther/react
Version:
README.md
1 lines • 3.36 kB
Source Map (JSON)
{"version":3,"file":"index.cjs","sources":["../Teaser.tsx"],"sourcesContent":["import React from \"react\";\nimport { registerTeaserWebComponent, renderServerSide, ITeaserProps, TeaserRegion } from \"@talkfurther/elements\";\nimport { version as REACT_VERSION } from \"./package.json\";\n\ndeclare module \"react\" {\n namespace JSX {\n interface IntrinsicElements {\n \"further-teaser\": any;\n }\n }\n}\n\ninterface TeaserComponentProps extends ITeaserProps {\n region?: TeaserRegion;\n}\n\ninterface TeaserComponentState {\n isClient: boolean;\n}\n\nexport class Teaser extends React.Component<TeaserComponentProps, TeaserComponentState> {\n constructor(props: TeaserComponentProps) {\n super(props);\n this.state = { isClient: false };\n }\n\n componentDidMount() {\n // componentDidMount only runs in the client,\n // so when it runs, we know for sure it's client-side\n this.setState({ isClient: true });\n const { region } = this.props;\n registerTeaserWebComponent({ region });\n }\n\n render() {\n const props = this.props;\n const { isClient } = this.state;\n const html = isClient ? \"\" : renderServerSide(props);\n\n return (\n <further-teaser\n suppressHydrationWarning={true}\n dangerouslySetInnerHTML={{ __html: html }}\n vsa-instance={props.vsaInstance}\n data-sdk-framework=\"react\"\n data-sdk-react-version={REACT_VERSION}\n title={props.title}\n subtitle={props.subtitle}\n options={JSON.stringify(props.options)}\n show-recent-tour-inquiries={props.showRecentTourInquiries}\n theme={JSON.stringify(props.theme || {})}\n custom-css={props.customCss}\n ></further-teaser>\n );\n }\n}\n\nexport default Teaser;\n"],"names":["Teaser","React","Component","constructor","props","state","isClient","componentDidMount","setState","region","registerTeaserWebComponent","render","html","renderServerSide","createElement","suppressHydrationWarning","dangerouslySetInnerHTML","__html","vsaInstance","REACT_VERSION","title","subtitle","options","JSON","stringify","showRecentTourInquiries","theme","customCss"],"mappings":";;;;;;;;;AAoBa,MAAAA,MAAO,SAAQC,yBAAK,CAACC,SAAqD,CAAA;EACrFC,WAAAA,CAAYC,KAA2B,EAAA;IACrC,KAAK,CAACA,KAAK,CAAC,C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