@toppr-engg/ask-tutor 0.3.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.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Toppr ask-tutor
2
+
3
+ This is a React library which can be used for interacting with the tutors for doubt resolution of the students.
4
+
5
+ To **install** the package, run the following command in the terminal
6
+
7
+ _npm install @toppr-engg/ask-tutor_
8
+
9
+ or
10
+
11
+ _yarn add @toppr-engg/ask-tutor_
12
+
13
+ ### Install the Peer Dependencies in your project
14
+
15
+ _yarn add react react-dom react-redux redux redux-saga_
16
+
17
+ ```javascript
18
+ import InstaLearn from '@toppr-engg/ask-tutor'
19
+ function App() {
20
+ return (
21
+ <InstaLearn
22
+ clientId={clientId} //required --> string
23
+ token={token} //required --> string
24
+ apiBaseUrl={apiBaseUrl} //optional --> string. Determines which env(preprod or prod) to initiate for doubts module
25
+ chatImage={chatImage} //optional --> object --> image data from doc upload to render image in one-to-one chat window
26
+ queryImage={queryImage} //optional --> object --> image data from doc upload API to start a new tutor session with image as a question
27
+ queryText={queryText} //optional --> string --> a query string to start a new tutor session with text as a question
28
+ subjectList={subjectList} //required --> array of strings --> Array of subject names to be passed to show some or all of those subjects in the subject selection screen - Tenant driven
29
+ subjectId={subjectId} //optional --> string --> Preferred for auto-detection of subject. If skipped, the subject selection screen is shown in doubts package
30
+ showSessionList={showSessionList} //optional --> boolean --> To render the chat history list for the user
31
+ onModalCloseCallback={onModalCloseCallback} // To handle event related to close of doubts package
32
+ searchResultCount={searchResultCount} // --> number --> count of searched results
33
+ handleToggleAskDoubtButton={handleToggleAskDoubtButton} //required --> function --> To enable/disable Ask-a-doubt Button based on liveSessionCount passed as a params in the function.
34
+ handleSessionInMeet={handleSessionInMeet} // optional --> function --> To enable/disable the header based on params passed in a function.
35
+ handleNotificationEvent={handleNotificationEvent} // optional --> function --> to handle notificationEvent based on params passed in function
36
+ collapsedState={collapsedState} // optional --> bool --> true --> to open live in collapsed state and vice-versa
37
+ handleGoToHomeClick={handleGoToHomeClick} //optional --> func --> redirect to homepage
38
+ preventSocketConnections={preventSocketConnections} //optional --> boolean --> to prevent the socket connection. --> by default it is false.
39
+ isChatOnly={isChatOnly} //optional --> boolean --> by default false --> to enable the chat feature only when isChatOnly is true.
40
+ />
41
+ )
42
+ }
43
+ ```
44
+
45
+ ### Function Definitions
46
+
47
+ ```javascript
48
+ // callback to handle notificationEvent based on params
49
+ // @param {string} event - event Name
50
+ // @param {object} payload - data based on that particular event
51
+ function handleNotificationEvent({ event, payload }) {}
52
+
53
+ // callback to enable/disable the header based on params
54
+ // @param {boolean} inMeet - true --> disable the header and vice-versa
55
+ function handleSessionInMeet({ inMeet }) {}
56
+
57
+ // callback to enable/disable Ask-a-doubt Button based on params
58
+ // @param {number} liveSessionCount - total no. of live session
59
+ // @param {number} nVideoSession - no. of video session (closed + active)
60
+
61
+ function handleToggleAskDoubtButton({ liveSessionCount, nVideoSession }) {}
62
+
63
+ // event related to close of Insta learn Session
64
+
65
+ function onModalCloseCallback() {}
66
+ ```
67
+
68
+ > clientId and token are to be generated by tenant app. For token generation process, refer https://www.notion.so/toppr/Ask-Service-Integration-doc-4678a12881e44d11afad79b16f8cd55a
69
+
70
+ > subjectList is tenant driven. What you pass is what yo get to see in doubts package
71
+
72
+ > For the Subject Confidence Flow, if the confidence is high then send the subjectId as a prop and through that the new session will be automatically created for the subject and the chat screen will open.
73
+ > If subjectId is not passed then the manual subject selection screen will be shown.