@gitlab/ui 66.20.0 → 66.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [66.22.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.21.0...v66.22.0) (2023-10-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlDuoChatMessageSources:** Implemented component ([8066320](https://gitlab.com/gitlab-org/gitlab-ui/commit/8066320214e88a8b75279eec1d82029bf8c3e9db))
7
+
8
+ # [66.21.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.20.0...v66.21.0) (2023-10-02)
9
+
10
+
11
+ ### Features
12
+
13
+ * **Popover:** Use heading scale ([7375d5e](https://gitlab.com/gitlab-org/gitlab-ui/commit/7375d5e20863543f62c82e26fc7dd45806401e19))
14
+
1
15
  # [66.20.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.19.0...v66.20.0) (2023-10-02)
2
16
 
3
17
 
@@ -0,0 +1,103 @@
1
+ import { GlIcon, GlLink } from '../../../../../../index';
2
+ import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ const i18n = {
6
+ MESSAGE_SOURCE: 'Source',
7
+ MESSAGE_SOURCES: 'Sources'
8
+ };
9
+ var script = {
10
+ name: 'GlDuoChatMessageSources',
11
+ components: {
12
+ GlIcon,
13
+ GlLink
14
+ },
15
+ props: {
16
+ /**
17
+ * The Array of the message sources.
18
+ */
19
+ sources: {
20
+ type: Array,
21
+ required: true
22
+ }
23
+ },
24
+ computed: {
25
+ sourceLabel() {
26
+ return this.sources.length > 1 ? i18n.MESSAGE_SOURCES : i18n.MESSAGE_SOURCES;
27
+ }
28
+ },
29
+ methods: {
30
+ getSourceIcon(sourceType) {
31
+ const currentSourceType = Object.values(DOCUMENTATION_SOURCE_TYPES).find(_ref => {
32
+ let {
33
+ value
34
+ } = _ref;
35
+ return value === sourceType;
36
+ });
37
+ return (currentSourceType === null || currentSourceType === void 0 ? void 0 : currentSourceType.icon) || 'document';
38
+ },
39
+ getSourceTitle(_ref2) {
40
+ let {
41
+ title,
42
+ source_type: sourceType,
43
+ stage,
44
+ group,
45
+ date,
46
+ author
47
+ } = _ref2;
48
+ if (title) {
49
+ return title;
50
+ }
51
+ if (sourceType === DOCUMENTATION_SOURCE_TYPES.DOC.value) {
52
+ if (stage && group) {
53
+ return `${stage} / ${group}`;
54
+ }
55
+ }
56
+ if (sourceType === DOCUMENTATION_SOURCE_TYPES.BLOG.value) {
57
+ if (date && author) {
58
+ return `${date} / ${author}`;
59
+ }
60
+ }
61
+ return i18n.MESSAGE_SOURCE;
62
+ }
63
+ }
64
+ };
65
+
66
+ /* script */
67
+ const __vue_script__ = script;
68
+
69
+ /* template */
70
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mt-4 gl-mr-3 gl-text-gray-600",attrs:{"data-testid":"duo-chat-message-sources"}},[(_vm.sources.length)?_c('span',[_vm._v(_vm._s(_vm.sourceLabel)+":")]):_vm._e(),_vm._v(" "),_c('ul',{staticClass:"gl-list-style-none gl-p-0 gl-m-0"},_vm._l((_vm.sources),function(source,index){return _c('li',{key:index,staticClass:"gl-display-flex gl-pt-3 gl-align-items-center",attrs:{"data-testid":"source-list-item"}},[(source.source_type)?_c('gl-icon',{staticClass:"gl-flex-shrink-0 gl-mr-2",attrs:{"name":_vm.getSourceIcon(source.source_type)}}):_vm._e(),_vm._v(" "),_c('gl-link',{attrs:{"href":source.source_url}},[_vm._v(_vm._s(_vm.getSourceTitle(source)))])],1)}),0)])};
71
+ var __vue_staticRenderFns__ = [];
72
+
73
+ /* style */
74
+ const __vue_inject_styles__ = undefined;
75
+ /* scoped */
76
+ const __vue_scope_id__ = undefined;
77
+ /* module identifier */
78
+ const __vue_module_identifier__ = undefined;
79
+ /* functional template */
80
+ const __vue_is_functional_template__ = false;
81
+ /* style inject */
82
+
83
+ /* style inject SSR */
84
+
85
+ /* style inject shadow dom */
86
+
87
+
88
+
89
+ const __vue_component__ = __vue_normalize__(
90
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
91
+ __vue_inject_styles__,
92
+ __vue_script__,
93
+ __vue_scope_id__,
94
+ __vue_is_functional_template__,
95
+ __vue_module_identifier__,
96
+ false,
97
+ undefined,
98
+ undefined,
99
+ undefined
100
+ );
101
+
102
+ export default __vue_component__;
103
+ export { i18n };
@@ -0,0 +1,21 @@
1
+ const DOCUMENTATION_SOURCE_TYPES = {
2
+ HANDBOOK: {
3
+ value: 'handbook',
4
+ icon: 'book'
5
+ },
6
+ DOC: {
7
+ value: 'doc',
8
+ icon: 'documents'
9
+ },
10
+ BLOG: {
11
+ value: 'blog',
12
+ icon: 'list-bulleted'
13
+ }
14
+ };
15
+ const MESSAGE_MODEL_ROLES = {
16
+ user: 'user',
17
+ system: 'system',
18
+ assistant: 'assistant'
19
+ };
20
+
21
+ export { DOCUMENTATION_SOURCE_TYPES, MESSAGE_MODEL_ROLES };
@@ -0,0 +1,31 @@
1
+ import { DOCUMENTATION_SOURCE_TYPES, MESSAGE_MODEL_ROLES } from './constants';
2
+
3
+ const MOCK_SOURCES = [{
4
+ title: 'GitLab Handbook',
5
+ source_type: DOCUMENTATION_SOURCE_TYPES.HANDBOOK.value,
6
+ source_url: '/handbook/'
7
+ }, {
8
+ stage: 'Mock Stage',
9
+ group: 'Mock Group',
10
+ source_type: DOCUMENTATION_SOURCE_TYPES.DOC.value,
11
+ source_url: '/company/team/'
12
+ }, {
13
+ date: '2023-04-21',
14
+ author: 'Test User',
15
+ source_type: DOCUMENTATION_SOURCE_TYPES.BLOG.value,
16
+ source_url: '/blog/'
17
+ }];
18
+ const MOCK_RESPONSE_MESSAGE = {
19
+ id: '123',
20
+ content: '_Duo Chat message_ comming from AI',
21
+ contentHtml: '<p><em>Duo Chat message</em> comming from AI</p>',
22
+ role: MESSAGE_MODEL_ROLES.assistant,
23
+ extras: {
24
+ sources: MOCK_SOURCES
25
+ },
26
+ requestId: '987',
27
+ errors: [],
28
+ timestamp: '2021-04-21T12:00:00.000Z'
29
+ };
30
+
31
+ export { MOCK_RESPONSE_MESSAGE };