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ezS,OAAOyS,cAAgB,GAC7CzS,OAAOyS,aAAapB,QAAO1L,EAAAA,EAAA,GACpB3F,OAAOyS,aAAapB,SAAW,IAC/BD,EAAQC,SAGXrR,OAAOyS,aAAanB,YAAW3L,EAAAA,EAAA,GAC5B3F,OAAOyS,aAAanB,aAAe,IACnCF,EAAQE,aAEY,MAAMoB,EAAiB,GAC9BA,EAAe,6DAA+D,CACtFnB,EAAGA,IAAMC,EAAQ,MACjBmB,GAAI,sCAEpB3S,OAAOyS,aAAezS,OAAOyS,cAAgB,GAC7CzS,OAAOyS,aAAaC,eAAc/M,EAAAA,EAAA,GACP3F,OAAOyS,aAAaC,gBAAkB,IACtCA,wFCzEpB,MAAME,IACGC,EAAAA,EAAAA,IAAA,CAAXC,EAAAA,IAAU,kCAECD,EAAAA,EAAAA,IAAA,CAAXC,EAAAA,IAAU,6CAECD,EAAAA,EAAAA,IAAA,CAAXC,EAAAA,IAAU,8KCLR,SAASpJ,EAAuBqC,GACnC,OAAO,IAAIgH,EAAAA,aAA0B,cAAehH,EAAQ,eAGhE,MAIaiH,GAA6BzW,EAAAA,EAAAA,IAA2B,CACjEE,OAA8BwW,EAAAA,iBAC9BxY,MANoCsC,GAC7B2M,EAAuB,CAAE9P,WAAY,OAQhD,WCvBAsZ,EAAOC,QAAUlV,cCAjBiV,EAAOC,QAAUC","sources":["webpack://Dobbies.Commerce/./src/modules/dobbies-search/actions/get-auto-suggest-suggestions.ts?2cd9","webpack://Dobbies.Commerce/./src/modules/dobbies-search/components/dobbies-search.categorysuggest.tsx?fcfd","webpack://Dobbies.Commerce/./src/modules/dobbies-search/components/dobbies-search.form.tsx?c965","webpack://Dobbies.Commerce/./src/modules/dobbies-search/components/dobbies-search.keywordsuggest.tsx?6a1a","webpack://Dobbies.Commerce/./src/modules/dobbies-search/components/dobbies-search.label.tsx?c5b5","webpack://Dobbies.Commerce/./src/modules/dobbies-search/components/dobbies-search.productsuggest.tsx?1f6c","webpack://Dobbies.Commerce/./src/modules/dobbies-search/dobbies-search.props.autogenerated.ts?f915","webpack://Dobbies.Commerce/./src/modules/dobbies-search/dobbies-search.tsx?9f21","webpack://Dobbies.Commerce/./src/modules/dobbies-search/dobbies-search.view.tsx?fb98","webpack://Dobbies.Commerce/./lib/dobbies-search/module-registration.js?aa1d","webpack://Dobbies.Commerce/./src/search-state.ts?dd10","webpack://Dobbies.Commerce/./src/search-state-data-action.ts?8223","webpack://Dobbies.Commerce/external var \"React\"?0d3b","webpack://Dobbies.Commerce/external var \"ReactDOM\"?853b"],"sourcesContent":["/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport { Autosuggestions } from '@msdyn365-commerce/commerce-entities';\r\nimport {\r\n CacheType,\r\n createObservableDataAction,\r\n getCatalogId,\r\n IAction,\r\n IActionContext,\r\n IActionInput,\r\n ICreateActionContext\r\n} from '@msdyn365-commerce/core';\r\nimport { SearchSuggestion, SearchSuggestionCriteria } from '@msdyn365-commerce/retail-proxy';\r\nimport { getSearchSuggestionsAsync } from '@msdyn365-commerce/retail-proxy/dist/DataActions/StoreOperationsDataActions.g';\r\nimport { generateImageUrl } from '@msdyn365-commerce-modules/retail-actions';\r\n\r\nexport enum SuggestionType {\r\n Category = 'ScopedCategory',\r\n Keyword = 'Keyword',\r\n Product = 'Product',\r\n None = 'None'\r\n}\r\n\r\n/**\r\n * Input class for auto suggest search input.\r\n */\r\nexport class AutoSuggestInput implements IActionInput {\r\n public searchQuery?: string;\r\n\r\n public topResultsCount?: number;\r\n\r\n public suggestionType?: string;\r\n\r\n public hitPrefix?: string;\r\n\r\n public hitSuffix?: string;\r\n\r\n public constructor(searchText?: string, top?: number, suggestionType?: string, hitPrefix?: string, hitSuffix?: string) {\r\n this.searchQuery = searchText;\r\n this.topResultsCount = top;\r\n this.suggestionType = suggestionType;\r\n this.hitPrefix = hitPrefix;\r\n this.hitSuffix = hitSuffix;\r\n }\r\n\r\n public getCacheKey = () => 'AutoSuggestSearchSuggestions';\r\n\r\n public getCacheObjectType = () => 'AutoSuggestSearchSuggestions';\r\n\r\n public dataCacheType = (): CacheType => 'none';\r\n}\r\n\r\nconst createInput = (inputData: ICreateActionContext) => {\r\n return new AutoSuggestInput();\r\n};\r\n\r\n/**\r\n * Calls the Retail API and returns a auto-suggest suggestions.\r\n * @param input\r\n * @param ctx\r\n */\r\nexport async function getSearchSuggestionsAction(input: AutoSuggestInput, ctx: IActionContext): Promise {\r\n // If no input is provided fail out\r\n if (!input || !input.searchQuery) {\r\n throw new Error('[getSearchSuggestionsAction]No valid Input was provided, failing');\r\n }\r\n\r\n const autosuggest: Autosuggestions = {};\r\n\r\n const autoSuggestPromises = [_getAutoSuggest(input, autosuggest, ctx)];\r\n return Promise.all(autoSuggestPromises).then(() => {\r\n return autosuggest;\r\n });\r\n}\r\n\r\nasync function _getAutoSuggest(input: AutoSuggestInput, autosuggest: Autosuggestions, ctx: IActionContext): Promise {\r\n const catalogId = getCatalogId(ctx.requestContext);\r\n const searchCriteria: SearchSuggestionCriteria = {\r\n ProductSearchCriteria: {\r\n SearchCondition: input.searchQuery && input.searchQuery.length > 0 ? input.searchQuery : '',\r\n Context: {\r\n ChannelId: +ctx.requestContext.apiSettings.channelId,\r\n CatalogId: catalogId\r\n }\r\n },\r\n HitPrefix: input.hitPrefix,\r\n HitSuffix: input.hitSuffix,\r\n SuggestionType: input.suggestionType\r\n };\r\n\r\n const searchSuggestions = await getSearchSuggestionsAsync(\r\n { callerContext: ctx, queryResultSettings: { Paging: { Top: input.topResultsCount } } },\r\n searchCriteria\r\n );\r\n\r\n if (searchSuggestions && searchSuggestions.length > 0) {\r\n // Generate image url\r\n searchSuggestions.map(\r\n (item: SearchSuggestion) =>\r\n (item.ImageUrl = item.ImageUrl ? generateImageUrl(item.ImageUrl, ctx.requestContext.apiSettings) : '')\r\n );\r\n\r\n autosuggest.AllSearchResults = searchSuggestions;\r\n } else {\r\n ctx.telemetry.error(\r\n `[getSearchSuggestionsAction] unable to get availabilites for search with suggestion type ${searchCriteria.SuggestionType}`\r\n );\r\n }\r\n}\r\n\r\nexport const getSearchSuggestionsActionDataAction = createObservableDataAction({\r\n id: '@msdyn365-commerce-modules/search/get-auto-suggest-suggestions',\r\n action: >getSearchSuggestionsAction,\r\n input: createInput\r\n});\r\n\r\nexport default getSearchSuggestionsActionDataAction;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport MsDyn365, { getRichTextHtml } from '@msdyn365-commerce/core';\r\nimport { ProductRefiner, ProductRefinerSource, ProductRefinerValue, SearchSuggestion } from '@msdyn365-commerce/retail-proxy';\r\nimport { format, getPayloadObject, getTelemetryAttributes, IPayLoad, ITelemetryContent } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nimport { IDobbiesSearchData } from '../dobbies-search.data';\r\nimport { IDobbiesSearchProps } from '../dobbies-search.props.autogenerated';\r\n\r\nexport interface ISearchCategorySuggestProps {\r\n searchCategorySuggestClass: string;\r\n searchPageURL: string;\r\n searchQsp: string | undefined;\r\n hitPrefix: string;\r\n hitSuffix: string;\r\n autoSuggestProps: IDobbiesSearchProps;\r\n searchText: string;\r\n searchRefiners: ProductRefiner[] | undefined;\r\n suggestions: SearchSuggestion[] | undefined;\r\n telemetryContent?: ITelemetryContent;\r\n shouldShowFullPath?: boolean;\r\n}\r\n\r\nexport interface ISearchCategoryViewProps {\r\n title: React.ReactNode;\r\n text: React.ReactNode[];\r\n}\r\n\r\nlet payLoad: IPayLoad;\r\n\r\n/**\r\n * CategorySuggestionsComponent.\r\n * @param props\r\n */\r\nexport const CategorySuggestionsComponent = (props: ISearchCategorySuggestProps): ISearchCategoryViewProps | undefined => {\r\n const {\r\n suggestions,\r\n searchText,\r\n autoSuggestProps: {\r\n resources: { categorySuggestionHeading }\r\n }\r\n } = props;\r\n\r\n const reactNodes: React.ReactNode[] = [];\r\n payLoad = getPayloadObject('click', props.telemetryContent!, '');\r\n\r\n suggestions?.map(item => {\r\n reactNodes.push(_assembleNode(item, props));\r\n });\r\n\r\n const titleNode = _renderTitle(categorySuggestionHeading, searchText);\r\n\r\n return { title: titleNode, text: reactNodes };\r\n};\r\n\r\nconst _renderTitle = (categorySuggestionHeading: string, searchText: string) => {\r\n const categoryAutoSuggestionHeading = categorySuggestionHeading\r\n ? format(categorySuggestionHeading, searchText)\r\n : `Search \"${searchText}\" in categories`;\r\n\r\n return
  • {categoryAutoSuggestionHeading}
  • ;\r\n};\r\n\r\nconst _assembleNode = (item: SearchSuggestion, props: ISearchCategorySuggestProps) => {\r\n const { searchText, hitPrefix, hitSuffix, shouldShowFullPath } = props;\r\n\r\n const splitValue = shouldShowFullPath ? item.Value : item.Value && item.Value.split('|').pop();\r\n const ariaLabel = splitValue\r\n ? splitValue.replace(new RegExp(`[${hitPrefix}]`, 'gi'), '').replace(new RegExp(`[${hitSuffix}]`, 'gi'), '')\r\n : item.Value && item.Value.replace(new RegExp(`[${hitPrefix}]`, 'gi'), '').replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n payLoad.contentAction.etext = item.Value;\r\n const attribute = getTelemetryAttributes(props.telemetryContent!, payLoad);\r\n return (\r\n
  • \r\n \r\n {_generateLink(item, searchText, props) && _getHighlightedText(splitValue ? splitValue : '', hitPrefix, hitSuffix)}\r\n \r\n
  • \r\n );\r\n};\r\n\r\nconst _generateLink = (suggestion: SearchSuggestion, searchText: string, props: ISearchCategorySuggestProps): string => {\r\n return suggestion && suggestion.Id ? _getCategoryLink(suggestion.Id, searchText, props) : '';\r\n};\r\n\r\nconst _getCategoryLink = (id: string, searchText: string, props: ISearchCategorySuggestProps): string => {\r\n const { searchPageURL, searchQsp, searchRefiners } = props;\r\n\r\n if (!MsDyn365.isBrowser) {\r\n return '';\r\n }\r\n\r\n const queryUrl = new URL(searchPageURL, window.location.href);\r\n\r\n if (searchQsp && searchText) {\r\n queryUrl.searchParams.set(searchQsp, searchText);\r\n }\r\n\r\n const categoryRefiners = searchRefiners?.find(refiners => {\r\n return refiners.SourceValue === ProductRefinerSource.Category;\r\n });\r\n const refiner = categoryRefiners?.Values?.find(item => {\r\n return item.RefinerRecordId === Number.parseInt(id, 10);\r\n });\r\n\r\n const encodedRefiner = refiner && JSON.stringify(compressRefiners([refiner]));\r\n if (encodedRefiner) {\r\n queryUrl.searchParams.set('refiners', encodedRefiner);\r\n }\r\n\r\n return queryUrl.href;\r\n};\r\n\r\nconst _getHighlightedText = (suggestion: string, hitPrefix: string, hitSuffix: string): JSX.Element => {\r\n const formattedText = suggestion\r\n .replace(new RegExp(`[${hitPrefix}]`, 'gi'), '')\r\n .replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n\r\n // eslint-disable-next-line react/no-danger\r\n return ;\r\n};\r\n\r\n// TODO: This code is currently duplicated in categoryautosuggest need to either remove one of these files\r\n// or move this code to a common place\r\nconst compressedRefinerKeys = [\r\n 'DataTypeValue',\r\n 'LeftValueBoundString',\r\n 'RefinerRecordId',\r\n 'RefinerSourceValue',\r\n 'RightValueBoundString',\r\n 'UnitText'\r\n];\r\n\r\n/**\r\n * Compressed a list of refiners for use in URLs.\r\n * @param refiners The uncompressed refiners.\r\n */\r\nconst compressRefiners = (refiners: ProductRefinerValue[]) => {\r\n const compressedRefiners: (string | number)[][] = [];\r\n\r\n refiners.forEach(refiner => {\r\n const compressedRefiner: (string | number)[] = [];\r\n compressedRefinerKeys.forEach(refinerKey => {\r\n compressedRefiner.push(refiner[refinerKey]);\r\n });\r\n compressedRefiners.push(compressedRefiner);\r\n });\r\n\r\n return compressedRefiners;\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport { Button } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nexport interface ISearchFormProps {\r\n hideSearchLabel: boolean | undefined;\r\n isSearchFormExpanded?: boolean | undefined;\r\n disableSubmitSearch: boolean | undefined;\r\n searchTextInput: React.RefObject;\r\n maxChars: number;\r\n searchQsp: string;\r\n searchPlaceholder: string;\r\n query: string;\r\n ariaLabelCancel: string;\r\n ariaLabelSearch: string;\r\n ariaLabelSubmit: string;\r\n handleCancelSearchChange(): void;\r\n handleInputChange(query: string): void;\r\n}\r\n\r\nexport interface ISearchFormViewProps {\r\n input: React.ReactNode;\r\n submitBtn: React.ReactNode;\r\n cancelBtn: React.ReactNode;\r\n}\r\n\r\n/**\r\n * On Input Change functionality.\r\n * @param handleInputChange -Input change function.\r\n * @returns Set updated input value.\r\n */\r\nconst onInputChangeFunction = (handleInputChange: (query: string) => void) => (event: React.ChangeEvent) => {\r\n handleInputChange(event.target.value || '');\r\n};\r\nexport const FormComponent = (props: ISearchFormProps): ISearchFormViewProps => {\r\n const {\r\n searchQsp,\r\n searchPlaceholder,\r\n hideSearchLabel,\r\n searchTextInput,\r\n handleInputChange,\r\n maxChars,\r\n disableSubmitSearch,\r\n handleCancelSearchChange,\r\n query,\r\n ariaLabelCancel,\r\n ariaLabelSearch,\r\n ariaLabelSubmit\r\n } = props;\r\n\r\n const onInputChange = onInputChangeFunction(handleInputChange);\r\n\r\n const inputNode = !hideSearchLabel ? (\r\n \r\n ) : (\r\n \r\n );\r\n\r\n const submitBtnNode = !disableSubmitSearch && \r\n \r\n );\r\n};\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport { PriceComponent } from '@msdyn365-commerce/components';\r\nimport { getRichTextHtml, IActionContext, IImageSettings, Image, ITelemetry } from '@msdyn365-commerce/core';\r\nimport { SearchSuggestion } from '@msdyn365-commerce/retail-proxy';\r\nimport { getProductPageUrlSync, ObjectExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport {\r\n getPayloadObject,\r\n getTelemetryAttributes,\r\n INodeProps,\r\n IPayLoad,\r\n ITelemetryContent,\r\n NodeTag\r\n} from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nimport { IDobbiesSearchData } from '../dobbies-search.data';\r\nimport { IDobbiesSearchProps } from '../dobbies-search.props.autogenerated';\r\n\r\n/**\r\n * Search product suggest resources.\r\n */\r\nexport interface ISearchProductSuggestResources {\r\n freePriceText: string;\r\n}\r\n\r\nexport interface ISearchProductSuggestProps {\r\n searchProductSuggestClass: string;\r\n searchPageURL: string;\r\n searchQsp: string | undefined;\r\n hitPrefix: string;\r\n hitSuffix: string;\r\n autoSuggestProps: IDobbiesSearchProps;\r\n searchText: string;\r\n suggestions: SearchSuggestion[] | undefined;\r\n telemetry: ITelemetry;\r\n moduleType: string;\r\n moduleId: string;\r\n telemetryContent?: ITelemetryContent;\r\n resources?: ISearchProductSuggestResources;\r\n}\r\n\r\nexport interface ISearchProductViewProps {\r\n title: React.ReactNode;\r\n items: ISearchProductItemViewProps[];\r\n}\r\n\r\nexport interface ISearchProductItemViewProps {\r\n text: React.ReactNode;\r\n thumbnail: React.ReactNode;\r\n price: React.ReactNode;\r\n LiProduct: INodeProps;\r\n AProduct: INodeProps;\r\n id: string | undefined;\r\n}\r\n\r\nlet payLoad: IPayLoad;\r\nlet telemetryContent: ITelemetryContent | undefined;\r\n\r\n/**\r\n * ProductSuggestionsComponent.\r\n * @param props\r\n */\r\nexport const ProductSuggestionsComponent = (props: ISearchProductSuggestProps): ISearchProductViewProps | undefined => {\r\n const {\r\n suggestions,\r\n hitSuffix,\r\n hitPrefix,\r\n autoSuggestProps: {\r\n context: { actionContext },\r\n resources: { productSuggestionHeading }\r\n },\r\n moduleType,\r\n moduleId\r\n } = props;\r\n const reactNodes: ISearchProductItemViewProps[] = [];\r\n telemetryContent = props.telemetryContent;\r\n payLoad = getPayloadObject('click', props.telemetryContent!, '');\r\n\r\n suggestions?.map(item => {\r\n reactNodes.push(_assembleNode(item, hitPrefix, hitSuffix, actionContext, props, moduleType, moduleId));\r\n });\r\n\r\n const titleNode = _renderTitle(productSuggestionHeading);\r\n\r\n return { title: titleNode, items: reactNodes };\r\n};\r\n\r\nconst _renderTitle = (productSuggestionHeading: string) => {\r\n const productAutoSuggestionHeading = productSuggestionHeading ? productSuggestionHeading : 'Go to products';\r\n\r\n return
  • {productAutoSuggestionHeading}
  • ;\r\n};\r\n\r\nconst _assembleNode = (\r\n item: SearchSuggestion,\r\n hitPrefix: string,\r\n hitSuffix: string,\r\n actionContext: IActionContext,\r\n props: ISearchProductSuggestProps,\r\n moduleType: string,\r\n moduleId: string\r\n): ISearchProductItemViewProps => {\r\n const altText =\r\n item.Value && item.Value.replace(new RegExp(`[${hitPrefix}]`, 'gi'), '').replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n\r\n const price = item.Value3?.Value?.DecimalValue;\r\n return {\r\n text: _getHighlightedText(item.Value ? item.Value : '', hitPrefix, hitSuffix),\r\n thumbnail: _renderThumbnail(item, altText ? altText : '', props),\r\n price: !ObjectExtensions.isNullOrUndefined(price) && _renderPrice(price, price, moduleId, moduleType, props),\r\n LiProduct: _getLiWrapper(),\r\n AProduct: _getAWrapper(item, hitPrefix, hitSuffix, actionContext, props),\r\n id: item.Id\r\n };\r\n};\r\n\r\nconst _getLiWrapper = () => {\r\n return {\r\n className: 'msc-autoSuggest__productResults-item',\r\n tag: 'li' as NodeTag\r\n };\r\n};\r\n\r\nconst _getAWrapper = (\r\n item: SearchSuggestion,\r\n hitPrefix: string,\r\n hitSuffix: string,\r\n actionContext: IActionContext,\r\n props: ISearchProductSuggestProps\r\n) => {\r\n const {\r\n autoSuggestProps: { context }\r\n } = props;\r\n const ariaLabel =\r\n item.Value && item.Value.replace(new RegExp(`[${hitPrefix}]`, 'gi'), '').replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n\r\n payLoad.contentAction.recid = item.Id;\r\n const attribute = getTelemetryAttributes(telemetryContent!, payLoad);\r\n const productPrice = context.cultureFormatter.formatCurrency(item.Value3!.Value!.DecimalValue!, context.request.channel?.Currency);\r\n\r\n return {\r\n className: 'msc-autoSuggest__productResults-item',\r\n tag: 'a' as NodeTag,\r\n 'aria-label': `${ariaLabel!} ${productPrice}`,\r\n href: _generateLink(item, hitPrefix, hitSuffix, actionContext),\r\n ...attribute\r\n };\r\n};\r\n\r\nconst _generateLink = (suggestion: SearchSuggestion, hitPrefix: string, hitSuffix: string, actionContext: IActionContext) => {\r\n const formattedLink = (suggestion.Value as string)\r\n .replace(new RegExp(`[${hitPrefix}]`, 'gi'), '')\r\n .replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n return suggestion.Value && suggestion.Id\r\n ? getProductPageUrlSync(formattedLink, (suggestion.Id as unknown) as number, actionContext, undefined)\r\n : '';\r\n};\r\n\r\nconst _getHighlightedText = (suggestion: string, hitPrefix: string, hitSuffix: string): JSX.Element => {\r\n const formattedText = suggestion\r\n .replace(new RegExp(`[${hitPrefix}]`, 'gi'), '')\r\n .replace(new RegExp(`[${hitSuffix}]`, 'gi'), '');\r\n\r\n return (\r\n // eslint-disable-next-line react/no-danger\r\n \r\n );\r\n};\r\n\r\nconst _renderPrice = (\r\n adjustedPrice: number,\r\n basePrice: number,\r\n moduleId: string,\r\n moduleType: string,\r\n props: ISearchProductSuggestProps\r\n): JSX.Element | null => {\r\n const {\r\n autoSuggestProps: { context }\r\n } = props;\r\n\r\n return (\r\n \r\n );\r\n};\r\n\r\nconst _renderThumbnail = (suggestion: SearchSuggestion, altText: string, props: ISearchProductSuggestProps): JSX.Element | null => {\r\n const {\r\n autoSuggestProps: {\r\n context: {\r\n request: { gridSettings }\r\n },\r\n config: { imageSettings }\r\n }\r\n } = props;\r\n if (imageSettings) {\r\n imageSettings.cropFocalRegion = true;\r\n }\r\n\r\n if (!suggestion || !suggestion.ImageUrl) {\r\n props.telemetry.error('Search suggestion content is empty, module wont render.');\r\n return null;\r\n }\r\n\r\n const defaultImageSettings: IImageSettings = {\r\n viewports: {\r\n xs: { q: 'w=40&h=40&m=6', w: 0, h: 0 },\r\n lg: { q: 'w=40&h=40&m=6', w: 0, h: 0 },\r\n xl: { q: 'w=40&h=40&m=6', w: 0, h: 0 }\r\n },\r\n lazyload: true,\r\n cropFocalRegion: true\r\n };\r\n\r\n return (\r\n \r\n );\r\n};\r\n","/**\r\n * Copyright (c) Microsoft Corporation\r\n * All rights reserved. See License.txt in the project root for license information.\r\n * IDobbiesSearch contentModule Interface Properties\r\n * THIS FILE IS AUTO-GENERATED - MANUAL MODIFICATIONS WILL BE LOST\r\n */\r\n\r\nimport * as Msdyn365 from '@msdyn365-commerce/core';\r\n\r\nexport interface IDobbiesSearchConfig extends Msdyn365.IModuleConfig {\r\n suggestionTypeCriterion?: ISuggestionTypeCriterionData[];\r\n topResultsCount?: number;\r\n imageSettings?: Msdyn365.IImageSettings;\r\n hideSearchLabel?: boolean;\r\n disableSubmitSearch?: boolean;\r\n searchplaceholderText?: string;\r\n shouldShowFullCategoryPath?: boolean;\r\n className?: string;\r\n clientRender?: boolean;\r\n}\r\n\r\nexport interface IDobbiesSearchResources {\r\n searchtext: string;\r\n searchLabelArialLabel: string;\r\n cancelBtnAriaLabel: string;\r\n searchBtnAriaLabel: string;\r\n submitBtnAriaLabel: string;\r\n autoSuggestFoundMessage: string;\r\n noAutoSuggestionMessage: string;\r\n productSuggestionHeading: string;\r\n categorySuggestionHeading: string;\r\n autoSuggestResultLoadingMessage: string;\r\n freePriceText: string;\r\n}\r\n\r\nexport const enum SuggestionTypeCriterionSuggestionType {\r\n product = 'product',\r\n keyword = 'keyword',\r\n scopedCategory = 'scopedCategory'\r\n}\r\n\r\nexport interface ISuggestionTypeCriterionData {\r\n SuggestionType?: SuggestionTypeCriterionSuggestionType;\r\n}\r\n\r\nexport interface IDobbiesSearchProps extends Msdyn365.IModule {\r\n resources: IDobbiesSearchResources;\r\n config: IDobbiesSearchConfig;\r\n}\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport { Autosuggestions } from '@msdyn365-commerce/commerce-entities';\r\nimport MsDyn365, { getCatalogId, getUrlSync } from '@msdyn365-commerce/core';\r\nimport { ProductRefiner, ProductRefinerSource, ProductsDataActions } from '@msdyn365-commerce/retail-proxy';\r\nimport { ArrayExtensions, ObjectExtensions } from '@msdyn365-commerce-modules/retail-actions';\r\nimport { createSearchStateInput } from '@msdyn365-commerce-modules/search-utilities';\r\nimport { getTelemetryObject, IModuleProps, INodeProps, ITelemetryContent, KeyCodes } from '@msdyn365-commerce-modules/utilities';\r\nimport classnames from 'classnames';\r\nimport { debounce } from 'lodash';\r\nimport { Spinner, SpinnerSize } from 'office-ui-fabric-react';\r\nimport * as React from 'react';\r\n\r\nimport getSearchSuggestionsAction, { AutoSuggestInput, SuggestionType } from './actions/get-auto-suggest-suggestions';\r\nimport {\r\n CategorySuggestionsComponent,\r\n FormComponent,\r\n ISearchCategoryViewProps,\r\n ISearchKeywordViewProps,\r\n ISearchProductViewProps,\r\n KeywordSuggestionsComponent,\r\n LabelComponent,\r\n ProductSuggestionsComponent\r\n} from './components';\r\nimport { IDobbiesSearchData } from './dobbies-search.data';\r\nimport {\r\n IDobbiesSearchProps,\r\n ISuggestionTypeCriterionData,\r\n SuggestionTypeCriterionSuggestionType\r\n} from './dobbies-search.props.autogenerated';\r\n\r\nexport interface ISearchState {\r\n isSearchFormExpanded: boolean;\r\n searchText: string;\r\n searchKeywordSuggestClass: string;\r\n searchProductSuggestClass: string;\r\n searchCategorySuggestClass: string;\r\n suggestions: Autosuggestions | undefined;\r\n searchRefiners?: ProductRefiner[] | undefined;\r\n autoSuggestAriaLabel: string;\r\n isInitialState: boolean;\r\n isLoadingAutoSuggest?: boolean;\r\n}\r\n\r\nexport interface ISearchViewProps extends IDobbiesSearchProps {\r\n Search: IModuleProps;\r\n AutoSuggestAriaLabel: INodeProps;\r\n AutoSuggestAriaLabelText: string;\r\n searchText: string;\r\n AutoSuggest: INodeProps;\r\n KeywordSuggest: INodeProps;\r\n ProductSuggest: INodeProps;\r\n CategorySuggest: INodeProps;\r\n SearchForm: INodeProps;\r\n FormWrapper: INodeProps;\r\n UlKeyword: INodeProps;\r\n UlProduct: INodeProps;\r\n UlCategory: INodeProps;\r\n label: React.ReactNode;\r\n form: React.ReactNode;\r\n autosuggestKeyword?: ISearchKeywordViewProps;\r\n autosuggestProduct?: ISearchProductViewProps;\r\n autosuggestCategory?: ISearchCategoryViewProps;\r\n callbacks: {\r\n handleCancelSearchChange(): void;\r\n // handleCancelSearchFocused?(): void;\r\n };\r\n isSearchFormExpanded: boolean;\r\n isLoadingAutoSuggest?: boolean;\r\n isLoadingNode?: React.ReactNode;\r\n cancelSearch: () => void;\r\n}\r\n\r\n/**\r\n *\r\n * Search module.\r\n * @extends {React.Component, ISearchState>}\r\n */\r\nclass Search extends React.Component, ISearchState> {\r\n private readonly searchTextInput: React.RefObject;\r\n\r\n private readonly searchCollapsedLabel: React.RefObject;\r\n\r\n private readonly formReference: React.RefObject;\r\n\r\n private readonly maxChars: number;\r\n\r\n private readonly topResultsCount?: number;\r\n\r\n private readonly hitPrefix: string = '{';\r\n\r\n private readonly hitSuffix: string = '}';\r\n\r\n private readonly waitTime: number = 500;\r\n\r\n private readonly autoSuggestResultScreenReaderDiv: React.RefObject;\r\n\r\n private readonly autoSuggestResultDiv: React.RefObject;\r\n\r\n private readonly searchFormClass: string;\r\n\r\n private readonly searchLabelClass: string;\r\n\r\n private readonly telemetryContent: ITelemetryContent;\r\n\r\n // private loadSuggestionsRequestId?: string;\r\n\r\n private inputSuggestionType?: ISuggestionTypeCriterionData[];\r\n\r\n // @ts-expect-error\r\n private cancellabelDebounce: debounce;\r\n\r\n public constructor(props: IDobbiesSearchProps) {\r\n super(props);\r\n this.searchTextInput = React.createRef();\r\n this.searchCollapsedLabel = React.createRef();\r\n this.autoSuggestResultScreenReaderDiv = React.createRef();\r\n this.autoSuggestResultDiv = React.createRef();\r\n this.formReference = React.createRef();\r\n this.state = {\r\n isSearchFormExpanded: false,\r\n searchText: '',\r\n searchKeywordSuggestClass: 'ms-search__autoSuggest__keyword',\r\n searchProductSuggestClass: 'ms-search__autoSuggest__product',\r\n searchCategorySuggestClass: 'ms-search__autoSuggest__category',\r\n suggestions: undefined,\r\n searchRefiners: undefined,\r\n autoSuggestAriaLabel: '',\r\n isInitialState: true,\r\n isLoadingAutoSuggest: false\r\n };\r\n this.maxChars =\r\n (this.props.context &&\r\n this.props.context.app &&\r\n this.props.context.app.config &&\r\n this.props.context.app.config.searchInputMaxLength) ||\r\n 50;\r\n\r\n this.inputSuggestionType = this.props.config && this.props.config.suggestionTypeCriterion;\r\n this.topResultsCount = this.props.config && this.props.config.topResultsCount ? this.props.config.topResultsCount : 5;\r\n this.searchFormClass = 'ms-search__form';\r\n this.searchLabelClass = 'ms-search__label';\r\n this.telemetryContent = getTelemetryObject(\r\n this.props.context.request.telemetryPageName!,\r\n this.props.friendlyName,\r\n this.props.telemetry\r\n );\r\n\r\n this._initSuggestionTypes();\r\n }\r\n\r\n public async componentDidMount(): Promise {\r\n document.body && document.body.addEventListener('mousedown', this._focusOutTarget);\r\n window && window.addEventListener('keyup', this._keyup);\r\n }\r\n\r\n public componentWillUnmount(): void {\r\n document.body && document.body.removeEventListener('mousedown', this._focusOutTarget, false);\r\n window && window.removeEventListener('keyup', this._keyup, false);\r\n }\r\n\r\n public componentDidUpdate(): void {\r\n // const {\r\n // config: { hideSearchLabel }\r\n // } = this.props;\r\n // const { isSearchFormExpanded, isInitialState } = this.state;\r\n\r\n // if (!this.props.context.request.params.isEditor) {\r\n // if (!hideSearchLabel && isSearchFormExpanded) {\r\n // this.searchTextInput && this.searchTextInput.current && this.searchTextInput.current.focus();\r\n // } else if (!isInitialState) {\r\n // this.searchCollapsedLabel && this.searchCollapsedLabel.current && this.searchCollapsedLabel.current.focus();\r\n // }\r\n // }\r\n this.state.isSearchFormExpanded && this.searchTextInput.current?.focus();\r\n }\r\n\r\n public shouldComponentUpdate(nextProps: IDobbiesSearchProps, nextState: ISearchState): boolean {\r\n if (this.state === nextState && this.props === nextProps) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n // eslint-disable-next-line complexity -- ignore complexity.\r\n public render(): JSX.Element {\r\n const {\r\n context,\r\n resources: { searchtext, searchLabelArialLabel, cancelBtnAriaLabel, searchBtnAriaLabel, submitBtnAriaLabel },\r\n config: { hideSearchLabel, disableSubmitSearch, searchplaceholderText, shouldShowFullCategoryPath, className = '' }\r\n } = this.props;\r\n\r\n const {\r\n isSearchFormExpanded,\r\n searchText,\r\n searchKeywordSuggestClass,\r\n searchProductSuggestClass,\r\n searchCategorySuggestClass,\r\n suggestions,\r\n searchRefiners,\r\n isLoadingAutoSuggest\r\n } = this.state;\r\n\r\n const searchQsp = (context && context.app && context.app.config && context.app.config.searchQueryStringParameter) || 'q';\r\n const searchPageURL = getUrlSync('search', context && context.actionContext) || '';\r\n const searchURL = this._appendQueryParams(searchPageURL, searchText, searchQsp);\r\n const searchPlaceholder = searchplaceholderText && searchplaceholderText.length > 0 ? searchplaceholderText : 'Search in Fabrikam';\r\n\r\n const keywordSuggestions = suggestions?.AllSearchResults?.filter(\r\n suggestion => suggestion.SuggestionType === SuggestionType.Keyword || suggestion.SuggestionType === SuggestionType.None\r\n );\r\n const productSuggestions = suggestions?.AllSearchResults?.filter(\r\n suggestion => suggestion.SuggestionType === SuggestionType.Product\r\n );\r\n const categoryRefiners = searchRefiners?.find(refiner => {\r\n return refiner.SourceValue === ProductRefinerSource.Category;\r\n });\r\n const categorySuggestions = suggestions?.AllSearchResults?.filter(suggestion => {\r\n if (suggestion.SuggestionType !== SuggestionType.Category) {\r\n return false;\r\n }\r\n const refiner = categoryRefiners?.Values?.find(item => {\r\n return `${item.RefinerRecordId ?? 0}` === suggestion.Id;\r\n });\r\n\r\n return !ObjectExtensions.isNullOrUndefined(refiner);\r\n });\r\n\r\n const viewProps: ISearchViewProps = {\r\n ...(this.props as IDobbiesSearchProps),\r\n cancelSearch: this._handleCancelSearchChange,\r\n Search: {\r\n moduleProps: this.props,\r\n className: `${classnames('ms-search', className)} ${disableSubmitSearch ? 'no-submit' : 'with-submit'}`\r\n },\r\n AutoSuggestAriaLabel: {\r\n tag: 'div',\r\n className: 'msc-autoSuggest__screen-reader',\r\n 'aria-live': 'assertive',\r\n ref: this.autoSuggestResultScreenReaderDiv\r\n },\r\n AutoSuggestAriaLabelText: this.state.autoSuggestAriaLabel,\r\n searchText: this.state.searchText,\r\n AutoSuggest: {\r\n ref: this.autoSuggestResultDiv,\r\n className: 'ms-search__autoSuggest'\r\n },\r\n KeywordSuggest: {\r\n className: searchKeywordSuggestClass\r\n },\r\n ProductSuggest: {\r\n className: searchProductSuggestClass\r\n },\r\n CategorySuggest: {\r\n className: searchCategorySuggestClass\r\n },\r\n SearchForm: {\r\n className: `${this.searchFormClass} ${isSearchFormExpanded ? 'bx-show' : 'bx-hide'}`\r\n },\r\n FormWrapper: {\r\n tag: 'form',\r\n ref: this.formReference,\r\n className: 'ms-search__searchForm',\r\n 'aria-label': 'Search',\r\n name: 'searchForm',\r\n role: 'search',\r\n action: searchURL,\r\n autoComplete: 'off',\r\n onSubmit: this._handleSubmit\r\n },\r\n UlKeyword: {\r\n tag: 'ul',\r\n className: classnames('msc-autoSuggest__keywordResults-items', className)\r\n },\r\n UlProduct: {\r\n tag: 'ul',\r\n className: classnames('msc-autoSuggest__productResults-items', className)\r\n },\r\n UlCategory: {\r\n tag: 'ul',\r\n className: classnames('msc-autoSuggest__categoryResults-items', className)\r\n },\r\n label: LabelComponent({\r\n isSearchFormExpanded,\r\n searchLabelClass: `${this.searchLabelClass} ${isSearchFormExpanded ? 'bx-hide' : 'bx-show'}`,\r\n searchtext,\r\n searchLabelArialLabel,\r\n searchCollapsedLabel: this.searchCollapsedLabel,\r\n hideSearchLabel,\r\n handleCancelSearchChange: this._handleCancelSearchChange,\r\n telemetryContent: this.telemetryContent\r\n }),\r\n form: FormComponent({\r\n ariaLabelCancel: cancelBtnAriaLabel,\r\n ariaLabelSearch: searchBtnAriaLabel,\r\n ariaLabelSubmit: submitBtnAriaLabel,\r\n hideSearchLabel,\r\n searchTextInput: this.searchTextInput,\r\n disableSubmitSearch,\r\n handleInputChange: this._handleInputChange,\r\n handleCancelSearchChange: this._handleCancelSearchChange,\r\n maxChars: this.maxChars,\r\n searchQsp,\r\n searchPlaceholder,\r\n query: searchText\r\n }),\r\n autosuggestKeyword:\r\n searchText &&\r\n searchText.length > 0 &&\r\n (isLoadingAutoSuggest || (keywordSuggestions && ArrayExtensions.hasElements(keywordSuggestions)))\r\n ? KeywordSuggestionsComponent({\r\n searchKeywordSuggestClass,\r\n searchPageURL,\r\n searchQsp,\r\n hitPrefix: this.hitPrefix,\r\n hitSuffix: this.hitSuffix,\r\n autoSuggestProps: this.props,\r\n searchText,\r\n suggestions: keywordSuggestions,\r\n telemetryContent: this.telemetryContent\r\n })\r\n : undefined,\r\n autosuggestProduct:\r\n searchText &&\r\n searchText.length > 0 &&\r\n (isLoadingAutoSuggest || (productSuggestions && ArrayExtensions.hasElements(productSuggestions)))\r\n ? ProductSuggestionsComponent({\r\n searchProductSuggestClass,\r\n searchPageURL,\r\n searchQsp,\r\n hitPrefix: this.hitPrefix,\r\n hitSuffix: this.hitSuffix,\r\n autoSuggestProps: this.props,\r\n searchText,\r\n suggestions: productSuggestions,\r\n telemetry: this.props.telemetry,\r\n moduleType: this.props.typeName,\r\n moduleId: this.props.id,\r\n telemetryContent: this.telemetryContent\r\n //resources: this.props.resources\r\n })\r\n : undefined,\r\n autosuggestCategory:\r\n searchText &&\r\n searchText.length > 0 &&\r\n (isLoadingAutoSuggest || (categorySuggestions && ArrayExtensions.hasElements(categorySuggestions)))\r\n ? CategorySuggestionsComponent({\r\n searchCategorySuggestClass,\r\n searchPageURL,\r\n searchQsp,\r\n hitPrefix: this.hitPrefix,\r\n hitSuffix: this.hitSuffix,\r\n autoSuggestProps: this.props,\r\n searchText,\r\n suggestions: categorySuggestions,\r\n searchRefiners,\r\n telemetryContent: this.telemetryContent,\r\n shouldShowFullPath: shouldShowFullCategoryPath\r\n })\r\n : undefined,\r\n callbacks: {\r\n handleCancelSearchChange: this._handleCancelSearchChange\r\n // handleCancelSearchFocused: this._handleCancelSearchFocused\r\n },\r\n isSearchFormExpanded: this.state.isSearchFormExpanded,\r\n isLoadingAutoSuggest,\r\n isLoadingNode: this._isLoadingNode()\r\n };\r\n\r\n return this.props.renderView(viewProps) as React.ReactElement;\r\n }\r\n\r\n private _initSuggestionTypes() {\r\n const suggestionTypes = this.props.config.suggestionTypeCriterion;\r\n\r\n const suggestions = ArrayExtensions.unique(ArrayExtensions.validValues(suggestionTypes));\r\n if (!ArrayExtensions.hasElements(suggestions)) {\r\n this.inputSuggestionType = [\r\n { SuggestionType: SuggestionTypeCriterionSuggestionType.keyword },\r\n { SuggestionType: SuggestionTypeCriterionSuggestionType.product },\r\n { SuggestionType: SuggestionTypeCriterionSuggestionType.scopedCategory }\r\n ];\r\n return;\r\n }\r\n\r\n const validSuggestions = suggestions.filter(suggestion => suggestion.SuggestionType);\r\n if (ArrayExtensions.hasElements(validSuggestions)) {\r\n this.inputSuggestionType = validSuggestions;\r\n return;\r\n }\r\n\r\n this.inputSuggestionType = [];\r\n }\r\n\r\n /**\r\n * Function to create the ReactNode for loading Autosuggest result.\r\n * @returns ReachNode for loading Autosuggest result.\r\n */\r\n private readonly _isLoadingNode = (): React.ReactNode => {\r\n const loadingText = this.props.resources.autoSuggestResultLoadingMessage;\r\n return ;\r\n };\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n private readonly _focusOutTarget = (e: any): void => {\r\n const { suggestions } = this.state;\r\n\r\n if (suggestions && suggestions.AllSearchResults && e.target.closest('.ms-search') === null) {\r\n this._clearAutoSuggestState();\r\n }\r\n };\r\n\r\n private readonly _keyup = (e: KeyboardEvent): void => {\r\n const { suggestions } = this.state;\r\n\r\n if (suggestions && suggestions.AllSearchResults && e.keyCode === KeyCodes.Escape) {\r\n this._clearAutoSuggestState();\r\n } else if (this.state.isSearchFormExpanded && e.keyCode === KeyCodes.Escape) {\r\n if (this.state.isSearchFormExpanded) {\r\n this.setState({ isSearchFormExpanded: false });\r\n }\r\n }\r\n\r\n if (\r\n !(\r\n (this.formReference.current && this.formReference.current.contains((e.target as unknown) as Node)) ||\r\n (this.autoSuggestResultDiv.current && this.autoSuggestResultDiv.current.contains((e.target as unknown) as Node))\r\n )\r\n ) {\r\n if (suggestions && suggestions.AllSearchResults) {\r\n this._clearAutoSuggestState();\r\n }\r\n\r\n if (this.state.isSearchFormExpanded) {\r\n this.setState({ isSearchFormExpanded: false });\r\n }\r\n }\r\n };\r\n\r\n private readonly _clearAutoSuggestState = (): void => {\r\n const {\r\n context: { actionContext },\r\n data: { searchState }\r\n } = this.props;\r\n\r\n if (this.searchTextInput.current && this.searchTextInput.current.value.length > 0) {\r\n searchState.searchText = '';\r\n searchState.defaultBasicSearchUrl = '';\r\n searchState.searchQueryStringParameter = '';\r\n actionContext ? actionContext.update(createSearchStateInput(searchState), searchState) : null;\r\n this.searchTextInput.current.value = '';\r\n }\r\n\r\n this.setState({ searchText: '', suggestions: undefined, searchRefiners: undefined });\r\n };\r\n\r\n // private async _getSearchSuggestions(loadSuggestionsRequestId: string, query: string) {\r\n // try {\r\n // const searchSuggestions = await getSearchSuggestionsAction(\r\n // new AutoSuggestInput(query, this.topResultsCount, this._getSuggestionType(), this.hitPrefix, this.hitSuffix),\r\n // this.props.context.actionContext\r\n // );\r\n // if (loadSuggestionsRequestId !== this.loadSuggestionsRequestId) {\r\n // return undefined;\r\n // }\r\n // return searchSuggestions;\r\n // } catch (error) {\r\n // if (loadSuggestionsRequestId !== this.loadSuggestionsRequestId) {\r\n // return undefined;\r\n // }\r\n // this.setState({ suggestions: undefined, searchRefiners: undefined, autoSuggestAriaLabel: this._setAutoSuggestResultCount() });\r\n // this.props.telemetry.exception(error);\r\n // this.props.telemetry.debug('Unable to get auto suggest results');\r\n // return undefined;\r\n // }\r\n // }\r\n\r\n // private async _updateSearchRefiners(loadSuggestionsRequestId: string, query: string, suggestions: Autosuggestions | undefined) {\r\n // try {\r\n // const refiners = await this._getSearchRefiners(query);\r\n // if (loadSuggestionsRequestId !== this.loadSuggestionsRequestId) {\r\n // return;\r\n // }\r\n // this.setState({\r\n // suggestions,\r\n // searchRefiners: refiners,\r\n // autoSuggestAriaLabel: this._setAutoSuggestResultCount(suggestions),\r\n // isLoadingAutoSuggest: false\r\n // });\r\n // } catch (error) {\r\n // if (loadSuggestionsRequestId !== this.loadSuggestionsRequestId) {\r\n // return;\r\n // }\r\n // this.setState({ suggestions, searchRefiners: undefined, autoSuggestAriaLabel: this._setAutoSuggestResultCount(suggestions) });\r\n // this.props.telemetry.exception(error);\r\n // this.props.telemetry.debug('Unable to get refiners results');\r\n // }\r\n // }\r\n\r\n // private _loadSuggestions(query: string) {\r\n // this.cancellabelDebounce = debounce(async () => {\r\n // this.setState({ isLoadingAutoSuggest: true });\r\n // const loadSuggestionsRequestId = Random.Guid.generateGuid();\r\n // this.loadSuggestionsRequestId = loadSuggestionsRequestId;\r\n // const searchSuggestions = await this._getSearchSuggestions(loadSuggestionsRequestId, query);\r\n // await this._updateSearchRefiners(loadSuggestionsRequestId, query, searchSuggestions);\r\n // }, this.waitTime);\r\n\r\n // setTimeout(() => {\r\n // this.cancellabelDebounce();\r\n // }, 0);\r\n // }\r\n\r\n private readonly _handleInputChange = (query: string): void => {\r\n if (!query || query.length <= this.maxChars) {\r\n this.setState({ searchText: query });\r\n }\r\n\r\n if (this.cancellabelDebounce) {\r\n this.cancellabelDebounce.cancel();\r\n }\r\n\r\n const {\r\n telemetry,\r\n context,\r\n data: { searchState }\r\n } = this.props;\r\n\r\n if (context) {\r\n if (query && query.length > 0) {\r\n if (query.length > this.maxChars) {\r\n return;\r\n }\r\n this.cancellabelDebounce = debounce(() => {\r\n this.setState({ isLoadingAutoSuggest: true });\r\n getSearchSuggestionsAction(\r\n new AutoSuggestInput(\r\n query,\r\n this.topResultsCount,\r\n this._getSuggestionType(this.inputSuggestionType),\r\n this.hitPrefix,\r\n this.hitSuffix\r\n ),\r\n context.actionContext\r\n )\r\n .then(results => {\r\n this._getSearchRefiners(query)\r\n .then(refiners => {\r\n this.setState({\r\n suggestions: results,\r\n searchRefiners: refiners,\r\n autoSuggestAriaLabel: this._setAutoSuggestResultCount(results),\r\n isLoadingAutoSuggest: false\r\n });\r\n })\r\n .catch(error => {\r\n this.setState({\r\n suggestions: results,\r\n searchRefiners: undefined,\r\n autoSuggestAriaLabel: this._setAutoSuggestResultCount(results),\r\n isLoadingAutoSuggest: false\r\n });\r\n telemetry.exception(error);\r\n telemetry.debug('Unable to get refiners results');\r\n });\r\n })\r\n .catch(error => {\r\n this.setState({\r\n suggestions: undefined,\r\n searchRefiners: undefined,\r\n autoSuggestAriaLabel: this._setAutoSuggestResultCount()\r\n });\r\n telemetry.exception(error);\r\n telemetry.debug('Unable to get auto suggest results');\r\n });\r\n }, this.waitTime);\r\n\r\n setTimeout(() => {\r\n this.cancellabelDebounce();\r\n }, 0);\r\n\r\n searchState.searchText = query;\r\n } else {\r\n this.setState({ suggestions: undefined, searchRefiners: undefined });\r\n searchState.searchText = '';\r\n }\r\n context.actionContext.update(createSearchStateInput(searchState), searchState);\r\n }\r\n };\r\n\r\n private readonly _getSuggestionType = (suggestionTypes?: ISuggestionTypeCriterionData[]): string => {\r\n if (suggestionTypes && suggestionTypes.length > 0) {\r\n const distinctSuggestionTypes: string[] = [];\r\n suggestionTypes &&\r\n suggestionTypes.forEach((suggestionTypeItem, index) => {\r\n suggestionTypeItem.SuggestionType &&\r\n distinctSuggestionTypes.push(\r\n suggestionTypeItem.SuggestionType.charAt(0).toUpperCase() + suggestionTypeItem.SuggestionType.slice(1)\r\n );\r\n });\r\n return distinctSuggestionTypes.join(',');\r\n }\r\n return 'Keyword, Product, ScopedCategory';\r\n };\r\n\r\n private async _getSearchRefiners(searchText: string): Promise {\r\n const { actionContext: ctx } = this.props.context;\r\n const catalogId = getCatalogId(ctx.requestContext);\r\n return ProductsDataActions.getProductSearchRefinersAsync(\r\n { callerContext: ctx },\r\n {\r\n SearchCondition: searchText,\r\n Context: {\r\n ChannelId: +ctx.requestContext.apiSettings.channelId,\r\n CatalogId: catalogId\r\n }\r\n }\r\n );\r\n }\r\n\r\n private readonly _handleSubmit = (\r\n e: React.MouseEvent | React.KeyboardEvent | React.FormEvent\r\n ): void => {\r\n const {\r\n config: { disableSubmitSearch },\r\n context: {\r\n actionContext,\r\n app: {\r\n config: { searchQueryStringParameter }\r\n }\r\n }\r\n } = this.props;\r\n\r\n const query = this.searchTextInput.current && this.searchTextInput.current.value;\r\n e.preventDefault();\r\n\r\n if (!query || (query && query.length === 0) || disableSubmitSearch) {\r\n this.searchTextInput && this.searchTextInput.current && this.searchTextInput.current.focus();\r\n } else {\r\n const searchQsp = searchQueryStringParameter || 'q';\r\n const searchURL = this._appendQueryParams(getUrlSync('search', actionContext) || '', query, searchQsp);\r\n document.location.href = searchURL;\r\n }\r\n };\r\n\r\n private readonly _handleCancelSearchChange = (): void => {\r\n const { isSearchFormExpanded, suggestions } = this.state;\r\n\r\n if (!isSearchFormExpanded) {\r\n this.setState({\r\n isSearchFormExpanded: true,\r\n searchText: '',\r\n isInitialState: false\r\n });\r\n } else {\r\n if (suggestions && suggestions.AllSearchResults) {\r\n this._clearAutoSuggestState();\r\n }\r\n this.setState({ isSearchFormExpanded: false });\r\n }\r\n };\r\n\r\n // private readonly _handleCancelSearchFocused = (): void => {\r\n // const { suggestions } = this.state;\r\n // if (!(suggestions && suggestions.AllSearchResults)) {\r\n // this._clearAutoSuggestState();\r\n // this.setState({ isSearchFormExpanded: false });\r\n // }\r\n // };\r\n\r\n private readonly _appendQueryParams = (route: string, query: string, qsp: string): string => {\r\n if (!MsDyn365.isBrowser) {\r\n return '';\r\n }\r\n\r\n const queryUrl = new URL(route, window.location.href);\r\n if (qsp && query) {\r\n queryUrl.searchParams.set(qsp, query);\r\n }\r\n\r\n return queryUrl.href;\r\n };\r\n\r\n private readonly _setAutoSuggestResultCount = (result?: Autosuggestions) => {\r\n if (this.autoSuggestResultScreenReaderDiv.current !== null) {\r\n const ariaLiveRegion = this.autoSuggestResultScreenReaderDiv.current;\r\n const suggestResultString = this.props.resources.autoSuggestFoundMessage;\r\n const emptyResultString = this.props.resources.noAutoSuggestionMessage;\r\n ariaLiveRegion.innerText =\r\n result && result.AllSearchResults && result.AllSearchResults.length > 0 ? suggestResultString : emptyResultString;\r\n ariaLiveRegion.setAttribute('aria-live', 'assertive');\r\n return ariaLiveRegion.innerText;\r\n }\r\n return '';\r\n };\r\n}\r\n\r\nexport default Search;\r\n","/*!\r\n * Copyright (c) Microsoft Corporation.\r\n * All rights reserved. See LICENSE in the project root for license information.\r\n */\r\n\r\n/* eslint-disable no-duplicate-imports */\r\nimport { INodeProps, Module, Node } from '@msdyn365-commerce-modules/utilities';\r\nimport * as React from 'react';\r\n\r\nimport { ISearchCategoryViewProps, ISearchFormViewProps, ISearchKeywordViewProps, ISearchProductViewProps } from './components';\r\nimport { ISearchViewProps } from './dobbies-search';\r\n\r\nconst SearchView: React.FC = props => {\r\n const {\r\n Search,\r\n AutoSuggestAriaLabel,\r\n AutoSuggestAriaLabelText,\r\n searchText,\r\n AutoSuggest,\r\n KeywordSuggest,\r\n ProductSuggest,\r\n CategorySuggest,\r\n UlKeyword,\r\n UlProduct,\r\n UlCategory,\r\n form,\r\n autosuggestCategory,\r\n autosuggestKeyword,\r\n autosuggestProduct,\r\n SearchForm,\r\n FormWrapper,\r\n label,\r\n isLoadingAutoSuggest,\r\n isLoadingNode,\r\n isSearchFormExpanded,\r\n cancelSearch\r\n } = props;\r\n\r\n return (\r\n \r\n {label}\r\n {
    }\r\n {_renderForm(form as ISearchFormViewProps, SearchForm, FormWrapper)}\r\n \r\n {searchText && searchText.length > 0 ? {AutoSuggestAriaLabelText} : ''}\r\n {_renderKeywordSuggestions(KeywordSuggest, UlKeyword, autosuggestKeyword, isLoadingAutoSuggest, isLoadingNode)}\r\n {_renderProductSuggestions(ProductSuggest, UlProduct, autosuggestProduct, isLoadingAutoSuggest, isLoadingNode)}\r\n {_renderCategorySuggestions(CategorySuggest, UlCategory, autosuggestCategory, isLoadingAutoSuggest, isLoadingNode)}\r\n \r\n \r\n );\r\n};\r\n\r\nconst _renderForm = (form: ISearchFormViewProps, SearchForm: INodeProps, FormWrapper: INodeProps) => {\r\n return (\r\n \r\n \r\n {form.input}\r\n {form.cancelBtn}\r\n {form.submitBtn}\r\n \r\n \r\n );\r\n};\r\n\r\nconst _renderKeywordSuggestions = (\r\n KeywordSuggest: INodeProps,\r\n UlKeyword: INodeProps,\r\n keywordSuggestions?: ISearchKeywordViewProps,\r\n isLoadingAutoSuggest?: boolean,\r\n isLoadingNode?: React.ReactNode\r\n) => {\r\n return (\r\n keywordSuggestions && (\r\n \r\n \r\n {isLoadingAutoSuggest && isLoadingNode}\r\n {!isLoadingAutoSuggest &&\r\n keywordSuggestions.text.map(text => {\r\n return text;\r\n })}\r\n \r\n \r\n )\r\n );\r\n};\r\n\r\nconst _renderProductSuggestions = (\r\n ProductSuggest: INodeProps,\r\n UlProduct: INodeProps,\r\n productSuggestions?: ISearchProductViewProps,\r\n isLoadingAutoSuggest?: boolean,\r\n isLoadingNode?: React.ReactNode\r\n) => {\r\n return (\r\n productSuggestions && (\r\n \r\n \r\n {productSuggestions.title}\r\n {isLoadingAutoSuggest && isLoadingNode}\r\n {!isLoadingAutoSuggest &&\r\n productSuggestions.items.map((item, index) => {\r\n return (\r\n \r\n \r\n {item.thumbnail}\r\n {item.text}\r\n {item.price}\r\n \r\n \r\n );\r\n })}\r\n \r\n \r\n )\r\n );\r\n};\r\n\r\nconst _renderCategorySuggestions = (\r\n CategorySuggest: INodeProps,\r\n UlCategory: INodeProps,\r\n categorySuggestions?: ISearchCategoryViewProps,\r\n isLoadingAutoSuggest?: boolean,\r\n isLoadingNode?: React.ReactNode\r\n) => {\r\n return (\r\n categorySuggestions && (\r\n \r\n \r\n {categorySuggestions.title}\r\n {isLoadingAutoSuggest && isLoadingNode}\r\n {!isLoadingAutoSuggest &&\r\n categorySuggestions.text.map(text => {\r\n return text;\r\n })}\r\n \r\n \r\n )\r\n );\r\n};\r\n\r\nexport default SearchView;\r\n","const binding = { modules: {}, dataActions: {} };\n\n const registerActionId = (actionPath) => {\n if (binding.dataActions[actionPath] &&\n binding.dataActions[actionPath].default &&\n binding.dataActions[actionPath].default.prototype &&\n binding.dataActions[actionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[actionPath].default.prototype.id] = binding.dataActions[actionPath];\n } else {\n Object.keys(binding.dataActions[actionPath] || {}).forEach(exportName => {\n if (binding.dataActions[actionPath][exportName] &&\n binding.dataActions[actionPath][exportName].prototype &&\n binding.dataActions[actionPath][exportName].prototype.Action) {\n binding.dataActions[binding.dataActions[actionPath][exportName].prototype.id] = binding.dataActions[actionPath][exportName];\n }\n })\n }\n };\n\n const registerSanitizedActionPath = (sanitizedActionPath, dataAction) => {\n if (process.env.NODE_ENV === 'development') {\n if (!dataAction.default) {\n throw new Error('Data action path does not have a default export');\n }\n if (!(dataAction.default.prototype.id && binding.dataActions[dataAction.default.prototype.id]) || !binding.dataActions[sanitizedActionPath]) {\n binding.dataActions[sanitizedActionPath] = dataAction;\n }\n } else {\n binding.dataActions[sanitizedActionPath] = dataAction;\n if (!binding.dataActions[sanitizedActionPath].default) {\n throw new Error('Data action path ' + sanitizedActionPath + ' does not have a default export');\n }\n binding.dataActions[sanitizedActionPath].default.prototype.RegistrationId = sanitizedActionPath;\n if (binding.dataActions[sanitizedActionPath].default.prototype.id) {\n binding.dataActions[binding.dataActions[sanitizedActionPath].default.prototype.id] = sanitizedActionPath;\n }\n }\n };\n \n\n (binding.modules['dobbies-search'] = {\n c: () => require('partner/modules/dobbies-search/dobbies-search.tsx'),\n $type: 'contentModule',\n da: [{name:'searchState', path:'@msdyn365-commerce-modules/search-utilities/dist/lib/search-state-data-action', runOn: 1}],\n \n iNM: false,\n ns: '__local__',\n n: 'dobbies-search',\n p: '__local__',\n \n pdp: '',\n \n \n md: 'src/modules/dobbies-search'\n });\n \n\n {\n const sanitizedActionPath = '@msdyn365-commerce-modules/search-utilities/dist/lib/search-state-data-action';\n let dataAction = require('@msdyn365-commerce-modules/search-utilities/dist/lib/search-state-data-action');\n registerSanitizedActionPath(sanitizedActionPath, dataAction);\n }\n \n\n \n window.__bindings__ = window.__bindings__ || {};\n window.__bindings__.modules = {\n ...window.__bindings__.modules || {},\n ...binding.modules\n };\n \n window.__bindings__.dataActions = {\n ...window.__bindings__.dataActions || {},\n ...binding.dataActions\n };\n export const viewDictionary = {};\n viewDictionary['__local__|__local__|modules|dobbies-search|dobbies-search'] = {\n c: () => require('partner/modules/dobbies-search/dobbies-search.view.tsx'),\n cn: '__local__-__local__-dobbies-search'\n };\nwindow.__bindings__ = window.__bindings__ || {};\nwindow.__bindings__.viewDictionary = {\n ...window.__bindings__.viewDictionary || {},\n ...viewDictionary\n };","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { observable } from 'mobx';\n\n/**\n * State information related to what is needed to succesfully perform a autosuggest.\n */\nexport class SearchState {\n @observable public searchText?: string;\n\n @observable public defaultBasicSearchUrl?: string;\n\n @observable public searchQueryStringParameter?: string;\n}\n","/*!\n * Copyright (c) Microsoft Corporation.\n * All rights reserved. See LICENSE in the project root for license information.\n */\n\nimport { createObservableDataAction, IAction, IActionInput, IAny, ICreateActionContext, IGeneric } from '@msdyn365-commerce/core';\nimport { GenericInput, getGenericAction } from '@msdyn365-commerce-modules/retail-actions';\n\nimport { SearchState } from './search-state';\n\nexport function createSearchStateInput(result: SearchState): GenericInput {\n return new GenericInput('searchState', result, 'SearchState');\n}\n\nconst createsearchStateInputInternal = (inputData: ICreateActionContext>): IActionInput => {\n return createSearchStateInput({ searchText: '' });\n};\n\nexport const getGenericActionDataAction = createObservableDataAction({\n action: >getGenericAction,\n input: createsearchStateInputInternal\n});\n\nexport default getGenericActionDataAction;\n","module.exports = React;","module.exports = ReactDOM;"],"names":["SuggestionType","AutoSuggestInput","constructor","searchText","top","suggestionType","hitPrefix","hitSuffix","getCacheKey","getCacheObjectType","dataCacheType","this","searchQuery","topResultsCount","async","_getAutoSuggest","input","autosuggest","ctx","catalogId","getCatalogId","requestContext","searchCriteria","ProductSearchCriteria","SearchCondition","length","Context","ChannelId","apiSettings","channelId","CatalogId","HitPrefix","HitSuffix","searchSuggestions","getSearchSuggestionsAsync","callerContext","queryResultSettings","Paging","Top","map","item","ImageUrl","generateImageUrl","AllSearchResults","telemetry","error","createObservableDataAction","id","action","Error","autoSuggestPromises","Promise","all","then","inputData","payLoad","CategorySuggestionsComponent","props","suggestions","autoSuggestProps","resources","categorySuggestionHeading","reactNodes","getPayloadObject","telemetryContent","push","_assembleNode","title","_renderTitle","text","categoryAutoSuggestionHeading","format","React","className","shouldShowFullPath","splitValue","Value","split","pop","ariaLabel","replace","RegExp","contentAction","etext","attribute","getTelemetryAttributes","key","Id","Object","assign","href","_generateLink","_getHighlightedText","suggestion","_getCategoryLink","_categoryRefiners$Val","searchPageURL","searchQsp","searchRefiners","MsDyn365","isBrowser","queryUrl","URL","window","location","searchParams","set","categoryRefiners","find","refiners","SourceValue","ProductRefinerSource","Category","refiner","Values","RefinerRecordId","Number","parseInt","encodedRefiner","JSON","stringify","compressRefiners","formattedText","dangerouslySetInnerHTML","getRichTextHtml","compressedRefinerKeys","compressedRefiners","forEach","compressedRefiner","refinerKey","FormComponent","searchPlaceholder","hideSearchLabel","searchTextInput","handleInputChange","maxChars","disableSubmitSearch","handleCancelSearchChange","query","ariaLabelCancel","ariaLabelSearch","ariaLabelSubmit","onInputChange","event","target","value","onInputChangeFunction","inputNode","type","name","placeholder","ref","onChange","maxLength","submitBtnNode","Button","cancelBtn","onClick","submitBtn","KeywordSuggestionsComponent","formattedLink","LabelComponent","searchLabelClass","searchLabelArialLabel","isSearchFormExpanded","searchtext","searchCollapsedLabel","attributes","innerRef","ProductSuggestionsComponent","context","actionContext","productSuggestionHeading","moduleType","moduleId","items","productAutoSuggestionHeading","_item$Value","altText","price","Value3","DecimalValue","thumbnail","_renderThumbnail","ObjectExtensions","isNullOrUndefined","_renderPrice","LiProduct","_getLiWrapper","AProduct","_getAWrapper","tag","_context$request$chan","recid","_objectSpread","cultureFormatter","formatCurrency","request","channel","Currency","getProductPageUrlSync","undefined","adjustedPrice","basePrice","_props$resources","PriceComponent","typeName","data","CustomerContextualPrice","BasePrice","freePriceText","gridSettings","config","imageSettings","cropFocalRegion","Image","src","viewports","xs","q","w","h","lg","xl","lazyload","loadFailureBehavior","SuggestionTypeCriterionSuggestionType","Search","super","waitTime","_isLoadingNode","loadingText","autoSuggestResultLoadingMessage","Spinner","label","size","SpinnerSize","medium","labelPosition","_focusOutTarget","e","state","closest","_clearAutoSuggestState","_keyup","keyCode","KeyCodes","Escape","setState","formReference","current","contains","autoSuggestResultDiv","searchState","defaultBasicSearchUrl","searchQueryStringParameter","update","createSearchStateInput","_handleInputChange","cancellabelDebounce","cancel","_debounce","isLoadingAutoSuggest","getSearchSuggestionsAction","_getSuggestionType","inputSuggestionType","results","_getSearchRefiners","autoSuggestAriaLabel","_setAutoSuggestResultCount","catch","exception","debug","setTimeout","suggestionTypes","distinctSuggestionTypes","suggestionTypeItem","index","charAt","toUpperCase","slice","join","_handleSubmit","app","preventDefault","focus","searchURL","_appendQueryParams","getUrlSync","document","_handleCancelSearchChange","isInitialState","route","qsp","result","autoSuggestResultScreenReaderDiv","ariaLiveRegion","suggestResultString","autoSuggestFoundMessage","emptyResultString","noAutoSuggestionMessage","innerText","setAttribute","searchKeywordSuggestClass","searchProductSuggestClass","searchCategorySuggestClass","searchInputMaxLength","suggestionTypeCriterion","searchFormClass","getTelemetryObject","telemetryPageName","friendlyName","_initSuggestionTypes","body","addEventListener","componentWillUnmount","removeEventListener","componentDidUpdate","_this$searchTextInput","shouldComponentUpdate","nextProps","nextState","render","_suggestions$AllSearc","_suggestions$AllSearc2","_suggestions$AllSearc3","cancelBtnAriaLabel","searchBtnAriaLabel","submitBtnAriaLabel","searchplaceholderText","shouldShowFullCategoryPath","keywordSuggestions","filter","Keyword","None","productSuggestions","Product","categorySuggestions","_item$RefinerRecordId","viewProps","cancelSearch","moduleProps","classnames","AutoSuggestAriaLabel","AutoSuggestAriaLabelText","AutoSuggest","KeywordSuggest","ProductSuggest","CategorySuggest","SearchForm","FormWrapper","role","autoComplete","onSubmit","UlKeyword","UlProduct","UlCategory","form","autosuggestKeyword","ArrayExtensions","hasElements","autosuggestProduct","autosuggestCategory","callbacks","isLoadingNode","renderView","unique","validValues","keyword","product","scopedCategory","validSuggestions","ProductsDataActions","_renderForm","Node","_renderKeywordSuggestions","_renderProductSuggestions","_renderCategorySuggestions","Module","binding","modules","dataActions","c","require","$type","da","path","runOn","iNM","ns","n","p","pdp","md","registerSanitizedActionPath","sanitizedActionPath","dataAction","default","prototype","RegistrationId","__bindings__","viewDictionary","cn","SearchState","__decorate","observable","GenericInput","getGenericActionDataAction","getGenericAction","module","exports","ReactDOM"],"sourceRoot":""}