Skip to content
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

Add PC Widget Docs #157

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
211 changes: 211 additions & 0 deletions docs/pc-widget-unity/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
---
sidebar_position: 30
title: Configuration
description: "Configuration options for Helpshift PC widget - Unity"
---

import {
Image
} from "@site/src/components/forDocs";

## Configuration

A configuration object has to be created, which should be passed to the `initialize` API.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrase this line. Ref to Web Widget page.

Below are the configuration options that we have.

<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Default</th>
<th>Required</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Domain</td>
<td>string</td>
<td><code>""</code></td>
<td>True</td>
<td>Specifies the domain for the widget to operate.</td>
</tr>
<tr>
<td>PlatformId</td>
<td>string</td>
<td><code>""</code></td>
<td>True</td>
<td>Unique identifier for the platform.</td>
</tr>
<tr>
<td>AppId</td>
<td>string</td>
<td><code>""</code></td>
<td>True</td>
<td>Unique identifier for the application.</td>
</tr>
<tr>
<td>WidgetType</td>
<td>string</td>
<td><code>helpcenter_and_webchat</code></td>
<td>True</td>
<td>Defines the type of widget. Common options include <code>helpcenter_and_webchat</code>, <code>helpcenter</code>, and <code>webchat</code>.</td>
</tr>
<tr>
<td>UserId</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Identifier for the user interacting with the widget.</td>
</tr>
<tr>
<td>UserName</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Name of the user.</td>
</tr>
<tr>
<td>UserEmail</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Email address of the user.</td>
</tr>
<tr>
<td>Language</td>
<td>string</td>
<td><code>en</code></td>
<td>False</td>
<td>Language preference for the widget. Example: <code>en</code>, <code>fr</code>.</td>
</tr>
<tr>
<td>ConversationPrefillText</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Prefill text for initiating a conversation.</td>
</tr>
<tr>
<td>InitialUserMessage</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Initial message displayed to the user.</td>
</tr>
<tr>
<td>FullPrivacy</td>
<td>bool</td>
<td><code>false</code></td>
<td>False</td>
<td>Indicates if full privacy mode is enabled.</td>
</tr>
<tr>
<td>InitiateChatOnLoad</td>
<td>bool</td>
<td><code>false</code></td>
<td>False</td>
<td>Automatically initiate a chat when the widget loads.</td>
</tr>
<tr>
<td>ClearAnonymousUserOnLogin</td>
<td>bool</td>
<td><code>false</code></td>
<td>False</td>
<td>Clears anonymous user data upon login.</td>
</tr>
<tr>
<td>EnableLogging</td>
<td>bool</td>
<td><code>false</code></td>
<td>False</td>
<td>Enables logging for debugging purposes.</td>
</tr>
<tr>
<td>Cifs</td>
<td>bool</td>
<td><code>false</code></td>
<td>False</td>
<td>Configuration identifier for specific integrations.</td>
</tr>
<tr>
<td>Tags</td>
<td>List&lt;string&gt;</td>
<td><code>new List&lt;string&gt;()</code></td>
<td>False</td>
<td>A list of tags to associate with the widget.</td>
</tr>
<tr>
<td>FaqId</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Identifier for a specific FAQ.</td>
</tr>
<tr>
<td>SectionId</td>
<td>string</td>
<td><code>""</code></td>
<td>False</td>
<td>Identifier for a specific section.</td>
</tr>
<tr>
<td>ResizeMode</td>
<td>ResizeMode</td>
<td><code>ResizeMode.SlimRight</code></td>
<td>False</td>
<td>Determines how the widget resizes. Example values include <code>ResizeMode.SlimRight</code>, <code>ResizeMode.SlimCenter</code>, <code>ResizeMode.SlimLeft</code>, <code>ResizeMode.WideCenter</code>, and <code>ResizeMode.FullScreen</code>.</td>
</tr>
</tbody>
</table>


### Usage

```csharp
var config = new HelpshiftConfig
{
Domain = "mydomain",
PlatformId = "mydomain_platform_123",
AppId = "3",
WidgetType = "helpcenter_and_webchat",
};

// Pass the configuration to the initialize API
Helpshift.Initialize(Application.streamingAssetsPath, config);

```

### Mode Previews
saga-hs marked this conversation as resolved.
Show resolved Hide resolved

<table>
<thead>
<tr>
<th>Mode</th>
<th>Preview</th>
</tr>
</thead>
<tbody>
<tr>
<td>SlimRight (Default)</td>
<td><Image src="/static/books/pc-widget-unity/preview-right.png" width="half" centered /></td>
</tr>
<tr>
<td>SlimLeft</td>
<td><Image src="/static/books/pc-widget-unity/preview-left.png" width="half" centered /></td>
</tr>
<tr>
<td>SlimCenter</td>
<td><Image src="/static/books/pc-widget-unity/preview-center.png" width="half" centered /></td>
</tr>
<tr>
<td>WideCenter</td>
<td><Image src="/static/books/pc-widget-unity/preview-wide-center.png" width="half" centered /></td>
</tr>
<tr>
<td>FullScreen</td>
<td><Image src="/static/books/pc-widget-unity/preview-fullscreen.png" width="half" centered /></td>
</tr>
</tbody>
</table>
74 changes: 74 additions & 0 deletions docs/pc-widget-unity/helpshift-apis.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
sidebar_position: 20
title: Helpshift APIs
description: "List of available APIs for Helpshift PC widget"
---

<table>
<tr>
<th>API</th>
<th>Description</th>
<th>Parameters</th>
<th>Example Usage</th>
</tr>
<tr>
<td>Helpshift.Initialize</td>
<td>
Initializes the Helpshift widget and runs it in the background, enabling it to listen for notifications.<br/><br/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change Helpshift widget -> Helpshift Widget everywhere

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check with product if we want to have PC widget as PC Widget?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going with Helpshift Pc Widget

If notifications are a high priority, this method should be called when the game starts to ensure timely event handling.
</td>
<td>
<ul>
<li>path (string): The base path to the Application's streaming assets, e.g., Application.streamingAssetsPath.</li>
<li>helpshiftConfig (object): A configuration object for the widget.</li>
</ul>
</td>
<td>
<code>Helpshift.Initialize(Application.streamingAssetsPath, helpshiftConfig);</code>
</td>
</tr>
<tr>
<td>Helpshift.Show</td>
<td>
Displays the Helpshift widget on the screen. This is typically invoked during the on-click action of a clickable element (e.g., a button).<br/><br/>
Ensure that <code>Helpshift.Initialize()</code> has been called earlier in the game flow before invoking this method; otherwise, the widget will not function properly.
</td>
<td>None</td>
<td>
<code>Helpshift.Show()</code>
</td>
</tr>
<tr>
<td>Helpshift.Hide</td>
<td>
Temporarily hides the Helpshift widget from the screen. This can also be triggered by clicking the "X" button on the widget.<br/><br/>
Typically used when the widget should be hidden to minimize distractions, adjust to UI changes, or ensure a smooth user experience during focused gameplay moments, such as cutscenes, high-concentration sequences, or transitions between states. The widget is hidden rather than closed to keep the background event system active for handling notifications.
</td>
<td>None</td>
<td>
<code>Helpshift.Hide()</code>
</td>
</tr>
<tr>
<td>Helpshift.CleanUp</td>
<td>
Destroy the Helpshift widget and terminates its background process. This method should be called during game shutdown to release resources and ensure proper cleanup.<br/><br/>
Call this inside Unity's <code>OnApplicationQuit()</code> method.
</td>
<td>None</td>
<td>
<code>Helpshift.CleanUp()</code>
</td>
</tr>
<tr>
<td>Helpshift.Update (Optional)</td>
<td>
Handles events sent from the Helpshift widget to Unity. This method is typically called inside Unity's <code>Update()</code> method.<br/><br/>
This is optional in the current workflow as no events are being sent from the widget to Unity.
</td>
<td>None</td>
<code>
Helpshift.Update()
</code>
</tr>
</table>
20 changes: 20 additions & 0 deletions docs/pc-widget-unity/integration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
sidebar_position: 10
title: Integration
description: "Integrate Helpshift PC widget in the PC unity games"
---
import {
Image
} from "@site/src/components/forDocs";

# Integration

When in a game, we can import the package using Assets -> Import Package -> Custom Package

<Image src="/static/books/pc-widget-unity/integrate-1.png" width="half" />

Import all the files from the package into the project

<Image src="/static/books/pc-widget-unity/integrate-2.png" width="half" />

This approach is the standard approach, where the game developers will have control over the <br/>widget's life cycle using the set of [Helpshift API's](/pc-widget-unity/helpshift-apis/) that are provided.
12 changes: 12 additions & 0 deletions src/data/homeSections.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@
"title": "New",
"colorClasses": "bg-green-500 text-white"
}
},
{
"title": "PC Widget - Unity",
"image": "/img/unity.png",
"link": "/pc-widget-unity",
"alt": "pc-widget-unity",
"description": "Integrate Helpshift widget in the PC unity games",
"color": "from-fuchsia-600 to-fuchsia-800",
"tag": {
"title": "New",
"colorClasses": "bg-green-500 text-white"
}
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions src/data/navbar.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
{
"label": "Helpshift Widget",
"to": "/helpshift-widget"
},
{
"label": "PC Widget - Unity",
"to": "/pc-widget-unity"
}
]
},
Expand Down
16 changes: 16 additions & 0 deletions src/data/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@
]
}
],
"pcWidget": [
{
"type": "category",
"label": "PC Widget - Unity",
"link": {
"type": "generated-index",
"slug": "pc-widget-unity"
},
"items": [
{
"type": "autogenerated",
"dirName": "pc-widget-unity"
}
]
}
],
"salesforce": [
{
"type": "category",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.