This commit is contained in:
Peter Morton 2025-08-08 09:46:07 -05:00
commit e17b64c0e9
9 changed files with 6650 additions and 0 deletions

4
.gitignore vendored
View File

@ -3,3 +3,7 @@ remote_console/application/node_modules
browser-extension/.DS_Store
browser-extension.crx
browser-extension.pem
iva_electron/node_modules
iva_electron/out
iva_electron/.DS_Store
.DS_Store

4
iva_electron/.env Normal file
View File

@ -0,0 +1,4 @@
APP_TITLE=Verint Copilot
WIDTH=400
HEIGHT=768
PROXY_ENDPOINT=https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/fullscreen_messenger

72
iva_electron/README.md Normal file
View File

@ -0,0 +1,72 @@
# Electron SPA App
This project is a simple and configurable **Electron desktop application** that embeds a **Single Page Application (SPA)** — such as a React, Vue, or static HTML/JavaScript app — into a desktop environment.
The app uses a `.env` file to allow easy configuration of the window size, title, and the path to your SPA entry point.
---
## 📁 Project Structure
```
electron-spa-app/
├── src/ # Electron main process code
│ └── main.js
├── .env # App configuration
├── package.json
└── README.md
```
---
## ⚙️ Features
- Embeds an IVA Application via Proxy Endpoint
- Configurable via `.env` (window size, title, entry point)
- Cross-platform support (macOS, Windows, Linux)
- Follows a clean folder structure
---
## 🧪 Prerequisites
- [Node.js](https://nodejs.org/) (v16 or higher recommended)
- [npm](https://www.npmjs.com/)
- [Electron](https://www.electronjs.org/) (installed as a dev dependency)
---
## 📦 Installation
1. **Clone the repository or copy the project:**
```bash
git https://git.mortons.site/verint.com/iva-studio-workspace.git
cd iva-studio-workspace/electron-spa-app
npm install
```
## 🛠️ Configuration
Edit the .env file in the root of the project to customize the app settings:
```bash
APP_TITLE=My Electron SPA
WIDTH=1024
HEIGHT=768
PROXY_ENDPOINT=https://router.ivastudio.verint.live/ProxyScript/run/67bca862210071627d32ef12/current/fullscreen_messenger
```
- APP_TITLE Title shown in the window
- WIDTH, HEIGHT Initial window size
- PROXY_ENDPOINT URL to your Proxy Endpoint
## 🚀 Run the App
To start the Electron application:
```bash
npm start
```
This will launch the desktop window and load your SPA.

View File

@ -0,0 +1,35 @@
req.query.subChannel = req.query.channel === "Root.Mobile.Android" ? "MAPP:GOOGLE" : "MAPP:APPLE";
req.query.channel = req.query.channel === "Root.Mobile.Android" ? "MAPP:GOOGLE" : "MAPP:APPLE";
req.query.isMapp = true;
const isQAP = req.query.qap === 'true';
console.log(`isQAP: ${isQAP}`);
res.send(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no">
<script>
window.trackingJson = ${JSON.stringify(req.query || {})};
window.ivasMessengerSettings = {
token: "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ3b3Jrc3BhY2VJZCI6IjY3YmNhODYyMjEwMDcxNjI3ZDMyZWYxMiIsImlhdCI6MTc0MDQxNzEyMn0.L_gLTj-ekDYs9SU6Jsehu9F-iKa5JAjAJEjpGkuXIbzNCdie2j63oPH0Ca9w5a4SIZ7AgFTDVO-1XPyAvCUaNNAHuFetnCSGScCl7K17cKlLJtn1tKA1E4jTd_Unz6wsbT21HV5mkBOBqOtGF2sqUuPLOe-ctY44zC6Yq44rNQZ5WJCJUu_7urT_6nyIVJxONDnWvIQH3vletseBrFod8flZTcQ9tlkcjqzc78y2FzO3c4xhJ9AHiRJ63tgaKm8oi8jZMXbp7d35tycNzRjk9Q4aONKdG8ciFwzjlIHGKMtI_C8x0xZH5sHIwJhGb6NJV69aX89ghdanzuDZpAfORg",
domain: "https://messenger.ivastudio.verint.live",
fullscreen: true,
port: "443",
branch: "current",
onError: (error) => console.error("Something went wrong with the websockets for IVA Messenger", error)
};
${isQAP && `window.ivasMessengerSettings.branch = 'current';`}
!(function () {
function t() {
var t = document.createElement("script");
(t.type = "text/javascript"), (t.async = !0), (t.src = "https://messenger.ivastudio.verint.live" + ":" + "443" + "/loader");
var e = document.getElementsByTagName("script")[0];
e.parentNode.insertBefore(t, e);
}
window.attachEvent ? window.attachEvent("onload", t) : window.addEventListener("load", t, !1);
})();
</script></head><body></body></html>`);

View File

@ -0,0 +1,48 @@
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
{
name: '@electron-forge/maker-dmg',
config: {},
}
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
};

6410
iva_electron/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

30
iva_electron/package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "Verint Copilot",
"version": "1.0.0",
"main": "src/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"dotenv": "^17.2.1",
"electron-squirrel-startup": "^1.0.1"
},
"devDependencies": {
"@electron-forge/cli": "^7.8.3",
"@electron-forge/maker-deb": "^7.8.3",
"@electron-forge/maker-dmg": "^7.8.3",
"@electron-forge/maker-rpm": "^7.8.3",
"@electron-forge/maker-squirrel": "^7.8.3",
"@electron-forge/maker-zip": "^7.8.3",
"@electron-forge/plugin-auto-unpack-natives": "^7.8.3",
"@electron-forge/plugin-fuses": "^7.8.3",
"@electron/fuses": "^1.8.0",
"electron": "^37.2.6"
}
}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Verint Copilot</title>
</head>
<body>
<h1>If you are seeing this page there is an error in your .env</h1>
</body>
</html>

36
iva_electron/src/main.js Normal file
View File

@ -0,0 +1,36 @@
const { app, BrowserWindow } = require('electron');
const path = require('path');
const fs = require('fs');
require('dotenv').config({ debug: true, path: path.resolve(__dirname, '..', '.env') });
function createWindow() {
const width = parseInt(process.env.WIDTH) || 800;
const height = parseInt(process.env.HEIGHT) || 600;
const appTitle = process.env.APP_TITLE || 'Electron App';
const proxyEndpoint = process.env.PROXY_ENDPOINT || 'public/index.html';
const mainWindow = new BrowserWindow({
width,
height,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
},
title: appTitle
});
mainWindow.webContents.loadURL(proxyEndpoint);
}
app.whenReady().then(() => {
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});