odaptos_design_system 1.4.132 → 1.4.133

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.
@@ -1,17 +1,4 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- interface TaskItem {
3
- _id: string;
4
- description: string;
5
- url: string;
6
- name: string;
7
- index: number;
8
- notes: string;
9
- type: 'task' | 'question';
10
- timedTask: boolean;
11
- totalSeconds: number;
12
- successSeconds: number;
13
- failureSeconds: number;
14
- }
15
2
  export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
16
3
  goBackText?: string;
17
4
  goBack?: () => void;
@@ -21,10 +8,10 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
21
8
  startInterviewTitle?: string;
22
9
  startInterviewBtnTitle?: string;
23
10
  startInterviewIcon?: JSX.Element;
24
- startInterview?: (task: TaskItem) => void;
25
- tasks: TaskItem[];
26
- sendTask: (task: TaskItem) => void;
27
- currentTask?: TaskItem;
11
+ startInterview?: (task: any) => void;
12
+ tasks: any[];
13
+ sendTask: (task: any) => void;
14
+ currentTask?: any;
28
15
  chatInputPlaceholder?: string;
29
16
  chatInputValue?: string;
30
17
  chatInputonChange?: (message: string) => void;
@@ -37,4 +24,3 @@ export interface ChatProps extends HTMLAttributes<HTMLDivElement> {
37
24
  idsTasksAlreadySent: string[];
38
25
  }
39
26
  export declare const Chat: ({ goBackText, goBack, chatTitle, welcomeTitle, welcomeDescription, startInterviewTitle, startInterviewBtnTitle, startInterviewIcon, startInterview, tasks, sendTask, currentTask, chatInputPlaceholder, chatInputValue, chatInputonChange, sendMessage, className, isTaskMode, isInterviewer, messages, idsTasksAlreadySent, ...props }: ChatProps) => React.JSX.Element;
40
- export {};
@@ -9218,27 +9218,30 @@ const Chat = ({
9218
9218
  }), /*#__PURE__*/React__default.createElement("div", {
9219
9219
  className: `${styles$d.tasks_container} ${styles$d.no_scrollbar}`
9220
9220
  }, isTaskMode ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, tasks.map(task => {
9221
- if (task.type === 'question' || task.type === 'task' || task.type === 'scenario' && isInterviewer) return /*#__PURE__*/React__default.createElement(Task, {
9222
- key: task._id,
9223
- taskNumber: `${task.type === 'task' ? 'Task' : task.type === 'question' ? 'Question' : 'Scenario'} #${task.index}`,
9224
- taskTitle: task.description,
9225
- url: task.url,
9226
- notes: task.notes,
9227
- state: idsTasksAlreadySent.includes(task._id) ? 'disabled' : currentTask && currentTask._id === task._id ? 'active' : 'idle',
9228
- task: task,
9229
- sendTask: () => {
9230
- if (task.type === 'task' || task.type === 'question') sendTask(task);else if (startInterview && task.type === 'scenario') startInterview(task);else return;
9231
- },
9232
- isDone: false,
9233
- isInterviewer: isInterviewer
9234
- });else if (task.type === 'scenario' && !isInterviewer) {
9235
- console.log('task', task);
9221
+ if (task.type === 'question' || task.type === 'task' || task.type === 'scenario' && isInterviewer) {
9222
+ const realTask = JSON.parse(task.body);
9223
+ return /*#__PURE__*/React__default.createElement(Task, {
9224
+ key: realTask._id,
9225
+ taskNumber: `${realTask.type === 'task' ? 'Task' : realTask.type === 'question' ? 'Question' : 'Scenario'} #${realTask.index}`,
9226
+ taskTitle: realTask.description,
9227
+ url: realTask.url,
9228
+ notes: realTask.notes,
9229
+ state: idsTasksAlreadySent.includes(realTask._id) ? 'disabled' : currentTask && currentTask._id === realTask._id ? 'active' : 'idle',
9230
+ task: realTask,
9231
+ sendTask: () => {
9232
+ if (realTask.type === 'task' || realTask.type === 'question') sendTask(realTask);else if (startInterview && realTask.type === 'scenario') startInterview(realTask);else return;
9233
+ },
9234
+ isDone: false,
9235
+ isInterviewer: isInterviewer
9236
+ });
9237
+ } else if (task.type === 'scenario' && !isInterviewer) {
9238
+ const scenario = JSON.parse(task.body);
9236
9239
  return /*#__PURE__*/React__default.createElement(Scenario, {
9237
- title: task.name,
9238
- description: task.description ?? '',
9239
- buttonText: task.url ? startInterviewBtnTitle : undefined,
9240
- buttonIcon: task.url ? startInterviewIcon : undefined,
9241
- url: task.url
9240
+ title: scenario.name,
9241
+ description: scenario.description ?? '',
9242
+ buttonText: scenario.url ? startInterviewBtnTitle : undefined,
9243
+ buttonIcon: scenario.url ? startInterviewIcon : undefined,
9244
+ url: scenario.url
9242
9245
  });
9243
9246
  } else return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
9244
9247
  })) : messages && messages.map(message => {