@stackone/hub 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/index.d.ts +19 -0
  2. package/dist/index.esm.js +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/webcomponent.js +11 -0
  5. package/dist/webcomponent.js.map +1 -0
  6. package/package.json +17 -4
  7. package/.github/workflows/node-ci.yml +0 -20
  8. package/.github/workflows/release-please.yml +0 -37
  9. package/.github/workflows/semantic-pull-request.yml +0 -31
  10. package/.nvmrc +0 -1
  11. package/.release-please-manifest.json +0 -1
  12. package/CHANGELOG.md +0 -50
  13. package/biome.json +0 -77
  14. package/dev/index.html +0 -11
  15. package/dev/main.css +0 -80
  16. package/dev/main.tsx +0 -98
  17. package/dev/vite-env.d.ts +0 -15
  18. package/index.html +0 -14
  19. package/release-please-config.json +0 -5
  20. package/rollup.config.mjs +0 -72
  21. package/src/Hub.tsx +0 -50
  22. package/src/StackOneHub.tsx +0 -138
  23. package/src/WebComponentWrapper.tsx +0 -14
  24. package/src/index.ts +0 -1
  25. package/src/modules/csv-importer.tsx/CsvImporter.tsx +0 -35
  26. package/src/modules/integration-picker/IntegrationPicker.tsx +0 -97
  27. package/src/modules/integration-picker/components/IntegrationFields.tsx +0 -129
  28. package/src/modules/integration-picker/components/IntegrationList.tsx +0 -71
  29. package/src/modules/integration-picker/components/IntegrationPickerContent.tsx +0 -107
  30. package/src/modules/integration-picker/components/cardFooter.tsx +0 -88
  31. package/src/modules/integration-picker/components/cardTitle.tsx +0 -53
  32. package/src/modules/integration-picker/components/views/ErrorView.tsx +0 -9
  33. package/src/modules/integration-picker/components/views/IntegrationFormView.tsx +0 -22
  34. package/src/modules/integration-picker/components/views/IntegrationListView.tsx +0 -19
  35. package/src/modules/integration-picker/components/views/LoadingView.tsx +0 -11
  36. package/src/modules/integration-picker/components/views/SuccessView.tsx +0 -10
  37. package/src/modules/integration-picker/components/views/index.ts +0 -5
  38. package/src/modules/integration-picker/hooks/useIntegrationPicker.ts +0 -394
  39. package/src/modules/integration-picker/queries.ts +0 -78
  40. package/src/modules/integration-picker/types.ts +0 -70
  41. package/src/shared/categories.ts +0 -55
  42. package/src/shared/components/error.tsx +0 -32
  43. package/src/shared/components/errorBoundary.tsx +0 -31
  44. package/src/shared/components/loading.tsx +0 -30
  45. package/src/shared/components/success.tsx +0 -40
  46. package/src/shared/contexts/featureFlagContext.tsx +0 -26
  47. package/src/shared/hooks/useFeatureFlags.ts +0 -24
  48. package/src/shared/httpClient.ts +0 -79
  49. package/src/shared/queries.ts +0 -12
  50. package/src/shared/types/featureFlags.ts +0 -1
  51. package/src/types/types.ts +0 -1
  52. package/tsconfig.json +0 -19
  53. package/vite.config.ts +0 -11
package/package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "name": "@stackone/hub",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "StackOne HUB",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./webcomponent": "./dist/webcomponent.js"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
6
19
  "scripts": {
7
20
  "test": "echo \"Error: no test specified\" && exit 1",
8
21
  "build": "rollup -c",
@@ -17,7 +30,7 @@
17
30
  "license": "MIT",
18
31
  "dependencies": {
19
32
  "@stackone/expressions": "^0.16.0",
20
- "@stackone/malachite": "^0.3.1",
33
+ "@stackone/malachite": "^0.5.0",
21
34
  "@tanstack/react-query": "^5.77.2"
22
35
  },
23
36
  "peerDependencies": {
@@ -45,4 +58,4 @@
45
58
  "tslib": "^2.8.1",
46
59
  "typescript": "^5.8.3"
47
60
  }
48
- }
61
+ }
@@ -1,20 +0,0 @@
1
- name: Node.js CI
2
-
3
- on: [pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v4
10
- - name: Use Node.js
11
- uses: actions/setup-node@v4
12
- with:
13
- node-version: '22.14.x'
14
- cache: 'npm'
15
- - name: Install dependencies
16
- run: npm ci
17
- - name: Build
18
- run: npm run build
19
- - name: Lint
20
- run: npm run lint
@@ -1,37 +0,0 @@
1
- on:
2
- push:
3
- branches:
4
- - main
5
-
6
- name: release-please
7
- jobs:
8
- release-please:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: googleapis/release-please-action@v4
12
- id: release
13
- with:
14
- token: ${{ secrets.REPO_GH_PAT }}
15
- config-file: release-please-config.json
16
- manifest-file: .release-please-manifest.json
17
-
18
- - name: Checkout Repository
19
- uses: actions/checkout@v4
20
- if: steps.release.outputs.paths_released != '[]'
21
- - name: Setup Node
22
- uses: actions/setup-node@v4
23
- if: steps.release.outputs.paths_released != '[]'
24
- with:
25
- node-version: '22.14.x'
26
- registry-url: 'https://registry.npmjs.org'
27
- - name: Build
28
- if: steps.release.outputs.paths_released != '[]'
29
- run: |
30
- npm install
31
- npm run build
32
- - name: Publish
33
- if: steps.release.outputs.paths_released != '[]'
34
- run: |
35
- npm run publish-release
36
- env:
37
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,31 +0,0 @@
1
- name: "Check PR title"
2
-
3
- on:
4
- pull_request_target:
5
- types:
6
- - opened
7
- - reopened
8
- - edited
9
- - synchronize
10
-
11
- permissions:
12
- pull-requests: read
13
-
14
- jobs:
15
- main:
16
- name: Validate PR title
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: amannn/action-semantic-pull-request@v5
20
- env:
21
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22
- with:
23
- scopes: |
24
- ENG-\d+
25
- deps
26
- deps-dev
27
- workflow
28
- requireScope: false
29
- ignoreLabels: |
30
- autorelease: pending
31
- dependencies
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- v22.14.0
@@ -1 +0,0 @@
1
- {".":"0.2.0"}
package/CHANGELOG.md DELETED
@@ -1,50 +0,0 @@
1
- # Changelog
2
-
3
- ## [0.2.0](https://github.com/StackOneHQ/hub/compare/hub-v0.1.0...hub-v0.2.0) (2025-08-08)
4
-
5
-
6
- ### Features
7
-
8
- * add external trigger token rendering ([f1c0ea2](https://github.com/StackOneHQ/hub/commit/f1c0ea22496b4b0bd92a33d69e4af5492b96089c))
9
- * expression and conditional rendering ([1762d3a](https://github.com/StackOneHQ/hub/commit/1762d3aad03fccc55a606bb5e154b85e8289f000))
10
- * feature flag context and hook ([a9d00a9](https://github.com/StackOneHQ/hub/commit/a9d00a9e81f3276c82f5e98c26e0b5648a4ad0cd))
11
- * render dropdowns and textareas with malachite ([9e59a0d](https://github.com/StackOneHQ/hub/commit/9e59a0d864af6c06cc7b653ff393291877895812))
12
-
13
-
14
- ### Bug Fixes
15
-
16
- * add border to dropdown ([2fb57e1](https://github.com/StackOneHQ/hub/commit/2fb57e139be16e646d3404bd5e13fd010cae8e67))
17
- * add theme support again ([76a092b](https://github.com/StackOneHQ/hub/commit/76a092b3625ac850af9b3256569337cacd92da52))
18
- * build ([1eb7894](https://github.com/StackOneHQ/hub/commit/1eb78945d7274349cb4572bac79ecd3e0929a57a))
19
- * handle window close event ([617d999](https://github.com/StackOneHQ/hub/commit/617d9992c03496dab0b5e7bdba149b0f78314aee))
20
- * input loop and card style ([a91e72a](https://github.com/StackOneHQ/hub/commit/a91e72a253a0da529712867e27192a397ed89ddf))
21
- * key uniqueness ([c3d01c5](https://github.com/StackOneHQ/hub/commit/c3d01c513fd6d4b0e8526c6741b2ae2272ef2f0a))
22
-
23
- ## [0.1.0](https://github.com/StackOneHQ/hub/compare/hub-v0.0.1...hub-v0.1.0) (2025-07-11)
24
-
25
-
26
- ### Features
27
-
28
- * account editing flow ([0cf3a54](https://github.com/StackOneHQ/hub/commit/0cf3a545d5b85d5422f02e4a0b990239979066c4))
29
- * add error boundary ([2f5e457](https://github.com/StackOneHQ/hub/commit/2f5e457743674307bf201606c136109c3bba6ff8))
30
- * add events ([0ac44e3](https://github.com/StackOneHQ/hub/commit/0ac44e39bc1a30c3897838ee4fa82a62fe1ed5d8))
31
- * add hub modes ([d74c6f7](https://github.com/StackOneHQ/hub/commit/d74c6f78ac597842034e52022ae958331bc15a28))
32
- * add suppor for new props in webcomponent ([cd718d8](https://github.com/StackOneHQ/hub/commit/cd718d8392feb47180d38846f426f87e16240e69))
33
- * back to antd ([6921d6d](https://github.com/StackOneHQ/hub/commit/6921d6dacec9f692e4145e061f7b5a51dabefe89))
34
- * error handling and better rendering ([2aec2a3](https://github.com/StackOneHQ/hub/commit/2aec2a3e75b53ac0b814eee63eac73c2169befba))
35
- * fetch integration list ([50d3226](https://github.com/StackOneHQ/hub/commit/50d3226435e84f8e000decaed52ce3fdb728e481))
36
- * handle expired tokens ([2dc60c8](https://github.com/StackOneHQ/hub/commit/2dc60c857b9612f886193a5efb748ab2b2cc56ed))
37
- * initialise repo with react and webcomponent build ([1e719ae](https://github.com/StackOneHQ/hub/commit/1e719aef846582699d01a06e01c5a3c2e4e8ed91))
38
- * loading states ([21e1ad5](https://github.com/StackOneHQ/hub/commit/21e1ad5e0f8f91ff75e90a9a01e385ddb3cf854a))
39
- * more design updates ([0293dfe](https://github.com/StackOneHQ/hub/commit/0293dfe92a8decfbe263c87aa274b811b7c5710b))
40
- * react query and better components ([ce2d084](https://github.com/StackOneHQ/hub/commit/ce2d08477d02c92da1fb4f5d2fa05bdbe286371b))
41
- * rudimentary account linking ([56a27a4](https://github.com/StackOneHQ/hub/commit/56a27a440992751a584de2c7fb3a4c7adf946190))
42
- * use malachite components locally ([b362c65](https://github.com/StackOneHQ/hub/commit/b362c657aed377cf4b5913e3ebe3794cea8498eb))
43
-
44
-
45
- ### Bug Fixes
46
-
47
- * hub form ([d4c9898](https://github.com/StackOneHQ/hub/commit/d4c989810ce25ea79368f22f0cfd5df8140abec2))
48
- * lint ([110eb98](https://github.com/StackOneHQ/hub/commit/110eb98e5ab6442b6c1000a2f72c07a84b3e1512))
49
- * release please ([e11cd2c](https://github.com/StackOneHQ/hub/commit/e11cd2c8f1f5ba1c2bcbbc661b9a3f3fd0866e10))
50
- * release please and package dependency ([d2a57bc](https://github.com/StackOneHQ/hub/commit/d2a57bcc7db27c7b4348db253d816141ccc99d03))
package/biome.json DELETED
@@ -1,77 +0,0 @@
1
- {
2
- "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3
- "vcs": {
4
- "enabled": false,
5
- "clientKind": "git",
6
- "useIgnoreFile": false
7
- },
8
- "files": {
9
- "ignoreUnknown": false,
10
- "ignore": ["**/node_modules/**", "**/dist/**"]
11
- },
12
- "formatter": {
13
- "enabled": true,
14
- "useEditorconfig": true,
15
- "formatWithErrors": false,
16
- "indentStyle": "space",
17
- "indentWidth": 4,
18
- "lineEnding": "lf",
19
- "lineWidth": 100,
20
- "attributePosition": "auto",
21
- "bracketSpacing": false
22
- },
23
- "organizeImports": {
24
- "enabled": true
25
- },
26
- "linter": {
27
- "enabled": true,
28
- "rules": {
29
- "recommended": false,
30
- "complexity": {
31
- "noBannedTypes": "error",
32
- "noUselessThisAlias": "error",
33
- "noUselessTypeConstraint": "error",
34
- "useArrowFunction": "off"
35
- },
36
- "correctness": {
37
- "noConstAssign": "error",
38
- "noPrecisionLoss": "error",
39
- "noUnusedVariables": "warn",
40
- "useArrayLiterals": "off",
41
- "useExhaustiveDependencies": "warn",
42
- "useHookAtTopLevel": "error"
43
- },
44
- "style": {
45
- "noInferrableTypes": "error",
46
- "noNamespace": "error",
47
- "noNonNullAssertion": "warn",
48
- "useAsConstAssertion": "error",
49
- "useBlockStatements": "off"
50
- },
51
- "suspicious": {
52
- "noEmptyBlockStatements": "error",
53
- "noEmptyInterface": "error",
54
- "noExplicitAny": "error",
55
- "noExtraNonNullAssertion": "error",
56
- "noMisleadingInstantiator": "error",
57
- "useNamespaceKeyword": "error"
58
- },
59
- "nursery": {
60
- "useComponentExportOnlyModules": "off"
61
- }
62
- }
63
- },
64
- "javascript": {
65
- "formatter": {
66
- "jsxQuoteStyle": "double",
67
- "quoteProperties": "asNeeded",
68
- "trailingCommas": "all",
69
- "semicolons": "always",
70
- "arrowParentheses": "always",
71
- "bracketSameLine": false,
72
- "quoteStyle": "single",
73
- "attributePosition": "auto",
74
- "bracketSpacing": true
75
- }
76
- }
77
- }
package/dev/index.html DELETED
@@ -1,11 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Dev Preview</title>
6
- </head>
7
- <body>
8
- <div id="root"></div>
9
- <script type="module" src="main.tsx"></script>
10
- </body>
11
- </html>
package/dev/main.css DELETED
@@ -1,80 +0,0 @@
1
- body {
2
- font-family: "Segoe UI", Arial, sans-serif;
3
- background: #fafbfc;
4
- margin: 0;
5
- padding: 0;
6
- }
7
-
8
- .hub-container {
9
- max-width: 600px;
10
- margin: 40px auto;
11
- background: #fff;
12
- border-radius: 12px;
13
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
14
- padding: 32px 40px 40px 40px;
15
- }
16
-
17
- h1 {
18
- font-size: 2.6rem;
19
- margin-top: 32px;
20
- margin-bottom: 24px;
21
- font-weight: 700;
22
- letter-spacing: -1px;
23
- }
24
-
25
- p {
26
- font-size: 1.1rem;
27
- margin-bottom: 12px;
28
- }
29
-
30
- .token-display {
31
- word-break: break-all;
32
- background: #f4f6f8;
33
- border-radius: 6px;
34
- padding: 8px 12px;
35
- font-family: "Fira Mono", monospace;
36
- font-size: 0.98rem;
37
- margin-bottom: 18px;
38
- }
39
-
40
- .button-row {
41
- display: flex;
42
- gap: 12px;
43
- margin-bottom: 28px;
44
- }
45
-
46
- button {
47
- background: #2d72d9;
48
- color: #fff;
49
- border: none;
50
- border-radius: 5px;
51
- padding: 8px 18px;
52
- font-size: 1rem;
53
- cursor: pointer;
54
- transition: background 0.18s;
55
- }
56
- button:hover {
57
- background: #1b4e91;
58
- }
59
-
60
- @media (max-width: 600px) {
61
- .hub-container {
62
- padding: 16px 6px;
63
- }
64
- h1 {
65
- font-size: 2rem;
66
- }
67
- }
68
-
69
- .hub-container.dark {
70
- background: #121212;
71
- color: #fff;
72
- .token-display {
73
- background: #333;
74
- color: #fff;
75
- }
76
- }
77
-
78
- body {
79
- background: goldenrod;
80
- }
package/dev/main.tsx DELETED
@@ -1,98 +0,0 @@
1
- import './main.css';
2
- import React, { useCallback, useEffect, useState } from 'react';
3
- import ReactDOM from 'react-dom/client';
4
- import { StackOneHub } from '../src/StackOneHub';
5
- import { request } from '../src/shared/httpClient';
6
- import { HubModes } from '../src/types/types';
7
-
8
- const HubWrapper: React.FC = () => {
9
- const [mode, setMode] = useState<HubModes | undefined>(undefined);
10
- const [loading, setLoading] = useState<boolean>(false);
11
- const [error, setError] = useState<string>();
12
- const [token, setToken] = useState<string>();
13
- const apiUrl = import.meta.env.VITE_API_URL ?? 'https://api.stackone.com';
14
- const appUrl = import.meta.env.VITE_APP_URL ?? 'https://app.stackone.com';
15
- const [theme, setTheme] = useState<'light' | 'dark'>('light');
16
- const [accountId, setAccountId] = useState<string>();
17
-
18
- const fetchToken = useCallback(async () => {
19
- try {
20
- setLoading(true);
21
- const apiKey = import.meta.env.VITE_STACKONE_API_KEY;
22
- const encodedApiKey = btoa(apiKey ?? '');
23
-
24
- const response = await request<{ token: string }>({
25
- url: `${apiUrl}/connect_sessions`,
26
- method: 'POST',
27
- headers: {
28
- 'Content-Type': 'application/json',
29
- Authorization: `Basic ${encodedApiKey}`,
30
- },
31
- body: {
32
- metadata: { source: 'hub' },
33
- origin_owner_id: import.meta.env.VITE_ORIGIN_OWNER_ID ?? 'dummy_customer_id',
34
- origin_owner_name:
35
- import.meta.env.VITE_ORIGIN_OWNER_NAME ?? 'dummy_customer_name',
36
- origin_username: import.meta.env.VITE_ORIGIN_USERNAME ?? 'dummy_username',
37
- account_id: accountId !== '' && accountId != null ? accountId : undefined,
38
- },
39
- });
40
- if (!response) {
41
- throw new Error('Failed to fetch token');
42
- }
43
-
44
- setToken(response.token);
45
- } catch (error) {
46
- console.error('Error fetching token:', error);
47
- setError(error.message as string);
48
- } finally {
49
- setLoading(false);
50
- }
51
- }, [accountId]);
52
-
53
- useEffect(() => {
54
- fetchToken();
55
- }, [fetchToken]);
56
-
57
- return (
58
- <div className={`hub-container ${theme}`}>
59
- {loading && <p> Loading token...</p>}
60
- {error && <p>Error loading token: {error}</p>}
61
- {token && <p className="token-display">Token: {token}</p>}
62
- <p>Current mode: {mode || 'No mode selected'}</p>
63
- <div className="button-row">
64
- <button onClick={fetchToken}>Get new token</button>
65
- <button onClick={() => setMode('integration-picker')}>
66
- Set Integration Picker mode
67
- </button>
68
- <button onClick={() => setMode('csv-importer')}>Set CSV Importer mode</button>
69
- <button onClick={() => setTheme((theme) => (theme === 'light' ? 'dark' : 'light'))}>
70
- {theme === 'light' ? '🌞' : '🌚'}
71
- </button>
72
- </div>
73
- <input type="text" value={accountId} onChange={(e) => setAccountId(e.target.value)} />
74
- <h1>StackOneHub Demo</h1>
75
- <StackOneHub
76
- mode={mode}
77
- token={token}
78
- baseUrl={apiUrl}
79
- theme={theme}
80
- onSuccess={() => {
81
- console.log('success');
82
- setMode(undefined);
83
- }}
84
- accountId={accountId}
85
- appUrl={appUrl}
86
- />
87
- </div>
88
- );
89
- };
90
-
91
- const rootElement = document.getElementById('root');
92
- if (rootElement) {
93
- ReactDOM.createRoot(rootElement).render(
94
- <React.StrictMode>
95
- <HubWrapper />
96
- </React.StrictMode>,
97
- );
98
- }
package/dev/vite-env.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_APP_TITLE: string;
5
- readonly VITE_STACKONE_API_KEY: string;
6
- readonly VITE_ORIGIN_OWNER_ID: string;
7
- readonly VITE_ORIGIN_OWNER_NAME: string;
8
- readonly VITE_ORIGIN_USERNAME: string;
9
- readonly VITE_API_URL: string;
10
- readonly VITE_APP_URL: string;
11
- }
12
-
13
- export interface ImportMeta {
14
- readonly env: ImportMetaEnv;
15
- }
package/index.html DELETED
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <script src="dist/webcomponent/StackOneHub.web.js"></script>
5
- </head>
6
- <body>
7
- <!-- Add a -->
8
- <stackone-hub
9
- token="eyJyZWdpb25fc2x1ZyI6ImV1IiwidG9rZW4iOiJzclgzU0xUemttcmpWQWQtWTdNZXFUTUh3OV9KaVdNRFk3M3RaenRwdVZIVV9EZERmQU14NGF3X3hWb09wdXZuRkQ1OW11WlJjZlZBRDRQMUxRcmVRdyJ9"
10
- base-url="http://localhost:4000"
11
- mode="integration-picker"
12
- ></stackone-hub>
13
- </body>
14
- </html>
@@ -1,5 +0,0 @@
1
- {
2
- "packages": {
3
- ".": {}
4
- }
5
- }
package/rollup.config.mjs DELETED
@@ -1,72 +0,0 @@
1
- import commonjs from "@rollup/plugin-commonjs";
2
- import resolve from "@rollup/plugin-node-resolve";
3
- import replace from "@rollup/plugin-replace";
4
- import terser from "@rollup/plugin-terser";
5
- import typescript from "@rollup/plugin-typescript";
6
- import del from "rollup-plugin-delete";
7
- import dts from "rollup-plugin-dts";
8
- import external from "rollup-plugin-peer-deps-external";
9
- import postcss from "rollup-plugin-postcss";
10
-
11
- export default [
12
- // React Component Bundle (external React)
13
- {
14
- input: "src/index.ts",
15
- output: [
16
- {
17
- file: "dist/react/StackOneHub.esm.js",
18
- format: "esm",
19
- },
20
- {
21
- file: "dist/react/StackOneHub.cjs.js",
22
- format: "cjs",
23
- },
24
- ],
25
- plugins: [
26
- del({ targets: "dist/react/*" }),
27
- external(),
28
- resolve(),
29
- commonjs(),
30
- typescript({ tsconfig: "./tsconfig.json" }),
31
- postcss(),
32
- terser(),
33
- replace({
34
- preventAssignment: true,
35
- "process.env.NODE_ENV": JSON.stringify("production"),
36
- }),
37
- ],
38
- },
39
-
40
- // Web Component Bundle (bundled React)
41
- {
42
- input: "src/WebComponentWrapper.tsx",
43
- output: {
44
- file: "dist/webcomponent/StackOneHub.web.js",
45
- format: "iife",
46
- name: "StackOneHubWebComponent",
47
- sourcemap: true,
48
- },
49
- plugins: [
50
- del({ targets: "dist/webcomponent/*" }), // Clean the dist folder before each build
51
- resolve(),
52
- commonjs(),
53
- typescript({ tsconfig: "./tsconfig.json" }),
54
- postcss(),
55
- terser(),
56
- replace({
57
- preventAssignment: true,
58
- "process.env.NODE_ENV": JSON.stringify("production"),
59
- }),
60
- ],
61
- },
62
-
63
- // Declaration file bundle
64
- {
65
- input: "src/index.ts",
66
- output: {
67
- file: "dist/index.d.ts",
68
- format: "es",
69
- },
70
- plugins: [del({ targets: "dist/index.d.ts" }), dts()],
71
- },
72
- ];
package/src/Hub.tsx DELETED
@@ -1,50 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query';
2
- import { IntegrationPicker } from './modules/integration-picker/IntegrationPicker';
3
- import { FeatureFlagProvider } from './shared/contexts/featureFlagContext';
4
- import { getSettings } from './shared/queries';
5
- import { HubModes } from './types/types';
6
-
7
- interface HubProps {
8
- mode: HubModes;
9
- token: string;
10
- apiUrl: string;
11
- dashboardUrl: string;
12
- height: string;
13
- onSuccess?: () => void;
14
- onClose?: () => void;
15
- onCancel?: () => void;
16
- accountId?: string;
17
- }
18
- export const Hub = ({
19
- mode,
20
- token,
21
- apiUrl,
22
- dashboardUrl,
23
- height,
24
- onSuccess,
25
- onClose,
26
- onCancel,
27
- accountId,
28
- }: HubProps) => {
29
- const { data: settings } = useQuery({
30
- queryKey: ['settings'],
31
- queryFn: () => getSettings(apiUrl, token),
32
- });
33
-
34
- return (
35
- <FeatureFlagProvider featureFlags={settings?.enabled_features ?? []}>
36
- {mode === 'integration-picker' && (
37
- <IntegrationPicker
38
- token={token}
39
- baseUrl={apiUrl}
40
- dashboardUrl={dashboardUrl}
41
- height={height}
42
- onSuccess={onSuccess}
43
- onClose={onClose}
44
- onCancel={onCancel}
45
- accountId={accountId}
46
- />
47
- )}
48
- </FeatureFlagProvider>
49
- );
50
- };