### Configuration File Example Source: https://github.com/get-chat/web-app/blob/master/README.md Example structure of the public/config.json file used for application configuration. It includes placeholders for API base URL, Sentry DSN, environment name, and other settings. ```json { "API_BASE_URL": "${APP_API_BASE_URL}", "APP_SENTRY_DSN": "${APP_SENTRY_DSN}", "APP_ENV_NAME": "${APP_ENV_NAME}", "APP_SENTRY_TAG_CLIENT": "${APP_SENTRY_TAG_CLIENT}", "APP_NOTIFICATIONS_LIMIT_PER_MINUTE": "${APP_NOTIFICATIONS_LIMIT_PER_MINUTE}", "APP_GOOGLE_MAPS_API_KEY": "${APP_GOOGLE_MAPS_API_KEY}", "APP_IS_READ_ONLY": "${APP_IS_READ_ONLY}" } ``` -------------------------------- ### Run Docker Container Source: https://github.com/get-chat/web-app/blob/master/README.md Starts the get.chat web application using a pre-built Docker image. Requires an environment file for configuration and exposes the application on port 8080. ```shell docker run --rm --env-file=docker.env -p 127.0.0.1:8080:80 registry.gitlab.com/get.chat/wab-app: ``` -------------------------------- ### Development Server Start Source: https://github.com/get-chat/web-app/blob/master/README.md Runs the get.chat web application in development mode, typically accessible at http://localhost:3000. Includes hot-reloading and console lint error reporting. ```shell pnpm start ``` -------------------------------- ### Configure Web App Title and Assets with Environment Variables Source: https://github.com/get-chat/web-app/blob/master/public/index.html This snippet demonstrates how the web application uses EJS templating to conditionally render content based on environment variables. It checks for variables like REACT_APP_TITLE, REACT_APP_FAVICON_URL, REACT_APP_LOGO_192_URL, and REACT_APP_MANIFEST_URL to set application-specific configurations. If a variable is not set, a default value is used. ```ejs <% if (process.env.REACT_APP_FAVICON_URL) { %> <% } else { %> <% } %> <% if (process.env.REACT_APP_TITLE) { %> <% } else { %> <% } %> <% if (process.env.REACT_APP_LOGO_192_URL) { %> <% } else { %> <% } %> <% if (process.env.REACT_APP_MANIFEST_URL) { %> <% } else { %> <% } %> <% if (process.env.REACT_APP_TITLE) { %> %REACT_APP_TITLE% <% } else { %> get.chat Web App <% } %> ``` -------------------------------- ### Production Build Source: https://github.com/get-chat/web-app/blob/master/README.md Builds the get.chat web application for production deployment. Optimizes and minifies assets, placing them in the 'build' folder. ```shell pnpm build ``` -------------------------------- ### Build Docker Image from Pre-built App Source: https://github.com/get-chat/web-app/blob/master/README.md Builds a local Docker image for the frontend application after the production build (`pnpm build`) has been completed. Uses a specific Dockerfile for pre-built applications. ```shell docker build -t inbox-frontend:local -f docker/Dockerfile.prebuild . ``` -------------------------------- ### Run Tests Source: https://github.com/get-chat/web-app/blob/master/README.md Executes the test suite for the get.chat web application. ```shell pnpm test ``` -------------------------------- ### Prettier Code Formatting Check Source: https://github.com/get-chat/web-app/blob/master/README.md Checks all project files for adherence to Prettier formatting rules and reports any discrepancies. ```shell pnpm lint:prettier ``` -------------------------------- ### Prettier Code Formatting Fix Source: https://github.com/get-chat/web-app/blob/master/README.md Automatically formats all project files according to Prettier rules, fixing any formatting issues. ```shell pnpm lint:prettier:fix ``` -------------------------------- ### Pre-commit Hook Linting Source: https://github.com/get-chat/web-app/blob/master/README.md Runs staged files through linting checks as part of a pre-commit hook. Typically managed automatically. ```shell pnpm lint:staged ``` -------------------------------- ### robots.txt Configuration Source: https://github.com/get-chat/web-app/blob/master/public/robots.txt Defines rules for web crawlers. This specific configuration allows all user-agents to access all resources on the site by not specifying any disallowed paths. ```robots.txt User-agent: * Disallow: ``` -------------------------------- ### Web App Query Parameters Source: https://github.com/get-chat/web-app/blob/master/README.md Defines the available query parameters for customizing the get.chat web application's behavior and appearance. These parameters control language, UI elements, API integration, and filtering. ```APIDOC Query Parameters: - `lng`: Changes the language of the page. Requires an Alpha-2 country code. - `chat_only` or `chatonly`: Hides the sidebar for viewing a single chat. Accepts `1` (show) or `0` (hide). - `refresh_token`: Converts a Refresh Token to an Auth Token. See: https://docs.get.chat/wa-integration-api/#tag/Authorization/operation/convertRefreshToken - `keep_refresh_token`: Retains the refresh token after its initial use. See: https://docs.get.chat/wa-integration-api/#tag/Authorization/operation/convertRefreshToken - `integration_api_base_url`: Sets the base URL for the inbox API. - `cf_`: Filters chats initially using filters documented at: https://docs.get.chat/wa-integration-api/#tag/Chats/operation/listChats. Prefix with `cf_`. - `hide_logo`: Hides the get.chat logo during loading. Accepts `1` (hide) or `0` (show). - `maximize`: Maximizes the application container by removing margins. Accepts `1` (maximize) or `0` (default). - `bg_color`: Sets the background color. Accepts hexadecimal color codes without the '#' prefix (e.g., `ff0000`). ``` -------------------------------- ### PO to JSON Translation Conversion Source: https://github.com/get-chat/web-app/blob/master/README.md Converts localization PO files to JSON format for use in the application. Requires specifying the target language. ```shell lang="en";i18next-conv --compatibilityJSON v4 -l $lang -s ./src/locales/${lang}/translation.po -t ./src/locales/${lang}/translation.json ``` -------------------------------- ### Add New Language Translation (Bash) Source: https://github.com/get-chat/web-app/blob/master/README.md Command to convert translation files for adding a new language. It uses i18next-conv to process a PO file and generate a JSON translation file. ```bash lang="en";i18next-conv --compatibilityJSON v4 -l $lang -s ./src/locales/${lang}/translation.po -t ./src/locales/${lang}/translation.json ``` -------------------------------- ### Iframe Clipboard API Permission Source: https://github.com/get-chat/web-app/blob/master/README.md Specifies the necessary `allow` attribute for iframes to enable clipboard operations within the get.chat web app. This is crucial for features like copying text or locations. ```html ``` -------------------------------- ### Disable Sentry Integration (JavaScript) Source: https://github.com/get-chat/web-app/blob/master/README.md Demonstrates how to disable Sentry integration by commenting out the Sentry.init call within the src/config/sentry.ts file. This is useful for development or when Sentry is not required. ```javascript // ***IMPORTS*** // Init storage type initStorageType(); // Load external config and render App axios .get(`/config.json`) .then((response) => { const config = response.data; // It is needed for ChatMessageModel window.config = config; // Init Sentry // if (!isLocalHost()) { // Sentry.init({ // debug: true, // dsn: config.APP_SENTRY_DSN, // release: packageJson.version, // integrations: [new Integrations.BrowserTracing()], // tracesSampleRate: 0.01, // beforeSend(event, hint) { // // Check if it is an exception, and if so, show the report dialog // if (event.exception) { // Sentry.showReportDialog({ eventId: event.event_id }); // } // return event; // }, // }); // } }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.