Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c368753
add ActivityTemplate
a-b-r-o-w-n Oct 15, 2019
ceea25b
update adaptive dialog
a-b-r-o-w-n Oct 15, 2019
8a3502d
EntityRecognizer -> EntityRecognizers
a-b-r-o-w-n Oct 15, 2019
3267a73
extract $ fields to sharable function
a-b-r-o-w-n Oct 15, 2019
69d5e5e
update id property
a-b-r-o-w-n Oct 15, 2019
7e36e94
input updates
a-b-r-o-w-n Oct 15, 2019
885d03f
update BeginDialog
a-b-r-o-w-n Oct 15, 2019
401418f
update CancelAllDialogs
a-b-r-o-w-n Oct 15, 2019
28da894
update ChoiceInput
a-b-r-o-w-n Oct 15, 2019
a766b4a
add ConditionalSelector
a-b-r-o-w-n Oct 15, 2019
171cec2
update ConfirmInput
a-b-r-o-w-n Oct 15, 2019
29e2afe
update DateTimeInput
a-b-r-o-w-n Oct 15, 2019
b0ed108
update DebugBreak
a-b-r-o-w-n Oct 15, 2019
93f1334
remove extraneous fields
a-b-r-o-w-n Oct 15, 2019
f7d4a45
update DeleteProperty
a-b-r-o-w-n Oct 15, 2019
1448d99
update EditActions
a-b-r-o-w-n Oct 15, 2019
520dca3
update EditArray
a-b-r-o-w-n Oct 15, 2019
ce93da7
update EmitEvent
a-b-r-o-w-n Oct 15, 2019
2c43f53
update EndDialog
a-b-r-o-w-n Oct 15, 2019
6997331
update EndTurn
a-b-r-o-w-n Oct 15, 2019
f11e666
add FirstSelector
a-b-r-o-w-n Oct 15, 2019
93bd00e
update Foreach
a-b-r-o-w-n Oct 15, 2019
5f1414f
update ForeachPage
a-b-r-o-w-n Oct 15, 2019
f26d8e0
update HTTPRequest
a-b-r-o-w-n Oct 15, 2019
9649b37
update IActivityTemplate
a-b-r-o-w-n Oct 15, 2019
42a11bb
update IDialog
a-b-r-o-w-n Oct 15, 2019
fc3a4af
update interfaces
a-b-r-o-w-n Oct 15, 2019
23dd2bb
update IfCondition
a-b-r-o-w-n Oct 15, 2019
7b2d59a
update InitProperty
a-b-r-o-w-n Oct 15, 2019
f57fd75
update LanguagePolicy
a-b-r-o-w-n Oct 15, 2019
fc5b896
update LogAction
a-b-r-o-w-n Oct 15, 2019
76d183a
Update LuisRecognizer
a-b-r-o-w-n Oct 15, 2019
aecac8f
add MostSpecificSelector MultiLanguageRecognizer
a-b-r-o-w-n Oct 15, 2019
9eba03f
update NumberInput
a-b-r-o-w-n Oct 15, 2019
6d6912a
update OAuthInput
a-b-r-o-w-n Oct 15, 2019
cf81cd1
update Trigger Conditions
a-b-r-o-w-n Oct 15, 2019
af19e4a
update QnAMakerDialog
a-b-r-o-w-n Oct 15, 2019
d882a54
update regex types
a-b-r-o-w-n Oct 15, 2019
b2ddf4d
update RepeatDialog
a-b-r-o-w-n Oct 15, 2019
1b1093c
update ReplaceDialog
a-b-r-o-w-n Oct 15, 2019
c1a05f7
update SendActivity
a-b-r-o-w-n Oct 15, 2019
b98415e
update SetProperty
a-b-r-o-w-n Oct 15, 2019
832498c
add StaticActivityTemplate
a-b-r-o-w-n Oct 15, 2019
b37df05
update SwitchCondition
a-b-r-o-w-n Oct 15, 2019
aeffc55
update TextInput
a-b-r-o-w-n Oct 15, 2019
75276f7
add TextTemplate
a-b-r-o-w-n Oct 15, 2019
511f848
update TraceActivity
a-b-r-o-w-n Oct 15, 2019
e8df77e
add TrueSelector
a-b-r-o-w-n Oct 15, 2019
e927c0b
update events -> triggers
a-b-r-o-w-n Oct 15, 2019
3b6152c
move SDKTypes to own file
a-b-r-o-w-n Oct 15, 2019
ed009b6
add to triggers instead of events when creating new trigger
a-b-r-o-w-n Oct 16, 2019
de01b8b
update visual editor to reference triggers and OnCustomEvent
a-b-r-o-w-n Oct 16, 2019
62cc148
remove value from prompt form
a-b-r-o-w-n Oct 16, 2019
6154dbd
update editor schema
a-b-r-o-w-n Oct 16, 2019
9a842c5
fix navigating to actions from form
a-b-r-o-w-n Oct 16, 2019
187f751
memoize form change handler
a-b-r-o-w-n Oct 16, 2019
a85353e
show dialog events in trigger creation
a-b-r-o-w-n Oct 16, 2019
1b69a3c
remove leftover anyOf
a-b-r-o-w-n Oct 16, 2019
131c239
fix trigger event creation
a-b-r-o-w-n Oct 16, 2019
b485b9d
update uiSchema
a-b-r-o-w-n Oct 16, 2019
eb67da7
fix HttpRequest headers schema
a-b-r-o-w-n Oct 16, 2019
c15809b
improve obischema type
a-b-r-o-w-n Oct 16, 2019
8372bcf
fix dialog options name
a-b-r-o-w-n Oct 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Composer/packages/client/src/ShellApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,16 @@ export const ShellApi: React.FC = () => {
function focusSteps({ subPaths = [], fragment }, event) {
cleanData();
let dataPath: string = subPaths[0];
if (event.source.name === FORM_EDITOR && focused && dataPath !== focused) {
dataPath = `${focused}.${dataPath}`;

if (event.source.name === FORM_EDITOR) {
// nothing focused yet, prepend the selected path
if (!focused && selected) {
dataPath = `${selected}.${dataPath}`;
} else if (focused !== dataPath) {
dataPath = `${focused}.${dataPath}`;
}
}

actions.focusTo(dataPath, fragment);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import formatMessage from 'format-message';
import { DialogFooter, PrimaryButton, DefaultButton, Stack, TextField, IDropdownOption } from 'office-ui-fabric-react';
import { Dropdown } from 'office-ui-fabric-react/lib/Dropdown';
import { get } from 'lodash';
import { appschema } from 'shared';

import {
addNewTrigger,
Expand Down Expand Up @@ -56,7 +57,7 @@ export const TriggerCreationModal: React.FC<TriggerCreationModalProps> = props =
const { isOpen, onDismiss, onSubmit, dialogId } = props;
const [formData, setFormData] = useState(initialFormData);
const { state } = useContext(StoreContext);
const { dialogs, schemas, luFiles } = state;
const { dialogs, luFiles } = state;
const luFile = luFiles.find(lu => lu.id === dialogId);
const onClickSubmitButton = e => {
e.preventDefault();
Expand Down Expand Up @@ -93,17 +94,16 @@ export const TriggerCreationModal: React.FC<TriggerCreationModalProps> = props =
[field]: newValue,
});
};
const eventTypes = get(schemas, `sdk.content.definitions.['${eventTypeKey}'].properties.events.items.enum`, []).map(
t => {
return { key: t, text: t };
}
);
const eventTypes = get(appschema, `definitions.['${eventTypeKey}'].properties.event.enum`, []).map(t => {
return { key: t, text: t };
});

const intents = get(luFile, 'parsedContent.LUISJsonStructure.intents', []);

const intentOptions = intents.map(t => {
return { key: t.name, text: t.name };
});

const showEventDropDown = formData.$type === eventTypeKey;
const showIntentDropDown = formData.$type === intentTypeKey;
return (
Expand Down
5 changes: 3 additions & 2 deletions Composer/packages/client/src/utils/dialogUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ export function getFriendlyName(data) {

export function insert(content, path: string, position: number | undefined, data: TriggerFormData) {
const current = get(content, path, []);
const optionalAttributes: { intent?: string; events?: string[] } = {};
const optionalAttributes: { intent?: string; event?: string } = {};

if (data.eventType) {
optionalAttributes.events = [data.eventType];
optionalAttributes.event = data.eventType;
}

if (data.intent) {
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/extensions/obiformeditor/demo/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function createDialogInfo(id: string, content: Partial<MicrosoftAdaptiveDialog>
isRoot: id === 'Main',
content: {
$type: 'Microsoft.AdaptiveDialog',
events: [],
triggers: [],
...content,
},
lgFile: '',
Expand Down Expand Up @@ -367,7 +367,7 @@ const Demo: React.FC = () => {
memory={memoryFormData}
onChange={debouncedOnChange}
schemas={{ editor: editorSchemaFormData }}
shellApi={mockShellApi as ShellApi}
shellApi={mockShellApi}
luFiles={luFiles}
lgFiles={lgFiles}
currentDialog={dialogFiles[0]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ export const UserAnswers: React.FC<UserAnswersProps> = props => {
/>
</div>
)}
<div css={field}>
<TextWidget
onChange={onChange('value')}
schema={getSchema('value')}
id={idSchema.value.__id}
value={formData.value}
label={formatMessage('Value')}
formContext={props.formContext}
rawErrors={errorSchema.value && errorSchema.value.__errors}
/>
</div>
{getSchema('defaultLocale') && (
<div css={field}>
<TextWidget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { setOverridesOnField } from '../utils';

import { TableField } from './TableField';

const renderTitle = (item: MicrosoftIRule) => {
const renderTitle = (item: ITriggerCondition) => {
const friendlyName = get(item, '$designer.name');

if (friendlyName) {
Expand All @@ -28,12 +28,12 @@ export function RulesField(props: FieldProps) {
const overrides = setOverridesOnField(props.formContext, 'RulesField');

return (
<TableField<MicrosoftIRule>
<TableField<ITriggerCondition>
{...props}
{...overrides}
dialogOptionsOpts={{ include: [DialogGroup.EVENTS], subMenu: false }}
label={formatMessage('Add New Rule')}
navPrefix="events"
navPrefix="triggers"
renderTitle={renderTitle}
>
{({ createNewItemAtIndex }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const StepsField: React.FC<BFDFieldProps> = props => {
dialogOptionsOpts={{
exclude: [DialogGroup.EVENTS, DialogGroup.ADVANCED_EVENTS, DialogGroup.SELECTOR, DialogGroup.OTHER],
}}
navPrefix={`${formContext.focusedEvent}.${props.name}`}
navPrefix={props.name}
>
{({ createNewItemAtIndex }) => (
<DefaultButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import ErrorBoundary, { FallbackProps } from 'react-error-boundary';
import { MessageBar, MessageBarType } from 'office-ui-fabric-react';
import debounce from 'lodash.debounce';
Expand Down Expand Up @@ -32,7 +32,8 @@ const ObiFormEditor: React.FC<FormEditorProps> = props => {
props.onChange(data, props.focusedSteps[0]);
};

const debouncedOnChange = debounce(onChange, 750);
// only need to debounce the change handler when focusedSteps change
const debouncedOnChange = useMemo(() => debounce(onChange, 750), [props.focusedSteps[0]]);
const key = get(props.data, '$designer.id', props.focusPath);

return (
Expand Down
27 changes: 9 additions & 18 deletions Composer/packages/extensions/obiformeditor/src/schema/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ interface InputDialog extends BaseSchema {
maxTurnCount: number;
/** Expressions to validate an input. */
validations: MicrosoftIExpression[];
/** The expression that you evaluated for input. */
value: MicrosoftIExpression;
/** Property that this input dialog is bound to */
property: MicrosoftIExpression;
/** Value to return if the value expression can't be evaluated. */
Expand Down Expand Up @@ -193,13 +191,7 @@ interface RuleBase extends BaseSchema {
/** Optional constraint to which must be met for this rule to fire */
constraint?: string;
/** Sequence of steps or dialogs to execute */
steps: MicrosoftIDialog[];
}

/** Defines a rule for an event which is triggered by some source */
interface OnEvent extends RuleBase {
/** Events to trigger this rule for */
events: DialogEvent[];
actions: MicrosoftIDialog[];
}

/** This defines the steps to take when an Intent is recognized (and optionally entities) */
Expand All @@ -210,13 +202,10 @@ interface OnIntent extends RuleBase {
entities: string[];
}

/** Defines a rule for an event which is triggered by some source */
interface Rule extends RuleBase {}

/** Defines a sequence of steps to take if there is no other trigger or plan operating */
interface OnUnknownIntent extends RuleBase {}

type MicrosoftIRule = OnEvent | OnIntent | Rule | OnUnknownIntent;
type ITriggerCondition = OnIntent | OnUnknownIntent;

/**
* Conversational Flow and Dialog Management
Expand All @@ -239,23 +228,25 @@ interface SwitchCondition extends BaseSchema {
default?: MicrosoftIDialog[];
}

/** This configures a data driven dialog via a collection of steps/dialogs. */
/** Flexible, data driven dialog that can adapt to the conversation. */
interface MicrosoftAdaptiveDialog extends BaseSchema {
/** Optional dialog ID. */
id?: string;
/** If this is true the dialog will automatically end when there are no more steps to run. If this is false it is the responsbility of the author to call EndDialog at an appropriate time. */
autoEndDialog?: boolean;
/** Value that will be passed back to the parent dialog. */
defaultResultProperty?: string;
/** Configured recognizer to generate intent and entites from user utterance. */
recognizer?: MicrosoftIRecognizer;
/** Language generator to use for this dialog. (aka: LG file) */
generator?: string;
/** This is the array of rules to use to evaluate conversation */
events: MicrosoftIRule[];
triggers: ITriggerCondition[];
}

/* Union of components which implement the IDialog interface */
type MicrosoftIDialog =
| ChoiceInput
| ConfirmInput
| MicrosoftIRecognizer
| MicrosoftIRule
| ITriggerCondition
| SwitchCondition
| TextInput;
Loading