Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dukhovnyi committed Nov 17, 2024
1 parent 8c32a67 commit f9047f2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 124 deletions.
166 changes: 43 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,44 @@

GliaWidgets SDK is a simple and customisable framework built on top of GliaSDK. It provides all the necessary UI components to quickly integrate GliaSDK into your project.

## Project structure
# How to use GliaSDK in Ionic environment

- `src` - contains ts source code and interfaces available in Ionic environment.
```js
// Import `glia-widgets-ionic` plugin
import { GliaSdk } from 'glia-widgets-ionic';

- `definitions.ts` - Ionic Plugin interfaces
- `index.ts` - exposes `GliaSdk` namespace and registers platforms (ios and android registered automatically). In case of introducing a new platform, see `web.ts` file.
- `web.ts` - example of using Ionic Plugin on web platform.
// Configure SDK
GliaSdk.configure({
siteId: 'site-id',
apiKey: { id: 'api-key-id', secret: 'api-key-secret' },
region: 'us',
companyName: 'Ionic Company',
});

- `ios` - iOS implementation of Ionic Plugin.

- `GliaSdkPlugin.swift` - the Plugin entry point.
- `GliaSdk.swift` - implementation for each Ionic Plugin interface.

- `android` - Android implementation of Ionic Plugin.

- TBD

- `example-app` - Example project with integrated GliaWidgets Ionic Plugin locally. Using for testing purposes.
- `src` - Ionic specific UI. Regular web page that uses Glia Widgets Ionic Plugin.
- `ios` - Sample iOS project. This project is using as an wrapper for Ionic Plugin since this sample project doesn't introduce any new functionality.
- `public` - precomiled JS code for using during iOS bundling.
- `android` - Sample Android project. This project is using as an wrapper for Ionic Plugin since this sample project doesn't introduce any new functionality.
- `dist` - precompiled JS code.

## Add New Interface/Function

- create a new interface in `definition.ts` file.
- add handling for `ios`:
- extend `pluginMethods` function in `GliaSdkPlugin.swift` file with `CAPPluginMethod`.
- add handling for `android`:
- TBD

## Troubleshooting

This project uses different folder for caching:

- `node_modules` - installed npm modules
- `.build` - Ionic build folder
- `dist` - precompiled JS code

Be aware that root folder has these files as a `example-app` also has the same project structure.

In case of unexpected building, compilation, changing tracking (introduced method is not existed in `ios`/`android` projects) issues, try to remove cache folders and install everything again.

```bash
# remove folder with dependencies
rm -rf node_modules
# install dependencies based on lock file
npm i
```

```bash
# remove precompiled code
rm -rf dist
# build TS/JS source code
npm run build
```

```bash
# generate documentation
npm run docgen
```

If changes in `example-app/src/index.html` are not visible in platform specific code, try to sync changes manually:

```bash
cd example-app

# for ios, it would be beneficial to do `rm -rf ios/App/App/public`
npm run build & npx cap sync ios
```

## Plugin Installation

```bash
npm install glia-widgets-ionic
npx cap sync
// Start engagement
GliaSdk.startAudio();
```

## API

<docgen-index>

* [`configure(...)`](#configure)
* [`startChat(...)`](#startchat)
* [`startAudio(...)`](#startaudio)
* [`startVideo(...)`](#startvideo)
* [`startSecureConversation(...)`](#startsecureconversation)
* [`clearVisitorSession()`](#clearvisitorsession)
* [`listQueues()`](#listqueues)
* [`showVisitorCodeViewController()`](#showvisitorcodeviewcontroller)
* [`authenticate(...)`](#authenticate)
* [`deauthenticate()`](#deauthenticate)
* [`isAuthenticated()`](#isauthenticated)
* [`refreshAuthentication(...)`](#refreshauthentication)
* [`pauseLiveObservation()`](#pauseliveobservation)
* [`resumeLiveObservation()`](#resumeliveobservation)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
- [`configure(...)`](#configure)
- [`startChat(...)`](#startchat)
- [`startAudio(...)`](#startaudio)
- [`startVideo(...)`](#startvideo)
- [`startSecureConversation(...)`](#startsecureconversation)
- [`clearVisitorSession()`](#clearvisitorsession)
- [`listQueues()`](#listqueues)
- [`showVisitorCodeViewController()`](#showvisitorcodeviewcontroller)
- [`authenticate(...)`](#authenticate)
- [`deauthenticate()`](#deauthenticate)
- [`isAuthenticated()`](#isauthenticated)
- [`refreshAuthentication(...)`](#refreshauthentication)
- [`pauseLiveObservation()`](#pauseliveobservation)
- [`resumeLiveObservation()`](#resumeliveobservation)
- [Interfaces](#interfaces)
- [Type Aliases](#type-aliases)

</docgen-index>

Expand All @@ -121,8 +60,7 @@ NB! To make plugin work properly, use `create-visitor` credentials for Site APIK
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`options`** | <code>{ siteId: string; apiKey: <a href="#apikey">ApiKey</a>; region: <a href="#region">Region</a>; companyName: string; overrideLocale?: string; }</code> |

--------------------

---

### startChat(...)

Expand All @@ -136,8 +74,7 @@ Starts a new chat/text engagement with queue identifiers. If `queueIds` is null
| ------------- | ------------------------------------- |
| **`options`** | <code>{ queueIds?: string[]; }</code> |

--------------------

---

### startAudio(...)

Expand All @@ -151,8 +88,7 @@ Starts a new audio engagement with queue identifiers. If `queueIds` is null or e
| ------------- | ------------------------------------- |
| **`options`** | <code>{ queueIds?: string[]; }</code> |

--------------------

---

### startVideo(...)

Expand All @@ -166,8 +102,7 @@ Starts a new video engagement for queue identifiers. If `queueIds` is null or em
| ------------- | ------------------------------------- |
| **`options`** | <code>{ queueIds?: string[]; }</code> |

--------------------

---

### startSecureConversation(...)

Expand All @@ -182,8 +117,7 @@ Secure Conversation requires authentication/IdToken.
| ------------- | --------------------------------------------------------------------------------------------------------- |
| **`options`** | <code>{ startScreen: <a href="#secureconversationstartscreen">SecureConversationStartScreen</a>; }</code> |

--------------------

---

### clearVisitorSession()

Expand All @@ -193,8 +127,7 @@ clearVisitorSession() => Promise<void>

Recreates currently used visitor in SDK.

--------------------

---

### listQueues()

Expand All @@ -206,8 +139,7 @@ Fetches all queues with its info for current site.

**Returns:** <code>Promise&lt;any&gt;</code>

--------------------

---

### showVisitorCodeViewController()

Expand All @@ -217,8 +149,7 @@ showVisitorCodeViewController() => Promise<void>

Presents GliaWidgets UI with visitor code for sharing with operator to start an engagement.

--------------------

---

### authenticate(...)

Expand All @@ -232,8 +163,7 @@ Authenticates visitor.
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| **`options`** | <code>{ behavior: <a href="#authenticationbehavior">AuthenticationBehavior</a>; idToken: string; accessToken?: string; }</code> | - Provides options for authentication such as behavior, idToken, and accessToken. |

--------------------

---

### deauthenticate()

Expand All @@ -243,8 +173,7 @@ deauthenticate() => Promise<void>

Deauthenticates visitor. Be aware that deauthentication process relies on <a href="#authenticationbehavior">`AuthenticationBehavior`</a>

--------------------

---

### isAuthenticated()

Expand All @@ -254,8 +183,7 @@ isAuthenticated() => Promise<void>

Provides current authentication state

--------------------

---

### refreshAuthentication(...)

Expand All @@ -269,8 +197,7 @@ Refreshes authentication access properties.
| ------------- | ------------------------------------------------------- |
| **`options`** | <code>{ idToken: string; accessToken?: string; }</code> |

--------------------

---

### pauseLiveObservation()

Expand All @@ -280,8 +207,7 @@ pauseLiveObservation() => Promise<void>

Makes a pause for ongoing LiveObservation session.

--------------------

---

### resumeLiveObservation()

Expand All @@ -291,37 +217,31 @@ resumeLiveObservation() => Promise<void>

Resumes ongoing LiveObservation session.

--------------------

---

### Interfaces


#### ApiKey

| Prop | Type |
| ------------ | ------------------- |
| **`id`** | <code>string</code> |
| **`secret`** | <code>string</code> |


### Type Aliases


#### Region

Site's region.

<code>'us' | 'eu' | 'beta'</code>


#### SecureConversationStartScreen

Start screen for Secure Conversation flow.

<code>'welcome' | 'chatTranscript'</code>


#### AuthenticationBehavior

Authentication (IdToken) behavior.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "glia-widgets-ionic",
"version": "0.0.1",
"version": "1.0.0",
"description": "GliaWidgets SDK is a simple and customisable framework built on top of GliaSDK. It provides all the necessary UI components to quickly integrate GliaSDK into your project.",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down

0 comments on commit f9047f2

Please sign in to comment.