Skip to content

Commit 21af1d1

Browse files
Merge branch 'main' into fix/state-update-api-toggle
2 parents a80813a + d75e2af commit 21af1d1

28 files changed

+395
-105
lines changed
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
.footer a {
1+
.custom-footer a {
22
text-decoration: none;
33
color: black;
44
cursor: pointer;
55
}
66

7-
.footer html, body, div, applet, object, iframe,
7+
.custom-footer html, body, div, applet, object, iframe,
88
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
99
a, abbr, acronym, address, big, cite, code,
1010
del, dfn, em, img, ins, kbd, q, s, samp,
@@ -20,33 +20,30 @@ time, mark, audio, video, button {
2020
margin: 0;
2121
padding: 0;
2222
border: 0;
23-
font-size: 100%;
24-
font: inherit;
2523
vertical-align: baseline;
26-
line-height: 19px;
2724
}
2825

2926

3027
/* HTML5 display-role reset for older browsers */
31-
.footer article, aside, details, figcaption, figure,
28+
.custom-footer article, aside, details, figcaption, figure,
3229
footer, header, hgroup, menu, nav, section {
3330
display: block;
3431
}
3532

36-
.footer ol, ul {
33+
.custom-footer ol, ul {
3734
list-style: none;
3835
}
3936

40-
.footer blockquote, q {
37+
.custom-footer blockquote, q {
4138
quotes: none;
4239
}
4340

44-
.footer blockquote:before, blockquote:after, q:before, q:after {
41+
.custom-footer blockquote:before, blockquote:after, q:before, q:after {
4542
content: '';
4643
content: none;
4744
}
4845

49-
.footer table {
46+
.custom-footer table {
5047
border-collapse: collapse;
5148
border-spacing: 0;
5249
}

custom-implementation/src/components/footer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ const Footer = ({ list = [], logo, status, compliance, ...rest }: any) => {
1313
return (
1414
<ComponentConfigContext.Provider
1515
value={{
16-
origin: 'https://api.docs.devrev.ai',
16+
origin: 'https://developer.devrev.ai',
1717
}}>
1818
<SharedFooter
19-
className="footer"
19+
className="custom-footer"
2020
list={list}
2121
logo={logo}
2222
status={status}

custom-implementation/src/components/header.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.header {
2-
background-color: white;
1+
.custom-header {
2+
z-index: 60;
33
}
44

5-
.header nav a {
5+
.custom-header nav a {
66
text-decoration: none;
77
color: black;
88
cursor: pointer;

custom-implementation/src/components/header.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client'
22

3+
import { useEffect, useState } from 'react'
34
import {
45
ComponentConfigContext,
56
HeaderV30 as SharedHeader,
@@ -11,23 +12,36 @@ const Header = ({
1112
logo,
1213
links,
1314
actions,
14-
version,
1515
collapseOnScroll = true,
1616
}: // eslint-disable-next-line @typescript-eslint/no-explicit-any
1717
any) => {
18+
const html = document.getElementsByTagName('html')[0]
19+
const [theme, setTheme] = useState(html.getAttribute('class'))
20+
useEffect(() => {
21+
const observer = new MutationObserver(() => {
22+
setTheme(html.getAttribute('class'))
23+
})
24+
25+
const config = { attributes: true, attributeFilter: ['class'] }
26+
observer.observe(html, config)
27+
return () => {
28+
observer.disconnect()
29+
}
30+
}, [html])
31+
1832
return (
1933
<div>
2034
<ComponentConfigContext.Provider
2135
value={{
22-
origin: 'https://api.docs.devrev.ai',
36+
origin: 'https://developer.devrev.ai',
2337
}}>
2438
<SharedHeader
2539
logo={logo}
2640
items={links}
2741
actions={actions}
28-
version={version}
42+
version={theme === 'dark' ? 'light' : 'dark'}
2943
collapseOnScroll={collapseOnScroll}
30-
wrapperClassName="header"
44+
wrapperClassName="custom-header"
3145
/>
3246
</ComponentConfigContext.Provider>
3347
</div>

custom-implementation/src/main.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,20 @@ const render = async () => {
2020
const sidenav = document.querySelector('button.fern-search-bar')
2121
?.parentElement as HTMLElement
2222

23+
const theme = document.getElementsByTagName('html')[0].getAttribute('class')
24+
2325
if (!document.getElementById('theme-switch')) {
2426
const wrapper = document.createElement('div')
2527
wrapper.setAttribute('id', 'theme-switch')
2628
sidenav.appendChild(wrapper)
27-
2829
ReactDOM.render(React.createElement(ThemeSwitch), wrapper)
2930
}
3031

3132
ReactDOM.render(
32-
React.createElement(Header, { ...data.header }),
33+
React.createElement(Header, {
34+
...data.header,
35+
version: theme == 'dark' ? 'light' : 'dark',
36+
}),
3337
document.getElementById('fern-header'),
3438
() => {
3539
// Once the header component is loaded, make it visible

fern.zip

-9.74 MB
Binary file not shown.

fern/docs/pages/concepts.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ A connection uses a keyring object to provide authentication, access token refre
2828

2929
## Event source
3030

31-
[Event sources](/snap-in-development/references/event-sources) collect events from webhooks, emails, and timer-based API calls. Events can also be manually published. DevRev supports the ingestion of webhooks from any source. Each event source is assigned to a dev org.
31+
[Event sources](/snapin-development/references/event-sources) collect events from webhooks, emails, and timer-based API calls. Events can also be manually published. DevRev supports the ingestion of webhooks from any source. Each event source is assigned to a dev org.
3232

3333
For example, if you want to collect webhook events from an organization's GitHub, create an event source which in turn gives us a URL to subscribe to on GitHub. Webhook events published to this URL are available from this event source.
3434

3535
## Function
3636

37-
The framework for executing code provided by users is [functions](/snap-in-development/references/functions). Currently, Javascript/TypeScript can be taken as input from the user and deployed as a function.
37+
The framework for executing code provided by users is [functions](/snapin-development/references/functions). Currently, Javascript/TypeScript can be taken as input from the user and deployed as a function.
3838

3939
Connection values can be passed to a function at runtime, enabling it to execute API calls to DevRev and to external systems such as GitHub, Slack, Bitbucket, and Discord.
4040

@@ -44,17 +44,17 @@ Snap-ins can be configured to enable and disable features, based on custom input
4444

4545
## Commands
4646

47-
A user can trigger [commands](/snap-in-development/references/commands) on different surfaces based on some parameters. Once a command is executed, a function is triggered.
47+
A user can trigger [commands](/snapin-development/references/commands) on different surfaces based on some parameters. Once a command is executed, a function is triggered.
4848

4949
A developer can develop commands to be included in a snap-in Version along with associated functions. These commands are installed when the snap-in is installed.
5050

5151
As part of the snap-in, commands have access to keyrings, global variables, and event sources.
5252

5353
## Hooks
5454

55-
[Hooks](/snap-in-development/references/hooks) enable developers to invoke functions when various events in the lifecycle of a snap-in occur. Hooks can be used to perform various actions based on the event such as validating the snap-in inputs and keyrings when the configuration is updated, registering event-sources and webhooks in external platforms when snap-in is activated, or setting custom fields to be used by the snap-in.
55+
[Hooks](/snapin-development/references/hooks) enable developers to invoke functions when various events in the lifecycle of a snap-in occur. Hooks can be used to perform various actions based on the event such as validating the snap-in inputs and keyrings when the configuration is updated, registering event-sources and webhooks in external platforms when snap-in is activated, or setting custom fields to be used by the snap-in.
5656

57-
Detailed documentation on hooks can be found in the [hooks reference](/snap-in-development/references/hooks).
57+
Detailed documentation on hooks can be found in the [hooks reference](/snapin-development/references/hooks).
5858

5959
## States
6060

@@ -76,7 +76,7 @@ The following diagram illustrates the transitions between different states.
7676

7777
## Snap-kit
7878

79-
[Snap-kit](/snap-in-development/references/snapkit) defines UI customization components. It's defined in the snap-in package and used to display developer-defined components. A snap-kit component can display data to a user or collect input for triggering a function.
79+
[Snap-kit](/snapin-development/references/snapkit) defines UI customization components. It's defined in the snap-in package and used to display developer-defined components. A snap-kit component can display data to a user or collect input for triggering a function.
8080

8181
## Marketplace
8282

fern/docs/pages/developer-intro.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A brief [tutorial](/api-reference/getting-started) shows you how to access the A
1010

1111
Specifications covering the supported APIs are based on OpenAPI Specification 3.0. You can download the specs to use an OpenAPI 3.0-compliant tool to perform a variety of actions, including rendering them in UI and generating SDKs. Two [versions](/about/versioning) of the DevRev API are available: [public](/public) and [beta](/beta) (early access). Use the drop-down menu in the upper-left corner of this site to switch between versions.
1212

13-
To take action based on events from the DevRev platform, [webhooks](/guides/getting-started-with-webhooks) are also supported.
13+
To take action based on events from the DevRev platform, [webhooks](/guides/webhooks) are also supported.
1414
<Cards>
1515
<Card
1616
title="Public"
@@ -27,7 +27,7 @@ To take action based on events from the DevRev platform, [webhooks](/guides/gett
2727

2828
## 🧩 Snap-ins
2929

30-
Numerous snap-ins are available on the DevRev [Marketplace](https://devrev.ai/marketplace). The [snap-in framework](/snap-in-development/concepts) is available for you to create your own snap-ins for automation of DevRev workflows or integration with other system.
30+
Numerous snap-ins are available on the DevRev [Marketplace](https://devrev.ai/marketplace). The [snap-in framework](/snapin-development/concepts) is available for you to create your own snap-ins for automation of DevRev workflows or integration with other system.
3131

3232
## 💻 SDKs
3333

fern/docs/pages/pagination.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
A lot of the time, when you're making calls to the DevRev API, there'll be a lot of results to return. For that reason, we paginate the results to make sure responses are easier to handle.
2+
DevRev API uses a cursor-based pagination to provide consistency and support large data.
23
Let's say your initial call is asking to list all the users in an org; the result could be a massive response with hundreds of thousands of pages. That's not a good place to start.
34

45
When you make an API call, it returns a cursor with a random code. If there are more pages available, the response will include a field called `next_cursor` which points to the next page.

fern/docs/pages/plug-sdk/methods.mdx

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
Our PLuG widget SDK is a powerful tool designed to further enhance our widget on your website or application. With our SDK, you can seamlessly integrate our feature-rich widget by empowering you to create a dynamic and personalized user experience. Let's get started.
22

3-
| Method | Description |
4-
| ------------------------ | --------------------------------------------------------------------------------- |
5-
| `plugSDK.init()` | Initialize the PLuG widget. |
6-
| `plugSDK.shutdown()` | End the user session which is currently initialized in PLuG widget. |
7-
| `plugSDK.toggleWidget()` | Open/close the widget. |
8-
| `plugSDK.onEvent()` | Perform specific actions based on the payload type received from the PLuG widget. |
9-
| `plugSDK.toggleTheme('light/dark')` | Toggle PLuG widget theme. |
10-
| `plugSDK.toggleWidget(true, 'create_conversation', {startConversationContent: 'Hi',});` | Start a conversation. |
3+
## Methods
114

5+
- `plugSDK.init()` Initialize the PLuG chat widget.
126

13-
## Initialize the widget
7+
- `plugSDK.initSearchAgent()` Initialize PLuG search agent.
148

15-
Calling the `init()` method initializes the PLuG widget on your website. Initializing the PLuG widget is necessary for you to perform any other actions on the PLuG widget SDK.
9+
- `plugSDK.shutdown()` End the user session which is currently initialized in PLuG widget.
10+
11+
- `plugSDK.toggleWidget()` Open/close the chat widget.
12+
13+
- `plugSDK.toggleSearchAgent()` Open/close the search agent.
14+
15+
- `plugSDK.onEvent()` Perform specific actions based on the payload type received from the PLuG widget.
16+
17+
- `plugSDK.toggleTheme('light/dark')` Toggle PLuG widget theme.
18+
19+
- `plugSDK.toggleWidget(true, 'create_conversation', {startConversationContent: 'Hi',});` Start a conversation.
20+
21+
- `plugSDK.prefillSearchQuery(query:"string")` Prefill the search input of the search agent.
22+
23+
## Initialize chat
24+
25+
Calling the `init()` method initializes the PLuG chat widget on your website. Initializing the PLuG widget is necessary for you to perform any other actions on the PLuG widget SDK.
1626

1727
```jsx
1828
useEffect(() => {
@@ -26,6 +36,25 @@ useEffect(() => {
2636
When React is using `Strict` mode, you might get a warning message from `window.plugSDK.init()` being called multiple times. These errors won't impact the installation and functioning of the widget.
2737
</Callout>
2838

39+
## Initialize search
40+
41+
Calling the `initSearchAgent()` method initializes the PLuG Search Agent on your website. Initializing search is necessary for you to perform any other actions on the PLuG widget SDK.
42+
43+
```jsx
44+
useEffect(() => {
45+
window.plugSDK.init({
46+
app_id: '<your_unique_app_id>',
47+
disable_plug_chat_window: true,
48+
});
49+
50+
window.plugSDK.onEvent((payload) => {
51+
if (payload.type === 'ON_PLUG_WIDGET_READY') {
52+
window.plugSDK.initSearchAgent();
53+
}
54+
});
55+
}, []);
56+
```
57+
2958
## Shutdown the widget
3059

3160
The `shutdown()` method is helpful when you want to end the user session which is currently initialized in the PLuG widget. You can use this method to clear your users' conversations and tickets when they log out of your application.
@@ -49,10 +78,11 @@ Once the `shutdown()` method is called, all the other functionality in the widge
4978

5079
## Open or close the widget
5180

52-
To control whether the PLuG widget launcher screen is open, you can use the `togglewidget()` method with a boolean value. Your code needs to listen to the event `ON_PLUG_WIDGET_READY` to call this method. If the widget isn't ready then this method won’t make any action.
81+
To control whether the PLuG widget launcher screen is open, you should use either the `togglewidget()` method with a boolean value or the `toggleSearchAgent()` method, depending on which PLuG instance you are using.
5382

5483
```jsx
5584
window.plugSDK.toggleWidget(true);
85+
window.plugSDK.toggleSearchAgent(true);
5686
```
5787

5888
<iframe src="https://codesandbox.io/embed/toggle-plug-with-button-nnkmk3?fontsize=14&hidenavigation=1&module=%2Fsrc%2FTogglePlug.js&theme=dark&view=preview&hidedevtools=1"
@@ -66,12 +96,13 @@ window.plugSDK.toggleWidget(true);
6696

6797
This method can be used to listen to events coming from the PLuG widget. The following are the different `PAYLOAD_TYPES`.
6898

69-
| Event | Meaning |
70-
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
71-
| `ON_PLUG_WIDGET_CLOSED` | The PLuG widget is closed. |
72-
| `ON_PLUG_WIDGET_OPENED` | The PLuG widget is opened. |
73-
| `ON_PLUG_WIDGET_READY` | The PLuG widget is ready. |
74-
| `ON_PLUG_WIDGET_UNREAD_COUNT_CHANGE` | The user receives a new message to their PLuG. You can also listen to the number of unread messages and display that to your user. |
99+
- `ON_PLUG_WIDGET_CLOSED` The PLuG widget is closed.
100+
101+
- `ON_PLUG_WIDGET_OPENED` The PLuG widget is opened.
102+
103+
- `ON_PLUG_WIDGET_READY` The PLuG widget is ready.
104+
-
105+
- `ON_PLUG_WIDGET_UNREAD_COUNT_CHANGE` The user receives a new message to their PLuG. You can also listen to the number of unread messages and display that to your user.
75106

76107
```jsx
77108
useEffect(() => {

fern/docs/pages/publish_to_marketplace.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ The publishing process commences by initiating a marketplace submission, which e
3434

3535
## Get started
3636

37-
To get started with publishing marketplace item, you need DevRev CLI. Refer to [DevRev CLI Cheatsheet](/snap-in-development/references/install-dev-rev-cli) for more information.
37+
To get started with publishing marketplace item, you need DevRev CLI. Refer to [DevRev CLI Cheatsheet](/snapin-development/references/install-dev-rev-cli) for more information.
3838

3939
### Create a snap-in
4040

41-
To proceed with making a submission in marketplace, you need a snap-in for which you are creating this submission. If you are new to snap-ins, [follow the development and deployment guide](/snap-in-development/tutorials/overview) to create your first snap-in.
41+
To proceed with making a submission in marketplace, you need a snap-in for which you are creating this submission. If you are new to snap-ins, [follow the development and deployment guide](/snapin-development/tutorials/overview) to create your first snap-in.
4242

4343
## Create marketplace listing
4444

fern/docs/pages/references/cli.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ The `--force` flag deletes the snap-in even if the `deactivate` hook fails. If t
312312

313313
## Snap-in context
314314

315-
The CLI persists in the context of the CLI in a [snap-in context](#snap-in-context). The context is used to store the following information per snap-in package slug:
315+
The CLI persists in the context of the CLI in a snap-in context. The context is used to store the following information per snap-in package slug:
316316

317317
1. The ID of the snap-in package owning the slug.
318318
2. The ID of the last created/upgraded snap-in version, if any.

fern/docs/pages/references/functions.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Using functions, you can provide custom code and link it to your event sources, automations, or snap-kit actions. Functions are written in JavaScript and can be used to transform events, send notifications, or perform any other custom logic including network calls.
22

3-
In order to create a snap-in version, functions must be defined as shown in the [code samples](/snap-in-development/code-samples). Functions are packaged and provided as an artifact at the time of snap-in version creation and then used to deploy functions to snap-in versions. An artifact may contain multiple function definitions. The artifact is a zip file containing the following files:
3+
In order to create a snap-in version, functions must be defined as shown in the [code samples](/snapin-development/code-samples). Functions are packaged and provided as an artifact at the time of snap-in version creation and then used to deploy functions to snap-in versions. An artifact may contain multiple function definitions. The artifact is a zip file containing the following files:
44

55
```bash
66
/
@@ -26,4 +26,4 @@ functions:
2626
- `name`: It is the function name that should match the corresponding function name in the folder.
2727
- `description`: It describes the function.
2828

29-
Refer to the [function invocation](/snap-in-development/references/function-invocation) for details about the exact payload of the function.
29+
Refer to the [function invocation](/snapin-development/references/function-invocation) for details about the exact payload of the function.

fern/docs/pages/references/hooks.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ hooks:
1818
function: update-resource
1919
```
2020
21-
The above definition would register the hooks and invoke the provided functions alongside each hook. The functions can be defined in the manifest and provided in the code as explained in the [functions reference](/snap-in-development/references/functions).
21+
The above definition would register the hooks and invoke the provided functions alongside each hook. The functions can be defined in the manifest and provided in the code as explained in the [functions reference](/snapin-development/references/functions).
2222
23-
For the event schema received by the function invocation, refer to the [function invocation reference](/snap-in-development/references/function-invocation).
23+
For the event schema received by the function invocation, refer to the [function invocation reference](/snapin-development/references/function-invocation).
2424
2525
The event name is the identifier for the hook. The event name can be used to identify the hook that's being invoked. The identifiers are defined in the summary table below.
2626

0 commit comments

Comments
 (0)