Skip to content

Commit

Permalink
chore: Change default value of blockWhileBotResponding to 10000 (#257)
Browse files Browse the repository at this point in the history
because we already deployed auto disable input until bot reply feature,
we dont want to change this behaviour again. So we change default value
of blockWhileBotResponding to 10000 (current deployed spec).
  • Loading branch information
liamcho authored May 31, 2024
1 parent 8af3b0f commit b676ec3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const App = (props: Props) => {
deviceType={props.deviceType}
enableResetHistoryOnConnect={props.enableResetHistoryOnConnect}
// messageInputControls={{
// blockWhileBotResponding: 1000,
// blockWhileBotResponding: false,
// }}
// callbacks={{
// onWidgetExpandStateChange: (newIsExpanded) => {
Expand Down
14 changes: 9 additions & 5 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export const DEFAULT_CONSTANT = {
enableResetHistoryOnConnect: false,
dateLocale: enUS,
enableHideWidgetForDeactivatedUser: false,
messageInputControls: {
blockWhileBotResponding: 10000,
},
} satisfies Partial<Constant>;

type ConfigureSession = (
Expand Down Expand Up @@ -128,8 +131,9 @@ export interface MessageInputControls {
/**
* If undefined, false, or 0 is given, message input will not be blocked.
* If true or non-zero numeric value is given, message input will be blocked.
* If true is given, there will not be a force unblock.
* If true is given, there will not be a force unblock (unblocks IFF reply is received).
* If numeric value is given, it will be used as timeout to force unblock the input.
* Default value is 10000 (force unblock after 10 seconds).
*/
blockWhileBotResponding?: boolean | number;
}
Expand Down Expand Up @@ -171,6 +175,10 @@ export interface Constant extends ConstantFeatureFlags {
* @public locale instance to be applied
*/
dateLocale: Locale;
/**
* @public Message input state controlling properties.
*/
messageInputControls?: MessageInputControls;
/**
* @private Whether to show the beta mark.
*/
Expand Down Expand Up @@ -239,10 +247,6 @@ export interface Constant extends ConstantFeatureFlags {
* @private Callback to be called when the widget open state changes.
*/
onWidgetOpenStateChange?: (params: OnWidgetOpenStateChangeParams) => void;
/**
* @public Message input state controlling properties.
*/
messageInputControls?: MessageInputControls;
}

interface ConstantFeatureFlags {
Expand Down
5 changes: 4 additions & 1 deletion src/context/ConstantContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ export const ConstantStateProvider = (
enableResetHistoryOnConnect:
props.enableResetHistoryOnConnect ??
initialState.enableResetHistoryOnConnect,
messageInputControls: props.messageInputControls,
messageInputControls: {
...initialState.messageInputControls,
...props.messageInputControls,
},
dateLocale: props.dateLocale ?? initialState.dateLocale,
enableHideWidgetForDeactivatedUser:
props.enableHideWidgetForDeactivatedUser ??
Expand Down

0 comments on commit b676ec3

Please sign in to comment.