app-tutor-ai-consumer 1.27.0 → 1.27.2
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 +3 -3
- 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 +2 -1
- 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/messages/hooks/use-subscribe-message-received-event/use-subscribe-message-received-event.tsx +3 -0
- package/src/modules/widget/components/container/container.tsx +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.27.2](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.27.1...v1.27.2) (2025-08-13)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- build staging ([e331a5e](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/e331a5ef60a8530e3f08419407fd5dea25a30722))
|
|
6
|
+
|
|
7
|
+
## [1.27.1](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.27.0...v1.27.1) (2025-08-13)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- different conversation ids bug ([bec54b4](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/bec54b484d54816d67fc2120763ddbeee3798caf))
|
|
12
|
+
|
|
1
13
|
# [1.27.0](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.26.1...v1.27.0) (2025-08-13)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -49,10 +49,10 @@ module.exports = async function (env) {
|
|
|
49
49
|
pathinfo: !productionMode,
|
|
50
50
|
filename: `remoteEntry.js`,
|
|
51
51
|
chunkFilename: `[name].[fullhash].chunk.${fileVersion}.js`,
|
|
52
|
-
sourceMapFilename: `[
|
|
52
|
+
sourceMapFilename: `[file].${fileVersion}.js.map`,
|
|
53
53
|
clean: true
|
|
54
54
|
},
|
|
55
|
-
devtool: productionMode ?
|
|
55
|
+
devtool: productionMode ? 'source-map' : 'cheap-module-source-map',
|
|
56
56
|
resolve: {
|
|
57
57
|
symlinks: !productionMode,
|
|
58
58
|
extensions: ['.tsx', '.ts', '.js', '.json'],
|
|
@@ -169,7 +169,7 @@ module.exports = async function (env) {
|
|
|
169
169
|
template: path.resolve(paths.PUBLIC, 'index.html'),
|
|
170
170
|
favicon: path.resolve(paths.PUBLIC, 'favicon.ico')
|
|
171
171
|
})
|
|
172
|
-
].concat(await getEnvironmentPlugins(
|
|
172
|
+
].concat(await getEnvironmentPlugins(process.env.NODE_ENV)),
|
|
173
173
|
watchOptions: {
|
|
174
174
|
ignored: /node_modules/
|
|
175
175
|
}
|
|
@@ -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.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "rspack serve --env=development --config config/rspack/rspack.config.js",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@hot-observability-js/react": "~1.1.0",
|
|
107
|
+
"@hotmart-org-ca/hot-observability-js": "~1.1.0",
|
|
107
108
|
"@hotmart/event-agent-js": "~1.1.2",
|
|
108
109
|
"@hotmart/sparkie": "~5.1.0",
|
|
109
110
|
"@lottiefiles/dotlottie-react": "~0.14.4",
|
|
@@ -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
|
|
|
@@ -34,6 +34,8 @@ const useSubscribeMessageReceivedEvent = () => {
|
|
|
34
34
|
|
|
35
35
|
const messageReceived = useCallback(
|
|
36
36
|
(data: IMessageWithSenderData) => {
|
|
37
|
+
if (data.conversationId !== conversationId) return
|
|
38
|
+
|
|
37
39
|
const queryData = queryClient.getQueryData<InfiniteData<FetchMessagesResponse>>(
|
|
38
40
|
messagesQueryConfig.queryKey
|
|
39
41
|
)
|
|
@@ -66,6 +68,7 @@ const useSubscribeMessageReceivedEvent = () => {
|
|
|
66
68
|
},
|
|
67
69
|
[
|
|
68
70
|
addUnreadMessagesToSet,
|
|
71
|
+
conversationId,
|
|
69
72
|
messagesQueryConfig.queryKey,
|
|
70
73
|
profileId,
|
|
71
74
|
queryClient,
|
|
@@ -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]}
|