Skip to content

Commit

Permalink
refactor(react & plugin-flow-builder): use camelCase for inferenceId …
Browse files Browse the repository at this point in the history
…and feedbackEnabled attributes
  • Loading branch information
Iru89 committed Jul 3, 2024
1 parent 8d35f24 commit 31f5aa5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class FlowKnowledgeBase extends ContentFieldsBase {
return (

Check warning on line 24 in packages/botonic-plugin-flow-builder/src/content-fields/flow-knowledge-base.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-plugin-flow-builder/src/content-fields/flow-knowledge-base.tsx#L24

Added line #L24 was not covered by tests
<Text
key={id}
feedbackenabled={this.feedbackEnabled}
inferenceid={this.inferenceId}
feedbackEnabled={this.feedbackEnabled}
inferenceId={this.inferenceId}
>
{this.text}
</Text>
Expand Down
4 changes: 2 additions & 2 deletions packages/botonic-react/src/components/index-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export interface MessageProps {
export interface TextProps extends MessageProps {
// converts markdown syntax to HTML
markdown?: boolean
feedbackenabled?: boolean
inferenceid?: string
feedbackEnabled?: boolean
inferenceId?: string
}

export interface Webview {
Expand Down
14 changes: 7 additions & 7 deletions packages/botonic-react/src/components/message/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const Message = props => {
style,
imagestyle = props.imagestyle || props.imageStyle,
isUnread = true,
feedbackenabled,
inferenceid,
feedbackEnabled,
inferenceId,
...otherProps
} = props

Expand Down Expand Up @@ -116,8 +116,8 @@ export const Message = props => {
customTypeName: decomposedChildren.customTypeName,
ack: ack,
isUnread: isUnread === 1 || isUnread === true,
feedbackenabled,
inferenceid,
feedbackEnabled,
inferenceId,
}
addMessage(message)
}
Expand Down Expand Up @@ -262,13 +262,13 @@ export const Message = props => {
{Boolean(blob) && hasBlobTick() && getBlobTick(5)}
</BlobContainer>
</MessageContainer>
{timestampsEnabled || feedbackenabled ? (
{timestampsEnabled || feedbackEnabled ? (
<MessageFooter
enabletimestamps={timestampsEnabled}
messageJSON={messageJSON}
sentBy={sentBy}
feedbackenabled={feedbackenabled}
inferenceid={inferenceid}
feedbackEnabled={feedbackEnabled}
inferenceId={inferenceId}
/>
) : null}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interface ButtonsState {
}

interface RatingProps {
inferenceid?: string
inferenceId?: string
messageId: string
}

export const MessageFeedback = ({ inferenceid, messageId }: RatingProps) => {
export const MessageFeedback = ({ inferenceId, messageId }: RatingProps) => {
const { webchatState, updateMessage, trackEvent } = useContext(WebchatContext)
const request = useContext(RequestContext)

Check warning on line 24 in packages/botonic-react/src/components/message/message-feedback.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-feedback.tsx#L23-L24

Added lines #L23 - L24 were not covered by tests

Expand All @@ -29,13 +29,13 @@ export const MessageFeedback = ({ inferenceid, messageId }: RatingProps) => {
negative: false,
})

const updateMsgWithFeedback = (feedbackenabled: boolean) => {
const updateMsgWithFeedback = (feedbackEnabled: boolean) => {
const message = webchatState.messagesJSON.find(
message => message.id === messageId

Check warning on line 34 in packages/botonic-react/src/components/message/message-feedback.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-feedback.tsx#L32-L34

Added lines #L32 - L34 were not covered by tests
)
const updatedMsg = {

Check warning on line 36 in packages/botonic-react/src/components/message/message-feedback.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-feedback.tsx#L36

Added line #L36 was not covered by tests
...message,
feedbackenabled,
feedbackEnabled,
}
updateMessage(updatedMsg)

Check warning on line 40 in packages/botonic-react/src/components/message/message-feedback.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-feedback.tsx#L40

Added line #L40 was not covered by tests
}
Expand Down Expand Up @@ -63,7 +63,7 @@ export const MessageFeedback = ({ inferenceid, messageId }: RatingProps) => {
}

const args = {

Check warning on line 65 in packages/botonic-react/src/components/message/message-feedback.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-feedback.tsx#L65

Added line #L65 was not covered by tests
knowledgebaseInferenceId: inferenceid,
knowledgebaseInferenceId: inferenceId,
feedbackTargetId: messageId,
feedbackGroupId: uuid(),
possibleOptions: [FeedbackOption.ThumbsUp, FeedbackOption.ThumbsDown],
Expand Down
12 changes: 6 additions & 6 deletions packages/botonic-react/src/components/message/message-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ interface MessageFooterProps {
enabletimestamps: boolean
messageJSON: any
sentBy: SENDERS
feedbackenabled: boolean
inferenceid?: string
feedbackEnabled: boolean
inferenceId?: string
}

export const MessageFooter = ({
enabletimestamps,
messageJSON,
sentBy,
feedbackenabled,
inferenceid,
feedbackEnabled,
inferenceId,
}: MessageFooterProps) => {
const { getThemeProperty } = useContext(WebchatContext)

Check warning on line 24 in packages/botonic-react/src/components/message/message-footer.tsx

View check run for this annotation

Codecov / codecov/patch

packages/botonic-react/src/components/message/message-footer.tsx#L24

Added line #L24 was not covered by tests

Expand All @@ -44,8 +44,8 @@ export const MessageFooter = ({
timestamp={messageJSON.timestamp}
/>
) : null}
{feedbackenabled ? (
<MessageFeedback inferenceid={inferenceid} messageId={messageJSON.id} />
{feedbackEnabled ? (
<MessageFeedback inferenceId={inferenceId} messageId={messageJSON.id} />
) : null}
</MessageFooterContainer>
)
Expand Down
4 changes: 2 additions & 2 deletions packages/botonic-react/src/components/text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const serialize = (textProps: TextProps) => {
export const Text = (props: TextProps) => {
const defaultTextProps = {
markdown: props.markdown === undefined ? true : props.markdown,
feedbackenabled: props.feedbackenabled,
inferenceid: props.inferenceid,
feedbackEnabled: props.feedbackEnabled,
inferenceId: props.inferenceId,
}

const textProps = mapObjectNonBooleanValues({
Expand Down

0 comments on commit 31f5aa5

Please sign in to comment.