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:
parent
58dd6d37e0
commit
62d19911be
6 changed files with 9 additions and 11 deletions
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getContrastingTextColor } from 'shared/helpers/ColorHelper';
|
import { getContrastingTextColor } from '@chatwoot/utils';
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
title: {
|
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 FormTextArea from '../Form/TextArea';
|
||||||
import Spinner from 'shared/components/Spinner';
|
import Spinner from 'shared/components/Spinner';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { getContrastingTextColor } from 'shared/helpers/ColorHelper';
|
import { getContrastingTextColor } from '@chatwoot/utils';
|
||||||
import { required, minLength, email } from 'vuelidate/lib/validators';
|
import { required, minLength, email } from 'vuelidate/lib/validators';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
import { getContrastingTextColor } from '@chatwoot/utils';
|
||||||
import AvailableAgents from 'widget/components/AvailableAgents.vue';
|
import AvailableAgents from 'widget/components/AvailableAgents.vue';
|
||||||
import { getContrastingTextColor } from 'shared/helpers/ColorHelper';
|
|
||||||
import CustomButton from 'shared/components/Button';
|
import CustomButton from 'shared/components/Button';
|
||||||
import configMixin from 'widget/mixins/configMixin';
|
import configMixin from 'widget/mixins/configMixin';
|
||||||
import availabilityMixin from 'widget/mixins/availability';
|
import availabilityMixin from 'widget/mixins/availability';
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chatwoot/prosemirror-schema": "https://github.com/chatwoot/prosemirror-schema.git#7e8acadd10d7b932c0dc0bd0a18f804434f83517",
|
"@chatwoot/prosemirror-schema": "https://github.com/chatwoot/prosemirror-schema.git#7e8acadd10d7b932c0dc0bd0a18f804434f83517",
|
||||||
|
"@chatwoot/utils": "^0.0.3",
|
||||||
"@rails/actioncable": "6.1.3",
|
"@rails/actioncable": "6.1.3",
|
||||||
"@rails/webpacker": "5.3.0",
|
"@rails/webpacker": "5.3.0",
|
||||||
"@sentry/vue": "^5.30.0",
|
"@sentry/vue": "^5.30.0",
|
||||||
|
|
|
@ -1096,6 +1096,11 @@
|
||||||
prosemirror-state "^1.3.3"
|
prosemirror-state "^1.3.3"
|
||||||
prosemirror-view "^1.17.2"
|
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":
|
"@cnakazawa/watch@^1.0.3":
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
|
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue