app-tutor-ai-consumer 1.22.3 → 1.24.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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +1 -1
  3. package/src/config/datahub/actions.ts +8 -1
  4. package/src/config/datahub/constants.ts +8 -1
  5. package/src/config/datahub/schemas/base-click-product-schema.ts +51 -0
  6. package/src/config/datahub/schemas/base-close-schema.ts +52 -0
  7. package/src/config/datahub/schemas/base-product-schema.ts +37 -0
  8. package/src/config/datahub/schemas/base-schema.ts +0 -2
  9. package/src/config/datahub/schemas/constants.ts +5 -0
  10. package/src/config/datahub/schemas/tutor/__tests__/click-hotmart-tutor.spec.ts +0 -6
  11. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-back.spec.ts +32 -0
  12. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-history.spec.ts +32 -0
  13. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-info.spec.ts +32 -0
  14. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-know-more.spec.ts +32 -0
  15. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-onboarding-start.spec.ts +32 -0
  16. package/src/config/datahub/schemas/tutor/__tests__/click-tutor-test-knowledge.spec.ts +32 -0
  17. package/src/config/datahub/schemas/tutor/__tests__/close-tutor-onboarding.spec.ts +32 -0
  18. package/src/config/datahub/schemas/tutor/click-tutor-back.ts +26 -0
  19. package/src/config/datahub/schemas/tutor/click-tutor-history.ts +26 -0
  20. package/src/config/datahub/schemas/tutor/click-tutor-info.ts +26 -0
  21. package/src/config/datahub/schemas/tutor/click-tutor-know-more.ts +26 -0
  22. package/src/config/datahub/schemas/tutor/click-tutor-minimize.ts +2 -2
  23. package/src/config/datahub/schemas/tutor/click-tutor-onboarding-start.ts +26 -0
  24. package/src/config/datahub/schemas/tutor/click-tutor-test-knowledge.ts +26 -0
  25. package/src/config/datahub/schemas/tutor/close-tutor-onboarding.ts +33 -0
  26. package/src/config/datahub/schemas/tutor/index.ts +7 -0
  27. package/src/config/datahub/schemas/types.ts +3 -1
  28. package/src/config/datahub/store.ts +24 -2
  29. package/src/config/datahub/types.ts +4 -0
  30. package/src/config/tests/handlers.ts +3 -0
  31. package/src/development-bootstrap.tsx +1 -1
  32. package/src/lib/components/horizontal-draggable-scroll/horizontal-draggable-scroll.tsx +1 -0
  33. package/src/lib/components/tooltip/styles.module.css +1 -1
  34. package/src/modules/messages/hooks/use-send-text-message/use-send-text-message.tsx +6 -1
  35. package/src/modules/widget/components/header/widget-header.tsx +17 -3
  36. package/src/modules/widget/components/page-layout/page-layout.tsx +3 -1
  37. package/src/modules/widget/components/quick-action-buttons/index.ts +2 -0
  38. package/src/modules/widget/components/quick-action-buttons/quick-action-buttons.tsx +74 -0
  39. package/src/modules/widget/components/starter-page/starter-page.tsx +8 -37
  40. package/src/modules/widget/hooks/use-init-widget/use-init-widget.tsx +5 -1
  41. package/src/types.ts +8 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # [1.24.0](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.23.0...v1.24.0) (2025-08-11)
2
+
3
+ ### Features
4
+
5
+ - add user actions on Tutor Datahub events ([e4281b1](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/e4281b14a2b2158bfa6711a55cfaf926d2caa747))
6
+
7
+ # [1.23.0](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.22.3...v1.23.0) (2025-08-11)
8
+
9
+ ### Features
10
+
11
+ - add metadata properties to widget settings and component IDs to customize on agent page ([04c244d](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/04c244dcb4170665f6a216ce69c119e358118ef5))
12
+ - adding component id ([82b25ce](https://github.com/Hotmart-Org/app-tutor-ai-consumer/commit/82b25ce4a4974d3739dae09dc21928d5b3b78544))
13
+
1
14
  ## [1.22.3](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.22.2...v1.22.3) (2025-08-08)
2
15
 
3
16
  ## [1.22.2](https://github.com/Hotmart-Org/app-tutor-ai-consumer/compare/v1.22.1...v1.22.2) (2025-08-07)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app-tutor-ai-consumer",
3
- "version": "1.22.3",
3
+ "version": "1.24.0",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "dev": "rspack serve --env=development --config config/rspack/rspack.config.js",
@@ -12,5 +12,12 @@ export type DataHubActionTypes = (typeof DataHubActions)[keyof typeof DataHubAct
12
12
  export const ActionNames = {
13
13
  CLICK_HOTMART_TUTOR: `${DataHubActions.CLICK}_hotmart_tutor`,
14
14
  CLICK_TUTOR_MINIMIZE: `${DataHubActions.CLICK}_tutor_minimize`,
15
- TRY_PRODUCT_TUTOR: `${DataHubActions.TRY}_product_tutor`
15
+ TRY_PRODUCT_TUTOR: `${DataHubActions.TRY}_product_tutor`,
16
+ CLICK_TUTOR_BACK: `${DataHubActions.CLICK}_tutor_back`,
17
+ CLICK_TUTOR_HISTORY: `${DataHubActions.CLICK}_tutor_history`,
18
+ CLICK_TUTOR_INFO: `${DataHubActions.CLICK}_tutor_info`,
19
+ CLICK_TUTOR_KNOW_MORE: `${DataHubActions.CLICK}_tutor_know_more`,
20
+ CLICK_TUTOR_ONBOARDING_START: `${DataHubActions.CLICK}_tutor_onboarding_start`,
21
+ CLICK_TUTOR_TEST_KNOWLEDGE: `${DataHubActions.CLICK}_tutor_test_knowledge`,
22
+ CLOSE_TUTOR_ONBOARDING: `${DataHubActions.CLOSE}_tutor_onboarding`
16
23
  } as const
@@ -24,7 +24,14 @@ export const Result = {
24
24
  export const ComponentNames = {
25
25
  BUTTON_LIKE_ANSWER: 'BUTTON_LIKE_ANSWER',
26
26
  BUTTON_DISLIKE_ANSWER: 'BUTTON_DISLIKE_ANSWER',
27
- BUTTON_CLOSE_TUTOR_CHAT: 'BUTTON_CLOSE_TUTOR_CHAT'
27
+ BUTTON_CLOSE_TUTOR_CHAT: 'BUTTON_CLOSE_TUTOR_CHAT',
28
+ PRODUCT_CONSUME_CLICK_TUTOR_BACK: 'product_consume_click_tutor_back',
29
+ PRODUCT_CONSUME_CLICK_TUTOR_HISTORY: 'product_consume_click_tutor_history',
30
+ PRODUCT_CONSUME_CLICK_TUTOR_INFO: 'product_consume_click_tutor_info',
31
+ PRODUCT_CONSUME_CLICK_TUTOR_KNOW_MORE: 'product_consume_click_tutor_know_more',
32
+ PRODUCT_CONSUME_CLICK_TUTOR_ONBOARDING_START: 'product_consume_click_tutor_onboarding_start',
33
+ PRODUCT_CONSUME_CLICK_TUTOR_TEST_KNOWLEDGE: 'product_consume_click_tutor_test_knowledge',
34
+ PRODUCT_CONSUME_CLOSE_TUTOR_ONBOARDING: 'product_consume_close_tutor_onboarding'
28
35
  } as const
29
36
 
30
37
  export const ComponentSource = {
@@ -0,0 +1,51 @@
1
+ import { ScreenNames } from '../constants'
2
+ import { DataHubEntities } from '../entities'
3
+ import type { ComponentNamesType, DataHubEntityTypes, ScreenNamesType } from '../types'
4
+
5
+ import BaseProductSchema from './base-product-schema'
6
+ import { ProductCategories } from './constants'
7
+ import type { ProductCategoriesType } from './types'
8
+
9
+ export type ConstructorArgs = {
10
+ componentName: ComponentNamesType
11
+ entity?: DataHubEntityTypes
12
+ isLogged?: boolean
13
+ screenName?: ScreenNamesType
14
+ productType?: ProductCategoriesType
15
+ }
16
+
17
+ abstract class BaseClickProductSchema extends BaseProductSchema {
18
+ protected componentName: ComponentNamesType
19
+ protected screenName: ScreenNamesType
20
+
21
+ entity: DataHubEntityTypes
22
+ isLogged: boolean
23
+
24
+ constructor(args: ConstructorArgs) {
25
+ const {
26
+ componentName,
27
+ entity = DataHubEntities.HOME,
28
+ isLogged = true,
29
+ screenName = ScreenNames.HOME_CONSUMER,
30
+ productType = ProductCategories.OnlineServices
31
+ } = args
32
+
33
+ super({ productType })
34
+
35
+ this.componentName = componentName
36
+ this.entity = entity
37
+ this.isLogged = isLogged
38
+ this.screenName = screenName
39
+ }
40
+
41
+ prepare() {
42
+ return {
43
+ ...super.prepare(),
44
+ componentName: this.componentName,
45
+ isLogged: this.isLogged,
46
+ screenName: this.screenName
47
+ }
48
+ }
49
+ }
50
+
51
+ export default BaseClickProductSchema
@@ -0,0 +1,52 @@
1
+ import { DataHubStore } from '..'
2
+ import { ScreenNames } from '../constants'
3
+ import { DataHubEntities } from '../entities'
4
+ import type { ComponentNamesType, DataHubEntityTypes, ScreenNamesType } from '../types'
5
+
6
+ import BaseSchema from './base-schema'
7
+
8
+ export type BaseCloseSchemaConstructorProps = {
9
+ componentName: ComponentNamesType
10
+ entity?: DataHubEntityTypes
11
+ isLogged?: boolean
12
+ screenName?: ScreenNamesType
13
+ }
14
+
15
+ abstract class BaseCloseSchema extends BaseSchema {
16
+ protected componentName: ComponentNamesType
17
+ protected screenName: ScreenNamesType
18
+
19
+ entity: DataHubEntityTypes
20
+ isLogged: boolean
21
+
22
+ constructor(args: BaseCloseSchemaConstructorProps) {
23
+ const {
24
+ componentName,
25
+ entity = DataHubEntities.HOME,
26
+ isLogged = true,
27
+ screenName = ScreenNames.HOME_CONSUMER
28
+ } = args
29
+
30
+ super()
31
+
32
+ this.componentName = componentName
33
+ this.entity = entity
34
+ this.isLogged = isLogged
35
+ this.screenName = screenName
36
+ }
37
+
38
+ prepare() {
39
+ return {
40
+ ...super.prepare(),
41
+ componentName: this.componentName,
42
+ connectionStatus: 'ONLINE',
43
+ entity: this.entity,
44
+ isLogged: this.isLogged,
45
+ productCategory: DataHubStore.product.category,
46
+ productId: DataHubStore.product.id,
47
+ screenName: this.screenName
48
+ }
49
+ }
50
+ }
51
+
52
+ export default BaseCloseSchema
@@ -0,0 +1,37 @@
1
+ import { DataHubStore } from '..'
2
+
3
+ import BaseSchema from './base-schema'
4
+ import type { ProductCategoriesType } from './types'
5
+
6
+ type ConstructorArgs = {
7
+ productType?: ProductCategoriesType
8
+ }
9
+
10
+ abstract class BaseProductSchema extends BaseSchema {
11
+ private productId: number
12
+ private productCategory: ProductCategoriesType
13
+ private connectionStatus: 'ONLINE' | 'OFFLINE'
14
+
15
+ constructor(
16
+ { productType = DataHubStore.product.category as ProductCategoriesType }: ConstructorArgs = {
17
+ productType: DataHubStore.product.category as ProductCategoriesType
18
+ }
19
+ ) {
20
+ super()
21
+
22
+ this.productId = DataHubStore.product.id
23
+ this.productCategory = productType
24
+ this.connectionStatus = 'ONLINE'
25
+ }
26
+
27
+ prepare() {
28
+ return {
29
+ ...super.prepare(),
30
+ productId: this.productId,
31
+ productCategory: this.productCategory,
32
+ connectionStatus: this.connectionStatus
33
+ }
34
+ }
35
+ }
36
+
37
+ export default BaseProductSchema
@@ -50,8 +50,6 @@ abstract class BaseSchema implements SchemaType, InitDataParams {
50
50
 
51
51
  prepare(): Record<string, unknown> {
52
52
  return {
53
- action: this.action,
54
- entity: this.entity,
55
53
  isLogged: this.isLogged,
56
54
  appVersion: this.appVersion,
57
55
  osVersion: this.osVersion,
@@ -8,3 +8,8 @@ export const UserRole = {
8
8
  ADMIN: 'ADMIN',
9
9
  CONSUMER: 'CONSUMER'
10
10
  } as const
11
+
12
+ export const ProductCategories = {
13
+ OnlineServices: 'category.online_services.name',
14
+ Ebook: 'category.ebook.name'
15
+ } as const
@@ -1,8 +1,6 @@
1
1
  import { chance } from '@/src/config/tests'
2
2
  import { DataHubStore } from '../../..'
3
- import { ActionNames } from '../../../actions'
4
3
  import { ComponentNames, ScreenNames } from '../../../constants'
5
- import { DataHubEntities } from '../../../entities'
6
4
  import { UserRole } from '../../constants'
7
5
  import ClickHotmartTutor from '../click-hotmart-tutor'
8
6
  import { ButtonReactions } from '../constants'
@@ -17,11 +15,9 @@ describe('ClickHotmartTutor', () => {
17
15
  }
18
16
 
19
17
  expect(new ClickHotmartTutor(event).getDataHubEventData()).toMatchObject({
20
- action: ActionNames.CLICK_HOTMART_TUTOR,
21
18
  appVersion: '',
22
19
  clubVersion: 'MEMBERSHIP',
23
20
  componentName: ComponentNames.BUTTON_DISLIKE_ANSWER,
24
- entity: DataHubEntities.HOME,
25
21
  hasAccess: event.hasAccess,
26
22
  isLogged: event.isLogged,
27
23
  membershipId: 'UNDEFINED',
@@ -58,11 +54,9 @@ describe('ClickHotmartTutor', () => {
58
54
  DataHubStore.initData(store)
59
55
 
60
56
  expect(new ClickHotmartTutor(event).getDataHubEventData()).toMatchObject({
61
- action: ActionNames.CLICK_HOTMART_TUTOR,
62
57
  appVersion: '',
63
58
  clubVersion: 'MEMBERSHIP',
64
59
  componentName: ComponentNames.BUTTON_LIKE_ANSWER,
65
- entity: DataHubEntities.HOME,
66
60
  hasAccess: event.hasAccess,
67
61
  isLogged: event.isLogged,
68
62
  membershipId: store.membershipId,
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../..'
5
+ import ClickTutorBackSchema from '../click-tutor-back'
6
+
7
+ describe('ClickTutorBackSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorBackSchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_BACK,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_BACK,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import ClickTutorHistorySchema from '../click-tutor-history'
6
+
7
+ describe('ClickTutorHistorySchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorHistorySchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_HISTORY,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_HISTORY,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import ClickTutorInfoSchema from '../click-tutor-info'
6
+
7
+ describe('ClickTutorInfoSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorInfoSchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_INFO,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_INFO,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import ClickTutorKnowMoreSchema from '../click-tutor-know-more'
6
+
7
+ describe('ClickTutorKnowMoreSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorKnowMoreSchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_KNOW_MORE,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_KNOW_MORE,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import ClickTutorOnboardingStartSchema from '../click-tutor-onboarding-start'
6
+
7
+ describe('ClickTutorOnboardingStartSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorOnboardingStartSchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_ONBOARDING_START,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_ONBOARDING_START,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import ClickTutorTestKnowledgeSchema from '../click-tutor-test-knowledge'
6
+
7
+ describe('ClickTutorTestKnowledgeSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new ClickTutorTestKnowledgeSchema()).toMatchObject({
10
+ action: ActionNames.CLICK_TUTOR_TEST_KNOWLEDGE,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_TEST_KNOWLEDGE,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,32 @@
1
+ import { ActionNames } from '../../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../../constants'
3
+ import { DataHubEntities } from '../../../entities'
4
+ import { ProductCategories, UserRole } from '../../constants'
5
+ import CloseTutorOnboardingSchema from '../close-tutor-onboarding'
6
+
7
+ describe('CloseTutorOnboardingSchema', () => {
8
+ it('should return the event correct data', () => {
9
+ expect(new CloseTutorOnboardingSchema()).toMatchObject({
10
+ action: ActionNames.CLOSE_TUTOR_ONBOARDING,
11
+ appVersion: '',
12
+ clubVersion: 'MEMBERSHIP',
13
+ componentName: ComponentNames.PRODUCT_CONSUME_CLOSE_TUTOR_ONBOARDING,
14
+ entity: DataHubEntities.PRODUCT_CONSUME,
15
+ isLogged: true,
16
+ membershipId: 'UNDEFINED',
17
+ membershipSlug: 'UNDEFINED',
18
+ osVersion: '537.36',
19
+ platform: 'WEB',
20
+ platformDetail: 'WebKit',
21
+ screenName: ScreenNames.HOME_CONSUMER,
22
+ sessionId: 'UNDEFINED',
23
+ ucode: 'UNDEFINED',
24
+ url: 'http://localhost:3000/',
25
+ userId: 0,
26
+ userRole: UserRole.CONSUMER,
27
+ productId: 0,
28
+ productCategory: ProductCategories.OnlineServices,
29
+ connectionStatus: 'ONLINE'
30
+ })
31
+ })
32
+ })
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorBackSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_BACK
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_BACK
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorBackSchema
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorHistorySchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_HISTORY
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_HISTORY
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorHistorySchema
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorInfoSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_INFO
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_INFO
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorInfoSchema
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorKnowMoreSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_KNOW_MORE
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_KNOW_MORE
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorKnowMoreSchema
@@ -2,9 +2,9 @@ import { ActionNames } from '../../actions'
2
2
  import { ComponentNames } from '../../constants'
3
3
  import { DataHubEntities } from '../../entities'
4
4
  import type { ActionNamesType } from '../../types'
5
- import BaseClickSchema from '../base-click-schema'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
6
 
7
- class ClickTutorMinimizeSchema extends BaseClickSchema {
7
+ class ClickTutorMinimizeSchema extends BaseClickProductSchema {
8
8
  action: ActionNamesType
9
9
 
10
10
  constructor() {
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorOnboardingStartSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_ONBOARDING_START
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_ONBOARDING_START
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorOnboardingStartSchema
@@ -0,0 +1,26 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class ClickTutorTestKnowledgeSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor() {
11
+ super({
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLICK_TUTOR_TEST_KNOWLEDGE
13
+ })
14
+
15
+ this.action = ActionNames.CLICK_TUTOR_TEST_KNOWLEDGE
16
+ this.entity = DataHubEntities.PRODUCT_CONSUME
17
+ }
18
+
19
+ getDataHubEventData(): Record<string, unknown> {
20
+ return {
21
+ ...super.prepare()
22
+ }
23
+ }
24
+ }
25
+
26
+ export default ClickTutorTestKnowledgeSchema
@@ -0,0 +1,33 @@
1
+ import { ActionNames } from '../../actions'
2
+ import { ComponentNames, ScreenNames } from '../../constants'
3
+ import { DataHubEntities } from '../../entities'
4
+ import type { ActionNamesType } from '../../types'
5
+ import BaseClickProductSchema from '../base-click-product-schema'
6
+
7
+ class CloseTutorOnboardingSchema extends BaseClickProductSchema {
8
+ action: ActionNamesType
9
+
10
+ constructor(
11
+ { componentName, screenName, entity } = {
12
+ componentName: ComponentNames.PRODUCT_CONSUME_CLOSE_TUTOR_ONBOARDING,
13
+ screenName: ScreenNames.HOME_CONSUMER,
14
+ entity: DataHubEntities.PRODUCT_CONSUME
15
+ }
16
+ ) {
17
+ super({
18
+ componentName,
19
+ screenName,
20
+ entity
21
+ })
22
+
23
+ this.action = ActionNames.CLOSE_TUTOR_ONBOARDING
24
+ }
25
+
26
+ getDataHubEventData(): Record<string, unknown> {
27
+ return {
28
+ ...this.prepare()
29
+ }
30
+ }
31
+ }
32
+
33
+ export default CloseTutorOnboardingSchema
@@ -1,4 +1,11 @@
1
1
  export { default as ClickHotmartTutor } from './click-hotmart-tutor'
2
+ export { default as ClickTutorBackSchema } from './click-tutor-back'
3
+ export { default as ClickTutorHistorySchema } from './click-tutor-history'
4
+ export { default as ClickTutorInfoSchema } from './click-tutor-info'
5
+ export { default as ClickTutorKnowMoreSchema } from './click-tutor-know-more'
2
6
  export { default as ClickTutorMinimizeSchema } from './click-tutor-minimize'
7
+ export { default as ClickTutorOnboardingStartSchema } from './click-tutor-onboarding-start'
8
+ export { default as ClickTutorTestKnowledgeSchema } from './click-tutor-test-knowledge'
9
+ export { default as CloseTutorOnboardingSchema } from './close-tutor-onboarding'
3
10
  export * from './constants'
4
11
  export * from './types'
@@ -1,9 +1,11 @@
1
- import type { ClubVersion, UserRole } from './constants'
1
+ import type { ClubVersion, ProductCategories, UserRole } from './constants'
2
2
 
3
3
  export type UserRoleType = (typeof UserRole)[keyof typeof UserRole]
4
4
 
5
5
  export type ClubVersionType = (typeof ClubVersion)[keyof typeof ClubVersion]
6
6
 
7
+ export type ProductCategoriesType = (typeof ProductCategories)[keyof typeof ProductCategories]
8
+
7
9
  export type SchemaBasedProps = {
8
10
  membershipSlug?: string
9
11
  membershipId?: string
@@ -2,6 +2,11 @@ import { UAParser } from 'ua-parser-js'
2
2
 
3
3
  import type { InitDataParams } from './types'
4
4
 
5
+ const defaultProduct = {
6
+ id: 0,
7
+ category: 'unknown'
8
+ }
9
+
5
10
  class DataHubStore {
6
11
  private instanceObj?: {
7
12
  userAgentParser: UAParser.IResult
@@ -14,13 +19,24 @@ class DataHubStore {
14
19
  userId: number
15
20
  membershipSlug: string
16
21
  membershipId: string
22
+ product: {
23
+ id: number
24
+ category: string
25
+ }
17
26
  }
18
27
 
19
28
  private get instance() {
20
29
  return this.instanceObj ?? this.resetData()
21
30
  }
22
31
 
23
- initData({ ucode, membershipId, membershipSlug, sessionId, userId }: InitDataParams) {
32
+ initData({
33
+ ucode,
34
+ membershipId,
35
+ membershipSlug,
36
+ sessionId,
37
+ userId,
38
+ product = defaultProduct
39
+ }: InitDataParams) {
24
40
  this.instance.userAgentParser = UAParser(navigator.userAgent)
25
41
  this.instance.browserInfo = this.instance.userAgentParser.browser
26
42
  this.instance.deviceType =
@@ -32,6 +48,7 @@ class DataHubStore {
32
48
  this.instance.userId = userId || 0
33
49
  this.instance.membershipSlug = membershipSlug
34
50
  this.instance.membershipId = membershipId
51
+ this.instance.product = product
35
52
  }
36
53
 
37
54
  resetData() {
@@ -47,7 +64,8 @@ class DataHubStore {
47
64
  sessionId: 'UNDEFINED',
48
65
  userId: 0,
49
66
  membershipSlug: 'UNDEFINED',
50
- membershipId: 'UNDEFINED'
67
+ membershipId: 'UNDEFINED',
68
+ product: defaultProduct
51
69
  }
52
70
 
53
71
  this.instanceObj = clearData
@@ -82,6 +100,10 @@ class DataHubStore {
82
100
  get membershipId() {
83
101
  return this.instance.membershipId
84
102
  }
103
+
104
+ get product() {
105
+ return this.instance.product
106
+ }
85
107
  }
86
108
 
87
109
  export default new DataHubStore()
@@ -34,4 +34,8 @@ export type InitDataParams = {
34
34
  userId: number
35
35
  membershipSlug: string
36
36
  membershipId: string
37
+ product?: {
38
+ id: number
39
+ category: string
40
+ }
37
41
  }
@@ -10,6 +10,9 @@ export const handlers = [
10
10
  http.all('https://tracking-api.buildstaging.com/rest/track/event/json/sync', () => {
11
11
  return HttpResponse.json({ ok: true })
12
12
  }),
13
+ http.all('https://tracking-api.buildstaging.com/rest/track/event/json', () => {
14
+ return HttpResponse.json({ ok: true })
15
+ }),
13
16
  http.all('https://c3po-api-auth.buildstaging.com/v1/auth/sparkie', () => {
14
17
  return HttpResponse.json({ ok: true })
15
18
  }),
@@ -20,7 +20,7 @@ if (devMode) {
20
20
  container.setAttribute('id', rootId)
21
21
  container.setAttribute(
22
22
  'class',
23
- 'bg-ai-dark fixed bottom-5 right-5 w-[27rem] h-[min(43rem,calc(100vh-2.5rem))] max-h-[calc(100vh-2.5rem)] z-10 rounded-[0.625rem] border border-neutral-200 shadow-lg overflow-hidden flex flex-col'
23
+ 'fixed bottom-5 right-5 w-[27rem] h-[min(43rem,calc(100vh-2.5rem))] max-h-[calc(100vh-2.5rem)] z-10 rounded-[0.625rem] border border-neutral-200 shadow-lg overflow-hidden flex flex-col'
24
24
  )
25
25
 
26
26
  // Theme setter
@@ -42,6 +42,7 @@ function HorizontalDraggableScroll({ children, className }: HorizontalDraggableS
42
42
 
43
43
  return (
44
44
  <div
45
+ id='tutor-ai-consumer-horizontal-draggable-scroll'
45
46
  ref={containerRef}
46
47
  onMouseDown={handleMouseDown}
47
48
  onMouseMove={handleMouseMove}
@@ -36,4 +36,4 @@
36
36
  top: 50%;
37
37
  left: 96%;
38
38
  transform: translateY(-50%) rotateZ(90deg);
39
- }
39
+ }
@@ -71,7 +71,12 @@ function useSendTextMessage() {
71
71
  router: questionParam ? 'summary' : undefined,
72
72
  osVersion: browserInfo.version,
73
73
  platformDetail: browserInfo.name,
74
- ucode: settings.user?.ucode
74
+ ucode: settings.user?.ucode,
75
+ agentProductId: settings.config?.metadata?.agentProductId,
76
+ agentName: settings.config?.metadata?.agentName,
77
+ courseName: settings.config?.metadata?.courseName,
78
+ source: settings.config?.metadata?.source,
79
+ prompt: settings.config?.metadata?.promptId
75
80
  },
76
81
  externalId: v4(),
77
82
  namespace: settings.namespace,
@@ -3,7 +3,12 @@ import clsx from 'clsx'
3
3
  import { useTranslation } from 'react-i18next'
4
4
 
5
5
  import { DataHubService } from '@/src/config/datahub'
6
- import { ClickTutorMinimizeSchema } from '@/src/config/datahub/schemas/tutor'
6
+ import {
7
+ ClickTutorBackSchema,
8
+ ClickTutorHistorySchema,
9
+ ClickTutorInfoSchema,
10
+ ClickTutorMinimizeSchema
11
+ } from '@/src/config/datahub/schemas/tutor'
7
12
  import { Button, Icon, Tooltip } from '@/src/lib/components'
8
13
  import { useMediaQuery } from '@/src/lib/hooks'
9
14
  import { TutorWidgetEvents } from '../../events'
@@ -25,10 +30,12 @@ function WidgetHeaderActions({
25
30
 
26
31
  const handleClickArchive = () => {
27
32
  setTab('chat')
33
+ DataHubService.sendEvent({ schema: new ClickTutorHistorySchema() })
28
34
  }
29
35
 
30
36
  const handleClickInfo = () => {
31
37
  setTab('information')
38
+ DataHubService.sendEvent({ schema: new ClickTutorInfoSchema() })
32
39
  }
33
40
 
34
41
  const handleClickExpand = () => {
@@ -98,8 +105,15 @@ function WidgetHeader({
98
105
 
99
106
  const hasToShowActions = useMemo(() => Number(actionButtons?.length) > 0, [actionButtons?.length])
100
107
 
108
+ const handleGoBack = () => {
109
+ goBack()
110
+ DataHubService.sendEvent({ schema: new ClickTutorBackSchema() })
111
+ }
112
+
101
113
  return (
102
- <div className='mb-4 mt-0.5 flex flex-col gap-2 text-neutral-900'>
114
+ <div
115
+ id='tutor-ai-consumer-widget-header'
116
+ className='mb-4 mt-0.5 flex flex-col gap-2 text-neutral-900'>
103
117
  <div className='flex justify-end'>
104
118
  <div className={styles.closeContainer}>
105
119
  <Button
@@ -119,7 +133,7 @@ function WidgetHeader({
119
133
  })}>
120
134
  {enabledButtons.includes('arrow-left') && (
121
135
  <div>
122
- <Button aria-label='Arrow Left Icon' onClick={goBack}>
136
+ <Button aria-label='Arrow Left Icon' onClick={handleGoBack}>
123
137
  <Icon name='arrow-left' className='h-3.5 w-3.5' aria-hidden />
124
138
  </Button>
125
139
  </div>
@@ -23,7 +23,9 @@ function PageLayout({ asideChild, children, className }: PageLayoutProps) {
23
23
  {children}
24
24
  </div>
25
25
  {asideChild && (
26
- <div className='grid-area-[aside] flex-shrink-0 border-t border-t-neutral-300 px-5 py-4'>
26
+ <div
27
+ id='tutor-ai-consumer-page-layout-aside'
28
+ className='grid-area-[aside] flex-shrink-0 border-t border-t-neutral-300 px-5 py-4'>
27
29
  {asideChild}
28
30
  </div>
29
31
  )}
@@ -0,0 +1,2 @@
1
+ export * from './quick-action-buttons'
2
+ export { default as QuickActionButtons } from './quick-action-buttons'
@@ -0,0 +1,74 @@
1
+ import { useMemo } from 'react'
2
+ import type { CSSProperties, MouseEventHandler } from 'react'
3
+ import { useTranslation } from 'react-i18next'
4
+
5
+ import { DataHubService } from '@/src/config/datahub'
6
+ import {
7
+ ClickTutorKnowMoreSchema,
8
+ ClickTutorTestKnowledgeSchema
9
+ } from '@/src/config/datahub/schemas/tutor'
10
+ import { Button, HorizontalDraggableScroll } from '@/src/lib/components'
11
+
12
+ export type QuickActionButtonsProps = {
13
+ send: (textContent?: string | null) => void
14
+ loading?: boolean
15
+ isDarkTheme?: boolean
16
+ className?: string
17
+ }
18
+
19
+ function QuickActionButtons({
20
+ send,
21
+ className,
22
+ loading = false,
23
+ isDarkTheme = false
24
+ }: QuickActionButtonsProps) {
25
+ const { t } = useTranslation()
26
+ const actionButtonStyle = useMemo(
27
+ () =>
28
+ isDarkTheme
29
+ ? undefined
30
+ : ({
31
+ '--gradient-btn-hover-foreground': '#0d0d0d'
32
+ } as CSSProperties),
33
+ [isDarkTheme]
34
+ )
35
+
36
+ const handleAskQuestion: MouseEventHandler<HTMLButtonElement> = (e) => {
37
+ send(e?.currentTarget?.querySelector('span[data-label=text-content]')?.textContent)
38
+ }
39
+
40
+ const handleAskToKnowMore: MouseEventHandler<HTMLButtonElement> = (e) => {
41
+ handleAskQuestion(e)
42
+ DataHubService.sendEvent({ schema: new ClickTutorKnowMoreSchema() })
43
+ }
44
+
45
+ const handleAskToTestKnowledge: MouseEventHandler<HTMLButtonElement> = (e) => {
46
+ handleAskQuestion(e)
47
+ DataHubService.sendEvent({ schema: new ClickTutorTestKnowledgeSchema() })
48
+ }
49
+
50
+ return (
51
+ <HorizontalDraggableScroll className={className}>
52
+ <Button
53
+ variant='gradient-outline'
54
+ style={actionButtonStyle}
55
+ className='ml-5 shrink-0 text-sm'
56
+ onClick={handleAskToKnowMore}
57
+ loading={loading}>
58
+ <span>🤖 </span>
59
+ {t('starter_page.what_does_tutor_do')}
60
+ </Button>
61
+ <Button
62
+ variant='gradient-outline'
63
+ style={actionButtonStyle}
64
+ className='mr-5 shrink-0 text-sm'
65
+ onClick={handleAskToTestKnowledge}
66
+ loading={loading}>
67
+ <span>📝 </span>
68
+ {t('starter_page.test_me')}
69
+ </Button>
70
+ </HorizontalDraggableScroll>
71
+ )
72
+ }
73
+
74
+ export default QuickActionButtons
@@ -1,9 +1,7 @@
1
1
  import { useEffect, useMemo, useRef } from 'react'
2
2
  import { useQueryClient } from '@tanstack/react-query'
3
- import type { CSSProperties, MouseEventHandler } from 'react'
4
3
  import { useTranslation } from 'react-i18next'
5
4
 
6
- import { Button, HorizontalDraggableScroll } from '@/src/lib/components'
7
5
  import { useMediaQuery, useRefEventListener } from '@/src/lib/hooks'
8
6
  import { ChatInput, useChatInputValueAtom } from '@/src/modules/messages/components'
9
7
  import { getAllMessagesQuery, useSendTextMessage } from '@/src/modules/messages/hooks'
@@ -14,6 +12,7 @@ import { useWidgetSettingsAtom, useWidgetTabsAtom } from '../../store'
14
12
  import { GreetingsCard } from '../greetings-card'
15
13
  import { WidgetHeader } from '../header'
16
14
  import { PageLayout } from '../page-layout'
15
+ import { QuickActionButtons } from '../quick-action-buttons'
17
16
 
18
17
  function WidgetStarterPage() {
19
18
  const { t } = useTranslation()
@@ -53,10 +52,6 @@ function WidgetStarterPage() {
53
52
  })
54
53
  }
55
54
 
56
- const handleAskQuestion: MouseEventHandler<HTMLButtonElement> = (e) => {
57
- sendText(e?.currentTarget?.querySelector('span[data-label=text-content]')?.textContent)
58
- }
59
-
60
55
  const handleSend = () => {
61
56
  sendText(chatInputRef.current?.value)
62
57
  }
@@ -75,16 +70,6 @@ function WidgetStarterPage() {
75
70
  [conversationId, limit, profileId]
76
71
  )
77
72
 
78
- const actionButtonStyle = useMemo(
79
- () =>
80
- isDarkTheme
81
- ? undefined
82
- : ({
83
- '--gradient-btn-hover-foreground': '#0d0d0d'
84
- } as CSSProperties),
85
- [isDarkTheme]
86
- )
87
-
88
73
  useEffect(() => {
89
74
  if (!conversationId || !profileId) return
90
75
 
@@ -113,30 +98,16 @@ function WidgetStarterPage() {
113
98
  <GreetingsCard
114
99
  author={settings?.user?.name?.split(' ')?.[0]}
115
100
  tutorName={name}
116
- isDarkTheme={settings?.config?.theme === 'dark'}
101
+ isDarkTheme={isDarkTheme}
117
102
  />
118
103
  </div>
119
104
  </div>
120
- <HorizontalDraggableScroll className='grid-area-[b] my-4 flex flex-shrink-0 snap-x snap-mandatory gap-2 overflow-x-auto whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden'>
121
- <Button
122
- variant='gradient-outline'
123
- style={actionButtonStyle}
124
- className='ml-5 shrink-0 text-sm'
125
- onClick={handleAskQuestion}
126
- loading={!isSparkieReady}>
127
- <span>🤖 </span>
128
- {t('starter_page.what_does_tutor_do')}
129
- </Button>
130
- <Button
131
- variant='gradient-outline'
132
- style={actionButtonStyle}
133
- className='mr-5 shrink-0 text-sm'
134
- onClick={handleAskQuestion}
135
- loading={!isSparkieReady}>
136
- <span>📝 </span>
137
- {t('starter_page.test_me')}
138
- </Button>
139
- </HorizontalDraggableScroll>
105
+ <QuickActionButtons
106
+ className='grid-area-[b] my-4 flex flex-shrink-0 snap-x snap-mandatory gap-2 overflow-x-auto whitespace-nowrap [scrollbar-width:none] [&::-webkit-scrollbar]:hidden'
107
+ isDarkTheme={isDarkTheme}
108
+ send={sendText}
109
+ loading={!isSparkieReady}
110
+ />
140
111
  </div>
141
112
  </PageLayout>
142
113
  )
@@ -15,7 +15,11 @@ const init = async (settings: WidgetSettingProps) => {
15
15
  membershipId: settings.membershipId ?? '',
16
16
  membershipSlug: settings.membershipSlug ?? '',
17
17
  sessionId: settings.sessionId,
18
- userId: Number(settings.userId)
18
+ userId: Number(settings.userId),
19
+ product: {
20
+ id: Number(settings.productId) || 0,
21
+ category: settings.productType ?? ''
22
+ }
19
23
  })
20
24
  TutorWidgetEvents['tutor-app-widget-loaded'].dispatch()
21
25
  } catch (error) {
package/src/types.ts CHANGED
@@ -51,6 +51,14 @@ export type WidgetSettingProps = {
51
51
  classType?: ClassTypes
52
52
  config?: {
53
53
  theme?: Theme
54
+ metadata?: {
55
+ parent?: 'AGENT' | 'TUTOR'
56
+ agentProductId?: number
57
+ agentName?: string
58
+ courseName?: string
59
+ source?: string
60
+ promptId?: string
61
+ }
54
62
  }
55
63
  }
56
64