diff --git a/.env.github.example b/.env.github.example index 29992e869..01a2cf9c0 100644 --- a/.env.github.example +++ b/.env.github.example @@ -23,3 +23,14 @@ IL_ENABLE_DEV_MODE=true #Enable this option if you want to enable UI features th NEXT_PUBLIC_EXPERIMENTAL_FEATURES=false SLACK_WEBHOOK_URL= + +# Analtyics setup vvv verbose is default +# ANALYTICS_VERBOSE=true +# ANALYTICS_PROVIDERS=Umami,Segment + +# UMAMI_KEY: 'umami-key' +# UMAMI_HOST_URL: 'http://umami-host:3000' +# SEGMENT_KEY: 'segment-key' +# Next needs to be in one line +# SEGMENT_INTEGRATIONS: '{"Segment.io": {"apiHost": "some.host.com/connections/api/v1","protocol": "https"}}' +# SEGMENT_CDN: 'https://some.host.com/connections/cdn' diff --git a/.env.native.example b/.env.native.example index ce65e6867..e9b6ab563 100644 --- a/.env.native.example +++ b/.env.native.example @@ -15,3 +15,15 @@ NEXT_PUBLIC_EXPERIMENTAL_FEATURES=false # IL_FILE_CONVERSION_SERVICE=http://localhost:5001 # Uncomment and fill in the http://host:port if the docling conversion service is running. # NEXT_PUBLIC_API_SERVER=http://localhost:8080 # Uncomment and point to the URL the api-server is running on. Native mode only and needs to be running on the same host as the UI. # NEXT_PUBLIC_MODEL_SERVER_URL=http://x.x.x.x # Used for model chat evaluation vLLM instances. Currently, server side rendering is not supported so the client must have access to this address for model chat evaluation to function in the UI. Currently ports, 8000 & 8001 are hardcoded and why it is not an option to set. + + +# Analtyics setup vvv verbose is default +# ANALYTICS_VERBOSE=true +# ANALYTICS_PROVIDERS=Umami,Segment + +# UMAMI_KEY: 'umami-key' +# UMAMI_HOST_URL: 'http://umami-host:3000' +# SEGMENT_KEY: 'segment-key' +# Next needs to be in one line +# SEGMENT_INTEGRATIONS: '{"Segment.io": {"apiHost": "some.host.com/connections/api/v1","protocol": "https"}}' +# SEGMENT_CDN: 'https://some.host.com/connections/cdn' diff --git a/package-lock.json b/package-lock.json index 96acaba59..7fe9068b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,12 +11,11 @@ "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2", "@next/env": "^15.2.4", - "@patternfly/chatbot": "^2.2.1", + "@patternfly/chatbot": "^2.2.0-prerelease.44", "@patternfly/react-core": "^6.2.0", "@patternfly/react-icons": "^6.0.0", "@patternfly/react-styles": "^6.0.0", "@patternfly/react-table": "^6.2.0", - "@patternfly/virtual-assistant": "^2.0.2", "axios": "^1.8.4", "date-fns": "^4.1.0", "dompurify": "^3.2.5", @@ -90,13 +89,17 @@ "node_modules/@emotion/is-prop-valid": { "version": "0.7.3", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@emotion/memoize": "0.7.1" } }, "node_modules/@emotion/memoize": { "version": "0.7.1", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", @@ -713,8 +716,6 @@ }, "node_modules/@lukeed/csprng": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", - "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", "license": "MIT", "engines": { "node": ">=8" @@ -722,8 +723,6 @@ }, "node_modules/@lukeed/uuid": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@lukeed/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha512-qC72D4+CDdjGqJvkFMMEAtancHUQ7/d/tAiHf64z8MopFDmcrtbcJuerDtFceuAfQJ2pDSfCKCtbqoGBNnwg0w==", "license": "MIT", "dependencies": { "@lukeed/csprng": "^1.1.0" @@ -791,7 +790,6 @@ "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -807,7 +805,6 @@ "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -823,7 +820,6 @@ "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -839,7 +835,6 @@ "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -855,7 +850,6 @@ "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -871,7 +865,6 @@ "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -887,7 +880,6 @@ "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -999,9 +991,7 @@ } }, "node_modules/@patternfly/chatbot": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@patternfly/chatbot/-/chatbot-2.2.1.tgz", - "integrity": "sha512-lVIUADO1l1O6+vQk1MDh3gbodwX8CxnyANlWFlY08FJ11XOt0p1Bec4AUnO0H8Cjk0cTHF6aV93MDF9NpjFCZQ==", + "version": "2.2.0-prerelease.44", "license": "MIT", "dependencies": { "@patternfly/react-code-editor": "^6.1.0", @@ -1099,27 +1089,6 @@ "integrity": "sha512-KyzbsQYXTCxTmwkLlN4GdmTCNlOKnPUpY389loaC4/B0wHNq8Vw4OMIsAPVi4RSSvTaSxitlPAwt3xBTjNIzFA==", "license": "MIT" }, - "node_modules/@patternfly/virtual-assistant": { - "version": "2.0.2", - "license": "MIT", - "dependencies": { - "@patternfly/react-code-editor": "^6.0.0", - "@patternfly/react-core": "^6.0.0", - "@patternfly/react-icons": "^6.0.0", - "clsx": "^2.1.0", - "framer-motion": "^11.3.28", - "path-browserify": "^1.0.1", - "react-jss": "^10.10.0", - "react-markdown": "^9.0.1", - "react-syntax-highlighter": "^15.5.0", - "react-textarea-auto-witdth-height": "^1.0.3", - "remark-gfm": "^4.0.0" - }, - "peerDependencies": { - "react": "^17 || ^18", - "react-dom": "^17 || ^18" - } - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "dev": true, @@ -1145,8 +1114,6 @@ }, "node_modules/@rrweb/types": { "version": "2.0.0-alpha.17", - "resolved": "https://registry.npmjs.org/@rrweb/types/-/types-2.0.0-alpha.17.tgz", - "integrity": "sha512-AfDTVUuCyCaIG0lTSqYtrZqJX39ZEYzs4fYKnexhQ+id+kbZIpIJtaut5cto6dWZbB3SEe4fW0o90Po3LvTmfg==", "license": "MIT", "peer": true, "dependencies": { @@ -1160,8 +1127,6 @@ }, "node_modules/@segment/analytics-core": { "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@segment/analytics-core/-/analytics-core-1.8.1.tgz", - "integrity": "sha512-EYcdBdhfi1pOYRX+Sf5orpzzYYFmDHTEu6+w0hjXpW5bWkWct+Nv6UJg1hF4sGDKEQjpZIinLTpQ4eioFM4KeQ==", "license": "MIT", "dependencies": { "@lukeed/uuid": "^2.0.0", @@ -1172,17 +1137,13 @@ }, "node_modules/@segment/analytics-generic-utils": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@segment/analytics-generic-utils/-/analytics-generic-utils-1.2.0.tgz", - "integrity": "sha512-DfnW6mW3YQOLlDQQdR89k4EqfHb0g/3XvBXkovH1FstUN93eL1kfW9CsDcVQyH3bAC5ZsFyjA/o/1Q2j0QeoWw==", "license": "MIT", "dependencies": { "tslib": "^2.4.1" } }, "node_modules/@segment/analytics-next": { - "version": "1.77.0", - "resolved": "https://registry.npmjs.org/@segment/analytics-next/-/analytics-next-1.77.0.tgz", - "integrity": "sha512-xZiSz8iOPoiYt0K0w3fMG5khaPzeLuALfQYUvle6rfNnhjs8N0WiV1Vx/EwgtJPPw3saol5n4oW8xhcGWeQAIA==", + "version": "1.78.1", "license": "MIT", "dependencies": { "@lukeed/uuid": "^2.0.0", @@ -1199,8 +1160,6 @@ }, "node_modules/@segment/analytics-next/node_modules/node-fetch": { "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" @@ -1219,8 +1178,6 @@ }, "node_modules/@segment/analytics.js-video-plugins": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@segment/analytics.js-video-plugins/-/analytics.js-video-plugins-0.2.1.tgz", - "integrity": "sha512-lZwCyEXT4aaHBLNK433okEKdxGAuyrVmop4BpQqQSJuRz0DglPZgd9B/XjiiWs1UyOankg2aNYMN3VcS8t4eSQ==", "license": "ISC", "dependencies": { "unfetch": "^3.1.1" @@ -1228,14 +1185,10 @@ }, "node_modules/@segment/analytics.js-video-plugins/node_modules/unfetch": { "version": "3.1.2", - "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-3.1.2.tgz", - "integrity": "sha512-L0qrK7ZeAudGiKYw6nzFjnJ2D5WHblUBwmHIqtPS6oKUd+Hcpk7/hKsSmcHsTlpd1TbTNsiRBUKRq3bHLNIqIw==", "license": "MIT" }, "node_modules/@segment/facade": { "version": "3.4.10", - "resolved": "https://registry.npmjs.org/@segment/facade/-/facade-3.4.10.tgz", - "integrity": "sha512-xVQBbB/lNvk/u8+ey0kC/+g8pT3l0gCT8O2y9Z+StMMn3KAFAQ9w8xfgef67tJybktOKKU7pQGRPolRM1i1pdA==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@segment/isodate-traverse": "^1.1.1", @@ -1246,14 +1199,10 @@ }, "node_modules/@segment/isodate": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@segment/isodate/-/isodate-1.0.3.tgz", - "integrity": "sha512-BtanDuvJqnACFkeeYje7pWULVv8RgZaqKHWwGFnL/g/TH/CcZjkIVTfGDp/MAxmilYHUkrX70SqwnYSTNEaN7A==", "license": "SEE LICENSE IN LICENSE" }, "node_modules/@segment/isodate-traverse": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@segment/isodate-traverse/-/isodate-traverse-1.1.1.tgz", - "integrity": "sha512-+G6e1SgAUkcq0EDMi+SRLfT48TNlLPF3QnSgFGVs0V9F3o3fq/woQ2rHFlW20W0yy5NnCUH0QGU3Am2rZy/E3w==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@segment/isodate": "^1.0.3" @@ -1820,8 +1769,6 @@ }, "node_modules/axios": { "version": "1.8.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", - "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", @@ -2057,8 +2004,6 @@ }, "node_modules/core-js": { "version": "3.41.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.41.0.tgz", - "integrity": "sha512-SJ4/EHwS36QMJd6h/Rg+GyR4A5xE0FSI3eZ+iBVpfqf1x0eTSg1smWLHrA+2jQThZSh97fmSgFSU8B61nxosxA==", "hasInstallScript": true, "license": "MIT", "funding": { @@ -2078,8 +2023,6 @@ }, "node_modules/cross-spawn": { "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -2091,23 +2034,6 @@ "node": ">= 8" } }, - "node_modules/css-jss": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "^10.10.0", - "jss-preset-default": "^10.10.0" - } - }, - "node_modules/css-vendor": { - "version": "2.0.8", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.3", - "is-in-browser": "^1.0.2" - } - }, "node_modules/csstype": { "version": "3.1.3", "license": "MIT" @@ -2359,8 +2285,6 @@ }, "node_modules/dset": { "version": "3.1.4", - "resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz", - "integrity": "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==", "license": "MIT", "engines": { "node": ">=4" @@ -3356,8 +3280,6 @@ }, "node_modules/fflate": { "version": "0.4.8", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", - "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==", "license": "MIT" }, "node_modules/file-entry-cache": { @@ -3786,8 +3708,6 @@ }, "node_modules/hast-util-has-property": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz", - "integrity": "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0" @@ -3799,8 +3719,6 @@ }, "node_modules/hast-util-interactive": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-interactive/-/hast-util-interactive-3.0.0.tgz", - "integrity": "sha512-9VFa3kP6AT40BNYcPmn3jpsG+1KPDF0rUFCrFVQDUsuUXZ3YLODm8UGV0tmYzFpcOIQXTAOi2ccS3ywlj2dQTA==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -3813,8 +3731,6 @@ }, "node_modules/hast-util-is-element": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", - "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0" @@ -3834,8 +3750,6 @@ }, "node_modules/hast-util-sanitize": { "version": "5.0.2", - "resolved": "https://registry.npmjs.org/hast-util-sanitize/-/hast-util-sanitize-5.0.2.tgz", - "integrity": "sha512-3yTWghByc50aGS7JlGhk61SPenfE/p1oaFeNwkOOyrscaOkMGrcW9+Cy/QAIOBpZxP1yqDIzFMR0+Np0i0+usg==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -3947,13 +3861,6 @@ "version": "1.0.0", "license": "CC0-1.0" }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "license": "BSD-3-Clause", - "dependencies": { - "react-is": "^16.7.0" - } - }, "node_modules/html-url-attributes": { "version": "3.0.1", "license": "MIT", @@ -3962,10 +3869,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hyphenate-style-name": { - "version": "1.1.0", - "license": "BSD-3-Clause" - }, "node_modules/ignore": { "version": "5.3.1", "license": "MIT", @@ -4032,8 +3935,6 @@ }, "node_modules/is-absolute-url": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz", - "integrity": "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==", "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" @@ -4257,10 +4158,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-in-browser": { - "version": "1.1.3", - "license": "MIT" - }, "node_modules/is-map": { "version": "2.0.3", "dev": true, @@ -4464,8 +4361,6 @@ }, "node_modules/isomorphic-git": { "version": "1.30.1", - "resolved": "https://registry.npmjs.org/isomorphic-git/-/isomorphic-git-1.30.1.tgz", - "integrity": "sha512-eWBlPIPDOctGY/bTUc/whs6EZ8YvnG1H2kOjTCJ/AkvBWUzODXcfulhpiA8Y4Px9e+bRYYkifE5fSE8FcRk8Ew==", "license": "MIT", "dependencies": { "async-lock": "^1.4.1", @@ -4526,8 +4421,6 @@ }, "node_modules/js-cookie": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz", - "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==", "license": "MIT", "engines": { "node": ">=12" @@ -4562,144 +4455,6 @@ "dev": true, "license": "MIT" }, - "node_modules/jss": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "csstype": "^3.0.2", - "is-in-browser": "^1.1.3", - "tiny-warning": "^1.0.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/jss" - } - }, - "node_modules/jss-plugin-camel-case": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "hyphenate-style-name": "^1.0.3", - "jss": "10.10.0" - } - }, - "node_modules/jss-plugin-compose": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-default-unit": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0" - } - }, - "node_modules/jss-plugin-expand": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0" - } - }, - "node_modules/jss-plugin-extend": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-global": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0" - } - }, - "node_modules/jss-plugin-nested": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-props-sort": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0" - } - }, - "node_modules/jss-plugin-rule-value-function": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-rule-value-observable": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "symbol-observable": "^1.2.0" - } - }, - "node_modules/jss-plugin-template": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "tiny-warning": "^1.0.2" - } - }, - "node_modules/jss-plugin-vendor-prefixer": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "css-vendor": "^2.0.8", - "jss": "10.10.0" - } - }, - "node_modules/jss-preset-default": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "jss": "10.10.0", - "jss-plugin-camel-case": "10.10.0", - "jss-plugin-compose": "10.10.0", - "jss-plugin-default-unit": "10.10.0", - "jss-plugin-expand": "10.10.0", - "jss-plugin-extend": "10.10.0", - "jss-plugin-global": "10.10.0", - "jss-plugin-nested": "10.10.0", - "jss-plugin-props-sort": "10.10.0", - "jss-plugin-rule-value-function": "10.10.0", - "jss-plugin-rule-value-observable": "10.10.0", - "jss-plugin-template": "10.10.0", - "jss-plugin-vendor-prefixer": "10.10.0" - } - }, "node_modules/jsx-ast-utils": { "version": "3.3.5", "dev": true, @@ -5703,8 +5458,6 @@ }, "node_modules/new-date": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/new-date/-/new-date-1.0.3.tgz", - "integrity": "sha512-0fsVvQPbo2I18DT2zVHpezmeeNYV2JaJSrseiHLc17GNOxJzUdx5mvSigPu8LtIfZSij5i1wXnXFspEs2CD6hA==", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@segment/isodate": "1.0.3" @@ -5871,8 +5624,6 @@ }, "node_modules/obj-case": { "version": "0.2.1", - "resolved": "https://registry.npmjs.org/obj-case/-/obj-case-0.2.1.tgz", - "integrity": "sha512-PquYBBTy+Y6Ob/O2574XHhDtHJlV1cJHMCgW+rDRc9J5hhmRelJB3k5dTK/3cVmFVtzvAKuENeuLpoyTzMzkOg==", "license": "MIT" }, "node_modules/object-assign": { @@ -6264,8 +6015,6 @@ }, "node_modules/postcss": { "version": "8.5.3", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", - "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", "funding": [ { "type": "opencollective", @@ -6293,8 +6042,6 @@ }, "node_modules/posthog-js": { "version": "1.225.1", - "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.225.1.tgz", - "integrity": "sha512-JO12aGlKbznD91osyNPgsQXP4jwLYdDtGrEL6idjGBb4ETFpud6tfe2Jdaow3672c3fNjFFNyu2ybXC3793VOA==", "license": "MIT", "dependencies": { "core-js": "^3.38.1", @@ -6415,10 +6162,6 @@ "node": ">=0.10.0" } }, - "node_modules/react-display-name": { - "version": "0.2.5", - "license": "MIT" - }, "node_modules/react-dom": { "version": "18.3.1", "license": "MIT", @@ -6449,26 +6192,6 @@ "version": "16.13.1", "license": "MIT" }, - "node_modules/react-jss": { - "version": "10.10.0", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.3.1", - "@emotion/is-prop-valid": "^0.7.3", - "css-jss": "10.10.0", - "hoist-non-react-statics": "^3.2.0", - "is-in-browser": "^1.1.3", - "jss": "10.10.0", - "jss-preset-default": "10.10.0", - "prop-types": "^15.6.0", - "shallow-equal": "^1.2.0", - "theming": "^3.3.0", - "tiny-warning": "^1.0.2" - }, - "peerDependencies": { - "react": ">=16.8.6" - } - }, "node_modules/react-markdown": { "version": "9.0.3", "license": "MIT", @@ -6508,13 +6231,6 @@ "react": ">= 0.14.0" } }, - "node_modules/react-textarea-auto-witdth-height": { - "version": "1.0.3", - "license": "MIT", - "peerDependencies": { - "react": ">=16.8.0" - } - }, "node_modules/readable-stream": { "version": "3.6.2", "license": "MIT", @@ -6677,8 +6393,6 @@ }, "node_modules/rehype-external-links": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rehype-external-links/-/rehype-external-links-3.0.0.tgz", - "integrity": "sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -6695,8 +6409,6 @@ }, "node_modules/rehype-sanitize": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/rehype-sanitize/-/rehype-sanitize-6.0.0.tgz", - "integrity": "sha512-CsnhKNsyI8Tub6L4sm5ZFsme4puGfc6pYylvXo1AeqaGbjOYyzNv3qZPwvs0oMJ39eryyeOdmxwUIo94IpEhqg==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -6709,8 +6421,6 @@ }, "node_modules/rehype-unwrap-images": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/rehype-unwrap-images/-/rehype-unwrap-images-1.0.0.tgz", - "integrity": "sha512-wzW5Mk9IlVF2UwXC5NtIZsx1aHYbV8+bLWjJnlZaaamz5QU52RppWtq1uEZJqGo8d9Y4RuDqidB6r9RFpKugIg==", "license": "MIT", "dependencies": { "@types/hast": "^3.0.0", @@ -6877,8 +6587,6 @@ }, "node_modules/rrweb-snapshot": { "version": "2.0.0-alpha.18", - "resolved": "https://registry.npmjs.org/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.18.tgz", - "integrity": "sha512-hBHZL/NfgQX6wO1D9mpwqFu1NJPpim+moIcKhFEjVTZVRUfCln+LOugRc4teVTCISYHN8Cw5e2iNTWCSm+SkoA==", "license": "MIT", "peer": true, "dependencies": { @@ -7041,10 +6749,6 @@ "sha.js": "bin.js" } }, - "node_modules/shallow-equal": { - "version": "1.2.1", - "license": "MIT" - }, "node_modules/sharp": { "version": "0.34.1", "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.1.tgz", @@ -7238,8 +6942,6 @@ }, "node_modules/source-map-js": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -7521,13 +7223,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/symbol-observable": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/tabbable": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", @@ -7551,26 +7246,6 @@ "dev": true, "license": "MIT" }, - "node_modules/theming": { - "version": "3.3.0", - "license": "MIT", - "dependencies": { - "hoist-non-react-statics": "^3.3.0", - "prop-types": "^15.5.8", - "react-display-name": "^0.2.4", - "tiny-warning": "^1.0.2" - }, - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "react": ">=16.3" - } - }, - "node_modules/tiny-warning": { - "version": "1.0.3", - "license": "MIT" - }, "node_modules/to-regex-range": { "version": "5.0.1", "devOptional": true, @@ -7584,8 +7259,6 @@ }, "node_modules/tr46": { "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "license": "MIT" }, "node_modules/trim-lines": { @@ -7772,8 +7445,6 @@ }, "node_modules/unfetch": { "version": "4.2.0", - "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", - "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==", "license": "MIT" }, "node_modules/unified": { @@ -7865,8 +7536,6 @@ }, "node_modules/uuid": { "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" @@ -7909,20 +7578,14 @@ }, "node_modules/web-vitals": { "version": "4.2.4", - "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.4.tgz", - "integrity": "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==", "license": "Apache-2.0" }, "node_modules/webidl-conversions": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "license": "BSD-2-Clause" }, "node_modules/whatwg-url": { "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "license": "MIT", "dependencies": { "tr46": "~0.0.3", diff --git a/package.json b/package.json index efc61a28a..cb7e8a63f 100644 --- a/package.json +++ b/package.json @@ -19,13 +19,12 @@ "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2", "@next/env": "^15.2.4", - "@patternfly/chatbot": "^2.2.1", + "@patternfly/chatbot": "^2.2.0-prerelease.44", "@patternfly/react-core": "^6.2.0", "@patternfly/react-icons": "^6.0.0", "@patternfly/react-styles": "^6.0.0", "axios": "^1.8.4", "@patternfly/react-table": "^6.2.0", - "@patternfly/virtual-assistant": "^2.0.2", "date-fns": "^4.1.0", "dompurify": "^3.2.5", "fs": "^0.0.1-security", diff --git a/src/app/api/analyticsConfig/route.ts b/src/app/api/analyticsConfig/route.ts new file mode 100644 index 000000000..74e928071 --- /dev/null +++ b/src/app/api/analyticsConfig/route.ts @@ -0,0 +1,22 @@ +import { NextResponse } from 'next/server'; + +export const dynamic = 'force-dynamic'; + +export async function GET() { + const uiConfig = { + verbose: process.env.ANALYTICS_VERBOSE || true, + activeProviders: process.env.ANALYTICS_PROVIDERS || [ "None" ], + umamiKey: process.env.UMAMI_KEY || '', + umamiHostUrl: process.env.UMAMI_HOST_URL || '', + segmentKey: process.env.SEGMENT_KEY || '', + segmentCdn: process.env.SEGMENT_CDN || '', + segmentIntegrations: {} + } ; + + const tmp = process.env.SEGMENT_INTEGRATIONS; + if (tmp) { + uiConfig.segmentIntegrations = JSON.parse(tmp); + } + + return NextResponse.json(uiConfig); +} diff --git a/src/app/playground/endpoints/page.tsx b/src/app/playground/endpoints/page.tsx index 2f5e2e168..6662df604 100644 --- a/src/app/playground/endpoints/page.tsx +++ b/src/app/playground/endpoints/page.tsx @@ -66,6 +66,7 @@ const EndpointsPage: React.FC = () => { }; const handleSaveEndpoint = () => { + window.analytics.trackSingleItem(currentEndpoint ? 'Model Endpoint edited' : 'Model Endpoint added', {}) const updatedUrl = removeTrailingSlash(url); if (currentEndpoint) { const updatedEndpoint: ExtendedEndpoint = { diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index c61299ffc..af70614df 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -32,6 +32,7 @@ import { import { BarsIcon } from '@patternfly/react-icons'; import ThemePreference from '@/components/ThemePreference/ThemePreference'; import '../styles/globals.scss'; +import { initAnalytics } from '@/components/analytics/initAnalytics'; interface IAppLayout { children: React.ReactNode; @@ -47,6 +48,8 @@ type Route = { const AppLayout: React.FunctionComponent = ({ children, className }) => { const { data: session, status } = useSession(); const [isExperimentalEnabled, setExperimental] = useState(false); + const [analyticsInitialised, setAnalyticsInitialised] = useState(false); + const [identified, setIdentified] = useState(false); const router = useRouter(); const pathname = usePathname(); @@ -61,6 +64,35 @@ const AppLayout: React.FunctionComponent = ({ children, className }) fetchExperimentalFeature(); }, []); + React.useEffect(() => { + if (!window.analytics) { + initAnalytics(); + setAnalyticsInitialised(true); + } + }, []); + + React.useEffect(() => { // this gets fired twice in dev mode, prod seems ok. + if (window.analytics) { + const url = `${pathname}` + window.analytics.trackPageView(url); // TODO does not get fired directly after login. + } + + }, [analyticsInitialised, pathname]); + + React.useEffect(() => { // TODO this gets fired much too often ( after each path change) + if (window.analytics ) { + // TODO we may potentially want to hash this. Also different code per target install? + // TODO pass other parameters as properties (?) + if (status !== "authenticated") { + return; + } + if (!identified) { // this is reset after each path change + window.analytics.identify(session?.user?.name ? session.user.name : '-unknown-user-name-', {}); + setIdentified(true); + } + } + },[analyticsInitialised, status, identified, session?.user?.name]); + React.useEffect(() => { if (status === 'loading') return; // Do nothing while loading if (!session && pathname !== '/login') { diff --git a/src/components/Chat/ChatBotComponent.tsx b/src/components/Chat/ChatBotComponent.tsx index 776644289..65b274959 100644 --- a/src/components/Chat/ChatBotComponent.tsx +++ b/src/components/Chat/ChatBotComponent.tsx @@ -214,6 +214,7 @@ const ChatBotComponent: React.FunctionComponent = ({ const handleCleanup = () => { setMessages([]); + window.analytics.trackSingleItem('Chat Cleared', {}); }; return ( diff --git a/src/components/Contribute/ContributionWizard/ContributionWizard.tsx b/src/components/Contribute/ContributionWizard/ContributionWizard.tsx index 71d838c7d..09dc4c794 100644 --- a/src/components/Contribute/ContributionWizard/ContributionWizard.tsx +++ b/src/components/Contribute/ContributionWizard/ContributionWizard.tsx @@ -141,9 +141,11 @@ export const ContributionWizard: React.FunctionComponent = ({ const autoFillForm = (): void => { setFormData(isSkillContribution ? { ...autoFillSkillsFields } : { ...autoFillKnowledgeFields }); + window.analytics.trackSingleItem('AutoFill Clicked', {isSkillContribution}); }; const handleCancel = () => { + window.analytics.trackSingleItem('Contribution Cancelled', {isSkillContribution}); router.push('/dashboard'); }; @@ -187,7 +189,10 @@ export const ContributionWizard: React.FunctionComponent = ({ style={{ maxHeight: '100%' }} startIndex={1} onClose={handleCancel} - onStepChange={(_ev, currentStep) => setActiveStepIndex(stepIds.indexOf(String(currentStep.id)))} + onStepChange={(_ev, currentStep) => { + setActiveStepIndex(stepIds.indexOf(String(currentStep.id))); + window.analytics.trackSingleItem('Wizard Step Changed', { isSkillContribution, step: currentStep.id });} + } footer={ = ({ filesToCon return () => { canceled = true; }; - }, [convertToMarkdownIfNeeded, filesToConvert, isUploading, onConverted, onError]); + }, [convertToMarkdownIfNeeded, currentFiles, filesToConvert, isUploading, onConverted, onError]); return ( diff --git a/src/components/Contribute/Knowledge/KnowledgeSeedExamples/KnowledgeSeedExamples.tsx b/src/components/Contribute/Knowledge/KnowledgeSeedExamples/KnowledgeSeedExamples.tsx index 836199b49..42201ebfd 100644 --- a/src/components/Contribute/Knowledge/KnowledgeSeedExamples/KnowledgeSeedExamples.tsx +++ b/src/components/Contribute/Knowledge/KnowledgeSeedExamples/KnowledgeSeedExamples.tsx @@ -102,10 +102,12 @@ const KnowledgeSeedExamples: React.FC = ({ isGithubMode, filesToUpload, u seedExample.immutable = false; seedExample.isExpanded = true; onUpdateSeedExamples([...seedExamples, seedExample]); + window.analytics.trackSingleItem("Added Seed", {isSkillContribution: false}); }; const deleteSeedExample = (seedExampleIndex: number): void => { onUpdateSeedExamples(seedExamples.filter((_, index: number) => index !== seedExampleIndex)); + window.analytics.trackSingleItem("Deleted Seed", {isSkillContribution: false}); }; return ( diff --git a/src/components/Contribute/Knowledge/KnowledgeWizard/KnowledgeWizard.tsx b/src/components/Contribute/Knowledge/KnowledgeWizard/KnowledgeWizard.tsx index b6d8c73f4..e688c7c00 100644 --- a/src/components/Contribute/Knowledge/KnowledgeWizard/KnowledgeWizard.tsx +++ b/src/components/Contribute/Knowledge/KnowledgeWizard/KnowledgeWizard.tsx @@ -269,6 +269,7 @@ export const KnowledgeWizard: React.FunctionComponent = ({ k return isDocUploaded; } + window.analytics.trackSingleItem("Knowledge Contribution Submitted", {}); // TODO add data if (knowledgeEditFormData) { const result = isGithubMode ? await updateGithubKnowledgeData(session, knowledgeFormData, knowledgeEditFormData, updateActionGroupAlertContent) @@ -292,6 +293,7 @@ export const KnowledgeWizard: React.FunctionComponent = ({ k const onYamlUploadKnowledgeFillForm = (data: KnowledgeYamlData): void => { setKnowledgeFormData(addYamlUploadKnowledge(knowledgeFormData, data)); + window.analytics.trackSingleItem('Knowledge Yaml uploaded', {}); updateActionGroupAlertContent({ title: 'YAML Uploaded Successfully', message: 'Your knowledge form has been populated based on the uploaded YAML file.', diff --git a/src/components/Contribute/Skill/SkillSeedExamples/SkillSeedExamples.tsx b/src/components/Contribute/Skill/SkillSeedExamples/SkillSeedExamples.tsx index 4be39e3c8..b5bbce72f 100644 --- a/src/components/Contribute/Skill/SkillSeedExamples/SkillSeedExamples.tsx +++ b/src/components/Contribute/Skill/SkillSeedExamples/SkillSeedExamples.tsx @@ -49,10 +49,12 @@ const SkillSeedExamples: React.FC = ({ seedExamples, onSelectContext, onU seedExample.immutable = false; seedExample.isExpanded = true; onUpdateSeedExamples([...seedExamples, seedExample]); + window.analytics.trackSingleItem("Added Seed", {isSkillContribution: true}); }; const deleteSeedExample = (seedExampleIndex: number): void => { onUpdateSeedExamples(seedExamples.filter((_, index: number) => index !== seedExampleIndex)); + window.analytics.trackSingleItem("Deleted Seed", {isSkillContribution: true}); }; return ( diff --git a/src/components/Contribute/Skill/SkillWizard/SkillWizard.tsx b/src/components/Contribute/Skill/SkillWizard/SkillWizard.tsx index 914c0b093..2530a92c2 100644 --- a/src/components/Contribute/Skill/SkillWizard/SkillWizard.tsx +++ b/src/components/Contribute/Skill/SkillWizard/SkillWizard.tsx @@ -176,6 +176,7 @@ export const SkillWizard: React.FunctionComponent = ({ skillEditFormData, }; const handleSubmit = async (githubUsername: string): Promise => { + window.analytics.trackSingleItem("Skill Contribution Submitted", {}); // TODO better place, add data if (skillEditFormData) { const result = isGithubMode ? await updateGithubSkillData(session, skillFormData, skillEditFormData, updateActionGroupAlertContent) @@ -200,6 +201,7 @@ export const SkillWizard: React.FunctionComponent = ({ skillEditFormData, const onYamlUploadSkillFillForm = (data: SkillYamlData): void => { setSkillFormData(addYamlUploadSkill(skillFormData, data)); + window.analytics.trackSingleItem('Skill Yaml uploaded', {}); updateActionGroupAlertContent({ title: 'YAML Uploaded Successfully', message: 'Your skill form has been populated based on the uploaded YAML file.', diff --git a/src/components/analytics/initAnalytics.ts b/src/components/analytics/initAnalytics.ts new file mode 100644 index 000000000..c288f819e --- /dev/null +++ b/src/components/analytics/initAnalytics.ts @@ -0,0 +1,40 @@ +'use client' + +import { TrackingApi } from '@patternfly/chatbot/src/tracking/tracking_api'; +import { getTrackingProviders } from '@patternfly/chatbot'; +import { InitProps } from '@patternfly/chatbot/dist/esm/tracking/tracking_spi'; + +declare global { + interface Window { + analytics: TrackingApi; + } +} + +export const initAnalytics = () : TrackingApi => { + console.log('initAnalytics'); + + if (window.analytics) { + return window.analytics; + } + + let api: TrackingApi ; + fetch('/api/analyticsConfig', { + method: 'GET' + }) + .then((response) => response.json()) + .then((data) => { + console.log(data); + api = getTrackingProviders(data); + window.analytics = api; + return api; + }) + .catch((error) => { + console.error(error); + api = getTrackingProviders({ verbose: false, activeProviders: ['None'] } as InitProps); + window.analytics = api; + return api; + }); + + // Should not be reached, but lint complains otherwise + return getTrackingProviders({ verbose: false, activeProviders: ['None'] } as InitProps); +};