# Toppr Ask-Expert

This is a React library which can be used for interacting with the tutors for doubt resolution of the students.

### Demo

> https://toppr-ask-expert.vercel.app

### Installation

To **install** the package, run the following command in the terminal

```
yarn add @toppr-engg/ask-expert
```

Install the **peer dependencies** in your project

```
yarn add react react-dom react-redux redux redux-saga
```

```javascript
import AskExpert from '@toppr-engg/ask-expert'
function App() {
  return (
    <AskExpert
      // required, specific to tenant
      clientId={string}
      // required, specific to tenant
      token={string}
      // optional, default to empty object
      askExpertAnswrData={object}
      // optional, defaults to prod
      apiBaseUrl={string}
    />
  )
}
```

### Sample Usage

```javascript
<AskExpert
  clientId={'YOUR_CLIENT_ID'}
  // Refer https://www.notion.so/toppr/Ask-Service-Integration-doc-4678a12881e44d11afad79b16f8cd55a for generating clientToken
  token={'YOUR_CLIENT_TOKEN'}
  askExpertAnswrData={{
    // This can be obtained by hitting DOC upload API and imageData can be obtained from its response
    imageData: {
      mediaLink: 'CDN/image.jpg',
      attachment: {
        id: 37989555,
        type: 'image',
        properties: { height: 1600, width: 1400 },
        uri: 'CDN.com/image.jpg',
        urls: {
          200: 'CDN/image.jpg',
          250: 'CDN/image.jpg',
          600: 'CDN/image.jpg',
          800: 'CDN/image.jpg',
          1200: 'CDN/image.jpg'
        }
      }
    },
    ctaKey: 'inline_curr_ques', // Which CTA invoked the package, terminilogy is your own to feed to analytics services
    subjectSlug: 'maths'
  }}
  // optional, defaults to prod
  apiBaseUrl={string}
/>
```

### List of subject slugs for Toppr

- physics
- chemistry
- maths
- biology
- civics
- english
- geography
- history
- economics
- mental-ability
- science
- evs
- accountancy
- bio-chemistry
- book-keeping-accountancy
- commerce
- elements-of-accounts
- english-language
- general-knowledge
- logical-reasoning
- quantitative-aptitude
- reasoning-ability
- science
- sociology
- social-studies
