From 218dc7b7a6f45248afb8dbadbfd3ae55ac041f96 Mon Sep 17 00:00:00 2001 From: christinaausley <84338309+christinaausley@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:26:53 -0400 Subject: [PATCH] implement pushfeedback (#3837) * pushfeedback option 2 * apply custom styling * style(formatting): remove email update coloring * Update src/theme/DocItem/Footer/index.js Co-authored-by: Steven Hicks * Update src/theme/DocItem/Footer/index.css Co-authored-by: Steven Hicks * Update src/theme/DocItem/Footer/index.js Co-authored-by: Steven Hicks * Update src/theme/DocItem/Footer/index.js Co-authored-by: Steven Hicks * Update src/theme/DocItem/Footer/index.css Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Steven Hicks Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- package-lock.json | 134 +++++++++++++++++++++++++++++ package.json | 1 + src/theme/DocItem/Footer/index.css | 7 ++ src/theme/DocItem/Footer/index.js | 101 ++++++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 src/theme/DocItem/Footer/index.css create mode 100644 src/theme/DocItem/Footer/index.js diff --git a/package-lock.json b/package-lock.json index 643b0ec4ba..8970c3f919 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "docusaurus-plugin-openapi-docs": "^2.0.4", "docusaurus-theme-openapi-docs": "^2.0.4", "mixpanel-browser": "^2.47.0", + "pushfeedback-react": "^0.1.30", "react": "^17.0.2", "react-dom": "^17.0.2", "react-player": "^2.11.0", @@ -4851,6 +4852,18 @@ "node": ">=14" } }, + "node_modules/@stencil/core": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.22.3.tgz", + "integrity": "sha512-kmVA0M/HojwsfkeHsifvHVIYe4l5tin7J5+DLgtl8h6WWfiMClND5K3ifCXXI2ETDNKiEk21p6jql3Fx9o2rng==", + "bin": { + "stencil": "bin/stencil" + }, + "engines": { + "node": ">=12.10.0", + "npm": ">=6.0.0" + } + }, "node_modules/@svgr/babel-plugin-add-jsx-attribute": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz", @@ -6991,6 +7004,14 @@ "resolved": "https://registry.npmjs.org/base16/-/base16-1.0.0.tgz", "integrity": "sha512-pNdYkNPiJUnEhnfXV56+sQy8+AaPcG3POZAUnwr4EeqCUZFz4u2PePbo3e5Gj4ziYPCWGUZT9RHisvJKnwFuBQ==" }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -9646,6 +9667,14 @@ "postcss": "^8.0.9" } }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/css-loader": { "version": "6.7.1", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", @@ -16002,6 +16031,18 @@ "webpack": "^5.20.0" } }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/htmlparser2": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", @@ -24053,6 +24094,23 @@ } ] }, + "node_modules/pushfeedback": { + "version": "0.1.39", + "resolved": "https://registry.npmjs.org/pushfeedback/-/pushfeedback-0.1.39.tgz", + "integrity": "sha512-/sZR2Sqdi1MgxVxVFup3c8GMW1vKVDykCNYIzJH4ic+whTG4a1VFR/uhsx6iHDP3CNxVO/mcxH+pMRSv9voypQ==", + "dependencies": { + "@stencil/core": "^2.13.0", + "html2canvas": "^1.4.1" + } + }, + "node_modules/pushfeedback-react": { + "version": "0.1.30", + "resolved": "https://registry.npmjs.org/pushfeedback-react/-/pushfeedback-react-0.1.30.tgz", + "integrity": "sha512-rHLfkmHSL8NLHdZ9xPlAoes4cor8LGzsCwYBvlajlIFggsajdO+F5GdUAi+cXvXJaBM+Us4EmZlD9naBljHMZA==", + "dependencies": { + "pushfeedback": "^0.1.39" + } + }, "node_modules/q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -28462,6 +28520,14 @@ "node": ">=8" } }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -29773,6 +29839,14 @@ "node": ">= 0.4.0" } }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -34413,6 +34487,11 @@ "webpack-sources": "^3.2.2" } }, + "@stencil/core": { + "version": "2.22.3", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.22.3.tgz", + "integrity": "sha512-kmVA0M/HojwsfkeHsifvHVIYe4l5tin7J5+DLgtl8h6WWfiMClND5K3ifCXXI2ETDNKiEk21p6jql3Fx9o2rng==" + }, "@svgr/babel-plugin-add-jsx-attribute": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz", @@ -36016,6 +36095,11 @@ "resolved": "https://registry.npmjs.org/base16/-/base16-1.0.0.tgz", "integrity": "sha512-pNdYkNPiJUnEhnfXV56+sQy8+AaPcG3POZAUnwr4EeqCUZFz4u2PePbo3e5Gj4ziYPCWGUZT9RHisvJKnwFuBQ==" }, + "base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==" + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -38064,6 +38148,14 @@ "integrity": "sha512-fBffmak0bPAnyqc/HO8C3n2sHrp9wcqQz6ES9koRF2/mLOVAx9zIQ3Y7R29sYCteTPqMCwns4WYQoCX91Xl3+w==", "requires": {} }, + "css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "requires": { + "utrie": "^1.0.2" + } + }, "css-loader": { "version": "6.7.1", "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-6.7.1.tgz", @@ -42969,6 +43061,15 @@ "tapable": "^2.0.0" } }, + "html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "requires": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + } + }, "htmlparser2": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", @@ -48724,6 +48825,23 @@ "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", "dev": true }, + "pushfeedback": { + "version": "0.1.39", + "resolved": "https://registry.npmjs.org/pushfeedback/-/pushfeedback-0.1.39.tgz", + "integrity": "sha512-/sZR2Sqdi1MgxVxVFup3c8GMW1vKVDykCNYIzJH4ic+whTG4a1VFR/uhsx6iHDP3CNxVO/mcxH+pMRSv9voypQ==", + "requires": { + "@stencil/core": "^2.13.0", + "html2canvas": "^1.4.1" + } + }, + "pushfeedback-react": { + "version": "0.1.30", + "resolved": "https://registry.npmjs.org/pushfeedback-react/-/pushfeedback-react-0.1.30.tgz", + "integrity": "sha512-rHLfkmHSL8NLHdZ9xPlAoes4cor8LGzsCwYBvlajlIFggsajdO+F5GdUAi+cXvXJaBM+Us4EmZlD9naBljHMZA==", + "requires": { + "pushfeedback": "^0.1.39" + } + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -52018,6 +52136,14 @@ "minimatch": "^3.0.4" } }, + "text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "requires": { + "utrie": "^1.0.2" + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -53030,6 +53156,14 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, + "utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "requires": { + "base64-arraybuffer": "^1.0.2" + } + }, "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index a0d7d464da..cb7193e7d4 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "docusaurus-plugin-openapi-docs": "^2.0.4", "docusaurus-theme-openapi-docs": "^2.0.4", "mixpanel-browser": "^2.47.0", + "pushfeedback-react": "^0.1.30", "react": "^17.0.2", "react-dom": "^17.0.2", "react-player": "^2.11.0", diff --git a/src/theme/DocItem/Footer/index.css b/src/theme/DocItem/Footer/index.css new file mode 100644 index 0000000000..7caa32a362 --- /dev/null +++ b/src/theme/DocItem/Footer/index.css @@ -0,0 +1,7 @@ +:root { + --feedback-primary-color: #fc5806; +} + +.button--icon { + line-height: 1em; +} diff --git a/src/theme/DocItem/Footer/index.js b/src/theme/DocItem/Footer/index.js new file mode 100644 index 0000000000..235dcdd540 --- /dev/null +++ b/src/theme/DocItem/Footer/index.js @@ -0,0 +1,101 @@ +// Why is this swizzled? +// To add a PushFeedback widget to every doc, to solicit feedback from readers. +// Swizzled from version 2.4.1. + +import React, { useEffect } from "react"; +import Footer from "@theme-original/DocItem/Footer"; + +import { FeedbackButton } from "pushfeedback-react"; +import { defineCustomElements } from "pushfeedback/loader"; +import "pushfeedback/dist/pushfeedback/pushfeedback.css"; +import "./index.css"; + +function FeedbackWidget() { + const buttonThumbsUp = ( + + + + ); + const buttonThumbsDown = ( + + + + ); + const projectId = "m6exeps3n1"; + + useEffect(() => { + if (typeof window !== "undefined") { + defineCustomElements(window); + } + }, []); + + return ( +
+
+ Was this helpful? +
+ + +
+ ); +} + +export default function FooterWrapper(props) { + return ( + <> + +