17 | Automatic translation, errors may occur. 18 |
19 |{text}
56 |Hvis du har noen flere spørsmål. Vennligst ta kontakt med oss igjen.
`, 26 | MessageCanvasTrayButton: `Start en ny chat`, 27 | InputPlaceHolder: `Skriv melding`, 28 | Today: `I dag`, 29 | Yesterday: `I går`, 30 | WelcomeMessage: `Velkommen til kundesupport`, 31 | SendMessageTooltip: `Send melding`, 32 | AttachFileImageTooltip: `Legg til fil`, 33 | Read: `Lest`, 34 | FieldValidationRequiredField: `Ugyldig innhold`, 35 | Save: 'Lagre', 36 | AttachFileInvalidSize: 'Filen er for stor. Maks størrelse: 10MB', 37 | AttachFileInvalidType: `Ugyldig filtype`, 38 | Connecting: 'Kobler til', 39 | Disconnected: 'Kobler fra', 40 | TypingIndicator: '{{name}} skriver...' 41 | }; 42 | 43 | const notificationBlocked: MultiLangText = { 44 | en: 'Notifications are blocked by the browser', 45 | no: 'Varsler er blokkert i nettleseren', 46 | }; 47 | 48 | const notificationAllowed: MultiLangText = { 49 | en: 'Notifications are enabled', 50 | no: 'Varsler er skrudd på', 51 | }; 52 | 53 | const notificationToggle: MultiLangText = { 54 | en: 'Enable notifications', 55 | no: 'Skru på varsler', 56 | }; 57 | 58 | const notificationSettings: MultiLangText = { 59 | en: 'This can be reset by clicking the lock icon next to the URL.', 60 | no: 'Endre ved å trykke på hengelåsikonet i adresselinjefeltet.', 61 | }; 62 | 63 | export default { 64 | entryPointLabel, 65 | predefinedMessage, 66 | norwegianUiTranslation, 67 | notificationBlocked, 68 | notificationAllowed, 69 | notificationToggle, 70 | notificationSettings, 71 | preEngagementFormMessage, 72 | }; 73 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@intility/flex-chat", 3 | "description": "Wrapped component with basic setup and theming based on Twilios WebChat Component", 4 | "version": "1.3.11", 5 | "license": "MIT", 6 | "deprecated": false, 7 | "author": { 8 | "name": "Christian Marker / Intility AS", 9 | "email": "christian.marker@intility.no" 10 | }, 11 | "contributors": [ 12 | { 13 | "name": "Eva Maria Dahlø / Intility AS", 14 | "email": "eva.maria.dahlo@intility.no" 15 | } 16 | ], 17 | "repository": { 18 | "url": "https://github.com/Intility/IntilityFlexChat" 19 | }, 20 | "bundle": "bundle/bundle.min.js", 21 | "main": "dist/index.js", 22 | "module": "es/index.js", 23 | "types": "types/src/index.d.ts", 24 | "scripts": { 25 | "start": "react-scripts start", 26 | "build": "run-s lint clean:build build:cjs build:es build:types", 27 | "build:watch": "babel src --out-dir dist --extensions \".ts,.tsx\" --watch --copy-files", 28 | "build:compile": "babel src --out-dir dist --extensions \".ts,.tsx\" --copy-files", 29 | "build:types": "tsc --project tsconfig.types.json", 30 | "build:cjs": "babel src --out-dir dist --extensions \".ts,.tsx\" --copy-files", 31 | "build:es": "babel src --out-dir es --extensions \".ts,.tsx\" --copy-files --env-name es", 32 | "clean:build": "rimraf dist es types bundle", 33 | "lint": "tsc && eslint src/**/*.ts[x]", 34 | "lint:fix": "eslint src/**/*.ts[x] --fix", 35 | "test": "react-scripts test", 36 | "eject": "react-scripts eject" 37 | }, 38 | "dependencies": { 39 | "@fortawesome/fontawesome-svg-core": "1.2.35", 40 | "@fortawesome/free-solid-svg-icons": "5.15.3", 41 | "@fortawesome/react-fontawesome": "0.1.14", 42 | "@twilio/flex-webchat-ui": "2.9.0", 43 | "axios": "0.21.1", 44 | "react-scripts": "4.0.3", 45 | "uuid": "8.3.2" 46 | }, 47 | "devDependencies": { 48 | "@babel/cli": "7.14.3", 49 | "@babel/core": "7.14.3", 50 | "@babel/plugin-proposal-class-properties": "7.13.0", 51 | "@babel/preset-env": "7.14.2", 52 | "@babel/preset-react": "7.13.13", 53 | "@babel/preset-typescript": "7.13.0", 54 | "@types/jest": "26.0.23", 55 | "@types/node": "15.3.0", 56 | "@types/react": "17.0.5", 57 | "@types/react-dom": "17.0.5", 58 | "@types/uuid": "8.3.0", 59 | "@typescript-eslint/eslint-plugin": "4.24.0", 60 | "@typescript-eslint/parser": "4.24.0", 61 | "eslint-config-prettier": "8.3.0", 62 | "eslint-plugin-prettier": "3.4.0", 63 | "husky": "6.0.0", 64 | "npm-run-all": "4.1.5", 65 | "prettier": "2.3.0", 66 | "react": "17.0.2", 67 | "react-dom": "17.0.2", 68 | "rimraf": "3.0.2", 69 | "typescript": "4.2.4" 70 | }, 71 | "babel": { 72 | "presets": [ 73 | "@babel/preset-env", 74 | "@babel/react", 75 | "@babel/preset-typescript" 76 | ], 77 | "plugins": [ 78 | "@babel/plugin-proposal-class-properties" 79 | ] 80 | }, 81 | "husky": { 82 | "hooks": { 83 | "pre-commit": "echo -e \"\\e[34mRunning Precommit hook \\e[39m \" && npm run lint:fix" 84 | } 85 | }, 86 | "browserslist": { 87 | "production": [ 88 | ">0.2%", 89 | "not dead", 90 | "not op_mini all" 91 | ], 92 | "development": [ 93 | "last 1 chrome version", 94 | "last 1 firefox version", 95 | "last 1 safari version" 96 | ] 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/components/TranslationBubbleBody.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect, useState } from 'react'; 2 | import useTranslation from '../hooks/useTranslation'; 3 | import { TranslateResponse } from '../interfaces/Translate'; 4 | import '../styles/TranslationBubbleBody.css'; 5 | 6 | interface TranslationBubbleBodyProps { 7 | key: string; 8 | message?: any; 9 | preferredLanguage: string; 10 | ref?: any; 11 | } 12 | 13 | const TranslationBubbleBody: React.FC94 | {getTranslation()?.text || message?.source?.state?.body || message?.source?.body} 95 |
96 | {!message.isFromMe && (message?.source?.state || message?.source?.body) && ( 97 |Error Initializing Chat
268 |Laster inn Chat
:Loading Chat
} 278 |