# FAQs

<details>

<summary><strong>Q1. What are the pre-requisites for setting up DIGIT?</strong></summary>

i) Install Vs Code -

* [vs code for windows](https://code.visualstudio.com/download)
* [vs code for Linux](https://code.visualstudio.com/download)

VS Code Extension -

* [GitLense](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
* [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
* [Tailwind CSS](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)

ii) Install Node JS -

* [Node Js For Windows](https://nodejs.org/en/download/)
* [Node Js For Linux](https://nodejs.org/en/download/)

iii) Install Postman - Postman is the tool we use to hit and test the APIs exposed by various services that we have. To install postman, follow the following links -

* [Postman for Windows](https://www.postman.com/downloads/)
* [Postman for Linux](https://dl.pstmn.io/download/latest/linux64)

</details>

<details>

<summary>Q2. <strong>How do we install Yarn?</strong></summary>

Install Yarn -

[Yarn For Linux](https://linuxhint.com/install_yarn_ubuntu/)

```
npm install --global yarn
yarn --version
```

</details>

<details>

<summary>Q3. How do we add Globalconfig in the DIGIT UI environment?</summary>

Local Environment: To enable it in local development, we need to add the JavaScript code block of globalconfig.js into the index.html

Path:- `micro-ui/web/public/index.html`

Link:- <https://github.com/egovernments/DIGIT-Dev/blob/master/frontend/micro-ui/web/public/index.html>

Script:-

```
<script src="https://path/to/public/s3/bucket/globalConfigs.js"></script>
```

```
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <link rel="icon" href="https://cdn.jsdelivr.net/npm/@egovernments/digit-ui-css/img/browser-icon.png"/>
    <link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.4.111/dist/index.css"/>
    <!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css/dist/index.css"/> -->
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="theme-color" content="#00bcd1"/>
    <title>mSeva</title>
     <script src="https://path/to/public/s3/bucket/globalConfigs.js"></script> 
   
</script>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.
      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.
      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>

```

Dev Environment: To enable it in the dev environment we need to add the javascript code block of telemetry into the\
Path:- DIGIT-DevOps/deploy-as-code/helm/environments/dev.yam

Link:-[ https://github.com/egovernments/DIGIT-Dev/blob/master/frontend/micro-ui/web/public/index.html](https://github.com/egovernments/DIGIT-Dev/blob/master/frontend/micro-ui/web/public/index.html)

```
<script src=https://path/to/public/s3/bucket/globalConfigs.js type=text/javascript></script>
```

```
employee:
  dashboard-url: "https://dashboard-pbuat.egovernments.org/s/w---s/app/kibana#/dashboard/4e687470-f3c7-11e8-8d09-b151e2b1cf8e?embed=true&_g=(refreshInterval%3A(pause%3A!f%2Cvalue%3A300000)%2Ctime%3A(from%3Anow-15m%2Cmode%3Aquick%2Cto%3Anow))"
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://path/to/public/s3/bucket/globalConfigs.js type=text/javascript></script>
      ';"

citizen:
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://path/to/public/s3/bucket/globalConfigs.js type=text/javascript></script>
      ';"

digit-ui:
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://path/to/public/s3/bucket/globalConfigs.js type=text/javascript></script>
      ';"

```

</details>

<details>

<summary><strong>5) In DIGIT UI, where do we need to add the .env file?</strong></summary>

Add the .env file in the example folder -

If the User is a citizen, then we will configure the .env file as follows:-

```
SKIP_PREFLIGHT_CHECK=true
REACT_APP_USER_TYPE=CITIZEN
REACT_APP_EMPLOYEE_TOKEN=c835932f-2ad4-4d05-83d6-49e0b8c59f8a
REACT_APP_CITIZEN_TOKEN=7cd58aae-30b3-41ed-a1b3-3417107a993c
REACT_APP_PROXY_API=https://dev.companyname.org
REACT_APP_PROXY_ASSETS=https://dev.companyname.org
REACT_APP_GLOBAL=https://path/to/public/s3/bucket/globalConfigs.js
REACT_APP_CENTRAL_GLOBAL=https://path/to/public/s3/bucket/statebglobalConfigs.js
REACT_APP_QA_GLOBAL=https://path/to/public/s3/bucket/egov-dev-assets/globalConfigs.js
REACT_APP_UAT_GLOBAL=https://path/to/public/s3/bucket/egov-uat-assets/globalConfigs.js
REACT_APP_STATEB_GLOBAL=https://path/to/public/s3/bucket/statebglobalConfigs.js
staging=https://staging.companyname.org
```

If the User is an Employee, then we configure the .env as follows:-

```
SKIP_PREFLIGHT_CHECK=true
REACT_APP_USER_TYPE=EMPLOYEE
REACT_APP_EMPLOYEE_TOKEN=c835932f-2ad4-4d05-83d6-49e0b8c59f8a
REACT_APP_CITIZEN_TOKEN=7cd58aae-30b3-41ed-a1b3-3417107a993c
REACT_APP_PROXY_API=https://dev.companyname.org
REACT_APP_PROXY_ASSETS=https://dev.companyname.org
REACT_APP_GLOBAL=https://path/to/public/s3/bucket/globalConfigs.js
REACT_APP_CENTRAL_GLOBAL=https://path/to/public/s3/bucket/statebglobalConfigs.js
REACT_APP_QA_GLOBAL=https://path/to/public/s3/bucket/egov-dev-assets/globalConfigs.js
REACT_APP_UAT_GLOBAL=https://path/to/public/s3/bucket/egov-uat-assets/globalConfigs.js
REACT_APP_STATEB_GLOBAL=https://path/to/public/s3/bucket/statebglobalConfigs.js
staging=https://staging.companyname.org
```

</details>

\ <br>

**6) In DIGIT UI, where do we need to add the .env file when we run the React app from micro-ui/web?**

Add the .env file in the micro-ui/web/src/

```
REACT_APP_STATE_LEVEL_TENANT_ID=pb
REACT_APP_PROXY_URL=https://dev.companyname.org
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digit.org/platform/guides/developer-guide/ui-developer-guide/faqs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
