l-min-components 1.7.1333 → 1.7.1335
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/package.json
CHANGED
|
@@ -306,6 +306,8 @@ const AppMainLayout = ({ children }) => {
|
|
|
306
306
|
|
|
307
307
|
const messageKit = useMessageKit(); // useMessageKit
|
|
308
308
|
|
|
309
|
+
const [isAffiliateLoading, setIsAffiliateLoading] = useState(true);
|
|
310
|
+
|
|
309
311
|
const SetupRightBar = ({
|
|
310
312
|
accountType,
|
|
311
313
|
planState,
|
|
@@ -424,6 +426,7 @@ const AppMainLayout = ({ children }) => {
|
|
|
424
426
|
// setAccountType={setAffiliatesActive}
|
|
425
427
|
generalData={generalData}
|
|
426
428
|
onChange={(v) => setAffiliateAccount(v)}
|
|
429
|
+
setIsAffiliateLoading={setIsAffiliateLoading}
|
|
427
430
|
/>
|
|
428
431
|
)}
|
|
429
432
|
|
|
@@ -441,6 +444,7 @@ const AppMainLayout = ({ children }) => {
|
|
|
441
444
|
) : window.location.pathname.includes("instructor") &&
|
|
442
445
|
!planState &&
|
|
443
446
|
!userPlanData?.loading &&
|
|
447
|
+
!isAffiliateLoading &&
|
|
444
448
|
!affiliateAccount?.id ? (
|
|
445
449
|
<div className="instructor_expired">
|
|
446
450
|
<h1>Dashboard</h1>
|
|
@@ -11,7 +11,11 @@ import FullPageLoader from "../fullPageLoader";
|
|
|
11
11
|
import deleteCookies from "./deleteCookies";
|
|
12
12
|
import { OutletContext } from "..";
|
|
13
13
|
|
|
14
|
-
const InstructorAccountSwitcher = ({
|
|
14
|
+
const InstructorAccountSwitcher = ({
|
|
15
|
+
generalData,
|
|
16
|
+
onChange,
|
|
17
|
+
setIsAffiliateLoading,
|
|
18
|
+
}) => {
|
|
15
19
|
// const [expiryFlow, setExpiryFlow] = useState();
|
|
16
20
|
const [switchValue, setSwitchValue] = useState(null);
|
|
17
21
|
const [selectedValue, setSelectedValue] = useState(null);
|
|
@@ -134,9 +138,11 @@ const InstructorAccountSwitcher = ({ generalData, onChange }) => {
|
|
|
134
138
|
// store cookie
|
|
135
139
|
setCookie(cookie);
|
|
136
140
|
onChange({ id: cookie });
|
|
141
|
+
setIsAffiliateLoading(false);
|
|
137
142
|
} else {
|
|
138
143
|
setSwitchValue(null);
|
|
139
144
|
onChange(null);
|
|
145
|
+
setIsAffiliateLoading(false);
|
|
140
146
|
}
|
|
141
147
|
}, [prioritizedAffiliateId]);
|
|
142
148
|
|
|
@@ -162,6 +168,9 @@ const InstructorAccountSwitcher = ({ generalData, onChange }) => {
|
|
|
162
168
|
}
|
|
163
169
|
}, [getAllAffiliateData?.data]);
|
|
164
170
|
|
|
171
|
+
//useeffect to supply loading state
|
|
172
|
+
useEffect(() => {}, [getAllAffiliateData]);
|
|
173
|
+
|
|
165
174
|
return getAllAffiliateData?.data?.results?.length > 0 && !search ? (
|
|
166
175
|
<>
|
|
167
176
|
{(setDefaultAffiliateData?.loading ||
|
package/src/utils/useAiUtils.js
CHANGED
|
@@ -44,8 +44,64 @@ const setupAnalysis = (data, otherValues = {}) => {
|
|
|
44
44
|
return null;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
const getDialogueByModal = (ai_model_data) => {
|
|
48
|
+
if (!ai_model_data) return [];
|
|
49
|
+
const speech_analysis_list = ai_model_data?.data?.speech_analysis;
|
|
50
|
+
const dialogues = speech_analysis_list?.map((item) => {
|
|
51
|
+
const data = Object.values(item?.attempt_data)?.[0];
|
|
52
|
+
return {
|
|
53
|
+
data,
|
|
54
|
+
audioText: item?.model_data ? getResponse(item?.model_data) : undefined,
|
|
55
|
+
setupAnalysis: item?.model_data
|
|
56
|
+
? setupAnalysis(
|
|
57
|
+
{ speech_analysis: [{ model_data: item?.model_data }] },
|
|
58
|
+
{ audio: data?.recording }
|
|
59
|
+
)
|
|
60
|
+
: undefined,
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
return dialogues;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const getQuizByModal = (ai_model_data) => {
|
|
67
|
+
if (!ai_model_data) return [];
|
|
68
|
+
|
|
69
|
+
const speech_analysis_list = ai_model_data?.data?.speech_analysis;
|
|
70
|
+
|
|
71
|
+
const grammerSetup = (audio_id) => {
|
|
72
|
+
if (!audio_id) return undefined;
|
|
73
|
+
const grammer_list = ai_model_data?.data?.grammar;
|
|
74
|
+
|
|
75
|
+
if (!grammer_list || grammer_list?.length === 0) return undefined;
|
|
76
|
+
const findGrammer = grammer_list?.find(
|
|
77
|
+
(item) => item?.attempt_data?.recording?.id === audio_id
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return [{ model_data: findGrammer?.model_data }];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const quizist = speech_analysis_list?.map((item) => {
|
|
84
|
+
const data = item?.attempt_data;
|
|
85
|
+
return {
|
|
86
|
+
data,
|
|
87
|
+
audioText: item?.model_data ? getResponse(item?.model_data) : undefined,
|
|
88
|
+
setupAnalysis: item?.model_data
|
|
89
|
+
? setupAnalysis(
|
|
90
|
+
{
|
|
91
|
+
speech_analysis: [{ model_data: item?.model_data }],
|
|
92
|
+
grammar: grammerSetup(data?.recording?.id),
|
|
93
|
+
},
|
|
94
|
+
{ audio: data?.recording || data, student_text: data?.text }
|
|
95
|
+
)
|
|
96
|
+
: undefined,
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return quizist;
|
|
101
|
+
};
|
|
102
|
+
|
|
47
103
|
const useAiUtils = () => {
|
|
48
|
-
return { setupAnalysis, getResponse };
|
|
104
|
+
return { setupAnalysis, getResponse, getDialogueByModal, getQuizByModal };
|
|
49
105
|
};
|
|
50
106
|
|
|
51
107
|
export default useAiUtils;
|