@coveo/quantic 3.35.0 → 3.36.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/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +132 -1
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.css +13 -1
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.html +29 -9
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.js +54 -0
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.js-meta.xml +1 -1
- package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.js-meta.xml +1 -1
- package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.css +9 -0
- package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.html +1 -1
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-params.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/product-enrichment/product-enrichment-request.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/recommendations/recommendations-request.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/answer-generation-api-state.d.ts +29 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/answer-generation-api.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/answer/answer-endpoint.d.ts +31 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/endpoints/answer/url-builders/endpoint-url-builder.d.ts +5 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/answer-draft-reducer/answer-draft-reducer.d.ts +26 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/answer-streaming-runner.d.ts +26 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/server-state-event-handler/server-state-event-handler.d.ts +21 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/strategies/streaming-strategies.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-generation/streaming/types.d.ts +42 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/answer-slice.d.ts +5 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/search-api-params.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/context/headless-context.d.ts +15 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-enrichment/headless-product-enrichment.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-actions-loader.d.ts +9 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-actions.d.ts +6 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-state.d.ts +9 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-validation.d.ts +11 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions-loader.d.ts +9 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions.d.ts +11 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-state.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/follow-up-answers/follow-up-answers-state.d.ts +28 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-mocks.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-state.d.ts +42 -36
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/head-answer-strategy.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-request.d.ts +1 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/context/headless-context.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +13 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-definitions.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-scopes.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/kind.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +4 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +4 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/context/headless-context.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-enrichment/headless-product-enrichment.ssr.d.ts +13 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/hydrated-state-factory.d.ts +3 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/static-state-factory.d.ts +4 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-definitions.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-scopes.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/state/search-app-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/state/state-sections.d.ts +7 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-search-request.d.ts +1 -8
- package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
- package/package.json +3 -3
|
@@ -46,6 +46,11 @@ const exampleSalesforceLink = 'https://www.example-salesforce.com';
|
|
|
46
46
|
const urlFragment = '#:~:text=text%2001';
|
|
47
47
|
const exampleCitationUrl = 'https://example.com/';
|
|
48
48
|
|
|
49
|
+
const activeCitationLinkClass = 'citation__link--active';
|
|
50
|
+
const activeCitationTitleClass = 'citation__title--active';
|
|
51
|
+
const activeCitationIconClass = 'citation__icon--active';
|
|
52
|
+
const testIconName = 'utility:attach';
|
|
53
|
+
|
|
49
54
|
const defaultOptions = {
|
|
50
55
|
citation: exampleCitation,
|
|
51
56
|
interactiveCitation: {
|
|
@@ -62,9 +67,23 @@ const selectors = {
|
|
|
62
67
|
citationTitle: '.citation__title',
|
|
63
68
|
citationTooltip: 'c-quantic-tooltip',
|
|
64
69
|
citationTooltipUrl: '[data-testid="citation__tooltip-uri"]',
|
|
70
|
+
citationIcon: '.citation__icon',
|
|
71
|
+
actionsSlot: 'slot[name="actions"]',
|
|
65
72
|
};
|
|
66
73
|
|
|
67
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Mocks the return value of the assignedNodes method.
|
|
76
|
+
* @param {Array<Element>} assignedElements
|
|
77
|
+
*/
|
|
78
|
+
function mockSlotAssignedNodes(assignedElements) {
|
|
79
|
+
HTMLSlotElement.prototype.assignedNodes = function () {
|
|
80
|
+
return assignedElements;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function createTestComponent(options = defaultOptions, assignedElements = []) {
|
|
85
|
+
mockSlotAssignedNodes(assignedElements);
|
|
86
|
+
|
|
68
87
|
const element = createElement('c-quantic-citation', {
|
|
69
88
|
is: QuanticCitation,
|
|
70
89
|
});
|
|
@@ -447,4 +466,116 @@ describe('c-quantic-citation', () => {
|
|
|
447
466
|
});
|
|
448
467
|
});
|
|
449
468
|
});
|
|
469
|
+
|
|
470
|
+
describe('when the citation is active', () => {
|
|
471
|
+
it('should apply the active styles to the citation link, title and icon', async () => {
|
|
472
|
+
const element = createTestComponent({
|
|
473
|
+
...defaultOptions,
|
|
474
|
+
citation: exampleCitation,
|
|
475
|
+
isActive: true,
|
|
476
|
+
iconName: testIconName,
|
|
477
|
+
});
|
|
478
|
+
await flushPromises();
|
|
479
|
+
|
|
480
|
+
const citationLink = element.shadowRoot.querySelector(
|
|
481
|
+
selectors.citationLink
|
|
482
|
+
);
|
|
483
|
+
const citationTitle = element.shadowRoot.querySelector(
|
|
484
|
+
selectors.citationTitle
|
|
485
|
+
);
|
|
486
|
+
const citationIcon = element.shadowRoot.querySelector(
|
|
487
|
+
selectors.citationIcon
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
expect(citationLink.classList).toContain(activeCitationLinkClass);
|
|
491
|
+
expect(citationTitle.classList).toContain(activeCitationTitleClass);
|
|
492
|
+
expect(citationIcon.classList).toContain(activeCitationIconClass);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
describe('when the citation is not active', () => {
|
|
497
|
+
it('should not apply the active styles to the citation link, title and icon', async () => {
|
|
498
|
+
const element = createTestComponent({
|
|
499
|
+
...defaultOptions,
|
|
500
|
+
citation: exampleCitation,
|
|
501
|
+
isActive: false,
|
|
502
|
+
iconName: testIconName,
|
|
503
|
+
});
|
|
504
|
+
await flushPromises();
|
|
505
|
+
|
|
506
|
+
const citationLink = element.shadowRoot.querySelector(
|
|
507
|
+
selectors.citationLink
|
|
508
|
+
);
|
|
509
|
+
const citationTitle = element.shadowRoot.querySelector(
|
|
510
|
+
selectors.citationTitle
|
|
511
|
+
);
|
|
512
|
+
const citationIcon = element.shadowRoot.querySelector(
|
|
513
|
+
selectors.citationIcon
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
expect(citationLink.classList).not.toContain(activeCitationLinkClass);
|
|
517
|
+
expect(citationTitle.classList).not.toContain(activeCitationTitleClass);
|
|
518
|
+
expect(citationIcon.classList).not.toContain(activeCitationIconClass);
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
describe('when an icon name is provided', () => {
|
|
523
|
+
it('should set the icon name on the citation icon', async () => {
|
|
524
|
+
const element = createTestComponent({
|
|
525
|
+
...defaultOptions,
|
|
526
|
+
citation: exampleCitation,
|
|
527
|
+
iconName: testIconName,
|
|
528
|
+
});
|
|
529
|
+
await flushPromises();
|
|
530
|
+
|
|
531
|
+
const citationIcon = element.shadowRoot.querySelector('lightning-icon');
|
|
532
|
+
expect(citationIcon.iconName).toBe(testIconName);
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
describe('when no icon name is provided', () => {
|
|
537
|
+
it('should not display any icon in the citation', async () => {
|
|
538
|
+
const element = createTestComponent({
|
|
539
|
+
...defaultOptions,
|
|
540
|
+
citation: exampleCitation,
|
|
541
|
+
iconName: undefined,
|
|
542
|
+
});
|
|
543
|
+
await flushPromises();
|
|
544
|
+
|
|
545
|
+
const citationIcon = element.shadowRoot.querySelector('lightning-icon');
|
|
546
|
+
expect(citationIcon).toBeNull();
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
describe('citation actions slot', () => {
|
|
551
|
+
it('should render provided actions in the slot', async () => {
|
|
552
|
+
const exampleAction = document.createElement('span');
|
|
553
|
+
exampleAction.textContent = 'Test Action';
|
|
554
|
+
const exampleAssignedElements = [exampleAction];
|
|
555
|
+
|
|
556
|
+
const element = createTestComponent(
|
|
557
|
+
defaultOptions,
|
|
558
|
+
exampleAssignedElements
|
|
559
|
+
);
|
|
560
|
+
await flushPromises();
|
|
561
|
+
|
|
562
|
+
const slot = element.shadowRoot.querySelector(selectors.actionsSlot);
|
|
563
|
+
expect(slot).not.toBeNull();
|
|
564
|
+
|
|
565
|
+
const assignedActions = slot.assignedNodes();
|
|
566
|
+
expect(assignedActions).toHaveLength(1);
|
|
567
|
+
expect(assignedActions[0].textContent).toBe('Test Action');
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it('should have no assigned actions when none are provided', async () => {
|
|
571
|
+
const element = createTestComponent();
|
|
572
|
+
await flushPromises();
|
|
573
|
+
|
|
574
|
+
const slot = element.shadowRoot.querySelector(selectors.actionsSlot);
|
|
575
|
+
expect(slot).not.toBeNull();
|
|
576
|
+
|
|
577
|
+
const assignedActions = element.querySelectorAll('[slot="actions"]');
|
|
578
|
+
expect(assignedActions).toHaveLength(0);
|
|
579
|
+
});
|
|
580
|
+
});
|
|
450
581
|
});
|
|
@@ -37,4 +37,16 @@
|
|
|
37
37
|
.citation__tooltip {
|
|
38
38
|
color: rgb(26, 27, 30);
|
|
39
39
|
cursor: default;
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.citation__link--active {
|
|
43
|
+
border-color: var(--lwc-brandAccessible, #0176d3);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.citation__title--active {
|
|
47
|
+
color: var(--lwc-brandAccessible, #0176d3);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.citation__icon--active {
|
|
51
|
+
--slds-c-icon-color-foreground-default: var(--lwc-brandAccessible, #0176d3);
|
|
52
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
class="citation slds-m-right_xx-small slds-m-vertical_xx-small slds-is-relative"
|
|
4
4
|
>
|
|
5
5
|
<a
|
|
6
|
-
class=
|
|
6
|
+
class={citationLinkClasses}
|
|
7
7
|
aria-label={citationTitle}
|
|
8
8
|
href={hrefValue}
|
|
9
9
|
target="_blank"
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
onmouseleave={handleCitationMouseLeave}
|
|
13
13
|
onclick={handleClick}
|
|
14
14
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
<template lwc:if={iconName}>
|
|
16
|
+
<lightning-icon
|
|
17
|
+
icon-name={iconName}
|
|
18
|
+
size="xx-small"
|
|
19
|
+
class={citationIconClasses}
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
></lightning-icon>
|
|
22
|
+
</template>
|
|
23
|
+
<p class={citationTitleClasses}>{citationTitle}</p>
|
|
20
24
|
</a>
|
|
21
25
|
<c-quantic-tooltip
|
|
22
26
|
light-theme
|
|
@@ -26,9 +30,25 @@
|
|
|
26
30
|
onmouseleave={handleTooltipMouseLeave}
|
|
27
31
|
>
|
|
28
32
|
<div class="citation__tooltip" slot="content">
|
|
29
|
-
<div
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
<div
|
|
34
|
+
data-testid="citation__tooltip-uri"
|
|
35
|
+
class="slds-text-body_small slds-text-color_weak slds-truncate slds-var-p-vertical_xxx-small"
|
|
36
|
+
>
|
|
37
|
+
{hrefValue}
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
data-testid="citation__tooltip-title"
|
|
41
|
+
class="slds-text-title_bold slds-var-p-vertical_xx-small"
|
|
42
|
+
>
|
|
43
|
+
{citationTitle}
|
|
44
|
+
</div>
|
|
45
|
+
<div
|
|
46
|
+
data-testid="citation__tooltip-text"
|
|
47
|
+
class="citation__tooltip-text slds-text-body_small slds-var-p-vertical_xxx-small"
|
|
48
|
+
>
|
|
49
|
+
{text}
|
|
50
|
+
</div>
|
|
51
|
+
<slot name="actions"></slot>
|
|
32
52
|
</div>
|
|
33
53
|
</c-quantic-tooltip>
|
|
34
54
|
</li>
|
|
@@ -13,6 +13,7 @@ const supportedFileTypesForTextFragment = ['html', 'SalesforceItem'];
|
|
|
13
13
|
* The `QuanticCitation` component renders an individual citation.
|
|
14
14
|
* @fires CustomEvent#quantic__citationhover
|
|
15
15
|
* @category Internal
|
|
16
|
+
* @slot actions Slot for action controls (e.g., lightning-button-icon) rendered inside the citation tooltip.
|
|
16
17
|
* @example
|
|
17
18
|
* <c-quantic-citation citation={citation} interactive-citation={interactiveCitation} onclick={handleClick} onquantic__citationhover={handleHover}></c-quantic-citation>
|
|
18
19
|
*/
|
|
@@ -36,6 +37,22 @@ export default class QuanticCitation extends NavigationMixin(LightningElement) {
|
|
|
36
37
|
* @default false
|
|
37
38
|
*/
|
|
38
39
|
@api disableCitationAnchoring = false;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the citation is in an active state.
|
|
42
|
+
* A citation in an active state is displayed with a different title and border color based on the theme set on the community.
|
|
43
|
+
* @api
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
@api isActive = false;
|
|
48
|
+
/**
|
|
49
|
+
* The name of the Salesforce icon to display before the citation title.
|
|
50
|
+
* See https://www.lightningdesignsystem.com/2e1ef8501/p/83309d-icons for a list of valid icon names.
|
|
51
|
+
* @api
|
|
52
|
+
* @example 'utility:attach'
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
@api iconName;
|
|
39
56
|
|
|
40
57
|
/** @type {Object} */
|
|
41
58
|
timeout;
|
|
@@ -281,4 +298,41 @@ export default class QuanticCitation extends NavigationMixin(LightningElement) {
|
|
|
281
298
|
? this.salesforceRecordUrl
|
|
282
299
|
: (this.clickUri ?? this.citation?.uri);
|
|
283
300
|
}
|
|
301
|
+
|
|
302
|
+
get citationTitleClasses() {
|
|
303
|
+
return [
|
|
304
|
+
'citation__title',
|
|
305
|
+
'slds-m-left_x-small',
|
|
306
|
+
'slds-truncate',
|
|
307
|
+
'slds-has-flexi-truncate',
|
|
308
|
+
{
|
|
309
|
+
'citation__title--active': this.isActive,
|
|
310
|
+
},
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
get citationLinkClasses() {
|
|
315
|
+
return [
|
|
316
|
+
'citation__link',
|
|
317
|
+
'slds-badge',
|
|
318
|
+
'slds-badge_lightest',
|
|
319
|
+
'slds-align_absolute-center',
|
|
320
|
+
'slds-text-link_reset',
|
|
321
|
+
'slds-p-left_xx-small',
|
|
322
|
+
'slds-p-right_x-small',
|
|
323
|
+
{
|
|
324
|
+
'citation__link--active': this.isActive,
|
|
325
|
+
},
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
get citationIconClasses() {
|
|
330
|
+
return [
|
|
331
|
+
'citation__icon',
|
|
332
|
+
'slds-m-left_x-small',
|
|
333
|
+
{
|
|
334
|
+
'citation__icon--active': this.isActive,
|
|
335
|
+
},
|
|
336
|
+
];
|
|
337
|
+
}
|
|
284
338
|
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
.tab-bar_list-container {
|
|
2
|
+
/* Prevents horizontal scrollbar from appearing when tabs overflow */
|
|
3
|
+
overflow-x: clip;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.tab-bar_dropdown {
|
|
2
7
|
max-width: 150px;
|
|
3
8
|
}
|
|
@@ -5,3 +10,7 @@
|
|
|
5
10
|
.tab-bar__more-button:focus {
|
|
6
11
|
text-decoration: none;
|
|
7
12
|
}
|
|
13
|
+
|
|
14
|
+
.tab-bar__dropdown-tab {
|
|
15
|
+
display: inline;
|
|
16
|
+
}
|