diff --git a/app/embeds/GoogleDataStudio.js b/app/embeds/GoogleDataStudio.js new file mode 100644 index 00000000..24c00b6b --- /dev/null +++ b/app/embeds/GoogleDataStudio.js @@ -0,0 +1,39 @@ +// @flow +import * as React from "react"; +import Image from "components/Image"; +import Frame from "./components/Frame"; + +const URL_REGEX = new RegExp( + "^https?://datastudio.google.com/(embed|u/0)/reporting/(.*)/page/(.*)(/edit)?$" +); + +type Props = {| + attrs: {| + href: string, + matches: string[], + |}, +|}; + +export default class GoogleDataStudio extends React.Component { + static ENABLED = [URL_REGEX]; + + render() { + return ( + + } + canonicalUrl={this.props.attrs.href} + title="Google Data Studio" + border + /> + ); + } +} diff --git a/app/embeds/GoogleDataStudio.test.js b/app/embeds/GoogleDataStudio.test.js new file mode 100644 index 00000000..29a52cc6 --- /dev/null +++ b/app/embeds/GoogleDataStudio.test.js @@ -0,0 +1,19 @@ +/* eslint-disable flowtype/require-valid-file-annotation */ +import GoogleDataStudio from "./GoogleDataStudio"; + +describe("GoogleDataStudio", () => { + const match = GoogleDataStudio.ENABLED[0]; + test("to be enabled on share link", () => { + expect( + "https://datastudio.google.com/embed/reporting/aab01789-f3a2-4ff3-9cba-c4c94c4a92e8/page/7zFD".match( + match + ) + ).toBeTruthy(); + }); + + test("to not be enabled elsewhere", () => { + expect("https://datastudio.google.com/u/0/".match(match)).toBe(null); + expect("https://datastudio.google.com".match(match)).toBe(null); + expect("https://www.google.com".match(match)).toBe(null); + }); +}); diff --git a/app/embeds/index.js b/app/embeds/index.js index ecb7fdd6..7e359806 100644 --- a/app/embeds/index.js +++ b/app/embeds/index.js @@ -11,6 +11,7 @@ import Descript from "./Descript"; import Figma from "./Figma"; import Framer from "./Framer"; import Gist from "./Gist"; +import GoogleDataStudio from "./GoogleDataStudio"; import GoogleDocs from "./GoogleDocs"; import GoogleDrawings from "./GoogleDrawings"; import GoogleDrive from "./GoogleDrive"; @@ -148,6 +149,13 @@ export default [ component: GoogleSlides, matcher: matcher(GoogleSlides), }, + { + title: "Google Data Studio", + keywords: "business intelligence", + icon: () => , + component: GoogleDataStudio, + matcher: matcher(GoogleDataStudio), + }, { title: "InVision", keywords: "design prototype", diff --git a/public/images/google-datastudio.png b/public/images/google-datastudio.png new file mode 100644 index 00000000..739a1fcb Binary files /dev/null and b/public/images/google-datastudio.png differ