@coveo/quantic 3.43.4 → 3.43.6

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 (29) hide show
  1. package/force-app/main/default/classes/CaseAssistController.cls +18 -0
  2. package/force-app/main/default/classes/CaseAssistController.cls-meta.xml +5 -0
  3. package/force-app/main/default/classes/CaseAssistControllerTest.cls +15 -0
  4. package/force-app/main/default/classes/CaseAssistControllerTest.cls-meta.xml +5 -0
  5. package/force-app/main/default/classes/HeadlessControllerTest.cls +1 -1
  6. package/force-app/main/default/classes/InsightController.cls +4 -2
  7. package/force-app/main/default/classes/SampleCaseAssistTokenProvider.cls +19 -0
  8. package/force-app/main/default/classes/SampleCaseAssistTokenProvider.cls-meta.xml +5 -0
  9. package/force-app/main/default/classes/SampleCaseAssistTokenProviderTest.cls +15 -0
  10. package/force-app/main/default/classes/SampleCaseAssistTokenProviderTest.cls-meta.xml +5 -0
  11. package/force-app/main/default/classes/SampleInsightTokenProvider.cls +24 -0
  12. package/force-app/main/default/classes/SampleInsightTokenProvider.cls-meta.xml +5 -0
  13. package/force-app/main/default/classes/SampleInsightTokenProviderTest.cls +24 -0
  14. package/force-app/main/default/classes/SampleInsightTokenProviderTest.cls-meta.xml +5 -0
  15. package/force-app/main/default/classes/SampleTokenProvider.cls +2 -1
  16. package/force-app/main/default/classes/SampleTokenProviderTest.cls +1 -1
  17. package/force-app/main/default/lwc/quanticCaseAssistInterface/quanticCaseAssistInterface.js +1 -1
  18. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +6 -0
  19. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +14 -14
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +6 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search-box/headless-search-box-options.d.ts +9 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/standalone-search-box/headless-standalone-search-box-options.d.ts +1 -0
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/commerce-query-suggest-slice.d.ts +3 -2
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +16 -5
  25. package/force-app/main/default/staticresources/coveoheadless/headless.js +15 -15
  26. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +14 -14
  27. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +13 -13
  28. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  29. package/package.json +8 -8
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Simple Apex Controller to fetch data for Headless initialization specific to the Case Assist use case.
3
+ */
4
+ global with sharing class CaseAssistController {
5
+ /**
6
+ * Get the configuration object for the initialization of Coveo Headless Case Assist.
7
+ * This uses the sample token with Case Assist permissions.
8
+ * @return {String} A serialized object containing the Case Assist Headless configuration.
9
+ */
10
+ @AuraEnabled(cacheable=true)
11
+ public static String getHeadlessConfiguration() {
12
+ /**
13
+ * e.g. To switch to the Coveo Token Provider, you simply need to replace the following line by:
14
+ * `return CoveoTokenProvider.getHeadlessConfiguration();`
15
+ */
16
+ return SampleCaseAssistTokenProvider.getHeadlessConfiguration();
17
+ }
18
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>53.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,15 @@
1
+ @isTest
2
+ private class CaseAssistControllerTest {
3
+ // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
4
+ static final String sampleHeadlessConfiguration = '{"accessToken":"xx564559b1-0045-48e1-953c-3addd1ee4457","organizationId":"searchuisamples"}';
5
+
6
+ @IsTest
7
+ static void shouldReturnStringifiedConfiguration() {
8
+ Test.startTest();
9
+ System.assertEquals(
10
+ sampleHeadlessConfiguration,
11
+ CaseAssistController.getHeadlessConfiguration()
12
+ );
13
+ Test.stopTest();
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>53.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -1,7 +1,7 @@
1
1
  @isTest
2
2
  private class HeadlessControllerTest {
3
3
  // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
4
- static final String sampleHeadlessConfiguration = '{"accessToken":"xx564559b1-0045-48e1-953c-3addd1ee4457","organizationId":"searchuisamples"}';
4
+ static final String sampleHeadlessConfiguration = '{"accessToken":"xxb9c21134-8dad-4d53-8a5e-855bacddba8f","organizationId":"searchuisamples"}';
5
5
  @IsTest
6
6
  static void shouldReturnStringifiedConfiguration() {
7
7
  Test.startTest();
@@ -15,9 +15,11 @@ global with sharing class InsightController {
15
15
  @AuraEnabled(cacheable=true)
16
16
  public static String getHeadlessConfiguration(String recordId) {
17
17
  /**
18
- * e.g. To switch to the Insight Token Provider, you simply need to replace the following line by:
18
+ * The SampleInsightTokenProvider returns a static sample configuration with
19
+ * hardcoded demo credentials for the Coveo sample organization.
20
+ * To switch to the real Insight Token Provider, replace the following line by:
19
21
  * `return InsightTokenProvider.getHeadlessConfiguration(recordId);`
20
22
  */
21
- return SampleTokenProvider.getHeadlessConfiguration();
23
+ return SampleInsightTokenProvider.getHeadlessConfiguration(recordId);
22
24
  }
23
25
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Return a static sample configuration with pre-configured value for the sample organization (Case Assist use case).
3
+ */
4
+ global with sharing class SampleCaseAssistTokenProvider implements ITokenProvider {
5
+ /**
6
+ * @see `ITokenProvider.getHeadlessConfiguration`.
7
+ */
8
+ @AuraEnabled
9
+ global static String getHeadlessConfiguration() {
10
+ Map<String, String> headlessConfiguration = new Map<String, String>();
11
+ headlessConfiguration.put('organizationId', 'searchuisamples');
12
+ headlessConfiguration.put(
13
+ 'accessToken',
14
+ // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
15
+ 'xx564559b1-0045-48e1-953c-3addd1ee4457'
16
+ );
17
+ return JSON.serialize(headlessConfiguration);
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>50.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,15 @@
1
+ @isTest
2
+ private class SampleCaseAssistTokenProviderTest {
3
+ // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
4
+ static final String sampleHeadlessConfiguration = '{"accessToken":"xx564559b1-0045-48e1-953c-3addd1ee4457","organizationId":"searchuisamples"}';
5
+
6
+ @IsTest
7
+ static void shouldReturnStringifiedConfiguration() {
8
+ Test.startTest();
9
+ System.assertEquals(
10
+ sampleHeadlessConfiguration,
11
+ SampleCaseAssistTokenProvider.getHeadlessConfiguration()
12
+ );
13
+ Test.stopTest();
14
+ }
15
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>50.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Return a static sample configuration with pre-configured value for the sample organization (Insight use case).
3
+ */
4
+ global with sharing class SampleInsightTokenProvider implements IInsightTokenProvider {
5
+ @AuraEnabled
6
+ global static String getHeadlessConfiguration() {
7
+ return getHeadlessConfiguration('');
8
+ }
9
+
10
+ /**
11
+ * @see `IInsightTokenProvider.getHeadlessConfiguration`.
12
+ */
13
+ @AuraEnabled(continuation=true cacheable=false)
14
+ global static String getHeadlessConfiguration(String recordId) {
15
+ Map<String, String> headlessConfiguration = new Map<String, String>();
16
+ headlessConfiguration.put('organizationId', 'searchuisamples');
17
+ headlessConfiguration.put(
18
+ 'accessToken',
19
+ // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
20
+ 'xx564559b1-0045-48e1-953c-3addd1ee4457'
21
+ );
22
+ return JSON.serialize(headlessConfiguration);
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>50.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -0,0 +1,24 @@
1
+ @isTest
2
+ private class SampleInsightTokenProviderTest {
3
+ // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
4
+ static final String sampleHeadlessConfiguration = '{"accessToken":"xx564559b1-0045-48e1-953c-3addd1ee4457","organizationId":"searchuisamples"}';
5
+ @IsTest
6
+ static void shouldReturnStringifiedConfiguration() {
7
+ Test.startTest();
8
+ System.assertEquals(
9
+ sampleHeadlessConfiguration,
10
+ SampleInsightTokenProvider.getHeadlessConfiguration('')
11
+ );
12
+ Test.stopTest();
13
+ }
14
+
15
+ @IsTest
16
+ static void shouldReturnStringifiedConfigurationWithNoArgs() {
17
+ Test.startTest();
18
+ System.assertEquals(
19
+ sampleHeadlessConfiguration,
20
+ SampleInsightTokenProvider.getHeadlessConfiguration()
21
+ );
22
+ Test.stopTest();
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>50.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -11,7 +11,8 @@ global with sharing class SampleTokenProvider implements ITokenProvider {
11
11
  headlessConfiguration.put(
12
12
  'accessToken',
13
13
  // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
14
- 'xx564559b1-0045-48e1-953c-3addd1ee4457'
14
+ // Name: Quantic__sampleTokenProvider_key_dnd - Anonymous Search key.
15
+ 'xxb9c21134-8dad-4d53-8a5e-855bacddba8f'
15
16
  );
16
17
  return JSON.serialize(headlessConfiguration);
17
18
  }
@@ -1,7 +1,7 @@
1
1
  @isTest
2
2
  private class SampleTokenProviderTest {
3
3
  // This API key is intentionally public — it belongs to a sample organization used for samples/docs.
4
- static final String sampleHeadlessConfiguration = '{"accessToken":"xx564559b1-0045-48e1-953c-3addd1ee4457","organizationId":"searchuisamples"}';
4
+ static final String sampleHeadlessConfiguration = '{"accessToken":"xxb9c21134-8dad-4d53-8a5e-855bacddba8f","organizationId":"searchuisamples"}';
5
5
  @IsTest
6
6
  static void shouldReturnStringifiedConfiguration() {
7
7
  Test.startTest();
@@ -1,5 +1,5 @@
1
1
  // @ts-ignore
2
- import getHeadlessConfiguration from '@salesforce/apex/HeadlessController.getHeadlessConfiguration';
2
+ import getHeadlessConfiguration from '@salesforce/apex/CaseAssistController.getHeadlessConfiguration';
3
3
  import {
4
4
  getHeadlessBindings,
5
5
  loadDependencies,
@@ -43,7 +43,13 @@ export class SortObject {
43
43
  async selectNextSortOptionUsingKeyboard(
44
44
  expectedLabel: string
45
45
  ): Promise<void> {
46
+ const previousDescendant =
47
+ await this.sortDropDown.getAttribute('aria-activedescendant');
46
48
  await this.sortDropDown.press('ArrowDown');
49
+ await expect(this.sortDropDown).not.toHaveAttribute(
50
+ 'aria-activedescendant',
51
+ previousDescendant ?? ''
52
+ );
47
53
  await this.sortDropDown.press('Enter');
48
54
  await expect(this.sortDropDown).toHaveText(expectedLabel);
49
55
  }