{"version":3,"sources":["node_modules/@vendasta/api-gateway/fesm2020/vendasta-api-gateway.mjs","apps/business-center-client/src/app/social-connections/social-connections.service.ts"],"sourcesContent":["import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'api-gateway-api.vendasta-local.com',\n 'test': '',\n 'demo': 'api-gateway-demo.apigateway.co',\n 'prod': 'api-gateway-prod.apigateway.co',\n 'production': 'api-gateway-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass IntegrationConnectionRequestDataEntry {\n static fromProto(proto) {\n let m = new IntegrationConnectionRequestDataEntry();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass IntegrationConnectionResponseDataEntry {\n static fromProto(proto) {\n let m = new IntegrationConnectionResponseDataEntry();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass IntegrationConnectionRequest {\n static fromProto(proto) {\n let m = new IntegrationConnectionRequest();\n m = Object.assign(m, proto);\n if (proto.data) {\n m.data = Object.keys(proto.data).reduce((obj, k) => {\n obj[k] = proto.data[k];\n return obj;\n }, {});\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.connectionId !== 'undefined') {\n toReturn['connectionId'] = this.connectionId;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.integrationName !== 'undefined') {\n toReturn['integrationName'] = this.integrationName;\n }\n if (typeof this.data !== 'undefined' && this.data !== null) {\n toReturn['data'] = 'toApiJson' in this.data ? this.data.toApiJson() : this.data;\n }\n return toReturn;\n }\n}\nclass IntegrationConnectionResponse {\n static fromProto(proto) {\n let m = new IntegrationConnectionResponse();\n m = Object.assign(m, proto);\n if (proto.data) {\n m.data = Object.keys(proto.data).reduce((obj, k) => {\n obj[k] = proto.data[k];\n return obj;\n }, {});\n }\n if (proto.lastAttempt) {\n m.lastAttempt = new Date(proto.lastAttempt);\n }\n if (proto.lastSuccess) {\n m.lastSuccess = new Date(proto.lastSuccess);\n }\n if (proto.lastDataReceived) {\n m.lastDataReceived = new Date(proto.lastDataReceived);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.connectionId !== 'undefined') {\n toReturn['connectionId'] = this.connectionId;\n }\n if (typeof this.integrationName !== 'undefined') {\n toReturn['integrationName'] = this.integrationName;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.externalId !== 'undefined') {\n toReturn['externalId'] = this.externalId;\n }\n if (typeof this.environment !== 'undefined') {\n toReturn['environment'] = this.environment;\n }\n if (typeof this.status !== 'undefined') {\n toReturn['status'] = this.status;\n }\n if (typeof this.data !== 'undefined' && this.data !== null) {\n toReturn['data'] = 'toApiJson' in this.data ? this.data.toApiJson() : this.data;\n }\n if (typeof this.lastAttempt !== 'undefined' && this.lastAttempt !== null) {\n toReturn['lastAttempt'] = 'toApiJson' in this.lastAttempt ? this.lastAttempt.toApiJson() : this.lastAttempt;\n }\n if (typeof this.lastSuccess !== 'undefined' && this.lastSuccess !== null) {\n toReturn['lastSuccess'] = 'toApiJson' in this.lastSuccess ? this.lastSuccess.toApiJson() : this.lastSuccess;\n }\n if (typeof this.lastDataReceived !== 'undefined' && this.lastDataReceived !== null) {\n toReturn['lastDataReceived'] = 'toApiJson' in this.lastDataReceived ? this.lastDataReceived.toApiJson() : this.lastDataReceived;\n }\n return toReturn;\n }\n}\nclass IntegrationConnectionResponseList {\n static fromProto(proto) {\n let m = new IntegrationConnectionResponseList();\n m = Object.assign(m, proto);\n if (proto.connections) {\n m.connections = proto.connections.map(IntegrationConnectionResponse.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.connections !== 'undefined' && this.connections !== null) {\n toReturn['connections'] = 'toApiJson' in this.connections ? this.connections.toApiJson() : this.connections;\n }\n return toReturn;\n }\n}\nclass NamespaceConnectionIDRequest {\n static fromProto(proto) {\n let m = new NamespaceConnectionIDRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.connectionId !== 'undefined') {\n toReturn['connectionId'] = this.connectionId;\n }\n return toReturn;\n }\n}\nclass NamespaceIntegrationNameRequest {\n static fromProto(proto) {\n let m = new NamespaceIntegrationNameRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.integrationName !== 'undefined') {\n toReturn['integrationName'] = this.integrationName;\n }\n return toReturn;\n }\n}\nclass NamespaceRequest {\n static fromProto(proto) {\n let m = new NamespaceRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet IntegrationConnectionApiService = /*#__PURE__*/(() => {\n class IntegrationConnectionApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n create(r) {\n const request = r.toApiJson ? r : new IntegrationConnectionRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/Create\", request.toApiJson(), this.apiOptions()).pipe(map(resp => IntegrationConnectionResponse.fromProto(resp)));\n }\n get(r) {\n const request = r.toApiJson ? r : new NamespaceConnectionIDRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/Get\", request.toApiJson(), this.apiOptions()).pipe(map(resp => IntegrationConnectionResponse.fromProto(resp)));\n }\n getMultiByNamespace(r) {\n const request = r.toApiJson ? r : new NamespaceRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/GetMultiByNamespace\", request.toApiJson(), this.apiOptions()).pipe(map(resp => IntegrationConnectionResponseList.fromProto(resp)));\n }\n getMultiByNamespaceAndIntegration(r) {\n const request = r.toApiJson ? r : new NamespaceIntegrationNameRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/GetMultiByNamespaceAndIntegration\", request.toApiJson(), this.apiOptions()).pipe(map(resp => IntegrationConnectionResponseList.fromProto(resp)));\n }\n update(r) {\n const request = r.toApiJson ? r : new IntegrationConnectionRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/Update\", request.toApiJson(), this.apiOptions()).pipe(map(resp => IntegrationConnectionResponse.fromProto(resp)));\n }\n delete(r) {\n const request = r.toApiJson ? r : new NamespaceConnectionIDRequest(r);\n return this.http.post(this._host + \"/api_gateway.v1.IntegrationConnectionService/Delete\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n IntegrationConnectionApiService.ɵfac = function IntegrationConnectionApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IntegrationConnectionApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n IntegrationConnectionApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IntegrationConnectionApiService,\n factory: IntegrationConnectionApiService.ɵfac,\n providedIn: 'root'\n });\n return IntegrationConnectionApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { HostService, IntegrationConnectionApiService, IntegrationConnectionRequest, IntegrationConnectionRequestDataEntry, IntegrationConnectionResponse, IntegrationConnectionResponseDataEntry, IntegrationConnectionResponseList, NamespaceConnectionIDRequest, NamespaceIntegrationNameRequest, NamespaceRequest };\n","import { HttpClient, HttpResponse } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Environment, EnvironmentService } from '@galaxy/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n IntegrationConnectionApiService,\n IntegrationConnectionRequest,\n IntegrationConnectionResponse,\n IntegrationConnectionResponseList,\n NamespaceConnectionIDRequest,\n NamespaceIntegrationNameRequest,\n} from '@vendasta/api-gateway';\nimport {\n Category,\n ConnectedProperty,\n DeletePropertyRequest,\n GA4PropertiesApiService,\n GetAvailablePropertiesRequest,\n SetPropertyMultiRequest,\n} from '@vendasta/google-analytics';\nimport { QuickBooksService } from '@vendasta/quickbooks';\nimport {\n BehaviorSubject,\n catchError,\n EMPTY,\n expand,\n map,\n Observable,\n of,\n reduce,\n shareReplay,\n switchMap,\n tap,\n} from 'rxjs';\nimport { AccountGroupService } from '../account-group';\nimport { AuthService } from '../auth.service';\nimport { GA4View, GAView, SocialPage } from './interface';\nimport {\n ConnectionsService,\n GetConnectionsResponseInterface,\n GetConnectionsInfoResponseInterface,\n ConnectionInterface,\n} from '@vendasta/business-center';\n\nconst googleSearchConsoleURL = {\n availableSitesV2: '/ajax/v2/google-search-console/get-available-sites/',\n connectSiteV2: '/ajax/v2/google-search-console/connect-site/',\n};\n\nexport interface SocialConnectionLinks {\n facebook: string;\n googleplus: string;\n linkedin: string;\n twitter: string;\n googleAnalytics: string;\n googleAnalyticsGA4: string;\n zoom: string;\n google_meet: string;\n quickbooks: string;\n googleSearchConsole: string;\n gingr: string;\n}\n\ninterface AccountMeta {\n accounts: SocialPage[];\n cursor: string;\n}\n\nexport interface SocialPageMeta {\n clientTags: string[];\n deleteUrl: string;\n isVerified: boolean;\n name: string;\n pages: SocialPageMeta[];\n ssid: string;\n tokenIsBroken: boolean;\n type: string;\n locationId: string;\n mapsUri: string;\n}\n\nexport interface SocialConnections {\n facebook: SocialPageMeta[];\n google_my_business: SocialPageMeta[];\n google_analytics: SocialPageMeta[];\n google_analyticsGA4: SocialPageMeta[];\n zoom: SocialPageMeta[];\n google_meet: SocialPageMeta[];\n quickbooks: SocialPageMeta[];\n google_search_console: SocialPageMeta[];\n gingr: SocialPageMeta[];\n}\n\nexport interface SocialConnectionsInfo {\n facebook: boolean;\n instagram: boolean;\n linkedin: boolean;\n twitter: boolean;\n}\ntype pageResponse = any[];\n\n@Injectable({ providedIn: 'root' })\nexport class SocialConnectionsService {\n pagesForAccount: Map = new Map();\n\n private pages$$ = new BehaviorSubject([]);\n readonly pages$ = this.pages$$.asObservable();\n private loadingPages$$ = new BehaviorSubject(false);\n readonly loadingPages$ = this.loadingPages$$.asObservable();\n private pagesCursor$$ = new BehaviorSubject('');\n readonly pagesCursor$ = this.pagesCursor$$.asObservable();\n private accountsCursor$$ = new BehaviorSubject('');\n readonly accountsCursor$ = this.accountsCursor$$.asObservable();\n private accounts$$ = new BehaviorSubject([]);\n readonly accounts$ = this.accounts$$.asObservable();\n private loadingAccounts$$ = new BehaviorSubject(false);\n readonly loadingAccounts$ = this.loadingAccounts$$.asObservable();\n private views$$: BehaviorSubject = new BehaviorSubject([]);\n readonly views$: Observable = this.views$$.asObservable();\n private GA4views$$: BehaviorSubject = new BehaviorSubject([]);\n readonly GA4views$: Observable = this.GA4views$$.asObservable();\n\n private sites$$: BehaviorSubject = new BehaviorSubject([]);\n readonly sites$: Observable = this.sites$$.asObservable();\n\n socialProfileConnections$ = this.accountGroupService.currentAccountGroup$.pipe(\n switchMap((accountGroup) => this.getSocialProfileConnections(accountGroup.accountGroupId)),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n socialProfileConnectionsInfo$ = this.accountGroupService.currentAccountGroup$.pipe(\n switchMap((accountGroup) => this.getSocialProfileConnectionsInfo(accountGroup.accountGroupId)),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n gmbConnected$ = this.socialProfileConnections$.pipe(\n map((connections) => connections?.google_my_business?.length > 0),\n );\n\n googleAnalyticsConnectedGA4$ = this.socialProfileConnections$.pipe(\n map((connections) => connections?.google_analyticsGA4?.length > 0),\n );\n\n facebookConnected$ = this.socialProfileConnections$.pipe(\n map((connections) => {\n return !!connections.facebook?.some((connection) => connection?.pages?.length > 0);\n }),\n );\n\n quickbooksConnectedCompany$ = this.accountGroupService.currentAccountGroupId$.pipe(\n switchMap((agid) => this.quickBooksService.getConnectedCompany(agid, this.authService.userId())),\n catchError((err) => {\n if (err.status >= 500) {\n console.error(this.translateService.instant('SOCIAL_CONNECTIONS.QUICKBOOKS.LOADING_ERROR'));\n }\n return of(null);\n }),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n noGaViews$$: BehaviorSubject = new BehaviorSubject(false);\n noGaViews$ = this.noGaViews$$.asObservable();\n\n constructor(\n private http: HttpClient,\n private accountGroupService: AccountGroupService,\n private connectionsService: ConnectionsService,\n private readonly environment: EnvironmentService,\n private quickBooksService: QuickBooksService,\n private translateService: TranslateService,\n private ga: GA4PropertiesApiService,\n private integrationConnectionApiService: IntegrationConnectionApiService,\n private authService: AuthService,\n ) {}\n\n getAuthUrls(accountGroupId: string, nextUrl: Location): Observable {\n let newUrl = nextUrl.href;\n const urlParts = nextUrl.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n return this.http\n .get<{ data: SocialConnectionLinks }>('/ajax/v1/get-auth-urls/', {\n params: {\n accountGroupId: accountGroupId,\n nextUrl: newUrl,\n },\n })\n .pipe(\n map((response) => {\n return response.data;\n }),\n );\n }\n\n getSocialProfileConnections(accountGroupId: string): Observable {\n return this.connectionsService.getConnections(accountGroupId).pipe(\n map((r: GetConnectionsResponseInterface) => getConnectionsResponseInterfaceToSocialConnections(r)),\n catchError(() => of({} as SocialConnections)),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n getSocialProfileConnectionsInfo(accountGroupId: string): Observable {\n return this.connectionsService.getConnectionsInfo(accountGroupId).pipe(\n map((r: GetConnectionsInfoResponseInterface) => {\n return {\n facebook: r.connectionInfo?.facebook,\n instagram: r.connectionInfo?.instagram,\n linkedin: r.connectionInfo?.linkedin,\n twitter: r.connectionInfo?.twitter,\n };\n }),\n catchError(() => of({} as SocialConnectionsInfo)),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n getSocialAccountInformation(\n accountGroupId: string,\n serviceUserId: string,\n type: string,\n cursor?: string,\n accountId?: string,\n ): void {\n this.loadingAccounts$$.next(true);\n this.getSocialPageInformation(accountGroupId, serviceUserId, type, cursor, accountId).subscribe((response) => {\n this.accountsCursor$$.next(response.cursor || '');\n this.loadingAccounts$$.next(false);\n this.accounts$$.next([...this.accounts$$.getValue(), ...response.pages]);\n });\n }\n\n getSocialPageInformation(\n accountGroupId: string,\n serviceUserId: string,\n type: string,\n cursor?: string,\n accountId?: string,\n ): Observable {\n return this.http\n .get('/ajax/v1/get-social-page-info/', {\n params: {\n accountGroupId,\n serviceUserId,\n type,\n accountId,\n nextCursor: cursor,\n },\n })\n .pipe(\n map(\n (res): SocialPageResponse => ({\n cursor: res.data.cursor,\n pages: res.data.pages,\n }),\n ),\n );\n }\n\n getAllSocialPageInformation(\n accountGroupId: string,\n serviceUserId: string,\n type: string,\n cursor?: string,\n accountId?: string,\n ): Observable {\n return this.getSocialPageInformation(accountGroupId, serviceUserId, type, cursor, accountId).pipe(\n expand((response) => {\n if (!response.cursor) {\n return EMPTY;\n } else {\n return this.getSocialPageInformation(accountGroupId, serviceUserId, type, response.cursor, accountId);\n }\n }),\n reduce((all, { pages }) => all.concat(pages), []),\n );\n }\n\n connectSocialPage(accountGroupId: string, serviceUserId: string, type: string, pageId: string): Observable {\n return this.http\n .post(\n '/ajax/v1/connect-social-page/',\n {},\n {\n params: {\n accountGroupId: accountGroupId,\n serviceUserId: serviceUserId,\n type: type,\n pageId: pageId,\n },\n },\n )\n .pipe(map((response) => response));\n }\n\n deleteService(deleteUrl: string): Observable {\n return this.http.post(deleteUrl, {});\n }\n // Google Analytics GA4 property deletion\n deleteGA4Service(partnerId: string, accountGroupId: string, _propertyId: string): Observable {\n return this.ga.deleteProperty(\n new DeletePropertyRequest({\n partnerId: partnerId,\n businessId: accountGroupId,\n category: Category.CATEGORY_WEBSITE,\n subcategory: 'CATEGORY_WEBSITE',\n }),\n );\n }\n // Google Analytics\n buildGoogleAnalyticsAuthUrl(partnerId: string, accountGroupId: string): string {\n // determine if the first query parameter needs an & or an ?\n const queryParamCharacter = window.location.search ? '&' : '?';\n // encode the URI\n const returnUrl = encodeURIComponent(\n window.location.href + queryParamCharacter + 'type=google-analytics' + `&message=VBC`,\n );\n const uri = `${this.googleAnalyticsHost()}/oauth/v1/auth-user`;\n const uriEncodedParams = `partner_id=${partnerId}&business_id=${accountGroupId}&return_url=${returnUrl}`;\n return `${uri}?${uriEncodedParams}`;\n }\n\n buildGoogleAnalyticsGA4AuthUrl(partnerId: string, accountGroupId: string): string {\n // determine if the first query parameter needs an & or an ?\n const queryParamCharacter = window.location.search ? '&' : '?';\n // encode the URI\n const returnUrl = encodeURIComponent(\n window.location.href + queryParamCharacter + 'type=google-analyticsGA4' + `&message=VBC`,\n );\n const uri = `${this.googleAnalyticsHost()}/oauth/v1/auth-user`;\n const uriEncodedParams = `partner_id=${partnerId}&business_id=${accountGroupId}&return_url=${returnUrl}`;\n return `${uri}?${uriEncodedParams}`;\n }\n private googleAnalyticsHost(): string {\n switch (this.environment.getEnvironment()) {\n case Environment.LOCAL:\n return 'http://localhost:11001';\n case Environment.DEMO:\n return 'https://google-analytics-api-demo.apigateway.co';\n case Environment.PROD:\n return 'https://google-analytics-api-prod.apigateway.co';\n }\n return 'https://google-analytics-api-demo.apigateway.co';\n }\n\n getPropertiesInformation(googleUserID: string): void {\n this.loadingAccounts$$.next(true);\n this.ga\n .getAvailableProperties(new GetAvailablePropertiesRequest({ googleUserId: googleUserID }))\n .pipe(\n tap((response) => {\n this.GA4views$$.next(response.properties ?? []);\n this.loadingAccounts$$.next(false);\n }),\n )\n .subscribe();\n }\n\n connectGA4Prop(\n partnerId: string,\n accountGroupId: string,\n accountId: string,\n propertyId: string,\n gaUserId: string,\n category: number,\n subcategory: string,\n propertyName: string,\n accountName: string,\n ): any {\n const param: ConnectedProperty[] = [\n new ConnectedProperty({\n partnerId: partnerId,\n businessId: accountGroupId,\n category: Category.CATEGORY_WEBSITE,\n subcategory: subcategory,\n propertyId: propertyId,\n propertyName: propertyName,\n accountId: accountId,\n accountName: accountName,\n googleUserId: gaUserId,\n }),\n ];\n this.ga\n .setPropertyMulti(\n new SetPropertyMultiRequest({\n properties: param,\n }),\n )\n .subscribe();\n }\n // Google Search Console\n buildGoogleSearchConsoleAuthUrl(partnerId: string, accountGroupId: string): string {\n // determine if the first query parameter needs an & or an ?\n const queryParamCharacter = window.location.search ? '&' : '?';\n // encode the URI\n let newUrl = window.location.href;\n const urlParts = window.location.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n const returnUrl = encodeURIComponent(newUrl + queryParamCharacter + 'type=google-search-console' + `&message=VBC`);\n const uri = `${this.googleSearchConsoleHost()}/oauth/v1/auth-user`;\n const uriEncodedParams = `partner_id=${partnerId}&business_id=${accountGroupId}&return_url=${returnUrl}`;\n return `${uri}?${uriEncodedParams}`;\n }\n\n private googleSearchConsoleHost(): string {\n switch (this.environment.getEnvironment()) {\n case Environment.LOCAL:\n return 'http://localhost:11001';\n case Environment.DEMO:\n return 'https://google-search-console-demo.apigateway.co';\n case Environment.PROD:\n return 'https://google-search-console-prod.apigateway.co';\n }\n return 'https://google-search-console-demo.apigateway.co';\n }\n\n gscGetSitesInformation(googleUserID: string): void {\n this.loadingAccounts$$.next(true);\n this.http\n .get(googleSearchConsoleURL.availableSitesV2, {\n params: {\n googleUserId: googleUserID,\n },\n })\n .pipe(\n tap((response) => {\n this.sites$$.next(response.data);\n this.loadingAccounts$$.next(false);\n }),\n )\n .subscribe();\n }\n getIntegrationConnection(namespace: string, integrationName: string): Observable {\n return this.integrationConnectionApiService.getMultiByNamespaceAndIntegration(\n new NamespaceIntegrationNameRequest({\n namespace: namespace,\n integrationName: integrationName,\n }),\n );\n }\n\n createIntegrationConnection(\n namespace: string,\n integrationName: string,\n locationId: string,\n ): Observable {\n return this.integrationConnectionApiService.create(\n new IntegrationConnectionRequest({\n namespace: namespace,\n integrationName: integrationName,\n data: {\n locationId: locationId,\n },\n }),\n );\n }\n\n deleteIntegrationConnection(namespace: string, connectionId: string): Observable> {\n return this.integrationConnectionApiService.delete(\n new NamespaceConnectionIDRequest({\n namespace: namespace,\n connectionId: connectionId,\n }),\n );\n }\n updateIntegrationConnection(\n namespace: string,\n connectionId: string,\n locationId: string,\n ): Observable {\n return this.integrationConnectionApiService.update(\n new IntegrationConnectionRequest({\n namespace: namespace,\n connectionId: connectionId,\n data: {\n locationId: locationId,\n },\n }),\n );\n }\n gscConnectSite(\n partnerId: string,\n accountGroupId: string,\n googleUserId: string,\n gscSiteUrl: string,\n ): Observable {\n const params = {\n partnerId: partnerId,\n businessId: accountGroupId,\n gscSiteUrl: gscSiteUrl,\n googleUserId: googleUserId,\n };\n return this.http\n .post(\n googleSearchConsoleURL.connectSiteV2,\n {},\n {\n params: params,\n },\n )\n .pipe(map((response) => response.data));\n }\n}\n\nfunction getConnectionsResponseInterfaceToSocialConnections(r: GetConnectionsResponseInterface): SocialConnections {\n if (!r.connections) {\n return {} as SocialConnections;\n }\n return {\n facebook: r.connections['facebook']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n google_my_business: r.connections['google_my_business']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n google_analytics: r.connections['google_analytics']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n google_analyticsGA4: r.connections['google_analyticsGA4']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n zoom: r.connections['zoom']?.connection?.map((page: ConnectionInterface) => connectionToSocialPageMeta(page)),\n google_meet: r.connections['google_meet']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n quickbooks: r.connections['quickbooks']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n google_search_console: r.connections['google_search_console']?.connection?.map((page: ConnectionInterface) =>\n connectionToSocialPageMeta(page),\n ),\n gingr: r.connections['gingr']?.connection?.map((page: ConnectionInterface) => connectionToSocialPageMeta(page)),\n };\n}\n\nfunction connectionToSocialPageMeta(connection: ConnectionInterface): SocialPageMeta {\n if (!connection) {\n return null;\n }\n return {\n clientTags: connection.clientTags,\n deleteUrl: connection.deleteUrl,\n isVerified: connection.isVerified,\n name: connection.name,\n pages: connection.pages?.map((page: SocialPageMeta) => connectionToSocialPageMeta(page)),\n ssid: connection.ssid,\n tokenIsBroken: connection.tokenIsBroken,\n type: connection.type,\n locationId: connection.locationId,\n mapsUri: connection.mapsUri,\n };\n}\n\nexport interface VAPIResponse {\n data: any;\n requestId: string;\n responseTime: number;\n statusCode: number;\n version: string;\n}\nexport interface SocialPageResponse {\n cursor?: string;\n pages: any[];\n}\n"],"mappings":"mlBAAA,IAKMA,GACAC,GAOFC,GAoEEC,EAmCAC,EA8DAC,EAuBAC,EAuBAC,EAuBAC,EAkCFC,GAzRJC,EAAAC,EAAA,KAAAC,IAEAC,IACAA,IACAC,KACMd,IAAe,OAAS,OAAO,YAAiB,SAAW,OAC3DC,GAAU,CACd,MAAS,qCACT,KAAQ,GACR,KAAQ,iCACR,KAAQ,iCACR,WAAc,gCAChB,EACIC,IAA4B,IAAM,CACpC,MAAMA,CAAY,CAChB,IAAI,MAAO,CACT,OAAOD,GAAQD,GAAY,YAAY,CAAC,CAC1C,CACA,IAAI,gBAAiB,CACnB,MAAO,WAAa,KAAK,IAC3B,CACF,CACA,OAAAE,EAAY,UAAO,SAA6Ba,EAAmB,CACjE,OAAO,IAAKA,GAAqBb,EACnC,EACAA,EAAY,WAA0Bc,EAAmB,CACvD,MAAOd,EACP,QAASA,EAAY,UACrB,WAAY,MACd,CAAC,EACMA,CACT,GAAG,EAkDGC,EAAN,MAAMc,CAA6B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xBvL,EAAwBwL,QAAxBxL,EAAwByL,UAAAC,WADX,MAAM,CAAA,CAAA,SACnB1L,CAAwB,GAAA","names":["environment","hostMap","HostService","IntegrationConnectionRequest","IntegrationConnectionResponse","IntegrationConnectionResponseList","NamespaceConnectionIDRequest","NamespaceIntegrationNameRequest","NamespaceRequest","IntegrationConnectionApiService","init_vendasta_api_gateway","__esmMin","init_core","init_http","init_operators","__ngFactoryType__","ɵɵdefineInjectable","_IntegrationConnectionRequest","proto","m","obj","k","kwargs","toReturn","_IntegrationConnectionResponse","_IntegrationConnectionResponseList","_NamespaceConnectionIDRequest","_NamespaceIntegrationNameRequest","_NamespaceRequest","http","hostService","HttpHeaders","r","request","map","resp","__spreadProps","__spreadValues","ɵɵinject","HttpClient","getConnectionsResponseInterfaceToSocialConnections","r","connections","facebook","connection","map","page","connectionToSocialPageMeta","google_my_business","google_analytics","google_analyticsGA4","zoom","google_meet","quickbooks","google_search_console","gingr","clientTags","deleteUrl","isVerified","name","pages","ssid","tokenIsBroken","type","locationId","mapsUri","googleSearchConsoleURL","SocialConnectionsService","init_social_connections_service","__esmMin","init_src","init_vendasta_api_gateway","init_vendasta_google_analytics","init_esm","availableSitesV2","connectSiteV2","constructor","http","accountGroupService","connectionsService","environment","quickBooksService","translateService","ga","integrationConnectionApiService","authService","pagesForAccount","Map","pages$$","BehaviorSubject","pages$","asObservable","loadingPages$$","loadingPages$","pagesCursor$$","pagesCursor$","accountsCursor$$","accountsCursor$","accounts$$","accounts$","loadingAccounts$$","loadingAccounts$","views$$","views$","GA4views$$","GA4views$","sites$$","sites$","socialProfileConnections$","currentAccountGroup$","pipe","switchMap","accountGroup","getSocialProfileConnections","accountGroupId","shareReplay","refCount","bufferSize","socialProfileConnectionsInfo$","getSocialProfileConnectionsInfo","gmbConnected$","length","googleAnalyticsConnectedGA4$","facebookConnected$","some","quickbooksConnectedCompany$","currentAccountGroupId$","agid","getConnectedCompany","userId","catchError","err","status","console","error","instant","of","noGaViews$$","noGaViews$","getAuthUrls","nextUrl","newUrl","href","urlParts","pathname","split","forEach","part","startsWith","replace","get","params","response","data","getConnections","getConnectionsInfo","connectionInfo","instagram","linkedin","twitter","getSocialAccountInformation","serviceUserId","cursor","accountId","next","getSocialPageInformation","subscribe","getValue","nextCursor","res","getAllSocialPageInformation","expand","EMPTY","reduce","all","concat","connectSocialPage","pageId","post","deleteService","deleteGA4Service","partnerId","_propertyId","deleteProperty","DeletePropertyRequest","businessId","category","Category","CATEGORY_WEBSITE","subcategory","buildGoogleAnalyticsAuthUrl","queryParamCharacter","window","location","search","returnUrl","encodeURIComponent","uri","googleAnalyticsHost","uriEncodedParams","buildGoogleAnalyticsGA4AuthUrl","getEnvironment","Environment","LOCAL","DEMO","PROD","getPropertiesInformation","googleUserID","getAvailableProperties","GetAvailablePropertiesRequest","googleUserId","tap","properties","connectGA4Prop","propertyId","gaUserId","propertyName","accountName","param","ConnectedProperty","setPropertyMulti","SetPropertyMultiRequest","buildGoogleSearchConsoleAuthUrl","googleSearchConsoleHost","gscGetSitesInformation","getIntegrationConnection","namespace","integrationName","getMultiByNamespaceAndIntegration","NamespaceIntegrationNameRequest","createIntegrationConnection","create","IntegrationConnectionRequest","deleteIntegrationConnection","connectionId","delete","NamespaceConnectionIDRequest","updateIntegrationConnection","update","gscConnectSite","gscSiteUrl","ɵɵinject","HttpClient","AccountGroupService","ConnectionsService","EnvironmentService","QuickBooksService","TranslateService","GA4PropertiesApiService","IntegrationConnectionApiService","AuthService","factory","ɵfac","providedIn"],"x_google_ignoreList":[0]}