diff --git a/README.md b/README.md index 2d5b583..7b62cbc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,45 @@ -# io.Connect Desktop Tutorials - -Source code for the JavaScript tutorial for developing an **io.Connect Desktop** project. - -For a guide on using the tutorial code, see the [Tutorials](https://docs.interop.io/desktop/tutorials/javascript/index.html) section of the official **io.Connect Desktop** documentation. - +# io.Connect Desktop Tutorials + +Source code for the JavaScript and TypeScript tutorials for developing an **io.Connect Desktop** project. + +For a guide on using the tutorial code, see the [Tutorials](https://docs.interop.io/desktop/tutorials/javascript/index.html) section of the official **io.Connect Desktop** documentation. + +## JavaScript Version + +The JavaScript tutorial is located in the `javascript` directory. It contains both starter code and the complete solution. + +## TypeScript Version + +The TypeScript tutorial is located in the `typescript` directory. It mirrors the JavaScript version but with TypeScript support. Both starter code and solution are provided. + +### Building TypeScript Projects + +1. Navigate to either the `typescript/solution` or `typescript/start` directory: + +```bash +cd typescript/solution +# or +cd typescript/start +``` + +2. Install dependencies: + +```bash +npm install +``` + +3. Build all applications: + +```bash +npm run build +``` + +4. Start the applications: + +```bash +npm start +``` + +You can also build and start individual applications using the specific build and start scripts. See the package.json for available commands. + > ⚠️ *Note that this tutorial is for a licensed product.* \ No newline at end of file diff --git a/typescript/package.json b/typescript/package.json new file mode 100644 index 0000000..31b9e14 --- /dev/null +++ b/typescript/package.json @@ -0,0 +1,14 @@ +{ + "name": "ts-tutorial", + "version": "1.0.0", + "description": "io.Connect Desktop TypeScript Tutorial", + "scripts": { + "install:all": "cd solution && npm install && cd ../start && npm install", + "build:solution": "cd solution && npm run build", + "build:start": "cd start && npm run build", + "build": "npm run build:solution && npm run build:start" + }, + "devDependencies": { + "typescript": "^5.3.3" + } +} \ No newline at end of file diff --git a/typescript/solution/app-definitions/client-details.json b/typescript/solution/app-definitions/client-details.json new file mode 100644 index 0000000..d27d5ee --- /dev/null +++ b/typescript/solution/app-definitions/client-details.json @@ -0,0 +1,12 @@ +{ + "name": "client-details", + "title": "Client Details", + "type": "window", + "details": { + "url": "http://localhost:9200/" + }, + "customProperties": { + "folder": "Asset Management", + "includeInWorkspaces": true + } +} \ No newline at end of file diff --git a/typescript/solution/app-definitions/clients.json b/typescript/solution/app-definitions/clients.json new file mode 100644 index 0000000..eeb39e0 --- /dev/null +++ b/typescript/solution/app-definitions/clients.json @@ -0,0 +1,17 @@ +{ + "name": "clients", + "title": "Clients", + "type": "window", + "details": { + "url": "http://localhost:9000/", + "minWidth": 400, + "minHeight": 400, + "channelSelector": { + "enabled": false + } + }, + "customProperties": { + "folder": "Asset Management", + "includeInWorkspaces": true + } +} \ No newline at end of file diff --git a/typescript/solution/app-definitions/portfolio-downloader.json b/typescript/solution/app-definitions/portfolio-downloader.json new file mode 100644 index 0000000..3f83352 --- /dev/null +++ b/typescript/solution/app-definitions/portfolio-downloader.json @@ -0,0 +1,20 @@ +{ + "name": "portfolio-downloader", + "title": "Portfolio Downloader", + "type": "window", + "details": { + "url": "http://localhost:9300/" + }, + "intents": [ + { + "name": "ExportPortfolio", + "displayName": "Download Portfolio", + "contexts": [ + "ClientPortfolio" + ] + } + ], + "customProperties": { + "folder": "Asset Management" + } +} \ No newline at end of file diff --git a/typescript/solution/app-definitions/stocks.json b/typescript/solution/app-definitions/stocks.json new file mode 100644 index 0000000..7d9ff6f --- /dev/null +++ b/typescript/solution/app-definitions/stocks.json @@ -0,0 +1,33 @@ +[ + { + "name": "stocks", + "title": "Stocks", + "type": "window", + "ignoreSavedLayout": true, + "details": { + "url": "http://localhost:9100/", + "width": 500, + "height": 450, + "minWidth": 450, + "minHeight": 400, + "channelSelector": { + "enabled": false + } + }, + "customProperties": { + "folder": "Asset Management", + "includeInWorkspaces": true + } + }, + { + "name": "stock-details", + "title": "Stock Details", + "type": "window", + "details": { + "url": "http://localhost:9100/details" + }, + "customProperties": { + "folder": "Asset Management" + } + } +] \ No newline at end of file diff --git a/typescript/solution/client-details/esbuild.js b/typescript/solution/client-details/esbuild.js new file mode 100644 index 0000000..27c80dc --- /dev/null +++ b/typescript/solution/client-details/esbuild.js @@ -0,0 +1,48 @@ +const fs = require('fs'); +const path = require('path'); +const { build } = require('esbuild'); + +// Directory paths +const srcDir = path.join(__dirname, 'src'); +const distDir = path.join(__dirname, 'dist'); + +// Ensure dist directory exists +if (!fs.existsSync(distDir)) { + fs.mkdirSync(distDir, { recursive: true }); +} + +// Copy HTML file +fs.copyFileSync( + path.join(srcDir, 'index.html'), + path.join(distDir, 'index.html') +); + +// Copy lib directory +const libSrcDir = path.join(srcDir, 'lib'); +const libDistDir = path.join(distDir, 'lib'); + +if (!fs.existsSync(libDistDir)) { + fs.mkdirSync(libDistDir, { recursive: true }); +} + +fs.readdirSync(libSrcDir).forEach(file => { + fs.copyFileSync( + path.join(libSrcDir, file), + path.join(libDistDir, file) + ); +}); + +// Build with esbuild +build({ + entryPoints: [path.join(srcDir, 'index.ts')], + bundle: true, + outfile: path.join(distDir, 'index.js'), + platform: 'browser', + format: 'iife', + sourcemap: true, + target: ['es2020'], + tsconfig: path.join(__dirname, 'tsconfig.json'), +}).catch((error) => { + console.error(error); + process.exit(1); +}); \ No newline at end of file diff --git a/typescript/solution/client-details/src/index.html b/typescript/solution/client-details/src/index.html new file mode 100644 index 0000000..c917d85 --- /dev/null +++ b/typescript/solution/client-details/src/index.html @@ -0,0 +1,72 @@ + + + + + +
+ + + + + +| Detail | +Value | +
|---|---|
| Full Name | ++ |
| Address | ++ |
| Phone Number | ++ |
| + | |
| Account Manager | ++ |
| Full Name | +PID | +GID | +Account Manager | +
|---|
| Symbol | +Description | +Bid | +Ask | +
|---|
| Detail | +Value | +
|---|---|
| Full Name | ++ |
| Address | ++ |
| Phone Number | ++ |
| + | |
| Account Manager | ++ |
| Full Name | +PID | +GID | +Account Manager | +
|---|
| Symbol | +Description | +Bid | +Ask | +
|---|