Skip to content

add: plug script #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d266357
add: plug script
nikhiltidke101 May 13, 2025
f9bc015
Merge branch 'main' into feat/plug
nikhiltidke101 May 13, 2025
5e5d10e
feat: integrate Plug SDK into main application
nikhiltidke101 May 13, 2025
c67893b
Merge branch 'feat/plug' of https://github.com/devrev/fern-api-docs i…
nikhiltidke101 May 13, 2025
e4a7d6c
Remove Plug component implementation from the codebase.
nikhiltidke101 May 13, 2025
0f6d93b
Remove unused Plug component import from main application file.
nikhiltidke101 May 13, 2025
165cf3b
chore: add @types/node to devDependencies in package.json
nikhiltidke101 May 13, 2025
4a013b9
fix: update Plug SDK initialization to use dynamic app ID from fetche…
nikhiltidke101 May 14, 2025
60f9545
feat: add search component and integrate into main application
nikhiltidke101 May 14, 2025
e447a28
refactor: comment out theme switch and search component initialization
nikhiltidke101 May 14, 2025
6a880d9
refactor: streamline search component integration
nikhiltidke101 May 14, 2025
86365f2
refactor: remove unused sidenav code from main application
nikhiltidke101 May 14, 2025
60a24d0
refactor: update search component integration in main application
nikhiltidke101 May 14, 2025
2aa4d8e
refactor: comment out search component rendering logic
nikhiltidke101 May 14, 2025
23e4e72
refactor: comment out theme switch and search component imports
nikhiltidke101 May 14, 2025
dc7a90a
refactor: integrate theme switch and search components into main appl…
nikhiltidke101 May 14, 2025
35de9ea
refactor: integrate search component rendering into main application
nikhiltidke101 May 14, 2025
7f93d54
feat: implement event handling for Plug SDK in main application
nikhiltidke101 May 14, 2025
0c61799
refactor: update key event handling for search agent activation
nikhiltidke101 May 14, 2025
f177745
refactor: comment out search component rendering logic
nikhiltidke101 May 14, 2025
5b65429
refactor: restore search component rendering logic in main application
nikhiltidke101 May 14, 2025
7b884bc
refactor: reorder imports for theme switch and search components in m…
nikhiltidke101 May 14, 2025
63e36ee
refactor: enhance event logging for Plug SDK integration in main appl…
nikhiltidke101 May 14, 2025
85b23b5
feat: add Widget component for Plug SDK integration in main application
nikhiltidke101 May 14, 2025
96ae4d8
feat: replace Widget component with Plug SDK integration in main appl…
nikhiltidke101 May 14, 2025
acdd873
refactor: restructure sidenav to include header wrapper for theme swi…
nikhiltidke101 May 14, 2025
9c4198e
refactor: improve event handling for Plug SDK widget readiness in mai…
nikhiltidke101 May 14, 2025
92db0e1
refactor: update sidenav structure and search button styling in main …
nikhiltidke101 May 14, 2025
5e87b13
refactor: adjust rendering order of theme switch and search component…
nikhiltidke101 May 14, 2025
967a035
refactor: remove PLUG_APP_ID environment variable from workflow files
nikhiltidke101 May 14, 2025
81fe745
refactor: remove @types/node dependency from custom implementation pa…
nikhiltidke101 May 14, 2025
b5b686e
refactor: remove Widget component from custom implementation package
nikhiltidke101 May 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/fern-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
registry-url: https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.AUTH_TOKEN}}
PLUG_APP_ID: ${{secrets.PLUG_APP_ID}}

- name: Build Navigation
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
registry-url: https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.AUTH_TOKEN}}
PLUG_APP_ID: ${{secrets.PLUG_APP_ID}}

- name: Install Fern
run: npm install -g fern-api
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
registry-url: https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.AUTH_TOKEN}}
PLUG_APP_ID: ${{secrets.PLUG_APP_ID}}

- name: Download Fern
run: npm install -g fern-api
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish-typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
registry-url: https://npm.pkg.github.com/
env:
NODE_AUTH_TOKEN: ${{secrets.AUTH_TOKEN}}
PLUG_APP_ID: ${{secrets.PLUG_APP_ID}}

- name: Build Navigation
run: |
Expand Down
1 change: 1 addition & 0 deletions custom-implementation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@types/node": "^22.15.17",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
22 changes: 21 additions & 1 deletion custom-implementation/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ const render = async () => {
*/

const data = await getPageData()

const sidenav = document.querySelector('button.fern-search-bar')
?.parentElement as HTMLElement


const theme = document.getElementsByTagName('html')[0].getAttribute('class')

if (!document.getElementById('theme-switch')) {
Expand Down Expand Up @@ -92,11 +94,29 @@ const render = async () => {
if (footer) footer.style.display = 'block'
},
)

// Add Plug component directly to body
if (!document.getElementById('plug-platform')) {
const plugScript = document.createElement('script')
plugScript.setAttribute('type', 'text/javascript')
plugScript.setAttribute('id', 'plug-platform')
plugScript.setAttribute('src', 'https://plug-platform.devrev.ai/static/plug.js')
document.body.appendChild(plugScript)

// Initialize Plug SDK after script loads
plugScript.onload = () => {
if ((window as any).plugSDK) {
(window as any).plugSDK?.init?.({
app_id: process.env.PLUG_APP_ID,
enable_session_recording: true,
})
}
}
}
}

let observations = 0
document.addEventListener('DOMContentLoaded', async () => {
console.log('DOMContentLoaded')
await render()
new MutationObserver(async (e, o) => {
await render()
Expand Down
Loading