@gitlab/ui 77.7.0 → 78.1.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 +22 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +7 -2
- package/dist/components/experimental/duo/chat/duo_chat.js +2 -2
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +8 -6
- package/dist/components/experimental/experiment_badge/constants.js +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +1 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +5 -0
- package/src/components/experimental/duo/chat/duo_chat.spec.js +9 -0
- package/src/components/experimental/duo/chat/duo_chat.vue +2 -1
- package/src/components/experimental/duo/user_feedback/user_feedback.spec.js +4 -9
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +8 -6
- package/src/components/experimental/experiment_badge/constants.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [78.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v78.0.0...v78.1.0) (2024-03-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlDuoChat:** explicitly disable Experimental Badge ([d701cc9](https://gitlab.com/gitlab-org/gitlab-ui/commit/d701cc95e9af956ce17c3b4c75ea4d481cadde59))
|
|
7
|
+
|
|
8
|
+
# [78.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v77.7.0...v78.0.0) (2024-03-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlDuoChat:** refactor hasFeedback to rely on props ([97d1664](https://gitlab.com/gitlab-org/gitlab-ui/commit/97d166494f7af33f36779863fedc8084ea3254fe))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* **GlDuoChat:** This commit refactors the
|
|
19
|
+
GlDuoChat Feedback indicator on every message
|
|
20
|
+
to use the information coming in from props
|
|
21
|
+
not from localState.
|
|
22
|
+
|
|
1
23
|
# [77.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v77.6.0...v77.7.0) (2024-03-04)
|
|
2
24
|
|
|
3
25
|
|
package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js
CHANGED
|
@@ -86,6 +86,10 @@ var script = {
|
|
|
86
86
|
var _this$message$extras;
|
|
87
87
|
return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
|
|
88
88
|
},
|
|
89
|
+
hasFeedback() {
|
|
90
|
+
var _this$message$extras2;
|
|
91
|
+
return (_this$message$extras2 = this.message.extras) === null || _this$message$extras2 === void 0 ? void 0 : _this$message$extras2.hasFeedback;
|
|
92
|
+
},
|
|
89
93
|
messageContent() {
|
|
90
94
|
if (this.message.errors.length > 0) return this.renderMarkdown(this.message.errors.join('; '));
|
|
91
95
|
if (this.message.contentHtml) {
|
|
@@ -115,7 +119,8 @@ var script = {
|
|
|
115
119
|
this.$emit('track-feedback', {
|
|
116
120
|
...e,
|
|
117
121
|
didWhat: this.didWhat,
|
|
118
|
-
improveWhat: this.improveWhat
|
|
122
|
+
improveWhat: this.improveWhat,
|
|
123
|
+
message: this.message
|
|
119
124
|
});
|
|
120
125
|
}
|
|
121
126
|
},
|
|
@@ -130,7 +135,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
130
135
|
'gl-ml-auto gl-bg-blue-100 gl-text-blue-900 gl-rounded-bottom-right-none': _vm.isUserMessage,
|
|
131
136
|
'gl-rounded-bottom-left-none gl-text-gray-900 gl-bg-white gl-border-1 gl-border-solid gl-border-gray-50':
|
|
132
137
|
_vm.isAssistantMessage,
|
|
133
|
-
}},[_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"}),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-flex-end gl-mt-4 duo-chat-message-feedback"},[_c('gl-duo-user-feedback',{attrs:{"modal-title":_vm.$options.i18n.MODAL.TITLE,"modal-alert":_vm.$options.i18n.MODAL.ALERT_TEXT},on:{"feedback":_vm.logEvent},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.DID_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.INTERACTION},model:{value:(_vm.didWhat),callback:function ($$v) {_vm.didWhat=$$v;},expression:"didWhat"}})],1),_vm._v(" "),_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.IMPROVE_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.BETTER_RESPONSE},model:{value:(_vm.improveWhat),callback:function ($$v) {_vm.improveWhat=$$v;},expression:"improveWhat"}})],1)]},proxy:true}],null,false,419229417)})],1)]:_vm._e()],2)};
|
|
138
|
+
}},[_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"}),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-flex-end gl-mt-4 duo-chat-message-feedback"},[_c('gl-duo-user-feedback',{attrs:{"feedback-received":_vm.hasFeedback,"modal-title":_vm.$options.i18n.MODAL.TITLE,"modal-alert":_vm.$options.i18n.MODAL.ALERT_TEXT},on:{"feedback":_vm.logEvent},scopedSlots:_vm._u([{key:"feedback-extra-fields",fn:function(){return [_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.DID_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.INTERACTION},model:{value:(_vm.didWhat),callback:function ($$v) {_vm.didWhat=$$v;},expression:"didWhat"}})],1),_vm._v(" "),_c('gl-form-group',{attrs:{"label":_vm.$options.i18n.MODAL.IMPROVE_WHAT,"optional":""}},[_c('gl-form-textarea',{attrs:{"placeholder":_vm.$options.i18n.MODAL.BETTER_RESPONSE},model:{value:(_vm.improveWhat),callback:function ($$v) {_vm.improveWhat=$$v;},expression:"improveWhat"}})],1)]},proxy:true}],null,false,419229417)})],1)]:_vm._e()],2)};
|
|
134
139
|
var __vue_staticRenderFns__ = [];
|
|
135
140
|
|
|
136
141
|
/* style */
|
|
@@ -119,7 +119,7 @@ var script = {
|
|
|
119
119
|
* The type of the badge. This is passed down to the `GlExperimentBadge` component. Refer that component for more information.
|
|
120
120
|
*/
|
|
121
121
|
badgeType: {
|
|
122
|
-
type: String,
|
|
122
|
+
type: String || null,
|
|
123
123
|
required: false,
|
|
124
124
|
default: badgeTypes[0],
|
|
125
125
|
validator: badgeTypeValidator
|
|
@@ -343,7 +343,7 @@ var script = {
|
|
|
343
343
|
const __vue_script__ = script;
|
|
344
344
|
|
|
345
345
|
/* template */
|
|
346
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block gl-drawer gl-max-h-full gl-bottom-0 gl-shadow-none gl-border-l gl-border-t duo-chat",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('header',{staticClass:"gl-drawer-header gl-drawer-header-sticky gl-z-index-200 gl-p-0! gl-border-b-0",attrs:{"data-testid":"chat-header"}},[_c('div',{staticClass:"drawer-title gl-display-flex gl-justify-content-start gl-align-items-center gl-p-5"},[_c('h3',{staticClass:"gl-my-0 gl-font-size-h2"},[_vm._v(_vm._s(_vm.title))]),_vm._v(" "),_c('gl-experiment-badge',{attrs:{"help-page-url":_vm.badgeHelpPageUrl,"type":_vm.badgeType,"container-id":"chat-component"}}),_vm._v(" "),_c('gl-button',{staticClass:"gl-p-0! gl-ml-auto",attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":_vm.hideChat}})],1),_vm._v(" "),_c('gl-alert',{staticClass:"gl-text-center gl-border-t gl-p-4 gl-text-gray-700 gl-bg-gray-50 legal-warning gl-max-w-full",attrs:{"dismissible":false,"variant":"tip","show-icon":false,"role":"alert","data-testid":"chat-legal-warning"}},[_vm._v(_vm._s(_vm.$options.i18n.CHAT_LEGAL_GENERATED_BY_AI))]),_vm._v(" "),_vm._t("subheader"),_vm._v(" "),(_vm.error)?_c('gl-alert',{key:"error",staticClass:"gl-pl-9!",attrs:{"dismissible":false,"variant":"danger","role":"alert","data-testid":"chat-error"}},[_c('span',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.error),expression:"error"}]})]):_vm._e()],2):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-drawer-body",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingTrottled}},[_c('transition-group',{staticClass:"duo-chat-history gl-display-flex gl-flex-direction-column gl-justify-content-end gl-bg-gray-10",class:[
|
|
346
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.isHidden)?_c('aside',{staticClass:"markdown-code-block gl-drawer gl-max-h-full gl-bottom-0 gl-shadow-none gl-border-l gl-border-t duo-chat",attrs:{"id":"chat-component","role":"complementary","data-testid":"chat-component"}},[(_vm.showHeader)?_c('header',{staticClass:"gl-drawer-header gl-drawer-header-sticky gl-z-index-200 gl-p-0! gl-border-b-0",attrs:{"data-testid":"chat-header"}},[_c('div',{staticClass:"drawer-title gl-display-flex gl-justify-content-start gl-align-items-center gl-p-5"},[_c('h3',{staticClass:"gl-my-0 gl-font-size-h2"},[_vm._v(_vm._s(_vm.title))]),_vm._v(" "),(_vm.badgeType)?_c('gl-experiment-badge',{attrs:{"help-page-url":_vm.badgeHelpPageUrl,"type":_vm.badgeType,"container-id":"chat-component"}}):_vm._e(),_vm._v(" "),_c('gl-button',{staticClass:"gl-p-0! gl-ml-auto",attrs:{"category":"tertiary","variant":"default","icon":"close","size":"small","data-testid":"chat-close-button","aria-label":_vm.$options.i18n.CHAT_CLOSE_LABEL},on:{"click":_vm.hideChat}})],1),_vm._v(" "),_c('gl-alert',{staticClass:"gl-text-center gl-border-t gl-p-4 gl-text-gray-700 gl-bg-gray-50 legal-warning gl-max-w-full",attrs:{"dismissible":false,"variant":"tip","show-icon":false,"role":"alert","data-testid":"chat-legal-warning"}},[_vm._v(_vm._s(_vm.$options.i18n.CHAT_LEGAL_GENERATED_BY_AI))]),_vm._v(" "),_vm._t("subheader"),_vm._v(" "),(_vm.error)?_c('gl-alert',{key:"error",staticClass:"gl-pl-9!",attrs:{"dismissible":false,"variant":"danger","role":"alert","data-testid":"chat-error"}},[_c('span',{directives:[{name:"safe-html",rawName:"v-safe-html",value:(_vm.error),expression:"error"}]})]):_vm._e()],2):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-drawer-body",attrs:{"data-testid":"chat-history"},on:{"scroll":_vm.handleScrollingTrottled}},[_c('transition-group',{staticClass:"duo-chat-history gl-display-flex gl-flex-direction-column gl-justify-content-end gl-bg-gray-10",class:[
|
|
347
347
|
{
|
|
348
348
|
'gl-h-full': !_vm.hasMessages,
|
|
349
349
|
'force-scroll-bar': _vm.hasMessages,
|
|
@@ -13,6 +13,14 @@ var script = {
|
|
|
13
13
|
FeedbackModal
|
|
14
14
|
},
|
|
15
15
|
props: {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the message already has gotten feedback
|
|
18
|
+
*/
|
|
19
|
+
feedbackReceived: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: false,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
16
24
|
/**
|
|
17
25
|
* The text to be displayed as the feedback link/button.
|
|
18
26
|
*/
|
|
@@ -31,11 +39,6 @@ var script = {
|
|
|
31
39
|
default: ''
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
|
-
data() {
|
|
35
|
-
return {
|
|
36
|
-
feedbackReceived: false
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
42
|
computed: {
|
|
40
43
|
shouldRenderModal() {
|
|
41
44
|
return !this.feedbackReceived && !this.feedbackLinkUrl;
|
|
@@ -48,7 +51,6 @@ var script = {
|
|
|
48
51
|
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
49
52
|
*/
|
|
50
53
|
this.$emit('feedback', event);
|
|
51
|
-
this.feedbackReceived = true;
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
i18n
|
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue
CHANGED
|
@@ -92,6 +92,9 @@ export default {
|
|
|
92
92
|
sources() {
|
|
93
93
|
return this.message.extras?.sources;
|
|
94
94
|
},
|
|
95
|
+
hasFeedback() {
|
|
96
|
+
return this.message.extras?.hasFeedback;
|
|
97
|
+
},
|
|
95
98
|
messageContent() {
|
|
96
99
|
if (this.message.errors.length > 0)
|
|
97
100
|
return this.renderMarkdown(this.message.errors.join('; '));
|
|
@@ -125,6 +128,7 @@ export default {
|
|
|
125
128
|
...e,
|
|
126
129
|
didWhat: this.didWhat,
|
|
127
130
|
improveWhat: this.improveWhat,
|
|
131
|
+
message: this.message,
|
|
128
132
|
});
|
|
129
133
|
},
|
|
130
134
|
},
|
|
@@ -147,6 +151,7 @@ export default {
|
|
|
147
151
|
|
|
148
152
|
<div class="gl-display-flex gl-align-items-flex-end gl-mt-4 duo-chat-message-feedback">
|
|
149
153
|
<gl-duo-user-feedback
|
|
154
|
+
:feedback-received="hasFeedback"
|
|
150
155
|
:modal-title="$options.i18n.MODAL.TITLE"
|
|
151
156
|
:modal-alert="$options.i18n.MODAL.ALERT_TEXT"
|
|
152
157
|
@feedback="logEvent"
|
|
@@ -126,6 +126,15 @@ describe('GlDuoChat', () => {
|
|
|
126
126
|
expect(component().exists()).toBe(shouldRender);
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
+
it('does not render the experimental label if it is explicitely disabled', () => {
|
|
130
|
+
createComponent({
|
|
131
|
+
propsData: {
|
|
132
|
+
badgeType: null,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
expect(findBadge().exists()).toBe(false);
|
|
136
|
+
});
|
|
137
|
+
|
|
129
138
|
describe('when messages exist', () => {
|
|
130
139
|
it('scrolls to the bottom on load', async () => {
|
|
131
140
|
const scrollIntoViewMock = jest.fn();
|
|
@@ -127,7 +127,7 @@ export default {
|
|
|
127
127
|
* The type of the badge. This is passed down to the `GlExperimentBadge` component. Refer that component for more information.
|
|
128
128
|
*/
|
|
129
129
|
badgeType: {
|
|
130
|
-
type: String,
|
|
130
|
+
type: String || null,
|
|
131
131
|
required: false,
|
|
132
132
|
default: badgeTypes[0],
|
|
133
133
|
validator: badgeTypeValidator,
|
|
@@ -369,6 +369,7 @@ export default {
|
|
|
369
369
|
>
|
|
370
370
|
<h3 class="gl-my-0 gl-font-size-h2">{{ title }}</h3>
|
|
371
371
|
<gl-experiment-badge
|
|
372
|
+
v-if="badgeType"
|
|
372
373
|
:help-page-url="badgeHelpPageUrl"
|
|
373
374
|
:type="badgeType"
|
|
374
375
|
container-id="chat-component"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { nextTick } from 'vue';
|
|
2
1
|
import { shallowMount } from '@vue/test-utils';
|
|
3
2
|
import GlButton from '../../../base/button/button.vue';
|
|
4
3
|
import FeedbackModal from './user_feedback_modal.vue';
|
|
@@ -65,27 +64,23 @@ describe('UserFeedback', () => {
|
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
describe('event handling', () => {
|
|
68
|
-
beforeEach(() => {
|
|
69
|
-
createComponent();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
67
|
const passedFeedback = { feedbackOptions: ['helpful'], extendedFeedback: 'Foo bar' };
|
|
73
68
|
|
|
74
69
|
it('emits the event, containing the form data, when modal emits', () => {
|
|
70
|
+
createComponent();
|
|
75
71
|
findModal().vm.$emit('feedback-submitted', passedFeedback);
|
|
76
72
|
expect(wrapper.emitted('feedback')).toHaveLength(1);
|
|
77
73
|
});
|
|
78
74
|
|
|
79
75
|
it('renders the thank you text instead of a button', async () => {
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
createComponent({ props: { feedbackReceived: true } });
|
|
77
|
+
|
|
82
78
|
expect(findButton().exists()).toBe(false);
|
|
83
79
|
expect(wrapper.text()).toContain(i18n.FEEDBACK_THANKS);
|
|
84
80
|
});
|
|
85
81
|
|
|
86
82
|
it('does not render the modal after feedback submitted', async () => {
|
|
87
|
-
|
|
88
|
-
await nextTick();
|
|
83
|
+
createComponent({ props: { feedbackReceived: true } });
|
|
89
84
|
expect(findModal().exists()).toBe(false);
|
|
90
85
|
});
|
|
91
86
|
});
|
|
@@ -14,6 +14,14 @@ export default {
|
|
|
14
14
|
FeedbackModal,
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
|
+
/**
|
|
18
|
+
* Whether the message already has gotten feedback
|
|
19
|
+
*/
|
|
20
|
+
feedbackReceived: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: false,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
17
25
|
/**
|
|
18
26
|
* The text to be displayed as the feedback link/button.
|
|
19
27
|
*/
|
|
@@ -32,11 +40,6 @@ export default {
|
|
|
32
40
|
default: '',
|
|
33
41
|
},
|
|
34
42
|
},
|
|
35
|
-
data() {
|
|
36
|
-
return {
|
|
37
|
-
feedbackReceived: false,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
43
|
computed: {
|
|
41
44
|
shouldRenderModal() {
|
|
42
45
|
return !this.feedbackReceived && !this.feedbackLinkUrl;
|
|
@@ -49,7 +52,6 @@ export default {
|
|
|
49
52
|
* @param {*} event An event, containing the feedback choices and the extended feedback text.
|
|
50
53
|
*/
|
|
51
54
|
this.$emit('feedback', event);
|
|
52
|
-
this.feedbackReceived = true;
|
|
53
55
|
},
|
|
54
56
|
},
|
|
55
57
|
i18n,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const badgeTypes = ['experiment', 'beta'];
|
|
1
|
+
export const badgeTypes = ['experiment', 'beta', null];
|
|
2
2
|
export const badgeTypeValidator = (value) => badgeTypes.includes(value);
|