{ "version": 3, "sources": ["src/app/core/services/trustpilot.service.ts"], "sourcesContent": ["import { Inject, Injectable } from '@angular/core';\nimport { Observable, tap } from 'rxjs';\nimport { EnvironmentService } from './environment.service';\nimport { ScriptLoaderService } from './script-loader.service';\nimport { WINDOW } from './window.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TrustpilotService {\n widgetTheme: Observable;\n\n constructor(\n @Inject(WINDOW) private window: Window,\n private scriptLoaderService: ScriptLoaderService,\n private environmentService: EnvironmentService\n ) {}\n\n loadTrustPilotWidget(widgetElement: HTMLElement, theme?: string) {\n if (theme && this.environmentService.isBrowser()) {\n // setting the theme of widget element before loading the script\n widgetElement.dataset.theme = theme;\n }\n const script = this.scriptLoaderService\n .load(\n 'https://widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js'\n )\n .pipe(\n tap(() => {\n (this.window as any)?.Trustpilot?.loadFromElement(\n widgetElement\n );\n })\n );\n return script;\n }\n}\n"], "mappings": "gJASA,IAAaA,GAAiB,IAAA,CAAxB,MAAOA,CAAiB,CAG1BC,YAC4BC,EAChBC,EACAC,EAAsC,CAFtB,KAAAF,OAAAA,EAChB,KAAAC,oBAAAA,EACA,KAAAC,mBAAAA,CACT,CAEHC,qBAAqBC,EAA4BC,EAAc,CAC3D,OAAIA,GAAS,KAAKH,mBAAmBI,UAAS,IAE1CF,EAAcG,QAAQF,MAAQA,GAEnB,KAAKJ,oBACfO,KACG,uEAAuE,EAE1EC,KACGC,EAAI,IAAK,CACJ,KAAKV,QAAgBW,YAAYC,gBAC9BR,CAAa,CAErB,CAAC,CAAC,CAGd,iDA1BSN,GAAiBe,EAIdC,CAAM,EAAAD,EAAAE,CAAA,EAAAF,EAAAG,CAAA,CAAA,CAAA,CAAA,iCAJTlB,EAAiBmB,QAAjBnB,EAAiBoB,UAAAC,WAFd,MAAM,CAAA,CAAA,SAETrB,CAAiB,GAAA", "names": ["TrustpilotService", "constructor", "window", "scriptLoaderService", "environmentService", "loadTrustPilotWidget", "widgetElement", "theme", "isBrowser", "dataset", "load", "pipe", "tap", "Trustpilot", "loadFromElement", "\u0275\u0275inject", "WINDOW", "ScriptLoaderService", "EnvironmentService", "factory", "\u0275fac", "providedIn"] }