@servicetitan/titan-chatbot-ui 3.1.0 → 3.1.1

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.
Files changed (140) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/chatbot/__tests-cy__/chatbot-help-center.test.js +2 -156
  3. package/dist/components/chatbot/__tests-cy__/chatbot-help-center.test.js.map +1 -1
  4. package/dist/components/chatbot/__tests-cy__/chatbot-live.test.js +2 -94
  5. package/dist/components/chatbot/__tests-cy__/chatbot-live.test.js.map +1 -1
  6. package/dist/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.js +2 -151
  7. package/dist/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.js.map +1 -1
  8. package/dist/components/chatbot/__tests-cy__/chatbot.test.js +2 -151
  9. package/dist/components/chatbot/__tests-cy__/chatbot.test.js.map +1 -1
  10. package/dist/components/chatbot/chatbot.d.ts +2 -1
  11. package/dist/components/chatbot/chatbot.d.ts.map +1 -1
  12. package/dist/components/chatbot/chatbot.js +2 -2
  13. package/dist/components/chatbot/chatbot.js.map +1 -1
  14. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.d.ts +2 -0
  15. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.d.ts.map +1 -0
  16. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.js +6 -0
  17. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.js.map +1 -0
  18. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.d.ts +2 -0
  19. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.d.ts.map +1 -0
  20. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.js +6 -0
  21. package/dist/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.js.map +1 -0
  22. package/dist/components/chatbot/dialog/chatbot-restart-dialog.d.ts.map +1 -1
  23. package/dist/components/chatbot/dialog/chatbot-restart-dialog.js +1 -1
  24. package/dist/components/chatbot/dialog/chatbot-restart-dialog.js.map +1 -1
  25. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.js +2 -61
  26. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.js.map +1 -1
  27. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.js +2 -96
  28. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.js.map +1 -1
  29. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.d.ts +2 -0
  30. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.d.ts.map +1 -0
  31. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.js +6 -0
  32. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.js.map +1 -0
  33. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.d.ts +2 -0
  34. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.d.ts.map +1 -0
  35. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.js +6 -0
  36. package/dist/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.js.map +1 -0
  37. package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.d.ts.map +1 -1
  38. package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.js +1 -1
  39. package/dist/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.js.map +1 -1
  40. package/dist/components/chatbot/feedback/chatbot-message-feedback-form.d.ts.map +1 -1
  41. package/dist/components/chatbot/feedback/chatbot-message-feedback-form.js +1 -1
  42. package/dist/components/chatbot/feedback/chatbot-message-feedback-form.js.map +1 -1
  43. package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.d.ts.map +1 -1
  44. package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.js +2 -4
  45. package/dist/components/chatbot/feedback/chatbot-message-feedback-popover.js.map +1 -1
  46. package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.d.ts.map +1 -1
  47. package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.js +1 -2
  48. package/dist/components/chatbot/feedback/chatbot-session-feedback-modal.js.map +1 -1
  49. package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.d.ts +2 -0
  50. package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.d.ts.map +1 -0
  51. package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.js +6 -0
  52. package/dist/components/chatbot/filters/__tests-cy__/chatbot-filters.test.js.map +1 -0
  53. package/dist/components/chatbot/filters/chatbot-filter.js +1 -1
  54. package/dist/components/chatbot/filters/chatbot-filter.js.map +1 -1
  55. package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.d.ts +2 -0
  56. package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.d.ts.map +1 -0
  57. package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.js +6 -0
  58. package/dist/components/chatbot/messages/__tests-cy__/chatbot-links.test.js.map +1 -0
  59. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.d.ts +2 -0
  60. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.d.ts.map +1 -0
  61. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.js +6 -0
  62. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.js.map +1 -0
  63. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.js +3 -82
  64. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.js.map +1 -1
  65. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.js +3 -54
  66. package/dist/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.js.map +1 -1
  67. package/package.json +6 -6
  68. package/src/components/chatbot/__tests-cy__/chatbot-help-center.test.tsx +2 -206
  69. package/src/components/chatbot/__tests-cy__/chatbot-live.test.tsx +2 -128
  70. package/src/components/chatbot/__tests-cy__/chatbot-titan-chatbot.test.tsx +2 -202
  71. package/src/components/chatbot/__tests-cy__/chatbot.test.tsx +2 -197
  72. package/src/components/chatbot/chatbot.tsx +66 -63
  73. package/src/components/chatbot/dialog/__tests-cy__/chatbot-restart-dialog.test.tsx +6 -0
  74. package/src/components/chatbot/dialog/__tests-cy__/chatbot-restart-link.test.tsx +6 -0
  75. package/src/components/chatbot/dialog/chatbot-restart-dialog.tsx +1 -0
  76. package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form-guardrail.test.tsx +2 -85
  77. package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-form.test.tsx +2 -127
  78. package/src/components/chatbot/feedback/__tests-cy__/chatbot-message-feedback-popover.test.tsx +6 -0
  79. package/src/components/chatbot/feedback/__tests-cy__/chatbot-session-feedback-modal.test.tsx +6 -0
  80. package/src/components/chatbot/feedback/chatbot-message-feedback-form-guardrail.tsx +1 -1
  81. package/src/components/chatbot/feedback/chatbot-message-feedback-form.tsx +1 -1
  82. package/src/components/chatbot/feedback/chatbot-message-feedback-popover.tsx +8 -5
  83. package/src/components/chatbot/feedback/chatbot-session-feedback-modal.tsx +1 -2
  84. package/src/components/chatbot/filters/__tests-cy__/chatbot-filters.test.tsx +6 -0
  85. package/src/components/chatbot/filters/chatbot-filter.tsx +1 -1
  86. package/src/components/chatbot/messages/__tests-cy__/chatbot-links.test.tsx +6 -0
  87. package/src/components/chatbot/messages/__tests-cy__/chatbot-message-answer-readonly.test.tsx +6 -0
  88. package/src/components/chatbot/messages/__tests-cy__/chatbot-message-answer.test.tsx +3 -107
  89. package/src/components/chatbot/messages/__tests-cy__/chatbot-message-typing.test.tsx +3 -68
  90. package/tsconfig.tsbuildinfo +1 -1
  91. package/dist/stores/__tests__/message-feedback-guardrail.store.test.d.ts +0 -2
  92. package/dist/stores/__tests__/message-feedback-guardrail.store.test.d.ts.map +0 -1
  93. package/dist/stores/__tests__/message-feedback-guardrail.store.test.js +0 -49
  94. package/dist/stores/__tests__/message-feedback-guardrail.store.test.js.map +0 -1
  95. package/dist/stores/__tests__/message-feedback.store.test.d.ts +0 -2
  96. package/dist/stores/__tests__/message-feedback.store.test.d.ts.map +0 -1
  97. package/dist/stores/__tests__/message-feedback.store.test.js +0 -114
  98. package/dist/stores/__tests__/message-feedback.store.test.js.map +0 -1
  99. package/dist/stores/__tests__/session-feedback.store.test.d.ts +0 -2
  100. package/dist/stores/__tests__/session-feedback.store.test.d.ts.map +0 -1
  101. package/dist/stores/__tests__/session-feedback.store.test.js +0 -39
  102. package/dist/stores/__tests__/session-feedback.store.test.js.map +0 -1
  103. package/dist/stores/message-feedback-base.store.d.ts +0 -8
  104. package/dist/stores/message-feedback-base.store.d.ts.map +0 -1
  105. package/dist/stores/message-feedback-base.store.js +0 -2
  106. package/dist/stores/message-feedback-base.store.js.map +0 -1
  107. package/dist/stores/message-feedback-guardrail.store.d.ts +0 -16
  108. package/dist/stores/message-feedback-guardrail.store.d.ts.map +0 -1
  109. package/dist/stores/message-feedback-guardrail.store.js +0 -85
  110. package/dist/stores/message-feedback-guardrail.store.js.map +0 -1
  111. package/dist/stores/message-feedback.store.d.ts +0 -23
  112. package/dist/stores/message-feedback.store.d.ts.map +0 -1
  113. package/dist/stores/message-feedback.store.js +0 -145
  114. package/dist/stores/message-feedback.store.js.map +0 -1
  115. package/dist/stores/session-feedback.store.d.ts +0 -15
  116. package/dist/stores/session-feedback.store.d.ts.map +0 -1
  117. package/dist/stores/session-feedback.store.js +0 -75
  118. package/dist/stores/session-feedback.store.js.map +0 -1
  119. package/dist/utils/__tests__/axios-utils.test.d.ts +0 -2
  120. package/dist/utils/__tests__/axios-utils.test.d.ts.map +0 -1
  121. package/dist/utils/__tests__/axios-utils.test.js +0 -33
  122. package/dist/utils/__tests__/axios-utils.test.js.map +0 -1
  123. package/dist/utils/axios-utils.d.ts +0 -5
  124. package/dist/utils/axios-utils.d.ts.map +0 -1
  125. package/dist/utils/axios-utils.js +0 -23
  126. package/dist/utils/axios-utils.js.map +0 -1
  127. package/dist/utils/test-utils.d.ts +0 -5
  128. package/dist/utils/test-utils.d.ts.map +0 -1
  129. package/dist/utils/test-utils.js +0 -17
  130. package/dist/utils/test-utils.js.map +0 -1
  131. package/src/stores/__tests__/message-feedback-guardrail.store.test.ts +0 -61
  132. package/src/stores/__tests__/message-feedback.store.test.ts +0 -121
  133. package/src/stores/__tests__/session-feedback.store.test.ts +0 -47
  134. package/src/stores/message-feedback-base.store.ts +0 -8
  135. package/src/stores/message-feedback-guardrail.store.ts +0 -60
  136. package/src/stores/message-feedback.store.ts +0 -113
  137. package/src/stores/session-feedback.store.ts +0 -44
  138. package/src/utils/__tests__/axios-utils.test.ts +0 -40
  139. package/src/utils/axios-utils.ts +0 -25
  140. package/src/utils/test-utils.ts +0 -22
@@ -1,75 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- import { InputFieldState, TextAreaFieldState } from '@servicetitan/form';
11
- import { injectable } from '@servicetitan/react-ioc';
12
- import { Models } from '@servicetitan/titan-chatbot-api';
13
- import { FormState } from 'formstate';
14
- import { computed, makeObservable, observable } from 'mobx';
15
- let SessionFeedbackStore = class SessionFeedbackStore {
16
- get isValid() {
17
- return this.formState.$.thumbs.value !== 0;
18
- }
19
- get feedback() {
20
- return new Models.Feedback({
21
- rating: this.formState.$.thumbs.value > 0
22
- ? Models.FeedbackRatings.ThumbsUp
23
- : Models.FeedbackRatings.ThumbsDown,
24
- description: this.formState.$.comment.value || undefined,
25
- });
26
- }
27
- get isThumbsUp() {
28
- return this.formState.$.thumbs.value > 0;
29
- }
30
- get isThumbsDown() {
31
- return this.formState.$.thumbs.value < 0;
32
- }
33
- constructor() {
34
- Object.defineProperty(this, "formState", {
35
- enumerable: true,
36
- configurable: true,
37
- writable: true,
38
- value: new FormState({
39
- thumbs: new InputFieldState(0),
40
- comment: new TextAreaFieldState(''),
41
- })
42
- });
43
- makeObservable(this);
44
- }
45
- };
46
- __decorate([
47
- observable,
48
- __metadata("design:type", Object)
49
- ], SessionFeedbackStore.prototype, "formState", void 0);
50
- __decorate([
51
- computed,
52
- __metadata("design:type", Object),
53
- __metadata("design:paramtypes", [])
54
- ], SessionFeedbackStore.prototype, "isValid", null);
55
- __decorate([
56
- computed,
57
- __metadata("design:type", Models.Feedback),
58
- __metadata("design:paramtypes", [])
59
- ], SessionFeedbackStore.prototype, "feedback", null);
60
- __decorate([
61
- computed,
62
- __metadata("design:type", Object),
63
- __metadata("design:paramtypes", [])
64
- ], SessionFeedbackStore.prototype, "isThumbsUp", null);
65
- __decorate([
66
- computed,
67
- __metadata("design:type", Object),
68
- __metadata("design:paramtypes", [])
69
- ], SessionFeedbackStore.prototype, "isThumbsDown", null);
70
- SessionFeedbackStore = __decorate([
71
- injectable(),
72
- __metadata("design:paramtypes", [])
73
- ], SessionFeedbackStore);
74
- export { SessionFeedbackStore };
75
- //# sourceMappingURL=session-feedback.store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-feedback.store.js","sourceRoot":"","sources":["../../src/stores/session-feedback.store.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGrD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAO7B,IACI,OAAO;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,IACI,QAAQ;QACR,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC;YACvB,MAAM,EACF,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC;gBAC7B,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ;gBACjC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU;YAC3C,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,SAAS;SAC3D,CAAC,CAAC;IACP,CAAC;IAED,IACI,UAAU;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,IACI,YAAY;QACZ,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED;QA/BA;;;;mBAAY,IAAI,SAAS,CAAC;gBACtB,MAAM,EAAE,IAAI,eAAe,CAAS,CAAC,CAAC;gBACtC,OAAO,EAAE,IAAI,kBAAkB,CAAS,EAAE,CAAC;aAC9C,CAAC;WAAC;QA6BC,cAAc,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACJ,CAAA;AAlCG;IADC,UAAU;;uDAIR;AAEH;IAAC,QAAQ;;;mDAGR;AAED;IAAC,QAAQ;8BACO,MAAM,CAAC,QAAQ;;oDAQ9B;AAED;IAAC,QAAQ;;;sDAGR;AAED;IAAC,QAAQ;;;wDAGR;AA/BQ,oBAAoB;IADhC,UAAU,EAAE;;GACA,oBAAoB,CAoChC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=axios-utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios-utils.test.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/axios-utils.test.ts"],"names":[],"mappings":""}
@@ -1,33 +0,0 @@
1
- import { expect } from '@jest/globals';
2
- import { withTimeout } from '../axios-utils';
3
- describe('axios-utils', () => {
4
- beforeEach(() => {
5
- jest.useFakeTimers();
6
- jest.setSystemTime(new Date('2000-01-01T00:00:00.000Z'));
7
- });
8
- afterEach(() => {
9
- jest.clearAllMocks();
10
- jest.useRealTimers();
11
- });
12
- test('should withTimeout (timeout first)', async () => {
13
- const abortController = new AbortController();
14
- const spyAbort = jest.spyOn(abortController, 'abort');
15
- const action = new Promise(resolve => setTimeout(() => resolve('done'), 100));
16
- const timeoutMs = 50;
17
- const p = expect(withTimeout(action, timeoutMs, abortController)).rejects.toThrow('The request is timed out');
18
- await jest.advanceTimersByTimeAsync(50);
19
- await p;
20
- expect(spyAbort).toHaveBeenCalledWith('The request is timed out');
21
- });
22
- test('should withTimeout (resolves first)', async () => {
23
- const abortController = new AbortController();
24
- const spyAbort = jest.spyOn(abortController, 'abort');
25
- const action = new Promise(resolve => setTimeout(() => resolve('done'), 100));
26
- const timeoutMs = 150;
27
- const p = expect(withTimeout(action, timeoutMs, abortController)).resolves.toEqual('done');
28
- await jest.advanceTimersByTimeAsync(100);
29
- await p;
30
- expect(spyAbort).not.toHaveBeenCalled();
31
- });
32
- });
33
- //# sourceMappingURL=axios-utils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios-utils.test.js","sourceRoot":"","sources":["../../../src/utils/__tests__/axios-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IACzB,UAAU,CAAC,GAAG,EAAE;QACZ,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9E,MAAM,SAAS,GAAG,EAAE,CAAC;QAErB,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAC7E,0BAA0B,CAC7B,CAAC;QACF,MAAM,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;QACxC,MAAM,CAAC,CAAC;QACR,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QAC9E,MAAM,SAAS,GAAG,GAAG,CAAC;QAEtB,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3F,MAAM,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACzC,MAAM,CAAC,CAAC;QACR,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Aborts the action if it takes longer than the specified timeout.
3
- */
4
- export declare function withTimeout<T>(action: Promise<T>, timeoutMs: number, abortController: AbortController): Promise<T>;
5
- //# sourceMappingURL=axios-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios-utils.d.ts","sourceRoot":"","sources":["../../src/utils/axios-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAC/B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
@@ -1,23 +0,0 @@
1
- /**
2
- * Aborts the action if it takes longer than the specified timeout.
3
- */
4
- export async function withTimeout(action, timeoutMs, abortController) {
5
- let timeoutId = undefined;
6
- const timeoutPromise = new Promise((_, reject) => {
7
- timeoutId = setTimeout(() => {
8
- abortController.abort('The request is timed out');
9
- reject(new Error('The request is timed out'));
10
- }, timeoutMs);
11
- });
12
- const promise = Promise.race([action, timeoutPromise]);
13
- try {
14
- return await promise;
15
- }
16
- finally {
17
- if (timeoutId) {
18
- clearTimeout(timeoutId);
19
- timeoutId = undefined;
20
- }
21
- }
22
- }
23
- //# sourceMappingURL=axios-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios-utils.js","sourceRoot":"","sources":["../../src/utils/axios-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,MAAkB,EAClB,SAAiB,EACjB,eAAgC;IAEhC,IAAI,SAAS,GAA8C,SAAS,CAAC;IACrE,MAAM,cAAc,GAAG,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAChD,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YACxB,eAAe,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAClD,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAClD,CAAC,EAAE,SAAS,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC;QACD,OAAO,MAAM,OAAO,CAAC;IACzB,CAAC;YAAS,CAAC;QACP,IAAI,SAAS,EAAE,CAAC;YACZ,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,SAAS,GAAG,SAAS,CAAC;QAC1B,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,5 +0,0 @@
1
- import { Container } from '@servicetitan/react-ioc';
2
- type Newable<T> = new (...args: never[]) => T;
3
- export declare const initTestContainer: (serviceIdentifier: Newable<unknown> | Newable<unknown>[], initDependenciesFn: (container: Container) => void) => () => Container;
4
- export {};
5
- //# sourceMappingURL=test-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/utils/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,KAAK,OAAO,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,iBAAiB,GAC1B,mBAAmB,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,EACxD,oBAAoB,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,oBAerD,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Container } from '@servicetitan/react-ioc';
2
- export const initTestContainer = (serviceIdentifier, initDependenciesFn) => {
3
- const rootContainer = new Container();
4
- if (Array.isArray(serviceIdentifier)) {
5
- serviceIdentifier.forEach(identifier => rootContainer.bind(identifier).toSelf());
6
- }
7
- else {
8
- rootContainer.bind(serviceIdentifier).toSelf();
9
- }
10
- return () => {
11
- const container = new Container();
12
- container.parent = rootContainer;
13
- initDependenciesFn(container);
14
- return container;
15
- };
16
- };
17
- //# sourceMappingURL=test-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/utils/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC7B,iBAAwD,EACxD,kBAAkD,EACpD,EAAE;IACA,MAAM,aAAa,GAAG,IAAI,SAAS,EAAE,CAAC;IACtC,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACnC,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACrF,CAAC;SAAM,CAAC;QACJ,aAAa,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,CAAC;IACnD,CAAC;IAED,OAAO,GAAG,EAAE;QACR,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QAClC,SAAS,CAAC,MAAM,GAAG,aAAa,CAAC;QACjC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QAC9B,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,61 +0,0 @@
1
- import { expect } from '@jest/globals';
2
- import { Models } from '@servicetitan/titan-chatbot-api';
3
- import { initTestContainer } from '../../utils/test-utils';
4
- import { MessageFeedbackGuardrailStore } from '../message-feedback-guardrail.store';
5
-
6
- const initContainer = initTestContainer(MessageFeedbackGuardrailStore, () => {});
7
-
8
- describe('[MessageFeedbackGuardrailStore]', () => {
9
- let store: MessageFeedbackGuardrailStore;
10
-
11
- beforeEach(() => {
12
- const container = initContainer();
13
- store = container.get(MessageFeedbackGuardrailStore);
14
- });
15
-
16
- afterEach(() => {
17
- jest.clearAllMocks();
18
- });
19
-
20
- test('should have correct default values', () => {
21
- expect(store.isValid).toBe(false);
22
- expect(store.formState.$.linkUrl.value).toBe('');
23
- expect(store.formState.$.comment.value).toBe('');
24
- });
25
-
26
- test('should export feedback with linkUrl and comment', async () => {
27
- store.formState.$.linkUrl.onChange('https://example.com');
28
- store.formState.$.comment.onChange('This is a comment');
29
-
30
- await store.formState.validate();
31
- const feedback = store.export();
32
-
33
- expect(feedback.rating).toBe(Models.FeedbackRatings.GuardrailFeedback);
34
- expect(feedback.linkUrl).toBe('https://example.com');
35
- expect(feedback.description).toBe('This is a comment');
36
- });
37
-
38
- test('should validate form state', async () => {
39
- store.formState.$.linkUrl.onChange('');
40
- store.formState.$.comment.onChange('');
41
-
42
- await store.formState.validate();
43
- expect(store.isValid).toBe(false);
44
- expect(store.formState.error).toBe('At least one input must be provided.');
45
-
46
- store.formState.$.linkUrl.onChange('https://example.com');
47
- store.formState.$.comment.onChange('');
48
- await store.formState.validate();
49
- expect(store.isValid).toBe(true);
50
-
51
- store.formState.$.linkUrl.onChange('');
52
- store.formState.$.comment.onChange('This is a comment');
53
- await store.formState.validate();
54
- expect(store.isValid).toBe(true);
55
-
56
- store.formState.$.linkUrl.onChange('https://example.com');
57
- store.formState.$.comment.onChange('This is a comment');
58
- await store.formState.validate();
59
- expect(store.isValid).toBe(true);
60
- });
61
- });
@@ -1,121 +0,0 @@
1
- import { expect } from '@jest/globals';
2
- import { Container } from '@servicetitan/react-ioc';
3
- import { CHATBOT_UI_STORE_TOKEN, IChatbotUiStore, Models } from '@servicetitan/titan-chatbot-api';
4
- import { initTestContainer } from '../../utils/test-utils';
5
- import { MessageFeedbackStore } from '../message-feedback.store';
6
-
7
- const initContainer = initTestContainer(MessageFeedbackStore, container => {
8
- class ChatbotUiStoreMock {
9
- customizations = {
10
- feedback: {
11
- isCommentAlwaysRequired: false,
12
- },
13
- };
14
- setCustomizationContext(context: any) {
15
- this.customizations = context;
16
- }
17
- }
18
- container
19
- .bind<IChatbotUiStore>(CHATBOT_UI_STORE_TOKEN)
20
- .toConstantValue(new ChatbotUiStoreMock() as IChatbotUiStore);
21
- });
22
-
23
- describe('[MessageFeedbackStore]', () => {
24
- let container: Container;
25
- let store: MessageFeedbackStore;
26
-
27
- beforeEach(() => {
28
- container = initContainer();
29
- store = container.get(MessageFeedbackStore);
30
- });
31
-
32
- test('should have proper form state', async () => {
33
- expect(store.isValid).toBe(false);
34
- expect(store.formState.$.notFull.value).toBe(false);
35
- expect(store.formState.$.unclear.value).toBe(false);
36
- expect(store.formState.$.unrelated.value).toBe(false);
37
- expect(store.formState.$.incorrect.value).toBe(false);
38
- expect(store.formState.$.other.value).toBe(false);
39
- expect(store.formState.$.otherComment.value).toBe('');
40
- expect(store.export()).toEqual({
41
- description: undefined,
42
- linkUrl: undefined,
43
- options: [],
44
- rating: Models.FeedbackRatings.ThumbsDown,
45
- });
46
-
47
- await store.formState.validate();
48
- expect(store.formState.error).toBe('At least one item has to be selected.');
49
- });
50
-
51
- test('should export form state', async () => {
52
- store.formState.$.unclear.onChange(true);
53
- store.formState.$.notFull.onChange(true);
54
- store.formState.$.unrelated.onChange(true);
55
- store.formState.$.incorrect.onChange(true);
56
- store.formState.$.other.onChange(true);
57
- store.formState.$.otherComment.onChange('Some comment');
58
- await store.formState.validate();
59
-
60
- expect(store.export()).toEqual({
61
- description: 'Some comment',
62
- linkUrl: undefined,
63
- options: expect.arrayContaining([
64
- Models.FeedbackOptions.Unclear,
65
- Models.FeedbackOptions.Incomplete,
66
- Models.FeedbackOptions.Unrelated,
67
- Models.FeedbackOptions.Incorrect,
68
- Models.FeedbackOptions.Other,
69
- ]),
70
- rating: Models.FeedbackRatings.ThumbsDown,
71
- });
72
- });
73
-
74
- test('should validate comment for non-internal users', async () => {
75
- // Other is selected and comment is empty, validation should fail
76
- store.formState.$.other.onChange(true);
77
- store.formState.$.otherComment.onChange('');
78
- await store.formState.validate();
79
- expect(store.formState.$.otherComment.error).toBe('Enter details.');
80
-
81
- // If "Other" is not selected, comment should not be required
82
- store.formState.$.other.onChange(false);
83
- store.formState.$.otherComment.onChange('');
84
- await store.formState.validate();
85
- expect(store.formState.$.otherComment.error).toBeFalsy();
86
-
87
- // If "Other" is selected and comment is provided, validation should pass
88
- store.formState.$.other.onChange(true);
89
- store.formState.$.otherComment.onChange('Some comment');
90
- await store.formState.validate();
91
- expect(store.formState.$.otherComment.error).toBeFalsy();
92
- });
93
-
94
- test('should validate comment for internal users', async () => {
95
- const chatbotUiStore = container.get<IChatbotUiStore>(CHATBOT_UI_STORE_TOKEN);
96
- chatbotUiStore.setCustomizationContext({
97
- feedback: {
98
- isCommentAlwaysRequired: true,
99
- },
100
- });
101
- expect(store.isCommentAlwaysRequired).toBe(true);
102
-
103
- // If "Other" is not selected, comment should be required
104
- store.formState.$.other.onChange(false);
105
- store.formState.$.otherComment.onChange('');
106
- await store.formState.validate();
107
- expect(store.formState.$.otherComment.error).toBe('Enter details.');
108
-
109
- // If "Other" is selected, comment should be required
110
- store.formState.$.other.onChange(true);
111
- store.formState.$.otherComment.onChange('');
112
- await store.formState.validate();
113
- expect(store.formState.$.otherComment.error).toBe('Enter details.');
114
-
115
- // If "Other" is selected and comment is provided, validation should pass
116
- store.formState.$.other.onChange(true);
117
- store.formState.$.otherComment.onChange('Some comment');
118
- await store.formState.validate();
119
- expect(store.formState.$.otherComment.error).toBeFalsy();
120
- });
121
- });
@@ -1,47 +0,0 @@
1
- import { expect } from '@jest/globals';
2
- import { Container } from '@servicetitan/react-ioc';
3
- import { initTestContainer } from '../../utils/test-utils';
4
- import { SessionFeedbackStore } from '../session-feedback.store';
5
-
6
- const initContainer = initTestContainer(SessionFeedbackStore, () => {});
7
-
8
- describe('[SessionFeedbackStore]', () => {
9
- let container: Container;
10
- let store: SessionFeedbackStore;
11
-
12
- beforeEach(() => {
13
- container = initContainer();
14
- store = container.get(SessionFeedbackStore);
15
- });
16
-
17
- test('should have proper form state', () => {
18
- expect(store.isValid).toBe(false);
19
- expect(store.formState.$.thumbs.value).toBe(0);
20
- expect(store.formState.$.comment.value).toBe('');
21
- expect(store.feedback).toEqual({
22
- rating: 0,
23
- description: undefined,
24
- });
25
- });
26
-
27
- test('should export feedback', async () => {
28
- store.formState.$.thumbs.onChange(1);
29
- store.formState.$.comment.onChange('Great service!');
30
- await store.formState.validate();
31
-
32
- expect(store.feedback).toEqual({
33
- rating: 1,
34
- description: 'Great service!',
35
- });
36
- });
37
-
38
- test('should validate thumbs up and down', () => {
39
- store.formState.$.thumbs.onChange(1);
40
- expect(store.isThumbsUp).toBe(true);
41
- expect(store.isThumbsDown).toBe(false);
42
-
43
- store.formState.$.thumbs.onChange(-1);
44
- expect(store.isThumbsUp).toBe(false);
45
- expect(store.isThumbsDown).toBe(true);
46
- });
47
- });
@@ -1,8 +0,0 @@
1
- import { Models } from '@servicetitan/titan-chatbot-api';
2
- import { FormState } from 'formstate';
3
-
4
- export interface IMessageFeedbackBaseStore<T extends FormState<{}> = FormState<{}>> {
5
- isValid: boolean;
6
- formState: T;
7
- export(): Models.IFeedback;
8
- }
@@ -1,60 +0,0 @@
1
- import { InputFieldState, TextAreaFieldState, formStateToJS } from '@servicetitan/form';
2
- import { injectable } from '@servicetitan/react-ioc';
3
- import { Models } from '@servicetitan/titan-chatbot-api';
4
- import { FormState } from 'formstate';
5
- import { action, computed, makeObservable, observable } from 'mobx';
6
- import { IMessageFeedbackBaseStore } from './message-feedback-base.store';
7
-
8
- export type FeedbackFormState = FormState<{
9
- linkUrl: InputFieldState<string>;
10
- comment: TextAreaFieldState<string>;
11
- }>;
12
-
13
- @injectable()
14
- export class MessageFeedbackGuardrailStore implements IMessageFeedbackBaseStore<FeedbackFormState> {
15
- @observable formState!: FeedbackFormState;
16
-
17
- @computed get isValid() {
18
- return Boolean(this.formState.$.linkUrl.value) || Boolean(this.formState.$.comment.value);
19
- }
20
-
21
- constructor() {
22
- this.createFormState();
23
- makeObservable(this);
24
- }
25
-
26
- export(): Models.Feedback {
27
- const state = formStateToJS(this.formState);
28
- let feedback: Models.IFeedback = {
29
- rating: Models.FeedbackRatings.GuardrailFeedback,
30
- };
31
- if (state.linkUrl) {
32
- feedback = {
33
- ...feedback,
34
- linkUrl: state.linkUrl,
35
- };
36
- }
37
- if (state.comment) {
38
- feedback = {
39
- ...feedback,
40
- description: state.comment,
41
- };
42
- }
43
- return new Models.Feedback(feedback);
44
- }
45
-
46
- @action
47
- private createFormState = () => {
48
- const formState = new FormState({
49
- linkUrl: new InputFieldState(''),
50
- comment: new TextAreaFieldState(''),
51
- });
52
- formState.validators($ => {
53
- const nothingSelected = !$.linkUrl.value && !$.comment.value;
54
- const result = nothingSelected ? 'At least one input must be provided.' : false;
55
- return result;
56
- });
57
- formState.disableAutoValidation();
58
- this.formState = formState;
59
- };
60
- }
@@ -1,113 +0,0 @@
1
- import {
2
- CheckboxFieldState,
3
- FormValidators,
4
- TextAreaFieldState,
5
- formStateToJS,
6
- } from '@servicetitan/form';
7
- import { inject, injectable } from '@servicetitan/react-ioc';
8
- import { CHATBOT_UI_STORE_TOKEN, IChatbotUiStore, Models } from '@servicetitan/titan-chatbot-api';
9
- import { FormState } from 'formstate';
10
- import { action, computed, makeObservable, observable } from 'mobx';
11
- import { IMessageFeedbackBaseStore } from './message-feedback-base.store';
12
-
13
- export type MessageFeedbackFormState = FormState<{
14
- unrelated: CheckboxFieldState;
15
- unclear: CheckboxFieldState;
16
- notFull: CheckboxFieldState;
17
- incorrect: CheckboxFieldState;
18
- other: CheckboxFieldState;
19
- otherComment: TextAreaFieldState<string>;
20
- }>;
21
-
22
- @injectable()
23
- export class MessageFeedbackStore implements IMessageFeedbackBaseStore<MessageFeedbackFormState> {
24
- @observable formState!: MessageFeedbackFormState;
25
-
26
- @computed get isCommentAlwaysRequired() {
27
- return this.chatbotUiStore.customizations.feedback?.isCommentAlwaysRequired ?? false;
28
- }
29
-
30
- @computed get isTextAreaVisible() {
31
- return this.isCommentAlwaysRequired || this.formState.$.other.value;
32
- }
33
-
34
- @computed get isValid() {
35
- return (
36
- this.formState.$.unrelated.value ||
37
- this.formState.$.unclear.value ||
38
- this.formState.$.notFull.value ||
39
- this.formState.$.incorrect.value ||
40
- this.formState.$.other.value
41
- );
42
- }
43
-
44
- constructor(@inject(CHATBOT_UI_STORE_TOKEN) private readonly chatbotUiStore: IChatbotUiStore) {
45
- this.formState = this.createFormState();
46
- makeObservable(this);
47
- }
48
-
49
- export(): Models.IFeedback {
50
- const state = formStateToJS(this.formState);
51
- const options: Models.FeedbackOptions[] = [];
52
- if (state.unrelated) {
53
- options.push(Models.FeedbackOptions.Unrelated);
54
- }
55
- if (state.unclear) {
56
- options.push(Models.FeedbackOptions.Unclear);
57
- }
58
- if (state.notFull) {
59
- options.push(Models.FeedbackOptions.Incomplete);
60
- }
61
- if (state.incorrect) {
62
- options.push(Models.FeedbackOptions.Incorrect);
63
- }
64
- if (state.other) {
65
- options.push(Models.FeedbackOptions.Other);
66
- }
67
- let feedback: Models.IFeedback = {
68
- rating: Models.FeedbackRatings.ThumbsDown,
69
- options,
70
- };
71
- if (state.otherComment) {
72
- feedback = {
73
- ...feedback,
74
- description: state.otherComment,
75
- };
76
- }
77
- return new Models.Feedback(feedback);
78
- }
79
-
80
- @action
81
- private createFormState = (): MessageFeedbackFormState => {
82
- const formState = new FormState({
83
- unrelated: new CheckboxFieldState(false),
84
- unclear: new CheckboxFieldState(false),
85
- notFull: new CheckboxFieldState(false),
86
- incorrect: new CheckboxFieldState(false),
87
- other: new CheckboxFieldState(false),
88
- otherComment: new TextAreaFieldState('')
89
- .validators($ => {
90
- if (this.isCommentAlwaysRequired) {
91
- // Internal users can't submit empty feedback
92
- return FormValidators.requiredWithCustomMessage('Enter details.')($);
93
- }
94
- // External users can submit empty feedback if "Other" is not selected
95
- if (!this.formState.$.other.value) {
96
- return false;
97
- }
98
- return FormValidators.requiredWithCustomMessage('Enter details.')($);
99
- })
100
- .disableAutoValidation(),
101
- }).validators($ => {
102
- const nothingSelected =
103
- !$.unrelated.value &&
104
- !$.unclear.value &&
105
- !$.notFull.value &&
106
- !$.incorrect.value &&
107
- !$.other.value;
108
- return nothingSelected ? 'At least one item has to be selected.' : false;
109
- });
110
- formState.disableAutoValidation();
111
- return formState;
112
- };
113
- }
@@ -1,44 +0,0 @@
1
- import { InputFieldState, TextAreaFieldState } from '@servicetitan/form';
2
- import { injectable } from '@servicetitan/react-ioc';
3
- import { Models } from '@servicetitan/titan-chatbot-api';
4
- import { FormState } from 'formstate';
5
- import { computed, makeObservable, observable } from 'mobx';
6
-
7
- @injectable()
8
- export class SessionFeedbackStore {
9
- @observable
10
- formState = new FormState({
11
- thumbs: new InputFieldState<number>(0),
12
- comment: new TextAreaFieldState<string>(''),
13
- });
14
-
15
- @computed
16
- get isValid() {
17
- return this.formState.$.thumbs.value !== 0;
18
- }
19
-
20
- @computed
21
- get feedback(): Models.Feedback {
22
- return new Models.Feedback({
23
- rating:
24
- this.formState.$.thumbs.value > 0
25
- ? Models.FeedbackRatings.ThumbsUp
26
- : Models.FeedbackRatings.ThumbsDown,
27
- description: this.formState.$.comment.value || undefined,
28
- });
29
- }
30
-
31
- @computed
32
- get isThumbsUp() {
33
- return this.formState.$.thumbs.value > 0;
34
- }
35
-
36
- @computed
37
- get isThumbsDown() {
38
- return this.formState.$.thumbs.value < 0;
39
- }
40
-
41
- constructor() {
42
- makeObservable(this);
43
- }
44
- }