Skip to content

Commit

Permalink
chore: Hide triggers 'OnQnAMatch' and 'OnChooseIntent' in PVA env (#5619
Browse files Browse the repository at this point in the history
)

Co-authored-by: Andy Brown <asbrown002@gmail.com>
  • Loading branch information
yeze322 and a-b-r-o-w-n authored Jan 27, 2021
1 parent 02b9c1f commit 79a2ba4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Composer/packages/extension-client/src/hooks/useTriggerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
// Licensed under the MIT License.

import { useContext, useMemo } from 'react';
import get from 'lodash/get';
import { SDKKinds } from '@botframework-composer/types';

import { EditorExtensionContext } from '../EditorExtensionContext';
import { TriggerUISchema } from '../types';

export function useTriggerConfig() {
const { plugins } = useContext(EditorExtensionContext);
const { plugins, shellData } = useContext(EditorExtensionContext);
const { schemas } = shellData;

const isPvaEnv = Boolean(get(schemas, 'sdk.content.definitions["Microsoft.VirtualAgents.Recognizer"]'));

const triggerConfig: TriggerUISchema = useMemo(() => {
const implementedTriggerSchema: TriggerUISchema = {};
Expand All @@ -16,6 +21,12 @@ export function useTriggerConfig() {
implementedTriggerSchema[$kind] = options.trigger;
}
});

// Hide 'OnChooseIntent' and 'OnQnAMatch' from PVA bots.
if (isPvaEnv) {
delete implementedTriggerSchema[SDKKinds.OnChooseIntent];
delete implementedTriggerSchema[SDKKinds.OnQnAMatch];
}
return implementedTriggerSchema;
}, [plugins.uiSchema]);

Expand Down

0 comments on commit 79a2ba4

Please sign in to comment.