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IAC7EA,IAAKpL,KAAKqL,qBAAuB,IAASF,EAAOnL,KAAKqL,qBAAuB,IAMnF,KAAKjO,OAAOiC,OACXJ,KACC1C,EAAQ+C,GAAMA,YAAaE,EAAa,EACxC8L,EAAK,CAAC,CAAC,EACP7L,UAAU,IAAM,KAAKrC,OAAO6N,mBAAmBC,iBAAmBF,CAAoB,CAC1F,IAAApQ,CAAA,CAAAK,IAAA,UAAAsQ,CAAA,aAAAA,CAAA,EArgBWpP,GAAYqP,EAAAC,EAAA,EAAAD,EAAAxR,EAAA,EAAAwR,EAAAE,EAAA,EAAAF,EAAAG,EAAA,EAAAH,EAAAI,EAAA,EAAAJ,EAAAK,GAAA,GAAAL,EAAAM,EAAA,EAAAN,EAAAO,EAAA,EAAAP,EAAAQ,EAAA,EAAAR,EAAAS,EAAA,EAAAT,EA+DbU,CAAS,EAAAV,EAAAW,EAAA,KAAAvR,CAAA,CAAAC,KAAA,CAAAC,CAAA,EAAAC,KAAA,CA/DRoB,EAAYnB,QAAZmB,EAAYlB,KAAAC,WAFX,MAAM,GAEd,GAAOiB,GAAPiQ,QAAOjQ,EAAY,aAAAkQ,CAAA,IAAArF,CAAA,CAAAsF,EAAA,IAAAC,CAAA","names":["CompanyBySlugGQL","Query","constructor","arguments","document","gql","companyBaseFragment","companyDataFragment","contactFragment","addressFragment","categoryBaseFragment","t","c","ɵprov","A","token","factory","ɵfac","providedIn","_CompanyBySlugGQL","StandLayoutEnum","complete","compact","admin","detailsPage","standFree","STAND_PAGES_NAMES","dashboard","label","$localize","path","icon","rel","news","products","StandService","standPages","Object","values","filter","p","currentCompany","newsCount","usersService","isInRole","UserRolesEnum","stand_admin","productsCount","map","standLayout","_standLayout","asReadonly","router","companyBySlugGQL","_platform","routesService","languagesService","metadataService","breadcrumbsService","location","errorService","locale","countriesService","signal","collapse","animate","hideNavBar","lockCollapsed","currentCategory","breadcrumbs","history","currentHistoryIndex","destroyed","$onDestroyStand","Subject","$onSlideStand","$onHeaderStateChange","$onDescriptionExpanded","standRegex","RegExp","mainStream","pipe","tap","startWith","routerStream","events","e","NavigationStart","NavigationEnd","subscribe","Scroll","position","next","RouteConfigLoadStart","isNaN","route","data","layout","setLayout","ActivationEnd","snapshot","mergeMap","scan","acc","event","__spreadProps","__spreadValues","trigger","navigationTrigger","id","idToRestore","restoredState","navigationId","undefined","currentIndex","idx","findIndex","x","splice","push","url","urlAfterRedirects","length","takeUntil","test","destroy","routerState","root","firstChild","curPage","urlParts","split","pop","platform","isBrowser","slug","locState","getState","stand","replaceState","currentStandPageUrl","currentQueryString","canonicalUrl","lang","currentLanguageCode","currentCategoriesPath","primaryPath","normalized","replace","re","replacingPath","canonicalDefaultUrl","urlSegments","shift","bc","i","includes","currentPageName","product","name","title","slice","join","store","concat","fromEvent","window","passive","capture","state","nextHistoryIndex","pathname","_state","resolve","$currentCompany","indexOf","BehaviorSubject","category","params","subcategory","companySlug","fetch","fetchPolicy","result","company","companyBySlug","accountType","AccountType","premium","customer","PageNotFoundError","freeMember","basicMember","setCustomReuseStrategy","setCurrentCompanyRole","_id","categories","level","find","cat","startsWith","navigate","getCompanyUrl","parent","shortName","fullName","primaryAddress","addresses","a","primary","set","catchError","err","from","handleError","getCurrentCompany","asObservable","getConfiguration","configurationName","standServiceurations","getResolvedUrl","pathFromRoot","v","segment","toString","isFirstPage","lastPageData","getCurrentLangCode","options","defaultCfg","showBackBtn","customH1Tag","appendCompanyMetaTags","canonical","carousel","index","alternativeLangs","primaryPathLocales","pathLocale","_url","getCompanyAltLangUrl","urlTree","parseUrl","queryParams","city","regionCode","countryCode","country","getName","companyTitleTpl","_title","metaTitle","_description","shortDescription","appendMetadata","description","images","companyImage","pageType","refPath","navigateNextStand","nextIndex","endsWith","nextCompany","historyGo","setTimeout","navigatePreviousStand","prevCompany","regex","previousIndex","relativeIndex","hasHistory","currShouldReuseRoute","routeReuseStrategy","shouldReuseRoute","future","curr","shouldReuseOnSlide","take","r","ɵɵinject","Router","Platform","RoutesService","LanguagesService","MetadataService","BreadcrumbsService","UsersService","Location","ErrorService","LOCALE_ID","IsoCountriesService","_StandService","C","mt","b"],"ignoreList":[],"sources":["src/app/shared/services/company/companyBySlug.gql.service.ts","src/app/stand/stand.enums.ts","src/app/stand/stand.service.ts"],"sourcesContent":["import {gql, Query} from 'apollo-angular';\r\nimport { companyBaseFragment} from './fragments/company-base.fragments';\r\nimport { companyDataFragment } from './fragments/company-data.fragment';\r\nimport { Injectable } from '@angular/core';\r\nimport { addressFragment } from '../common/fragments/address.fragment';\r\nimport { contactFragment } from '../common/fragments/contact.fragment';\r\nimport { categoryBaseFragment } from '../categories/fragments/category-base.fragments';\r\nimport { ICompany } from '@collections/companies/interfaces/company.interface';\r\n\r\n\r\nexport interface CompanyBySlugResponse {\r\n companyBySlug: ICompany;\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class CompanyBySlugGQL extends Query {\r\n document = gql`\r\n query getCompanyBySlug (\r\n $slug:String!,\r\n $lang: String!,\r\n $category: String){\r\n companyBySlug(slug:$slug, lang: $lang) {\r\n ...companyBase\r\n ...companyData\r\n folder\r\n companyImage\r\n shortDescription\r\n description\r\n categories(lang: $lang, thirdLevel: true) {\r\n ...categoryBase\r\n parent(lang: $lang) {\r\n ...categoryBase\r\n }\r\n }\r\n tags(lang: $lang) {\r\n tag\r\n }\r\n fieldsOfRelevance\r\n materials\r\n translations\r\n associatedCount\r\n productsCount\r\n newsCount\r\n primaryPathLocales {\r\n path\r\n lang\r\n }\r\n addresses {...AddressFields}\r\n contacts {...ContactFields}\r\n webSite\r\n socials {\r\n name\r\n url\r\n }\r\n associations(lang: $lang) {\r\n ...companyBase\r\n }\r\n nextCompany(lang: $lang, category: $category) {\r\n ...companyBase\r\n }\r\n prevCompany(lang: $lang, category: $category) {\r\n ...companyBase\r\n }\r\n }\r\n }\r\n ${companyBaseFragment},\r\n ${companyDataFragment},\r\n ${contactFragment},\r\n ${addressFragment},\r\n ${categoryBaseFragment}\r\n `;\r\n}\r\n","export enum StandLayoutEnum {\r\n 'complete' = 0,\r\n 'compact' = 1,\r\n 'admin' = 2,\r\n 'detailsPage' = 3,\r\n 'standFree' = 4\r\n}\r\n","import { ICategory } from '@collections/categories/interfaces/category.interface';\r\nimport { UsersService } from '@shared/services/users/users.service';\r\nimport { Inject, Injectable, LOCALE_ID, Optional, signal } from '@angular/core';\r\nimport { Location } from '@angular/common';\r\nimport { Subject, BehaviorSubject, Observable, fromEvent, from, ReplaySubject } from 'rxjs';\r\nimport { ActivatedRouteSnapshot, RouterStateSnapshot, Router, NavigationEnd, NavigationStart, Scroll, ActivationEnd, RoutesRecognized, RouteConfigLoadStart } from '@angular/router';\r\nimport { filter, map, startWith, mergeMap, takeUntil, scan, take, tap, catchError } from 'rxjs/operators';\r\nimport { CompanyBySlugGQL } from '@shared/services/company/companyBySlug.gql.service';\r\nimport { ICompany } from '@collections/companies/interfaces/company.interface';\r\nimport { StandLayoutEnum } from './stand.enums';\r\nimport { Platform } from '@angular/cdk/platform';\r\nimport { RoutesService } from '@shared/services/routes/route.service';\r\nimport { LanguagesService } from '@shared/services/languages/languages.service';\r\nimport { IPathLocale } from '@collections/common/interfaces/path-locale.interface';\r\nimport { BreadcrumbsService, IBreadcrumb } from '@shared/services/breadcrumbs/breadcrumbs.service';\r\nimport { MetadataService } from '@shared/services/meta-data-service/meta-data.service';\r\nimport { ErrorService } from 'app/error-handler/services/error.service';\r\nimport { PageNotFoundError } from 'app/error-handler/custom-errors/page-not-found.error';\r\nimport { IsoCountriesService } from 'app/shared/services/iso-countries/iso-countries.service';\r\nimport { UserRolesEnum } from '@collections/users/enums/user-roles.enums';\r\nimport { RobotsIndexEnum } from 'app/shared/services/meta-data-service/meta-data.commons';\r\nimport { AccountType } from '@collections/companies/enums';\r\n\r\nexport type NavigationTrigger = 'imperative' | 'popstate' | 'hashchange';\r\n\r\nexport interface HistoryEntry {\r\n id: number;\r\n url: string;\r\n}\r\n\r\nexport interface RouterHistory {\r\n history: HistoryEntry[];\r\n currentIndex: number;\r\n\r\n event: NavigationStart | NavigationEnd;\r\n trigger: NavigationTrigger;\r\n id: number;\r\n idToRestore: number;\r\n}\r\n\r\nexport interface IStandLayoutOptions {\r\n collapse?: boolean;\r\n animate?: boolean;\r\n hideNavBar: boolean;\r\n showBackBtn?: boolean;\r\n lockCollapsed?: boolean;\r\n customH1Tag?: boolean;\r\n}\r\ninterface IStandComponent {\r\n navigationItem: {\r\n label: string;\r\n path: string;\r\n icon: string;\r\n };\r\n}\r\n\r\nexport interface IStandPage {\r\n label: string;\r\n path: string;\r\n icon: string;\r\n rel: string;\r\n}\r\n\r\n\r\ninterface IStandConfiguration {\r\n components: IStandComponent[];\r\n}\r\ninterface IStandConfigurations {\r\n [name: string]: IStandConfiguration;\r\n}\r\n\r\nexport const STAND_PAGES_NAMES = {\r\n dashboard: { label: $localize`Online Stand`, path: null, icon: 'stand:featured_play_list', rel: '' },\r\n news: { label: $localize`News`, path: 'news', icon: 'stand:newspaper', rel: 'nofollow' },\r\n products: { label: $localize`Products`, path: 'products', icon: 'stand:collections', rel: 'nofollow' },\r\n};\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class StandService {\r\n\r\n public get standPages(): IStandPage[] {\r\n return Object.values(STAND_PAGES_NAMES)\r\n .filter(p => {\r\n switch (p.path) {\r\n case 'news':\r\n return this.currentCompany.newsCount > 0 || this.usersService.isInRole([UserRolesEnum.admin, UserRolesEnum.stand_admin]);\r\n break;\r\n case 'products':\r\n return this.currentCompany.productsCount > 0 || this.usersService.isInRole([UserRolesEnum.admin, UserRolesEnum.stand_admin]);\r\n break;\r\n default:\r\n return true;\r\n }\r\n })\r\n .map(p => p);\r\n }\r\n\r\n // private $onChangeHeader: ReplaySubject;\r\n\r\n get standLayout() {\r\n return this._standLayout.asReadonly();\r\n }\r\n private _standLayout = signal({ collapse: false, animate: true, hideNavBar: false, lockCollapsed: false });\r\n\r\n private $onDestroyStand: Subject;\r\n private $currentCompany: BehaviorSubject;\r\n public $onSlideStand: Subject;\r\n public $onHeaderStateChange: Subject;\r\n public $onDescriptionExpanded: Subject;\r\n private currentCompany: ICompany;\r\n\r\n\r\n private standServiceurations: IStandConfigurations;\r\n private lastPageData: any;\r\n private currentPageName: string;\r\n private currentStandPageUrl: string;\r\n private currentQueryString: string;\r\n\r\n public currentCategoriesPath: string;\r\n public currentCategory = signal(null);\r\n\r\n\r\n public canonicalDefaultUrl: IPathLocale;\r\n public canonicalUrl: IPathLocale;\r\n public breadcrumbs: IBreadcrumb[] = [];\r\n\r\n private history: HistoryEntry[] = [];\r\n private currentHistoryIndex = 0;\r\n private destroyed = false;\r\n\r\n constructor(\r\n private router: Router,\r\n private companyBySlugGQL: CompanyBySlugGQL,\r\n private _platform: Platform,\r\n private routesService: RoutesService,\r\n private languagesService: LanguagesService,\r\n @Optional() private metadataService: MetadataService,\r\n private breadcrumbsService: BreadcrumbsService,\r\n private usersService: UsersService,\r\n private location: Location,\r\n private errorService: ErrorService,\r\n @Inject(LOCALE_ID) private locale: string,\r\n private countriesService: IsoCountriesService\r\n ) {\r\n\r\n // this.$onChangeHeader = new ReplaySubject();\r\n\r\n this.$onDestroyStand = new Subject();\r\n // this.$openStandVideo = new Subject();\r\n\r\n this.$onSlideStand = new Subject();\r\n this.$onHeaderStateChange = new Subject();\r\n this.$onDescriptionExpanded = new Subject();\r\n const standRegex = new RegExp(/\\/(stand|stand-free)\\//);\r\n\r\n\r\n const mainStream = this.$onDestroyStand\r\n .pipe(\r\n tap((destroyed) => this.destroyed = destroyed),\r\n filter(destroyed => destroyed === false),\r\n startWith(false)\r\n );\r\n\r\n const routerStream = this.router.events\r\n .pipe(\r\n filter(e => e instanceof NavigationStart || e instanceof NavigationEnd)\r\n );\r\n\r\n this.router.events\r\n .subscribe((e) => {\r\n if(e instanceof Scroll) {\r\n if ((e.position && e.position[1] > 0) || false) {\r\n this.$onHeaderStateChange.next(true);\r\n } else {\r\n this.$onHeaderStateChange.next(false);\r\n }\r\n }\r\n\r\n if(e instanceof RouteConfigLoadStart && !isNaN(e.route.data?.layout)) {\r\n this.setLayout(e.route.data.layout);\r\n }\r\n\r\n if(e instanceof ActivationEnd && !isNaN(e.snapshot.data?.layout)) {\r\n this.setLayout(e.snapshot.data.layout);\r\n }\r\n });\r\n // Per ovviare al problema che per questo servizio non avviene mai l'onDestroy (lazy loaded Module)\r\n // https://stackoverflow.com/questions/53222529/services-lifecycle-destroy-a-service\r\n // https://stackoverflow.com/questions/38950435/rxjs-resubscribe-to-unsubscribed-observable\r\n\r\n mainStream\r\n .pipe(\r\n mergeMap(\r\n () => routerStream.pipe(\r\n scan(\r\n (acc, event) => {\r\n if (event instanceof NavigationStart) {\r\n // We need to track the trigger, id, and idToRestore from the NavigationStart events\r\n return {\r\n ...acc,\r\n event,\r\n trigger: event.navigationTrigger,\r\n id: event.id,\r\n idToRestore:\r\n (event.restoredState && event.restoredState.navigationId) ||\r\n undefined\r\n };\r\n }\r\n // NavigationEnd events\r\n const history = [...acc.history];\r\n let currentIndex = acc.currentIndex;\r\n // browser events (back/forward) are popstate events\r\n if (acc.trigger === 'popstate') {\r\n // get the history item that references the idToRestore\r\n const idx = history.findIndex(x => x.id === acc.idToRestore);\r\n // if found, set the current index to that history item and update the id\r\n if (idx > -1) {\r\n currentIndex = idx;\r\n history[idx].id = acc.id;\r\n } else {\r\n currentIndex = 0;\r\n }\r\n } else {\r\n // remove all events in history that come after the current index\r\n history.splice(currentIndex + 1);\r\n // add the new event to the end of the history and set that as our current index\r\n history.push({ id: acc.id, url: event.urlAfterRedirects });\r\n currentIndex = history.length - 1;\r\n }\r\n return {\r\n ...acc,\r\n event,\r\n history,\r\n currentIndex\r\n };\r\n },\r\n {\r\n event: null,\r\n history: [],\r\n trigger: null,\r\n id: 0,\r\n idToRestore: 0,\r\n currentIndex: 0\r\n }\r\n ),\r\n // filter out so we only act when navigation is done\r\n filter(\r\n ({ event, trigger }) => event instanceof NavigationEnd\r\n ),\r\n takeUntil(this.$onDestroyStand)\r\n )\r\n )\r\n )\r\n .subscribe(({ history, currentIndex }) => {\r\n this.history = history;\r\n this.currentHistoryIndex = currentIndex;\r\n });\r\n\r\n\r\n mainStream\r\n .pipe(\r\n mergeMap(() =>\r\n routerStream\r\n .pipe(\r\n filter(e => e instanceof NavigationEnd),\r\n takeUntil(this.$onDestroyStand)\r\n )\r\n )\r\n ).subscribe((e: NavigationEnd) => {\r\n if (!this.currentCompany) {\r\n return;\r\n }\r\n const url = e.urlAfterRedirects;\r\n // uscita dallo stand component;\r\n if (!standRegex.test(url)){\r\n this.destroy();\r\n }\r\n\r\n let route = this.router.routerState.root;\r\n\r\n while (route.firstChild) {\r\n route = route.firstChild;\r\n }\r\n let curPage;\r\n const urlParts = url.split(/[?#]/);\r\n curPage = urlParts[0].split('/').pop();\r\n\r\n if (this.platform.isBrowser && curPage === this.currentCompany.slug ) {\r\n const locState: any = this.location.getState();\r\n locState.stand = 'next';\r\n this.location.replaceState(url, '', locState);\r\n }\r\n\r\n this.currentStandPageUrl = curPage === this.currentCompany.slug ? '' : curPage;\r\n this.currentQueryString = urlParts.length > 1 ? urlParts[1] : undefined;\r\n this.canonicalUrl = { lang: this.currentLanguageCode, path: url };\r\n if (this.currentCategoriesPath !== this.currentCompany.primaryPath) {\r\n const normalized = this.currentCategoriesPath.replace('/', '\\/');\r\n const re = new RegExp(`^\\/hall${normalized}\\/`);\r\n const replacingPath = `/hall${this.currentCompany.primaryPath}/`;\r\n this.canonicalUrl.path = url.replace(re, replacingPath);\r\n }\r\n this.canonicalDefaultUrl = { ...this.canonicalUrl };\r\n\r\n route.data.subscribe(data => {\r\n const urlSegments = url.split('/');\r\n urlSegments.shift();\r\n const bc: IBreadcrumb[] = [];\r\n let i = urlSegments.length - 1;\r\n if(!urlSegments.includes(this.currentCompany.slug)){\r\n return;\r\n }\r\n\r\n this.currentPageName = '';\r\n while (urlSegments[i] !== this.currentCompany.slug) {\r\n let label: string;\r\n switch (urlSegments[i]) {\r\n case 'news':\r\n label = this.currentPageName = STAND_PAGES_NAMES.news.label;\r\n this.canonicalDefaultUrl.path = this.canonicalDefaultUrl.path.replace('/news', '');\r\n break;\r\n case 'products':\r\n label = this.currentPageName = STAND_PAGES_NAMES.products.label;\r\n this.canonicalDefaultUrl.path = this.canonicalDefaultUrl.path.replace('/products', '');\r\n break;\r\n default:\r\n if (data.product) {\r\n label = data.product.name;\r\n } else if (data.news) {\r\n label = data.news.title;\r\n }\r\n }\r\n bc.splice(0, 0, {label: label, url: `/${urlSegments.slice(0, i + 1).join('/')}`});\r\n i--;\r\n }\r\n this.breadcrumbsService.store(this.breadcrumbs.concat(bc));\r\n });\r\n });\r\n\r\n if (this.platform.isBrowser) {\r\n mainStream\r\n .pipe(\r\n mergeMap(() => fromEvent(window, 'popstate', { passive: true, capture: true })\r\n .pipe(\r\n takeUntil(this.$onDestroyStand)\r\n ))\r\n )\r\n .subscribe((event: any) => {\r\n if (event.state?.stand) {\r\n const nextHistoryIndex = this.history.findIndex(i => i.url === window.location.pathname);\r\n const _state = this.location.getState();\r\n _state[`stand`] = this.currentHistoryIndex > nextHistoryIndex ? 'prev' : 'next';\r\n this.$onSlideStand.next(true);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable {\r\n if (this.$currentCompany) {\r\n this.$currentCompany.complete();\r\n }\r\n\r\n // da realizzare meglio\r\n if (state.url.indexOf('/edit/info/') > -1) {\r\n return;\r\n }\r\n this.$currentCompany = new BehaviorSubject(null);\r\n const category = `/${route.params.category}` + (route.params.subcategory ? `/${route.params.subcategory}` : '');\r\n const slug = route.params.companySlug;\r\n\r\n return this.companyBySlugGQL.fetch({ \r\n slug: slug, \r\n lang: this.currentLanguageCode, \r\n category: category \r\n }, {\r\n // fetchPolicy: 'no-cache'\r\n fetchPolicy: 'cache-first'\r\n })\r\n .pipe(\r\n map(result => {\r\n // initialize variables\r\n if(this.destroyed) {\r\n this.$onDestroyStand.next(false);\r\n }\r\n\r\n this.currentCategoriesPath = null;\r\n this.canonicalUrl = null;\r\n this.breadcrumbs = [];\r\n\r\n let company = result.data.companyBySlug;\r\n if (!company) {\r\n throw new PageNotFoundError(state.url);\r\n } \r\n else if((state.url.indexOf('/stand-free/') > -1) && (company.accountType == AccountType.premium || company.accountType == AccountType.customer)){\r\n throw new PageNotFoundError(state.url);\r\n } \r\n else if((state.url.indexOf('/stand/') > -1) && (company.accountType == AccountType.freeMember || company.accountType == AccountType.basicMember)){\r\n throw new PageNotFoundError(state.url);\r\n } \r\n else {\r\n if (this.currentCompany && this.currentCompany.slug !== company.slug) {\r\n this.setCustomReuseStrategy();\r\n }\r\n }\r\n this.usersService.setCurrentCompanyRole(company._id);\r\n\r\n this.currentCategoriesPath = `/${route.params.category}/${(route.params.subcategory || '')}`;\r\n const currentCategory = company.categories\r\n .filter(c => c.level < 2)\r\n .find(cat => cat.path.startsWith(this.currentCategoriesPath));\r\n const needRedirect = !currentCategory || slug !== company.slug;\r\n if (needRedirect) {\r\n // some category name or company slug had changed\r\n // redirect 301\r\n this.router.navigate([this.routesService.getCompanyUrl(company)]);\r\n }\r\n\r\n // breadcrumbs\r\n this.breadcrumbs.push({ label: currentCategory.parent.shortName, url: `/hall${currentCategory.parent.path}` });\r\n if (route.params.subcategory) {\r\n this.breadcrumbs.push({ label: currentCategory.shortName, url: `/hall${currentCategory.path}` });\r\n }\r\n if((company.accountType == AccountType.premium || company.accountType == AccountType.customer))\r\n {\r\n this.breadcrumbs.push({ label: company.fullName, url: `${this.breadcrumbs[this.breadcrumbs.length - 1].url}/stand/${company.slug}` });\r\n }\r\n else{\r\n this.breadcrumbs.push({ label: company.fullName, url: `${this.breadcrumbs[this.breadcrumbs.length - 1].url}/stand-free/${company.slug}` });\r\n }\r\n this.breadcrumbsService.store(this.breadcrumbs);\r\n\r\n company = {\r\n ...company,\r\n primaryAddress: company.addresses.find(a => a.primary === true)\r\n };\r\n this.currentCategory.set(currentCategory);\r\n this.currentCompany = company;\r\n this.$currentCompany.next(company);\r\n return { company: company };\r\n }),\r\n catchError((err) => {\r\n return from(this.errorService.handleError(err));\r\n })\r\n\r\n );\r\n }\r\n\r\n destroy(): void {\r\n this.breadcrumbs = [];\r\n this.$onDestroyStand.next(true);\r\n }\r\n getCurrentCompany(): Observable {\r\n return this.$currentCompany.asObservable();\r\n }\r\n getConfiguration(configurationName: string): IStandConfiguration {\r\n return this.standServiceurations[configurationName];\r\n }\r\n\r\n getResolvedUrl(route: ActivatedRouteSnapshot): string {\r\n return route.pathFromRoot\r\n .map(v => v.url.map(segment => segment.toString()).join('/'))\r\n .join('/');\r\n }\r\n\r\n get isFirstPage(): boolean {\r\n return this.lastPageData === undefined;\r\n }\r\n\r\n get platform(): Platform {\r\n return this._platform;\r\n }\r\n\r\n get currentLanguageCode(): string {\r\n return this.languagesService.getCurrentLangCode();\r\n }\r\n\r\n setLayout(layout: StandLayoutEnum): void {\r\n let options: IStandLayoutOptions;\r\n const defaultCfg = { collapse: false, animate: true, hideNavBar: false, lockCollapsed: false };\r\n switch (layout) {\r\n case StandLayoutEnum.complete:\r\n options = defaultCfg;\r\n break;\r\n case StandLayoutEnum.compact:\r\n options = { collapse: true, animate: !this.isFirstPage, hideNavBar: !this.isFirstPage, lockCollapsed: true };\r\n break;\r\n case StandLayoutEnum.admin:\r\n options = { collapse: true, animate: !this.isFirstPage, hideNavBar: true, showBackBtn: true, lockCollapsed: true };\r\n break;\r\n case StandLayoutEnum.detailsPage:\r\n options = { collapse: false, animate: !this.isFirstPage, hideNavBar: false, lockCollapsed: false, customH1Tag: true };\r\n break;\r\n case StandLayoutEnum.standFree:\r\n options = defaultCfg;\r\n break;\r\n }\r\n\r\n this._standLayout.set(options);\r\n // this.$onChangeHeader.next(options);\r\n }\r\n\r\n appendCompanyMetaTags(canonical: IPathLocale, carousel?: string[], index?: RobotsIndexEnum): void {\r\n const company = this.currentCompany;\r\n let alternativeLangs: IPathLocale[] = [];\r\n\r\n alternativeLangs = company.primaryPathLocales\r\n .map(pathLocale => {\r\n const _url = this.routesService.getCompanyAltLangUrl(company, pathLocale.lang);\r\n const urlTree = this.router.parseUrl(_url);\r\n\r\n urlTree.queryParams = this.router.routerState.snapshot.root.queryParams;\r\n\r\n return {\r\n lang: pathLocale.lang,\r\n // path: (this.currentStandPageUrl ? `${_url}/${this.currentStandPageUrl}` : _url) + this.currentQueryString ? `?${this.currentQueryString }` : ''\r\n path: (this.currentStandPageUrl ? `${_url}/${this.currentStandPageUrl}` : _url)\r\n } as IPathLocale;\r\n });\r\n\r\n const { city, regionCode, countryCode } = company.addresses[0];\r\n const country = this.countriesService.getName(countryCode, this.locale);\r\n const companyTitleTpl = `${company.fullName} ${$localize `in `}${city} ${regionCode ? `(${regionCode})`: ''} - ${country}`;\r\n \r\n let _title\r\n if (company.metaTitle && company.metaTitle != '') {\r\n _title = company.metaTitle;\r\n } else {\r\n _title = this.currentPageName ? `${this.currentPageName} - ${companyTitleTpl}` : `${companyTitleTpl}`;\r\n }\r\n const _description = company.shortDescription ? company.shortDescription :\r\n $localize`Information and contacts of ${company.fullName}, a company specializing in ${this.currentCategory().shortName}. Learn about products, services, news, and submit your inquiry!`;\r\n\r\n // aggiungo Meta tags lato server\r\n this.metadataService.appendMetadata({\r\n title: _title,\r\n description: _description,\r\n images: [company.companyImage],\r\n pageType: 'company',\r\n company: company,\r\n categories: company.categories.map(c => c.refPath)\r\n },\r\n canonical,\r\n alternativeLangs, index, company, carousel);\r\n }\r\n\r\n navigateNextStand(): void {\r\n const nextIndex = this.history.findIndex(i => i.url.endsWith(this.currentCompany.nextCompany.slug));\r\n const nextCompany = this.currentCompany.nextCompany;\r\n this.$onSlideStand.next(true);\r\n if (nextIndex > -1) {\r\n this.location.historyGo(nextIndex - this.currentHistoryIndex);\r\n return;\r\n }\r\n const url = this.routesService.getCompanyUrl(nextCompany, this.currentCategoriesPath);\r\n setTimeout(() => {\r\n this.router.navigate([url], {\r\n state: { stand: 'next' }\r\n });\r\n }, 10);\r\n }\r\n\r\n navigatePreviousStand(): void {\r\n if (this.currentCompany.prevCompany) {\r\n const regex = new RegExp(`.*\\/${this.currentCompany.prevCompany.slug}(\\/.*)?`);\r\n const previousIndex = this.history.findIndex(i => regex.test(i.url));\r\n const relativeIndex = -(this.currentHistoryIndex - previousIndex);\r\n this.$onSlideStand.next(true);\r\n this.location.historyGo(relativeIndex);\r\n }\r\n }\r\n\r\n get hasHistory(): boolean {\r\n if (! this.currentCompany.prevCompany) {\r\n return false;\r\n }\r\n const regex = new RegExp(`.*\\/${this.currentCompany.prevCompany.slug}(\\/.*)?`);\r\n return this.history.findIndex(i => regex.test(i.url)) > -1;\r\n }\r\n\r\n setCustomReuseStrategy(): void{\r\n const currShouldReuseRoute = this.router.routeReuseStrategy.shouldReuseRoute;\r\n\r\n this.router.routeReuseStrategy.shouldReuseRoute = (future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean => {\r\n if (curr.data.shouldReuseOnSlide === false || future.data.shouldReuseOnSlide === false) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n this.router.events\r\n .pipe(\r\n filter((e) => e instanceof NavigationEnd),\r\n take(1)\r\n ).subscribe(() => this.router.routeReuseStrategy.shouldReuseRoute = currShouldReuseRoute);\r\n }\r\n\r\n}\r\n"]}