@lenne.tech/ng-base 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -572,8 +572,9 @@
572
572
  */
573
573
  function apolloOptionsFactory(baseModuleConfig, httpLink, authService) {
574
574
  var links = [];
575
+ var defaultUrl = 'api.' + window.location.href + '/graphql';
575
576
  var http = httpLink.create({
576
- uri: baseModuleConfig.apiUrl,
577
+ uri: baseModuleConfig.apiUrl ? baseModuleConfig.apiUrl : 'https://' + defaultUrl,
577
578
  });
578
579
  var authMiddleware = new core.ApolloLink(function (operation, forward) {
579
580
  var headers = {};
@@ -3010,23 +3011,79 @@
3010
3011
  this.titleService = titleService;
3011
3012
  this.metaTagService = metaTagService;
3012
3013
  }
3013
- SEOService.prototype.initPageForSEO = function (title, description, keywords) {
3014
- this.setPageTitle(title);
3015
- this.setPageDescription(description);
3016
- if (keywords) {
3017
- this.setPageKeywords(keywords);
3014
+ SEOService.prototype.initPageForSEO = function (input) {
3015
+ this.setGeneralData(input);
3016
+ this.setTwitterData(input);
3017
+ this.setTwitterData(input);
3018
+ this.setFacebookData(input);
3019
+ if (input.keywords) {
3020
+ this.setPageKeywords(input.keywords);
3018
3021
  }
3019
3022
  };
3020
- SEOService.prototype.setPageTitle = function (title) {
3021
- this.titleService.setTitle(title);
3022
- this.metaTagService.updateTag({ property: 'og:title', content: title });
3023
- this.metaTagService.updateTag({ name: 'twitter:title', content: title });
3023
+ /**
3024
+ * Set general metadata
3025
+ *
3026
+ * @param data
3027
+ * @private
3028
+ */
3029
+ SEOService.prototype.setGeneralData = function (data) {
3030
+ this.titleService.setTitle(data.title);
3031
+ this.metaTagService.updateTag({ name: 'description', content: data.description });
3024
3032
  };
3025
- SEOService.prototype.setPageDescription = function (description) {
3026
- this.metaTagService.updateTag({ name: 'description', content: description });
3027
- this.metaTagService.updateTag({ property: 'og:description', content: description });
3028
- this.metaTagService.updateTag({ name: 'twitter:description', content: description });
3033
+ /**
3034
+ * Set metadata for twitter
3035
+ *
3036
+ * @param data
3037
+ * @private
3038
+ */
3039
+ SEOService.prototype.setTwitterData = function (data) {
3040
+ this.metaTagService.updateTag({ name: 'twitter:title', content: data.title });
3041
+ this.metaTagService.updateTag({ name: 'twitter:description', content: data.description });
3042
+ this.metaTagService.updateTag({
3043
+ property: 'twitter:url',
3044
+ content: data.url ? data.url : window.location.href,
3045
+ });
3046
+ if (data.image) {
3047
+ this.metaTagService.updateTag({
3048
+ property: 'twitter:image',
3049
+ content: data.image,
3050
+ });
3051
+ this.metaTagService.updateTag({
3052
+ property: 'twitter:card',
3053
+ content: 'summary_large_image',
3054
+ });
3055
+ }
3029
3056
  };
3057
+ /**
3058
+ * Set metadata for facebook
3059
+ *
3060
+ * @param data
3061
+ * @private
3062
+ */
3063
+ SEOService.prototype.setFacebookData = function (data) {
3064
+ this.metaTagService.updateTag({ property: 'og:title', content: data.title });
3065
+ this.metaTagService.updateTag({ property: 'og:description', content: data.description });
3066
+ this.metaTagService.updateTag({
3067
+ property: 'og:type',
3068
+ content: 'website',
3069
+ });
3070
+ this.metaTagService.updateTag({
3071
+ property: 'og:url',
3072
+ content: data.url ? data.url : window.location.href,
3073
+ });
3074
+ if (data.image) {
3075
+ this.metaTagService.updateTag({
3076
+ property: 'og:image',
3077
+ content: data.image,
3078
+ });
3079
+ }
3080
+ };
3081
+ /**
3082
+ * Set page keywords
3083
+ *
3084
+ * @param keywords
3085
+ * @private
3086
+ */
3030
3087
  SEOService.prototype.setPageKeywords = function (keywords) {
3031
3088
  this.metaTagService.updateTag({ name: 'keywords', content: keywords });
3032
3089
  };