@coveo/quantic 3.27.1-pre.f83bd005a5 → 3.28.0-pre.2dcf8120da

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.
@@ -4917,6 +4917,15 @@
4917
4917
  "required": true,
4918
4918
  "defaultValue": "",
4919
4919
  "type": "string"
4920
+ },
4921
+ {
4922
+ "name": "recordId",
4923
+ "attribute": "record-id",
4924
+ "access": "@api",
4925
+ "description": "<p>The ID of the record used to retrieve the user ID of its creator.\nThis is required to assign the correct privileges for enabling the User Actions feature.</p>",
4926
+ "required": true,
4927
+ "defaultValue": "",
4928
+ "type": "string"
4920
4929
  }
4921
4930
  ]
4922
4931
  },
@@ -0,0 +1,10 @@
1
+ global interface IInsightTokenProvider {
2
+ /**
3
+ * Get the configuration object (serialized) for the initialization of Coveo Headless.
4
+ * @param {String} recordId – The record ID used to fetch user context or privileges for token generation.
5
+ * @return {String} A serialized object containing the following keys:
6
+ * - `accessToken`: a search token (see https://docs.coveo.com/en/56/build-a-search-ui/search-token-authentication).
7
+ * - `organizationId`: the ID of the organization to query (see https://docs.coveo.com/en/148/manage-an-organization/retrieve-the-organization-id).
8
+ */
9
+ String getHeadlessConfiguration(String recordId);
10
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <ApexClass xmlns="urn:metadata.tooling.soap.sforce.com">
3
+ <apiVersion>61.0</apiVersion>
4
+ <status>Active</status>
5
+ </ApexClass>
@@ -2,6 +2,10 @@
2
2
  * Simple Apex Controller to fetch data for Headless initialization specific to the Insight use case.
3
3
  */
4
4
  global with sharing class InsightController {
5
+ public static String getHeadlessConfiguration() {
6
+ return getHeadlessConfiguration('');
7
+ }
8
+
5
9
  /**
6
10
  * Get the configuration object (serialized) for the initialization of Coveo Headless through a class implementing `ITokenProvider`.
7
11
  * @return {String} A serialized object containing the following keys:
@@ -9,10 +13,10 @@ global with sharing class InsightController {
9
13
  * - `organizationId`: the ID of the organization to query (see https://docs.coveo.com/en/148/manage-an-organization/retrieve-the-organization-id).
10
14
  */
11
15
  @AuraEnabled(cacheable=true)
12
- public static String getHeadlessConfiguration() {
16
+ public static String getHeadlessConfiguration(String recordId) {
13
17
  /**
14
18
  * e.g. To switch to the Insight Token Provider, you simply need to replace the following line by:
15
- * `return InsightTokenProvider.getHeadlessConfiguration();`
19
+ * `return InsightTokenProvider.getHeadlessConfiguration(recordId);`
16
20
  */
17
21
  return SampleTokenProvider.getHeadlessConfiguration();
18
22
  }
@@ -35,6 +35,13 @@ export default class QuanticInsightInterface extends LightningElement {
35
35
  * @type {string}
36
36
  */
37
37
  @api insightId;
38
+ /**
39
+ * The ID of the record used to retrieve the user ID of its creator.
40
+ * This is required to assign the correct privileges for enabling the User Actions feature.
41
+ * @api
42
+ * @type {string}
43
+ */
44
+ @api recordId = '';
38
45
 
39
46
  /** @type {InsightEngineOptions} */
40
47
  engineOptions;
@@ -69,7 +76,7 @@ export default class QuanticInsightInterface extends LightningElement {
69
76
  loadDependencies(this, HeadlessBundleNames.insight)
70
77
  .then(() => {
71
78
  if (!getHeadlessBindings(this.engineId)?.engine) {
72
- getHeadlessConfiguration()
79
+ getHeadlessConfiguration({recordId: this.recordId})
73
80
  .then((data) => {
74
81
  if (data) {
75
82
  const {organizationId, accessToken, ...rest} = JSON.parse(data);