mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	chore: Add chatwoot utils package (#2307)
* add chatwoot utils package * remove color helper * replace contrasting text color with chatwoot util
This commit is contained in:
		| @@ -7,7 +7,7 @@ | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| import { getContrastingTextColor } from 'shared/helpers/ColorHelper'; | ||||
| import { getContrastingTextColor } from '@chatwoot/utils'; | ||||
| export default { | ||||
|   props: { | ||||
|     title: { | ||||
|   | ||||
| @@ -1,8 +0,0 @@ | ||||
| export const getContrastingTextColor = bgColor => { | ||||
|   const color = bgColor.replace('#', ''); | ||||
|   const r = parseInt(color.slice(0, 2), 16); | ||||
|   const g = parseInt(color.slice(2, 4), 16); | ||||
|   const b = parseInt(color.slice(4, 6), 16); | ||||
|   // http://stackoverflow.com/a/3943023/112731 | ||||
|   return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF'; | ||||
| }; | ||||
| @@ -56,7 +56,7 @@ import FormInput from '../Form/Input'; | ||||
| import FormTextArea from '../Form/TextArea'; | ||||
| import Spinner from 'shared/components/Spinner'; | ||||
| import { mapGetters } from 'vuex'; | ||||
| import { getContrastingTextColor } from 'shared/helpers/ColorHelper'; | ||||
| import { getContrastingTextColor } from '@chatwoot/utils'; | ||||
| import { required, minLength, email } from 'vuelidate/lib/validators'; | ||||
| export default { | ||||
|   components: { | ||||
|   | ||||
| @@ -29,8 +29,8 @@ | ||||
|  | ||||
| <script> | ||||
| import { mapGetters } from 'vuex'; | ||||
| import { getContrastingTextColor } from '@chatwoot/utils'; | ||||
| import AvailableAgents from 'widget/components/AvailableAgents.vue'; | ||||
| import { getContrastingTextColor } from 'shared/helpers/ColorHelper'; | ||||
| import CustomButton from 'shared/components/Button'; | ||||
| import configMixin from 'widget/mixins/configMixin'; | ||||
| import availabilityMixin from 'widget/mixins/availability'; | ||||
|   | ||||
| @@ -16,6 +16,7 @@ | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@chatwoot/prosemirror-schema": "https://github.com/chatwoot/prosemirror-schema.git#7e8acadd10d7b932c0dc0bd0a18f804434f83517", | ||||
|     "@chatwoot/utils": "^0.0.3", | ||||
|     "@rails/actioncable": "6.1.3", | ||||
|     "@rails/webpacker": "5.3.0", | ||||
|     "@sentry/vue": "^5.30.0", | ||||
|   | ||||
| @@ -1096,6 +1096,11 @@ | ||||
|     prosemirror-state "^1.3.3" | ||||
|     prosemirror-view "^1.17.2" | ||||
|  | ||||
| "@chatwoot/utils@^0.0.3": | ||||
|   version "0.0.3" | ||||
|   resolved "https://registry.yarnpkg.com/@chatwoot/utils/-/utils-0.0.3.tgz#40fbb6c6d1aed853b3c5189d0f4979d3ca185a2f" | ||||
|   integrity sha512-2KbA1r34IM2U58CUvsC9dEN3gsx5Dcc6uD1iHPFNC3zTsg8Tb+K7IQXxfZt+VAvV0fbniLzCuXt6h81Ds0aj6Q== | ||||
|  | ||||
| "@cnakazawa/watch@^1.0.3": | ||||
|   version "1.0.4" | ||||
|   resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Muhsin Keloth
					Muhsin Keloth