Skip to content

Commit 208fd80

Browse files
committed
Clean up
1 parent 15d218f commit 208fd80

9 files changed

Lines changed: 43 additions & 25 deletions

File tree

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"botframework-webchat-cldr-data": "development",
7474
"botframework-webchat-core": "production",
7575
"botframework-webchat-react-valibot": "development",
76-
"botframework-webchat-store": "development"
76+
"botframework-webchat-redux-store": "development"
7777
},
7878
"pinDependencies": {
7979
"@babel/cli": [

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
"url": "https://github.com/microsoft/BotFramework-WebChat/issues"
4040
},
4141
"files": [
42+
"./*.js",
4243
"./dist/**/*",
43-
"./src/**/*",
44-
"*.js"
44+
"./src/**/*"
4545
],
4646
"homepage": "https://github.com/microsoft/BotFramework-WebChat/packages/core#readme",
4747
"tsd": {

packages/core/src/actions/clearSuggestedActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const clearSuggestedActionsActionSchema = pipe(
1111

1212
type ClearSuggestedActionsAction = InferOutput<typeof clearSuggestedActionsActionSchema>;
1313

14-
export default function clearSuggestedActions() {
14+
export default function clearSuggestedActions(): ClearSuggestedActionsAction {
1515
return {
1616
type: CLEAR_SUGGESTED_ACTIONS
17-
} satisfies ClearSuggestedActionsAction;
17+
};
1818
}
1919

2020
export { CLEAR_SUGGESTED_ACTIONS, clearSuggestedActionsActionSchema, type ClearSuggestedActionsAction };

packages/core/src/actions/registerActionSink.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ const registerActionSinkActionSchema = object({
1212

1313
type RegisterActionSinkAction = InferOutput<typeof registerActionSinkActionSchema>;
1414

15-
export default function registerActionSink(sink: (action: Action) => void): RegisterActionSinkAction {
15+
function registerActionSink(sink: (action: Action) => void): RegisterActionSinkAction {
1616
return {
1717
payload: { sink },
1818
type: REGISTER_ACTION_SINK
19-
} satisfies RegisterActionSinkAction;
19+
};
2020
}
2121

22+
export default registerActionSink;
2223
export { REGISTER_ACTION_SINK, registerActionSinkActionSchema, type RegisterActionSinkAction };

packages/core/src/actions/setSuggestedActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function setSuggestedActions(
3232
return {
3333
type: SET_SUGGESTED_ACTIONS,
3434
payload: { originActivity, suggestedActions }
35-
} satisfies SetSuggestedActionsAction;
35+
};
3636
}
3737

3838
export { SET_SUGGESTED_ACTIONS, setSuggestedActionsActionSchema, type SetSuggestedActionsAction };

packages/core/src/actions/unregisterActionSink.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ const unregisterActionSinkActionSchema = object({
1212

1313
type UnregisterActionSinkAction = InferOutput<typeof unregisterActionSinkActionSchema>;
1414

15-
export default function unregisterActionSink(sink: (action: Action) => void): UnregisterActionSinkAction {
15+
function unregisterActionSink(sink: (action: Action) => void): UnregisterActionSinkAction {
1616
return {
1717
payload: { sink },
1818
type: UNREGISTER_ACTION_SINK
19-
} satisfies UnregisterActionSinkAction;
19+
};
2020
}
2121

22+
export default unregisterActionSink;
2223
export { UNREGISTER_ACTION_SINK, unregisterActionSinkActionSchema, type UnregisterActionSinkAction };

packages/core/src/sagas/actionSinkSaga.ts

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
import { type Action } from 'redux';
22
import { take, takeEvery } from 'redux-saga/effects';
3-
import { parse } from 'valibot';
3+
import { safeParse } from 'valibot';
44

5-
import { REGISTER_ACTION_SINK, type RegisterActionSinkAction } from '../actions/registerActionSink';
5+
import {
6+
REGISTER_ACTION_SINK,
7+
registerActionSinkActionSchema,
8+
type RegisterActionSinkAction
9+
} from '../actions/registerActionSink';
610
import { UNREGISTER_ACTION_SINK, unregisterActionSinkActionSchema } from '../actions/unregisterActionSink';
711

812
export default function* actionSinkSaga() {
913
yield takeEvery(
1014
({ type }) => type === REGISTER_ACTION_SINK,
11-
function* ({ payload: { sink } }: RegisterActionSinkAction) {
12-
for (;;) {
13-
const action: Action = yield take();
15+
function* (action: RegisterActionSinkAction) {
16+
const result = safeParse(registerActionSinkActionSchema, action);
1417

15-
if (
16-
action.type === UNREGISTER_ACTION_SINK &&
17-
parse(unregisterActionSinkActionSchema, action).payload.sink === sink
18-
) {
19-
break;
20-
}
18+
if (result.success) {
19+
const {
20+
payload: { sink }
21+
} = result.output;
22+
23+
for (;;) {
24+
const action: Action = yield take();
25+
26+
if (action.type === UNREGISTER_ACTION_SINK) {
27+
const result = safeParse(unregisterActionSinkActionSchema, action);
2128

22-
sink(action);
29+
if (result.success && result.output.payload.sink === sink) {
30+
break;
31+
}
32+
}
33+
34+
sink(action);
35+
}
2336
}
2437
}
2538
);

packages/react-valibot/src/reactNode.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ function reactNode<
1010
function reactNode<
1111
const TMessage extends ErrorMessage<CustomIssue> | undefined = ErrorMessage<CustomIssue> | undefined
1212
>(message?: TMessage): CustomSchema<ReactNode, TMessage> {
13-
// TODO: Why do we need force cast?
14-
return custom<ReactNode, TMessage>(() => true, message as TMessage);
13+
return custom<ReactNode, TMessage>(
14+
() => true,
15+
// TODO: Probably lacking some undefined checks, thus, we need to force cast.
16+
message as TMessage
17+
);
1518
}
1619

1720
export default reactNode;

packages/redux-store/src/suggestedActions/private/SuggestedActionsContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type SuggestedActionsContextType = Readonly<{
55
useSuggestedActions: () => readonly [
66
readonly DirectLineCardAction[],
77
Dispatch<SetStateAction<readonly DirectLineCardAction[]>>,
8-
Readonly<{ activity: WebChatActivity | undefined }>
8+
Readonly<{ activity: undefined | WebChatActivity }>
99
];
1010
}>;
1111

0 commit comments

Comments
 (0)