@coveo/quantic 3.30.2-pre.05fd9d4454 → 3.30.2-pre.90867109cf

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 (145) hide show
  1. package/README.md +13 -13
  2. package/force-app/main/default/lwc/quanticAttachedResults/quanticAttachedResults.html +35 -0
  3. package/force-app/main/default/lwc/quanticAttachedResults/quanticAttachedResults.js +103 -0
  4. package/force-app/main/default/lwc/quanticAttachedResults/quanticAttachedResults.js-meta.xml +8 -0
  5. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +8 -8
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/analytics-relay-client.d.ts +2 -2
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/analytics-selectors.d.ts +2 -2
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +1 -1
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +3 -3
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.d.ts +16 -16
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/app/common-reducers.d.ts +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine.d.ts +5 -5
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine.d.ts +4 -4
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +4 -4
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +2 -2
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/context/cart/headless-cart-selectors.d.ts +8 -8
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-listing/facets/headless-product-listing-facet-options.d.ts +4 -4
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/facets/headless-search-facet-options.d.ts +4 -4
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/headless-core-range-facet.d.ts +1 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/knowledge/generated-answer/headless-answerapi-generated-answer-mocks.d.ts +7737 -704
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/features/actions-history/ipx-actions-history-actions.d.ts +1 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-slice.d.ts +1 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-query-selectors.d.ts +2 -2
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-slice.d.ts +1 -1
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-slice.d.ts +1 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-context/case-context-slice.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-slice.d.ts +1 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-slice.d.ts +1 -1
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-slice.d.ts +1 -1
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-actions.d.ts +2 -2
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-selector.d.ts +2 -2
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-slice.d.ts +1 -1
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-slice.d.ts +1 -1
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/did-you-mean/did-you-mean-slice.d.ts +1 -1
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-actions.d.ts +2 -2
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-selector.d.ts +2 -2
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-slice.d.ts +1 -1
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/field-suggestions-order/field-suggestions-order-slice.d.ts +1 -1
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-selectors.d.ts +2 -2
  42. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-slice.d.ts +1 -1
  43. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/instant-products/instant-products-slice.d.ts +1 -1
  44. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-selectors.d.ts +12 -12
  45. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-slice.d.ts +1 -1
  46. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/parameters/parameters-slice.d.ts +1 -1
  47. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product/product-actions.d.ts +2 -2
  48. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +2 -2
  49. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-selectors.d.ts +14 -14
  50. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-slice.d.ts +1 -1
  51. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-slice.d.ts +1 -1
  52. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +1 -1
  53. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recent-queries/recent-queries-slice.d.ts +1 -1
  54. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
  55. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-selectors.d.ts +6 -6
  56. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-slice.d.ts +1 -1
  57. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +4 -4
  58. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-selectors.d.ts +16 -16
  59. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-slice.d.ts +1 -1
  60. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort-slice.d.ts +1 -1
  61. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
  62. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
  63. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-slice.d.ts +1 -1
  64. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-slice.d.ts +1 -1
  65. package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-selector.d.ts +2 -2
  66. package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-slice.d.ts +1 -1
  67. package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/debug-slice.d.ts +1 -1
  68. package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/version-slice.d.ts +1 -1
  69. package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-slice.d.ts +1 -1
  70. package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-selectors.d.ts +2 -2
  71. package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-slice.d.ts +1 -1
  72. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
  73. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-slice.d.ts +1 -1
  74. package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-slice.d.ts +1 -1
  75. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-slice.d.ts +1 -1
  76. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/automatic-facet-set/automatic-facet-set-slice.d.ts +1 -1
  77. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-slice.d.ts +1 -1
  78. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-order/facet-order-slice.d.ts +1 -1
  79. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-set-slice.d.ts +1 -1
  80. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-state-selector.d.ts +2 -2
  81. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/generic/generic-facet-search-actions.d.ts +2 -2
  82. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-set-slice.d.ts +1 -1
  83. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-state-selector.d.ts +2 -2
  84. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-controller-actions.d.ts +2 -2
  85. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-slice.d.ts +1 -1
  86. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-controller-actions.d.ts +2 -2
  87. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-set-slice.d.ts +1 -1
  88. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-controller-actions.d.ts +2 -2
  89. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-set-slice.d.ts +1 -1
  90. package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions.d.ts +1 -1
  91. package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-slice.d.ts +1 -1
  92. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-actions.d.ts +1 -1
  93. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-slice.d.ts +1 -1
  94. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
  95. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/answer-api-selectors.d.ts +33 -41
  96. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +2 -2
  97. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-request.d.ts +20 -1961
  98. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-selectors.d.ts +2 -2
  99. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-slice.d.ts +1 -1
  100. package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-actions.d.ts +3 -3
  101. package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-slice.d.ts +2 -2
  102. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-configuration/insight-configuration-slice.d.ts +1 -1
  103. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-actions.d.ts +1 -1
  104. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-slice.d.ts +1 -1
  105. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +5 -5
  106. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/legacy/insight-search-actions.d.ts +4 -4
  107. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-actions.d.ts +1 -1
  108. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-slice.d.ts +1 -1
  109. package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-slice.d.ts +1 -1
  110. package/force-app/main/default/staticresources/coveoheadless/definitions/features/pagination/pagination-slice.d.ts +1 -1
  111. package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/pipeline-slice.d.ts +1 -1
  112. package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/select-pipeline.d.ts +2 -2
  113. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-selectors.d.ts +2 -2
  114. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-slice.d.ts +1 -1
  115. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-set/query-set-slice.d.ts +1 -1
  116. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
  117. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-slice.d.ts +1 -1
  118. package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-slice.d.ts +1 -1
  119. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-slice.d.ts +1 -1
  120. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-results/recent-results-slice.d.ts +1 -1
  121. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-actions.d.ts +1 -1
  122. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-slice.d.ts +1 -1
  123. package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-actions.d.ts +2 -2
  124. package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-slice.d.ts +1 -1
  125. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +5 -5
  126. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +6 -6
  127. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-selectors.d.ts +2 -2
  128. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-slice.d.ts +1 -1
  129. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-selectors.d.ts +2 -2
  130. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-slice.d.ts +1 -1
  131. package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-slice.d.ts +1 -1
  132. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
  133. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
  134. package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-selectors.d.ts +2 -2
  135. package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-slice.d.ts +1 -1
  136. package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-selectors.d.ts +4 -4
  137. package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-slice.d.ts +1 -1
  138. package/force-app/main/default/staticresources/coveoheadless/definitions/features/triggers/triggers-slice.d.ts +1 -1
  139. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +2 -2
  140. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +2 -2
  141. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-ssr-controller-definitions.d.ts +2 -2
  142. package/force-app/main/default/staticresources/coveoheadless/headless.js +3 -3
  143. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +3 -3
  144. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
  145. package/package.json +12 -17
package/README.md CHANGED
@@ -46,7 +46,7 @@ Optionally install the [VSCode Salesforce Extension Pack](https://marketplace.vi
46
46
 
47
47
  - Make sure you are at the root of `packages/quantic`.
48
48
 
49
- - Run `pnpm run setup:examples`.
49
+ - Run `npm run setup:examples`.
50
50
 
51
51
  This command will create two scratch orgs for you:
52
52
 
@@ -69,7 +69,7 @@ Or you can run the individual commands below.
69
69
  #### Create a Default Scratch Org
70
70
 
71
71
  - Make sure you are in the `packages/quantic` root folder.
72
- - Run this command to create the default scratch org. `pnpm run scratch:create`.
72
+ - Run this command to create the default scratch org. `npm run scratch:create`.
73
73
  - In VS Code, press Command + Shift P, enter sfdx, and select SFDX: Create a Default Scratch Org.
74
74
  - You can also run this command from the command line. `sf org create scratch --set-default --definition-file config/lws-enabled-scratch-def.json --alias Quantic__LWS_enabled`
75
75
  - `Quantic__LWS_enabled` is an alias for the scratch org that you can use in other Salesforce CLI commands. You can create any alias that you like.
@@ -87,7 +87,7 @@ Example components are available as Salesforce communities (Digital Experiences)
87
87
  To set up both communities in scratch orgs, run:
88
88
 
89
89
  ```bash
90
- pnpm run setup:examples
90
+ npm run setup:examples
91
91
  ```
92
92
 
93
93
  This script creates, configures, and deploys everything required to have fully working examples in **two scratch orgs**:
@@ -110,15 +110,15 @@ https://your-salesforce-lws-disabled-scratch-org-instance.force.com/examples
110
110
  Once the community has been deployed, you can deploy the `main` or `example` components to a specific org only when needed by running the corresponding commands:
111
111
 
112
112
  ```bash
113
- pnpm run deploy:main --target-org Quantic__LWS_enabled
114
- pnpm run deploy:examples --target-org Quantic__LWS_enabled
113
+ npm run deploy:main --target-org Quantic__LWS_enabled
114
+ npm run deploy:examples --target-org Quantic__LWS_enabled
115
115
  ```
116
116
 
117
117
  You can replace Quantic\_\_LWS_enabled with your target org alias. For example:
118
118
 
119
119
  ```bash
120
- pnpm run deploy:main --target-org MyCustomOrg
121
- pnpm run deploy:examples --target-org MyCustomOrg
120
+ npm run deploy:main --target-org MyCustomOrg
121
+ npm run deploy:examples --target-org MyCustomOrg
122
122
  ```
123
123
 
124
124
  ### Run Playwright for Quantic Components
@@ -130,19 +130,19 @@ pnpm run deploy:examples --target-org MyCustomOrg
130
130
  To run Playwright tests, run:
131
131
 
132
132
  ```bash
133
- pnpm run e2e:playwright
133
+ npm run e2e:playwright
134
134
  ```
135
135
 
136
136
  To run Playwright tests only for the scratch org where LWS is enabled, run:
137
137
 
138
138
  ```bash
139
- pnpm run e2e:playwright:lws-enabled
139
+ npm run e2e:playwright:lws-enabled
140
140
  ```
141
141
 
142
142
  To run Playwright tests only for the scratch org where LWS is disabled, run:
143
143
 
144
144
  ```bash
145
- pnpm run e2e:playwright:lws-disabled
145
+ npm run e2e:playwright:lws-disabled
146
146
  ```
147
147
 
148
148
  ### Run LWC unit tests for Quantic Components
@@ -150,20 +150,20 @@ pnpm run e2e:playwright:lws-disabled
150
150
  To run LWC unit tests directly in your console, run:
151
151
 
152
152
  ```bash
153
- pnpm run test:unit
153
+ npm run test:unit
154
154
  ```
155
155
 
156
156
  To run specific file/components LWC unit tests directly in your console, run:
157
157
 
158
158
  ```bash
159
- pnpm run test:unit -p force-app/main/default/lwc/nameOfComponent/
159
+ npm run test:unit -p force-app/main/default/lwc/nameOfComponent/
160
160
  ```
161
161
 
162
162
  ## Use Quantic From Source
163
163
 
164
164
  After you have cloned the repository and have run `npm install`, run the following commands:
165
165
 
166
- - `pnpm run build`
166
+ - `npm run build`
167
167
  - `sf project deploy start --source-dir force-app/main/default`
168
168
 
169
169
  ## Other Useful Commands
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <lightning-card title="Attached Results" icon-name="standard:attach">
3
+ <template lwc:if={results.length}>
4
+ <table class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout">
5
+ <thead>
6
+ <tr>
7
+ <th style="width: 75%">Title</th>
8
+ <th style="width: 15%">Source</th>
9
+ <th style="width: 10%">Actions</th>
10
+ </tr>
11
+ </thead>
12
+ <tbody>
13
+ <template for:each={results} for:item="result">
14
+ <tr key={result.permanentId}>
15
+ <td class="slds-grid">
16
+ <a href={result.resultUrl} target="_blank" class="slds-truncate" title={result.title}>
17
+ {result.title}
18
+ </a>
19
+ </td>
20
+ <td>{result.source}</td>
21
+ <td class="slds-text-align_center">
22
+ <lightning-button-icon onclick={result.handleDetach} icon-name="utility:attach" variant="bare"
23
+ alternative-text="Detach Result" title="Detach Result"></lightning-button-icon>
24
+ </td>
25
+ </tr>
26
+ </template>
27
+ </tbody>
28
+ </table>
29
+
30
+ </template>
31
+ <template lwc:else>
32
+ <div class="slds-p-horizontal_medium slds-text-color_weak">No attached results to show.</div>
33
+ </template>
34
+ </lightning-card>
35
+ </template>
@@ -0,0 +1,103 @@
1
+ import {
2
+ registerComponentForInit,
3
+ initializeWithHeadless,
4
+ getHeadlessBundle,
5
+ } from 'c/quanticHeadlessLoader';
6
+ import { LightningElement, api, track } from 'lwc';
7
+ // @ts-ignore
8
+ import DetachFromCase from '@salesforce/apex/AttachToCaseController.AuraDetachFromCase';
9
+
10
+ export default class QuanticAttachedResults extends LightningElement {
11
+ /**
12
+ * The ID of the engine instance the component registers to.
13
+ * Note: this needs to be the same as the one set in Hosted Insight Panel. it should be in the format `insight-recordId`.
14
+ * For example, `insight-500RL00000NA2BNYA1`, the current record id is just an example for the POC.
15
+ * @api
16
+ * @type {string}
17
+ */
18
+ engineId = `insight-500RL00000NA2BNYA1`;
19
+ @track results = [];
20
+
21
+ attachedResults;
22
+ unsubscribe;
23
+ headless;
24
+
25
+ connectedCallback() {
26
+ registerComponentForInit(this, this.engineId);
27
+ }
28
+
29
+ renderedCallback() {
30
+ initializeWithHeadless(this, this.engineId, this.initialize);
31
+ }
32
+
33
+ initialize = (engine) => {
34
+ // This component needs to do a logic similar to what the Insight Renderer does to use APEX to get the attached results saved in Salesforce and setting them in the Headless state.
35
+ // While doing that the loading state should be handled properly and reflected in the UI.
36
+ this.engine = engine;
37
+ this.headless = getHeadlessBundle(this.engineId);
38
+ this.attachedResults = this.headless.buildAttachToCase(engine, {
39
+ options: {
40
+ result: null,
41
+ caseId: '123', // The caseId should be dynamic based on the current record id.
42
+ },
43
+ });
44
+ this.unsubscribe = this.attachedResults.subscribe(() => this.updateState());
45
+ this.actions = {
46
+ ...this.headless.loadAttachedResultsActions(engine),
47
+ ...this.headless.loadAttachedResultsAnalyticsActions(engine),
48
+ };
49
+ };
50
+
51
+ disconnectedCallback() {
52
+ this.unsubscribe?.();
53
+ }
54
+
55
+ updateState() {
56
+ this.results =
57
+ this.attachedResults.state?.results.map((result) => ({
58
+ ...result,
59
+ handleDetach: () => {
60
+ this.detach(result);
61
+ },
62
+ })) || [];
63
+ }
64
+
65
+ detach = (result) => {
66
+ // Loading state should be handled properly in the UI after clicking the detach button.
67
+ this._isLoading = true;
68
+ // We detach using the attach to case APEX service.
69
+ DetachFromCase({
70
+ uriHash: result.permanentId,
71
+ sfkbid: result.knowledgeArticleId,
72
+ caseId: '500RL00000NA2BNYA1',
73
+ })
74
+ .then((response) => {
75
+ const parsedResponse = JSON.parse(response);
76
+ if (parsedResponse?.succeeded) {
77
+ // we detach from the Headless state.
78
+ this.engine.dispatch(
79
+ this.actions.detachResult({ ...result, uriHash: result.permanentId }
80
+ )
81
+ );
82
+ // We log analytics event.
83
+ this.engine.dispatch(
84
+ this.actions.logCaseDetach({
85
+ ...result,
86
+ raw: {
87
+ urihash: result.permanentId,
88
+ permanentid: result.permanentId,
89
+ },
90
+ })
91
+ );
92
+ } else {
93
+ console.error('Error detaching result:', parsedResponse?.errors);
94
+ }
95
+ })
96
+ .catch((error) => {
97
+ console.error('Error detaching result:');
98
+ })
99
+ .finally(() => {
100
+ this._isLoading = false;
101
+ });
102
+ };
103
+ }
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>53.0</apiVersion>
4
+ <isExposed>true</isExposed>
5
+ <targets>
6
+ <target>lightning__RecordPage</target>
7
+ </targets>
8
+ </LightningComponentBundle>