Skip to content

Commit 56ebcd8

Browse files
Remove multiple primary handling logic from SDK (#308)
1 parent ca8a0f8 commit 56ebcd8

File tree

4 files changed

+1
-53
lines changed

4 files changed

+1
-53
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thoughtspot/visual-embed-sdk",
3-
"version": "1.40.2",
3+
"version": "1.40.3",
44
"description": "ThoughtSpot Embed SDK",
55
"module": "lib/src/index.js",
66
"main": "dist/tsembed.js",

src/errors.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export const CUSTOM_ACTIONS_ERROR_MESSAGE = {
2525
MISSING_REQUIRED_FIELDS: (id: string, missingFields: string[]) => `Custom Action Validation Error for '${id}': Missing required fields: ${missingFields.join(', ')}`,
2626
UNSUPPORTED_TARGET: (id: string, targetType: string) => `Custom Action Validation Error for '${id}': Target type '${targetType}' is not supported`,
2727
INVALID_POSITION: (position: string, targetType: string, supportedPositions: string) => `Position '${position}' is not supported for ${targetType.toLowerCase()}-level custom actions. Supported positions: ${supportedPositions}`,
28-
MULTIPLE_PRIMARY_ACTIONS: (targetType: string, existingName: string, newName: string) => `Multiple primary actions found for ${targetType.toLowerCase()}-level custom actions: '${existingName}' and '${newName}'. Only the first action will be shown.`,
2928
INVALID_METADATA_IDS: (targetType: string, invalidIds: string[], supportedIds: string) => `Invalid metadata IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported metadata IDs: ${supportedIds}`,
3029
INVALID_DATA_MODEL_IDS: (targetType: string, invalidIds: string[], supportedIds: string) => `Invalid data model IDs for ${targetType.toLowerCase()}-level custom actions: ${invalidIds.join(', ')}. Supported data model IDs: ${supportedIds}`,
3130
INVALID_FIELDS: (targetType: string, invalidFields: string[], supportedFields: string) => `Invalid fields for ${targetType.toLowerCase()}-level custom actions: ${invalidFields.join(', ')}. Supported fields: ${supportedFields}`,

src/utils/custom-actions.spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -268,46 +268,6 @@ describe('getCustomActions function', () => {
268268
});
269269
});
270270

271-
describe('Primary Action Conflicts', () => {
272-
test('should warn about multiple primary actions for same target', () => {
273-
const firstAction = {
274-
id: 'first-id',
275-
name: 'First Action',
276-
target: CustomActionTarget.LIVEBOARD,
277-
position: CustomActionsPosition.PRIMARY,
278-
};
279-
const secondAction = {
280-
id: 'second-id',
281-
name: 'Second Action',
282-
target: CustomActionTarget.LIVEBOARD,
283-
position: CustomActionsPosition.PRIMARY,
284-
};
285-
const result = getCustomActions([firstAction, secondAction]);
286-
expect(result.actions).toHaveLength(1);
287-
expect(result.actions[0]).toEqual(firstAction);
288-
expect(result.errors).toHaveLength(1);
289-
expect(result.errors[0]).toContain("Multiple primary actions found for liveboard-level custom actions");
290-
});
291-
292-
test('should allow multiple primary actions for different targets', () => {
293-
const liveboardAction = {
294-
id: 'lb-id',
295-
name: 'Liveboard Action',
296-
target: CustomActionTarget.LIVEBOARD,
297-
position: CustomActionsPosition.PRIMARY,
298-
};
299-
const vizAction = {
300-
id: 'viz-id',
301-
name: 'Viz Action',
302-
target: CustomActionTarget.VIZ,
303-
position: CustomActionsPosition.PRIMARY,
304-
};
305-
const result = getCustomActions([liveboardAction, vizAction]);
306-
expect(result.actions).toHaveLength(2);
307-
expect(result.errors).toEqual([]);
308-
});
309-
});
310-
311271
describe('Metadata IDs Validation', () => {
312272
test('should reject invalid metadata IDs for LIVEBOARD', () => {
313273
const action = {

src/utils/custom-actions.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,6 @@ const validateCustomAction = (action: CustomAction, primaryActionsPerTarget: Map
7777
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.INVALID_POSITION(position, targetType, supportedPositions));
7878
}
7979

80-
// Check for primary action conflicts (this is a warning, not a validation
81-
// failure)
82-
if (position === CustomActionsPosition.PRIMARY) {
83-
const existingPrimaryAction = primaryActionsPerTarget.get(targetType);
84-
if (existingPrimaryAction) {
85-
errors.push(CUSTOM_ACTIONS_ERROR_MESSAGE.MULTIPLE_PRIMARY_ACTIONS(targetType, existingPrimaryAction.name, action.name));
86-
} else {
87-
primaryActionsPerTarget.set(targetType, action);
88-
}
89-
}
90-
9180
// Validate metadata IDs
9281
if (metadataIds) {
9382
const invalidMetadataIds = Object.keys(metadataIds).filter(

0 commit comments

Comments
 (0)