app-tutor-ai-consumer 1.27.1 → 1.27.3
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.
- package/CHANGELOG.md +12 -0
- package/config/rspack/rspack.config.js +9 -5
- package/config/rspack/utils/envs.js +7 -4
- package/config/rspack/utils/plugins.js +40 -5
- package/environments/.env.production +5 -0
- package/package.json +11 -2
- package/src/@types/hot-observability-js.d.ts +1 -0
- package/src/config/hot-observability/hot-observability.ts +7 -0
- package/src/config/hot-observability/index.ts +2 -0
- package/src/config/hot-observability/types.ts +29 -0
- package/src/lib/components/errors/boundary.tsx +3 -1
- package/src/modules/widget/components/container/container.tsx +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.27.3](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.27.2...v1.27.3) (2025-08-14)
|
|
2
|
+
|
|
3
|
+
### Performance Improvements
|
|
4
|
+
|
|
5
|
+
- add bundle analyzers ([26ee88f](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/26ee88f6e2cfa73645ac9406f0e1df03947686f9))
|
|
6
|
+
|
|
7
|
+
## [1.27.2](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.27.1...v1.27.2) (2025-08-13)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- build staging ([e331a5e](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/e331a5ef60a8530e3f08419407fd5dea25a30722))
|
|
12
|
+
|
|
1
13
|
## [1.27.1](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.27.0...v1.27.1) (2025-08-13)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
|
@@ -5,6 +5,7 @@ const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin')
|
|
|
5
5
|
const paths = require('./utils/paths')
|
|
6
6
|
const alias = require('./utils/alias')
|
|
7
7
|
const { getEnvironmentPlugins } = require('./utils/plugins')
|
|
8
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin')
|
|
8
9
|
|
|
9
10
|
require('dotenv').config({
|
|
10
11
|
path: path.resolve(__dirname, `../../environments/.env.${process.env.NODE_ENV}`)
|
|
@@ -12,7 +13,7 @@ require('dotenv').config({
|
|
|
12
13
|
|
|
13
14
|
module.exports = async function (env) {
|
|
14
15
|
const standaloneMode = env?.local
|
|
15
|
-
const productionMode = env?.production || env?.staging
|
|
16
|
+
const productionMode = env?.production || env?.staging || env?.RSDOCTOR
|
|
16
17
|
const releaseFullName = `app-tutor-ai-consumer_v${packageJSON.version}`
|
|
17
18
|
const fileVersion = `${productionMode ? 'prod' : 'dev'}-${packageJSON?.version}`
|
|
18
19
|
const bundlePath = !productionMode
|
|
@@ -49,10 +50,10 @@ module.exports = async function (env) {
|
|
|
49
50
|
pathinfo: !productionMode,
|
|
50
51
|
filename: `remoteEntry.js`,
|
|
51
52
|
chunkFilename: `[name].[fullhash].chunk.${fileVersion}.js`,
|
|
52
|
-
sourceMapFilename: `[
|
|
53
|
+
sourceMapFilename: `[file].${fileVersion}.js.map`,
|
|
53
54
|
clean: true
|
|
54
55
|
},
|
|
55
|
-
devtool: productionMode ?
|
|
56
|
+
devtool: productionMode ? 'source-map' : 'cheap-module-source-map',
|
|
56
57
|
resolve: {
|
|
57
58
|
symlinks: !productionMode,
|
|
58
59
|
extensions: ['.tsx', '.ts', '.js', '.json'],
|
|
@@ -168,8 +169,11 @@ module.exports = async function (env) {
|
|
|
168
169
|
new rspack.HtmlRspackPlugin({
|
|
169
170
|
template: path.resolve(paths.PUBLIC, 'index.html'),
|
|
170
171
|
favicon: path.resolve(paths.PUBLIC, 'favicon.ico')
|
|
171
|
-
})
|
|
172
|
-
|
|
172
|
+
}),
|
|
173
|
+
env?.RSDOCTOR && new RsdoctorRspackPlugin({})
|
|
174
|
+
]
|
|
175
|
+
.filter(Boolean)
|
|
176
|
+
.concat(await getEnvironmentPlugins(process.env.NODE_ENV)),
|
|
173
177
|
watchOptions: {
|
|
174
178
|
ignored: /node_modules/
|
|
175
179
|
}
|
|
@@ -26,15 +26,18 @@ const envs = [
|
|
|
26
26
|
|
|
27
27
|
const localEnvs = ['MEMBERSHIP_SLUG']
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const stagingEnvs = [...envs, 'APP_HOST_MF']
|
|
30
|
+
|
|
31
|
+
const prodEnvs = ['SENTRY_DSN', 'SENTRY_ORG', 'SENTRY_PROJECT']
|
|
30
32
|
|
|
31
33
|
const devEnvs = [...envs, ...localEnvs]
|
|
32
34
|
|
|
33
|
-
const allEnvs = [...
|
|
35
|
+
const allEnvs = [...stagingEnvs, ...prodEnvs]
|
|
34
36
|
|
|
35
37
|
module.exports = {
|
|
38
|
+
allEnvs,
|
|
39
|
+
devEnvs,
|
|
36
40
|
envs,
|
|
37
41
|
prodEnvs,
|
|
38
|
-
|
|
39
|
-
allEnvs
|
|
42
|
+
stagingEnvs
|
|
40
43
|
}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
const refreshPlugin = require('@rspack/plugin-react-refresh')
|
|
2
2
|
const rspack = require('@rspack/core')
|
|
3
|
-
const { devEnvs,
|
|
3
|
+
const { allEnvs, devEnvs, stagingEnvs } = require('./envs')
|
|
4
4
|
const CompressionPlugin = require('compression-webpack-plugin')
|
|
5
|
+
const { HotmartRumPlugin } = require('@hotmart-org-ca/hot-observability-js/rum/webpack')
|
|
6
|
+
const packageJSON = require('../../../package.json')
|
|
7
|
+
const paths = require('./paths')
|
|
8
|
+
const path = require('path')
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
const release = `${packageJSON.name}@v${packageJSON.version}`
|
|
11
|
+
|
|
12
|
+
async function getEnvironmentPlugins(env) {
|
|
13
|
+
const developmentMode = env !== 'production' && env !== 'staging'
|
|
14
|
+
const stagingMode = env === 'staging'
|
|
15
|
+
|
|
16
|
+
if (developmentMode) {
|
|
8
17
|
const res = await fetch(
|
|
9
18
|
`${process.env.SECURITY_BASE_URL}/security/oauth/token?grant_type=password&username=${process.env.USER_VLC}&password=${process.env.VLC_PASSWORD}`,
|
|
10
19
|
{
|
|
@@ -24,8 +33,7 @@ async function getEnvironmentPlugins(isDevelopment) {
|
|
|
24
33
|
]
|
|
25
34
|
}
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
new rspack.EnvironmentPlugin(allEnvs),
|
|
36
|
+
const prodCommonPlugins = [
|
|
29
37
|
new rspack.CssExtractRspackPlugin({
|
|
30
38
|
filename: 'app-tutor-ai-consumer.css',
|
|
31
39
|
chunkFilename: '[id].[contenthash].css'
|
|
@@ -34,6 +42,33 @@ async function getEnvironmentPlugins(isDevelopment) {
|
|
|
34
42
|
algorithm: 'gzip'
|
|
35
43
|
})
|
|
36
44
|
]
|
|
45
|
+
|
|
46
|
+
if (stagingMode) return [new rspack.EnvironmentPlugin(stagingEnvs), ...prodCommonPlugins]
|
|
47
|
+
|
|
48
|
+
return [
|
|
49
|
+
new rspack.EnvironmentPlugin(allEnvs),
|
|
50
|
+
HotmartRumPlugin({
|
|
51
|
+
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
52
|
+
org: process.env.SENTRY_ORG,
|
|
53
|
+
project: process.env.SENTRY_PROJECT,
|
|
54
|
+
release: {
|
|
55
|
+
name: release,
|
|
56
|
+
deploy: {
|
|
57
|
+
env: process.env.NODE_ENV
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
moduleMetadata: () => ({
|
|
61
|
+
dsn: process.env.SENTRY_DSN,
|
|
62
|
+
release
|
|
63
|
+
}),
|
|
64
|
+
sourcemaps: {
|
|
65
|
+
assets: [path.resolve(paths.DIST, '**/*.js'), path.resolve(paths.DIST, '**/*.map')],
|
|
66
|
+
ignore: [paths.NODE_MODULES],
|
|
67
|
+
disable: Boolean(process.env.ANALYZE)
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
...prodCommonPlugins
|
|
71
|
+
]
|
|
37
72
|
}
|
|
38
73
|
|
|
39
74
|
module.exports = {
|
|
@@ -41,3 +41,8 @@ BUNDLE_PATH=https://app-club-microfrontends-prod.cp.hotmart.com
|
|
|
41
41
|
|
|
42
42
|
# STATIC
|
|
43
43
|
STATIC_URL=https://static.hotmart.com
|
|
44
|
+
|
|
45
|
+
# SENTRY
|
|
46
|
+
SENTRY_DSN=https://16c84dbea85a67f73a3696f6f05796bb@o49094.ingest.us.sentry.io/4509837136887808
|
|
47
|
+
SENTRY_ORG=hotmart
|
|
48
|
+
SENTRY_PROJECT=app-tutor-ai-consumer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "app-tutor-ai-consumer",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "rspack serve --env=development --config config/rspack/rspack.config.js",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"fetch-langs": "PROJECT=app-tutor-ai-consumer PATH_LANGUAGES=public/locales api-languages-cli",
|
|
24
24
|
"fetch-langs:local": "PROJECT=app-tutor-ai-consumer PATH_LANGUAGES=public/locales LANG_ENV=local api-languages-cli",
|
|
25
25
|
"semantic-release": "semantic-release",
|
|
26
|
+
"analyze": "rspack build --analyze --config config/rspack/rspack.config.js",
|
|
27
|
+
"rsdoctor": "rspack build --mode=production --env=RSDOCTOR --config config/rspack/rspack.config.js",
|
|
26
28
|
"prepare": "husky || true"
|
|
27
29
|
},
|
|
28
30
|
"keywords": [],
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
"@eslint/js": "~9.28.0",
|
|
38
40
|
"@hotmart/api-languages-cli": "~2.0.5",
|
|
39
41
|
"@rsbuild/plugin-svgr": "~1.2.0",
|
|
42
|
+
"@rsdoctor/rspack-plugin": "~1.2.2",
|
|
40
43
|
"@rspack/cli": "~1.3.15",
|
|
41
44
|
"@rspack/core": "~1.3.15",
|
|
42
45
|
"@rspack/plugin-react-refresh": "~1.4.3",
|
|
@@ -97,13 +100,14 @@
|
|
|
97
100
|
"ts-node": "~10.9.2",
|
|
98
101
|
"typescript": "~5.8.3",
|
|
99
102
|
"typescript-eslint": "~8.34.0",
|
|
100
|
-
"ua-parser-js": "~2.0.
|
|
103
|
+
"ua-parser-js": "~2.0.4",
|
|
101
104
|
"undici": "~7.10.0",
|
|
102
105
|
"vite-tsconfig-paths": "~5.1.4",
|
|
103
106
|
"vitest": "~3.2.3"
|
|
104
107
|
},
|
|
105
108
|
"dependencies": {
|
|
106
109
|
"@hot-observability-js/react": "~1.1.0",
|
|
110
|
+
"@hotmart-org-ca/hot-observability-js": "~1.1.0",
|
|
107
111
|
"@hotmart/event-agent-js": "~1.1.2",
|
|
108
112
|
"@hotmart/sparkie": "~5.1.0",
|
|
109
113
|
"@lottiefiles/dotlottie-react": "~0.14.4",
|
|
@@ -134,6 +138,11 @@
|
|
|
134
138
|
"@rollup/rollup-linux-x64-gnu": "4.6.1",
|
|
135
139
|
"@rspack/binding-linux-x64-gnu": "1.3.10"
|
|
136
140
|
},
|
|
141
|
+
"overrides": {
|
|
142
|
+
"property-information": "7.1.0",
|
|
143
|
+
"uuid": "~11.1.0",
|
|
144
|
+
"ua-parser-js": "~2.0.4"
|
|
145
|
+
},
|
|
137
146
|
"browserslist": [
|
|
138
147
|
">0.2%",
|
|
139
148
|
"not dead",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '@hotmart-org-ca/hot-observability-js/rum/react'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type Levels = 'fatal' | 'error' | 'warning' | 'log' | 'info' | 'debug'
|
|
2
|
+
|
|
3
|
+
export type ExtraParams = {
|
|
4
|
+
stack?: string
|
|
5
|
+
message?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ErrorParams = {
|
|
9
|
+
name: string
|
|
10
|
+
} & ExtraParams
|
|
11
|
+
|
|
12
|
+
export type User = {
|
|
13
|
+
id: number
|
|
14
|
+
email: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ScopeParams = {
|
|
18
|
+
setUser: (user: User) => void
|
|
19
|
+
setTag: (key: string, value: string) => void
|
|
20
|
+
setLevel: (level: Levels) => void
|
|
21
|
+
setExtras: (params: ExtraParams) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type HotmartRumFunctions = {
|
|
25
|
+
withScope: <T>(callback: (scope: ScopeParams) => T) => T
|
|
26
|
+
captureException: (error: string, hint: any) => void
|
|
27
|
+
captureMessage: (message: string) => string
|
|
28
|
+
ErrorBoundary: any
|
|
29
|
+
}
|
|
@@ -3,6 +3,8 @@ import { Component } from 'react'
|
|
|
3
3
|
import { HotmartRum } from '@hot-observability-js/react'
|
|
4
4
|
import type { ErrorInfo, PropsWithChildren, ReactNode } from 'react'
|
|
5
5
|
|
|
6
|
+
import { productionMode } from '../../utils'
|
|
7
|
+
|
|
6
8
|
export type BoundaryState = {
|
|
7
9
|
hasError: boolean
|
|
8
10
|
}
|
|
@@ -18,7 +20,7 @@ export type BoundaryProps = PropsWithChildren<{
|
|
|
18
20
|
}>
|
|
19
21
|
|
|
20
22
|
const logError = (error: Error, errorInfo: ErrorInfo, user?: BoundaryProps['user']) => {
|
|
21
|
-
if (
|
|
23
|
+
if (!productionMode && typeof vi === 'undefined') {
|
|
22
24
|
return console.error(`Uncaught error: ${JSON.stringify({ error, errorInfo })}`)
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
1
3
|
import { useSubscribeMessageReceivedEvent } from '@/src/modules/messages/hooks'
|
|
2
4
|
import { useSubscribeThreadClosedEvent } from '@/src/modules/thread/hooks'
|
|
3
5
|
import { useListenToVisibilityEvents } from '../../hooks'
|
|
4
6
|
import { useWidgetTabsAtom } from '../../store'
|
|
5
7
|
import { WIDGET_TABS } from '../constants'
|
|
6
8
|
|
|
9
|
+
// TODO: REMOVE
|
|
10
|
+
const hotmartRumKey = 'app-tutor-ai-consumer::hotmart-rum::activate'
|
|
11
|
+
const useSentryDebugger = () => {
|
|
12
|
+
const [logError] = useState(() => Boolean(window?.localStorage?.getItem?.(hotmartRumKey)))
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (logError) throw new Error(hotmartRumKey)
|
|
16
|
+
}, [logError])
|
|
17
|
+
}
|
|
18
|
+
|
|
7
19
|
function WidgetContainer() {
|
|
8
20
|
const [widgetTabs] = useWidgetTabsAtom()
|
|
9
21
|
|
|
@@ -11,6 +23,8 @@ function WidgetContainer() {
|
|
|
11
23
|
useSubscribeThreadClosedEvent()
|
|
12
24
|
useListenToVisibilityEvents()
|
|
13
25
|
|
|
26
|
+
useSentryDebugger()
|
|
27
|
+
|
|
14
28
|
return (
|
|
15
29
|
<div className='flex h-full flex-col items-center justify-stretch overflow-hidden'>
|
|
16
30
|
{WIDGET_TABS[widgetTabs.currentTab]}
|