@adobe/spacecat-shared-data-access 2.52.0 → 2.53.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [@adobe/spacecat-shared-data-access-v2.53.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.52.0...@adobe/spacecat-shared-data-access-v2.53.0) (2025-08-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * add llmo methods for api endpoints ([#910](https://github.com/adobe/spacecat-shared/issues/910)) ([be938d5](https://github.com/adobe/spacecat-shared/commit/be938d5bd2bf3d430ab6f7b4b3ee4734aab98185))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v2.52.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.51.1...@adobe/spacecat-shared-data-access-v2.52.0) (2025-08-12)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "2.52.0",
3
+ "version": "2.53.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -380,6 +380,10 @@ export const Config = (data = {}) => {
380
380
  self.getLlmoHumanQuestions = () => state?.llmo?.questions?.Human;
381
381
  self.getLlmoAIQuestions = () => state?.llmo?.questions?.AI;
382
382
  self.getLlmoUrlPatterns = () => state?.llmo?.urlPatterns;
383
+ self.getLlmoCustomerIntent = () => {
384
+ const llmoConfig = self.getLlmoConfig();
385
+ return llmoConfig?.customerIntent || [];
386
+ };
383
387
 
384
388
  self.updateSlackConfig = (channel, workspace, invitedUserCount) => {
385
389
  state.slack = {
@@ -390,7 +394,9 @@ export const Config = (data = {}) => {
390
394
  };
391
395
 
392
396
  self.updateLlmoConfig = (dataFolder, brand, questions = {}, urlPatterns = undefined) => {
397
+ const currentLlmoConfig = state.llmo || {};
393
398
  state.llmo = {
399
+ ...currentLlmoConfig,
394
400
  dataFolder,
395
401
  brand,
396
402
  questions,
@@ -422,6 +428,47 @@ export const Config = (data = {}) => {
422
428
  state.llmo.questions.AI.push(...questions);
423
429
  };
424
430
 
431
+ self.addLlmoCustomerIntent = (customerIntentItems) => {
432
+ state.llmo = state.llmo || {};
433
+ state.llmo.customerIntent = state.llmo.customerIntent || [];
434
+ state.llmo.customerIntent.push(...customerIntentItems);
435
+ };
436
+
437
+ self.removeLlmoCustomerIntent = (intentKey) => {
438
+ state.llmo = state.llmo || {};
439
+ state.llmo.customerIntent = state.llmo.customerIntent || [];
440
+
441
+ const currentCustomerIntent = state.llmo.customerIntent;
442
+ const firstOccurrenceIndex = currentCustomerIntent.findIndex(
443
+ (item) => item.key === intentKey,
444
+ );
445
+
446
+ if (firstOccurrenceIndex !== -1) {
447
+ state.llmo.customerIntent = currentCustomerIntent.filter(
448
+ (item, index) => index !== firstOccurrenceIndex,
449
+ );
450
+ }
451
+ };
452
+
453
+ self.updateLlmoCustomerIntent = (intentKey, updateData) => {
454
+ state.llmo = state.llmo || {};
455
+ state.llmo.customerIntent = state.llmo.customerIntent || [];
456
+
457
+ const currentCustomerIntent = state.llmo.customerIntent;
458
+ const firstOccurrenceIndex = currentCustomerIntent.findIndex(
459
+ (item) => item.key === intentKey,
460
+ );
461
+
462
+ if (firstOccurrenceIndex !== -1) {
463
+ state.llmo.customerIntent = currentCustomerIntent.map((item, index) => {
464
+ if (index === firstOccurrenceIndex) {
465
+ return { ...item, ...updateData };
466
+ }
467
+ return item;
468
+ });
469
+ }
470
+ };
471
+
425
472
  self.removeLlmoQuestion = (key) => {
426
473
  state.llmo = state.llmo || {};
427
474
  state.llmo.questions = state.llmo.questions || {};
@@ -81,6 +81,11 @@ export interface LlmoUrlPattern {
81
81
  tags?: LmmoTag[];
82
82
  }
83
83
 
84
+ export interface LlmoCustomerIntent {
85
+ key: string;
86
+ value: string;
87
+ }
88
+
84
89
  export interface SiteConfig {
85
90
  state: {
86
91
  slack?: {
@@ -124,7 +129,8 @@ export interface SiteConfig {
124
129
  Human?: Array<LlmoQuestion>;
125
130
  AI?: Array<LlmoQuestion>;
126
131
  };
127
- urlPatterns?: Array<LlmoUrlPattern>
132
+ urlPatterns?: Array<LlmoUrlPattern>;
133
+ customerIntent?: Array<LlmoCustomerIntent>;
128
134
  };
129
135
  };
130
136
  extractWellKnownTags(tags: Array<string>): Partial<Record<WellKnownLmmoTag, string>>;
@@ -150,6 +156,8 @@ export interface SiteConfig {
150
156
  dataFolder: string;
151
157
  brand: string;
152
158
  questions?: { Human?: Array<LlmoQuestion>; AI?: Array<LlmoQuestion> };
159
+ urlPatterns?: Array<LlmoUrlPattern>;
160
+ customerIntent?: Array<LlmoCustomerIntent>;
153
161
  } | undefined;
154
162
  updateLlmoConfig(dataFolder: string, brand: string, questions?: {
155
163
  Human?: Array<LlmoQuestion>;
@@ -168,6 +176,10 @@ export interface SiteConfig {
168
176
  updateLlmoQuestion(key: string, questionUpdate: Partial<LlmoQuestion>): void;
169
177
  addLlmoUrlPatterns(urlPatterns: Array<LlmoUrlPattern>): void;
170
178
  removeLlmoUrlPattern(urlPattern: string): void;
179
+ getLlmoCustomerIntent(): Array<LlmoCustomerIntent>;
180
+ addLlmoCustomerIntent(customerIntentItems: Array<LlmoCustomerIntent>): void;
181
+ removeLlmoCustomerIntent(intentKey: string): void;
182
+ updateLlmoCustomerIntent(intentKey: string, updateData: Partial<LlmoCustomerIntent>): void;
171
183
  }
172
184
 
173
185
  export interface Site extends BaseModel {