diff --git a/src/Core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php b/src/Core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php new file mode 100644 index 00000000..548e0d06 --- /dev/null +++ b/src/Core/Content/Product/SalesChannel/Listing/ProductListingFeaturesSubscriber.php @@ -0,0 +1,63 @@ + 'prepare', + ProductSuggestCriteriaEvent::class => 'prepare', + ProductSearchCriteriaEvent::class => [ + ['handleSearchRequest', 100], + ], + ProductListingResultEvent::class => 'process', + ProductSearchResultEvent::class => 'process', + ]; + } + + public function prepare(ProductListingCriteriaEvent $event): void + { + $this->decorated->prepare($event); + } + + public function process(ProductListingResultEvent $event): void + { + $this->decorated->process($event); + } + + public function handleSearchRequest(ProductSearchCriteriaEvent $event): void + { + $limit = $event->getCriteria()->getLimit(); + $this->decorated->prepare($event); + + $limitOverride = $limit ?? $event->getCriteria()->getLimit(); + + $event->getCriteria()->setIds(['2a88d9b59d474c7e869d8071649be43c', '11dc680240b04f469ccba354cbf0b967']); + +// $this->findologicSearchService->doSearch($event, $limitOverride); + } + + public function __call($method, $args) + { + if (!method_exists($this->decorated, $method)) { + return; + } + + return $this->decorated->{$method}(...$args); + } +} \ No newline at end of file diff --git a/src/Core/Content/Product/SalesChannel/Search/ProductSearchRoute.php b/src/Core/Content/Product/SalesChannel/Search/ProductSearchRoute.php new file mode 100644 index 00000000..37bba947 --- /dev/null +++ b/src/Core/Content/Product/SalesChannel/Search/ProductSearchRoute.php @@ -0,0 +1,108 @@ +decorated; + } + + public function load( + Request $request, + SalesChannelContext $context, + ?Criteria $criteria = null + ): ProductSearchRouteResponse { + $this->addElasticSearchContext($context); + + $criteria ??= $this->criteriaBuilder->handleRequest( + $request, + new Criteria(), + $this->definition, + $context->getContext() + ); + + $shouldHandleRequest = $this->configProvider->isSearchEnabled(); + + $criteria->addFilter( + new ProductAvailableFilter( + $context->getSalesChannel()->getId(), + ProductVisibilityDefinition::VISIBILITY_SEARCH + ) + ); + + $this->searchBuilder->build($request, $criteria, $context); + + $this->eventDispatcher->dispatch( + new ProductSearchCriteriaEvent($request, $criteria, $context) + ); + + if (!$shouldHandleRequest) { + return $this->decorated->load($request, $context, $criteria); + } + + $query = $request->query->get('search'); + $result = $this->doSearch($criteria, $context, $query); + $result = ProductListingResult::createFrom($result); + $result->addCurrentFilter('search', $query); + + $this->eventDispatcher->dispatch( + new ProductSearchResultEvent($request, $result, $context) + ); + + return new ProductSearchRouteResponse($result); + } + + protected function doSearch( + Criteria $criteria, + SalesChannelContext $salesChannelContext, + ?string $query + ): EntitySearchResult { + $this->assignPaginationToCriteria($criteria); + $this->addOptionsGroupAssociation($criteria); + + if (empty($criteria->getIds())) { + return $this->createEmptySearchResult($criteria, $salesChannelContext->getContext()); + } + + return $this->fetchProducts($criteria, $salesChannelContext, $query); + } + + public function addElasticSearchContext(SalesChannelContext $context): void + { + $context->getContext()->addState(Criteria::STATE_ELASTICSEARCH_AWARE); + } +} \ No newline at end of file diff --git a/src/Core/Content/Product/SearchKeyword/ProductSearchBuilder.php b/src/Core/Content/Product/SearchKeyword/ProductSearchBuilder.php new file mode 100644 index 00000000..65e75c1c --- /dev/null +++ b/src/Core/Content/Product/SearchKeyword/ProductSearchBuilder.php @@ -0,0 +1,89 @@ +getPathInfo() === '/suggest') { + $this->buildParent($request, $criteria, $context); + return; + } + + $this->doBuild($request, $criteria, $context); + } + + public function buildParent(Request $request, Criteria $criteria, SalesChannelContext $context): void + { + $this->decorated->build($request, $criteria, $context); + } + + public function doBuild(Request $request, Criteria $criteria, SalesChannelContext $context): void + { + $search = $request->get('search'); + + if (is_array($search)) { + $term = implode(' ', $search); + } else { + $term = (string) $search; + } + + $term = trim($term); + $pattern = $this->interpreter->interpret($term, $context->getContext()); + + foreach ($pattern->getTerms() as $searchTerm) { + $criteria->addQuery( + new ScoreQuery( + new EqualsFilter('product.searchKeywords.keyword', $searchTerm->getTerm()), + $searchTerm->getScore(), + 'product.searchKeywords.ranking' + ) + ); + } + $criteria->addQuery( + new ScoreQuery( + new ContainsFilter('product.searchKeywords.keyword', $pattern->getOriginal()->getTerm()), + $pattern->getOriginal()->getScore(), + 'product.searchKeywords.ranking' + ) + ); + + if ($pattern->getBooleanClause() !== SearchPattern::BOOLEAN_CLAUSE_AND) { + $criteria->addFilter(new AndFilter([ + new EqualsAnyFilter('product.searchKeywords.keyword', array_values($pattern->getAllTerms())), + new EqualsFilter('product.searchKeywords.languageId', $context->getContext()->getLanguageId()), + ])); + + return; + } + + foreach ($pattern->getTokenTerms() as $terms) { + $criteria->addFilter(new AndFilter([ + new EqualsFilter('product.searchKeywords.languageId', $context->getContext()->getLanguageId()), + new EqualsAnyFilter('product.searchKeywords.keyword', $terms), + ])); + } + } +} diff --git a/src/Elasticsearch/Product/ProductSearchBuilder.php b/src/Elasticsearch/Product/ProductSearchBuilder.php new file mode 100644 index 00000000..7e41c13d --- /dev/null +++ b/src/Elasticsearch/Product/ProductSearchBuilder.php @@ -0,0 +1,48 @@ +helper->allowSearch($this->productDefinition, $context->getContext(), $criteria)) { + $this->decorated->build($request, $criteria, $context); + + return; + } + + $search = $request->get('search'); + + if (\is_array($search)) { + $term = implode(' ', $search); + } else { + $term = (string) $search; + } + + $term = trim($term); + + // reset queries and set term to criteria. + $criteria->resetQueries(); + + // elasticsearch will interpret this on demand + $criteria->setTerm($term); + } +} \ No newline at end of file diff --git a/src/Model/ConfigProvider.php b/src/Model/ConfigProvider.php index beb09071..a0ea04a5 100644 --- a/src/Model/ConfigProvider.php +++ b/src/Model/ConfigProvider.php @@ -60,6 +60,10 @@ class ConfigProvider public const ENABLE_PRODUCT_LABELLING_SYNC = 'config.enableLabelling'; + public const ENABLE_SEARCH = 'config.enableSearch'; + + public const ENABLE_NAVIGATION = 'config.enableNavigation'; + public function __construct(SystemConfigService $systemConfig) { $this->systemConfig = $systemConfig; @@ -199,4 +203,14 @@ public function getProductIdentifier($channelId = null): string $value = $this->systemConfig->get($this->path(self::PRODUCT_IDENTIFIER_FIELD), $channelId); return is_string($value) ? $value : 'product-id'; } + + public function isSearchEnabled($channelId = null): bool + { + return $this->systemConfig->getBool($this->path(self::ENABLE_SEARCH), $channelId); + } + + public function isNavigationEnabled($channelId = null): bool + { + return $this->systemConfig->getBool($this->path(self::ENABLE_SEARCH), $channelId); + } } diff --git a/src/Resources/config/imports/search.xml b/src/Resources/config/imports/search.xml new file mode 100644 index 00000000..b4d833df --- /dev/null +++ b/src/Resources/config/imports/search.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index b48a6e19..b0302e2c 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -4,6 +4,10 @@ xmlns="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + + + @@ -311,5 +315,15 @@ + + + + diff --git a/src/Resources/public/administration/js/nosto-integration.js b/src/Resources/public/administration/js/nosto-integration.js index b0049ec5..e8398a48 100644 --- a/src/Resources/public/administration/js/nosto-integration.js +++ b/src/Resources/public/administration/js/nosto-integration.js @@ -1,3 +1,3 @@ /*! For license information please see nosto-integration.js.LICENSE.txt */ -!function(e){var n={};function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)t.d(o,i,function(n){return e[n]}.bind(null,i));return o},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p=(window.__sw__.assetPath + '/bundles/nostointegration/'),t(t.s="8kwx")}({"/fvg":function(e){e.exports=JSON.parse('{"sw-cms":{"detail":{"sidebar":{"nostoSidebarOption":"Nosto Komponenten"},"preview":{"elementLabel":"Element-ID","emptyLabel":"Nicht konfiguriert"}}}}')},"6EZe":function(e,n,t){},"6fhQ":function(e,n,t){var o=t("hD3o");o.__esModule&&(o=o.default),"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals);(0,t("P8hj").default)("20e54586",o,!0,{})},"8kwx":function(e,n,t){"use strict";t.r(n);var o,i=(o=t("PPLc")).keys().reduce((function(e,n){var t={name:n.split(".")[1].split("/")[1],functional:!0,render:function(e,t){var i=t.data;return e("span",{class:[i.staticClass,i.class],style:i.style,attrs:i.attrs,on:i.on,domProps:{innerHTML:o(n)}})}};return e.push(t),e}),[]),r=Shopware.Component;i.map((function(e){return r.register(e.name,e)}));function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function s(e,n){for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:"nosto";return l(this,r),(t=i.call(this,e,n,o)).name="nostoApiKeyValidatorService",t}return n=r,(t=[{key:"validate",value:function(e){var n=this.getBasicHeaders();return this.httpClient.post("/_action/nosto-integration-api-key-validate",e,{headers:n})}}])&&s(n.prototype,t),o&&s(n,o),Object.defineProperty(n,"prototype",{writable:!1}),r}(Shopware.Classes.ApiService);Shopware.Service().register("nostoApiKeyValidatorService",(function(e){var n=Shopware.Application.getContainer("init");return new d(n.httpClient,e.loginService)}));t("GqwO");var g=Shopware,h=g.Component,A=g.Defaults,v=g.Mixin,w=Shopware.Data.Criteria;h.register("nosto-integration-settings",{template:'{% block nosto_integration %}\n \n {% block nostointegration_header %}\n \n {% endblock %}\n {% block nosto_integration_actions %}\n \n {% endblock %}\n\n {% block nosto_integration_content %}\n \n {% endblock %}\n \n{% endblock %}\n',inject:["repositoryFactory","NostoIntegrationProviderService"],mixins:[v.getByName("notification")],data:function(){return{isLoading:!1,isSaveSuccessful:!1,defaultAccountNameFilled:!1,messageAccountBlankErrorState:null,config:null,salesChannels:[],errorStates:{},configurationKeys:{accountID:"NostoIntegration.config.accountID",accountName:"NostoIntegration.config.accountName",productToken:"NostoIntegration.config.productToken",emailToken:"NostoIntegration.config.emailToken",appToken:"NostoIntegration.config.appToken"}}},metaInfo:function(){return{title:this.$createTitle()}},computed:{salesChannelRepository:function(){return this.repositoryFactory.create("sales_channel")}},created:function(){this.createdComponent()},methods:{createdComponent:function(){this.getSalesChannels()},onChangeLanguage:function(){this.getSalesChannels()},getSalesChannels:function(){var e=this;this.isLoading=!0;var n=new w;n.addFilter(w.equalsAny("typeId",[A.storefrontSalesChannelTypeId,A.apiSalesChannelTypeId])),this.salesChannelRepository.search(n,Shopware.Context.api).then((function(n){n.add({id:null,translated:{name:e.$tc("sw-sales-channel-switch.labelDefaultOption")}}),e.salesChannels=n})).finally((function(){e.isLoading=!1}))},isActive:function(e){var n="NostoIntegration.config.isEnabled",t=this.$refs.configComponent.allConfigs[e]||null;return null!=t&&t.hasOwnProperty(n)&&"boolean"==typeof t[n]?t[n]:this.$refs.configComponent.allConfigs.null[n]},getInheritedValue:function(e,n){return this.$refs.configComponent.allConfigs.hasOwnProperty(e)&&this.$refs.configComponent.allConfigs[e].hasOwnProperty(n)&&null!==this.$refs.configComponent.allConfigs[e][n]?this.$refs.configComponent.allConfigs[e][n]:this.$refs.configComponent.allConfigs.null[n]},checkErrorsBeforeSave:function(){var e=this,n={},t=!1;try{Object.keys(this.$refs.configComponent.allConfigs).forEach((function(o){if(e.isActive(o)&&(!e.getInheritedValue(o,e.configurationKeys.accountID)||!e.getInheritedValue(o,e.configurationKeys.accountName)||!e.getInheritedValue(o,e.configurationKeys.productToken)||!e.getInheritedValue(o,e.configurationKeys.emailToken)||!e.getInheritedValue(o,e.configurationKeys.appToken)))throw t={salesChannelName:e.salesChannels.get("null"===o?null:o).translated.name},n}))}catch(e){if(e!==n)throw e}return t},clearCaches:function(){var e=this;this.createNotificationInfo({message:this.$tc("sw-settings-cache.notifications.clearCache.started")}),this.NostoIntegrationProviderService.clearCaches().then((function(){e.createNotificationSuccess({message:e.$tc("sw-settings-cache.notifications.clearCache.success")})})).catch((function(){e.createNotificationError({message:e.$tc("sw-settings-cache.notifications.clearCache.error")})}))},onSave:function(){var e=this;this.isLoading=!0;var n=this.checkErrorsBeforeSave();if(n)return this.isLoading=!1,void this.createNotificationError({title:n.salesChannelName,message:this.$tc("nosto.messages.error-message")});this.$refs.configComponent.save().then((function(){e.isSaveSuccessful=!0,e.createNotificationSuccess({message:e.$tc("nosto.messages.success-message")}),e.clearCaches()})).finally((function(){e.isLoading=!1}))}}});function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(){m=function(){return e};var e={},n=Object.prototype,t=n.hasOwnProperty,o=Object.defineProperty||function(e,n,t){e[n]=t.value},i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{s({},"")}catch(e){s=function(e,n,t){return e[n]=t}}function c(e,n,t,i){var r=n&&n.prototype instanceof p?n:p,a=Object.create(r.prototype),l=new x(i||[]);return o(a,"_invoke",{value:S(e,t,l)}),a}function f(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var u={};function p(){}function d(){}function g(){}var h={};s(h,r,(function(){return this}));var A=Object.getPrototypeOf,v=A&&A(A(K([])));v&&v!==n&&t.call(v,r)&&(h=v);var w=g.prototype=p.prototype=Object.create(h);function P(e){["next","throw","return"].forEach((function(n){s(e,n,(function(e){return this._invoke(n,e)}))}))}function y(e,n){function i(o,r,a,l){var s=f(e[o],e,r);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==b(u)&&t.call(u,"__await")?n.resolve(u.__await).then((function(e){i("next",e,a,l)}),(function(e){i("throw",e,a,l)})):n.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,l)}))}l(s.arg)}var r;o(this,"_invoke",{value:function(e,t){function o(){return new n((function(n,o){i(e,t,n,o)}))}return r=r?r.then(o,o):o()}})}function S(e,n,t){var o="suspendedStart";return function(i,r){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw r;return I()}for(t.method=i,t.arg=r;;){var a=t.delegate;if(a){var l=C(a,t);if(l){if(l===u)continue;return l}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===o)throw o="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);o="executing";var s=f(e,n,t);if("normal"===s.type){if(o=t.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(o="completed",t.method="throw",t.arg=s.arg)}}}function C(e,n){var t=n.method,o=e.iterator[t];if(void 0===o)return n.delegate=null,"throw"===t&&e.iterator.return&&(n.method="return",n.arg=void 0,C(e,n),"throw"===n.method)||"return"!==t&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+t+"' method")),u;var i=f(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,u;var r=i.arg;return r?r.done?(n[e.resultName]=r.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}function T(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function F(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function K(e){if(e){var n=e[r];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o=0;--i){var r=this.tryEntries[i],a=r.completion;if("root"===r.tryLoc)return o("end");if(r.tryLoc<=this.prev){var l=t.call(r,"catchLoc"),s=t.call(r,"finallyLoc");if(l&&s){if(this.prev=0;--o){var i=this.tryEntries[o];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),F(t),u}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var o=t.completion;if("throw"===o.type){var i=o.arg;F(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:K(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),u}},e}function P(e,n,t,o,i,r,a){try{var l=e[r](a),s=l.value}catch(e){return void t(e)}l.done?n(s):Promise.resolve(s).then(o,i)}function y(e){return function(){var n=this,t=arguments;return new Promise((function(o,i){var r=e.apply(n,t);function a(e){P(r,o,i,a,l,"next",e)}function l(e){P(r,o,i,a,l,"throw",e)}a(void 0)}))}}function S(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var o,i,r,a,l=[],s=!0,c=!1;try{if(r=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(o=r.call(t)).done)&&(l.push(o.value),l.length!==n);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return C(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,o=new Array(n);t\n \n\n {% block nosto_integration_setting_deferred_init %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_setting_merch %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_setting_notLoggedInCache %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_setting_sales_channel_domain %}\n \n {% endblock %}\n \n\n \n {% block nosto_integration_settings_custom_fields %}\n \n \n \n {% endblock %}\n\n {% block nosto_integration_settings_tag_1 %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_settings_tag_2 %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_settings_tag_3 %}\n \n\n \n \n {% endblock %}\n\n {% block nosto_integration_settings_tag_google_category %}\n \n \n \n {% endblock %}\n \n \n{% endblock %}\n',inject:["repositoryFactory"],props:{actualConfigData:{type:Object,required:!0},allConfigs:{type:Object,required:!0},selectedSalesChannelId:{type:String,required:!1,default:null}},data:function(){return{isLoading:!1,productCustomFields:[],productTags:[],languageCode:null}},computed:{domainCriteria:function(){var e=new F(1,25);return e.addFilter(F.equals("salesChannelId",this.selectedSalesChannelId)),e},languageRepository:function(){return this.repositoryFactory.create("language")},customFieldSetRepository:function(){return this.repositoryFactory.create("custom_field_set")},tagRepository:function(){return this.repositoryFactory.create("tag")}},created:function(){this.initLanguageCode(),this.getProductCustomFields(),this.getProductTags(),this.createdComponent()},methods:{createdComponent:function(){var e=this,n="NostoIntegration.config.";Object.entries({tag1:null,tag2:null,tag3:null,selectedCustomFields:null,googleCategory:null,isInitializeNostoAfterInteraction:null}).forEach((function(t){var o=S(t,2),i=o[0],r=o[1];void 0===e.allConfigs.null[n+i]&&e.$set(e.allConfigs.null,n+i,r)}));for(var t=1;t<4;t+=1){var o="NostoIntegration.config.tag".concat(t);("string"==typeof this.allConfigs.null[o]||this.allConfigs.null[o]instanceof String)&&(this.allConfigs.null[o]=[this.allConfigs.null[o]]),("string"==typeof this.actualConfigData[o]||this.actualConfigData[o]instanceof String)&&(this.actualConfigData[o]=[this.actualConfigData[o]])}},initLanguageCode:function(){var e=this;return y(m().mark((function n(){return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e.getSystemCurrentLocale();case 2:e.languageCode=n.sent;case 3:case"end":return n.stop()}}),n)})))()},getSystemCurrentLocale:function(){var e=this;return y(m().mark((function n(){var t,o;return m().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return(t=new F).addFilter(F.equals("id",Shopware.Context.api.languageId)),t.addAssociation("locale"),n.next=5,e.languageRepository.search(t,Shopware.Context.api);case 5:return o=n.sent,n.abrupt("return",o.first().locale.code);case 7:case"end":return n.stop()}}),n)})))()},clearTagValue:function(e){this.allConfigs.null["NostoIntegration.config.".concat(e)]=null},getProductCustomFields:function(){var e=this;this.initLanguageCode().then((function(){var n=e,t=new F;return t.setLimit(5e4),t.addFilter(F.equals("relations.entityName","product")).addAssociation("customFields").addAssociation("relations"),e.customFieldSetRepository.search(t,Shopware.Context.api).then((function(e){e.forEach((function(e){e.customFields.forEach((function(e){var t=e.config.label[n.languageCode]||e.name;n.productCustomFields.push({label:t,name:e.name,id:e.name})}))}))}))}))},getProductTags:function(){var e=this;this.initLanguageCode().then((function(){var n=new F;return n.setLimit(5e4),e.tagRepository.search(n,Shopware.Context.api).then((function(n){n.forEach((function(n){e.productTags.push({label:n.name,name:n.name,id:n.id})}))}))}))}}});function x(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var o,i,r,a,l=[],s=!0,c=!1;try{if(r=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(o=r.call(t)).done)&&(l.push(o.value),l.length!==n);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,n)||function(e,n){if(!e)return;if("string"==typeof e)return K(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return K(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,o=new Array(n);t