2017-12-24 04:02:57 -05:00
|
|
|
import { Injectable } from "@angular/core";
|
|
|
|
import { Http } from "@angular/http";
|
2018-03-24 19:16:52 -04:00
|
|
|
import { AuthedApi } from "../authed-api";
|
2017-12-24 04:02:57 -05:00
|
|
|
import { FE_Widget } from "../../models/integration";
|
|
|
|
import { IntegrationsApiService } from "./integrations-api.service";
|
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class WidgetApiService extends AuthedApi {
|
|
|
|
constructor(http: Http, private integrationsApi: IntegrationsApiService) {
|
|
|
|
super(http);
|
|
|
|
}
|
|
|
|
|
|
|
|
public getWidget(type: string): Promise<FE_Widget> {
|
|
|
|
return this.integrationsApi.getIntegration("widget", type).then(i => <FE_Widget>i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public isEmbeddable(url: string): Promise<any> { // 200 = success, anything else = error
|
|
|
|
return this.http.get("/api/v1/dimension/widgets/embeddable", {params: {url: url}})
|
|
|
|
.map(r => r.json()).toPromise();
|
|
|
|
}
|
|
|
|
}
|