loop-modules
Version:
Shared modules for the Loop product suite.
65 lines (64 loc) • 2.44 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
// angular
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
// libs
import 'rxjs/add/operator/map';
import { Observable } from 'rxjs/Observable';
/**
* Service reponsible for managing the company's primary brand color
* @author Sean Perkins <sean@meetmaestro.com | sean-perkins>
*
* @export
* @class BrandService
*/
var BrandService = BrandService_1 = (function () {
function BrandService(http) {
this.http = http;
}
/**
* Sets the primary brand color from the backend-server
*
* @returns {Observable<any>} Observable of the loaded brand color
*
* @memberOf BrandService
*/
BrandService.prototype.setBrand = function () {
var _this = this;
return Observable.create(function (observer) {
_this.http.get('/ma_loop/api/v1/configuration').map(function (res) { return res.json(); }).subscribe(function (result) {
_this.brandColor = result.brand_color_1 || BrandService_1.DEFAULT_BRAND_COLOR;
observer.next(_this.brandColor);
});
});
};
Object.defineProperty(BrandService.prototype, "color", {
/**
* Returns the organization's brand primary color
*
* @readonly
* @type {string}
*/
get: function () {
return this.brandColor;
},
enumerable: true,
configurable: true
});
return BrandService;
}());
BrandService.DEFAULT_BRAND_COLOR = '#CD445B';
BrandService = BrandService_1 = __decorate([
Injectable(),
__metadata("design:paramtypes", [Http])
], BrandService);
export { BrandService };
var BrandService_1;