From 39c7b6a3493416c693e8156dda8f8925fb7fa4e4 Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 14:00:19 -0400 Subject: [PATCH 1/7] fix breaking unit test and upgdated package version --- package.json | 2 +- src/ui/components/search/autocompletecomponent.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d9f0e7271..824110c42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/answers-search-ui", - "version": "1.16.1", + "version": "1.16.2", "description": "Javascript Search Programming Interface", "main": "dist/answers-umd.js", "repository": { diff --git a/src/ui/components/search/autocompletecomponent.js b/src/ui/components/search/autocompletecomponent.js index c01ededfc..3f7a1d43a 100644 --- a/src/ui/components/search/autocompletecomponent.js +++ b/src/ui/components/search/autocompletecomponent.js @@ -214,7 +214,7 @@ export default class AutoCompleteComponent extends Component { resultIndex: this._resultIndex, promptHeader: this._originalQuery.length === 0 ? this.promptHeader : null, listLabelIdName: this.listLabelIdName, - autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name.replaceAll('.', '-')}`, + autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name ? this._config.name.replaceAll('.', '-') : ''}`, eventOptions: this.eventOptions(data) })); } From cfe619299e16bfb38bab21f9422235d6880baccb Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 14:20:54 -0400 Subject: [PATCH 2/7] optimization --- src/ui/components/search/autocompletecomponent.js | 2 +- src/ui/rendering/defaulttemplatesloader.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/components/search/autocompletecomponent.js b/src/ui/components/search/autocompletecomponent.js index 3f7a1d43a..4a303abad 100644 --- a/src/ui/components/search/autocompletecomponent.js +++ b/src/ui/components/search/autocompletecomponent.js @@ -214,7 +214,7 @@ export default class AutoCompleteComponent extends Component { resultIndex: this._resultIndex, promptHeader: this._originalQuery.length === 0 ? this.promptHeader : null, listLabelIdName: this.listLabelIdName, - autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name ? this._config.name.replaceAll('.', '-') : ''}`, + autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name?.replaceAll('.', '-')}`, eventOptions: this.eventOptions(data) })); } diff --git a/src/ui/rendering/defaulttemplatesloader.js b/src/ui/rendering/defaulttemplatesloader.js index a8523e9c9..055805d4a 100644 --- a/src/ui/rendering/defaulttemplatesloader.js +++ b/src/ui/rendering/defaulttemplatesloader.js @@ -44,7 +44,7 @@ export default class DefaultTemplatesLoader { onload: resolve, onerror: reject, async: true, - src: COMPILED_TEMPLATES_URL + src: 'answerstemplates.compiled.min.js' }); DOM.append('body', script); }); From 39b3cabaa0748f6b7b0df0a7fd649ecdf2650779 Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 14:22:14 -0400 Subject: [PATCH 3/7] optimization2 --- src/ui/rendering/defaulttemplatesloader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/rendering/defaulttemplatesloader.js b/src/ui/rendering/defaulttemplatesloader.js index 055805d4a..a8523e9c9 100644 --- a/src/ui/rendering/defaulttemplatesloader.js +++ b/src/ui/rendering/defaulttemplatesloader.js @@ -44,7 +44,7 @@ export default class DefaultTemplatesLoader { onload: resolve, onerror: reject, async: true, - src: 'answerstemplates.compiled.min.js' + src: COMPILED_TEMPLATES_URL }); DOM.append('body', script); }); From b4e2894ba225d433ade1bdd563059ef3cdc82c84 Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 15:11:17 -0400 Subject: [PATCH 4/7] return empty string if container id is undefined --- src/ui/components/search/searchcomponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/components/search/searchcomponent.js b/src/ui/components/search/searchcomponent.js index 57ee75b52..c24e06f5a 100644 --- a/src/ui/components/search/searchcomponent.js +++ b/src/ui/components/search/searchcomponent.js @@ -678,7 +678,7 @@ export default class SearchComponent extends Component { labelText: this.labelText, inputLabelIdName: this.inputLabelIdName, submitIcon: this.submitIcon, - searchBarContainerId: this._container.id, + searchBarContainerId: this._container.id || '', submitText: this.submitText, clearText: this.clearText, showClearButton: this._showClearButton, From d395f30df1b659ddfe06506fc626ed7bf066854a Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 17:13:56 -0400 Subject: [PATCH 5/7] return empty string if container id is undefined2 --- src/ui/components/search/searchcomponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/components/search/searchcomponent.js b/src/ui/components/search/searchcomponent.js index c24e06f5a..e3bcef164 100644 --- a/src/ui/components/search/searchcomponent.js +++ b/src/ui/components/search/searchcomponent.js @@ -678,7 +678,7 @@ export default class SearchComponent extends Component { labelText: this.labelText, inputLabelIdName: this.inputLabelIdName, submitIcon: this.submitIcon, - searchBarContainerId: this._container.id || '', + searchBarContainerId: this._container?.id || '', submitText: this.submitText, clearText: this.clearText, showClearButton: this._showClearButton, From 546df87c0e29672ea4896f6fb1f35a13e269d564 Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 17:32:28 -0400 Subject: [PATCH 6/7] update version in packagelock --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a55737093..f7e6e353f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/answers-search-ui", - "version": "1.16.1", + "version": "1.16.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/answers-search-ui", - "version": "1.16.1", + "version": "1.16.2", "license": "BSD-3-Clause", "dependencies": { "@mapbox/mapbox-gl-language": "^0.10.1", From 9aa2a365f606fe595a346769a8342fd28e01fb4c Mon Sep 17 00:00:00 2001 From: Jesuye David Date: Wed, 4 Oct 2023 18:38:52 -0400 Subject: [PATCH 7/7] fix replaceAll is not a function --- src/ui/components/search/autocompletecomponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/components/search/autocompletecomponent.js b/src/ui/components/search/autocompletecomponent.js index 4a303abad..326048ceb 100644 --- a/src/ui/components/search/autocompletecomponent.js +++ b/src/ui/components/search/autocompletecomponent.js @@ -214,7 +214,7 @@ export default class AutoCompleteComponent extends Component { resultIndex: this._resultIndex, promptHeader: this._originalQuery.length === 0 ? this.promptHeader : null, listLabelIdName: this.listLabelIdName, - autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name?.replaceAll('.', '-')}`, + autocompleteContainerIdName: `yxt-AutoComplete-container-${this._config.name?.replace(/\./g, '-') || ''}`, eventOptions: this.eventOptions(data) })); }