@coveo/quantic 3.31.3 → 3.32.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.
@@ -1617,4 +1617,11 @@
1617
1617
  <protected>false</protected>
1618
1618
  <shortDescription>Insights related to this case</shortDescription>
1619
1619
  </labels>
1620
+ <labels>
1621
+ <fullName>quantic_NoGeneratedAnswer</fullName>
1622
+ <value>No generated answer available.</value>
1623
+ <language>en_US</language>
1624
+ <protected>false</protected>
1625
+ <shortDescription>No generated answer available.</shortDescription>
1626
+ </labels>
1620
1627
  </CustomLabels>
@@ -10,6 +10,7 @@ import generatingAnswer from '@salesforce/label/c.quantic_GeneratingAnswer';
10
10
  import harmful from '@salesforce/label/c.quantic_Harmful';
11
11
  import inaccurate from '@salesforce/label/c.quantic_Inaccurate';
12
12
  import irrelevant from '@salesforce/label/c.quantic_Irrelevant';
13
+ import loading from '@salesforce/label/c.quantic_Loading';
13
14
  import other from '@salesforce/label/c.quantic_Other';
14
15
  import outOfDate from '@salesforce/label/c.quantic_OutOfDate';
15
16
  import rgaDisclaimer from '@salesforce/label/c.quantic_RGADisclaimer';
@@ -17,6 +18,7 @@ import thisAnswerWasHelpful from '@salesforce/label/c.quantic_ThisAnswerWasHelpf
17
18
  import thisAnswerWasNotHelpful from '@salesforce/label/c.quantic_ThisAnswerWasNotHelpful';
18
19
  import tryAgain from '@salesforce/label/c.quantic_TryAgain';
19
20
  import whyGeneratedAnswerWasNotHelpful from '@salesforce/label/c.quantic_WhyGeneratedAnswerWasNotHelpful';
21
+ import noGeneratedAnswer from '@salesforce/label/c.quantic_NoGeneratedAnswer';
20
22
  import FeedbackModalQna from 'c/quanticFeedbackModalQna';
21
23
  import {
22
24
  registerComponentForInit,
@@ -30,6 +32,8 @@ import errorTemplate from './templates/errorTemplate.html';
30
32
  // @ts-ignore
31
33
  import generatedAnswerTemplate from './templates/generatedAnswer.html';
32
34
  // @ts-ignore
35
+ import loadingTemplate from './templates/loading.html';
36
+ // @ts-ignore
33
37
  import retryPromptTemplate from './templates/retryPrompt.html';
34
38
 
35
39
  /** @typedef {import("coveo").SearchEngine} SearchEngine */
@@ -147,6 +151,8 @@ export default class QuanticGeneratedAnswer extends LightningElement {
147
151
  rgaDisclaimer,
148
152
  showMore,
149
153
  showLess,
154
+ loading,
155
+ noGeneratedAnswer,
150
156
  };
151
157
 
152
158
  /** @type {GeneratedAnswer} */
@@ -603,12 +609,16 @@ export default class QuanticGeneratedAnswer extends LightningElement {
603
609
  return !!slot?.assignedNodes()?.length;
604
610
  }
605
611
 
606
- get shouldDisplayCustomNoAnswerMessage() {
607
- return (
608
- this.state?.cannotAnswer &&
609
- this.searchStatusState?.hasResults &&
610
- this.hasCustomNoAnswerMessage
611
- );
612
+ get cannotAnswer() {
613
+ return this.state?.cannotAnswer && this.searchStatusState?.hasResults;
614
+ }
615
+
616
+ get isLoading() {
617
+ return this.state?.isLoading;
618
+ }
619
+
620
+ get isManualAnswerGeneration() {
621
+ return this.state?.answerGenerationMode === 'manual';
612
622
  }
613
623
 
614
624
  /**
@@ -622,6 +632,13 @@ export default class QuanticGeneratedAnswer extends LightningElement {
622
632
  if (this.hasInitializationError) {
623
633
  return errorTemplate;
624
634
  }
635
+ if (
636
+ this.isLoading &&
637
+ this.isManualAnswerGeneration &&
638
+ !this.state?.cannotAnswer
639
+ ) {
640
+ return loadingTemplate;
641
+ }
625
642
  if (this.hasRetryableError) {
626
643
  return retryPromptTemplate;
627
644
  }
@@ -70,9 +70,7 @@
70
70
  </div>
71
71
  </template>
72
72
  </div>
73
- <div
74
- class={generatedAnswerFooterRowClass}
75
- >
73
+ <div class={generatedAnswerFooterRowClass}>
76
74
  <template lwc:if={shouldShowCollapseGeneratingMessage}>
77
75
  <div
78
76
  data-testid="generated-answer__collapse-generating-message"
@@ -107,20 +105,42 @@
107
105
  </template>
108
106
  </div>
109
107
  </template>
110
- <template lwc:if={shouldDisplayCustomNoAnswerMessage}>
111
- <div data-testid="generated-answer__no-answer-card" class="slds-box">
112
- <div class="generated-answer__card-header slds-grid">
113
- <span
114
- class="generated-answer__badge slds-var-p-around_x-small slds-text-title_bold"
115
- >{labels.generatedAnswerForYou}</span
108
+ <template lwc:if={cannotAnswer}>
109
+ <template lwc:if={isManualAnswerGeneration}>
110
+ <div data-testid="generated-answer__no-answer-card" class="slds-box">
111
+ <div class="generated-answer__card-header slds-grid">
112
+ <span
113
+ class="generated-answer__badge slds-var-p-around_x-small slds-text-title_bold"
114
+ >{labels.generatedAnswerForYou}</span
115
+ >
116
+ </div>
117
+ <div
118
+ data-testid="generated-answer__no-answer-message"
119
+ class="generated-answer__content slds-var-m-top_medium"
116
120
  >
117
- </div>
118
- <div class="generated-answer__content slds-var-m-top_medium">
119
- <div class={generatedAnswerClass}>
120
- <slot name="no-answer-message"></slot>
121
+ <div class={generatedAnswerClass}>
122
+ <slot name="no-answer-message">{labels.noGeneratedAnswer}</slot>
123
+ </div>
121
124
  </div>
122
125
  </div>
123
- </div>
126
+ </template>
127
+ <template lwc:else>
128
+ <template lwc:if={hasCustomNoAnswerMessage}>
129
+ <div data-testid="generated-answer__no-answer-card" class="slds-box">
130
+ <div class="generated-answer__card-header slds-grid">
131
+ <span
132
+ class="generated-answer__badge slds-var-p-around_x-small slds-text-title_bold"
133
+ >{labels.generatedAnswerForYou}</span
134
+ >
135
+ </div>
136
+ <div class="generated-answer__content slds-var-m-top_medium">
137
+ <div class={generatedAnswerClass}>
138
+ <slot name="no-answer-message"> </slot>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </template>
143
+ </template>
124
144
  </template>
125
145
  <div class="slds-hide">
126
146
  <slot name="no-answer-message"></slot>
@@ -0,0 +1,3 @@
1
+ .generated-answer__spinner {
2
+ height: 40px;
3
+ }
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <div
3
+ class="slds-is-relative slds-align_absolute-center generated-answer__spinner"
4
+ >
5
+ <lightning-spinner
6
+ alternative-text={labels.loading}
7
+ size="small"
8
+ ></lightning-spinner>
9
+ </div>
10
+ </template>