Skip to content

Commit 2a76b46

Browse files
feat: update files and permissions
1 parent 22e1c29 commit 2a76b46

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module.exports = {
3636
enableConversationContext: 'false',
3737
conversationContext: [],
3838
enableAgentFromHeader: 'false',
39-
enableAgentFromFloatingButton: 'false'
39+
enableAgentFromFloatingButton: 'false',
40+
enableAgentFromSearchSuggestions: 'false'
4041
},
4142
// Customize how your 'site' and 'locale' are displayed in the url.
4243
url: {

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module.exports = {
3636
enableConversationContext: 'false',
3737
conversationContext: [],
3838
enableAgentFromHeader: 'false',
39-
enableAgentFromFloatingButton: 'false'
39+
enableAgentFromFloatingButton: 'false',
40+
enableAgentFromSearchSuggestions: 'false'
4041
},
4142
// Customize settings for your url
4243
url: {

packages/template-retail-react-app/app/components/search/index.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import React, {useEffect, useMemo, useRef, useState} from 'react'
7+
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
88
import {useSearchSuggestions} from '@salesforce/commerce-sdk-react'
99
import {
1010
Input,
@@ -225,7 +225,7 @@ const Search = (props) => {
225225
}
226226

227227
const clearInput = () => {
228-
searchInputRef.current.blur()
228+
searchInputRef.current?.blur()
229229
setIsOpen(false)
230230
}
231231

@@ -340,10 +340,10 @@ const Search = (props) => {
340340
}
341341
}
342342

343-
const onAskAssistantClick = () => {
343+
const onAskAssistantClick = useCallback(() => {
344344
launchChat()
345345
clearInput()
346-
}
346+
}, [launchChat, clearInput])
347347

348348
const shouldOpenPopover = () => {
349349
// As per design we only want to show the popover if the input is focused and we have recent searches saved

packages/template-retail-react-app/app/components/search/partials/ask-assistant-banner.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const AskAssistantBanner = ({onClick, styles}) => {
4545

4646
AskAssistantBanner.propTypes = {
4747
onClick: PropTypes.func.isRequired,
48-
styles: PropTypes.object
48+
styles: PropTypes.object.isRequired
4949
}
5050

5151
export default AskAssistantBanner

packages/template-retail-react-app/app/components/search/partials/search-suggestions-section.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const SuggestionSection = ({
2828
const hasPopularSearches = searchSuggestions?.popularSearchSuggestions?.length
2929
const hasRecentSearches = searchSuggestions?.recentSearchSuggestions?.length
3030

31+
const askAssistantBanner =
32+
showAskAssistantBanner && onAskAssistantClick ? (
33+
<AskAssistantBanner onClick={onAskAssistantClick} styles={styles} />
34+
) : null
35+
3136
return (
3237
<Fragment>
3338
{/* Mobile - Vertical alignment */}
@@ -102,9 +107,7 @@ const SuggestionSection = ({
102107
/>
103108
</Fragment>
104109
)}
105-
{showAskAssistantBanner && onAskAssistantClick && (
106-
<AskAssistantBanner onClick={onAskAssistantClick} styles={styles} />
107-
)}
110+
{askAssistantBanner}
108111
</HideOnDesktop>
109112
{/* Desktop - Vertical and Horizontal alignment */}
110113
<HideOnMobile>
@@ -199,9 +202,7 @@ const SuggestionSection = ({
199202
)}
200203
</Box>
201204
</Box>
202-
{showAskAssistantBanner && onAskAssistantClick && (
203-
<AskAssistantBanner onClick={onAskAssistantClick} styles={styles} />
204-
)}
205+
{askAssistantBanner}
205206
</HideOnMobile>
206207
</Fragment>
207208
)

packages/template-retail-react-app/app/utils/config-utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export const getCommerceAgentConfig = () => {
2121
enableConversationContext: 'false',
2222
conversationContext: [],
2323
enableAgentFromHeader: 'false',
24-
enableAgentFromFloatingButton: 'false'
24+
enableAgentFromFloatingButton: 'false',
25+
enableAgentFromSearchSuggestions: 'false'
2526
}
2627
return getConfig().app.commerceAgent ?? defaults
2728
}

0 commit comments

Comments
 (0)