@jeraldj/discussions-ui 8.0.3-v16

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.
Files changed (174) hide show
  1. package/README.md +24 -0
  2. package/assets/images/Buffer-512.webp +0 -0
  3. package/assets/images/announcement.svg +25 -0
  4. package/assets/images/back-img.png +0 -0
  5. package/assets/images/bookmarks.png +0 -0
  6. package/assets/images/card-icon.png +0 -0
  7. package/assets/images/close.png +0 -0
  8. package/assets/images/delete.svg +13 -0
  9. package/assets/images/down-arrow.png +0 -0
  10. package/assets/images/down-chevron.png +0 -0
  11. package/assets/images/down.svg +12 -0
  12. package/assets/images/edit.svg +11 -0
  13. package/assets/images/empty.svg +37 -0
  14. package/assets/images/eye-icon.png +0 -0
  15. package/assets/images/general discussion.svg +15 -0
  16. package/assets/images/import-export-arrows.png +0 -0
  17. package/assets/images/loader-icon.svg +6 -0
  18. package/assets/images/profits.png +0 -0
  19. package/assets/images/search-icon.png +0 -0
  20. package/assets/images/select-bookmarks.png +0 -0
  21. package/assets/images/select-down-arrow.png +0 -0
  22. package/assets/images/select-profits.png +0 -0
  23. package/assets/images/select-up-arrow.png +0 -0
  24. package/assets/images/up-arrow.png +0 -0
  25. package/assets/images/up-chevron.png +0 -0
  26. package/assets/images/up.svg +12 -0
  27. package/assets/images/views.svg +9 -0
  28. package/assets/images/votes.svg +14 -0
  29. package/assets/styles/global.scss +283 -0
  30. package/esm2022/jeraldj-discussions-ui.mjs +5 -0
  31. package/esm2022/lib/common/constants.json +630 -0
  32. package/esm2022/lib/components/components.module.mjs +105 -0
  33. package/esm2022/lib/components/discuss-all/discuss-all.component.mjs +269 -0
  34. package/esm2022/lib/components/discuss-category/discuss-category.component.mjs +152 -0
  35. package/esm2022/lib/components/discuss-home/discuss-home.component.mjs +142 -0
  36. package/esm2022/lib/components/discuss-start/discuss-start.component.mjs +199 -0
  37. package/esm2022/lib/components/discuss-tags/discuss-tags.component.mjs +93 -0
  38. package/esm2022/lib/components/discussion-details/discussion-details.component.mjs +459 -0
  39. package/esm2022/lib/components/lib-entry/lib-entry.component.mjs +96 -0
  40. package/esm2022/lib/components/my-discussion/my-discussion.component.mjs +234 -0
  41. package/esm2022/lib/components/side-pannel/side-pannel.component.mjs +79 -0
  42. package/esm2022/lib/components/tag-all-discussion/tag-all-discussion.component.mjs +151 -0
  43. package/esm2022/lib/components/trending-tags/trending-tags.component.mjs +62 -0
  44. package/esm2022/lib/config/url.config.mjs +32 -0
  45. package/esm2022/lib/discussion-events.service.mjs +27 -0
  46. package/esm2022/lib/discussion-routing/discussion-routing.module.mjs +80 -0
  47. package/esm2022/lib/discussion-ui.module.mjs +41 -0
  48. package/esm2022/lib/elements/app-loader/app-loader.component.mjs +36 -0
  49. package/esm2022/lib/elements/avatar-photo/avatar-photo.component.mjs +81 -0
  50. package/esm2022/lib/elements/category-card/category-card.component.mjs +17 -0
  51. package/esm2022/lib/elements/discuss-card/discuss-card.component.mjs +45 -0
  52. package/esm2022/lib/elements/elements.module.mjs +69 -0
  53. package/esm2022/lib/elements/load-alert/load-alert.component.mjs +34 -0
  54. package/esm2022/lib/elements/post-reply/post-reply.component.mjs +69 -0
  55. package/esm2022/lib/elements/related-discussion/related-discussion.component.mjs +61 -0
  56. package/esm2022/lib/elements/sliders/sliders.component.mjs +76 -0
  57. package/esm2022/lib/events.service.mjs +31 -0
  58. package/esm2022/lib/models/discuss.model.mjs +16 -0
  59. package/esm2022/lib/models/discussion-config.model.mjs +2 -0
  60. package/esm2022/lib/navigation-service.service.mjs +39 -0
  61. package/esm2022/lib/pipes/pipe-filter/pipe-filter.pipe.mjs +20 -0
  62. package/esm2022/lib/pipes/pipe-list-filter/pipe-list-filter.pipe.mjs +22 -0
  63. package/esm2022/lib/pipes/pipe-relative-time/pipe-relative-time.pipe.mjs +41 -0
  64. package/esm2022/lib/pipes/pipes.module.mjs +24 -0
  65. package/esm2022/lib/pipes/sort-by/sort-by.pipe.mjs +34 -0
  66. package/esm2022/lib/pipes/split-initials/split-initials.pipe.mjs +23 -0
  67. package/esm2022/lib/router-service.service.mjs +21 -0
  68. package/esm2022/lib/services/abstract-config.service.mjs +3 -0
  69. package/esm2022/lib/services/config.service.mjs +76 -0
  70. package/esm2022/lib/services/discuss-utils.service.mjs +36 -0
  71. package/esm2022/lib/services/discussion.service.mjs +254 -0
  72. package/esm2022/lib/telemetry-utils.service.mjs +103 -0
  73. package/esm2022/lib/wrapper/base-wrapper/base-wrapper.component.mjs +41 -0
  74. package/esm2022/lib/wrapper/category-widget/category-widget.component.mjs +37 -0
  75. package/esm2022/lib/wrapper/tags-widget/tags-widget.component.mjs +33 -0
  76. package/esm2022/lib/wrapper-navigate.service.mjs +23 -0
  77. package/esm2022/public-api.mjs +29 -0
  78. package/fesm2022/jeraldj-discussions-ui.mjs +3929 -0
  79. package/fesm2022/jeraldj-discussions-ui.mjs.map +1 -0
  80. package/index.d.ts +6 -0
  81. package/jeraldj-discussions-ui.d.ts.map +1 -0
  82. package/lib/components/components.module.d.ts +24 -0
  83. package/lib/components/components.module.d.ts.map +1 -0
  84. package/lib/components/discuss-all/discuss-all.component.d.ts +61 -0
  85. package/lib/components/discuss-all/discuss-all.component.d.ts.map +1 -0
  86. package/lib/components/discuss-category/discuss-category.component.d.ts +45 -0
  87. package/lib/components/discuss-category/discuss-category.component.d.ts.map +1 -0
  88. package/lib/components/discuss-home/discuss-home.component.d.ts +59 -0
  89. package/lib/components/discuss-home/discuss-home.component.d.ts.map +1 -0
  90. package/lib/components/discuss-start/discuss-start.component.d.ts +50 -0
  91. package/lib/components/discuss-start/discuss-start.component.d.ts.map +1 -0
  92. package/lib/components/discuss-tags/discuss-tags.component.d.ts +41 -0
  93. package/lib/components/discuss-tags/discuss-tags.component.d.ts.map +1 -0
  94. package/lib/components/discussion-details/discussion-details.component.d.ts +112 -0
  95. package/lib/components/discussion-details/discussion-details.component.d.ts.map +1 -0
  96. package/lib/components/lib-entry/lib-entry.component.d.ts +42 -0
  97. package/lib/components/lib-entry/lib-entry.component.d.ts.map +1 -0
  98. package/lib/components/my-discussion/my-discussion.component.d.ts +54 -0
  99. package/lib/components/my-discussion/my-discussion.component.d.ts.map +1 -0
  100. package/lib/components/side-pannel/side-pannel.component.d.ts +34 -0
  101. package/lib/components/side-pannel/side-pannel.component.d.ts.map +1 -0
  102. package/lib/components/tag-all-discussion/tag-all-discussion.component.d.ts +53 -0
  103. package/lib/components/tag-all-discussion/tag-all-discussion.component.d.ts.map +1 -0
  104. package/lib/components/trending-tags/trending-tags.component.d.ts +26 -0
  105. package/lib/components/trending-tags/trending-tags.component.d.ts.map +1 -0
  106. package/lib/config/url.config.d.ts +29 -0
  107. package/lib/config/url.config.d.ts.map +1 -0
  108. package/lib/discussion-events.service.d.ts +12 -0
  109. package/lib/discussion-events.service.d.ts.map +1 -0
  110. package/lib/discussion-routing/discussion-routing.module.d.ts +9 -0
  111. package/lib/discussion-routing/discussion-routing.module.d.ts.map +1 -0
  112. package/lib/discussion-ui.module.d.ts +16 -0
  113. package/lib/discussion-ui.module.d.ts.map +1 -0
  114. package/lib/elements/app-loader/app-loader.component.d.ts +17 -0
  115. package/lib/elements/app-loader/app-loader.component.d.ts.map +1 -0
  116. package/lib/elements/avatar-photo/avatar-photo.component.d.ts +19 -0
  117. package/lib/elements/avatar-photo/avatar-photo.component.d.ts.map +1 -0
  118. package/lib/elements/category-card/category-card.component.d.ts +10 -0
  119. package/lib/elements/category-card/category-card.component.d.ts.map +1 -0
  120. package/lib/elements/discuss-card/discuss-card.component.d.ts +17 -0
  121. package/lib/elements/discuss-card/discuss-card.component.d.ts.map +1 -0
  122. package/lib/elements/elements.module.d.ts +18 -0
  123. package/lib/elements/elements.module.d.ts.map +1 -0
  124. package/lib/elements/load-alert/load-alert.component.d.ts +15 -0
  125. package/lib/elements/load-alert/load-alert.component.d.ts.map +1 -0
  126. package/lib/elements/post-reply/post-reply.component.d.ts +22 -0
  127. package/lib/elements/post-reply/post-reply.component.d.ts.map +1 -0
  128. package/lib/elements/related-discussion/related-discussion.component.d.ts +26 -0
  129. package/lib/elements/related-discussion/related-discussion.component.d.ts.map +1 -0
  130. package/lib/elements/sliders/sliders.component.d.ts +18 -0
  131. package/lib/elements/sliders/sliders.component.d.ts.map +1 -0
  132. package/lib/events.service.d.ts +18 -0
  133. package/lib/events.service.d.ts.map +1 -0
  134. package/lib/models/discuss.model.d.ts +298 -0
  135. package/lib/models/discuss.model.d.ts.map +1 -0
  136. package/lib/models/discussion-config.model.d.ts +42 -0
  137. package/lib/models/discussion-config.model.d.ts.map +1 -0
  138. package/lib/navigation-service.service.d.ts +22 -0
  139. package/lib/navigation-service.service.d.ts.map +1 -0
  140. package/lib/pipes/pipe-filter/pipe-filter.pipe.d.ts +8 -0
  141. package/lib/pipes/pipe-filter/pipe-filter.pipe.d.ts.map +1 -0
  142. package/lib/pipes/pipe-list-filter/pipe-list-filter.pipe.d.ts +8 -0
  143. package/lib/pipes/pipe-list-filter/pipe-list-filter.pipe.d.ts.map +1 -0
  144. package/lib/pipes/pipe-relative-time/pipe-relative-time.pipe.d.ts +8 -0
  145. package/lib/pipes/pipe-relative-time/pipe-relative-time.pipe.d.ts.map +1 -0
  146. package/lib/pipes/pipes.module.d.ts +13 -0
  147. package/lib/pipes/pipes.module.d.ts.map +1 -0
  148. package/lib/pipes/sort-by/sort-by.pipe.d.ts +8 -0
  149. package/lib/pipes/sort-by/sort-by.pipe.d.ts.map +1 -0
  150. package/lib/pipes/split-initials/split-initials.pipe.d.ts +8 -0
  151. package/lib/pipes/split-initials/split-initials.pipe.d.ts.map +1 -0
  152. package/lib/router-service.service.d.ts +10 -0
  153. package/lib/router-service.service.d.ts.map +1 -0
  154. package/lib/services/abstract-config.service.d.ts +4 -0
  155. package/lib/services/abstract-config.service.d.ts.map +1 -0
  156. package/lib/services/config.service.d.ts +36 -0
  157. package/lib/services/config.service.d.ts.map +1 -0
  158. package/lib/services/discuss-utils.service.d.ts +14 -0
  159. package/lib/services/discuss-utils.service.d.ts.map +1 -0
  160. package/lib/services/discussion.service.d.ts +76 -0
  161. package/lib/services/discussion.service.d.ts.map +1 -0
  162. package/lib/telemetry-utils.service.d.ts +20 -0
  163. package/lib/telemetry-utils.service.d.ts.map +1 -0
  164. package/lib/wrapper/base-wrapper/base-wrapper.component.d.ts +22 -0
  165. package/lib/wrapper/base-wrapper/base-wrapper.component.d.ts.map +1 -0
  166. package/lib/wrapper/category-widget/category-widget.component.d.ts +23 -0
  167. package/lib/wrapper/category-widget/category-widget.component.d.ts.map +1 -0
  168. package/lib/wrapper/tags-widget/tags-widget.component.d.ts +17 -0
  169. package/lib/wrapper/tags-widget/tags-widget.component.d.ts.map +1 -0
  170. package/lib/wrapper-navigate.service.d.ts +11 -0
  171. package/lib/wrapper-navigate.service.d.ts.map +1 -0
  172. package/package.json +44 -0
  173. package/public-api.d.ts +26 -0
  174. package/public-api.d.ts.map +1 -0
@@ -0,0 +1,3929 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Injectable, Component, Input, Inject, Pipe, Output, NgModule, HostBinding, ViewChild } from '@angular/core';
3
+ import * as _ from 'lodash';
4
+ import ___default from 'lodash';
5
+ import { Subject, timer, ReplaySubject, interval, combineLatest } from 'rxjs';
6
+ import * as i1 from '@angular/router';
7
+ import { RouterModule } from '@angular/router';
8
+ import * as i2$1 from '@angular/forms';
9
+ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
10
+ import * as i6 from '@angular/common';
11
+ import { CommonModule } from '@angular/common';
12
+ import { map } from 'rxjs/operators';
13
+ import * as i2 from '@jeraldj/client-services';
14
+ import { CsModule } from '@jeraldj/client-services';
15
+ import * as i1$1 from '@angular/common/http';
16
+ import { HttpClientModule } from '@angular/common/http';
17
+ import _$1, { orderBy } from 'lodash-es';
18
+ import { EventEmitter as EventEmitter$1 } from 'events';
19
+ import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
20
+ import * as i9 from 'ngx-infinite-scroll';
21
+ import { InfiniteScrollModule } from 'ngx-infinite-scroll';
22
+ import * as i7 from 'ngx-chips';
23
+ import { TagInputModule } from 'ngx-chips';
24
+
25
+ /* tslint:enable */
26
+ class DiscussionEventsService {
27
+ constructor() {
28
+ this.telemetryEvent = new Subject();
29
+ this.actionEvent = new EventEmitter();
30
+ }
31
+ emitTelemetry(event) {
32
+ console.log('Lib Event', event);
33
+ if (!_.isEmpty(event)) {
34
+ this.telemetryEvent.next(event);
35
+ }
36
+ }
37
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionEventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
38
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionEventsService, providedIn: 'root' }); }
39
+ }
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionEventsService, decorators: [{
41
+ type: Injectable,
42
+ args: [{
43
+ providedIn: 'root'
44
+ }]
45
+ }], ctorParameters: function () { return []; } });
46
+
47
+ class TelemetryUtilsService {
48
+ constructor(discussionEvents, router) {
49
+ this.discussionEvents = discussionEvents;
50
+ this.router = router;
51
+ this._context = [];
52
+ this.currentObj = {};
53
+ }
54
+ setContext(context) {
55
+ this._context = context;
56
+ this.currentObj = _.last(context);
57
+ }
58
+ uppendContext(data) {
59
+ const matchedC = _.find(this._context, { id: data.id });
60
+ if (!_.isEmpty(data) && !_.isEqual(data, matchedC)) {
61
+ this._context.push(data);
62
+ }
63
+ this.currentObj = _.last(this._context);
64
+ }
65
+ deleteContext(prevTopic) {
66
+ const topic = _.find(this._context, prevTopic);
67
+ if (topic) {
68
+ this._context = _.reject(this._context, topic);
69
+ }
70
+ }
71
+ getContext() {
72
+ return this._context;
73
+ }
74
+ logImpression(pageId) {
75
+ this.discussionEvents.emitTelemetry({});
76
+ const impressionEvent = {
77
+ eid: 'IMPRESSION',
78
+ edata: {
79
+ type: 'view',
80
+ pageid: pageId,
81
+ uri: this.router.url
82
+ }
83
+ };
84
+ if (this.currentObj) {
85
+ impressionEvent.context = { cdata: [{
86
+ id: _.get(this.currentObj, 'id').toString(),
87
+ type: _.get(this.currentObj, 'type')
88
+ }
89
+ ] };
90
+ }
91
+ this.discussionEvents.emitTelemetry(impressionEvent);
92
+ }
93
+ logInteract(event, pageId) {
94
+ const target = _.get(event, 'currentTarget.attributes.id') || _.get(event, 'target.attributes.id') ||
95
+ _.get(event, 'srcElement.attributes.id');
96
+ const interactEvent = {
97
+ eid: 'INTERACT',
98
+ edata: {
99
+ id: _.get(target, 'value') || _.get(event, 'action'),
100
+ type: 'CLICK',
101
+ pageid: pageId
102
+ }
103
+ };
104
+ if (this.currentObj) {
105
+ const object = {
106
+ id: _.get(this.currentObj, 'id').toString(),
107
+ type: _.get(this.currentObj, 'type'),
108
+ ver: '1'
109
+ };
110
+ object['rollup'] = this._context.length > 1 ? this.getRollUp() : {};
111
+ interactEvent.context = {
112
+ cdata: [{
113
+ id: _.get(this.currentObj, 'id').toString(),
114
+ type: _.get(this.currentObj, 'type')
115
+ }], object
116
+ };
117
+ }
118
+ this.discussionEvents.emitTelemetry(interactEvent);
119
+ }
120
+ getRollUp() {
121
+ const rollUp = {};
122
+ const data = _.reject(this._context, this.currentObj);
123
+ if (this._context.length > 1) {
124
+ data.forEach((element, index) => {
125
+ console.log('rollup', element);
126
+ rollUp['l' + (index + 1)] = element.toString();
127
+ });
128
+ }
129
+ if (_.get(this.currentObj, 'type') !== 'Post') {
130
+ return rollUp;
131
+ }
132
+ return {};
133
+ }
134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TelemetryUtilsService, deps: [{ token: DiscussionEventsService }, { token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
135
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TelemetryUtilsService, providedIn: 'root' }); }
136
+ }
137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TelemetryUtilsService, decorators: [{
138
+ type: Injectable,
139
+ args: [{
140
+ providedIn: 'root'
141
+ }]
142
+ }], ctorParameters: function () { return [{ type: DiscussionEventsService }, { type: i1.Router }]; } });
143
+
144
+ class CategoryCardComponent {
145
+ constructor() { }
146
+ ngOnInit() {
147
+ console.log(this.category);
148
+ }
149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategoryCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
150
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CategoryCardComponent, selector: "lib-category-card", inputs: { category: "category" }, ngImport: i0, template: "<div class=\"category-card\" tabindex=\"0\" role=\"link\">\n <div class=\"category-card-header\">\n <div class=\"category-card-header-image\">\n <img src=\"./assets/discussion-ui/images/Buffer-512.webp\" alt=\"category card icon\" class=\"category-card-img\">\n </div>\n <div class=\"category-card-header-label\" [innerHTML]=\"category.name\"></div>\n </div>\n <p class=\"category-card-header-text\">{{category.description}}</p>\n <div class=\"category-card-main\">\n <div class=\"category-card-main-content\">\n <div class=\"discussion-label\">{{category.totalTopicCount}} Discussions</div>\n <div class=\"post-label\">{{category.totalPostCount}} Posts</div>\n </div>\n <div><img src=\"./assets/discussion-ui/images/eye-icon.png\" class=\"eye-icon\" alt=\"eye icon\">\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-category-card-label: var(--df-text);--df-category-card-text: var(--df-text)}.category-card{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;border-radius:.25rem;height:11rem;width:auto;padding:1rem;cursor:pointer}.category-card .category-card-header{display:flex;flex-direction:row;align-items:center}.category-card .category-card-header .category-card-header-image{border:.0625rem solid var(--red-0);border-radius:50%;max-width:3.125rem;width:100%;height:3.125rem;position:relative}.category-card .category-card-header .category-card-header-image .category-card-img{position:absolute;top:.5rem;left:.5rem;width:2rem;height:2rem}.category-card .category-card-header .category-card-header-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;color:var(--df-category-card-label);word-break:break-word;margin:0 .5rem;font-weight:700}.category-card .category-card-header-text{color:var(--df-category-card-text);-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all;padding:.5rem 0;font-size:.875rem}.category-card .category-card-main{display:flex;justify-content:space-between;align-items:center;color:var(--df-category-card-text);margin:.5rem 0;font-size:.875rem;font-weight:700}.category-card .category-card-main .category-card-main-content{display:flex}.category-card .category-card-main .post-label{margin:0 1rem}.category-card .category-card-main .eye-icon{width:1.4rem;height:1.4rem}\n"] }); }
151
+ }
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategoryCardComponent, decorators: [{
153
+ type: Component,
154
+ args: [{ selector: 'lib-category-card', template: "<div class=\"category-card\" tabindex=\"0\" role=\"link\">\n <div class=\"category-card-header\">\n <div class=\"category-card-header-image\">\n <img src=\"./assets/discussion-ui/images/Buffer-512.webp\" alt=\"category card icon\" class=\"category-card-img\">\n </div>\n <div class=\"category-card-header-label\" [innerHTML]=\"category.name\"></div>\n </div>\n <p class=\"category-card-header-text\">{{category.description}}</p>\n <div class=\"category-card-main\">\n <div class=\"category-card-main-content\">\n <div class=\"discussion-label\">{{category.totalTopicCount}} Discussions</div>\n <div class=\"post-label\">{{category.totalPostCount}} Posts</div>\n </div>\n <div><img src=\"./assets/discussion-ui/images/eye-icon.png\" class=\"eye-icon\" alt=\"eye icon\">\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-category-card-label: var(--df-text);--df-category-card-text: var(--df-text)}.category-card{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;border-radius:.25rem;height:11rem;width:auto;padding:1rem;cursor:pointer}.category-card .category-card-header{display:flex;flex-direction:row;align-items:center}.category-card .category-card-header .category-card-header-image{border:.0625rem solid var(--red-0);border-radius:50%;max-width:3.125rem;width:100%;height:3.125rem;position:relative}.category-card .category-card-header .category-card-header-image .category-card-img{position:absolute;top:.5rem;left:.5rem;width:2rem;height:2rem}.category-card .category-card-header .category-card-header-label{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;color:var(--df-category-card-label);word-break:break-word;margin:0 .5rem;font-weight:700}.category-card .category-card-header-text{color:var(--df-category-card-text);-webkit-box-orient:vertical;display:-webkit-box;-webkit-line-clamp:3;overflow:hidden;text-overflow:ellipsis;word-break:break-all;padding:.5rem 0;font-size:.875rem}.category-card .category-card-main{display:flex;justify-content:space-between;align-items:center;color:var(--df-category-card-text);margin:.5rem 0;font-size:.875rem;font-weight:700}.category-card .category-card-main .category-card-main-content{display:flex}.category-card .category-card-main .post-label{margin:0 1rem}.category-card .category-card-main .eye-icon{width:1.4rem;height:1.4rem}\n"] }]
155
+ }], ctorParameters: function () { return []; }, propDecorators: { category: [{
156
+ type: Input
157
+ }] } });
158
+
159
+ class DiscussCardComponent {
160
+ constructor() { }
161
+ ngOnInit() {
162
+ console.log('discussionData', this.discussionData);
163
+ }
164
+ getBgColor(tagTitle) {
165
+ const bgColor = this.stringToColor(tagTitle.toLowerCase());
166
+ const color = this.getContrast();
167
+ return { color, 'background-color': bgColor };
168
+ }
169
+ stringToColor(title) {
170
+ let hash = 0;
171
+ for (let i = 0; i < title.length; i++) {
172
+ // tslint:disable-next-line: no-bitwise
173
+ hash = title.charCodeAt(i) + ((hash << 5) - hash);
174
+ }
175
+ const hue = Math.abs(hash % 360);
176
+ // tslint:disable-next-line: prefer-template
177
+ const colour = 'hsl(' + hue + ',100%,30%)';
178
+ return colour;
179
+ }
180
+ getContrast() {
181
+ return 'rgba(255, 255, 255, 80%)';
182
+ }
183
+ IsSingleComent(postCount) {
184
+ if (postCount && (postCount - 1) == 1) {
185
+ return true;
186
+ }
187
+ else {
188
+ return false;
189
+ }
190
+ }
191
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
192
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussCardComponent, selector: "lib-discuss-card", inputs: { discussionData: "discussionData" }, ngImport: i0, template: "<!-- Card container -->\n<div class=\"discuss-card-content\" tabindex=\"0\" role=\"link\">\n\n <!-- Card header -->\n <div tabindex=\"0\" role=\"link\">\n <!-- <a href=\"javascript:void(0)\" i18n-aria-label tabindex=\"0\" role=\"link\"> -->\n <h3 class='discuss-card-title' *ngIf=\"discussionData?.title\" [innerHTML]=\"discussionData?.title\"></h3>\n <h3 class='discuss-card-title' *ngIf=\"!discussionData?.title && discussionData?.topic?.title\" [innerHTML]=\"discussionData?.topic?.title\"></h3>\n <h3 class='discuss-card-title' *ngIf=\"!discussionData?.title && !discussionData?.topic?.title && discussionData?.name\" [innerHTML]=\"discussionData?.name\"></h3>\n <!-- </a> -->\n\n <!-- Card subtitle -->\n <div class=\"discuss-card-subtitle\">\n <div class=\"card-label-container\">\n <div *ngIf=\"discussionData?.category?.name\" class=\"discuss-card-label\">\n <img src=\"./assets/discussion-ui/images/Buffer-512.webp\" alt=\"category card icon\" width=\"20px\" class=\"mr-4\">\n {{discussionData.category.name}}\n </div>\n <div>\n <span class=\"dot\"></span>\n <span class=\"discuss-user-label\" *ngIf=\"discussionData?.user?.username\">{{discussionData?.user?.username}}</span>\n <span class=\"discuss-user-label\" *ngIf=\"!(discussionData?.user?.username)\">{{'Anonymous'}}</span>\n </div>\n </div>\n\n <div class=\"timing\">{{discussionData.lastposttime | date}}</div>\n <!-- <span class=\"margin-left-l\">{{discussionData.timestamp | pipeRelativeTime}}</span> -->\n </div>\n <!-- /Card subtitle -->\n </div>\n <!-- /Card header -->\n\n <!-- Card content -->\n <div class=\"tags\">\n <ng-container *ngIf=\"discussionData && discussionData.tags && discussionData.tags.length > 0\">\n <span *ngFor=\"let tag of discussionData.tags\" class=\"tag\" [ngStyle]=\"getBgColor(tag.value)\">\n {{tag.value}}\n </span>\n </ng-container>\n </div>\n <!-- /Card content -->\n\n <!-- Card footer -->\n <div class=\"discuss-card-comments\">\n <div class=\"comments-content\">\n <span class=\"votes-content\">\n <!-- <mat-icon class=\"cursor-pointer\">import_export</mat-icon> -->\n <img src=\"./assets/discussion-ui/images/votes.svg\" alt=\"votes icon\">\n <span>{{(discussionData.upvotes + discussionData.downvotes) || 0 }} Votes</span>\n </span>\n <span class=\"views-content\">\n <!-- <mat-icon>trending_up</mat-icon> -->\n <img src=\"./assets/discussion-ui/images/views.svg\" alt=\"views icon\">\n <span>{{discussionData.viewcount || 0}} Views</span>\n </span>\n </div>\n <div class=\"comments-count\">{{((discussionData.postcount || 1) -1) }}\n comments\n </div>\n </div>\n\n <!-- /Card footer -->\n</div>\n<!-- /Card header -->", styles: [".discuss-card-content{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:1rem;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;word-break:break-all;cursor:pointer;width:auto}.discuss-card-content .discuss-card-title{margin:0;color:var(--df-text);cursor:pointer;font-size:1rem;font-weight:700;word-break:break-word}.discuss-card-content .discuss-card-subtitle{margin:8px 0 0;font-size:.875rem;display:flex;align-items:center}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle{align-items:flex-start}}.discuss-card-content .discuss-card-subtitle .card-label-container{display:flex;align-items:center}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .card-label-container{margin-right:auto;flex-wrap:wrap}}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label{color:var(--primary);display:flex;align-items:center}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label img{margin-right:.25rem}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label{flex-basis:100%}}.discuss-card-content .discuss-card-subtitle .card-label-container .dot{height:.375rem;width:.375rem;background-color:var(--gray-400);border-radius:50%;display:inline-block;margin:0 .5rem;position:relative;bottom:.0625rem}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-user-label{word-break:break-word}.discuss-card-content .discuss-card-subtitle .timing{margin:0 .5rem}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .timing{flex:0 0 auto}}.discuss-card-content .discuss-card-comments{display:flex;justify-content:space-between;font-size:.875rem;flex-wrap:wrap;font-weight:700;align-items:center;padding-top:.5rem}.discuss-card-content .discuss-card-comments .comments-content{display:flex}.discuss-card-content .discuss-card-comments .comments-content .votes-content,.discuss-card-content .discuss-card-comments .comments-content .views-content{display:flex;align-items:center;font-size:.875rem}.discuss-card-content .discuss-card-comments .comments-content .votes-content span,.discuss-card-content .discuss-card-comments .comments-content .views-content span{margin:0 .5rem}.discuss-card-content .discuss-card-comments .comments-content .views-content{margin-left:1.5rem}.discuss-card-content .discuss-card-comments .comments-content .votes-content img,.discuss-card-content .discuss-card-comments .comments-content .views-content img{height:1rem;width:1rem;cursor:pointer}.discuss-card-content .discuss-card-comments .comments-count{color:var(--primary);font-weight:700}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: i6.DatePipe, name: "date" }] }); }
193
+ }
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussCardComponent, decorators: [{
195
+ type: Component,
196
+ args: [{ selector: 'lib-discuss-card', template: "<!-- Card container -->\n<div class=\"discuss-card-content\" tabindex=\"0\" role=\"link\">\n\n <!-- Card header -->\n <div tabindex=\"0\" role=\"link\">\n <!-- <a href=\"javascript:void(0)\" i18n-aria-label tabindex=\"0\" role=\"link\"> -->\n <h3 class='discuss-card-title' *ngIf=\"discussionData?.title\" [innerHTML]=\"discussionData?.title\"></h3>\n <h3 class='discuss-card-title' *ngIf=\"!discussionData?.title && discussionData?.topic?.title\" [innerHTML]=\"discussionData?.topic?.title\"></h3>\n <h3 class='discuss-card-title' *ngIf=\"!discussionData?.title && !discussionData?.topic?.title && discussionData?.name\" [innerHTML]=\"discussionData?.name\"></h3>\n <!-- </a> -->\n\n <!-- Card subtitle -->\n <div class=\"discuss-card-subtitle\">\n <div class=\"card-label-container\">\n <div *ngIf=\"discussionData?.category?.name\" class=\"discuss-card-label\">\n <img src=\"./assets/discussion-ui/images/Buffer-512.webp\" alt=\"category card icon\" width=\"20px\" class=\"mr-4\">\n {{discussionData.category.name}}\n </div>\n <div>\n <span class=\"dot\"></span>\n <span class=\"discuss-user-label\" *ngIf=\"discussionData?.user?.username\">{{discussionData?.user?.username}}</span>\n <span class=\"discuss-user-label\" *ngIf=\"!(discussionData?.user?.username)\">{{'Anonymous'}}</span>\n </div>\n </div>\n\n <div class=\"timing\">{{discussionData.lastposttime | date}}</div>\n <!-- <span class=\"margin-left-l\">{{discussionData.timestamp | pipeRelativeTime}}</span> -->\n </div>\n <!-- /Card subtitle -->\n </div>\n <!-- /Card header -->\n\n <!-- Card content -->\n <div class=\"tags\">\n <ng-container *ngIf=\"discussionData && discussionData.tags && discussionData.tags.length > 0\">\n <span *ngFor=\"let tag of discussionData.tags\" class=\"tag\" [ngStyle]=\"getBgColor(tag.value)\">\n {{tag.value}}\n </span>\n </ng-container>\n </div>\n <!-- /Card content -->\n\n <!-- Card footer -->\n <div class=\"discuss-card-comments\">\n <div class=\"comments-content\">\n <span class=\"votes-content\">\n <!-- <mat-icon class=\"cursor-pointer\">import_export</mat-icon> -->\n <img src=\"./assets/discussion-ui/images/votes.svg\" alt=\"votes icon\">\n <span>{{(discussionData.upvotes + discussionData.downvotes) || 0 }} Votes</span>\n </span>\n <span class=\"views-content\">\n <!-- <mat-icon>trending_up</mat-icon> -->\n <img src=\"./assets/discussion-ui/images/views.svg\" alt=\"views icon\">\n <span>{{discussionData.viewcount || 0}} Views</span>\n </span>\n </div>\n <div class=\"comments-count\">{{((discussionData.postcount || 1) -1) }}\n comments\n </div>\n </div>\n\n <!-- /Card footer -->\n</div>\n<!-- /Card header -->", styles: [".discuss-card-content{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:1rem;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;word-break:break-all;cursor:pointer;width:auto}.discuss-card-content .discuss-card-title{margin:0;color:var(--df-text);cursor:pointer;font-size:1rem;font-weight:700;word-break:break-word}.discuss-card-content .discuss-card-subtitle{margin:8px 0 0;font-size:.875rem;display:flex;align-items:center}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle{align-items:flex-start}}.discuss-card-content .discuss-card-subtitle .card-label-container{display:flex;align-items:center}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .card-label-container{margin-right:auto;flex-wrap:wrap}}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label{color:var(--primary);display:flex;align-items:center}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label img{margin-right:.25rem}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-card-label{flex-basis:100%}}.discuss-card-content .discuss-card-subtitle .card-label-container .dot{height:.375rem;width:.375rem;background-color:var(--gray-400);border-radius:50%;display:inline-block;margin:0 .5rem;position:relative;bottom:.0625rem}.discuss-card-content .discuss-card-subtitle .card-label-container .discuss-user-label{word-break:break-word}.discuss-card-content .discuss-card-subtitle .timing{margin:0 .5rem}@media screen and (max-width: 768px){.discuss-card-content .discuss-card-subtitle .timing{flex:0 0 auto}}.discuss-card-content .discuss-card-comments{display:flex;justify-content:space-between;font-size:.875rem;flex-wrap:wrap;font-weight:700;align-items:center;padding-top:.5rem}.discuss-card-content .discuss-card-comments .comments-content{display:flex}.discuss-card-content .discuss-card-comments .comments-content .votes-content,.discuss-card-content .discuss-card-comments .comments-content .views-content{display:flex;align-items:center;font-size:.875rem}.discuss-card-content .discuss-card-comments .comments-content .votes-content span,.discuss-card-content .discuss-card-comments .comments-content .views-content span{margin:0 .5rem}.discuss-card-content .discuss-card-comments .comments-content .views-content{margin-left:1.5rem}.discuss-card-content .discuss-card-comments .comments-content .votes-content img,.discuss-card-content .discuss-card-comments .comments-content .views-content img{height:1rem;width:1rem;cursor:pointer}.discuss-card-content .discuss-card-comments .comments-count{color:var(--primary);font-weight:700}\n"] }]
197
+ }], ctorParameters: function () { return []; }, propDecorators: { discussionData: [{
198
+ type: Input
199
+ }] } });
200
+
201
+ class AvatarPhotoComponent {
202
+ constructor() {
203
+ this.size = '';
204
+ this.randomColor = false;
205
+ this.showInitials = false;
206
+ this.random = Math.random().toString(36).slice(2);
207
+ // public initials!: string
208
+ this.colors = [
209
+ // '#EB7181', // red
210
+ '#306933', // green
211
+ // '#000000', // black
212
+ // '#3670B2', // blue
213
+ // '#4E9E87',
214
+ // '#7E4C8D',
215
+ ];
216
+ this.randomcolors = [
217
+ '#EB7181',
218
+ '#006400',
219
+ '#000000',
220
+ '#3670B2',
221
+ '#4E9E87',
222
+ '#7E4C8D',
223
+ ];
224
+ }
225
+ ngOnInit() {
226
+ if (!this.photoUrl) {
227
+ this.showInitials = true;
228
+ if (!this.initials) {
229
+ this.createInititals();
230
+ }
231
+ const randomIndex = Math.floor(Math.random() * Math.floor(this.colors.length));
232
+ this.circleColor = this.colors[randomIndex];
233
+ if (this.randomColor) {
234
+ const randomIndex1 = Math.floor(Math.random() * Math.floor(this.randomcolors.length));
235
+ this.circleColor = this.randomcolors[randomIndex1];
236
+ }
237
+ }
238
+ }
239
+ createInititals() {
240
+ let initials = '';
241
+ const array = `${this.name} `.toString().split(' ');
242
+ if (array[0] !== 'undefined' && typeof array[1] !== 'undefined') {
243
+ initials += array[0].charAt(0);
244
+ initials += array[1].charAt(0);
245
+ }
246
+ else {
247
+ for (let i = 0; i < this.name.length; i += 1) {
248
+ if (this.name.charAt(i) === ' ') {
249
+ continue;
250
+ }
251
+ if (this.name.charAt(i) === this.name.charAt(i)) {
252
+ initials += this.name.charAt(i);
253
+ if (initials.length === 2) {
254
+ break;
255
+ }
256
+ }
257
+ }
258
+ }
259
+ this.initials = initials.toUpperCase();
260
+ }
261
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AvatarPhotoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
262
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AvatarPhotoComponent, selector: "lib-avatar-photo", inputs: { photoUrl: "photoUrl", name: "name", size: "size", randomColor: "randomColor", initials: "initials" }, ngImport: i0, template: "<div [ngClass]=\"{'circle-s' : size=== 's',\n'circle-m' : size=== 'm',\n'circle-l' : size=== 'l',\n'circle-xl' : size=== 'xl',\n'circle-xxl' : size=== 'xxl',\n'circle-xl-s' : size=== 'xl-s',\n'circle-xxl-s': size=== 'xxl-s'}\" [ngStyle]=\"{'background-color': circleColor }\">\n <img *ngIf=\"!showInitials\" src=\"{{photoUrl}}\" [alt]=\"photoUrl? '' :(name || initials || size || random)\">\n\n <div *ngIf=\"showInitials\" class=\"initials\" i18n-aria-label>\n {{ initials }}\n </div>\n</div>", styles: [""], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
263
+ }
264
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AvatarPhotoComponent, decorators: [{
265
+ type: Component,
266
+ args: [{ selector: 'lib-avatar-photo', template: "<div [ngClass]=\"{'circle-s' : size=== 's',\n'circle-m' : size=== 'm',\n'circle-l' : size=== 'l',\n'circle-xl' : size=== 'xl',\n'circle-xxl' : size=== 'xxl',\n'circle-xl-s' : size=== 'xl-s',\n'circle-xxl-s': size=== 'xxl-s'}\" [ngStyle]=\"{'background-color': circleColor }\">\n <img *ngIf=\"!showInitials\" src=\"{{photoUrl}}\" [alt]=\"photoUrl? '' :(name || initials || size || random)\">\n\n <div *ngIf=\"showInitials\" class=\"initials\" i18n-aria-label>\n {{ initials }}\n </div>\n</div>" }]
267
+ }], propDecorators: { photoUrl: [{
268
+ type: Input
269
+ }], name: [{
270
+ type: Input
271
+ }], size: [{
272
+ type: Input
273
+ }], randomColor: [{
274
+ type: Input
275
+ }], initials: [{
276
+ type: Input
277
+ }] } });
278
+
279
+ const urlConfig = {
280
+ // endpoint configs...!
281
+ host: 'http://localhost:3002',
282
+ // host: 'https://dev.sunbirded.org',
283
+ apiSlug: '/discussion',
284
+ apiBasePath: () => `${urlConfig.host}${urlConfig.apiSlug}`,
285
+ // URLs...!
286
+ getAllCategories: () => `${urlConfig.apiBasePath()}/categories`,
287
+ getSingleCategoryDetails: (cid) => `${urlConfig.apiBasePath()}/category/${cid}`,
288
+ getAllTags: () => `${urlConfig.apiBasePath()}/tags`,
289
+ getTagBasedDiscussion: (tag) => `${urlConfig.apiBasePath()}/tags/${tag}`,
290
+ createPost: () => `${urlConfig.apiBasePath()}/v3/topics`,
291
+ votePost: (pid) => `${urlConfig.apiBasePath()}/v3/posts/${pid}/vote`,
292
+ replyPost: (tid) => `${urlConfig.apiBasePath()}/v3/topics/${tid}`,
293
+ bookmarkPost: (pid) => `${urlConfig.apiBasePath()}/v3/posts/${pid}/bookmark`,
294
+ recentPost: () => `${urlConfig.apiBasePath()}/recent`,
295
+ popularPost: () => `${urlConfig.apiBasePath()}/popular`,
296
+ unread: () => `${urlConfig.apiBasePath()}/topics/unread/total`,
297
+ getTopic: () => `${urlConfig.apiBasePath()}/topic`,
298
+ profile: () => `${urlConfig.apiBasePath()}/users/me`,
299
+ fetchProfile: (slug) => `${urlConfig.apiBasePath()}/users/${slug}/about`,
300
+ listUpVote: (slug) => `${urlConfig.apiBasePath()}/user/${slug}/upvoted`,
301
+ listDownVoted: (slug) => `${urlConfig.apiBasePath()}/user/${slug}/downvoted`,
302
+ listSaved: (slug) => `${urlConfig.apiBasePath()}/user/${slug}/bookmarks`,
303
+ fetchNetworkProfile: `user/profileDetails/getUserRegistry`,
304
+ userDetails: (username) => `${urlConfig.apiBasePath()}/user/${username}`,
305
+ getContextBasedTopics: (slug) => `${urlConfig.apiBasePath()}/category/${slug}`,
306
+ registerUser: () => `${urlConfig.apiBasePath()}/user/v1/create`,
307
+ getContextBasedDiscussion: () => `${urlConfig.apiBasePath()}/category/list`,
308
+ getContextBasedTagDiscussion: () => `${urlConfig.apiBasePath()}/tags/list`
309
+ };
310
+
311
+ /* tslint:enable */
312
+ const CONTEXT_PROPS = {
313
+ cid: 'cid',
314
+ tid: 'tid',
315
+ uid: 'uid'
316
+ };
317
+ class DiscussionService {
318
+ constructor(http, csModule) {
319
+ this.http = http;
320
+ this.csModule = csModule;
321
+ // tslint:disable-next-line:variable-name
322
+ this._context = {};
323
+ this.alertEvent = new Subject();
324
+ // TODO: Take from the logged in user data;
325
+ // this.usr = this.configSvc.userProfile
326
+ this.usr = { userId: '1234' };
327
+ console.log('CsModule init---', CsModule.instance);
328
+ this.csDiscussionService = CsModule.instance.discussionService;
329
+ }
330
+ initializeUserDetails(userId) {
331
+ userId = userId;
332
+ this.userDetails = JSON.parse(sessionStorage.getItem('dFUserDetails'));
333
+ this.fetchUserProfile(userId).subscribe(response => {
334
+ this.userDetails = response;
335
+ sessionStorage.setItem('dFUserDetails', JSON.stringify(response));
336
+ }, (error) => {
337
+ // TODO: toaster error
338
+ console.log('error fetching user details');
339
+ });
340
+ }
341
+ appendPage(page, url) {
342
+ if (page) {
343
+ return `${url}?page=${page}`;
344
+ }
345
+ return `${url}?page=1`;
346
+ }
347
+ fetchAllTags() {
348
+ // const tags = this.http.get(urlConfig.getAllTags())
349
+ // .toPromise();
350
+ // return tags;
351
+ console.log('innn fetchAllTags');
352
+ return this.csDiscussionService.fetchAllTags();
353
+ }
354
+ createPost(data) {
355
+ // return this.http.post(urlConfig.createPost(), data);
356
+ return this.csDiscussionService.createPost(data);
357
+ }
358
+ /**
359
+ * @description To get all the categories
360
+ */
361
+ fetchAllCategories() {
362
+ // return this.http.get<NSDiscussData.ICategorie[]>(urlConfig.getAllCategories()).pipe(
363
+ // map((data: any) => {
364
+ // // Taking only "categories" from the response
365
+ // const resp = (data as any).categories;
366
+ // return resp;
367
+ // }),
368
+ // catchError( error => {
369
+ // return throwError( 'Something went wrong!' );
370
+ // })
371
+ // );
372
+ console.log('in fetchall categories');
373
+ return this.csDiscussionService.fetchAllCategories().pipe(map((data) => data.categories));
374
+ }
375
+ fetchSingleCategoryDetails(cid) {
376
+ return this.csDiscussionService.fetchSingleCategoryDetails(cid);
377
+ // return this.http.get<NSDiscussData.ICategorie>(urlConfig.getSingleCategoryDetails(cid));
378
+ }
379
+ fetchSingleCategoryDetailsSort(cid, sort, page) {
380
+ return this.csDiscussionService.fetchSingleCategoryDetails(cid);
381
+ }
382
+ fetchAllTag() {
383
+ return this.csDiscussionService.fetchAllTags();
384
+ // return this.http.get(urlConfig.getAllTags());
385
+ }
386
+ contextBasedTags(data) {
387
+ return this.csDiscussionService.contextBasedTags(data);
388
+ // return this.http.get(urlConfig.getAllTags());
389
+ }
390
+ fetchPostDetails() {
391
+ return this.csDiscussionService.fetchAllTags();
392
+ // return this.http.get(urlConfig.getAllTags());
393
+ }
394
+ votePost(pid, data) {
395
+ return this.csDiscussionService.votePost(pid, data);
396
+ // const url = urlConfig.votePost(pid);
397
+ // return this.http.post(url, data);
398
+ }
399
+ deleteVotePost(pid) {
400
+ // const url = urlConfig.votePost(pid);
401
+ // return this.http.delete(url);
402
+ return this.csDiscussionService.deleteVotePost(pid);
403
+ }
404
+ bookmarkPost(pid) {
405
+ // const url = urlConfig.bookmarkPost(pid);
406
+ // return this.http.post(url, {});
407
+ return this.csDiscussionService.bookmarkPost(pid);
408
+ }
409
+ deleteBookmarkPost(pid) {
410
+ // const url = urlConfig.bookmarkPost(pid);
411
+ // return this.http.delete(url);
412
+ return this.csDiscussionService.deleteBookmarkPost(pid);
413
+ }
414
+ replyPost(tid, data) {
415
+ // const url = urlConfig.replyPost(tid);
416
+ // return this.http.post(url, data);
417
+ return this.csDiscussionService.replyPost(tid, data);
418
+ }
419
+ fetchRecentPost(pageId) {
420
+ return this.csDiscussionService.recentPost(_.get(this._userDetails, 'username'), pageId);
421
+ }
422
+ getTagBasedDiscussion(tag, page) {
423
+ return this.csDiscussionService.getTagBasedDiscussion(tag);
424
+ }
425
+ getContextBasedDiscussion(data) {
426
+ return this.csDiscussionService.getContextBasedDiscussion(data);
427
+ }
428
+ getContextBasedTagDiscussion(data) {
429
+ return this.csDiscussionService.getContextBasedTagDiscussion(data);
430
+ }
431
+ fetchPopularD(page) {
432
+ return this.csDiscussionService.popularPost(page);
433
+ }
434
+ fetchTopicById(topicId, slug, page) {
435
+ // let url = urlConfig.getTopic() + '/' + topicId.toString() + '/' + slug;
436
+ // url = this.appendPage(page, url);
437
+ // return this.http.get(url);
438
+ return this.csDiscussionService.fetchTopicById(topicId, slug, page);
439
+ }
440
+ fetchTopicByIdSort(topicId, sort, page) {
441
+ // let url = urlConfig.getTopic + topicId.toString();
442
+ // url = this.appendPage(page, url);
443
+ // return this.http.get(`${url}&sort=${sort}`);
444
+ return this.csDiscussionService.fetchTopicById(topicId, sort, page);
445
+ }
446
+ fetchUnreadCOunt() {
447
+ // return this.http.get<any>(urlConfig.unread());
448
+ return this.csDiscussionService.fetchUnreadCOunt();
449
+ }
450
+ // fetchProfile() {
451
+ // // return this.http.get(urlConfig.profile());
452
+ // return this.csDiscussionService.fetchProfile();
453
+ // }
454
+ fetchProfileInfo(slug) {
455
+ // return this.http.get(urlConfig.fetchProfile(slug));
456
+ return this.csDiscussionService.fetchProfileInfo(slug);
457
+ }
458
+ fetchUpvoted(pageId) {
459
+ // return this.http.get(urlConfig.listUpVote(_.get(this._userDetails, 'username')));
460
+ return this.csDiscussionService.fetchUpvoted(_.get(this._userDetails, 'username'), pageId);
461
+ }
462
+ fetchDownvoted(pageId) {
463
+ // return this.http.get(urlConfig.listDownVoted(_.get(this._userDetails, 'username')));
464
+ return this.csDiscussionService.fetchDownvoted(_.get(this._userDetails, 'username'), pageId);
465
+ }
466
+ fetchSaved(pageId) {
467
+ // return this.http.get(urlConfig.listSaved(_.get(this._userDetails, 'username')));
468
+ return this.csDiscussionService.fetchSaved(_.get(this._userDetails, 'username'), pageId);
469
+ }
470
+ fetchBestPost(pageId) {
471
+ return this.csDiscussionService.fetchBestPost(_.get(this._userDetails, 'username'), pageId);
472
+ }
473
+ fetchUserProfile(userId) {
474
+ // return this.http.get<any>(urlConfig.userDetails(userName));
475
+ return this.csDiscussionService.getUserDetails(userId);
476
+ }
477
+ getContextBasedTopic(slug, pageId) {
478
+ // return this.http.get(urlConfig.getContextBasedTopics(slug));
479
+ return this.csDiscussionService.getContextBasedTopic(slug, pageId);
480
+ }
481
+ registerUser(data) {
482
+ return this.http.post(urlConfig.registerUser(), data);
483
+ }
484
+ createForum(data) {
485
+ return this.csDiscussionService.createForum(data);
486
+ }
487
+ getForumIds(data) {
488
+ return this.csDiscussionService.getForumIds(data).toPromise();
489
+ }
490
+ set userDetails(userDetails) {
491
+ this._userDetails = userDetails;
492
+ }
493
+ get userDetails() {
494
+ return this._userDetails;
495
+ }
496
+ set userId(userId) {
497
+ this._userId = userId;
498
+ }
499
+ get userId() {
500
+ return this._userId;
501
+ }
502
+ set forumIds(ids) {
503
+ this._forumIds = ids;
504
+ }
505
+ get forumIds() {
506
+ return this._forumIds;
507
+ }
508
+ setContext(key, value) {
509
+ if (CONTEXT_PROPS[key]) {
510
+ this._context[key] = value;
511
+ }
512
+ else {
513
+ console.log('Context can not be set for this key: ', key);
514
+ }
515
+ }
516
+ getContext(key) {
517
+ return key ? this._context[key] : this._context;
518
+ }
519
+ editPost(pid, data) {
520
+ return this.csDiscussionService.editPost(pid, data);
521
+ }
522
+ deletePost(pid, uid) {
523
+ return this.csDiscussionService.deletePost(pid, uid);
524
+ }
525
+ editTopic(tid, data) {
526
+ return this.csDiscussionService.editTopic(tid, data);
527
+ }
528
+ deleteTopic(tid) {
529
+ return this.csDiscussionService.deleteTopic(tid);
530
+ }
531
+ /** To check the error code and show alert message
532
+ * if it is 502 - error
533
+ */
534
+ showTrafficAlert(errorObject) {
535
+ const errorCode = _.get(errorObject, 'response.responseCode');
536
+ if (errorCode) {
537
+ if ([502, '502'].includes(errorCode)) {
538
+ this.alertEvent.next();
539
+ }
540
+ }
541
+ }
542
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionService, deps: [{ token: i1$1.HttpClient }, { token: 'CsModule' }], target: i0.ɵɵFactoryTarget.Injectable }); }
543
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionService, providedIn: 'root' }); }
544
+ }
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionService, decorators: [{
546
+ type: Injectable,
547
+ args: [{
548
+ providedIn: 'root'
549
+ }]
550
+ }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: i2.CsModule, decorators: [{
551
+ type: Inject,
552
+ args: ['CsModule']
553
+ }] }]; } });
554
+
555
+ /* tslint:enable */
556
+ class AppLoaderComponent {
557
+ constructor(discussionService) {
558
+ this.discussionService = discussionService;
559
+ }
560
+ ngOnInit() {
561
+ this.headerMessage = 'Please wait';
562
+ this.loaderMessage = 'We are fetching details';
563
+ if (this.data) {
564
+ this.headerMessage = _.get(this.data, 'headerMessage') || this.headerMessage;
565
+ this.loaderMessage = _.get(this.data, 'loaderMessage') || this.loaderMessage;
566
+ }
567
+ this.countDown = timer(10000)
568
+ .subscribe(() => {
569
+ this.discussionService.alertEvent.next();
570
+ });
571
+ }
572
+ ngOnDestroy() {
573
+ this.countDown.unsubscribe();
574
+ }
575
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppLoaderComponent, deps: [{ token: DiscussionService }], target: i0.ɵɵFactoryTarget.Component }); }
576
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AppLoaderComponent, selector: "lib-app-loader", inputs: { data: "data" }, ngImport: i0, template: "<ng-container>\n <div class=\"dt-app-loader-container\">\n <img src=\"./assets/discussion-ui/images/loader-icon.svg\" width=\"50px\">\n <div class=\"loader-content\">\n <div class=\"loader-label\">\n {{headerMessage}}\n </div>\n <p>{{loaderMessage}}</p>\n </div>\n </div>\n</ng-container>", styles: [".dt-app-loader-container{background:var(--gray-100);width:94%!important;margin:1rem auto;border-radius:1.5rem;border:0px;display:flex;padding:1rem}\\200b .loader-content{margin:0 1rem;font-size:.875rem}\\200b .loader-label{font-weight:700;margin-bottom:.25rem}\n"] }); }
577
+ }
578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppLoaderComponent, decorators: [{
579
+ type: Component,
580
+ args: [{ selector: 'lib-app-loader', template: "<ng-container>\n <div class=\"dt-app-loader-container\">\n <img src=\"./assets/discussion-ui/images/loader-icon.svg\" width=\"50px\">\n <div class=\"loader-content\">\n <div class=\"loader-label\">\n {{headerMessage}}\n </div>\n <p>{{loaderMessage}}</p>\n </div>\n </div>\n</ng-container>", styles: [".dt-app-loader-container{background:var(--gray-100);width:94%!important;margin:1rem auto;border-radius:1.5rem;border:0px;display:flex;padding:1rem}\\200b .loader-content{margin:0 1rem;font-size:.875rem}\\200b .loader-label{font-weight:700;margin-bottom:.25rem}\n"] }]
581
+ }], ctorParameters: function () { return [{ type: DiscussionService }]; }, propDecorators: { data: [{
582
+ type: Input
583
+ }] } });
584
+
585
+ var categories = [
586
+ {
587
+ cid: 1,
588
+ name: "Announcements",
589
+ description: "Check here for announcements about NodeBB",
590
+ icon: "fa-bullhorn",
591
+ slug: "1/announcements",
592
+ topic_count: 73,
593
+ disabled: 0,
594
+ order: 1,
595
+ bgColor: "#e57373",
596
+ link: "",
597
+ "class": "col-lg-4 col-md-6 col-xs-12",
598
+ numRecentReplies: 1,
599
+ color: "#ffffff",
600
+ post_count: 884,
601
+ parentCid: 0,
602
+ descriptionParsed: "<p>Check here for announcements about NodeBB</p>\n",
603
+ minTags: 0,
604
+ maxTags: 5,
605
+ isSection: 0,
606
+ totalPostCount: 854,
607
+ totalTopicCount: 73,
608
+ tagWhitelist: [
609
+ ],
610
+ "unread-class": "unread",
611
+ children: [
612
+ ],
613
+ posts: [
614
+ {
615
+ pid: 79553,
616
+ timestamp: 1597704130970,
617
+ content: "<p dir=\"auto\">A bug in our validation logic made it possible to change the password of any user on a running NodeBB forum by sending a specially crafted <a href=\"http://socket.io\" rel=\"nofollow\">socket.io</a> call to the server.</p>\n<p dir=\"auto\">We have resolved this in the latest version of NodeBB, and the fix has already been rolled out as a patch on all of our hosted customers.</p>\n<p dir=\"auto\">For more information on the vulnerability as well as instructions on how to resolve this issue, please have a look here: <a href=\"https://github.com/NodeBB/NodeBB/security/advisories/GHSA-hr66-c8pg-5mg7\" rel=\"nofollow\">https://github.com/NodeBB/NodeBB/security/advisories/GHSA-hr66-c8pg-5mg7</a></p>\n<p dir=\"auto\"><strong>Click <a href=\"https://blog.nodebb.org/nodebb-1-14-3/\" rel=\"nofollow\">here</a> to see the full blog post</strong></p>\n",
618
+ timestampISO: "2020-08-17T22:42:10.970Z",
619
+ user: {
620
+ uid: 3,
621
+ username: "psychobunny",
622
+ userslug: "psychobunny",
623
+ picture: "https://i.imgur.com/ltvPqkU.gif",
624
+ displayname: "psychobunny",
625
+ "icon:text": "P",
626
+ "icon:bgColor": "#f44336"
627
+ },
628
+ index: 1,
629
+ cid: 1,
630
+ parentCid: 0,
631
+ topic: {
632
+ slug: "14967/nodebb-v1-14-3-a-critical-security-update",
633
+ title: "NodeBB v1.14.3: A Critical Security Update"
634
+ }
635
+ }
636
+ ],
637
+ teaser: {
638
+ url: "/post/79553",
639
+ timestampISO: "2020-08-17T22:42:10.970Z",
640
+ pid: 79553,
641
+ topic: {
642
+ slug: "14967/nodebb-v1-14-3-a-critical-security-update",
643
+ title: "NodeBB v1.14.3: A Critical Security Update"
644
+ }
645
+ }
646
+ },
647
+ {
648
+ cid: 2,
649
+ name: "General Discussion",
650
+ description: "A place to talk about whatever you want",
651
+ icon: "fa-comment",
652
+ slug: "2/general-discussion",
653
+ topic_count: 3188,
654
+ order: 2,
655
+ bgColor: "#ba68c8",
656
+ link: "",
657
+ "class": "col-lg-4 col-md-6 col-xs-12",
658
+ numRecentReplies: 1,
659
+ color: "#ffffff",
660
+ post_count: 20024,
661
+ descriptionParsed: "<p dir=\"auto\">A place to talk about whatever you want</p>\n",
662
+ minTags: 0,
663
+ maxTags: 5,
664
+ parentCid: 0,
665
+ disabled: 0,
666
+ isSection: 0,
667
+ totalPostCount: 20024,
668
+ totalTopicCount: 3188,
669
+ tagWhitelist: [
670
+ ],
671
+ "unread-class": "",
672
+ children: [
673
+ ],
674
+ posts: [
675
+ {
676
+ pid: 80371,
677
+ timestamp: 1605714102926,
678
+ content: "<p dir=\"auto\"><a class=\"plugin-mentions-user plugin-mentions-a\" href=\"https://community.nodebb.org/uid/16106\">@gotwf</a> pardon the late response, I've adopted your suggestion, thanks! </p>\n<p dir=\"auto\"><a class=\"plugin-mentions-user plugin-mentions-a\" href=\"https://community.nodebb.org/uid/2\">@julian</a> good to know! And apparently my spammers were all \"human-powered\"; ever since I made the changes suggested by <a class=\"plugin-mentions-user plugin-mentions-a\" href=\"https://community.nodebb.org/uid/1\">@baris</a> the blacklist hits and spam accounts have dropped to zero!</p>\n<p dir=\"auto\">Hopefully it stays that way so I can focus on content </p>\n<p dir=\"auto\">Cheers</p>\n",
679
+ timestampISO: "2020-11-18T15:41:42.926Z",
680
+ user: {
681
+ uid: 19985,
682
+ username: "Nefarius",
683
+ userslug: "nefarius",
684
+ picture: "https://i.imgur.com/v798aRw.png",
685
+ displayname: "Nefarius",
686
+ "icon:text": "N",
687
+ "icon:bgColor": "#673ab7"
688
+ },
689
+ index: 6,
690
+ cid: 2,
691
+ parentCid: 0,
692
+ topic: {
693
+ slug: "15119/spam-registration-amount-and-handling-is-unbearable",
694
+ title: "Spam registration amount and handling is unbearable"
695
+ }
696
+ }
697
+ ],
698
+ teaser: {
699
+ url: "/post/80371",
700
+ timestampISO: "2020-11-18T15:41:42.926Z",
701
+ pid: 80371,
702
+ topic: {
703
+ slug: "15119/spam-registration-amount-and-handling-is-unbearable",
704
+ title: "Spam registration amount and handling is unbearable"
705
+ }
706
+ }
707
+ },
708
+ {
709
+ link: "",
710
+ "class": "col-lg-4 col-md-6 col-xs-12",
711
+ icon: "fa-github",
712
+ description: "Stay tuned here to hear more about new releases and features of NodeBB!",
713
+ order: 3,
714
+ topic_count: 1158,
715
+ name: "NodeBB Development",
716
+ cid: 3,
717
+ post_count: 6760,
718
+ numRecentReplies: 1,
719
+ bgColor: "#4fc3f7",
720
+ slug: "3/nodebb-development",
721
+ color: "#ffffff",
722
+ disabled: 0,
723
+ descriptionParsed: "<p>Stay tuned here to hear more about new releases and features of NodeBB!</p>\n",
724
+ isSection: 0,
725
+ minTags: 0,
726
+ maxTags: 5,
727
+ parentCid: 0,
728
+ totalPostCount: 17980,
729
+ totalTopicCount: 2992,
730
+ tagWhitelist: [
731
+ ],
732
+ "unread-class": "unread",
733
+ children: [
734
+ {
735
+ cid: 5,
736
+ name: "Feature Requests",
737
+ description: "You have a cool idea about NodeBB? Post it here.",
738
+ icon: "fa-lightbulb-o",
739
+ slug: "5/feature-requests",
740
+ topic_count: 692,
741
+ order: 1,
742
+ bgColor: "#ffb74d",
743
+ link: "",
744
+ "class": "col-lg-4 col-md-6 col-xs-12",
745
+ numRecentReplies: 1,
746
+ color: "#ffffff",
747
+ post_count: 4176,
748
+ parentCid: 3,
749
+ disabled: 0,
750
+ minTags: 0,
751
+ maxTags: 5,
752
+ isSection: 0,
753
+ totalPostCount: 4176,
754
+ totalTopicCount: 692,
755
+ descriptionParsed: "You have a cool idea about NodeBB? Post it here.",
756
+ tagWhitelist: [
757
+ ],
758
+ "unread-class": "unread",
759
+ children: [
760
+ ],
761
+ parent: {
762
+ link: "",
763
+ "class": "col-lg-4 col-md-6 col-xs-12",
764
+ icon: "fa-github",
765
+ description: "Stay tuned here to hear more about new releases and features of NodeBB!",
766
+ order: 3,
767
+ topic_count: 1158,
768
+ name: "NodeBB Development",
769
+ cid: 3,
770
+ post_count: 6760,
771
+ numRecentReplies: 1,
772
+ bgColor: "#4fc3f7",
773
+ slug: "3/nodebb-development",
774
+ color: "#ffffff",
775
+ disabled: 0,
776
+ descriptionParsed: "<p>Stay tuned here to hear more about new releases and features of NodeBB!</p>\n",
777
+ isSection: 0,
778
+ minTags: 0,
779
+ maxTags: 5,
780
+ parentCid: 0,
781
+ totalPostCount: 6760,
782
+ totalTopicCount: 1158,
783
+ tagWhitelist: [
784
+ ],
785
+ "unread-class": "unread"
786
+ },
787
+ posts: [
788
+ {
789
+ pid: 80380,
790
+ timestamp: 1605820679025,
791
+ content: "<p dir=\"auto\"><a class=\"plugin-mentions-user plugin-mentions-a\" href=\"https://community.nodebb.org/uid/2\">@julian</a> if this makes sense to you, do you think this can be a part of \"canned responses\" plugin?</p>\n",
792
+ timestampISO: "2020-11-19T21:17:59.025Z",
793
+ user: {
794
+ uid: 16848,
795
+ username: "crazycells",
796
+ userslug: "crazycells",
797
+ picture: "https://i.imgur.com/fnkHctr.png",
798
+ displayname: "crazycells",
799
+ "icon:text": "C",
800
+ "icon:bgColor": "#009688"
801
+ },
802
+ index: 2,
803
+ cid: 5,
804
+ parentCid: 3,
805
+ topic: {
806
+ slug: "15137/canned-explanations-reasons-for-user-ban",
807
+ title: "canned explanations(reasons) for user ban"
808
+ }
809
+ }
810
+ ]
811
+ }
812
+ ]
813
+ }
814
+ ];
815
+ var topics = [
816
+ {
817
+ cid: 13,
818
+ lastposttime: 1606632795076,
819
+ mainPid: 17647,
820
+ postcount: 1,
821
+ slug: "8917/hello-this-is-my-new-post",
822
+ tid: 8917,
823
+ timestamp: 1606632795069,
824
+ title: "Hello this is my new post",
825
+ uid: 104,
826
+ viewcount: 1,
827
+ deleted: 0,
828
+ locked: 0,
829
+ pinned: 0,
830
+ upvotes: 0,
831
+ downvotes: 0,
832
+ deleterUid: 0,
833
+ titleRaw: "Hello this is my new post",
834
+ timestampISO: "2020-11-29T06:53:15.069Z",
835
+ lastposttimeISO: "2020-11-29T06:53:15.076Z",
836
+ votes: 0,
837
+ teaserPid: null,
838
+ category: {
839
+ cid: 13,
840
+ name: "Administration",
841
+ slug: "13/administration",
842
+ icon: "fa-comments",
843
+ backgroundImage: null,
844
+ imageClass: "cover",
845
+ bgColor: "#DC9656",
846
+ color: "#fff",
847
+ disabled: 0
848
+ },
849
+ user: {
850
+ uid: 104,
851
+ username: "5cad153a-29f0-4cc6-8344-ad5fc06ffb1d",
852
+ fullname: "arunkumar pilli",
853
+ userslug: "5cad153a-29f0-4cc6-8344-ad5fc06ffb1d",
854
+ reputation: 0,
855
+ postcount: 1,
856
+ picture: null,
857
+ signature: null,
858
+ banned: 0,
859
+ status: "online",
860
+ "icon:text": "5",
861
+ "icon:bgColor": "#1b5e20",
862
+ banned_until_readable: "Not Banned"
863
+ },
864
+ teaser: {
865
+ pid: 17647,
866
+ uid: 104,
867
+ timestamp: 1606632795076,
868
+ tid: 8917,
869
+ content: "adding new post in igot discussions\n",
870
+ timestampISO: "2020-11-29T06:53:15.076Z",
871
+ user: {
872
+ uid: 104,
873
+ username: "5cad153a-29f0-4cc6-8344-ad5fc06ffb1d",
874
+ userslug: "5cad153a-29f0-4cc6-8344-ad5fc06ffb1d",
875
+ picture: null,
876
+ "icon:text": "5",
877
+ "icon:bgColor": "#1b5e20"
878
+ },
879
+ index: 1
880
+ },
881
+ tags: [
882
+ ],
883
+ isOwner: false,
884
+ ignored: false,
885
+ unread: true,
886
+ bookmark: 3,
887
+ unreplied: false,
888
+ icons: [
889
+ ],
890
+ index: 0
891
+ },
892
+ {
893
+ cid: 9,
894
+ lastposttime: 1606297869195,
895
+ mainPid: 17635,
896
+ postcount: 5,
897
+ slug: "8912/why-is-bangalore-s-infrastructure-bad",
898
+ tid: 8912,
899
+ timestamp: 1606134890874,
900
+ title: "Why is Bangalore&#x27;s infrastructure bad?",
901
+ uid: 113,
902
+ viewcount: 36,
903
+ downvotes: 0,
904
+ upvotes: 2,
905
+ teaserPid: 17646,
906
+ deleted: 0,
907
+ locked: 0,
908
+ pinned: 0,
909
+ deleterUid: 0,
910
+ titleRaw: "Why is Bangalore's infrastructure bad?",
911
+ timestampISO: "2020-11-23T12:34:50.874Z",
912
+ lastposttimeISO: "2020-11-25T09:51:09.195Z",
913
+ votes: 2,
914
+ category: {
915
+ cid: 9,
916
+ name: "Infrastructure",
917
+ slug: "9/infrastructure",
918
+ icon: "fa-comments",
919
+ backgroundImage: null,
920
+ imageClass: "cover",
921
+ bgColor: "#86C1B9",
922
+ color: "#333",
923
+ disabled: 0
924
+ },
925
+ user: {
926
+ uid: 113,
927
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
928
+ fullname: "Manimegalai Mohan",
929
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
930
+ reputation: 3,
931
+ postcount: 16,
932
+ picture: null,
933
+ signature: null,
934
+ banned: 0,
935
+ status: "offline",
936
+ "icon:text": "1",
937
+ "icon:bgColor": "#3f51b5",
938
+ banned_until_readable: "Not Banned"
939
+ },
940
+ teaser: {
941
+ pid: 17635,
942
+ uid: 113,
943
+ timestamp: 1606134890882,
944
+ tid: 8912,
945
+ content: "Why is Bangalore's infrastructure bad?\n",
946
+ timestampISO: "2020-11-23T12:34:50.882Z",
947
+ user: {
948
+ uid: 113,
949
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
950
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
951
+ picture: null,
952
+ "icon:text": "1",
953
+ "icon:bgColor": "#3f51b5"
954
+ },
955
+ index: 1
956
+ },
957
+ tags: [
958
+ ],
959
+ isOwner: false,
960
+ ignored: false,
961
+ unread: true,
962
+ bookmark: 7,
963
+ unreplied: false,
964
+ icons: [
965
+ ],
966
+ index: 1
967
+ },
968
+ {
969
+ cid: 13,
970
+ lastposttime: 1606201083049,
971
+ mainPid: 17645,
972
+ postcount: 1,
973
+ slug: "8916/origin-of-solar-system",
974
+ tid: 8916,
975
+ timestamp: 1606201083043,
976
+ title: "Origin of Solar system",
977
+ uid: 113,
978
+ viewcount: 10,
979
+ deleted: 0,
980
+ locked: 0,
981
+ pinned: 0,
982
+ upvotes: 0,
983
+ downvotes: 0,
984
+ deleterUid: 0,
985
+ titleRaw: "Origin of Solar system",
986
+ timestampISO: "2020-11-24T06:58:03.043Z",
987
+ lastposttimeISO: "2020-11-24T06:58:03.049Z",
988
+ votes: 0,
989
+ teaserPid: null,
990
+ category: {
991
+ cid: 13,
992
+ name: "Administration",
993
+ slug: "13/administration",
994
+ icon: "fa-comments",
995
+ backgroundImage: null,
996
+ imageClass: "cover",
997
+ bgColor: "#DC9656",
998
+ color: "#fff",
999
+ disabled: 0
1000
+ },
1001
+ user: {
1002
+ uid: 113,
1003
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1004
+ fullname: "Manimegalai Mohan",
1005
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1006
+ reputation: 3,
1007
+ postcount: 16,
1008
+ picture: null,
1009
+ signature: null,
1010
+ banned: 0,
1011
+ status: "offline",
1012
+ "icon:text": "1",
1013
+ "icon:bgColor": "#3f51b5",
1014
+ banned_until_readable: "Not Banned"
1015
+ },
1016
+ teaser: {
1017
+ pid: 17645,
1018
+ uid: 113,
1019
+ timestamp: 1606201083049,
1020
+ tid: 8916,
1021
+ content: "Solar system\n",
1022
+ timestampISO: "2020-11-24T06:58:03.049Z",
1023
+ user: {
1024
+ uid: 113,
1025
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1026
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1027
+ picture: null,
1028
+ "icon:text": "1",
1029
+ "icon:bgColor": "#3f51b5"
1030
+ },
1031
+ index: 1
1032
+ },
1033
+ tags: [
1034
+ ],
1035
+ isOwner: false,
1036
+ ignored: false,
1037
+ unread: true,
1038
+ bookmark: 3,
1039
+ unreplied: false,
1040
+ icons: [
1041
+ ],
1042
+ index: 2
1043
+ },
1044
+ {
1045
+ cid: 11,
1046
+ lastposttime: 1606198830431,
1047
+ mainPid: 17644,
1048
+ postcount: 1,
1049
+ slug: "8915/who-opened-up-the-indian-economy",
1050
+ tid: 8915,
1051
+ timestamp: 1606198830424,
1052
+ title: "Who opened up the indian economy?",
1053
+ uid: 113,
1054
+ viewcount: 5,
1055
+ deleted: 0,
1056
+ locked: 0,
1057
+ pinned: 0,
1058
+ upvotes: 0,
1059
+ downvotes: 0,
1060
+ deleterUid: 0,
1061
+ titleRaw: "Who opened up the indian economy?",
1062
+ timestampISO: "2020-11-24T06:20:30.424Z",
1063
+ lastposttimeISO: "2020-11-24T06:20:30.431Z",
1064
+ votes: 0,
1065
+ teaserPid: null,
1066
+ category: {
1067
+ cid: 11,
1068
+ name: "Economy",
1069
+ slug: "11/economy",
1070
+ icon: "fa-comments",
1071
+ backgroundImage: null,
1072
+ imageClass: "cover",
1073
+ bgColor: "#F7CA88",
1074
+ color: "#333",
1075
+ disabled: 0
1076
+ },
1077
+ user: {
1078
+ uid: 113,
1079
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1080
+ fullname: "Manimegalai Mohan",
1081
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1082
+ reputation: 3,
1083
+ postcount: 16,
1084
+ picture: null,
1085
+ signature: null,
1086
+ banned: 0,
1087
+ status: "offline",
1088
+ "icon:text": "1",
1089
+ "icon:bgColor": "#3f51b5",
1090
+ banned_until_readable: "Not Banned"
1091
+ },
1092
+ teaser: {
1093
+ pid: 17644,
1094
+ uid: 113,
1095
+ timestamp: 1606198830431,
1096
+ tid: 8915,
1097
+ content: "Who opened up the indian economy?\n",
1098
+ timestampISO: "2020-11-24T06:20:30.431Z",
1099
+ user: {
1100
+ uid: 113,
1101
+ username: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1102
+ userslug: "1c2d792e-392b-4d98-b18e-af5ea69340b2",
1103
+ picture: null,
1104
+ "icon:text": "1",
1105
+ "icon:bgColor": "#3f51b5"
1106
+ },
1107
+ index: 1
1108
+ },
1109
+ tags: [
1110
+ ],
1111
+ isOwner: false,
1112
+ ignored: false,
1113
+ unread: true,
1114
+ bookmark: 3,
1115
+ unreplied: false,
1116
+ icons: [
1117
+ ],
1118
+ index: 3
1119
+ },
1120
+ {
1121
+ cid: 11,
1122
+ lastposttime: 1606135442960,
1123
+ mainPid: 17637,
1124
+ postcount: 4,
1125
+ slug: "8914/how-covid-will-impact-indian-economy",
1126
+ tid: 8914,
1127
+ timestamp: 1606135371841,
1128
+ title: "How covid will impact indian economy ?",
1129
+ uid: 5,
1130
+ viewcount: 10,
1131
+ teaserPid: 17640,
1132
+ deleted: 0,
1133
+ locked: 0,
1134
+ pinned: 0,
1135
+ upvotes: 0,
1136
+ downvotes: 0,
1137
+ deleterUid: 0,
1138
+ titleRaw: "How covid will impact indian economy ?",
1139
+ timestampISO: "2020-11-23T12:42:51.841Z",
1140
+ lastposttimeISO: "2020-11-23T12:44:02.960Z",
1141
+ votes: 0,
1142
+ category: {
1143
+ cid: 11,
1144
+ name: "Economy",
1145
+ slug: "11/economy",
1146
+ icon: "fa-comments",
1147
+ backgroundImage: null,
1148
+ imageClass: "cover",
1149
+ bgColor: "#F7CA88",
1150
+ color: "#333",
1151
+ disabled: 0
1152
+ },
1153
+ user: {
1154
+ uid: 5,
1155
+ username: "9cdd9f76-2584-4ae5-940d-3f51dce020dc",
1156
+ fullname: "Christopher F'des",
1157
+ userslug: "9cdd9f76-2584-4ae5-940d-3f51dce020dc",
1158
+ reputation: 8,
1159
+ postcount: 13,
1160
+ picture: null,
1161
+ signature: null,
1162
+ banned: 0,
1163
+ status: "offline",
1164
+ "icon:text": "9",
1165
+ "icon:bgColor": "#ff5722",
1166
+ banned_until_readable: "Not Banned"
1167
+ },
1168
+ teaser: {
1169
+ pid: 17637,
1170
+ uid: 5,
1171
+ timestamp: 1606135371849,
1172
+ tid: 8914,
1173
+ content: "How covid will impact indian economy ?\n",
1174
+ timestampISO: "2020-11-23T12:42:51.849Z",
1175
+ user: {
1176
+ uid: 5,
1177
+ username: "9cdd9f76-2584-4ae5-940d-3f51dce020dc",
1178
+ userslug: "9cdd9f76-2584-4ae5-940d-3f51dce020dc",
1179
+ picture: null,
1180
+ "icon:text": "9",
1181
+ "icon:bgColor": "#ff5722"
1182
+ },
1183
+ index: 1
1184
+ },
1185
+ tags: [
1186
+ ],
1187
+ isOwner: false,
1188
+ ignored: false,
1189
+ unread: true,
1190
+ bookmark: 6,
1191
+ unreplied: false,
1192
+ icons: [
1193
+ ],
1194
+ index: 4
1195
+ }
1196
+ ];
1197
+ var ROUTES = {
1198
+ TOPIC: "/discussion-forum/topic/",
1199
+ DISCUSSION: "/discussion-forum/",
1200
+ CATEGORY: "/discussion-forum/category/",
1201
+ TAG: "/discussion-forum/tags/"
1202
+ };
1203
+ var MENUOPTIONS = [
1204
+ {
1205
+ route: "all-discussions",
1206
+ label: "All discussions",
1207
+ enable: false
1208
+ },
1209
+ {
1210
+ route: "categories",
1211
+ label: "Categories",
1212
+ enable: true
1213
+ },
1214
+ {
1215
+ route: "tags",
1216
+ label: "Tags",
1217
+ enable: true
1218
+ },
1219
+ {
1220
+ route: "my-discussion",
1221
+ label: "My discussion",
1222
+ enable: true
1223
+ }
1224
+ ];
1225
+ var CATEGORY = "category";
1226
+ var CATEGORY_DETAILS = "categoryDetails";
1227
+ var CATEGORY_HOME = "categoryHome";
1228
+ var TAG_ALL_DISCUSS = "tagAllDiscuss";
1229
+ var TAGS = "TAGS";
1230
+ var TAGSALL = "TAGSALL";
1231
+ var constants = {
1232
+ categories: categories,
1233
+ topics: topics,
1234
+ ROUTES: ROUTES,
1235
+ MENUOPTIONS: MENUOPTIONS,
1236
+ CATEGORY: CATEGORY,
1237
+ CATEGORY_DETAILS: CATEGORY_DETAILS,
1238
+ CATEGORY_HOME: CATEGORY_HOME,
1239
+ TAG_ALL_DISCUSS: TAG_ALL_DISCUSS,
1240
+ TAGS: TAGS,
1241
+ TAGSALL: TAGSALL
1242
+ };
1243
+
1244
+ class ConfigService {
1245
+ constructor(activatedRoute, discussionService) {
1246
+ this.activatedRoute = activatedRoute;
1247
+ this.discussionService = discussionService;
1248
+ this.setCategoryId = new ReplaySubject(1);
1249
+ }
1250
+ ngOnInit() {
1251
+ }
1252
+ setConfig(activatedRoute) {
1253
+ activatedRoute.data.subscribe((config) => {
1254
+ this._config = config.data;
1255
+ });
1256
+ }
1257
+ setConfigFromParams(activatedRoute) {
1258
+ activatedRoute.queryParams.subscribe((params) => {
1259
+ const obj = {
1260
+ userId: _.get(params, 'userId'),
1261
+ categories: JSON.parse(_.get(params, 'categories'))
1262
+ };
1263
+ this._config = obj;
1264
+ });
1265
+ }
1266
+ setConfigFromWidgetBaseClass(config) {
1267
+ this._config = config;
1268
+ }
1269
+ getConfig() {
1270
+ return this._config;
1271
+ }
1272
+ getCategories() {
1273
+ this.getParams = this.getConfig();
1274
+ return _.get(this.getParams, 'categories');
1275
+ }
1276
+ hasContext() {
1277
+ this.hasContextData = this.getCategories() ?
1278
+ (this.getCategories().result ? this.getCategories().result.length : null)
1279
+ : null;
1280
+ return this.hasContextData;
1281
+ }
1282
+ getContext() {
1283
+ this.getContextData = this.getCategories() ?
1284
+ (this.getCategories().result ? this.getCategories().result : null)
1285
+ : null;
1286
+ return this.getContextData;
1287
+ }
1288
+ setCategoryid(id) {
1289
+ this.categoryId = id;
1290
+ this.setCategoryId.next(id);
1291
+ }
1292
+ getHeaderOption() {
1293
+ return this._config.headerOptions !== undefined ? this._config.headerOptions : true;
1294
+ }
1295
+ getBannerOption() {
1296
+ return this._config.bannerOption ? this._config.bannerOption : false;
1297
+ }
1298
+ getCategoryid() {
1299
+ return this.categoryId;
1300
+ }
1301
+ getRouterSlug() {
1302
+ return this._config.routerSlug ? this._config.routerSlug : '';
1303
+ }
1304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigService, deps: [{ token: i1.ActivatedRoute }, { token: DiscussionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1305
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigService, providedIn: 'root' }); }
1306
+ }
1307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfigService, decorators: [{
1308
+ type: Injectable,
1309
+ args: [{
1310
+ providedIn: 'root'
1311
+ }]
1312
+ }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: DiscussionService }]; } });
1313
+
1314
+ // import {BehaviorSubject} from 'rxjs/BehaviorSubject';
1315
+ class EventsService {
1316
+ constructor() {
1317
+ this._navItemSource = new BehaviorSubject(0);
1318
+ // Observable navItem stream
1319
+ this.navItem$ = this._navItemSource.asObservable();
1320
+ this.registeredEvents = [];
1321
+ this.toggleMenuItem = new ReplaySubject(1);
1322
+ }
1323
+ /**
1324
+ * This function is used to update the states in widget with data
1325
+ * @param {} data
1326
+ * TODO: Not being used anymore have to cleanup
1327
+ */
1328
+ toggle(data) {
1329
+ this.toggleMenuItem.next(data);
1330
+ }
1331
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EventsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1332
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EventsService, providedIn: 'root' }); }
1333
+ }
1334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EventsService, decorators: [{
1335
+ type: Injectable,
1336
+ args: [{
1337
+ providedIn: 'root'
1338
+ }]
1339
+ }], ctorParameters: function () { return []; } });
1340
+
1341
+ //TODO: Need to cleanup this service since we are not gonna use
1342
+ class WrapperNavigateService {
1343
+ constructor(_eventService) {
1344
+ this._eventService = _eventService;
1345
+ this.closeSideNav = new EventEmitter$1();
1346
+ }
1347
+ navigate(input) {
1348
+ // this._eventService.toggle(input)
1349
+ }
1350
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WrapperNavigateService, deps: [{ token: EventsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1351
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WrapperNavigateService, providedIn: 'root' }); }
1352
+ }
1353
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WrapperNavigateService, decorators: [{
1354
+ type: Injectable,
1355
+ args: [{
1356
+ providedIn: 'root'
1357
+ }]
1358
+ }], ctorParameters: function () { return [{ type: EventsService }]; } });
1359
+
1360
+ class RouterServiceService {
1361
+ constructor(router) {
1362
+ this.router = router;
1363
+ }
1364
+ navigate(input) {
1365
+ // this.router.navigate(url)
1366
+ this.router.navigate([input.data.url], { queryParams: input.data.queryParams, queryParamsHandling: "merge" });
1367
+ }
1368
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterServiceService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
1369
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterServiceService, providedIn: 'root' }); }
1370
+ }
1371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterServiceService, decorators: [{
1372
+ type: Injectable,
1373
+ args: [{
1374
+ providedIn: 'root'
1375
+ }]
1376
+ }], ctorParameters: function () { return [{ type: i1.Router }]; } });
1377
+
1378
+ class NavigationServiceService {
1379
+ constructor(wrapperService, routerService) {
1380
+ this.wrapperService = wrapperService;
1381
+ this.routerService = routerService;
1382
+ this.navigateService = "routerService";
1383
+ }
1384
+ /**
1385
+ * used to intialize the navigation service with the wrapperservice or routerservice
1386
+ * @param {string} wrapperService
1387
+ */
1388
+ initService(wrapperService) {
1389
+ this.navigateService = wrapperService;
1390
+ }
1391
+ /**
1392
+ * used for navigating to the other pages based on the service initalized
1393
+ * @param {} input
1394
+ */
1395
+ navigate(input) {
1396
+ if (this.navigateService === 'routerService') {
1397
+ this.routerService.navigate(input);
1398
+ }
1399
+ else {
1400
+ this.wrapperService.navigate(input);
1401
+ }
1402
+ }
1403
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationServiceService, deps: [{ token: WrapperNavigateService }, { token: RouterServiceService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1404
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationServiceService, providedIn: 'root' }); }
1405
+ }
1406
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavigationServiceService, decorators: [{
1407
+ type: Injectable,
1408
+ args: [{
1409
+ providedIn: 'root'
1410
+ }]
1411
+ }], ctorParameters: function () { return [{ type: WrapperNavigateService }, { type: RouterServiceService }]; } });
1412
+
1413
+ class PipeRelativeTimePipe {
1414
+ transform(value) {
1415
+ if (value) {
1416
+ const seconds = Math.floor((+new Date() - +new Date(value)) / 1000);
1417
+ if (seconds < 29) // less than 30 seconds ago will show as 'Just now'
1418
+ return 'Just now';
1419
+ const intervals = {
1420
+ 'year': 31536000,
1421
+ 'month': 2592000,
1422
+ 'week': 604800,
1423
+ 'day': 86400,
1424
+ 'hour': 3600,
1425
+ 'minute': 60,
1426
+ 'second': 1
1427
+ };
1428
+ let counter;
1429
+ for (const i in intervals) {
1430
+ counter = Math.floor(seconds / intervals[i]);
1431
+ if (counter > 0)
1432
+ if (counter === 1) {
1433
+ return counter + ' ' + i + ' ago'; // singular (1 day ago)
1434
+ }
1435
+ else {
1436
+ return counter + ' ' + i + 's ago'; // plural (2 days ago)
1437
+ }
1438
+ }
1439
+ }
1440
+ return value;
1441
+ }
1442
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeRelativeTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1443
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: PipeRelativeTimePipe, name: "pipeRelativeTime" }); }
1444
+ }
1445
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeRelativeTimePipe, decorators: [{
1446
+ type: Pipe,
1447
+ args: [{
1448
+ name: 'pipeRelativeTime',
1449
+ }]
1450
+ }] });
1451
+
1452
+ class RelatedDiscussionComponent {
1453
+ constructor(router, configService, discussionService, navigationService) {
1454
+ this.router = router;
1455
+ this.configService = configService;
1456
+ this.discussionService = discussionService;
1457
+ this.navigationService = navigationService;
1458
+ this.stateChange = new EventEmitter();
1459
+ this.fetchSingleCategoryLoader = false;
1460
+ }
1461
+ ngOnInit() {
1462
+ }
1463
+ ngOnChanges() {
1464
+ if (this.catId) {
1465
+ this.fetchRelatedDiscussionData(this.catId);
1466
+ }
1467
+ }
1468
+ fetchRelatedDiscussionData(cid) {
1469
+ this.fetchSingleCategoryLoader = true;
1470
+ this.discussionService.fetchSingleCategoryDetails(cid).subscribe((data) => {
1471
+ this.relatedDiscussions = [];
1472
+ _$1.filter(data.topics, (topic) => {
1473
+ if (topic.deleted === 0 && this.topicId !== topic.tid) {
1474
+ this.relatedDiscussions.push(topic);
1475
+ }
1476
+ });
1477
+ this.fetchSingleCategoryLoader = false;
1478
+ }, (err) => {
1479
+ console.log('Error in fetching category details');
1480
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError)
1481
+ this.fetchSingleCategoryLoader = false;
1482
+ });
1483
+ }
1484
+ getDiscussion(discuss) {
1485
+ const input = { data: { url: `${this.configService.getRouterSlug()}${ROUTES.DISCUSSION}topic/${discuss.slug}`, queryParams: {} } };
1486
+ this.navigationService.navigate(input);
1487
+ this.stateChange.emit(discuss);
1488
+ }
1489
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RelatedDiscussionComponent, deps: [{ token: i1.Router }, { token: ConfigService }, { token: DiscussionService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
1490
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RelatedDiscussionComponent, selector: "lib-related-discussion", inputs: { catId: "catId", topicId: "topicId" }, outputs: { stateChange: "stateChange" }, usesOnChanges: true, ngImport: i0, template: "<h5 aria-label=\"Related discussions\" class=\"related-discuss-label\">Related discussions</h5>\n<ng-container *ngIf=\"relatedDiscussions && relatedDiscussions.length > 0\">\n <div *ngFor=\"let discussion of relatedDiscussions | slice:0:5;\" class=\"related-discuss-card df-card\" tabindex=\"0\">\n <label role=\"link\" tabindex=\"0\" aria-label=\"related discussion post df-text-color\"\n class=\"related-discuss-card-content discuss-user-label\" (click)=\"getDiscussion(discussion)\"\n [innerHTML]=\"discussion?.title\">\n </label>\n <div class=\"related-discuss-card-description mt-8\">\n <div class=\"category-name\" [innerHTML]=\"discussion.category.name\"></div>\n <div class=\"dot\"></div>\n <div class=\"time\">{{ discussion.timestamp | pipeRelativeTime }}</div>\n </div>\n </div>\n</ng-container>", styles: ["::ng-deep:root{--df-related-card-bg:var(--df-background)}.related-discuss-card{padding:1rem;display:flex;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-related-card-bg);color:var(--df-text);margin-bottom:1rem;flex-direction:column;max-width:18.75rem}@media (max-width: 768px){.related-discuss-card{max-width:100%}}.related-discuss-label{font-weight:700;margin:0 0 1rem;color:var(--df-text)}@media (max-width: 768px){.related-discuss-label{margin:1rem 0}}.related-discuss-card-content{margin:0;cursor:pointer;font-size:.875rem;font-weight:700;word-break:break-all}.related-discuss-card-description{display:flex;align-items:center;font-size:.875rem;flex-wrap:wrap;margin-top:.5rem}.related-discuss-card-description .dot{height:.375rem;width:.375rem;background-color:var(--gray-400);border-radius:50%;display:inline-block;margin:0 .5rem;position:relative;bottom:0}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i6.SlicePipe, name: "slice" }, { kind: "pipe", type: PipeRelativeTimePipe, name: "pipeRelativeTime" }] }); }
1491
+ }
1492
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RelatedDiscussionComponent, decorators: [{
1493
+ type: Component,
1494
+ args: [{ selector: 'lib-related-discussion', template: "<h5 aria-label=\"Related discussions\" class=\"related-discuss-label\">Related discussions</h5>\n<ng-container *ngIf=\"relatedDiscussions && relatedDiscussions.length > 0\">\n <div *ngFor=\"let discussion of relatedDiscussions | slice:0:5;\" class=\"related-discuss-card df-card\" tabindex=\"0\">\n <label role=\"link\" tabindex=\"0\" aria-label=\"related discussion post df-text-color\"\n class=\"related-discuss-card-content discuss-user-label\" (click)=\"getDiscussion(discussion)\"\n [innerHTML]=\"discussion?.title\">\n </label>\n <div class=\"related-discuss-card-description mt-8\">\n <div class=\"category-name\" [innerHTML]=\"discussion.category.name\"></div>\n <div class=\"dot\"></div>\n <div class=\"time\">{{ discussion.timestamp | pipeRelativeTime }}</div>\n </div>\n </div>\n</ng-container>", styles: ["::ng-deep:root{--df-related-card-bg:var(--df-background)}.related-discuss-card{padding:1rem;display:flex;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-related-card-bg);color:var(--df-text);margin-bottom:1rem;flex-direction:column;max-width:18.75rem}@media (max-width: 768px){.related-discuss-card{max-width:100%}}.related-discuss-label{font-weight:700;margin:0 0 1rem;color:var(--df-text)}@media (max-width: 768px){.related-discuss-label{margin:1rem 0}}.related-discuss-card-content{margin:0;cursor:pointer;font-size:.875rem;font-weight:700;word-break:break-all}.related-discuss-card-description{display:flex;align-items:center;font-size:.875rem;flex-wrap:wrap;margin-top:.5rem}.related-discuss-card-description .dot{height:.375rem;width:.375rem;background-color:var(--gray-400);border-radius:50%;display:inline-block;margin:0 .5rem;position:relative;bottom:0}\n"] }]
1495
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: ConfigService }, { type: DiscussionService }, { type: NavigationServiceService }]; }, propDecorators: { catId: [{
1496
+ type: Input
1497
+ }], topicId: [{
1498
+ type: Input
1499
+ }], stateChange: [{
1500
+ type: Output
1501
+ }] } });
1502
+
1503
+ class PipeFilterPipe {
1504
+ transform(value, keys, term) {
1505
+ if (!term) {
1506
+ return value;
1507
+ }
1508
+ return (value || []).filter((item) => keys.split(',')
1509
+ .some(key => item.hasOwnProperty(key) && new RegExp(`^${term}$`, 'gi').test(item[key])));
1510
+ }
1511
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1512
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: PipeFilterPipe, name: "pipeFilter" }); }
1513
+ }
1514
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeFilterPipe, decorators: [{
1515
+ type: Pipe,
1516
+ args: [{
1517
+ name: 'pipeFilter'
1518
+ }]
1519
+ }] });
1520
+
1521
+ /* tslint:enable */
1522
+ class SortByPipe {
1523
+ transform(data, sortField, sortOrder) {
1524
+ if (!data || !data.length || sortOrder === '' || !sortOrder) {
1525
+ return data;
1526
+ }
1527
+ if (!sortField || sortField === '') {
1528
+ data = data.map(e => e.trim());
1529
+ if (sortOrder === 'asc') {
1530
+ return data.sort();
1531
+ }
1532
+ else {
1533
+ return data.sort().reverse();
1534
+ }
1535
+ }
1536
+ data.forEach((obj) => {
1537
+ obj[sortField] = obj[sortField].trim();
1538
+ });
1539
+ return orderBy(data, [sortField], [sortOrder]);
1540
+ }
1541
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortByPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1542
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SortByPipe, name: "sortBy" }); }
1543
+ }
1544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SortByPipe, decorators: [{
1545
+ type: Pipe,
1546
+ args: [{
1547
+ name: 'sortBy'
1548
+ }]
1549
+ }] });
1550
+
1551
+ class SplitInitialsPipe {
1552
+ transform(value) {
1553
+ if (value) {
1554
+ let userInitial = '';
1555
+ const name = value.split(' ');
1556
+ name.forEach(element => {
1557
+ userInitial = userInitial + element.charAt(0);
1558
+ });
1559
+ return userInitial;
1560
+ }
1561
+ }
1562
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SplitInitialsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1563
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SplitInitialsPipe, name: "splitInitials" }); }
1564
+ }
1565
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SplitInitialsPipe, decorators: [{
1566
+ type: Pipe,
1567
+ args: [{
1568
+ name: 'splitInitials'
1569
+ }]
1570
+ }] });
1571
+
1572
+ class PipeListFilterPipe {
1573
+ transform(value, keys, term) {
1574
+ if (!term) {
1575
+ return value;
1576
+ }
1577
+ return (value || []).filter((item) => keys.split(',')
1578
+ .some(key => item.hasOwnProperty(key)
1579
+ && item[key] && (`${item[key]} `).toLocaleLowerCase().includes(term.toLocaleLowerCase())));
1580
+ // new RegExp(`^${term}$`, 'gi').test(item[key])
1581
+ }
1582
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeListFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1583
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: PipeListFilterPipe, name: "pipeListFilter" }); }
1584
+ }
1585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipeListFilterPipe, decorators: [{
1586
+ type: Pipe,
1587
+ args: [{
1588
+ name: 'pipeListFilter',
1589
+ }]
1590
+ }] });
1591
+
1592
+ class PipesModule {
1593
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1594
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: PipesModule, declarations: [PipeFilterPipe, SortByPipe, PipeRelativeTimePipe, SplitInitialsPipe, PipeListFilterPipe], imports: [CommonModule], exports: [PipeFilterPipe, SortByPipe, PipeRelativeTimePipe, SplitInitialsPipe, PipeListFilterPipe] }); }
1595
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipesModule, imports: [CommonModule] }); }
1596
+ }
1597
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PipesModule, decorators: [{
1598
+ type: NgModule,
1599
+ args: [{
1600
+ declarations: [PipeFilterPipe, SortByPipe, PipeRelativeTimePipe, SplitInitialsPipe, PipeListFilterPipe],
1601
+ imports: [
1602
+ CommonModule
1603
+ ],
1604
+ exports: [PipeFilterPipe, SortByPipe, PipeRelativeTimePipe, SplitInitialsPipe, PipeListFilterPipe]
1605
+ }]
1606
+ }] });
1607
+
1608
+ class PostReplyComponent {
1609
+ constructor(formBuilder) {
1610
+ this.formBuilder = formBuilder;
1611
+ this.showCancel = true;
1612
+ this.mode = 'add';
1613
+ this.actionEvent = new EventEmitter();
1614
+ this.isButtonEnabled = false;
1615
+ }
1616
+ ngOnInit() {
1617
+ console.log('conent came', this.content);
1618
+ this.initializeFormFields();
1619
+ }
1620
+ initializeFormFields() {
1621
+ this.replyForm = this.formBuilder.group({
1622
+ replyContent: ['', Validators.required]
1623
+ });
1624
+ this.replyForm.valueChanges.subscribe(val => {
1625
+ this.isButtonEnabled = this.validateForm();
1626
+ });
1627
+ }
1628
+ validateForm() {
1629
+ if (this.replyForm.status === 'VALID') {
1630
+ return true;
1631
+ }
1632
+ else {
1633
+ return false;
1634
+ }
1635
+ }
1636
+ isFieldValid(field) {
1637
+ let valueNoWhiteSpace = this.replyForm.get(field).value;
1638
+ if (valueNoWhiteSpace) {
1639
+ const length = valueNoWhiteSpace.length;
1640
+ if (length >= 2 && valueNoWhiteSpace.charAt(length - 2) === " ") {
1641
+ this.replyForm.patchValue({ replyContent: this.replyForm.get(field).value.trim() });
1642
+ }
1643
+ else {
1644
+ this.replyForm.patchValue({ replyContent: this.replyForm.get(field).value.trimStart() });
1645
+ }
1646
+ }
1647
+ return !this.replyForm.get(field).valid && this.replyForm.get(field).dirty;
1648
+ }
1649
+ onReplyClick(mode) {
1650
+ // tslint:disable-next-line:no-string-literal
1651
+ this.actionEvent.emit({ action: mode, content: this.replyForm.controls['replyContent'].value.trim() });
1652
+ }
1653
+ onCancelClick() {
1654
+ this.actionEvent.emit({ action: 'cancel' });
1655
+ }
1656
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PostReplyComponent, deps: [{ token: i2$1.UntypedFormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
1657
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PostReplyComponent, selector: "lib-post-reply", inputs: { showCancel: "showCancel", mode: "mode", content: "content" }, outputs: { actionEvent: "actionEvent" }, ngImport: i0, template: "<form [formGroup]=\"replyForm\">\n <div appearance=\"outline\" class=\"text-form-field\">\n <label class=\"text-form-label\">Your answer here</label>\n <textarea placeholder=\"Type here (minimum 10 characters)\" \n minlength=\"10\" aria-label=\"Type your message here\"\n formControlName=\"replyContent\" \n class=\"text-content\"\n [ngModel]=\"content\"\n [ngClass]=\"{'is-invalid' : isFieldValid('replyContent')}\">\n </textarea>\n </div>\n</form>\n<div class=\"updatePostActions\">\n <button class=\"df-btn df-btn-normal df-cancel-btn\"\n *ngIf=\"showCancel\"\n (click)=\"onCancelClick()\" \n id=\"cancel-update-post\" \n type=\"button\">\n <span class=\"text-white\">Cancel</span>\n </button>\n <button [ngClass]=\"{'df-btn-disabled': !isButtonEnabled }\" \n *ngIf=\"mode === 'edit'\"\n [disabled]=\"!isButtonEnabled\" \n class=\"df-btn df-btn-normal df-btn-primary\" \n (click)=\"onReplyClick('edit')\" \n id=\"update-post\"\n type=\"button\">\n <span class=\"text-white\">Update</span>\n </button>\n <button [ngClass]=\"{'df-btn-disabled': !replyForm.valid }\" \n *ngIf=\"mode !== 'edit'\"\n [disabled]=\"!isButtonEnabled\" \n class=\"df-btn df-btn-normal df-btn-primary\" \n (click)=\"onReplyClick('reply')\" \n id=\"update-post\"\n type=\"button\">\n <span class=\"text-white\">Post Reply</span>\n </button>\n</div>", styles: [".text-form-field{display:flex;flex-direction:column}.text-form-label{font-size:.875rem;margin-bottom:1rem}.text-content{min-height:6.75rem;max-height:33.75rem;margin-bottom:.875rem;background-color:var(--df-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;cursor:pointer;outline:0;padding:.5rem .875rem}.updatePostActions{display:flex;justify-content:flex-end;margin-bottom:1rem}.df-update-btn,.df-post-reply-btn{margin:.5rem 0}.cancel-update-post{margin-right:20px}.df-btn-disabled{background-color:var(--gray-100);border:solid var(--gray-100)}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
1658
+ }
1659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PostReplyComponent, decorators: [{
1660
+ type: Component,
1661
+ args: [{ selector: 'lib-post-reply', template: "<form [formGroup]=\"replyForm\">\n <div appearance=\"outline\" class=\"text-form-field\">\n <label class=\"text-form-label\">Your answer here</label>\n <textarea placeholder=\"Type here (minimum 10 characters)\" \n minlength=\"10\" aria-label=\"Type your message here\"\n formControlName=\"replyContent\" \n class=\"text-content\"\n [ngModel]=\"content\"\n [ngClass]=\"{'is-invalid' : isFieldValid('replyContent')}\">\n </textarea>\n </div>\n</form>\n<div class=\"updatePostActions\">\n <button class=\"df-btn df-btn-normal df-cancel-btn\"\n *ngIf=\"showCancel\"\n (click)=\"onCancelClick()\" \n id=\"cancel-update-post\" \n type=\"button\">\n <span class=\"text-white\">Cancel</span>\n </button>\n <button [ngClass]=\"{'df-btn-disabled': !isButtonEnabled }\" \n *ngIf=\"mode === 'edit'\"\n [disabled]=\"!isButtonEnabled\" \n class=\"df-btn df-btn-normal df-btn-primary\" \n (click)=\"onReplyClick('edit')\" \n id=\"update-post\"\n type=\"button\">\n <span class=\"text-white\">Update</span>\n </button>\n <button [ngClass]=\"{'df-btn-disabled': !replyForm.valid }\" \n *ngIf=\"mode !== 'edit'\"\n [disabled]=\"!isButtonEnabled\" \n class=\"df-btn df-btn-normal df-btn-primary\" \n (click)=\"onReplyClick('reply')\" \n id=\"update-post\"\n type=\"button\">\n <span class=\"text-white\">Post Reply</span>\n </button>\n</div>", styles: [".text-form-field{display:flex;flex-direction:column}.text-form-label{font-size:.875rem;margin-bottom:1rem}.text-content{min-height:6.75rem;max-height:33.75rem;margin-bottom:.875rem;background-color:var(--df-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;cursor:pointer;outline:0;padding:.5rem .875rem}.updatePostActions{display:flex;justify-content:flex-end;margin-bottom:1rem}.df-update-btn,.df-post-reply-btn{margin:.5rem 0}.cancel-update-post{margin-right:20px}.df-btn-disabled{background-color:var(--gray-100);border:solid var(--gray-100)}\n"] }]
1662
+ }], ctorParameters: function () { return [{ type: i2$1.UntypedFormBuilder }]; }, propDecorators: { showCancel: [{
1663
+ type: Input
1664
+ }], mode: [{
1665
+ type: Input
1666
+ }], content: [{
1667
+ type: Input
1668
+ }], actionEvent: [{
1669
+ type: Output
1670
+ }] } });
1671
+
1672
+ // import { EventService } from '@sunbird-cb/utils'
1673
+ class SlidersComponent {
1674
+ constructor() {
1675
+ this.id = `banner_${Math.random()}`;
1676
+ this.currentIndex = 0;
1677
+ this.slideInterval = null;
1678
+ // super()
1679
+ }
1680
+ ngOnInit() {
1681
+ this.reInitiateSlideInterval();
1682
+ }
1683
+ reInitiateSlideInterval() {
1684
+ console.log('---------------', this.bannerData);
1685
+ if (this.bannerData.widgetData.length > 1) {
1686
+ try {
1687
+ if (this.slideInterval) {
1688
+ this.slideInterval.unsubscribe();
1689
+ }
1690
+ }
1691
+ catch (e) {
1692
+ }
1693
+ finally {
1694
+ this.slideInterval = interval(8000).subscribe(() => {
1695
+ if (this.currentIndex === this.bannerData.widgetData.length - 1) {
1696
+ this.currentIndex = 0;
1697
+ }
1698
+ else {
1699
+ this.currentIndex += 1;
1700
+ }
1701
+ });
1702
+ }
1703
+ }
1704
+ }
1705
+ slideTo(index) {
1706
+ if (index >= 0 && index < this.bannerData.widgetData.length) {
1707
+ this.currentIndex = index;
1708
+ }
1709
+ else if (index === this.bannerData.widgetDatalength) {
1710
+ this.currentIndex = 0;
1711
+ }
1712
+ else {
1713
+ this.currentIndex = this.bannerData.widgetData.length + index;
1714
+ }
1715
+ this.reInitiateSlideInterval();
1716
+ }
1717
+ get isOpenInNewTab() {
1718
+ const currentData = this.bannerData[this.currentIndex];
1719
+ if (currentData.redirectUrl && currentData.redirectUrl.includes('mailto') || this.bannerData[this.currentIndex].openInNewTab) {
1720
+ return true;
1721
+ }
1722
+ return false;
1723
+ }
1724
+ openInNewTab() {
1725
+ const currentData = this.bannerData[this.currentIndex];
1726
+ if (currentData.redirectUrl && currentData.redirectUrl.includes('mailto') || this.bannerData[this.currentIndex].openInNewTab) {
1727
+ window.open(currentData.redirectUrl);
1728
+ }
1729
+ }
1730
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SlidersComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1731
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SlidersComponent, selector: "ws-widget-sliders", inputs: { bannerData: "bannerData" }, host: { properties: { "id": "this.id" } }, ngImport: i0, template: "<div class=\"banner-container\" (swipeleft)=\"slideTo(currentIndex + 1)\" (swiperight)=\"slideTo(currentIndex - 1)\"\n *ngIf=\"bannerData.widgetData?.length > 1\">\n\n <div class=\"banner WidgetInstanceId\" *ngFor=\"let slide of bannerData.widgetData; let i = index\" [hidden]=\"i !== currentIndex\">\n <p>{{slide.banners | json}}</p>\n <img i18n-alt alt=\"Page Banner\" [src]=\"slide.banners\" wsUtilsImageResponsive class=\"banner-image\" />\n </div>\n <div class=\"banner-meta\">\n <!-- <a [routerLink]=\" !isOpenInNewTab ? widgetData[currentIndex].redirectUrl : './'\"\n class=\"banner-title text-truncate\" *ngIf=\"widgetData[currentIndex].title\"\n [title]=\"widgetData[currentIndex].title\">\n {{ widgetData[currentIndex].title }}\n </a> -->\n <div class=\"dots-container\" *ngIf=\"bannerData.widgetData?.length > 1\">\n <span class=\"dot\" [ngClass]=\"{ active: j === currentIndex }\" *ngFor=\"let slide of bannerData.widgetData; let j = index\"\n (click)=\"slideTo(j)\"></span>\n </div>\n </div>\n <a *ngIf=\"bannerData.widgetData?.length > 1\" role=\"button\" class=\"prev\" (click)=\"slideTo(currentIndex - 1)\">&#10094;</a>\n <a *ngIf=\"bannerData.widgetData?.length > 1\" role=\"button\" class=\"next\" (click)=\"slideTo(currentIndex + 1)\">&#10095;</a>\n</div>\n<div class=\"banner-container-solo\" *ngIf=\"bannerData.widgetData?.length == 1\">\n <img i18n-alt alt=\"Page Banner\" [src]=\"bannerData.widgetData[0].banners.xl\" wsUtilsImageResponsive class=\"banner-image-solo\" />\n</div>\n", styles: [".banner-container{min-height:243px;overflow:hidden;position:relative;margin:auto;border-radius:12px}.banner-overlay{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background:linear-gradient(to left,#00000040,#0000 15% 85%,#00000040)}.banner{-webkit-animation-name:fade;-webkit-animation-duration:1.5s;animation-name:fade;animation-duration:1.5s}.banner .banner-image{width:100%;min-height:243px;display:block;height:350px;border-radius:12px}.banner-meta{text-align:center;z-index:2;position:absolute;bottom:0;left:50%;border-radius:12px;transform:translate(-50%);box-sizing:border-box}.banner-meta .banner-title{color:#f2f2f2;font-size:1.1rem}.banner-meta .dots-container{display:flex;align-items:center;justify-content:center}.banner-meta .dots-container .dot{cursor:pointer;margin:0 6px;background-color:#787878bf;box-shadow:1px 1px 4px #0009;border-radius:50%;display:inline-block;transition:background-color .5s ease!important}.banner-meta .dots-container .dot.active{background-color:#d3d3d3}@keyframes fade{0%{opacity:.25}to{opacity:1}}.prev,.next{cursor:pointer;position:absolute;top:50%;transform:translateY(-50%);color:#fff;font-weight:700;z-index:2;border-radius:0 3px 3px 0}.next{right:0;border-radius:3px 0 0 3px}.banner-container-solo{overflow:hidden;margin:auto;border-radius:12px}.banner-image-solo{width:100%;display:block;border-radius:12px}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i6.JsonPipe, name: "json" }] }); }
1732
+ }
1733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SlidersComponent, decorators: [{
1734
+ type: Component,
1735
+ args: [{ selector: 'ws-widget-sliders', template: "<div class=\"banner-container\" (swipeleft)=\"slideTo(currentIndex + 1)\" (swiperight)=\"slideTo(currentIndex - 1)\"\n *ngIf=\"bannerData.widgetData?.length > 1\">\n\n <div class=\"banner WidgetInstanceId\" *ngFor=\"let slide of bannerData.widgetData; let i = index\" [hidden]=\"i !== currentIndex\">\n <p>{{slide.banners | json}}</p>\n <img i18n-alt alt=\"Page Banner\" [src]=\"slide.banners\" wsUtilsImageResponsive class=\"banner-image\" />\n </div>\n <div class=\"banner-meta\">\n <!-- <a [routerLink]=\" !isOpenInNewTab ? widgetData[currentIndex].redirectUrl : './'\"\n class=\"banner-title text-truncate\" *ngIf=\"widgetData[currentIndex].title\"\n [title]=\"widgetData[currentIndex].title\">\n {{ widgetData[currentIndex].title }}\n </a> -->\n <div class=\"dots-container\" *ngIf=\"bannerData.widgetData?.length > 1\">\n <span class=\"dot\" [ngClass]=\"{ active: j === currentIndex }\" *ngFor=\"let slide of bannerData.widgetData; let j = index\"\n (click)=\"slideTo(j)\"></span>\n </div>\n </div>\n <a *ngIf=\"bannerData.widgetData?.length > 1\" role=\"button\" class=\"prev\" (click)=\"slideTo(currentIndex - 1)\">&#10094;</a>\n <a *ngIf=\"bannerData.widgetData?.length > 1\" role=\"button\" class=\"next\" (click)=\"slideTo(currentIndex + 1)\">&#10095;</a>\n</div>\n<div class=\"banner-container-solo\" *ngIf=\"bannerData.widgetData?.length == 1\">\n <img i18n-alt alt=\"Page Banner\" [src]=\"bannerData.widgetData[0].banners.xl\" wsUtilsImageResponsive class=\"banner-image-solo\" />\n</div>\n", styles: [".banner-container{min-height:243px;overflow:hidden;position:relative;margin:auto;border-radius:12px}.banner-overlay{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background:linear-gradient(to left,#00000040,#0000 15% 85%,#00000040)}.banner{-webkit-animation-name:fade;-webkit-animation-duration:1.5s;animation-name:fade;animation-duration:1.5s}.banner .banner-image{width:100%;min-height:243px;display:block;height:350px;border-radius:12px}.banner-meta{text-align:center;z-index:2;position:absolute;bottom:0;left:50%;border-radius:12px;transform:translate(-50%);box-sizing:border-box}.banner-meta .banner-title{color:#f2f2f2;font-size:1.1rem}.banner-meta .dots-container{display:flex;align-items:center;justify-content:center}.banner-meta .dots-container .dot{cursor:pointer;margin:0 6px;background-color:#787878bf;box-shadow:1px 1px 4px #0009;border-radius:50%;display:inline-block;transition:background-color .5s ease!important}.banner-meta .dots-container .dot.active{background-color:#d3d3d3}@keyframes fade{0%{opacity:.25}to{opacity:1}}.prev,.next{cursor:pointer;position:absolute;top:50%;transform:translateY(-50%);color:#fff;font-weight:700;z-index:2;border-radius:0 3px 3px 0}.next{right:0;border-radius:3px 0 0 3px}.banner-container-solo{overflow:hidden;margin:auto;border-radius:12px}.banner-image-solo{width:100%;display:block;border-radius:12px}\n"] }]
1736
+ }], ctorParameters: function () { return []; }, propDecorators: { bannerData: [{
1737
+ type: Input
1738
+ }], id: [{
1739
+ type: HostBinding,
1740
+ args: ['id']
1741
+ }] } });
1742
+
1743
+ // import { IGroup } from '../../infy/routes/navigator/models/navigator.model'
1744
+ var NSDiscussData;
1745
+ (function (NSDiscussData) {
1746
+ let IPageName;
1747
+ (function (IPageName) {
1748
+ IPageName["HOME"] = "discussion-home";
1749
+ IPageName["START"] = "discussion-start";
1750
+ IPageName["DETAILS"] = "discussion-details";
1751
+ IPageName["CATEGORY"] = "discussion-category";
1752
+ IPageName["TAGS"] = "discussion-category";
1753
+ IPageName["MY_DISCUSSION"] = "my-discussion";
1754
+ IPageName["LIB_ENTRY"] = "lib-entry";
1755
+ IPageName["LOAD_ALERT"] = "load-alert";
1756
+ })(IPageName = NSDiscussData.IPageName || (NSDiscussData.IPageName = {}));
1757
+ })(NSDiscussData || (NSDiscussData = {}));
1758
+
1759
+ /* tslint:enable */
1760
+ class LoadAlertComponent {
1761
+ constructor(telemetryUtils) {
1762
+ this.telemetryUtils = telemetryUtils;
1763
+ this.close = new EventEmitter();
1764
+ this.exit = new EventEmitter();
1765
+ }
1766
+ ngOnInit() {
1767
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.LOAD_ALERT);
1768
+ }
1769
+ exitForum(event) {
1770
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.LOAD_ALERT);
1771
+ this.exit.emit(event);
1772
+ }
1773
+ closeModal(event) {
1774
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.LOAD_ALERT);
1775
+ this.close.emit();
1776
+ }
1777
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoadAlertComponent, deps: [{ token: TelemetryUtilsService }], target: i0.ɵɵFactoryTarget.Component }); }
1778
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LoadAlertComponent, selector: "lib-load-alert", outputs: { close: "close", exit: "exit" }, ngImport: i0, template: "<div class=\"modal fade\" id=\"alertModal\">\n <div class=\"df-dimmer-alert-modal\">\n <div class=\"df-alert-modal\"> \n <div class=\"df-alert-modal-header\">Alert</div> \n <div class=\"df-alert-modal-content\">\n <label class=\"df-alert-label\">We are experiencing high traffic.Please try after sometime.</label>\n </div>\n <div class=\"df-alert-modal-buttons\">\n <button class=\"df-btn df-btn-normal df-btn-primary df-alert-close-btn\" id=\"load-alert-close\" (click)=\"exitForum($event)\">Close</button>\n </div>\n </div>\n </div>\n</div>", styles: ["#alertModal{display:block;opacity:2!important}.df-dimmer-alert-modal{position:fixed;inset:0;background:#000c;z-index:99999;opacity:1;transition:opacity .1s ease-in;pointer-events:auto}.df-dimmer-alert-modal .df-alert-modal{max-width:30rem;width:100%;margin:0 auto;border-radius:.1875rem;background:var(--white);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);overflow:auto;height:auto}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-header{background-color:var(--primary);color:var(--white);font-weight:700;font-size:1rem;padding:.5rem 1rem;border-bottom:0 solid var(--gray-100);min-height:2.5rem;line-height:1.5rem}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-content{padding:1rem;min-height:3.75rem}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-content .df-alert-label{display:inline-block;margin-bottom:0;font-size:.8125rem;font-weight:700}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-buttons{padding:.5rem 1rem;background:var(--white);border-top:.0625rem solid var(--gray-100);min-height:3.5rem;display:flex;flex-direction:row-reverse;align-items:center;cursor:pointer}\n"] }); }
1779
+ }
1780
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LoadAlertComponent, decorators: [{
1781
+ type: Component,
1782
+ args: [{ selector: 'lib-load-alert', template: "<div class=\"modal fade\" id=\"alertModal\">\n <div class=\"df-dimmer-alert-modal\">\n <div class=\"df-alert-modal\"> \n <div class=\"df-alert-modal-header\">Alert</div> \n <div class=\"df-alert-modal-content\">\n <label class=\"df-alert-label\">We are experiencing high traffic.Please try after sometime.</label>\n </div>\n <div class=\"df-alert-modal-buttons\">\n <button class=\"df-btn df-btn-normal df-btn-primary df-alert-close-btn\" id=\"load-alert-close\" (click)=\"exitForum($event)\">Close</button>\n </div>\n </div>\n </div>\n</div>", styles: ["#alertModal{display:block;opacity:2!important}.df-dimmer-alert-modal{position:fixed;inset:0;background:#000c;z-index:99999;opacity:1;transition:opacity .1s ease-in;pointer-events:auto}.df-dimmer-alert-modal .df-alert-modal{max-width:30rem;width:100%;margin:0 auto;border-radius:.1875rem;background:var(--white);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);overflow:auto;height:auto}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-header{background-color:var(--primary);color:var(--white);font-weight:700;font-size:1rem;padding:.5rem 1rem;border-bottom:0 solid var(--gray-100);min-height:2.5rem;line-height:1.5rem}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-content{padding:1rem;min-height:3.75rem}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-content .df-alert-label{display:inline-block;margin-bottom:0;font-size:.8125rem;font-weight:700}.df-dimmer-alert-modal .df-alert-modal .df-alert-modal-buttons{padding:.5rem 1rem;background:var(--white);border-top:.0625rem solid var(--gray-100);min-height:3.5rem;display:flex;flex-direction:row-reverse;align-items:center;cursor:pointer}\n"] }]
1783
+ }], ctorParameters: function () { return [{ type: TelemetryUtilsService }]; }, propDecorators: { close: [{
1784
+ type: Output
1785
+ }], exit: [{
1786
+ type: Output
1787
+ }] } });
1788
+
1789
+ class ElementsModule {
1790
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1791
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ElementsModule, declarations: [PostReplyComponent,
1792
+ CategoryCardComponent,
1793
+ DiscussCardComponent,
1794
+ AvatarPhotoComponent,
1795
+ AppLoaderComponent,
1796
+ RelatedDiscussionComponent,
1797
+ SlidersComponent,
1798
+ LoadAlertComponent], imports: [CommonModule, PipesModule,
1799
+ FormsModule,
1800
+ ReactiveFormsModule], exports: [CategoryCardComponent,
1801
+ DiscussCardComponent,
1802
+ AvatarPhotoComponent,
1803
+ AppLoaderComponent,
1804
+ RelatedDiscussionComponent,
1805
+ AppLoaderComponent,
1806
+ PostReplyComponent,
1807
+ SlidersComponent,
1808
+ LoadAlertComponent] }); }
1809
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementsModule, imports: [CommonModule, PipesModule,
1810
+ FormsModule,
1811
+ ReactiveFormsModule] }); }
1812
+ }
1813
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ElementsModule, decorators: [{
1814
+ type: NgModule,
1815
+ args: [{
1816
+ declarations: [
1817
+ PostReplyComponent,
1818
+ CategoryCardComponent,
1819
+ DiscussCardComponent,
1820
+ AvatarPhotoComponent,
1821
+ AppLoaderComponent,
1822
+ RelatedDiscussionComponent,
1823
+ SlidersComponent,
1824
+ LoadAlertComponent
1825
+ ],
1826
+ imports: [
1827
+ CommonModule, PipesModule,
1828
+ FormsModule,
1829
+ ReactiveFormsModule
1830
+ ],
1831
+ exports: [
1832
+ CategoryCardComponent,
1833
+ DiscussCardComponent,
1834
+ AvatarPhotoComponent,
1835
+ AppLoaderComponent,
1836
+ RelatedDiscussionComponent,
1837
+ AppLoaderComponent,
1838
+ PostReplyComponent,
1839
+ SlidersComponent,
1840
+ LoadAlertComponent
1841
+ ]
1842
+ }]
1843
+ }] });
1844
+
1845
+ /* tslint:enable */
1846
+ class SidePannelComponent {
1847
+ constructor(router, discussService, activatedRoute, telemetryUtils, configService) {
1848
+ this.router = router;
1849
+ this.discussService = discussService;
1850
+ this.activatedRoute = activatedRoute;
1851
+ this.telemetryUtils = telemetryUtils;
1852
+ this.configService = configService;
1853
+ this.defaultPage = 'categories';
1854
+ this.menu = [];
1855
+ this.showSideMenu = true;
1856
+ }
1857
+ ngOnInit() {
1858
+ // TODO: loader or spinner
1859
+ this.telemetryUtils.setContext([]);
1860
+ this.hideSidePanel = document.body.classList.contains('widget');
1861
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.HOME);
1862
+ this.data = this.configService.getConfig();
1863
+ const menuArr = _.get(this.data, 'menuOptions') && _.get(this.data, 'menuOptions').length > 0
1864
+ ? this.data.menuOptions : MENUOPTIONS;
1865
+ // })
1866
+ for (let i = 0; i < menuArr.length; i++) {
1867
+ if (menuArr[i].enable) {
1868
+ this.menu.push(menuArr[i]);
1869
+ }
1870
+ }
1871
+ }
1872
+ isActive(selectedItem) {
1873
+ this.landingPage = this.data.defaultLandingPage ? this.data.defaultLandingPage : 'categories';
1874
+ if (this.router.url.indexOf(`/${selectedItem}`) > -1 || this.selectedTab === selectedItem) {
1875
+ if (!this.selectedTab) {
1876
+ this.selectedTab = selectedItem;
1877
+ }
1878
+ return true;
1879
+ }
1880
+ else if (selectedItem === this.landingPage && !this.selectedTab) {
1881
+ return true;
1882
+ }
1883
+ return false;
1884
+ }
1885
+ navigate(pageName, event) {
1886
+ this.selectedTab = pageName;
1887
+ this.telemetryUtils.setContext([]);
1888
+ if (event) {
1889
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.HOME);
1890
+ }
1891
+ this.router.navigate([`${this.configService.getRouterSlug()}${ROUTES.DISCUSSION}${pageName}`], { queryParamsHandling: "merge" });
1892
+ this.closeNav();
1893
+ }
1894
+ ngOnDestroy() {
1895
+ if (this.paramsSubscription) {
1896
+ this.paramsSubscription.unsubscribe();
1897
+ }
1898
+ }
1899
+ showMenuButton() {
1900
+ this.showSideMenu = this.showSideMenu ? false : true;
1901
+ }
1902
+ closeNav() {
1903
+ this.showSideMenu = this.showSideMenu ? false : true;
1904
+ }
1905
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SidePannelComponent, deps: [{ token: i1.Router }, { token: DiscussionService }, { token: i1.ActivatedRoute }, { token: TelemetryUtilsService }, { token: ConfigService }], target: i0.ɵɵFactoryTarget.Component }); }
1906
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SidePannelComponent, selector: "lib-side-pannel", ngImport: i0, template: "<ul class=\"sb-sidebar-menu pl-0\" *ngIf=\"!hideSidePanel\">\n <!-- <li class=\"df-sidebar-menu-list\" *ngIf=\"false\" (click)=\"navigate('home', $event)\" id=\"all-discussions\"><a>All discussions</a></li> -->\n <li *ngFor='let d of menu' class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': isActive(d.route)}\"\n (click)=\"navigate(d.route, $event)\" id=\"d.route\"><a>{{d.label}}</a></li>\n <!-- <li class=\"df-sidebar-menu-list\" id=\"leader-board\"><a>Leaderboard</a></li> -->\n</ul>\n\n<!-- for mobile-view -->\n<button type=\"button\" class=\"open-btn\" (click)=\"showMenuButton()\">\u2630</button> \n<div class=\"overlay-sidebar\" *ngIf=\"!showSideMenu\">\n <div class=\"overlay-sidebar__menu\">\n <a href=\"javascript:void(0)\" class=\"close-btn\" (click)=\"closeNav()\">&times;</a>\n <div class=\"overlay-sidebar__menu__content\">\n <ul class=\"sb-sidebar-menu-mob pl-0\">\n <li *ngFor='let d of menu' class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': isActive(d.route)}\"\n (click)=\"navigate(d.route, $event)\" id=\"d.route\"><a>{{d.label}}</a></li>\n <!-- <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" *ngIf=\"false\" (click)=\"navigate('home', $event)\" id=\"all-discussions\"><a>All discussions</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': selectedTab === 'categories'}\" (click)=\"navigate('categories', $event)\" id=\"discussion-categories\"><a>Categories</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\"[ngClass]=\"{'menu-active': selectedTab === 'tags'}\" (click)=\"navigate('tags', $event)\" id=\"discussion-tags\"><a>Tags</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': selectedTab === 'my-discussion'}\" (click)=\"navigate('my-discussion', $event)\" id=\"my-discussion\"><a>My discussions</a></li> -->\n </ul>\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-sidebar-menu-text: var(--gray-600);--df-sidebar-menu-active-text: var(--primary);--df-sidebar-menu-bl:var(--primary);--df-sidebar-menu-active-bg: var(--df-common-bg);--open-btn-bg: var(--white);--open-btn-color: var(--gray-800);--df-overlay-sidebar-bg:var(--black);--df-overlay-sidebar-bg-menu:#f5f6fa}.sb-sidebar-menu{list-style-type:none;margin-bottom:0;height:100%;display:inline}.df-sidebar-menu-list{margin-bottom:.5rem;padding:.75rem 1rem;font-size:14px;color:var(--df-sidebar-menu-text);border-left:.125rem solid transparent;cursor:pointer}.df-sidebar-menu-list.menu-active,.df-sidebar-menu-list:hover{background-color:var(--df-sidebar-menu-active-bg);font-weight:700;border-left:.1875rem solid var(--df-sidebar-menu-bl);color:var(--df-sidebar-menu-active-text);border-bottom:0px}.sb-sidebar-menu-mob{list-style-type:none;margin-bottom:0;height:100%;display:inline}.open-btn,.overlay-sidebar{display:none}@media (max-width: 768px){.sb-sidebar-menu{display:none}.open-btn{display:inline;border:none;cursor:pointer;height:2.5rem;width:2.5rem;border-radius:1rem;font-size:1.375rem;background-color:var(--open-btn-bg);box-shadow:3px 3px 2px #0000001a;color:var(--open-btn-color)}.overlay-sidebar{height:100vh;width:100%;overflow:hidden;background:#0006;inset:0;position:absolute;display:inline;z-index:3;transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}.overlay-sidebar__menu{position:relative;top:0;height:100%;width:15rem;right:0;z-index:100000;overflow-y:auto;overflow-x:hidden;background-color:var(--df-overlay-sidebar-bg-menu);box-shadow:0 8px 10px -5px #0003,0 16px 24px 2px #00000024,0 6px 30px 5px #000}.overlay-sidebar__menu .close-btn{font-size:2.5rem;display:flex;justify-content:flex-end;padding-right:1rem;cursor:pointer}.overlay-sidebar__menu__content{padding:0 1rem;height:100%}}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1907
+ }
1908
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SidePannelComponent, decorators: [{
1909
+ type: Component,
1910
+ args: [{ selector: 'lib-side-pannel', template: "<ul class=\"sb-sidebar-menu pl-0\" *ngIf=\"!hideSidePanel\">\n <!-- <li class=\"df-sidebar-menu-list\" *ngIf=\"false\" (click)=\"navigate('home', $event)\" id=\"all-discussions\"><a>All discussions</a></li> -->\n <li *ngFor='let d of menu' class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': isActive(d.route)}\"\n (click)=\"navigate(d.route, $event)\" id=\"d.route\"><a>{{d.label}}</a></li>\n <!-- <li class=\"df-sidebar-menu-list\" id=\"leader-board\"><a>Leaderboard</a></li> -->\n</ul>\n\n<!-- for mobile-view -->\n<button type=\"button\" class=\"open-btn\" (click)=\"showMenuButton()\">\u2630</button> \n<div class=\"overlay-sidebar\" *ngIf=\"!showSideMenu\">\n <div class=\"overlay-sidebar__menu\">\n <a href=\"javascript:void(0)\" class=\"close-btn\" (click)=\"closeNav()\">&times;</a>\n <div class=\"overlay-sidebar__menu__content\">\n <ul class=\"sb-sidebar-menu-mob pl-0\">\n <li *ngFor='let d of menu' class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': isActive(d.route)}\"\n (click)=\"navigate(d.route, $event)\" id=\"d.route\"><a>{{d.label}}</a></li>\n <!-- <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" *ngIf=\"false\" (click)=\"navigate('home', $event)\" id=\"all-discussions\"><a>All discussions</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': selectedTab === 'categories'}\" (click)=\"navigate('categories', $event)\" id=\"discussion-categories\"><a>Categories</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\"[ngClass]=\"{'menu-active': selectedTab === 'tags'}\" (click)=\"navigate('tags', $event)\" id=\"discussion-tags\"><a>Tags</a></li>\n <li class=\"df-sidebar-menu-list\" tabindex=\"0\" role=\"link\" [ngClass]=\"{'menu-active': selectedTab === 'my-discussion'}\" (click)=\"navigate('my-discussion', $event)\" id=\"my-discussion\"><a>My discussions</a></li> -->\n </ul>\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-sidebar-menu-text: var(--gray-600);--df-sidebar-menu-active-text: var(--primary);--df-sidebar-menu-bl:var(--primary);--df-sidebar-menu-active-bg: var(--df-common-bg);--open-btn-bg: var(--white);--open-btn-color: var(--gray-800);--df-overlay-sidebar-bg:var(--black);--df-overlay-sidebar-bg-menu:#f5f6fa}.sb-sidebar-menu{list-style-type:none;margin-bottom:0;height:100%;display:inline}.df-sidebar-menu-list{margin-bottom:.5rem;padding:.75rem 1rem;font-size:14px;color:var(--df-sidebar-menu-text);border-left:.125rem solid transparent;cursor:pointer}.df-sidebar-menu-list.menu-active,.df-sidebar-menu-list:hover{background-color:var(--df-sidebar-menu-active-bg);font-weight:700;border-left:.1875rem solid var(--df-sidebar-menu-bl);color:var(--df-sidebar-menu-active-text);border-bottom:0px}.sb-sidebar-menu-mob{list-style-type:none;margin-bottom:0;height:100%;display:inline}.open-btn,.overlay-sidebar{display:none}@media (max-width: 768px){.sb-sidebar-menu{display:none}.open-btn{display:inline;border:none;cursor:pointer;height:2.5rem;width:2.5rem;border-radius:1rem;font-size:1.375rem;background-color:var(--open-btn-bg);box-shadow:3px 3px 2px #0000001a;color:var(--open-btn-color)}.overlay-sidebar{height:100vh;width:100%;overflow:hidden;background:#0006;inset:0;position:absolute;display:inline;z-index:3;transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}.overlay-sidebar__menu{position:relative;top:0;height:100%;width:15rem;right:0;z-index:100000;overflow-y:auto;overflow-x:hidden;background-color:var(--df-overlay-sidebar-bg-menu);box-shadow:0 8px 10px -5px #0003,0 16px 24px 2px #00000024,0 6px 30px 5px #000}.overlay-sidebar__menu .close-btn{font-size:2.5rem;display:flex;justify-content:flex-end;padding-right:1rem;cursor:pointer}.overlay-sidebar__menu__content{padding:0 1rem;height:100%}}\n"] }]
1911
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: DiscussionService }, { type: i1.ActivatedRoute }, { type: TelemetryUtilsService }, { type: ConfigService }]; } });
1912
+
1913
+ /* tslint:enable */
1914
+ class LibEntryComponent {
1915
+ constructor(activatedRoute, discussionService, configService, location, navigationServiceService, discussionEventService, telemetryUtils) {
1916
+ this.activatedRoute = activatedRoute;
1917
+ this.discussionService = discussionService;
1918
+ this.configService = configService;
1919
+ this.location = location;
1920
+ this.navigationServiceService = navigationServiceService;
1921
+ this.discussionEventService = discussionEventService;
1922
+ this.telemetryUtils = telemetryUtils;
1923
+ this.headerOption = true;
1924
+ this.currentRoute = 'all-discussions';
1925
+ this.showLoaderAlert = false;
1926
+ this.bannerSubscription = this.activatedRoute.data.subscribe(data => {
1927
+ if (data && data.pageData) {
1928
+ this.banner = data.pageData.data.banner || [];
1929
+ }
1930
+ });
1931
+ }
1932
+ ngOnInit() {
1933
+ /**
1934
+ * calling the initservice to tell navigationservice to use the router service
1935
+ * because this component is invoke only in router approach
1936
+ */
1937
+ this.navigationServiceService.initService('routerService');
1938
+ this.histtoryStartIndex = window.history.length - 1;
1939
+ this.configService.setConfig(this.activatedRoute);
1940
+ // this.activatedRoute.data.subscribe((data) => {
1941
+ this.data = this.configService.getConfig();
1942
+ if (!this.data) {
1943
+ // fallback for query params
1944
+ this.configService.setConfigFromParams(this.activatedRoute);
1945
+ this.data = this.configService.getConfig();
1946
+ }
1947
+ this.discussionService.userId = _.get(this.data, 'userId');
1948
+ const rawCategories = _.get(this.data, 'categories');
1949
+ this.discussionService.forumIds = _.get(rawCategories, 'result');
1950
+ this.discussionService.initializeUserDetails(this.discussionService.userId);
1951
+ this.handleLoaderAlert();
1952
+ }
1953
+ handleLoaderAlert() {
1954
+ this.subscription = this.discussionService.alertEvent.subscribe(() => {
1955
+ this.showLoaderAlert = true;
1956
+ });
1957
+ }
1958
+ goBack() {
1959
+ const eventAction = {
1960
+ action: 'DF_BACK'
1961
+ };
1962
+ this.discussionEventService.emitTelemetry(eventAction);
1963
+ this.location.back();
1964
+ }
1965
+ close(event) {
1966
+ this.showLoaderAlert = false;
1967
+ const eventAction = {
1968
+ action: 'DF_CLOSE'
1969
+ };
1970
+ this.discussionEventService.emitTelemetry(eventAction);
1971
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.LIB_ENTRY);
1972
+ window.history.go(-(window.history.length - this.histtoryStartIndex));
1973
+ }
1974
+ closeLoadAlert() {
1975
+ this.showLoaderAlert = false;
1976
+ }
1977
+ ngOnDestroy() {
1978
+ this.subscription.unsubscribe();
1979
+ }
1980
+ onScrollTopActive(event) {
1981
+ window.scroll({
1982
+ top: 0,
1983
+ left: 0,
1984
+ behavior: 'smooth'
1985
+ });
1986
+ }
1987
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LibEntryComponent, deps: [{ token: i1.ActivatedRoute }, { token: DiscussionService }, { token: ConfigService }, { token: i6.Location }, { token: NavigationServiceService }, { token: DiscussionEventsService }, { token: TelemetryUtilsService }], target: i0.ɵɵFactoryTarget.Component }); }
1988
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LibEntryComponent, selector: "lib-lib-entry", host: { classAttribute: "flex-1 main_discuss_lib" }, ngImport: i0, template: "<div class=\"sbt-inside-page-container ui container\">\n <div class=\"df-header\">\n <button type=\"button\" class=\"df-btn df-btn-normal df-btn-primary df-back-btn\" tabindex=\"0\" autofocus\n role=\"button\" (click)=\"goBack()\">\n <img src=\"./assets/discussion-ui/images/back-img.png\" alt=\"back icon\" />\n Back\n </button>\n <button (click)=\"close($event)\" class=\"df-btn df-btn-normal df-btn-danger df-close-btn\" tabindex=\"0\"\n id=\"close-discussion-forum\" type=\"button\" autofocus>\n Close\n <img src=\"./assets/discussion-ui/images/close.png\" alt=\"close icon\" />\n </button>\n </div>\n\n <div class=\"discussion-forum-content\">\n <div class=\"discuss-left-panel\">\n <lib-side-pannel></lib-side-pannel>\n </div>\n <div class=\"discuss-right-panel\">\n <router-outlet (activate)=\"onScrollTopActive($event)\"></router-outlet>\n </div>\n </div>\n</div>\n\n<lib-load-alert *ngIf=\"showLoaderAlert\" (exit)=\"close($event)\" (close)=\"closeLoadAlert()\"></lib-load-alert>", styles: ["::ng-deep:root{--df-header-bg:var(--df-common-bg)}.df-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;background:var(--df-header-bg);margin-bottom:1rem}.df-header .df-back-btn{display:flex;align-items:center}.df-header .df-back-btn img{width:1rem;height:1rem;margin-right:.25rem;filter:invert(1)}.df-header .df-close-btn img{width:.5rem;height:.5rem;margin-left:.25rem;filter:invert(1)}.discussion-forum-content{display:grid;grid-template-columns:1fr 4fr;grid-gap:1.5rem}@media (max-width: 768px){.discussion-forum-content{grid-template-columns:1fr}}.ui.container{display:block;max-width:100%!important}@media only screen and (max-width: 767px){.ui.container{width:auto!important;margin-left:1em!important;margin-right:1em!important}}@media only screen and (max-width: 1800px) and (min-width: 768px){.ui.container{width:90%;margin-left:auto!important;margin-right:auto!important}}\n"], dependencies: [{ kind: "component", type: SidePannelComponent, selector: "lib-side-pannel" }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: LoadAlertComponent, selector: "lib-load-alert", outputs: ["close", "exit"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1989
+ }
1990
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LibEntryComponent, decorators: [{
1991
+ type: Component,
1992
+ args: [{ selector: 'lib-lib-entry', host: { class: 'flex-1 main_discuss_lib', }, template: "<div class=\"sbt-inside-page-container ui container\">\n <div class=\"df-header\">\n <button type=\"button\" class=\"df-btn df-btn-normal df-btn-primary df-back-btn\" tabindex=\"0\" autofocus\n role=\"button\" (click)=\"goBack()\">\n <img src=\"./assets/discussion-ui/images/back-img.png\" alt=\"back icon\" />\n Back\n </button>\n <button (click)=\"close($event)\" class=\"df-btn df-btn-normal df-btn-danger df-close-btn\" tabindex=\"0\"\n id=\"close-discussion-forum\" type=\"button\" autofocus>\n Close\n <img src=\"./assets/discussion-ui/images/close.png\" alt=\"close icon\" />\n </button>\n </div>\n\n <div class=\"discussion-forum-content\">\n <div class=\"discuss-left-panel\">\n <lib-side-pannel></lib-side-pannel>\n </div>\n <div class=\"discuss-right-panel\">\n <router-outlet (activate)=\"onScrollTopActive($event)\"></router-outlet>\n </div>\n </div>\n</div>\n\n<lib-load-alert *ngIf=\"showLoaderAlert\" (exit)=\"close($event)\" (close)=\"closeLoadAlert()\"></lib-load-alert>", styles: ["::ng-deep:root{--df-header-bg:var(--df-common-bg)}.df-header{display:flex;align-items:center;justify-content:space-between;padding:1rem;background:var(--df-header-bg);margin-bottom:1rem}.df-header .df-back-btn{display:flex;align-items:center}.df-header .df-back-btn img{width:1rem;height:1rem;margin-right:.25rem;filter:invert(1)}.df-header .df-close-btn img{width:.5rem;height:.5rem;margin-left:.25rem;filter:invert(1)}.discussion-forum-content{display:grid;grid-template-columns:1fr 4fr;grid-gap:1.5rem}@media (max-width: 768px){.discussion-forum-content{grid-template-columns:1fr}}.ui.container{display:block;max-width:100%!important}@media only screen and (max-width: 767px){.ui.container{width:auto!important;margin-left:1em!important;margin-right:1em!important}}@media only screen and (max-width: 1800px) and (min-width: 768px){.ui.container{width:90%;margin-left:auto!important;margin-right:auto!important}}\n"] }]
1993
+ }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: DiscussionService }, { type: ConfigService }, { type: i6.Location }, { type: NavigationServiceService }, { type: DiscussionEventsService }, { type: TelemetryUtilsService }]; } });
1994
+
1995
+ class DiscussUtilsService {
1996
+ constructor() { }
1997
+ stringToColor(title) {
1998
+ let hash = 0;
1999
+ for (let i = 0; i < title.length; i++) {
2000
+ // tslint:disable-next-line: no-bitwise
2001
+ hash = title.charCodeAt(i) + ((hash << 5) - hash);
2002
+ }
2003
+ const hue = Math.abs(hash % 360);
2004
+ // tslint:disable-next-line: prefer-template
2005
+ const colour = 'hsl(' + hue + ',100%,30%)';
2006
+ return colour;
2007
+ }
2008
+ getContrast() {
2009
+ return 'rgba(255, 255, 255, 80%)';
2010
+ }
2011
+ /**
2012
+ * The htmlDecode() method parses a string containing either HTML or XML
2013
+ * @param {any} str
2014
+ */
2015
+ htmlDecode(str) {
2016
+ const doc = new DOMParser().parseFromString(str, "text/html");
2017
+ return doc.documentElement.textContent;
2018
+ }
2019
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussUtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2020
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussUtilsService, providedIn: 'root' }); }
2021
+ }
2022
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussUtilsService, decorators: [{
2023
+ type: Injectable,
2024
+ args: [{
2025
+ providedIn: 'root'
2026
+ }]
2027
+ }], ctorParameters: function () { return []; } });
2028
+
2029
+ /* tslint:enable */
2030
+ class DiscussStartComponent {
2031
+ constructor(discussService, formBuilder, telemetryUtils, configService, discussUtils) {
2032
+ this.discussService = discussService;
2033
+ this.formBuilder = formBuilder;
2034
+ this.telemetryUtils = telemetryUtils;
2035
+ this.configService = configService;
2036
+ this.discussUtils = discussUtils;
2037
+ this.close = new EventEmitter();
2038
+ this.editable = true;
2039
+ this.postTagsArray = [];
2040
+ this.uploadSaveData = false;
2041
+ this.showErrorMsg = false;
2042
+ this.showSelectCategory = false;
2043
+ this.createErrorMsg = '';
2044
+ this.defaultError = 'Something went wrong, Please try again after sometime!';
2045
+ this.enableSubmitButton = false;
2046
+ }
2047
+ ngOnInit() {
2048
+ document.querySelector('[tabindex="-1"]').focus();
2049
+ // debugger
2050
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.START);
2051
+ this.cIds = this.configService.getCategories();
2052
+ if (this.categoryId) {
2053
+ this.showSelectCategory = false;
2054
+ }
2055
+ else {
2056
+ this.showSelectCategory = true;
2057
+ }
2058
+ this.initializeData();
2059
+ this.initializeFormFields(this.topicData);
2060
+ }
2061
+ initializeFormFields(topicData) {
2062
+ this.startForm = this.formBuilder.group({
2063
+ question: [null, [Validators.required, Validators.minLength(8)]],
2064
+ description: [null, [Validators.required, Validators.minLength(8)]],
2065
+ tags: [],
2066
+ category: []
2067
+ });
2068
+ this.startForm.valueChanges.subscribe(val => {
2069
+ this.validateForm();
2070
+ });
2071
+ /** If popup is in edit mode */
2072
+ if (topicData) {
2073
+ const tags = _.map(_.get(topicData, 'tags'), (element) => {
2074
+ return _.get(element, 'value');
2075
+ });
2076
+ /** calling htmlDecode method to get the parsed string */
2077
+ this.startForm.controls['question'].setValue(this.discussUtils.htmlDecode(_.get(topicData, 'title')));
2078
+ this.startForm.controls['description'].setValue(_.get(topicData, 'posts[0].content').replace(/<[^>]+>/g, ''));
2079
+ this.startForm.controls['tags'].setValue(tags);
2080
+ this.validateForm();
2081
+ }
2082
+ }
2083
+ isFieldValid(field) {
2084
+ let valueNoWhiteSpace = this.startForm.get(field).value;
2085
+ if (valueNoWhiteSpace) {
2086
+ const index = valueNoWhiteSpace.length;
2087
+ if (index >= 2 && valueNoWhiteSpace.charAt(index - 2) === " ") {
2088
+ this.startForm.patchValue({ replyContent: this.startForm.get(field).value.trim() });
2089
+ }
2090
+ else {
2091
+ this.startForm.patchValue({ replyContent: this.startForm.get(field).value.trimStart() });
2092
+ }
2093
+ }
2094
+ return (!this.startForm.get(field).valid && this.startForm.get(field).dirty);
2095
+ }
2096
+ validateForm() {
2097
+ if (this.startForm.status === 'VALID') {
2098
+ this.enableSubmitButton = true;
2099
+ }
2100
+ else {
2101
+ this.enableSubmitButton = false;
2102
+ }
2103
+ }
2104
+ initializeData() {
2105
+ // debugger
2106
+ if (this.configService.hasContext() && !this.categoryId) {
2107
+ const req = {
2108
+ cids: this.cIds.result
2109
+ };
2110
+ this.discussService.getContextBasedDiscussion(req).subscribe((data) => {
2111
+ this.allCategories = data.result;
2112
+ if (this.startForm.get('category')) { }
2113
+ this.startForm.controls['category'].setValue(this.allCategories[0].cid);
2114
+ });
2115
+ }
2116
+ else if (this.categoryId) {
2117
+ const req = {
2118
+ cids: [this.categoryId]
2119
+ };
2120
+ this.showSelectCategory = false;
2121
+ this.editable = false;
2122
+ this.discussService.getContextBasedDiscussion(req).subscribe((data) => {
2123
+ this.allCategories = data.result;
2124
+ if (this.startForm.get('category')) { }
2125
+ this.startForm.controls.category.setValue(this.allCategories[0].cid);
2126
+ });
2127
+ }
2128
+ else {
2129
+ this.discussService.fetchAllCategories().subscribe((data) => {
2130
+ this.allCategories = data;
2131
+ if (this.startForm.get('category')) { }
2132
+ this.startForm.controls['category'].setValue(this.allCategories[1].cid);
2133
+ });
2134
+ }
2135
+ this.discussService.fetchAllTag().subscribe(data => {
2136
+ const tags = _.get(data, 'tags');
2137
+ this.allTags = _.map(tags, (tag) => tag.value);
2138
+ });
2139
+ }
2140
+ showError(meta) {
2141
+ if (meta) {
2142
+ return true;
2143
+ }
2144
+ return false;
2145
+ }
2146
+ submitPost(form) {
2147
+ this.uploadSaveData = true;
2148
+ this.showErrorMsg = false;
2149
+ const postCreateReq = {
2150
+ cid: this.categoryId ? this.categoryId : parseInt(form.value.category),
2151
+ title: form.value.question,
2152
+ content: form.value.description,
2153
+ tags: form.value.tags,
2154
+ };
2155
+ this.discussService.createPost(postCreateReq).subscribe(() => {
2156
+ this.closeModal('success');
2157
+ form.reset();
2158
+ this.uploadSaveData = false;
2159
+ // success toast;
2160
+ // this.openSnackbar(this.toastSuccess.nativeElement.value)
2161
+ // close the modal
2162
+ }, err => {
2163
+ this.closeModal('discard');
2164
+ // error toast
2165
+ // .openSnackbar(this.toastError.nativeElement.value)
2166
+ this.uploadSaveData = false;
2167
+ if (err) {
2168
+ if (err.error && err.error.message) {
2169
+ this.showErrorMsg = true;
2170
+ this.createErrorMsg = err.error.message.split('|')[1] || this.defaultError;
2171
+ }
2172
+ }
2173
+ });
2174
+ }
2175
+ /**
2176
+ * @param {any} form
2177
+ * @description - It will emit an event when popup is opened in edit topic/thread mode
2178
+ * Here, as 'tid', we are passing the main topic pid from the post array
2179
+ */
2180
+ updatePost(form) {
2181
+ const updateTopicRequest = {
2182
+ title: form.value.question,
2183
+ content: form.value.description,
2184
+ tags: form.value.tags,
2185
+ uid: _.get(this.topicData, 'uid')
2186
+ };
2187
+ this.close.emit({
2188
+ action: 'update',
2189
+ tid: _.get(this.topicData, 'posts[0].pid'),
2190
+ request: updateTopicRequest
2191
+ });
2192
+ }
2193
+ closeModal(eventMessage) {
2194
+ this.close.emit({ message: eventMessage });
2195
+ }
2196
+ logTelemetry(event) {
2197
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.START);
2198
+ }
2199
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussStartComponent, deps: [{ token: DiscussionService }, { token: i2$1.UntypedFormBuilder }, { token: TelemetryUtilsService }, { token: ConfigService }, { token: DiscussUtilsService }], target: i0.ɵɵFactoryTarget.Component }); }
2200
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussStartComponent, selector: "lib-discuss-start", inputs: { categoryId: "categoryId", topicData: "topicData", mode: "mode" }, outputs: { close: "close" }, ngImport: i0, template: "<!--modals-->\n<div class=\"modal fade\" id=\"myModal\">\n <div class=\"discussion-start-modal\">\n <div class=\"discussion-start-modal-content\" id=\"topic-scroll\" tabindex=\"-1\" role=\"dialog\">\n <form [formGroup]=\"startForm\" class=\"discussion-start-form\">\n\n <div class=\"start-form-content\" *ngIf=\"showSelectCategory\" [ngClass]=\"{ 'is-invalid': showError('subTitle') }\">\n <label class=\"start-form-label\">Select category*</label>\n <div class=\"start-form-field\">\n <label class=\"start-form-label\" for=\"myList\">Select list </label>\n <select formControlName=\"category\" #category [required]=\"true\" id=\"myList\" class=\"select-category\">\n <option [value]=\"c.cid\" *ngFor=\"let c of allCategories\" [innerHTML]=\"c.name\"></option>\n </select>\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('category').valid\" i18n=\"category Error|Explains category is required\">\n category is mandatory</small>\n </div>\n\n <div class=\"start-form-content\" [ngClass]=\"{ 'is-invalid': showError('subTitle') }\">\n <label class=\"start-form-label\">Discussion topic*</label>\n <div class=\"start-form-field\">\n <input [ngClass]=\"{'is-invalid' : isFieldValid('question')}\" class=\"start-form-field-control\" placeholder=\"Type here (minimum 8 characters)\"\n formControlName=\"question\" #question maxlength=\"1000\" />\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('question').valid\" i18n=\"question Error|Explains question is required\">\n Question is mandatory. It should be minimum of\n 8 characters</small>\n </div>\n\n <div class=\"start-form-content\">\n <div class=\"start-form-field\">\n <label class=\"start-form-label\" for=\"description\">Please elaborate your question or idea here*</label>\n <textarea [ngClass]=\"{'is-invalid' : isFieldValid('description')}\" minlength=\"8\" class=\"start-form-field-control\" rows=\"8\" formControlName=\"description\"\n #description name=\"moretext\" placeholder=\"Type here (minimum 8 characters)\" id=\"description\"></textarea>\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('description').valid\"\n i18n=\"description Error|Explains description is required\"> Description is mandatory. It should be minimum of\n 8 characters </small>\n </div>\n\n <div #postTags [ngClass]=\"{ 'is-invalid': showError('tags') }\" class=\"start-tags\">\n <label class=\"mb-0\">Tags</label>\n <div *ngFor=\"let tag of postTagsArray\">\n {{ tag }}\n </div>\n <!-- TODO: check the padding for placeholder -->\n <tag-input class=\"tag-input\" secondaryPlaceholder=\"Add a tag and press Enter\" formControlName=\"tags\"\n [modelAsStrings]=\"true\">\n </tag-input>\n </div>\n\n <div *ngIf=\"showErrorMsg\">\n <small class=\"mandatory-label\">\n {{createErrorMsg}}\n </small>\n </div>\n\n <div class=\"start-modal-buttons\">\n <button (click)=\"closeModal('discard');logTelemetry($event)\" mat-raised-button type=\"button\"\n class=\"df-btn df-btn-normal df-cancel-btn\" id=\"discard-discussion-start-form\">Cancel\n </button>\n <span *ngIf=\"uploadSaveData\">\n </span>\n <button *ngIf=\"mode !== 'edit'\" type=\"submit\" class=\"df-btn df-btn-normal df-btn-primary df-submit-btn\"\n [ngClass]=\"{'df-btn-disabled': !enableSubmitButton }\" [disabled]=\"!enableSubmitButton\"\n (click)=\"submitPost(startForm);logTelemetry($event)\" id=\"submit-discussion-start-form\">\n <span class=\"text-white\">Submit</span>\n </button>\n <button *ngIf=\"mode === 'edit'\" type=\"submit\" class=\"df-btn df-btn-normal df-btn-primary df-update-btn\"\n [ngClass]=\"{'df-btn-disabled': !enableSubmitButton }\" [disabled]=\"!enableSubmitButton\"\n (click)=\"updatePost(startForm);logTelemetry($event)\" id=\"update-topic-popup\">\n <span class=\"text-white\">Update</span>\n </button>\n </div>\n \u200B\n </form>\n \u200B\n <input type=\"hidden\" i18-value i18-aria-value aria-value=\"Post created successful\"\n value=\"Post created successfully!\" #toastSuccess />\n <input type=\"hidden\" i18-value i18-aria-value aria-value=\"unable to create post\"\n value=\"Error in creating new post!\" #toastError />\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-modal-content-bg: var(--df-common-bg);--df-modal-field-control-bg: var(--df-background);--df-tag-bg:var(--df-e9e8d9);--df-ng-tag-bg: var(--df-background)}.discussion-start-modal{position:fixed;inset:0;background:#000c;z-index:99999;opacity:1;transition:opacity .1s ease-in;pointer-events:auto}.discussion-start-modal .discussion-start-modal-content{max-width:50rem;width:90%;position:relative;margin:0 auto;padding:1rem;border-radius:.1875rem;background:var(--df-modal-content-bg);color:var(--df-text);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);overflow:auto;max-height:calc(100% - 156px)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-content{margin-bottom:.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-label{display:inline-block;margin-bottom:.5rem;font-size:.8125rem;font-weight:700}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field{position:relative;margin-bottom:0}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .select-category{border:.0625rem solid var(--gray-200);color:var(--df-text);margin:0 .5rem;padding:.5rem .25rem;background:var(--df-field-control-bg)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control{background-color:var(--df-modal-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;width:96%;cursor:pointer;outline:none;padding:.5rem .875rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control:focus,.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control .active{border-color:var(--primary-400)!important}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .mandatory-label{font-size:.75rem;color:var(--red-100)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons{float:right}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-submit-btn,.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-update-btn{margin-left:.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-cancel-btn{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;border:0;margin:0 .5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-btn-disabled{background-color:var(--gray-100)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-tags{margin-bottom:1.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-tags label{display:inline-block;font-size:.8125rem;font-weight:700;margin-bottom:0}#myModal{display:block;opacity:2!important}::ng-deep .ng2-tag-input{border:.0625rem solid var(--gray-200)!important;color:var(--df-text)!important;display:block;font-size:.8125rem!important;max-width:100%;padding:.25rem .5rem;margin:.5rem 0;background:var(--df-field-control-bg);border-radius:.1875rem;border-bottom:.0625rem solid var(--gray-200)!important}::ng-deep .ng2-tag-input--focused{border-color:var(--primary-400)!important}::ng-deep .ng2-tag-input__text-input{height:2.25rem;margin:0 .5rem;color:var(--df-text);background:var(--df-ng-tag-bg)}::ng-deep .ng2-tag-input.active{border-color:var(--primary-400)!important}::ng-deep tag{background:var(--df-tag-bg)!important;color:var(--df-text)!important}::ng-deep tag:first-child{margin-left:.5rem!important}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2$1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.TagInputComponent, selector: "tag-input", inputs: ["separatorKeys", "separatorKeyCodes", "placeholder", "secondaryPlaceholder", "maxItems", "validators", "asyncValidators", "onlyFromAutocomplete", "errorMessages", "theme", "onTextChangeDebounce", "inputId", "inputClass", "clearOnBlur", "hideForm", "addOnBlur", "addOnPaste", "pasteSplitPattern", "blinkIfDupe", "removable", "editable", "allowDupes", "modelAsStrings", "trimTags", "inputText", "ripple", "tabindex", "disable", "dragZone", "onRemoving", "onAdding", "animationDuration"], outputs: ["onAdd", "onRemove", "onSelect", "onFocus", "onBlur", "onTextChange", "onPaste", "onValidationError", "onTagEdited", "inputTextChange"] }] }); }
2201
+ }
2202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussStartComponent, decorators: [{
2203
+ type: Component,
2204
+ args: [{ selector: 'lib-discuss-start', template: "<!--modals-->\n<div class=\"modal fade\" id=\"myModal\">\n <div class=\"discussion-start-modal\">\n <div class=\"discussion-start-modal-content\" id=\"topic-scroll\" tabindex=\"-1\" role=\"dialog\">\n <form [formGroup]=\"startForm\" class=\"discussion-start-form\">\n\n <div class=\"start-form-content\" *ngIf=\"showSelectCategory\" [ngClass]=\"{ 'is-invalid': showError('subTitle') }\">\n <label class=\"start-form-label\">Select category*</label>\n <div class=\"start-form-field\">\n <label class=\"start-form-label\" for=\"myList\">Select list </label>\n <select formControlName=\"category\" #category [required]=\"true\" id=\"myList\" class=\"select-category\">\n <option [value]=\"c.cid\" *ngFor=\"let c of allCategories\" [innerHTML]=\"c.name\"></option>\n </select>\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('category').valid\" i18n=\"category Error|Explains category is required\">\n category is mandatory</small>\n </div>\n\n <div class=\"start-form-content\" [ngClass]=\"{ 'is-invalid': showError('subTitle') }\">\n <label class=\"start-form-label\">Discussion topic*</label>\n <div class=\"start-form-field\">\n <input [ngClass]=\"{'is-invalid' : isFieldValid('question')}\" class=\"start-form-field-control\" placeholder=\"Type here (minimum 8 characters)\"\n formControlName=\"question\" #question maxlength=\"1000\" />\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('question').valid\" i18n=\"question Error|Explains question is required\">\n Question is mandatory. It should be minimum of\n 8 characters</small>\n </div>\n\n <div class=\"start-form-content\">\n <div class=\"start-form-field\">\n <label class=\"start-form-label\" for=\"description\">Please elaborate your question or idea here*</label>\n <textarea [ngClass]=\"{'is-invalid' : isFieldValid('description')}\" minlength=\"8\" class=\"start-form-field-control\" rows=\"8\" formControlName=\"description\"\n #description name=\"moretext\" placeholder=\"Type here (minimum 8 characters)\" id=\"description\"></textarea>\n </div>\n <small class=\"mandatory-label\" *ngIf=\"!startForm.get('description').valid\"\n i18n=\"description Error|Explains description is required\"> Description is mandatory. It should be minimum of\n 8 characters </small>\n </div>\n\n <div #postTags [ngClass]=\"{ 'is-invalid': showError('tags') }\" class=\"start-tags\">\n <label class=\"mb-0\">Tags</label>\n <div *ngFor=\"let tag of postTagsArray\">\n {{ tag }}\n </div>\n <!-- TODO: check the padding for placeholder -->\n <tag-input class=\"tag-input\" secondaryPlaceholder=\"Add a tag and press Enter\" formControlName=\"tags\"\n [modelAsStrings]=\"true\">\n </tag-input>\n </div>\n\n <div *ngIf=\"showErrorMsg\">\n <small class=\"mandatory-label\">\n {{createErrorMsg}}\n </small>\n </div>\n\n <div class=\"start-modal-buttons\">\n <button (click)=\"closeModal('discard');logTelemetry($event)\" mat-raised-button type=\"button\"\n class=\"df-btn df-btn-normal df-cancel-btn\" id=\"discard-discussion-start-form\">Cancel\n </button>\n <span *ngIf=\"uploadSaveData\">\n </span>\n <button *ngIf=\"mode !== 'edit'\" type=\"submit\" class=\"df-btn df-btn-normal df-btn-primary df-submit-btn\"\n [ngClass]=\"{'df-btn-disabled': !enableSubmitButton }\" [disabled]=\"!enableSubmitButton\"\n (click)=\"submitPost(startForm);logTelemetry($event)\" id=\"submit-discussion-start-form\">\n <span class=\"text-white\">Submit</span>\n </button>\n <button *ngIf=\"mode === 'edit'\" type=\"submit\" class=\"df-btn df-btn-normal df-btn-primary df-update-btn\"\n [ngClass]=\"{'df-btn-disabled': !enableSubmitButton }\" [disabled]=\"!enableSubmitButton\"\n (click)=\"updatePost(startForm);logTelemetry($event)\" id=\"update-topic-popup\">\n <span class=\"text-white\">Update</span>\n </button>\n </div>\n \u200B\n </form>\n \u200B\n <input type=\"hidden\" i18-value i18-aria-value aria-value=\"Post created successful\"\n value=\"Post created successfully!\" #toastSuccess />\n <input type=\"hidden\" i18-value i18-aria-value aria-value=\"unable to create post\"\n value=\"Error in creating new post!\" #toastError />\n </div>\n </div>\n</div>", styles: ["::ng-deep:root{--df-modal-content-bg: var(--df-common-bg);--df-modal-field-control-bg: var(--df-background);--df-tag-bg:var(--df-e9e8d9);--df-ng-tag-bg: var(--df-background)}.discussion-start-modal{position:fixed;inset:0;background:#000c;z-index:99999;opacity:1;transition:opacity .1s ease-in;pointer-events:auto}.discussion-start-modal .discussion-start-modal-content{max-width:50rem;width:90%;position:relative;margin:0 auto;padding:1rem;border-radius:.1875rem;background:var(--df-modal-content-bg);color:var(--df-text);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);overflow:auto;max-height:calc(100% - 156px)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-content{margin-bottom:.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-label{display:inline-block;margin-bottom:.5rem;font-size:.8125rem;font-weight:700}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field{position:relative;margin-bottom:0}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .select-category{border:.0625rem solid var(--gray-200);color:var(--df-text);margin:0 .5rem;padding:.5rem .25rem;background:var(--df-field-control-bg)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control{background-color:var(--df-modal-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;width:96%;cursor:pointer;outline:none;padding:.5rem .875rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control:focus,.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-form-field .start-form-field-control .active{border-color:var(--primary-400)!important}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .mandatory-label{font-size:.75rem;color:var(--red-100)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons{float:right}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-submit-btn,.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-update-btn{margin-left:.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-cancel-btn{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;border:0;margin:0 .5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-modal-buttons .df-btn-disabled{background-color:var(--gray-100)}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-tags{margin-bottom:1.5rem}.discussion-start-modal .discussion-start-modal-content .discussion-start-form .start-tags label{display:inline-block;font-size:.8125rem;font-weight:700;margin-bottom:0}#myModal{display:block;opacity:2!important}::ng-deep .ng2-tag-input{border:.0625rem solid var(--gray-200)!important;color:var(--df-text)!important;display:block;font-size:.8125rem!important;max-width:100%;padding:.25rem .5rem;margin:.5rem 0;background:var(--df-field-control-bg);border-radius:.1875rem;border-bottom:.0625rem solid var(--gray-200)!important}::ng-deep .ng2-tag-input--focused{border-color:var(--primary-400)!important}::ng-deep .ng2-tag-input__text-input{height:2.25rem;margin:0 .5rem;color:var(--df-text);background:var(--df-ng-tag-bg)}::ng-deep .ng2-tag-input.active{border-color:var(--primary-400)!important}::ng-deep tag{background:var(--df-tag-bg)!important;color:var(--df-text)!important}::ng-deep tag:first-child{margin-left:.5rem!important}\n"] }]
2205
+ }], ctorParameters: function () { return [{ type: DiscussionService }, { type: i2$1.UntypedFormBuilder }, { type: TelemetryUtilsService }, { type: ConfigService }, { type: DiscussUtilsService }]; }, propDecorators: { categoryId: [{
2206
+ type: Input
2207
+ }], topicData: [{
2208
+ type: Input
2209
+ }], mode: [{
2210
+ type: Input
2211
+ }], close: [{
2212
+ type: Output
2213
+ }] } });
2214
+
2215
+ /* tslint:enable */
2216
+ class DiscussHomeComponent {
2217
+ constructor(router, route, discussionService, configService, telemetryUtils, navigationService) {
2218
+ this.router = router;
2219
+ this.route = route;
2220
+ this.discussionService = discussionService;
2221
+ this.configService = configService;
2222
+ this.telemetryUtils = telemetryUtils;
2223
+ this.navigationService = navigationService;
2224
+ this.stateChange = new EventEmitter();
2225
+ this.discussionList = [];
2226
+ this.showStartDiscussionModal = false;
2227
+ // categoryId: string;
2228
+ this.isTopicCreator = false;
2229
+ this.showLoader = false;
2230
+ this.currentActivePage = 1;
2231
+ this.pagination = Object.create({});
2232
+ // Input parameters for infinite scroll
2233
+ this.InfiniteScrollConfig = {
2234
+ modalScrollDistance: 2,
2235
+ modalScrollThrottle: 50
2236
+ };
2237
+ // Input parameters for infinite scroll
2238
+ this.modalScrollDistance = -12;
2239
+ this.modalScrollThrottle = 500;
2240
+ this.scrollUpDistance = 5;
2241
+ this.currentPage = 0;
2242
+ }
2243
+ ngOnInit() {
2244
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.HOME);
2245
+ this.route.params.subscribe(params => {
2246
+ this.configService.setCategoryId.subscribe((categoryIds) => {
2247
+ this.routeParams = categoryIds;
2248
+ // categoryIds = this.discussionService.getContext(CONTEXT_PROPS.cid)
2249
+ categoryIds = this.categoryId ? this.categoryId : categoryIds;
2250
+ this.getDiscussionList(categoryIds);
2251
+ });
2252
+ this.routeParams = params;
2253
+ this.categoryId = this.discussionService.getContext(CONTEXT_PROPS.cid);
2254
+ // this.getDiscussionList(_.get(this.routeParams, 'slug'));
2255
+ });
2256
+ }
2257
+ /**
2258
+ * @description - set the scroll container height
2259
+ */
2260
+ ngAfterViewChecked() {
2261
+ if (this.elementView && this.elementView.nativeElement && !this.elementView.nativeElement.style.height) {
2262
+ // the number 10 is just a random value to reduce the height of the parent container to the infinite scroll
2263
+ this.elementView.nativeElement.style.height = (this.elementView.nativeElement.clientHeight - 10) + 'px';
2264
+ }
2265
+ }
2266
+ navigateToDiscussionDetails(discussionData) {
2267
+ const matchedTopic = _.find(this.telemetryUtils.getContext(), { type: 'Topic' });
2268
+ if (matchedTopic) {
2269
+ this.telemetryUtils.deleteContext(matchedTopic);
2270
+ }
2271
+ this.telemetryUtils.uppendContext({
2272
+ id: _.get(discussionData, 'tid'),
2273
+ type: 'Topic'
2274
+ });
2275
+ let routerSlug = this.configService.getConfig().routerSlug ? this.configService.getConfig().routerSlug : '';
2276
+ let input = { data: { url: `${routerSlug}${ROUTES.TOPIC}${_.trim(_.get(discussionData, 'slug'))}`, queryParams: {}, tid: discussionData.tid, title: discussionData.title }, action: CATEGORY_DETAILS };
2277
+ this.navigationService.navigate(input);
2278
+ this.stateChange.emit({ tid: discussionData.tid, title: discussionData.title, action: this.categoryHomeAction });
2279
+ }
2280
+ /**
2281
+ * @description - To get all the topics
2282
+ * @param - required cid as a slug
2283
+ */
2284
+ getDiscussionList(slug) {
2285
+ this.showLoader = true;
2286
+ const scrollIndex = this.pagination.currentPage ? this.pagination.currentPage : 1;
2287
+ this.discussionService.getContextBasedTopic(slug, scrollIndex).subscribe(data => {
2288
+ this.pagination = data.pagination;
2289
+ this.showLoader = false;
2290
+ this.isTopicCreator = _.get(data, 'privileges.topics:create') === true ? true : false;
2291
+ this.discussionList = [...this.discussionList, ...(_.union(_.get(data, 'topics'), _.get(data, 'children')))];
2292
+ }, error => {
2293
+ this.showLoader = false;
2294
+ // error code check
2295
+ this.discussionService.showTrafficAlert(error);
2296
+ // TODO: Toaster
2297
+ console.log('error fetching topic list', error);
2298
+ });
2299
+ }
2300
+ startDiscussion() {
2301
+ this.showStartDiscussionModal = true;
2302
+ }
2303
+ logTelemetry(event) {
2304
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.HOME);
2305
+ }
2306
+ closeModal(event) {
2307
+ if (_.get(event, 'message') === 'success') {
2308
+ this.discussionList = [];
2309
+ this.pagination.currentPage = this.pagination.first.page;
2310
+ this.getDiscussionList(_.get(this.routeParams, 'slug'));
2311
+ }
2312
+ this.showStartDiscussionModal = false;
2313
+ }
2314
+ /**
2315
+ * @description - call the topic get api when scrolled down
2316
+ */
2317
+ onModalScrollDown() {
2318
+ if (this.pagination.currentPage !== this.pagination.pageCount) {
2319
+ this.pagination.currentPage = this.pagination.next.page;
2320
+ this.getDiscussionList(_.get(this.routeParams, 'slug'));
2321
+ }
2322
+ }
2323
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussHomeComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: DiscussionService }, { token: ConfigService }, { token: TelemetryUtilsService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
2324
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussHomeComponent, selector: "lib-discuss-home", inputs: { categoryId: "categoryId", categoryHomeAction: "categoryHomeAction" }, outputs: { stateChange: "stateChange" }, viewQueries: [{ propertyName: "elementView", first: true, predicate: ["scrollContainerHeight"], descendants: true }], ngImport: i0, template: "<button *ngIf=\"isTopicCreator\" (click)=\"startDiscussion();logTelemetry($event)\" role=\"link\" tabindex=\"0\"\n class=\"df-btn df-btn-normal df-btn-primary df-start-btn\" data-toggle=\"modal\" data-target=\"#myModal\" data-backdrop=\"static\" data-keyboard=\"false\"\n id=\"start-discussion\">Start Discussion</button>\n<div *ngIf=\"discussionList && discussionList.length > 0\" class=\"topic-list-container\" id=\"topic-scroll\" #scrollContainerHeight>\n <div [infiniteScrollContainer]=\"'.topic-list-container'\" infinite-scroll class=\"infinite-scroll\"\n [scrollWindow]=\"false\" [infiniteScrollDistance]=\"InfiniteScrollConfig.modalScrollDistance\" [fromRoot]=\"true\"\n [infiniteScrollThrottle]=\"InfiniteScrollConfig.modalScrollThrottle\" (scrolled)=\"onModalScrollDown()\">\n <div *ngFor=\"let discussionData of discussionList\"\n (click)=\"navigateToDiscussionDetails(discussionData);logTelemetry($event)\" id=\"topic-card\">\n <lib-discuss-card [discussionData]=\"discussionData\"></lib-discuss-card>\n </div>\n </div>\n</div>\n<ng-container *ngIf=\"!(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" id=\"topic-card\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n</ng-container>\n<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<lib-discuss-start [categoryId]=\"categoryId\" (close)=\"closeModal($event)\" *ngIf=\"showStartDiscussionModal\">\n</lib-discuss-start>", styles: [".df-start-btn{margin-bottom:1rem}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiscussCardComponent, selector: "lib-discuss-card", inputs: ["discussionData"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }, { kind: "directive", type: i9.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "component", type: DiscussStartComponent, selector: "lib-discuss-start", inputs: ["categoryId", "topicData", "mode"], outputs: ["close"] }] }); }
2325
+ }
2326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussHomeComponent, decorators: [{
2327
+ type: Component,
2328
+ args: [{ selector: 'lib-discuss-home', template: "<button *ngIf=\"isTopicCreator\" (click)=\"startDiscussion();logTelemetry($event)\" role=\"link\" tabindex=\"0\"\n class=\"df-btn df-btn-normal df-btn-primary df-start-btn\" data-toggle=\"modal\" data-target=\"#myModal\" data-backdrop=\"static\" data-keyboard=\"false\"\n id=\"start-discussion\">Start Discussion</button>\n<div *ngIf=\"discussionList && discussionList.length > 0\" class=\"topic-list-container\" id=\"topic-scroll\" #scrollContainerHeight>\n <div [infiniteScrollContainer]=\"'.topic-list-container'\" infinite-scroll class=\"infinite-scroll\"\n [scrollWindow]=\"false\" [infiniteScrollDistance]=\"InfiniteScrollConfig.modalScrollDistance\" [fromRoot]=\"true\"\n [infiniteScrollThrottle]=\"InfiniteScrollConfig.modalScrollThrottle\" (scrolled)=\"onModalScrollDown()\">\n <div *ngFor=\"let discussionData of discussionList\"\n (click)=\"navigateToDiscussionDetails(discussionData);logTelemetry($event)\" id=\"topic-card\">\n <lib-discuss-card [discussionData]=\"discussionData\"></lib-discuss-card>\n </div>\n </div>\n</div>\n<ng-container *ngIf=\"!(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" id=\"topic-card\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n</ng-container>\n<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<lib-discuss-start [categoryId]=\"categoryId\" (close)=\"closeModal($event)\" *ngIf=\"showStartDiscussionModal\">\n</lib-discuss-start>", styles: [".df-start-btn{margin-bottom:1rem}\n"] }]
2329
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: DiscussionService }, { type: ConfigService }, { type: TelemetryUtilsService }, { type: NavigationServiceService }]; }, propDecorators: { categoryId: [{
2330
+ type: Input
2331
+ }], categoryHomeAction: [{
2332
+ type: Input
2333
+ }], stateChange: [{
2334
+ type: Output
2335
+ }], elementView: [{
2336
+ type: ViewChild,
2337
+ args: ['scrollContainerHeight']
2338
+ }] } });
2339
+
2340
+ /* tslint:enable */
2341
+ class DiscussCategoryComponent {
2342
+ constructor(discussService, configService, router, activatedRoute, telemetryUtils, navigationService) {
2343
+ this.discussService = discussService;
2344
+ this.configService = configService;
2345
+ this.router = router;
2346
+ this.activatedRoute = activatedRoute;
2347
+ this.telemetryUtils = telemetryUtils;
2348
+ this.navigationService = navigationService;
2349
+ this.categories = [];
2350
+ this.stateChange = new EventEmitter();
2351
+ this.pageId = 0;
2352
+ this.isTopicCreator = false;
2353
+ this.showStartDiscussionModal = false;
2354
+ this.showLoader = false;
2355
+ }
2356
+ ngOnInit() {
2357
+ /** It will look for the queryParams, if back button is clicked,
2358
+ * the queryParams will change and it will fetch the categories
2359
+ * if there is no queryParams available, then it will fetch the default categories of the forumIds
2360
+ */
2361
+ this.telemetryUtils.setContext([]);
2362
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.CATEGORY);
2363
+ this.forumIds = this.categoryIds ? this.categoryIds : this.discussService.forumIds;
2364
+ this.paramsSubscription = this.activatedRoute.queryParams.subscribe((params) => {
2365
+ if (_.get(params, 'cid')) {
2366
+ this.navigateToDiscussionPage(_.get(params, 'cid'));
2367
+ }
2368
+ else {
2369
+ this.categories = [];
2370
+ if (this.forumIds.length) {
2371
+ this.fetchAllAvailableCategories(this.forumIds);
2372
+ }
2373
+ else {
2374
+ this.fetchAllCategories();
2375
+ }
2376
+ }
2377
+ });
2378
+ }
2379
+ fetchAllAvailableCategories(ids) {
2380
+ this.showLoader = true;
2381
+ ids.forEach((cid) => {
2382
+ this.fetchCategory(cid).subscribe(data => {
2383
+ this.showLoader = false;
2384
+ this.categories.push(data);
2385
+ }, error => {
2386
+ // TODO: Toast error
2387
+ // error code check
2388
+ this.discussService.showTrafficAlert(error);
2389
+ console.log('issue fetching category', error);
2390
+ this.showLoader = false;
2391
+ });
2392
+ });
2393
+ }
2394
+ fetchAllCategories() {
2395
+ this.showLoader = true;
2396
+ this.discussService.fetchAllCategories().subscribe(data => {
2397
+ this.showLoader = false;
2398
+ this.categories = data;
2399
+ }, error => {
2400
+ // TODO: Toast error
2401
+ // error code check
2402
+ this.discussService.showTrafficAlert(error);
2403
+ console.log('issue fetching category', error);
2404
+ this.showLoader = false;
2405
+ });
2406
+ }
2407
+ fetchCategory(cid) {
2408
+ return this.discussService.fetchSingleCategoryDetails(cid);
2409
+ }
2410
+ /**
2411
+ * It will fetch the children for each category click.
2412
+ * if there is no children available the it will redirect to the topic list page
2413
+ */
2414
+ navigateToDiscussionPage(cid, slug) {
2415
+ this.showLoader = true;
2416
+ this.telemetryUtils.uppendContext({ id: cid, type: 'Category' });
2417
+ this.discussService.fetchSingleCategoryDetails(cid).subscribe(response => {
2418
+ this.showLoader = false;
2419
+ this.categoryId = _.get(response, 'cid');
2420
+ this.isTopicCreator = _.get(response, 'privileges.topics:create') === true ? true : false;
2421
+ this.showStartDiscussionModal = false;
2422
+ let input;
2423
+ if (_.get(response, 'children').length > 0) {
2424
+ this.router.navigate([], { relativeTo: this.activatedRoute.parent, queryParams: { cid: this.categoryId } });
2425
+ // input = { data: { url: '', queryParams: { cid: this.categoryId } }, action: this.categoryAction}
2426
+ // this.navigationService.navigate(input)
2427
+ _.get(response, 'children').forEach(subCategoryData => {
2428
+ this.categories.push(subCategoryData);
2429
+ });
2430
+ }
2431
+ else {
2432
+ this.discussService.setContext(CONTEXT_PROPS.cid, this.categoryId);
2433
+ this.configService.setCategoryid(this.categoryId);
2434
+ let routerSlug = this.configService.getConfig().routerSlug ? this.configService.getConfig().routerSlug : '';
2435
+ input = { data: { url: `${routerSlug}${ROUTES.CATEGORY}${this.categoryId}`, queryParams: {} }, action: CATEGORY_HOME, };
2436
+ this.navigationService.navigate(input);
2437
+ this.stateChange.emit({ action: this.categoryAction, categoryId: this.categoryId });
2438
+ }
2439
+ }, error => {
2440
+ // error code check
2441
+ this.discussService.showTrafficAlert(error);
2442
+ this.showLoader = false;
2443
+ // TODO: Toast error
2444
+ console.log('issue fetching category', error);
2445
+ });
2446
+ }
2447
+ startDiscussion() {
2448
+ this.showStartDiscussionModal = true;
2449
+ }
2450
+ closeModal(event) {
2451
+ this.showStartDiscussionModal = false;
2452
+ }
2453
+ logTelemetry(event) {
2454
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.CATEGORY);
2455
+ }
2456
+ ;
2457
+ ngOnDestroy() {
2458
+ if (this.paramsSubscription) {
2459
+ this.paramsSubscription.unsubscribe();
2460
+ }
2461
+ }
2462
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussCategoryComponent, deps: [{ token: DiscussionService }, { token: ConfigService }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: TelemetryUtilsService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
2463
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussCategoryComponent, selector: "lib-discuss-category", inputs: { categoryIds: "categoryIds", categoryAction: "categoryAction" }, outputs: { stateChange: "stateChange" }, ngImport: i0, template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n <button (click)=\"startDiscussion();logTelemetry($event)\" *ngIf=\"isTopicCreator\" class=\"df-btn df-btn-primary df-btn-normal mb-16\" id=\"start-discussion\">Start Discussion</button>\n <div class=\"discuss-category-cards\">\n <ng-container *ngFor=\"let data of categories\">\n <div (click)=\"navigateToDiscussionPage(data?.cid, data?.slug);logTelemetry($event)\" class=\"categories-card-content\" id=\"category-card\">\n <lib-category-card [category]=\"data\" ></lib-category-card>\n </div>\n </ng-container>\n </div>\n\n <lib-discuss-start (close)=\"closeModal($event)\" [categoryId]=\"categoryId\" *ngIf=\"showStartDiscussionModal\" ></lib-discuss-start>\n", styles: [".discuss-category-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(292px,1fr));grid-gap:1.5rem;margin-bottom:1.5rem;cursor:pointer;position:relative;z-index:unset}@media (max-width: 700px){.discuss-category-cards{grid-template-columns:1fr}}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CategoryCardComponent, selector: "lib-category-card", inputs: ["category"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }, { kind: "component", type: DiscussStartComponent, selector: "lib-discuss-start", inputs: ["categoryId", "topicData", "mode"], outputs: ["close"] }] }); }
2464
+ }
2465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussCategoryComponent, decorators: [{
2466
+ type: Component,
2467
+ args: [{ selector: 'lib-discuss-category', template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n <button (click)=\"startDiscussion();logTelemetry($event)\" *ngIf=\"isTopicCreator\" class=\"df-btn df-btn-primary df-btn-normal mb-16\" id=\"start-discussion\">Start Discussion</button>\n <div class=\"discuss-category-cards\">\n <ng-container *ngFor=\"let data of categories\">\n <div (click)=\"navigateToDiscussionPage(data?.cid, data?.slug);logTelemetry($event)\" class=\"categories-card-content\" id=\"category-card\">\n <lib-category-card [category]=\"data\" ></lib-category-card>\n </div>\n </ng-container>\n </div>\n\n <lib-discuss-start (close)=\"closeModal($event)\" [categoryId]=\"categoryId\" *ngIf=\"showStartDiscussionModal\" ></lib-discuss-start>\n", styles: [".discuss-category-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(292px,1fr));grid-gap:1.5rem;margin-bottom:1.5rem;cursor:pointer;position:relative;z-index:unset}@media (max-width: 700px){.discuss-category-cards{grid-template-columns:1fr}}\n"] }]
2468
+ }], ctorParameters: function () { return [{ type: DiscussionService }, { type: ConfigService }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: TelemetryUtilsService }, { type: NavigationServiceService }]; }, propDecorators: { categoryIds: [{
2469
+ type: Input
2470
+ }], categoryAction: [{
2471
+ type: Input
2472
+ }], stateChange: [{
2473
+ type: Output
2474
+ }] } });
2475
+
2476
+ /* tslint:enable */
2477
+ class DiscussTagsComponent {
2478
+ constructor(discussionService, telemetryUtils, router, activatedRoute, configService, discussUtils, navigationService) {
2479
+ this.discussionService = discussionService;
2480
+ this.telemetryUtils = telemetryUtils;
2481
+ this.router = router;
2482
+ this.activatedRoute = activatedRoute;
2483
+ this.configService = configService;
2484
+ this.discussUtils = discussUtils;
2485
+ this.navigationService = navigationService;
2486
+ this.stateChange = new EventEmitter();
2487
+ this.showLoader = false;
2488
+ }
2489
+ ngOnInit() {
2490
+ this.telemetryUtils.setContext([]);
2491
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.TAGS);
2492
+ this.cIds = this.configService.getCategories();
2493
+ if (this.configService.hasContext()) {
2494
+ this.getContextBasedTags(this.cIds.result);
2495
+ }
2496
+ else {
2497
+ this.fetchAllTags();
2498
+ }
2499
+ }
2500
+ fetchAllTags() {
2501
+ this.showLoader = true;
2502
+ this.discussionService.fetchAllTag().subscribe(data => {
2503
+ this.showLoader = false;
2504
+ this.filteredTags = _.get(data, 'tags');
2505
+ }, error => {
2506
+ this.showLoader = false;
2507
+ // TODO: toaster
2508
+ console.log('error fetching tags');
2509
+ });
2510
+ }
2511
+ getContextBasedTags(cid) {
2512
+ const req = {
2513
+ cids: cid
2514
+ };
2515
+ this.showLoader = true;
2516
+ this.discussionService.contextBasedTags(req).subscribe(data => {
2517
+ this.showLoader = false;
2518
+ this.filteredTags = _.get(data, 'result');
2519
+ }, error => {
2520
+ this.showLoader = false;
2521
+ // TODO: toaster
2522
+ console.log('error fetching tags');
2523
+ });
2524
+ }
2525
+ getBgColor(tagTitle) {
2526
+ const bgColor = this.discussUtils.stringToColor(tagTitle.toLowerCase());
2527
+ const color = this.discussUtils.getContrast();
2528
+ return { color, 'background-color': bgColor };
2529
+ }
2530
+ getAllDiscussions(tag) {
2531
+ this.queryParam = tag.value;
2532
+ const tagdata = {
2533
+ tagname: ''
2534
+ };
2535
+ tagdata.tagname = tag.value;
2536
+ this.queryParam = tagdata;
2537
+ const routerSlug = this.configService.getConfig().routerSlug ? this.configService.getConfig().routerSlug : '';
2538
+ const input = { data: { url: `${routerSlug}${ROUTES.TAG}tag-discussions`,
2539
+ queryParams: this.queryParam, tagName: this.queryParam.tagName }, action: 'tagsAll' };
2540
+ this.navigationService.navigate(input);
2541
+ this.stateChange.emit({ action: TAG_ALL_DISCUSS, title: tag.value, tid: 'sd' });
2542
+ // tslint:disable-next-line: max-line-length
2543
+ // this.router.navigate([`${this.configService.getRouterSlug()}${CONSTANTS.ROUTES.TAG}tag-discussions`], { queryParams: this.queryParam });
2544
+ }
2545
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussTagsComponent, deps: [{ token: DiscussionService }, { token: TelemetryUtilsService }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: ConfigService }, { token: DiscussUtilsService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
2546
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussTagsComponent, selector: "lib-discuss-tags", outputs: { stateChange: "stateChange" }, ngImport: i0, template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<div class=\"flex flex-1 margin-top-m flex-column discussion-tag-content\">\n <ng-container *ngIf=\"filteredTags && filteredTags.length > 0\">\n <div class=\"tags\">\n <div *ngFor=\"let tag of filteredTags \" class=\"tag\" [ngStyle]=\"getBgColor(tag.value)\"\n (click)=\"getAllDiscussions(tag)\">\n <!-- Can enable random colors from below commented code -->\n <!-- <div *ngFor=\"let tag of filteredTags | pipeFilter:'score,value':query\"\n class=\"tag text-capitalize\" [ngStyle]=\"getBgColor(tag.value)\"> -->\n <span class=\"margin-left-m\">{{tag.value}}</span>\n <span class=\"ws-mat-default-text count\">{{tag.score}}</span>\n </div>\n </div>\n </ng-container>\n</div>\n\u200B\n\u200B\n<div class=\"tag-empty-container\" *ngIf=\"!showLoader && !filteredTags.length\">\n <div class=\"tag-empty-img\"><img src=\"./assets/discussion-ui/images/empty.svg\" alt=\"empty image\"></div>\n <label class=\"tag-empty-label\">No tags Available !</label>\n <p class=\"tag-empty-text\">Stay tuned ! we will be updating our tags library and add them here</p>\n</div>\n", styles: ["::ng-deep:root{--df-tag-empty-bg:var(--df-common-bg)}.sb-search-box{display:flex;align-items:center;border:0px}.sb-search-box .sb-search-input{width:100%;font-size:.875rem;min-height:2rem;outline:0;border-radius:0;line-height:normal;background:none;padding:1em;border-radius:.25rem;border:0px}.search-icon{width:1.125rem;height:1.125rem;margin:1rem 0rem 1rem 1rem}.sb-search-box .input-div{border-radius:1.5rem;background:var(--white);display:flex;align-items:center;border:.0625rem solid var(--gray-100);width:100%}.sb-search-box .input-div:hover{border-color:var(--primary)}.tag{cursor:pointer}@media (max-width: 768px){.discuss-tags{flex-direction:column}}.tag-empty-container{background:var(--white);background:var(--df-tag-empty-bg);color:var(--df-text);display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:1.5rem;height:100%;border-radius:.25rem;min-height:28.125rem}.tag-empty-container .tag-empty-img{width:100%;max-width:13.875rem}.tag-empty-container .tag-empty-label{font-size:.875rem;font-weight:700;margin:1.5rem 0 .75rem;color:var(--black)!important}.tag-empty-container .tag-empty-text{font-size:.875rem;font-weight:400;text-align:center;color:var(--black)!important}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }] }); }
2547
+ }
2548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussTagsComponent, decorators: [{
2549
+ type: Component,
2550
+ args: [{ selector: 'lib-discuss-tags', template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<div class=\"flex flex-1 margin-top-m flex-column discussion-tag-content\">\n <ng-container *ngIf=\"filteredTags && filteredTags.length > 0\">\n <div class=\"tags\">\n <div *ngFor=\"let tag of filteredTags \" class=\"tag\" [ngStyle]=\"getBgColor(tag.value)\"\n (click)=\"getAllDiscussions(tag)\">\n <!-- Can enable random colors from below commented code -->\n <!-- <div *ngFor=\"let tag of filteredTags | pipeFilter:'score,value':query\"\n class=\"tag text-capitalize\" [ngStyle]=\"getBgColor(tag.value)\"> -->\n <span class=\"margin-left-m\">{{tag.value}}</span>\n <span class=\"ws-mat-default-text count\">{{tag.score}}</span>\n </div>\n </div>\n </ng-container>\n</div>\n\u200B\n\u200B\n<div class=\"tag-empty-container\" *ngIf=\"!showLoader && !filteredTags.length\">\n <div class=\"tag-empty-img\"><img src=\"./assets/discussion-ui/images/empty.svg\" alt=\"empty image\"></div>\n <label class=\"tag-empty-label\">No tags Available !</label>\n <p class=\"tag-empty-text\">Stay tuned ! we will be updating our tags library and add them here</p>\n</div>\n", styles: ["::ng-deep:root{--df-tag-empty-bg:var(--df-common-bg)}.sb-search-box{display:flex;align-items:center;border:0px}.sb-search-box .sb-search-input{width:100%;font-size:.875rem;min-height:2rem;outline:0;border-radius:0;line-height:normal;background:none;padding:1em;border-radius:.25rem;border:0px}.search-icon{width:1.125rem;height:1.125rem;margin:1rem 0rem 1rem 1rem}.sb-search-box .input-div{border-radius:1.5rem;background:var(--white);display:flex;align-items:center;border:.0625rem solid var(--gray-100);width:100%}.sb-search-box .input-div:hover{border-color:var(--primary)}.tag{cursor:pointer}@media (max-width: 768px){.discuss-tags{flex-direction:column}}.tag-empty-container{background:var(--white);background:var(--df-tag-empty-bg);color:var(--df-text);display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:1.5rem;height:100%;border-radius:.25rem;min-height:28.125rem}.tag-empty-container .tag-empty-img{width:100%;max-width:13.875rem}.tag-empty-container .tag-empty-label{font-size:.875rem;font-weight:700;margin:1.5rem 0 .75rem;color:var(--black)!important}.tag-empty-container .tag-empty-text{font-size:.875rem;font-weight:400;text-align:center;color:var(--black)!important}\n"] }]
2551
+ }], ctorParameters: function () { return [{ type: DiscussionService }, { type: TelemetryUtilsService }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: ConfigService }, { type: DiscussUtilsService }, { type: NavigationServiceService }]; }, propDecorators: { stateChange: [{
2552
+ type: Output
2553
+ }] } });
2554
+
2555
+ /* tslint:enable */
2556
+ class MyDiscussionComponent {
2557
+ constructor(discussService, configService, router, telemetryUtils) {
2558
+ this.discussService = discussService;
2559
+ this.configService = configService;
2560
+ this.router = router;
2561
+ this.telemetryUtils = telemetryUtils;
2562
+ this.discussionList = []; // this is for posts
2563
+ this.currentFilter = 'timestamp';
2564
+ this.userInitial = '';
2565
+ this.showLoader = false;
2566
+ this.pagination = Object.create({});
2567
+ // Input parameters for infinite scroll
2568
+ this.InfiniteScrollConfig = {
2569
+ modalScrollDistance: 2,
2570
+ modalScrollThrottle: 50
2571
+ };
2572
+ }
2573
+ /** To fetch user details */
2574
+ fetchUserProfile(userName) {
2575
+ this.discussService.fetchUserProfile(userName).subscribe(response => {
2576
+ this.showLoader = false;
2577
+ console.log(response);
2578
+ this.data = response;
2579
+ if (_.get(this.data, 'posts')) {
2580
+ this.discussionList = _.get(this.data, 'posts').filter(p => (p.isMainPost === true));
2581
+ }
2582
+ // if (this.configSvc.userProfile) {
2583
+ // localStorage.setItem(this.configSvc.userProfile.userId, this.profilePhoto);
2584
+ // }
2585
+ }, error => {
2586
+ this.showLoader = false;
2587
+ // error code check
2588
+ this.discussService.showTrafficAlert(error);
2589
+ // TODO: Toaster
2590
+ console.log('error fetching user details');
2591
+ });
2592
+ }
2593
+ ngOnInit() {
2594
+ this.telemetryUtils.setContext([]);
2595
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.MY_DISCUSSION);
2596
+ this.filter(this.currentFilter, false);
2597
+ }
2598
+ /**
2599
+ * @description - set the scroll container height
2600
+ */
2601
+ ngAfterViewChecked() {
2602
+ if (this.elementView && this.elementView.nativeElement && !this.elementView.nativeElement.style.height) {
2603
+ // the number 10 is just a random value to reduce the height of the parent container to the infinite scroll
2604
+ this.elementView.nativeElement.style.height = (this.elementView.nativeElement.clientHeight - 10) + 'px';
2605
+ }
2606
+ }
2607
+ /**
2608
+ * @param {string|'timestamp'|'best'|'saved'|'watched'|'upvoted'|'downvoted'} key
2609
+ * @param {boolean} resetpagination - its used to reset the pagination value based on the filter data
2610
+ */
2611
+ filter(key, resetpagination) {
2612
+ this.currentFilter = key;
2613
+ if (key) {
2614
+ // reset the currentpage value to 1 and reset the discussionList data based on the respective api response when the filter is changed
2615
+ if (resetpagination) {
2616
+ this.discussionList = [];
2617
+ this.pagination.currentPage = 1;
2618
+ }
2619
+ // setting the current page index
2620
+ const scrollIndex = this.pagination.currentPage ? this.pagination.currentPage : 1;
2621
+ this.showLoader = true;
2622
+ switch (key) {
2623
+ case 'timestamp':
2624
+ this.getRecentTopics(scrollIndex);
2625
+ break;
2626
+ case 'best':
2627
+ // this.discussionList = _.uniqBy(this.data.bestPosts, 'tid');
2628
+ this.discussService.fetchBestPost(scrollIndex).subscribe(result => {
2629
+ if (result) {
2630
+ const bestPost = result['posts'].filter(p => (p.isMainPost === true));
2631
+ this.discussionList = [...this.discussionList, ...bestPost];
2632
+ this.pagination = _.get(result, 'pagination');
2633
+ this.showLoader = false;
2634
+ }
2635
+ else {
2636
+ this.showLoader = false;
2637
+ this.discussionList = [];
2638
+ }
2639
+ }, error => {
2640
+ // error code check
2641
+ this.discussService.showTrafficAlert(error);
2642
+ });
2643
+ break;
2644
+ case 'saved':
2645
+ this.discussService.fetchSaved(scrollIndex).subscribe(response => {
2646
+ if (response) {
2647
+ // this.discussionList = _.uniqBy(response['posts'], 'tid');
2648
+ this.discussionList = [...this.discussionList, ...response['posts']];
2649
+ this.pagination = _.get(response, 'pagination');
2650
+ this.showLoader = false;
2651
+ }
2652
+ else {
2653
+ this.showLoader = false;
2654
+ this.discussionList = [];
2655
+ }
2656
+ },
2657
+ // tslint:disable-next-line
2658
+ (error) => {
2659
+ // error code check
2660
+ this.discussService.showTrafficAlert(error);
2661
+ this.discussionList = [];
2662
+ });
2663
+ break;
2664
+ case 'watched':
2665
+ this.showLoader = false;
2666
+ this.discussionList = [];
2667
+ break;
2668
+ case 'upvoted':
2669
+ this.discussService.fetchUpvoted(scrollIndex).subscribe(response => {
2670
+ if (response) {
2671
+ // this.discussionList = _.uniqBy(response['posts'], 'tid');
2672
+ const upvoted = response['posts'].filter(p => (p.isMainPost === true));
2673
+ this.pagination = _.get(response, 'pagination');
2674
+ this.discussionList = [...this.discussionList, ...upvoted];
2675
+ this.showLoader = false;
2676
+ }
2677
+ else {
2678
+ this.showLoader = false;
2679
+ this.discussionList = [];
2680
+ }
2681
+ },
2682
+ // tslint:disable-next-line
2683
+ (error) => {
2684
+ this.discussionList = [];
2685
+ // error code check
2686
+ this.discussService.showTrafficAlert(error);
2687
+ });
2688
+ break;
2689
+ case 'downvoted':
2690
+ this.discussService.fetchDownvoted(scrollIndex).subscribe(response => {
2691
+ if (response) {
2692
+ // this.discussionList = _.uniqBy(response['posts'], 'tid');
2693
+ const downvoted = response['posts'].filter(p => (p.isMainPost === true));
2694
+ this.discussionList = [...this.discussionList, ...downvoted];
2695
+ this.pagination = _.get(response, 'pagination');
2696
+ this.showLoader = false;
2697
+ }
2698
+ else {
2699
+ this.showLoader = false;
2700
+ this.discussionList = [];
2701
+ }
2702
+ },
2703
+ // tslint:disable-next-line
2704
+ (error) => {
2705
+ this.discussionList = [];
2706
+ // error code check
2707
+ this.discussService.showTrafficAlert(error);
2708
+ });
2709
+ break;
2710
+ default:
2711
+ // this.discussionList = _.uniqBy(this.data.latestPosts, 'tid');
2712
+ this.pagination = _.get(this.data, 'pagination');
2713
+ this.discussionList = _.get(this.data, 'latestPosts');
2714
+ break;
2715
+ }
2716
+ }
2717
+ }
2718
+ navigateToDiscussionDetails(discussionData) {
2719
+ console.log('discussionData', discussionData);
2720
+ const slug = _.get(discussionData, 'slug') || _.get(discussionData, 'topic.slug');
2721
+ this.router.navigate([`${this.configService.getRouterSlug()}${ROUTES.TOPIC}${slug}`]);
2722
+ }
2723
+ logTelemetry(event) {
2724
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.MY_DISCUSSION);
2725
+ }
2726
+ /**
2727
+ * @description - getting the recent post data
2728
+ * @param {number} scrollIndex
2729
+ */
2730
+ getRecentTopics(scrollIndex) {
2731
+ const userId = this.discussService.userId;
2732
+ // const userSlug = this.discussService.userDetails.userslug;
2733
+ combineLatest([
2734
+ this.discussService.fetchUserProfile(userId),
2735
+ this.discussService.fetchRecentPost(scrollIndex)
2736
+ ]).subscribe(result => {
2737
+ console.log('getRecentTopics', result);
2738
+ this.showLoader = false;
2739
+ this.data = _.merge(result[0], result[1]);
2740
+ this.discussionList = [...this.discussionList, ...(_.get(this.data, 'posts'))];
2741
+ this.discussionList = this.discussionList.filter(p => (p.isMainPost === true));
2742
+ this.pagination = _.get(this.data, 'pagination');
2743
+ }, error => {
2744
+ this.showLoader = false;
2745
+ console.log(error);
2746
+ });
2747
+ }
2748
+ /**
2749
+ * @description - call the topic get api when scrolled down and setting the limit of API Call
2750
+ */
2751
+ onModalScrollDown() {
2752
+ if (this.pagination.currentPage !== this.pagination.pageCount) {
2753
+ this.pagination.currentPage = this.pagination.next.page;
2754
+ const resetpagination = false;
2755
+ // using settimeout to avoid the function call before getting the pagination response from api,
2756
+ // because the api is called twice with the same page index
2757
+ setTimeout(() => {
2758
+ this.filter(this.currentFilter, resetpagination);
2759
+ }, 800);
2760
+ }
2761
+ }
2762
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MyDiscussionComponent, deps: [{ token: DiscussionService }, { token: ConfigService }, { token: i1.Router }, { token: TelemetryUtilsService }], target: i0.ɵɵFactoryTarget.Component }); }
2763
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MyDiscussionComponent, selector: "lib-my-discussion", viewQueries: [{ propertyName: "elementView", first: true, predicate: ["scrollContainerHeight"], descendants: true }], ngImport: i0, template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n\n<div class=\"profileCard\">\n <div class=\"profile-card-content\">\n <div class=\"profile-header-image\">\n <div class=\"box-text\">\n <span class=\"box-label\"></span>{{ data?.username | splitInitials }}\n </div>\n </div>\n <div>\n <div class=\"profile-label name\" [innerHTML]=\"data?.username\"></div>\n <div class=\"profile-label department\">{{ department }}</div>\n <div class=\"profile-label location\">{{ location }}</div>\n <div class=\"profile-label email\">{{ data?.email || data?.username }}</div>\n <ng-container>\n <div class=\"my-discuss-topics\">\n <div class=\"my-discuss-topics__content\">\n <div class=\"my-discuss-label\">\n <span class=\"number\">{{ data?.topiccount || 0 }}</span>\n Discussions\n </div>\n <div class=\"post-count-area my-discuss-label\">\n <span class=\"number\">{{ data?.postcount || 0 }}</span>\n Posts\n </div>\n </div>\n <div class=\"text-right\">\n <!-- Enable lated when other user can visit your profile -->\n <!-- <span class=\"noocoments\" mat-card-subtitle>Last online {{data?.lastonline | pipeRelativeTime}}</span> -->\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n\n<ng-container>\n <div class=\"recent-tabs\">\n <div class=\"tabs-content\">\n <div class=\"tabs-filter\">\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'timestamp',\n 'ws-mat-accent-border font-medium': currentFilter !== 'timestamp'\n }\" (click)=\"filter('timestamp', true); logTelemetry($event)\" id=\"recent-post\">\n Recent posts\n </a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'best',\n 'ws-mat-accent-border font-medium': currentFilter !== 'best'\n }\" (click)=\"filter('best', true); logTelemetry($event)\" id=\"best-post\">\n Best posts\n </a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'saved',\n 'ws-mat-accent-border font-medium': currentFilter !== 'saved'\n }\" (click)=\"filter('saved', true); logTelemetry($event)\" id=\"saved-post\">\n Saved posts\n </a>\n <!-- <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option \" [ngClass]=\"{'ws-mat-accent-border-active' : currentFilter === 'watched',\n 'ws-mat-accent-border font-medium':currentFilter !== 'watched'}\" mat-button\n (click)=\"filter('watched')\">\n Watched </a> -->\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'upvoted',\n 'ws-mat-accent-border font-medium': currentFilter !== 'upvoted'\n }\" (click)=\"filter('upvoted', true); logTelemetry($event)\" id=\"upvoted-post\">\n Upvoted\n </a>\n\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'downvoted',\n 'ws-mat-accent-border font-medium': currentFilter !== 'downvoted'\n }\" (click)=\"filter('downvoted', true); logTelemetry($event)\" id=\"downvoted-post\">\n Downvoted\n </a>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"discussionList && discussionList.length > 0\" class=\"topic-list-container\" id=\"topic-scroll\"\n #scrollContainerHeight>\n <!--infinite scroll-->\n <div [infiniteScrollContainer]=\"'.topic-list-container'\" infinite-scroll class=\"infinite-scroll\"\n [scrollWindow]=\"false\" [infiniteScrollDistance]=\"InfiniteScrollConfig.modalScrollDistance\" [fromRoot]=\"true\"\n [infiniteScrollThrottle]=\"InfiniteScrollConfig.modalScrollThrottle\" (scrolled)=\"onModalScrollDown()\">\n <ng-container *ngFor=\"let data of discussionList\">\n <div (click)=\"navigateToDiscussionDetails(data); logTelemetry($event)\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n </div>\n</div>\n\n<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<ng-container *ngIf=\"!(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n</ng-container>", styles: ["::ng-deep:root{--df-box-text:var(--white);--df-profile-bg: var(--primary-400)}.profileCard{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:0;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;width:auto}.profileCard .profile-card-content{display:flex;flex-wrap:wrap}.profileCard .profile-card-content .profile-header-image{display:flex;justify-content:center;align-items:center;width:100%;border-radius:.25rem;max-width:9.5rem;height:8.4375rem;border:.0625rem solid var(--gray-100);margin-right:1.5rem;background:var(--df-profile-bg);text-align:center}.profileCard .profile-card-content .profile-header-image .box-text{font-size:4rem;color:var(--df-box-text);text-transform:uppercase}.profileCard .profile-card-content .profile-header-image .box-text .box-label{color:var(--white);font-size:1rem;line-height:.75rem;letter-spacing:.2625px;text-transform:uppercase}.profileCard .profile-card-content .profile-label{font-weight:700;margin-bottom:.5rem;font-size:.875rem}.profileCard .profile-card-content .name{font-size:1rem}.profileCard .profile-card-content .my-discuss-topics{font-size:.875rem;margin:1rem 0;font-weight:600}.profileCard .profile-card-content .my-discuss-topics__content{display:flex}.profileCard .profile-card-content .my-discuss-topics__content .my-discussion-label{margin:0 .5rem}.profileCard .profile-card-content .my-discuss-topics__content .my-discussion-label .number{color:var(--primary-300)}.profileCard .profile-card-content .my-discuss-topics__content .post-count-area{margin-left:2rem}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiscussCardComponent, selector: "lib-discuss-card", inputs: ["discussionData"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }, { kind: "directive", type: i9.InfiniteScrollDirective, selector: "[infiniteScroll], [infinite-scroll], [data-infinite-scroll]", inputs: ["infiniteScrollDistance", "infiniteScrollUpDistance", "infiniteScrollThrottle", "infiniteScrollDisabled", "infiniteScrollContainer", "scrollWindow", "immediateCheck", "horizontal", "alwaysCallback", "fromRoot"], outputs: ["scrolled", "scrolledUp"] }, { kind: "pipe", type: SplitInitialsPipe, name: "splitInitials" }] }); }
2764
+ }
2765
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MyDiscussionComponent, decorators: [{
2766
+ type: Component,
2767
+ args: [{ selector: 'lib-my-discussion', template: "<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n\n<div class=\"profileCard\">\n <div class=\"profile-card-content\">\n <div class=\"profile-header-image\">\n <div class=\"box-text\">\n <span class=\"box-label\"></span>{{ data?.username | splitInitials }}\n </div>\n </div>\n <div>\n <div class=\"profile-label name\" [innerHTML]=\"data?.username\"></div>\n <div class=\"profile-label department\">{{ department }}</div>\n <div class=\"profile-label location\">{{ location }}</div>\n <div class=\"profile-label email\">{{ data?.email || data?.username }}</div>\n <ng-container>\n <div class=\"my-discuss-topics\">\n <div class=\"my-discuss-topics__content\">\n <div class=\"my-discuss-label\">\n <span class=\"number\">{{ data?.topiccount || 0 }}</span>\n Discussions\n </div>\n <div class=\"post-count-area my-discuss-label\">\n <span class=\"number\">{{ data?.postcount || 0 }}</span>\n Posts\n </div>\n </div>\n <div class=\"text-right\">\n <!-- Enable lated when other user can visit your profile -->\n <!-- <span class=\"noocoments\" mat-card-subtitle>Last online {{data?.lastonline | pipeRelativeTime}}</span> -->\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n</div>\n\n<ng-container>\n <div class=\"recent-tabs\">\n <div class=\"tabs-content\">\n <div class=\"tabs-filter\">\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'timestamp',\n 'ws-mat-accent-border font-medium': currentFilter !== 'timestamp'\n }\" (click)=\"filter('timestamp', true); logTelemetry($event)\" id=\"recent-post\">\n Recent posts\n </a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'best',\n 'ws-mat-accent-border font-medium': currentFilter !== 'best'\n }\" (click)=\"filter('best', true); logTelemetry($event)\" id=\"best-post\">\n Best posts\n </a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'saved',\n 'ws-mat-accent-border font-medium': currentFilter !== 'saved'\n }\" (click)=\"filter('saved', true); logTelemetry($event)\" id=\"saved-post\">\n Saved posts\n </a>\n <!-- <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option \" [ngClass]=\"{'ws-mat-accent-border-active' : currentFilter === 'watched',\n 'ws-mat-accent-border font-medium':currentFilter !== 'watched'}\" mat-button\n (click)=\"filter('watched')\">\n Watched </a> -->\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'upvoted',\n 'ws-mat-accent-border font-medium': currentFilter !== 'upvoted'\n }\" (click)=\"filter('upvoted', true); logTelemetry($event)\" id=\"upvoted-post\">\n Upvoted\n </a>\n\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{\n 'tabs-active': currentFilter === 'downvoted',\n 'ws-mat-accent-border font-medium': currentFilter !== 'downvoted'\n }\" (click)=\"filter('downvoted', true); logTelemetry($event)\" id=\"downvoted-post\">\n Downvoted\n </a>\n </div>\n </div>\n </div>\n</ng-container>\n\n<div *ngIf=\"discussionList && discussionList.length > 0\" class=\"topic-list-container\" id=\"topic-scroll\"\n #scrollContainerHeight>\n <!--infinite scroll-->\n <div [infiniteScrollContainer]=\"'.topic-list-container'\" infinite-scroll class=\"infinite-scroll\"\n [scrollWindow]=\"false\" [infiniteScrollDistance]=\"InfiniteScrollConfig.modalScrollDistance\" [fromRoot]=\"true\"\n [infiniteScrollThrottle]=\"InfiniteScrollConfig.modalScrollThrottle\" (scrolled)=\"onModalScrollDown()\">\n <ng-container *ngFor=\"let data of discussionList\">\n <div (click)=\"navigateToDiscussionDetails(data); logTelemetry($event)\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n </div>\n</div>\n\n<lib-app-loader *ngIf=\"showLoader\"></lib-app-loader>\n<ng-container *ngIf=\"!(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n</ng-container>", styles: ["::ng-deep:root{--df-box-text:var(--white);--df-profile-bg: var(--primary-400)}.profileCard{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:0;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;width:auto}.profileCard .profile-card-content{display:flex;flex-wrap:wrap}.profileCard .profile-card-content .profile-header-image{display:flex;justify-content:center;align-items:center;width:100%;border-radius:.25rem;max-width:9.5rem;height:8.4375rem;border:.0625rem solid var(--gray-100);margin-right:1.5rem;background:var(--df-profile-bg);text-align:center}.profileCard .profile-card-content .profile-header-image .box-text{font-size:4rem;color:var(--df-box-text);text-transform:uppercase}.profileCard .profile-card-content .profile-header-image .box-text .box-label{color:var(--white);font-size:1rem;line-height:.75rem;letter-spacing:.2625px;text-transform:uppercase}.profileCard .profile-card-content .profile-label{font-weight:700;margin-bottom:.5rem;font-size:.875rem}.profileCard .profile-card-content .name{font-size:1rem}.profileCard .profile-card-content .my-discuss-topics{font-size:.875rem;margin:1rem 0;font-weight:600}.profileCard .profile-card-content .my-discuss-topics__content{display:flex}.profileCard .profile-card-content .my-discuss-topics__content .my-discussion-label{margin:0 .5rem}.profileCard .profile-card-content .my-discuss-topics__content .my-discussion-label .number{color:var(--primary-300)}.profileCard .profile-card-content .my-discuss-topics__content .post-count-area{margin-left:2rem}\n"] }]
2768
+ }], ctorParameters: function () { return [{ type: DiscussionService }, { type: ConfigService }, { type: i1.Router }, { type: TelemetryUtilsService }]; }, propDecorators: { elementView: [{
2769
+ type: ViewChild,
2770
+ args: ['scrollContainerHeight']
2771
+ }] } });
2772
+
2773
+ const MSGS = {
2774
+ deletePost: `Are you sure you want to delete this Post? This can't be undone.`,
2775
+ deleteTopic: `Are you sure you want to delete this topic? Your action cannot be undone.`
2776
+ };
2777
+ class DiscussionDetailsComponent {
2778
+ constructor(route, discussionService, configService, formBuilder, router, telemetryUtils, renderer, location, navigationService) {
2779
+ this.route = route;
2780
+ this.discussionService = discussionService;
2781
+ this.configService = configService;
2782
+ this.formBuilder = formBuilder;
2783
+ this.router = router;
2784
+ this.telemetryUtils = telemetryUtils;
2785
+ this.renderer = renderer;
2786
+ this.location = location;
2787
+ this.navigationService = navigationService;
2788
+ this.stateChange = new EventEmitter();
2789
+ this.currentActivePage = 1;
2790
+ this.currentFilter = 'timestamp'; // 'recent
2791
+ this.pager = {};
2792
+ this.fetchSingleCategoryLoader = false;
2793
+ this.editMode = false;
2794
+ this.updatedPost = false;
2795
+ this.showEditTopicModal = false;
2796
+ this.dropdownContent = true;
2797
+ this.showLoader = false;
2798
+ /**
2799
+ * @description - It will check for the outside click while kebab menu is in open mode.
2800
+ */
2801
+ this.renderer.listen('window', 'click', (e) => {
2802
+ // tslint:disable-next-line:no-string-literal
2803
+ if (e.target['id'] !== 'group-actions') {
2804
+ this.dropdownContent = true;
2805
+ }
2806
+ });
2807
+ }
2808
+ ngOnInit() {
2809
+ this.initializeFormFiled();
2810
+ if (this.widget) {
2811
+ this.fetchSingleCategoryLoader = true;
2812
+ }
2813
+ if (!this.topicId && !this.slug) {
2814
+ this.route.params.subscribe(params => {
2815
+ this.routeParams = params;
2816
+ this.slug = _.get(this.routeParams, 'slug');
2817
+ this.topicId = _.get(this.routeParams, 'topicId');
2818
+ this.refreshPostData(this.currentActivePage);
2819
+ // this.getRealtedDiscussion(this.cid)
2820
+ });
2821
+ }
2822
+ else {
2823
+ this.refreshPostData(this.currentActivePage);
2824
+ // this.getRealtedDiscussion(this.cid)
2825
+ }
2826
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.DETAILS);
2827
+ }
2828
+ // tslint:disable-next-line: use-life-cycle-interface
2829
+ ngOnChanges() {
2830
+ if (!this.topicId && !this.slug) {
2831
+ this.route.params.subscribe(params => {
2832
+ this.routeParams = params;
2833
+ this.slug = _.get(this.routeParams, 'slug');
2834
+ this.topicId = _.get(this.routeParams, 'topicId');
2835
+ this.refreshPostData(this.currentActivePage);
2836
+ // this.getRealtedDiscussion(this.cid)
2837
+ });
2838
+ }
2839
+ else {
2840
+ this.refreshPostData(this.currentActivePage);
2841
+ // this.getRealtedDiscussion(this.cid)
2842
+ }
2843
+ }
2844
+ // new method
2845
+ acceptData(discuss) {
2846
+ // debugger
2847
+ const matchedTopic = _.find(this.telemetryUtils.getContext(), { type: 'Topic' });
2848
+ if (matchedTopic) {
2849
+ this.telemetryUtils.deleteContext(matchedTopic);
2850
+ }
2851
+ this.telemetryUtils.uppendContext({
2852
+ id: _.get(discuss, 'tid'),
2853
+ type: 'Topic'
2854
+ });
2855
+ const slug = _.trim(_.get(discuss, 'slug'));
2856
+ const input = {
2857
+ data: { url: `${this.configService.getRouterSlug()}${ROUTES.TOPIC}${slug}`, queryParams: {} },
2858
+ action: CATEGORY_DETAILS
2859
+ };
2860
+ this.navigationService.navigate(input);
2861
+ this.stateChange.emit({ action: CATEGORY_DETAILS, title: discuss.title, tid: discuss.tid });
2862
+ }
2863
+ initializeFormFiled() {
2864
+ this.postAnswerForm = this.formBuilder.group({
2865
+ answer: [],
2866
+ });
2867
+ this.UpdatePostAnswerForm = this.formBuilder.group({
2868
+ updatedAnswer: [],
2869
+ });
2870
+ this.replyForm = this.formBuilder.group({
2871
+ reply: []
2872
+ });
2873
+ }
2874
+ async refreshPostData(page) {
2875
+ if (this.currentFilter === 'timestamp') {
2876
+ this.discussionService.fetchTopicById(this.topicId, this.slug, page).subscribe((data) => {
2877
+ this.appendResponse(data);
2878
+ this.showLoader = true;
2879
+ }, (err) => {
2880
+ // error code check
2881
+ this.discussionService.showTrafficAlert(err);
2882
+ console.log('Error in fetching topics');
2883
+ // toast message
2884
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2885
+ });
2886
+ }
2887
+ else {
2888
+ this.discussionService.fetchTopicByIdSort(this.topicId, 'voted', page).subscribe((data) => {
2889
+ this.appendResponse(data);
2890
+ this.showLoader = true;
2891
+ }, (err) => {
2892
+ // error code check
2893
+ this.discussionService.showTrafficAlert(err);
2894
+ console.log('Error in fetching topics');
2895
+ });
2896
+ }
2897
+ }
2898
+ appendResponse(data) {
2899
+ this.data = data;
2900
+ this.paginationData = _.get(data, 'pagination');
2901
+ // TODO: After updating the nodebb version to v1.18.6 or above. Remove the fallback after 2/3 releases.
2902
+ this.mainUid = _.get(data, 'loggedInUser.uid') || _.get(data, 'privileges.uid');
2903
+ this.categoryId = _.get(data, 'cid');
2904
+ this.topicId = _.get(data, 'tid');
2905
+ }
2906
+ setPagination() {
2907
+ this.pager = {
2908
+ startIndex: this.paginationData.first.page,
2909
+ endIndex: this.paginationData.last.page,
2910
+ pages: this.paginationData.pages,
2911
+ currentPage: this.paginationData.currentPage,
2912
+ totalPage: this.paginationData.pageCount,
2913
+ };
2914
+ }
2915
+ upvote(discuss) {
2916
+ const req = {
2917
+ delta: 1,
2918
+ };
2919
+ this.processVote(discuss, req);
2920
+ }
2921
+ downvote(discuss) {
2922
+ const req = {
2923
+ delta: -1,
2924
+ };
2925
+ this.processVote(discuss, req);
2926
+ }
2927
+ async processVote(discuss, req) {
2928
+ if (discuss && discuss.uid) {
2929
+ this.discussionService.votePost(discuss.pid, req).subscribe(() => {
2930
+ // toast
2931
+ // this.openSnackbar(this.toastSuccess.nativeElement.value);
2932
+ this.postAnswerForm.reset();
2933
+ this.refreshPostData(this.currentActivePage);
2934
+ }, (err) => {
2935
+ // error code check
2936
+ this.discussionService.showTrafficAlert(err);
2937
+ // toast
2938
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2939
+ });
2940
+ }
2941
+ }
2942
+ bookmark(discuss) {
2943
+ this.discussionService.bookmarkPost(discuss.pid).subscribe(data => {
2944
+ // toast
2945
+ // this.openSnackbar('Bookmark added successfully!');
2946
+ this.refreshPostData(this.currentActivePage);
2947
+ }, (err) => {
2948
+ // error code check
2949
+ this.discussionService.showTrafficAlert(err);
2950
+ // toast
2951
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2952
+ });
2953
+ }
2954
+ unBookMark(discuss) {
2955
+ this.discussionService.deleteBookmarkPost(discuss.pid).subscribe(data => {
2956
+ // toast
2957
+ this.refreshPostData(this.currentActivePage);
2958
+ }, (err) => {
2959
+ // error code check
2960
+ this.discussionService.showTrafficAlert(err);
2961
+ // toast
2962
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2963
+ });
2964
+ }
2965
+ deleteVote(discuss) {
2966
+ this.discussionService.deleteVotePost(discuss.pid).subscribe(data => {
2967
+ // toast
2968
+ this.refreshPostData(this.currentActivePage);
2969
+ }, (err) => {
2970
+ // error code check
2971
+ this.discussionService.showTrafficAlert(err);
2972
+ // toast
2973
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2974
+ });
2975
+ }
2976
+ postReply(replyContent, post) {
2977
+ const req = {
2978
+ content: replyContent,
2979
+ };
2980
+ this.postAnswerForm.controls['answer'].setValue('');
2981
+ if (post && post.tid) {
2982
+ this.discussionService.replyPost(post.tid, req).subscribe(() => {
2983
+ // toast
2984
+ // this.openSnackbar('Your reply was saved succesfuly!');
2985
+ // this.fetchNewData = true;
2986
+ this.refreshPostData(this.currentActivePage);
2987
+ }, (err) => {
2988
+ // error code check
2989
+ this.discussionService.showTrafficAlert(err);
2990
+ // toast
2991
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
2992
+ });
2993
+ }
2994
+ }
2995
+ postCommentsReply(replyContent, post) {
2996
+ const req = {
2997
+ content: replyContent,
2998
+ toPid: post.pid,
2999
+ };
3000
+ if (post && post.tid) {
3001
+ this.discussionService.replyPost(post.tid, req).subscribe(() => {
3002
+ // toast
3003
+ // this.openSnackbar('Your reply was saved succesfuly!');
3004
+ this.refreshPostData(this.currentActivePage);
3005
+ }, (err) => {
3006
+ // error code check
3007
+ this.discussionService.showTrafficAlert(err);
3008
+ // toast
3009
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError);
3010
+ });
3011
+ }
3012
+ }
3013
+ confirmDelete(pid) {
3014
+ if (window.confirm(MSGS.deletePost)) {
3015
+ this.deletePost(pid);
3016
+ }
3017
+ }
3018
+ filter(key) {
3019
+ if (key) {
3020
+ this.currentFilter = key;
3021
+ this.refreshPostData(this.currentActivePage);
3022
+ }
3023
+ }
3024
+ navigateWithPage(page) {
3025
+ if (page !== this.currentActivePage) {
3026
+ this.router.navigate([`${this.configService.getRouterSlug()}${ROUTES.CATEGORY} ${this.topicId}`], { queryParams: { page }, queryParamsHandling: "merge" });
3027
+ }
3028
+ }
3029
+ showError(meta) {
3030
+ if (meta) {
3031
+ return true;
3032
+ }
3033
+ return false;
3034
+ }
3035
+ getBgColor(tagTitle) {
3036
+ const bgColor = this.stringToColor(tagTitle.toLowerCase());
3037
+ const color = this.getContrast();
3038
+ return { color, 'background-color': bgColor };
3039
+ }
3040
+ stringToColor(title) {
3041
+ let hash = 0;
3042
+ for (let i = 0; i < title.length; i++) {
3043
+ // tslint:disable-next-line: no-bitwise
3044
+ hash = title.charCodeAt(i) + ((hash << 5) - hash);
3045
+ }
3046
+ const hue = Math.abs(hash % 360);
3047
+ // tslint:disable-next-line: prefer-template
3048
+ const colour = 'hsl(' + hue + ',100%,30%)';
3049
+ return colour;
3050
+ }
3051
+ getContrast() {
3052
+ return 'rgba(255, 255, 255, 80%)';
3053
+ }
3054
+ logTelemetry(event, data) {
3055
+ const pid = _.get(data, 'pid') || _.get(data, 'mainPid') ?
3056
+ { id: _.get(data, 'pid') || _.get(data, 'mainPid'), type: 'Post' } : {};
3057
+ this.telemetryUtils.uppendContext(pid);
3058
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.DETAILS);
3059
+ }
3060
+ onEditMode(UpdatePostStatus) {
3061
+ if (UpdatePostStatus) {
3062
+ this.editMode = true;
3063
+ }
3064
+ else {
3065
+ this.editMode = false;
3066
+ }
3067
+ }
3068
+ getRealtimePost(post, index) {
3069
+ this.editMode = true;
3070
+ this.editContentIndex = index;
3071
+ this.contentPost = _.get(post, 'content').replace(/<[^>]*>/g, '');
3072
+ post.toggle = false;
3073
+ }
3074
+ updatePost(updatedPostContent, pid) {
3075
+ this.editMode = false;
3076
+ const req = {
3077
+ content: updatedPostContent,
3078
+ title: '',
3079
+ tags: [],
3080
+ uid: this.mainUid
3081
+ };
3082
+ this.discussionService.editPost(pid, req).subscribe((data) => {
3083
+ // TODO: Success toast
3084
+ this.refreshPostData(this.currentActivePage);
3085
+ }, (error) => {
3086
+ // error code check
3087
+ this.discussionService.showTrafficAlert(error);
3088
+ // TODO: error toast
3089
+ console.log('e', error);
3090
+ });
3091
+ console.log(pid);
3092
+ }
3093
+ deletePost(postId) {
3094
+ this.discussionService.deletePost(postId, this.mainUid).subscribe((data) => {
3095
+ // TODO: Success toast
3096
+ this.refreshPostData(this.currentActivePage);
3097
+ }, (error) => {
3098
+ // error code check
3099
+ this.discussionService.showTrafficAlert(error);
3100
+ // TODO: error toast
3101
+ console.log('e', error);
3102
+ });
3103
+ }
3104
+ editReplyHandler(event, post) {
3105
+ if (_.get(event, 'action') === 'cancel') {
3106
+ this.onEditMode(false);
3107
+ }
3108
+ else if (_.get(event, 'action') === 'edit') {
3109
+ this.updatePost(_.get(event, 'content'), _.get(post, 'pid'));
3110
+ this.logTelemetry(event, post);
3111
+ }
3112
+ }
3113
+ commentReplyHandler(event, post) {
3114
+ if (_.get(event, 'action') === 'cancel') {
3115
+ this.togglePost(post);
3116
+ }
3117
+ else if (_.get(event, 'action') === 'reply') {
3118
+ this.postCommentsReply(_.get(event, 'content'), post);
3119
+ this.logTelemetry(event, post);
3120
+ }
3121
+ }
3122
+ postReplyHandler(event, post) {
3123
+ if (_.get(event, 'action') === 'reply') {
3124
+ this.postReply(_.get(event, 'content'), post);
3125
+ this.logTelemetry(event, post);
3126
+ }
3127
+ }
3128
+ togglePost(post) {
3129
+ post.toggle = !post.toggle;
3130
+ this.onEditMode(false);
3131
+ }
3132
+ /**
3133
+ * @description - It will trigger the event handlers and close the update thread popup.
3134
+ */
3135
+ closeModal(event) {
3136
+ console.log('close event', event);
3137
+ if (_.get(event, 'action') === 'update') {
3138
+ this.editTopicHandler(event, _.get(event, 'tid'), _.get(event, 'request'));
3139
+ }
3140
+ this.showEditTopicModal = false;
3141
+ }
3142
+ /**
3143
+ * @description - It will open update thread popup.
3144
+ */
3145
+ editTopic(event, topicData) {
3146
+ this.showEditTopicModal = true;
3147
+ this.logTelemetry(event, topicData);
3148
+ }
3149
+ /**
3150
+ * @description - It will all the update topic api. If success, then will refresh the data.
3151
+ */
3152
+ editTopicHandler(event, tid, updateTopicRequest) {
3153
+ this.logTelemetry(event, this.editableTopicDetails);
3154
+ this.discussionService.editPost(tid, updateTopicRequest).subscribe(data => {
3155
+ console.log('update success', data);
3156
+ this.refreshPostData(this.currentActivePage);
3157
+ }, error => {
3158
+ // error code check
3159
+ this.discussionService.showTrafficAlert(error);
3160
+ console.log('error while updating', error);
3161
+ });
3162
+ }
3163
+ /**
3164
+ * @description - It will open the confirmation popup before deleting the topic,
3165
+ * If clicked yes, then will call the delete topic handler.
3166
+ */
3167
+ deleteTopic(event, topicData) {
3168
+ if (window.confirm(MSGS.deleteTopic)) {
3169
+ this.logTelemetry(event, topicData);
3170
+ this.deleteTopicHandler(_.get(topicData, 'tid'));
3171
+ }
3172
+ }
3173
+ /**
3174
+ * @description - It will all the delete topic api. If success, then will navigate back to the previous page.
3175
+ */
3176
+ deleteTopicHandler(topicId) {
3177
+ this.discussionService.deleteTopic(topicId).subscribe(data => {
3178
+ this.location.back();
3179
+ }, error => {
3180
+ // error code check
3181
+ this.discussionService.showTrafficAlert(error);
3182
+ console.log('error while deleting', error);
3183
+ });
3184
+ }
3185
+ /**
3186
+ * @description - It will toggle the kebab menu click
3187
+ */
3188
+ onMenuClick() {
3189
+ this.dropdownContent = !this.dropdownContent;
3190
+ }
3191
+ ngOnDestroy() {
3192
+ if (this.paramsSubscription) {
3193
+ this.paramsSubscription.unsubscribe();
3194
+ }
3195
+ }
3196
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionDetailsComponent, deps: [{ token: i1.ActivatedRoute }, { token: DiscussionService }, { token: ConfigService }, { token: i2$1.UntypedFormBuilder }, { token: i1.Router }, { token: TelemetryUtilsService }, { token: i0.Renderer2 }, { token: i6.Location }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
3197
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussionDetailsComponent, selector: "lib-discussion-details", inputs: { topicId: "topicId", slug: "slug", widget: "widget" }, outputs: { stateChange: "stateChange" }, usesOnChanges: true, ngImport: i0, template: "<lib-app-loader *ngIf=\"!showLoader\"></lib-app-loader>\n<div class=\"discuss-details-content\" *ngIf=\"showLoader\">\n <div class=\"discussion-details\" tabindex=\"0\" role=\"link\">\n\n <!-- header -->\n <div class=\"discuss-card-kabab-menu\">\n <h3 class=\"discussion-card-title df-label-color\" [innerHTML]=\"data?.title\"></h3>\n <div *ngIf=\"data?.uid === mainUid\">\n <div class=\"kabab-menu\" id=\"group-actions\" (click)=\"onMenuClick()\" tabindex=\"0\"></div>\n <div class=\"kabab-menu-dropdown-content\" [hidden]=\"dropdownContent\">\n <div id=\"edit-topic\" class=\"list\" tabindex=\"0\"\n (click)=\"editTopic($event, data); editableTopicDetails = data\">Edit\n </div>\n <div id=\"delete-topic\" class=\"list\" (click)=\"deleteTopic($event, data)\" tabindex=\"0\">Delete</div>\n </div>\n </div>\n </div>\n <!-- /header -->\n\n <ng-container *ngFor=\"let post of data?.posts\">\n <div class=\"post-reply-card\" *ngIf=\"post?.index === 0\">\n <h3 class=\"discussion-heading df-text-color\" [innerHTML]=\"post?.content\"></h3>\n <div class=\"discussion-content\">\n <div class=\"circle-text\">\n <div class=\"circle-label\">{{ post?.user?.username | splitInitials }}</div>\n </div>\n <div class=\"discussion-labels\">{{'Asked by '}}</div>\n <div class=\"discussion-labels\" *ngIf=\"post.user.fullname\" [innerHTML]=\"post.user.fullname\"></div>\n <div class=\"discussion-labels\" *ngIf=\"!post.user.fullname\" [innerHTML]=\"post.user.username\"></div>\n </div>\n\n <div class=\"tags\" aria-label=\"tags\">\n <ng-container *ngIf=\"data && data?.tags && data?.tags?.length > 0\">\n <span *ngFor=\"let tag of data?.tags\" class=\"tag\" role=\"link\" tabindex=\"0\"\n [ngStyle]=\"getBgColor(tag.value)\">\n {{tag.value}}\n </span>\n </ng-container>\n </div>\n\n <div class=\"comments-area\">\n <div>\n <span class=\"post-icons mobile\">\n <span role=\"link\" tabindex=\"0\" *ngIf=\"!post.upvoted\" (click)=\"upvote(post);logTelemetry($event, post)\"\n aria-label=\"upvote the post\" id=\"up-vote\">\n <!-- upward arrow -->\n <img src=\"./assets/discussion-ui/images/up-arrow.png\" alt=\"up-arrow\" class=\"icons\"\n alt=\"up arrow icon for like the post\">\n </span>\n <span *ngIf=\"post.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"remove upvote\" id=\"delete-vote\">\n <!-- upward arrow -->\n <img src=\"./assets/discussion-ui/images/up.svg\" alt=\"select-up-arrow\" class=\"icons\" alt=\"up image\">\n </span>\n <span class=\"vote-value\" role=\"text\"\n [attr.aria-label]=\"'total upvoat is' + data?.upvotes\">{{data?.upvotes}}</span>\n </span>\n <span class=\"post-icons mobile\">\n <span *ngIf=\"!post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"downvote(post);logTelemetry($event, post)\" aria-label=\"downvote post\" id=\"down-vote\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down-arrow.png\" class=\"icons\"\n alt=\"down arrow icon for unlike post\">\n </span>\n <span *ngIf=\"post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"remove down vote\" id=\"delete-vote\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down.svg\" class=\"icons\" alt=\"down image\">\n </span>\n <span class=\"vote-value\" role=\"text\"\n [attr.aria-label]=\"'total upvoat is' + data?.upvotes\">{{data?.downvotes}}</span>\n </span>\n <span class=\"post-icons mobile\" role=\"link\" tabindex=\"0\">\n <!-- trending -->\n <img src=\"./assets/discussion-ui/images/views.svg\" alt=\"views icon for seeing the posts\" class=\"icons\">\n <span class=\"vote-value\" aria-label=\"views count\">{{data.viewcount}} Views</span>\n </span>\n <span class=\"post-icons mobile\">\n <span *ngIf=\"!data?.posts[0]?.bookmarked\" role=\"link\" tabindex=\"0\"\n (click)=\"bookmark(post);logTelemetry($event, post)\" aria-label=\"Bookmark post\" id=\"bookmark\">\n <!-- bookmark -->\n <img src=\"./assets/discussion-ui/images/bookmarks.png\" class=\"icons\" alt=\"bookmark icon\">\n </span>\n <span *ngIf=\"data?.posts[0]?.bookmarked\" role=\"link\" tabindex=\"0\"\n (click)=\"unBookMark(post);logTelemetry($event, post)\" aria-label=\"unBookmark post\"\n id=\"un-bookmark-vote\">\n <!-- bookmark -->\n <img src=\"./assets/discussion-ui/images/select-bookmarks.png\" class=\"icons bookmark-icon\"\n alt=\"select bookmark icon\">\n </span>\n </span>\n </div>\n <div class=\"comments-count\">\n <span *ngIf=\"data?.postcount-1 > 0\" aria-label=\"comments count\">\n {{data?.postcount-1}}\n comments\n </span>\n <span *ngIf=\"data?.postcount-1 <=0\" aria-label=\"comments count\">\n 0 comments</span>\n </div>\n </div>\n <!-- /card content -->\n <!-- post reply -->\n <lib-post-reply (actionEvent)=\"postReplyHandler($event, post); logTelemetry($event, post)\" [mode]=\"'reply'\"\n [showCancel]=\"false\"></lib-post-reply>\n \n </div>\n </ng-container>\n <!-- /card end -->\n\n <ng-container *ngIf=\"data?.posts && data?.postcount > 1\">\n <div class=\"recent-tabs\">\n <div class=\"tabs-content\">\n <div class=\"tabs-filter\">\n <a href=\"javascript:void(0)\" class=\"filter-option\" role=\"link\" tabindex=\"0\" [ngClass]=\"{'tabs-active' : currentFilter === 'timestamp',\n 'ws-mat-accent-border':currentFilter !== 'timestamp'}\"\n (click)=\"filter('timestamp');logTelemetry($event)\" id=\"recent-post\">\n Recent </a>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let post of data?.posts | sortBy: 'timestampISO':'desc'; index as i\">\n <!-- card content -->\n <div *ngIf=\"post?.index != 0\" class=\"post-card\">\n <!-- header -->\n <div class=\"comment-section\">\n <div class=\"post-header-content\">\n <span class=\"circle-text\"><span class=\"circle-label\">{{ post?.user?.username | splitInitials\n }}</span></span>\n <span class=\"post-name\" *ngIf=\"post?.user?.fullname\" [innerHTML]=\"post?.user?.fullname\"></span>\n <span class=\"post-name df-label-color\" *ngIf=\"!post?.user?.fullname\"\n [innerHTML]=\"post?.user?.username\"></span>\n </div>\n <div class=\"custom-actions\">\n <span class=\"post-time\">{{ post?.timestamp | date: 'dd MMM yyyy hh:mm a'}}</span>\n <ng-container *ngIf=\"mainUid === post?.uid\">\n <img src=\"./assets/discussion-ui/images/edit.svg\" class=\"edit-icon\" id=\"edit-post\" alt=\"edit icon\"\n (click)=\"getRealtimePost(post, i)\" tabindex=\"0\">\n <img src=\"./assets/discussion-ui/images/delete.svg\" class=\"delete-icon\" id=\"delete-post\" alt=\"delete icon\"\n (click)=\"confirmDelete(post?.pid)\" tabindex=\"0\">\n </ng-container>\n </div>\n </div>\n <!-- / header -->\n <div>\n <div class=\"edit-text\" *ngIf=\"!editMode || editContentIndex !== i\">\n <p [innerHTML]=\"post?.content\" class=\"post-labels df-text-color\"></p>\n <div class=\"edited-text\" *ngIf=\"post?.edited\">(edited)</div>\n </div>\n <div *ngIf=\"editMode && editContentIndex === i\">\n <lib-post-reply (actionEvent)=\"editReplyHandler($event, post)\" [mode]=\"'edit'\" [showCancel]=\"true\"\n [content]=\"contentPost\"></lib-post-reply>\n </div>\n <div class=\"reply-area\">\n <div>\n <span class=\"flex mobile\">\n <!-- upward arrow -->\n <span class=\"up-vote-text\" *ngIf=\"!post?.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"upvote(post);logTelemetry($event, post)\" aria-label=\"upvote comment\" id=\"up-vote\">\n <img src=\"./assets/discussion-ui/images/up.svg\" class=\"icons\" alt=\"up icon\">\n </span>\n </span>\n <span class=\"post-icons mobile\">\n <!-- upward arrow -->\n <span class=\"down-vote-text\" *ngIf=\"post.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"delete upvote on comment\"\n id=\"delete-vote\">\n <img src=\"./assets/discussion-ui/images/up.svg\" class=\"icons\" alt=\"up icon\">\n </span>\n <span class=\"vote-value\">{{post?.upvotes}}</span>\n </span>\n\n <span class=\"flex mobile\">\n <span id=\"down-vote\" *ngIf=\"!post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"downvote(post);logTelemetry($event, post)\" aria-label=\"downvote comment\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down-arrow.png\" class=\"icons\" alt=\"down arrow icon\">\n </span>\n </span>\n <span class=\"post-icons mobile\">\n <span id=\"delete-vote\" *ngIf=\"post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"delete downvote on comment\">\n <!-- down arrow -->\n <img src=\"./assets/discussion-ui/images/down.svg\" class=\"icons\" alt=\"down icon\">\n </span>\n <span class=\"vote-value\">{{post?.downvotes}}</span>\n </span>\n </div>\n\n <button (click)=\"togglePost(post); logTelemetry($event, post)\"\n class=\"df-btn df-btn-normal df-btn-primary df-reply-btn\" id=\"reply-comment\">\n Reply </button>\n\n </div>\n <div class=\"replies\" *ngIf=\"post?.toggle\">\n <ng-container [ngTemplateOutlet]=\"reply\" [ngTemplateOutletContext]=\"{post:post}\">\n </ng-container>\n </div>\n <ng-container *ngIf=\"post?.replies?.count > 0\">\n <div>\n <div>\n <div class=\"reply-content\" (click)=\"post.replyCountToggle = !post.replyCountToggle\" tabindex=\"0\">\n <span class=\"replies-count\"> {{post?.replies?.count}} reply(s) </span>\n <div *ngIf=\"post?.replyCountToggle\" role=\"link\" tabindex=\"0\" aria-label=\"reply toggle\">\n <span class=\"toggle-icon\" *ngIf=\"post?.replyCountToggle\" aria-label=\"reply toggle upwards\">\n <!-- up arrow -->\n <img src=\"./assets/discussion-ui/images/up-chevron.png\" class=\"icons\" alt=\"up chevron icon\">\n </span>\n </div>\n <div *ngIf=\"!post.replyCountToggle\" role=\"link\" tabindex=\"0\" aria-label=\"reply toggle\">\n <span class=\"toggle-icon\" *ngIf=\"!post.replyCountToggle\" aria-label=\"reply toggle downwards\">\n <!-- down arrow -->\n <img src=\"./assets/discussion-ui/images/down-chevron.png\" class=\"icons\" alt=\"down chevron icon\">\n </span>\n </div>\n </div>\n </div>\n <div class=\"last-reply-data\">\n <span *ngIf=\"!post.replyCountToggle\">Last reply\n {{ post?.replies?.timestampISO | date: 'dd MMM yyyy hh:mm a' }} </span>\n </div>\n </div>\n <div class=\"replies\" *ngIf=\"post?.replyCountToggle\">\n <ng-container [ngTemplateOutlet]=\"replies\"\n [ngTemplateOutletContext]=\"{posts:data.posts, postId:post.pid}\">\n </ng-container>\n </div>\n </ng-container>\n </div>\n <!-- /card content -->\n </div>\n <!-- / card -->\n <!-- Divider -->\n <div *ngIf=\"post.index != 0\"></div>\n </ng-container>\n </div>\n\n <div class=\"related-discuss-part\">\n <div *ngIf=\"fetchSingleCategoryLoader\" class=\"related-discuss-part-content\"></div>\n <lib-related-discussion *ngIf=\"!fetchSingleCategoryLoader\" [catId]=\"categoryId\" [topicId]=\"topicId\">\n </lib-related-discussion>\n </div>\n</div>\n\n<ng-template #reply let-post=\"post\">\n <lib-post-reply (actionEvent)=\"commentReplyHandler($event, post)\" [mode]=\"'reply'\" [showCancel]=\"true\">\n </lib-post-reply>\n</ng-template>\n\n<ng-template #replies let-posts=\"posts\" let-postId=\"postId\">\n <ng-container *ngFor=\"let post of posts | pipeFilter:'toPid': postId; index as index; last as last\">\n <!-- card -->\n <div class=\"post-sub-card\">\n <!-- card-header -->\n <div class=\"comment-section\">\n <div class=\"post-header-content\">\n <div class=\"circle-text\"><div class=\"circle-label\">{{ post?.user?.username | splitInitials }}</div></div>\n <div class=\"post-name\" *ngIf=\"post?.user?.fullname\" [innerHTML]=\"post?.user?.fullname\"></div>\n <div class=\"df-label-color post-name\" *ngIf=\"!post?.user?.fullname\"\n [innerHTML]=\"post?.user?.username\"></div>\n </div>\n <div class=\"post-time\">{{ post?.timestamp | date}}</div>\n </div>\n <!-- /card-header -->\n\n <!-- card-content -->\n <div>\n <p role=\"link\" tabindex=\"0\" tabindex=\"0\" [innerHTML]=\"post?.content\"></p>\n <div class=\"reply-area\">\n <div class=\"reply-area-content\">\n <span class=\"post-icons mobile\">\n <!-- up arrow -->\n <img *ngIf=\"!post?.upvoted\" class=\"cursor-pointer\" (click)=\"upvote(post);logTelemetry($event, post)\"\n src=\"./assets/discussion-ui/images/up-arrow.png\" alt=\"up arrow icon\" class=\"icons\" tabindex=\"0\">\n <img *ngIf=\"post?.upvoted\" class=\"cursor-pointer\" (click)=\"deleteVote(post);logTelemetry($event, post)\"\n src=\"./assets/discussion-ui/images/up.svg\" alt=\"select up arrow icon\" class=\"icons\" tabindex=\"0\">\n <span class=\"vote-value\">{{post.upvotes}}</span>\n </span>\n <span class=\"post-icons mobile\">\n <img *ngIf=\"!post?.downvoted\" class=\"cursor-pointer\" (click)=\"downvote(post); logTelemetry($event, post)\"\n id=\"up-vote\" tabindex=\"0\" src=\"./assets/discussion-ui/images/down-arrow.png\" alt=\"down arrow icon\"\n class=\"icons\">\n <img *ngIf=\"post?.downvoted\" class=\"cursor-pointer\" (click)=\"deleteVote(post);logTelemetry($event, post)\"\n id=\"delete-vote\" tabindex=\"0\" src=\"./assets/discussion-ui/images/down.svg\" alt=\"select down arrow icon\"\n class=\"icons\">\n <span class=\"vote-value\">{{post?.downvotes}}</span>\n </span>\n </div>\n </div>\n </div>\n </div> \n <!-- /card -->\n </ng-container>\n</ng-template>\n\n<input type=\"hidden\" i18-value i18-aria-value aria-value=\"Thank you for voting!\" value=\"Thank you for voting!!\"\n #toastSuccess />\n<input type=\"hidden\" i18-value i18-aria-value aria-value=\"Something went wrong, please try again later!\"\n value=\"Something went wrong, please try again later!\" #toastError />\n\n<lib-discuss-start [mode]=\"'edit'\" [topicData]=\"editableTopicDetails\" (close)=\"closeModal($event)\"\n *ngIf=\"showEditTopicModal\"></lib-discuss-start>", styles: ["@charset \"UTF-8\";.discuss-details-content{display:flex;flex-direction:row}.discussion-details{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:3;height:auto;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:.875rem 1rem;justify-content:space-between;z-index:unset;margin-bottom:1rem}.related-discuss-part{padding:0 0 1rem 1.5rem;position:relative;z-index:2}.related-discuss-part .related-discuss-part-content{padding:0 .25rem}.discussion-card-title{font-size:1.25rem;font-weight:700}.discussion-heading{font-size:.875rem;font-weight:400;pointer-events:none;margin-bottom:0;margin-top:.5rem}.discussion-content{display:flex;align-items:center;margin-bottom:1rem;font-size:.875rem;flex-wrap:wrap;margin-bottom:0;margin-top:1rem}.comment-section{display:flex;align-items:center;justify-content:space-between;margin:.5rem 0;flex-direction:row;flex-wrap:wrap}.post-header-content{display:flex;align-items:center}.circle-text{border-radius:50%;width:1.75rem;height:1.75rem;display:flex;justify-content:center;align-items:center;background-color:#306933}.circle-label{color:var(--white);font-size:1rem;line-height:.75rem;letter-spacing:.2625px;text-transform:uppercase}.discussion-labels{color:var(--gray-400);margin-left:.5rem;font-size:.875rem}.comments-area{display:flex;align-items:center;justify-content:space-between;font-weight:700;flex-direction:row;font-size:.875rem;margin:1rem 0}.text-form-field{display:flex;flex-direction:column}.text-content{min-height:6.75rem;max-height:33.75rem;margin-bottom:.875rem;background-color:var(--df-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;cursor:pointer;outline:0;padding:.5rem .875rem}.text-content.is-invalid,.text-content.is-invalid:hover,.text-content.is-invalid:focus{border:.0625rem solid var(--red-100)}.text-content.is-valid,.text-content.is-valid:hover,.text-content.is-valid:focus{border:.0625rem solid var(--primary-400)}.up-vote-text,.down-vote-text{font-size:1rem;color:var(--black);margin-right:.5rem}.post-card,.post-reply-card{border-bottom:.0625rem solid var(--gray-100);margin-bottom:1.5rem}.post-sub-card{margin:0 .5rem .5rem;border:0}.comments-section{display:flex;align-items:center;justify-content:space-between}.post-icons{margin-right:1rem}.post-name{font-size:1rem;font-weight:700;margin-left:1rem;word-break:break-all;text-transform:capitalize}.post-time{color:var(var(--gray-400));margin:0 1rem;font-size:.875rem}.post-labels{font-size:.875rem;margin:0}.reply-area{display:flex;justify-content:space-between;align-items:center}.reply-area-content{position:relative;margin-top:1rem}.margin-gap-tb{margin:1rem 0}.custom-actions{display:flex;align-items:center}.edit-post{margin-right:1.25rem}.border-0{border-bottom:0px}.comments-count{color:var(--primary);font-weight:700;cursor:pointer}@media (max-width: 768px){.discuss-details-content{flex-direction:column}.related-discuss-part{padding:0}.post-btn{width:100%;margin-top:.5rem;cursor:pointer}.post-time{margin-top:.5rem;margin-left:0}.comment-section{display:flex;flex-direction:column;align-items:start;margin-bottom:.5rem}}.df-btn-disabled{background-color:var(--gray-100)!important;color:var(--gray-200)!important}.df-reply-btn{margin-bottom:.5rem}.edited-text{padding-left:.5rem;margin-top:.25rem;font-size:.75rem;color:var(--gray-200)}.delete-icon,.edit-icon{cursor:pointer;width:1rem;height:1rem;margin:0 .5rem}.discuss-card-kabab-menu{display:flex;justify-content:space-between;flex-wrap:wrap}.kabab-menu{color:var(--primary-400);width:1.875rem;height:1.875rem;line-height:1.75rem;text-align:center;border-radius:50%;padding-left:.5rem;position:absolute;right:.5rem}.kabab-menu:hover{background:var(--gray-0);cursor:pointer}.kabab-menu:after{content:\"\\2807\";font-size:1.5rem}.kabab-menu-dropdown-content{position:absolute;border-radius:.125rem;background-color:var(--white);box-shadow:0 3px 5px 4px rgba(var(--rc-rgba-black),.05);padding:.5rem;z-index:1;text-align:left;right:0;top:0;min-width:13.125rem}.kabab-menu-dropdown-content .list{display:flex;align-items:center;width:100%;cursor:pointer;font-size:.875rem;padding:.5rem}.kabab-menu-dropdown-content .list:hover,.kabab-menu-dropdown-content .list:active{background-color:var(--primary-100)}.kabab-menu-dropdown-content .list:last-child .df-btn-normal{color:var(--red-400)}.kabab-menu-dropdown-content .list .df-btn-normal{font-size:.875rem}::ng-deep html[dir=rtl] .kabab-menu-dropdown-content{right:auto;left:0}.vote-value{margin-left:.5rem}.icons{width:.875rem;height:.875rem;position:relative;cursor:pointer}.edit-text{display:flex}.last-reply-data{margin:1rem 0;font-size:.875rem}.reply-content{display:flex;align-items:center}.replies{width:100%}.replies-count{font-size:.875rem;font-weight:700;cursor:pointer}.toggle-icon{padding:0 1rem;cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }, { kind: "component", type: RelatedDiscussionComponent, selector: "lib-related-discussion", inputs: ["catId", "topicId"], outputs: ["stateChange"] }, { kind: "component", type: PostReplyComponent, selector: "lib-post-reply", inputs: ["showCancel", "mode", "content"], outputs: ["actionEvent"] }, { kind: "component", type: DiscussStartComponent, selector: "lib-discuss-start", inputs: ["categoryId", "topicData", "mode"], outputs: ["close"] }, { kind: "pipe", type: i6.DatePipe, name: "date" }, { kind: "pipe", type: PipeFilterPipe, name: "pipeFilter" }, { kind: "pipe", type: SortByPipe, name: "sortBy" }, { kind: "pipe", type: SplitInitialsPipe, name: "splitInitials" }] }); }
3198
+ }
3199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionDetailsComponent, decorators: [{
3200
+ type: Component,
3201
+ args: [{ selector: 'lib-discussion-details', template: "<lib-app-loader *ngIf=\"!showLoader\"></lib-app-loader>\n<div class=\"discuss-details-content\" *ngIf=\"showLoader\">\n <div class=\"discussion-details\" tabindex=\"0\" role=\"link\">\n\n <!-- header -->\n <div class=\"discuss-card-kabab-menu\">\n <h3 class=\"discussion-card-title df-label-color\" [innerHTML]=\"data?.title\"></h3>\n <div *ngIf=\"data?.uid === mainUid\">\n <div class=\"kabab-menu\" id=\"group-actions\" (click)=\"onMenuClick()\" tabindex=\"0\"></div>\n <div class=\"kabab-menu-dropdown-content\" [hidden]=\"dropdownContent\">\n <div id=\"edit-topic\" class=\"list\" tabindex=\"0\"\n (click)=\"editTopic($event, data); editableTopicDetails = data\">Edit\n </div>\n <div id=\"delete-topic\" class=\"list\" (click)=\"deleteTopic($event, data)\" tabindex=\"0\">Delete</div>\n </div>\n </div>\n </div>\n <!-- /header -->\n\n <ng-container *ngFor=\"let post of data?.posts\">\n <div class=\"post-reply-card\" *ngIf=\"post?.index === 0\">\n <h3 class=\"discussion-heading df-text-color\" [innerHTML]=\"post?.content\"></h3>\n <div class=\"discussion-content\">\n <div class=\"circle-text\">\n <div class=\"circle-label\">{{ post?.user?.username | splitInitials }}</div>\n </div>\n <div class=\"discussion-labels\">{{'Asked by '}}</div>\n <div class=\"discussion-labels\" *ngIf=\"post.user.fullname\" [innerHTML]=\"post.user.fullname\"></div>\n <div class=\"discussion-labels\" *ngIf=\"!post.user.fullname\" [innerHTML]=\"post.user.username\"></div>\n </div>\n\n <div class=\"tags\" aria-label=\"tags\">\n <ng-container *ngIf=\"data && data?.tags && data?.tags?.length > 0\">\n <span *ngFor=\"let tag of data?.tags\" class=\"tag\" role=\"link\" tabindex=\"0\"\n [ngStyle]=\"getBgColor(tag.value)\">\n {{tag.value}}\n </span>\n </ng-container>\n </div>\n\n <div class=\"comments-area\">\n <div>\n <span class=\"post-icons mobile\">\n <span role=\"link\" tabindex=\"0\" *ngIf=\"!post.upvoted\" (click)=\"upvote(post);logTelemetry($event, post)\"\n aria-label=\"upvote the post\" id=\"up-vote\">\n <!-- upward arrow -->\n <img src=\"./assets/discussion-ui/images/up-arrow.png\" alt=\"up-arrow\" class=\"icons\"\n alt=\"up arrow icon for like the post\">\n </span>\n <span *ngIf=\"post.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"remove upvote\" id=\"delete-vote\">\n <!-- upward arrow -->\n <img src=\"./assets/discussion-ui/images/up.svg\" alt=\"select-up-arrow\" class=\"icons\" alt=\"up image\">\n </span>\n <span class=\"vote-value\" role=\"text\"\n [attr.aria-label]=\"'total upvoat is' + data?.upvotes\">{{data?.upvotes}}</span>\n </span>\n <span class=\"post-icons mobile\">\n <span *ngIf=\"!post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"downvote(post);logTelemetry($event, post)\" aria-label=\"downvote post\" id=\"down-vote\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down-arrow.png\" class=\"icons\"\n alt=\"down arrow icon for unlike post\">\n </span>\n <span *ngIf=\"post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"remove down vote\" id=\"delete-vote\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down.svg\" class=\"icons\" alt=\"down image\">\n </span>\n <span class=\"vote-value\" role=\"text\"\n [attr.aria-label]=\"'total upvoat is' + data?.upvotes\">{{data?.downvotes}}</span>\n </span>\n <span class=\"post-icons mobile\" role=\"link\" tabindex=\"0\">\n <!-- trending -->\n <img src=\"./assets/discussion-ui/images/views.svg\" alt=\"views icon for seeing the posts\" class=\"icons\">\n <span class=\"vote-value\" aria-label=\"views count\">{{data.viewcount}} Views</span>\n </span>\n <span class=\"post-icons mobile\">\n <span *ngIf=\"!data?.posts[0]?.bookmarked\" role=\"link\" tabindex=\"0\"\n (click)=\"bookmark(post);logTelemetry($event, post)\" aria-label=\"Bookmark post\" id=\"bookmark\">\n <!-- bookmark -->\n <img src=\"./assets/discussion-ui/images/bookmarks.png\" class=\"icons\" alt=\"bookmark icon\">\n </span>\n <span *ngIf=\"data?.posts[0]?.bookmarked\" role=\"link\" tabindex=\"0\"\n (click)=\"unBookMark(post);logTelemetry($event, post)\" aria-label=\"unBookmark post\"\n id=\"un-bookmark-vote\">\n <!-- bookmark -->\n <img src=\"./assets/discussion-ui/images/select-bookmarks.png\" class=\"icons bookmark-icon\"\n alt=\"select bookmark icon\">\n </span>\n </span>\n </div>\n <div class=\"comments-count\">\n <span *ngIf=\"data?.postcount-1 > 0\" aria-label=\"comments count\">\n {{data?.postcount-1}}\n comments\n </span>\n <span *ngIf=\"data?.postcount-1 <=0\" aria-label=\"comments count\">\n 0 comments</span>\n </div>\n </div>\n <!-- /card content -->\n <!-- post reply -->\n <lib-post-reply (actionEvent)=\"postReplyHandler($event, post); logTelemetry($event, post)\" [mode]=\"'reply'\"\n [showCancel]=\"false\"></lib-post-reply>\n \n </div>\n </ng-container>\n <!-- /card end -->\n\n <ng-container *ngIf=\"data?.posts && data?.postcount > 1\">\n <div class=\"recent-tabs\">\n <div class=\"tabs-content\">\n <div class=\"tabs-filter\">\n <a href=\"javascript:void(0)\" class=\"filter-option\" role=\"link\" tabindex=\"0\" [ngClass]=\"{'tabs-active' : currentFilter === 'timestamp',\n 'ws-mat-accent-border':currentFilter !== 'timestamp'}\"\n (click)=\"filter('timestamp');logTelemetry($event)\" id=\"recent-post\">\n Recent </a>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let post of data?.posts | sortBy: 'timestampISO':'desc'; index as i\">\n <!-- card content -->\n <div *ngIf=\"post?.index != 0\" class=\"post-card\">\n <!-- header -->\n <div class=\"comment-section\">\n <div class=\"post-header-content\">\n <span class=\"circle-text\"><span class=\"circle-label\">{{ post?.user?.username | splitInitials\n }}</span></span>\n <span class=\"post-name\" *ngIf=\"post?.user?.fullname\" [innerHTML]=\"post?.user?.fullname\"></span>\n <span class=\"post-name df-label-color\" *ngIf=\"!post?.user?.fullname\"\n [innerHTML]=\"post?.user?.username\"></span>\n </div>\n <div class=\"custom-actions\">\n <span class=\"post-time\">{{ post?.timestamp | date: 'dd MMM yyyy hh:mm a'}}</span>\n <ng-container *ngIf=\"mainUid === post?.uid\">\n <img src=\"./assets/discussion-ui/images/edit.svg\" class=\"edit-icon\" id=\"edit-post\" alt=\"edit icon\"\n (click)=\"getRealtimePost(post, i)\" tabindex=\"0\">\n <img src=\"./assets/discussion-ui/images/delete.svg\" class=\"delete-icon\" id=\"delete-post\" alt=\"delete icon\"\n (click)=\"confirmDelete(post?.pid)\" tabindex=\"0\">\n </ng-container>\n </div>\n </div>\n <!-- / header -->\n <div>\n <div class=\"edit-text\" *ngIf=\"!editMode || editContentIndex !== i\">\n <p [innerHTML]=\"post?.content\" class=\"post-labels df-text-color\"></p>\n <div class=\"edited-text\" *ngIf=\"post?.edited\">(edited)</div>\n </div>\n <div *ngIf=\"editMode && editContentIndex === i\">\n <lib-post-reply (actionEvent)=\"editReplyHandler($event, post)\" [mode]=\"'edit'\" [showCancel]=\"true\"\n [content]=\"contentPost\"></lib-post-reply>\n </div>\n <div class=\"reply-area\">\n <div>\n <span class=\"flex mobile\">\n <!-- upward arrow -->\n <span class=\"up-vote-text\" *ngIf=\"!post?.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"upvote(post);logTelemetry($event, post)\" aria-label=\"upvote comment\" id=\"up-vote\">\n <img src=\"./assets/discussion-ui/images/up.svg\" class=\"icons\" alt=\"up icon\">\n </span>\n </span>\n <span class=\"post-icons mobile\">\n <!-- upward arrow -->\n <span class=\"down-vote-text\" *ngIf=\"post.upvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"delete upvote on comment\"\n id=\"delete-vote\">\n <img src=\"./assets/discussion-ui/images/up.svg\" class=\"icons\" alt=\"up icon\">\n </span>\n <span class=\"vote-value\">{{post?.upvotes}}</span>\n </span>\n\n <span class=\"flex mobile\">\n <span id=\"down-vote\" *ngIf=\"!post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"downvote(post);logTelemetry($event, post)\" aria-label=\"downvote comment\">\n <!-- downward arrow -->\n <img src=\"./assets/discussion-ui/images/down-arrow.png\" class=\"icons\" alt=\"down arrow icon\">\n </span>\n </span>\n <span class=\"post-icons mobile\">\n <span id=\"delete-vote\" *ngIf=\"post?.downvoted\" role=\"link\" tabindex=\"0\"\n (click)=\"deleteVote(post);logTelemetry($event, post)\" aria-label=\"delete downvote on comment\">\n <!-- down arrow -->\n <img src=\"./assets/discussion-ui/images/down.svg\" class=\"icons\" alt=\"down icon\">\n </span>\n <span class=\"vote-value\">{{post?.downvotes}}</span>\n </span>\n </div>\n\n <button (click)=\"togglePost(post); logTelemetry($event, post)\"\n class=\"df-btn df-btn-normal df-btn-primary df-reply-btn\" id=\"reply-comment\">\n Reply </button>\n\n </div>\n <div class=\"replies\" *ngIf=\"post?.toggle\">\n <ng-container [ngTemplateOutlet]=\"reply\" [ngTemplateOutletContext]=\"{post:post}\">\n </ng-container>\n </div>\n <ng-container *ngIf=\"post?.replies?.count > 0\">\n <div>\n <div>\n <div class=\"reply-content\" (click)=\"post.replyCountToggle = !post.replyCountToggle\" tabindex=\"0\">\n <span class=\"replies-count\"> {{post?.replies?.count}} reply(s) </span>\n <div *ngIf=\"post?.replyCountToggle\" role=\"link\" tabindex=\"0\" aria-label=\"reply toggle\">\n <span class=\"toggle-icon\" *ngIf=\"post?.replyCountToggle\" aria-label=\"reply toggle upwards\">\n <!-- up arrow -->\n <img src=\"./assets/discussion-ui/images/up-chevron.png\" class=\"icons\" alt=\"up chevron icon\">\n </span>\n </div>\n <div *ngIf=\"!post.replyCountToggle\" role=\"link\" tabindex=\"0\" aria-label=\"reply toggle\">\n <span class=\"toggle-icon\" *ngIf=\"!post.replyCountToggle\" aria-label=\"reply toggle downwards\">\n <!-- down arrow -->\n <img src=\"./assets/discussion-ui/images/down-chevron.png\" class=\"icons\" alt=\"down chevron icon\">\n </span>\n </div>\n </div>\n </div>\n <div class=\"last-reply-data\">\n <span *ngIf=\"!post.replyCountToggle\">Last reply\n {{ post?.replies?.timestampISO | date: 'dd MMM yyyy hh:mm a' }} </span>\n </div>\n </div>\n <div class=\"replies\" *ngIf=\"post?.replyCountToggle\">\n <ng-container [ngTemplateOutlet]=\"replies\"\n [ngTemplateOutletContext]=\"{posts:data.posts, postId:post.pid}\">\n </ng-container>\n </div>\n </ng-container>\n </div>\n <!-- /card content -->\n </div>\n <!-- / card -->\n <!-- Divider -->\n <div *ngIf=\"post.index != 0\"></div>\n </ng-container>\n </div>\n\n <div class=\"related-discuss-part\">\n <div *ngIf=\"fetchSingleCategoryLoader\" class=\"related-discuss-part-content\"></div>\n <lib-related-discussion *ngIf=\"!fetchSingleCategoryLoader\" [catId]=\"categoryId\" [topicId]=\"topicId\">\n </lib-related-discussion>\n </div>\n</div>\n\n<ng-template #reply let-post=\"post\">\n <lib-post-reply (actionEvent)=\"commentReplyHandler($event, post)\" [mode]=\"'reply'\" [showCancel]=\"true\">\n </lib-post-reply>\n</ng-template>\n\n<ng-template #replies let-posts=\"posts\" let-postId=\"postId\">\n <ng-container *ngFor=\"let post of posts | pipeFilter:'toPid': postId; index as index; last as last\">\n <!-- card -->\n <div class=\"post-sub-card\">\n <!-- card-header -->\n <div class=\"comment-section\">\n <div class=\"post-header-content\">\n <div class=\"circle-text\"><div class=\"circle-label\">{{ post?.user?.username | splitInitials }}</div></div>\n <div class=\"post-name\" *ngIf=\"post?.user?.fullname\" [innerHTML]=\"post?.user?.fullname\"></div>\n <div class=\"df-label-color post-name\" *ngIf=\"!post?.user?.fullname\"\n [innerHTML]=\"post?.user?.username\"></div>\n </div>\n <div class=\"post-time\">{{ post?.timestamp | date}}</div>\n </div>\n <!-- /card-header -->\n\n <!-- card-content -->\n <div>\n <p role=\"link\" tabindex=\"0\" tabindex=\"0\" [innerHTML]=\"post?.content\"></p>\n <div class=\"reply-area\">\n <div class=\"reply-area-content\">\n <span class=\"post-icons mobile\">\n <!-- up arrow -->\n <img *ngIf=\"!post?.upvoted\" class=\"cursor-pointer\" (click)=\"upvote(post);logTelemetry($event, post)\"\n src=\"./assets/discussion-ui/images/up-arrow.png\" alt=\"up arrow icon\" class=\"icons\" tabindex=\"0\">\n <img *ngIf=\"post?.upvoted\" class=\"cursor-pointer\" (click)=\"deleteVote(post);logTelemetry($event, post)\"\n src=\"./assets/discussion-ui/images/up.svg\" alt=\"select up arrow icon\" class=\"icons\" tabindex=\"0\">\n <span class=\"vote-value\">{{post.upvotes}}</span>\n </span>\n <span class=\"post-icons mobile\">\n <img *ngIf=\"!post?.downvoted\" class=\"cursor-pointer\" (click)=\"downvote(post); logTelemetry($event, post)\"\n id=\"up-vote\" tabindex=\"0\" src=\"./assets/discussion-ui/images/down-arrow.png\" alt=\"down arrow icon\"\n class=\"icons\">\n <img *ngIf=\"post?.downvoted\" class=\"cursor-pointer\" (click)=\"deleteVote(post);logTelemetry($event, post)\"\n id=\"delete-vote\" tabindex=\"0\" src=\"./assets/discussion-ui/images/down.svg\" alt=\"select down arrow icon\"\n class=\"icons\">\n <span class=\"vote-value\">{{post?.downvotes}}</span>\n </span>\n </div>\n </div>\n </div>\n </div> \n <!-- /card -->\n </ng-container>\n</ng-template>\n\n<input type=\"hidden\" i18-value i18-aria-value aria-value=\"Thank you for voting!\" value=\"Thank you for voting!!\"\n #toastSuccess />\n<input type=\"hidden\" i18-value i18-aria-value aria-value=\"Something went wrong, please try again later!\"\n value=\"Something went wrong, please try again later!\" #toastError />\n\n<lib-discuss-start [mode]=\"'edit'\" [topicData]=\"editableTopicDetails\" (close)=\"closeModal($event)\"\n *ngIf=\"showEditTopicModal\"></lib-discuss-start>", styles: ["@charset \"UTF-8\";.discuss-details-content{display:flex;flex-direction:row}.discussion-details{box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:3;height:auto;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:.875rem 1rem;justify-content:space-between;z-index:unset;margin-bottom:1rem}.related-discuss-part{padding:0 0 1rem 1.5rem;position:relative;z-index:2}.related-discuss-part .related-discuss-part-content{padding:0 .25rem}.discussion-card-title{font-size:1.25rem;font-weight:700}.discussion-heading{font-size:.875rem;font-weight:400;pointer-events:none;margin-bottom:0;margin-top:.5rem}.discussion-content{display:flex;align-items:center;margin-bottom:1rem;font-size:.875rem;flex-wrap:wrap;margin-bottom:0;margin-top:1rem}.comment-section{display:flex;align-items:center;justify-content:space-between;margin:.5rem 0;flex-direction:row;flex-wrap:wrap}.post-header-content{display:flex;align-items:center}.circle-text{border-radius:50%;width:1.75rem;height:1.75rem;display:flex;justify-content:center;align-items:center;background-color:#306933}.circle-label{color:var(--white);font-size:1rem;line-height:.75rem;letter-spacing:.2625px;text-transform:uppercase}.discussion-labels{color:var(--gray-400);margin-left:.5rem;font-size:.875rem}.comments-area{display:flex;align-items:center;justify-content:space-between;font-weight:700;flex-direction:row;font-size:.875rem;margin:1rem 0}.text-form-field{display:flex;flex-direction:column}.text-content{min-height:6.75rem;max-height:33.75rem;margin-bottom:.875rem;background-color:var(--df-field-control-bg);border:.0625rem solid var(--gray-200);border-radius:.1875rem;color:var(--df-text);display:block;font-size:.8125rem;font-family:sans-serif;position:relative;cursor:pointer;outline:0;padding:.5rem .875rem}.text-content.is-invalid,.text-content.is-invalid:hover,.text-content.is-invalid:focus{border:.0625rem solid var(--red-100)}.text-content.is-valid,.text-content.is-valid:hover,.text-content.is-valid:focus{border:.0625rem solid var(--primary-400)}.up-vote-text,.down-vote-text{font-size:1rem;color:var(--black);margin-right:.5rem}.post-card,.post-reply-card{border-bottom:.0625rem solid var(--gray-100);margin-bottom:1.5rem}.post-sub-card{margin:0 .5rem .5rem;border:0}.comments-section{display:flex;align-items:center;justify-content:space-between}.post-icons{margin-right:1rem}.post-name{font-size:1rem;font-weight:700;margin-left:1rem;word-break:break-all;text-transform:capitalize}.post-time{color:var(var(--gray-400));margin:0 1rem;font-size:.875rem}.post-labels{font-size:.875rem;margin:0}.reply-area{display:flex;justify-content:space-between;align-items:center}.reply-area-content{position:relative;margin-top:1rem}.margin-gap-tb{margin:1rem 0}.custom-actions{display:flex;align-items:center}.edit-post{margin-right:1.25rem}.border-0{border-bottom:0px}.comments-count{color:var(--primary);font-weight:700;cursor:pointer}@media (max-width: 768px){.discuss-details-content{flex-direction:column}.related-discuss-part{padding:0}.post-btn{width:100%;margin-top:.5rem;cursor:pointer}.post-time{margin-top:.5rem;margin-left:0}.comment-section{display:flex;flex-direction:column;align-items:start;margin-bottom:.5rem}}.df-btn-disabled{background-color:var(--gray-100)!important;color:var(--gray-200)!important}.df-reply-btn{margin-bottom:.5rem}.edited-text{padding-left:.5rem;margin-top:.25rem;font-size:.75rem;color:var(--gray-200)}.delete-icon,.edit-icon{cursor:pointer;width:1rem;height:1rem;margin:0 .5rem}.discuss-card-kabab-menu{display:flex;justify-content:space-between;flex-wrap:wrap}.kabab-menu{color:var(--primary-400);width:1.875rem;height:1.875rem;line-height:1.75rem;text-align:center;border-radius:50%;padding-left:.5rem;position:absolute;right:.5rem}.kabab-menu:hover{background:var(--gray-0);cursor:pointer}.kabab-menu:after{content:\"\\2807\";font-size:1.5rem}.kabab-menu-dropdown-content{position:absolute;border-radius:.125rem;background-color:var(--white);box-shadow:0 3px 5px 4px rgba(var(--rc-rgba-black),.05);padding:.5rem;z-index:1;text-align:left;right:0;top:0;min-width:13.125rem}.kabab-menu-dropdown-content .list{display:flex;align-items:center;width:100%;cursor:pointer;font-size:.875rem;padding:.5rem}.kabab-menu-dropdown-content .list:hover,.kabab-menu-dropdown-content .list:active{background-color:var(--primary-100)}.kabab-menu-dropdown-content .list:last-child .df-btn-normal{color:var(--red-400)}.kabab-menu-dropdown-content .list .df-btn-normal{font-size:.875rem}::ng-deep html[dir=rtl] .kabab-menu-dropdown-content{right:auto;left:0}.vote-value{margin-left:.5rem}.icons{width:.875rem;height:.875rem;position:relative;cursor:pointer}.edit-text{display:flex}.last-reply-data{margin:1rem 0;font-size:.875rem}.reply-content{display:flex;align-items:center}.replies{width:100%}.replies-count{font-size:.875rem;font-weight:700;cursor:pointer}.toggle-icon{padding:0 1rem;cursor:pointer}\n"] }]
3202
+ }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: DiscussionService }, { type: ConfigService }, { type: i2$1.UntypedFormBuilder }, { type: i1.Router }, { type: TelemetryUtilsService }, { type: i0.Renderer2 }, { type: i6.Location }, { type: NavigationServiceService }]; }, propDecorators: { topicId: [{
3203
+ type: Input
3204
+ }], slug: [{
3205
+ type: Input
3206
+ }], widget: [{
3207
+ type: Input
3208
+ }], stateChange: [{
3209
+ type: Output
3210
+ }] } });
3211
+
3212
+ /* tslint:enable */
3213
+ class TrendingTagsComponent {
3214
+ constructor(router, configService, navigationService) {
3215
+ this.router = router;
3216
+ this.configService = configService;
3217
+ this.navigationService = navigationService;
3218
+ this.stateChange = new EventEmitter();
3219
+ this.max = 0;
3220
+ }
3221
+ ngOnInit() {
3222
+ // debugger
3223
+ this.max = ___default.get(___default.maxBy(this.tags, 'score'), 'score') || 0;
3224
+ this.trandingTags = ___default.chain(this.tags).orderBy('score', 'desc').take(5).value();
3225
+ }
3226
+ ngOnChanges(data) {
3227
+ // debugger
3228
+ // this.tableData!.columns = data.tableData.currentValue.columns
3229
+ this.tags = ___default.get(data, 'tags.currentValue');
3230
+ this.max = ___default.get(___default.maxBy(this.tags, 'score'), 'score') || 0;
3231
+ this.trandingTags = ___default.chain(this.tags).orderBy('score', 'desc').take(5).value();
3232
+ }
3233
+ // TODO: To enable trending tags click and navigate to tags detals page
3234
+ getAllDiscussions(tag) {
3235
+ // debugger
3236
+ this.queryParam = tag.value;
3237
+ const tagdata = {
3238
+ tagname: ''
3239
+ };
3240
+ tagdata.tagname = tag.value;
3241
+ this.queryParam = tagdata;
3242
+ const routerSlug = this.configService.getConfig().routerSlug ? this.configService.getConfig().routerSlug : '';
3243
+ const input = { data: { url: `${routerSlug}${ROUTES.TAG}tag-discussions`,
3244
+ queryParams: this.queryParam, tagName: this.queryParam.tagName }, action: 'tagsAll' };
3245
+ this.navigationService.navigate(input);
3246
+ this.stateChange.emit({ action: TAG_ALL_DISCUSS, title: tag.value, tid: 'sd' });
3247
+ // tslint:disable-next-line: max-line-length
3248
+ // this.router.navigate([`${this.configService.getRouterSlug()}${CONSTANTS.ROUTES.TAG}tag-discussions`], { queryParams: this.queryParam });
3249
+ }
3250
+ css() {
3251
+ // return 'linear - gradient(to left, #00ff00 " + 80 + " %, #ff0000 20 %)"
3252
+ }
3253
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TrendingTagsComponent, deps: [{ token: i1.Router }, { token: ConfigService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
3254
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TrendingTagsComponent, selector: "lib-discuss-trending-tags", inputs: { tags: "tags" }, outputs: { stateChange: "stateChange" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"margin-left-l right_tag_inner_box\">\n <span class=\"mat-subheading-2\" role=\"link\" tabindex=\"0\" aria-label=\"Trending tags\">Trending tags</span>\n <ng-container *ngIf=\"trandingTags && trandingTags.length > 0\">\n <div *ngFor=\"let tag of trandingTags\" class=\"tag ws-mat-primary-lite-background-important cursor-pointer\" role=\"link\" tabindex=\"0\"\n [attr.aria-label]=\"tag.value\"\n [ngStyle]=\"{'background-image':'linear-gradient(to right, #ECECEC, #ECECEC ' + ((tag.score / max) *100 ) + '%, #FFF 24px)'}\" (click)=\"getAllDiscussions(tag)\">\n <span class=\"margin-left-m mat-caption\">{{tag.value}}</span>\n <span class=\"custom-margin margin-right-m mat-subheading-2\">{{tag.score}}</span>\n </div>\n </ng-container>\n </div>\n\n <div class=\"update_box margin-left-l\"> \n <span class=\"mat-subheading-2\" role=\"link\" tabindex=\"0\" aria-label=\"Updates\">Updates</span>\n <div class=\"update_inner_box flex flex-col items-center justify-center\">\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">1 Upvote on your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">What is the most reliable and useful source for COVID related ..</p>\n </div>\n </div>\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">@sundaramraj answered your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">I think the solution to such a problem would be to extensively..</p>\n </div>\n </div>\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">1 Upvote on your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">What is the most reliable and useful source for COVID related ..</p>\n </div>\n </div>\n\n <div class=\"flex flex-col items-center update_btn_box\">\n <a class=\"all_update_link flex mat-subheading-2 justify-center\">ALL UPDATES</a>\n </div>\n\n </div>\n </div>", styles: [":root{font-size:16px;--blue: #024f9d;--green: #008840;--black: #000000;--white: #ffffff;--red:#ff4558;--primary: var(--blue);--secondary: #008840;--tertiary: #e55a28;--gray-hs: 0, 0%;--gray: hsl(var(--gray-hs), 20%);--gray-0: hsl(var(--gray-hs), 95%);--gray-100: hsl(var(--gray-hs), 80%);--gray-200: hsl(var(--gray-hs), 60%);--gray-300: hsl(var(--gray-hs), 59%);--gray-400: hsl(var(--gray-hs), 40%);--gray-800: var(--gray);--primary-hs: 210, 97%;--primary: hsl(var(--primary-hs), 31%);--primary-0: hsl(var(--primary-hs), 98%);--primary-100: hsl(var(--primary-hs), 88%);--primary-200: hsl(var(--primary-hs), 78%);--primary-250: hsl(var(--primary-hs), 73%);--primary-300: hsl(var(--primary-hs), 68%);--primary-400: var(--primary);--primary-600: hsl(var(--primary), 48%);--primary-800: hsl(var(--primary-hs), 38%);--secondary-hs: 148, 100%;--secondary: hsl(var(--secondary-hs), 27%);--secondary-0: hsl(var(--secondary-hs), 94%);--secondary-100: hsl(var(--secondary-hs), 39%);--secondary-200: hsl(var(--secondary-hs), 38%);--secondary-400: var(--secondary);--tertiary-hs:16,78%;--tertiary:hsl(var(--tertiary-hs), 53%);--tertiary-0:hsl(var(--tertiary-hs), 92%);--tertiary-100: hsl(var(--tertiary-hs), 56%);--tertiary-400: var(--tertiary);--red-0: #fbccd1;--red-100: #ff6979;--red-400: var(--red);--df-e9e8d9:#e9e8d9;--df-333:#333;--text-color:var(--df-333);--df-background:var(--white);--df-common-bg:var(--white);--df-body-bg: var(--primary-0);--df-theme-bg: var(--df-background);--df-text: var(--text-color);--df-card-bg: var(--df-background);--df-btn-default-color: var(--white);--df-field-control-bg: var(--df-background);--df-cancel-btn-bg:var(--df-background);--df-tab-bg: var(--df-background);--df-tab-text: var(--primary);--df-tab-bg-active: var(--primary);--df-tab-text-active: var(--white)}.recent-tabs{transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;box-shadow:none!important;border-radius:unset;background:inherit!important;z-index:unset;padding-bottom:.5rem}.recent-tabs .tabs-content{display:flex;flex:1 1 0%;flex-direction:column}.recent-tabs .tabs-content .tabs-filter{display:flex;flex:1 1 0%;flex-wrap:wrap}.recent-tabs .tabs-content .tabs-filter .filter-option{background:var(--df-tab-bg);padding:.5rem 1rem;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;font-size:.875rem;font-weight:700;margin-right:.75rem;margin-top:.5rem;transition:all ease .3s;display:flex;align-items:center;cursor:pointer;white-space:nowrap;text-decoration:none;color:var(--df-tab-text)}.recent-tabs .tabs-content .tabs-filter .filter-option:first-child{margin-left:0}.recent-tabs .tabs-content .tabs-filter .filter-option:hover,.recent-tabs .tabs-content .tabs-filter .filter-option.tabs-active{color:var(--df-btn-default-color);text-decoration:none;background-color:var(--df-tab-bg-active)}.tags{display:flex;flex:1;flex-direction:row;flex-wrap:wrap;position:relative;z-index:2}@media (max-width: 768px){.tags{z-index:unset}}.tags .tag{font-size:.75rem;display:flex;width:auto;min-width:max-content;max-height:2rem;justify-content:space-between;align-items:center;text-transform:lowercase;margin:.5rem 1rem .5rem 0;padding:.5rem 1rem;border-radius:1.5rem;cursor:pointer}.df-cancel-btn{background-color:var(--white);color:var(--primary-400);border-color:var(--primary-400);margin:0 .5rem}.df-cancel-btn:hover,.df-cancel-btn:active{color:var(--primary-800);background-color:var(--primary-100)}.topic-list-container{overflow-y:auto;overflow-x:hidden;height:calc(100vh - 150px)!important}#topic-scroll::-webkit-scrollbar-track{box-shadow:inset 0 0 6px #0000004d;background-color:#ccc}#topic-scroll::-webkit-scrollbar{width:8px}#topic-scroll::-webkit-scrollbar-thumb{background:gray}.no-card-content{cursor:pointer;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:0;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;width:auto}.no-card-content .no-data-label{font-size:1.25rem;font-weight:700}.df-btn{white-space:nowrap;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;outline:0;display:inline-block;border:0;cursor:pointer;min-width:4rem;border-radius:.125rem;position:relative;line-height:1;text-transform:inherit;text-decoration:none}.df-btn-normal{height:2rem;padding:.5rem 1rem;font-size:.75rem}.df-btn-primary{background-color:var(--primary-400)}.df-btn-secondary{background-color:var(--secondary-200)}.df-btn-tertiary{background-color:var(--tertiary-100)}.df-btn-danger{background-color:var(--red-100)}.df-btn-danger:hover{background-color:var(--red-400)}.df-btn-primary,.df-btn-secondary,.df-btn-tertiary,.df-btn-danger{color:var(--df-btn-default-color)}.df-btn-primary.active,.df-btn-primary:active,.df-btn-primary:hover{background-color:var(--primary-800)}.df-btn-secondary.active,.df-btn-secondary:active,.df-btn-secondary:hover{background-color:var(--secondary-400)}.df-btn-tertiary.active,.df-btn-tertiary:active,.df-btn-tertiary:hover{background-color:var(--tertiary-400)}.tag{display:flex;width:17.25rem;height:2rem;border-radius:.25rem;justify-content:space-between;margin:.5rem 0;align-items:center;box-sizing:border-box}.custom-margin{margin-top:auto!important;margin-bottom:auto!important}@media (max-width: 768px){.right_tag_inner_box{width:100%;margin-left:0!important}}.update_box{box-sizing:border-box;margin-top:2rem;display:none}.update_box .update_inner_box{box-sizing:border-box;margin-top:1rem}.update_box .update_inner_box .update_card{box-sizing:border-box}.update_box .update_inner_box .update_card .card_head p.blue_heading{color:var(--primary);margin-bottom:.5rem}.update_box .update_inner_box .update_btn_box{width:100%;margin-top:.5rem}.update_box .update_inner_box .update_btn_box a.all_update_link{width:100%;padding:.5rem 0;text-align:center;color:var(--primary);border-radius:.25rem;border:.0625rem solid var(--black)}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
3255
+ }
3256
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TrendingTagsComponent, decorators: [{
3257
+ type: Component,
3258
+ args: [{ selector: 'lib-discuss-trending-tags', template: "<div class=\"margin-left-l right_tag_inner_box\">\n <span class=\"mat-subheading-2\" role=\"link\" tabindex=\"0\" aria-label=\"Trending tags\">Trending tags</span>\n <ng-container *ngIf=\"trandingTags && trandingTags.length > 0\">\n <div *ngFor=\"let tag of trandingTags\" class=\"tag ws-mat-primary-lite-background-important cursor-pointer\" role=\"link\" tabindex=\"0\"\n [attr.aria-label]=\"tag.value\"\n [ngStyle]=\"{'background-image':'linear-gradient(to right, #ECECEC, #ECECEC ' + ((tag.score / max) *100 ) + '%, #FFF 24px)'}\" (click)=\"getAllDiscussions(tag)\">\n <span class=\"margin-left-m mat-caption\">{{tag.value}}</span>\n <span class=\"custom-margin margin-right-m mat-subheading-2\">{{tag.score}}</span>\n </div>\n </ng-container>\n </div>\n\n <div class=\"update_box margin-left-l\"> \n <span class=\"mat-subheading-2\" role=\"link\" tabindex=\"0\" aria-label=\"Updates\">Updates</span>\n <div class=\"update_inner_box flex flex-col items-center justify-center\">\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">1 Upvote on your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">What is the most reliable and useful source for COVID related ..</p>\n </div>\n </div>\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">@sundaramraj answered your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">I think the solution to such a problem would be to extensively..</p>\n </div>\n </div>\n\n <div class=\"mat-card flex flex-col update_card margin-bottom-s\">\n <div class=\"flex fex-1 items-center justify-start card_head\">\n <p class=\"mat-subheading-1 blue_heading\">1 Upvote on your question</p>\n </div>\n <div class=\"flex fex-1 items-center justify-start card_body\">\n <p class=\"mat-body-2\">What is the most reliable and useful source for COVID related ..</p>\n </div>\n </div>\n\n <div class=\"flex flex-col items-center update_btn_box\">\n <a class=\"all_update_link flex mat-subheading-2 justify-center\">ALL UPDATES</a>\n </div>\n\n </div>\n </div>", styles: [":root{font-size:16px;--blue: #024f9d;--green: #008840;--black: #000000;--white: #ffffff;--red:#ff4558;--primary: var(--blue);--secondary: #008840;--tertiary: #e55a28;--gray-hs: 0, 0%;--gray: hsl(var(--gray-hs), 20%);--gray-0: hsl(var(--gray-hs), 95%);--gray-100: hsl(var(--gray-hs), 80%);--gray-200: hsl(var(--gray-hs), 60%);--gray-300: hsl(var(--gray-hs), 59%);--gray-400: hsl(var(--gray-hs), 40%);--gray-800: var(--gray);--primary-hs: 210, 97%;--primary: hsl(var(--primary-hs), 31%);--primary-0: hsl(var(--primary-hs), 98%);--primary-100: hsl(var(--primary-hs), 88%);--primary-200: hsl(var(--primary-hs), 78%);--primary-250: hsl(var(--primary-hs), 73%);--primary-300: hsl(var(--primary-hs), 68%);--primary-400: var(--primary);--primary-600: hsl(var(--primary), 48%);--primary-800: hsl(var(--primary-hs), 38%);--secondary-hs: 148, 100%;--secondary: hsl(var(--secondary-hs), 27%);--secondary-0: hsl(var(--secondary-hs), 94%);--secondary-100: hsl(var(--secondary-hs), 39%);--secondary-200: hsl(var(--secondary-hs), 38%);--secondary-400: var(--secondary);--tertiary-hs:16,78%;--tertiary:hsl(var(--tertiary-hs), 53%);--tertiary-0:hsl(var(--tertiary-hs), 92%);--tertiary-100: hsl(var(--tertiary-hs), 56%);--tertiary-400: var(--tertiary);--red-0: #fbccd1;--red-100: #ff6979;--red-400: var(--red);--df-e9e8d9:#e9e8d9;--df-333:#333;--text-color:var(--df-333);--df-background:var(--white);--df-common-bg:var(--white);--df-body-bg: var(--primary-0);--df-theme-bg: var(--df-background);--df-text: var(--text-color);--df-card-bg: var(--df-background);--df-btn-default-color: var(--white);--df-field-control-bg: var(--df-background);--df-cancel-btn-bg:var(--df-background);--df-tab-bg: var(--df-background);--df-tab-text: var(--primary);--df-tab-bg-active: var(--primary);--df-tab-text-active: var(--white)}.recent-tabs{transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;box-shadow:none!important;border-radius:unset;background:inherit!important;z-index:unset;padding-bottom:.5rem}.recent-tabs .tabs-content{display:flex;flex:1 1 0%;flex-direction:column}.recent-tabs .tabs-content .tabs-filter{display:flex;flex:1 1 0%;flex-wrap:wrap}.recent-tabs .tabs-content .tabs-filter .filter-option{background:var(--df-tab-bg);padding:.5rem 1rem;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;font-size:.875rem;font-weight:700;margin-right:.75rem;margin-top:.5rem;transition:all ease .3s;display:flex;align-items:center;cursor:pointer;white-space:nowrap;text-decoration:none;color:var(--df-tab-text)}.recent-tabs .tabs-content .tabs-filter .filter-option:first-child{margin-left:0}.recent-tabs .tabs-content .tabs-filter .filter-option:hover,.recent-tabs .tabs-content .tabs-filter .filter-option.tabs-active{color:var(--df-btn-default-color);text-decoration:none;background-color:var(--df-tab-bg-active)}.tags{display:flex;flex:1;flex-direction:row;flex-wrap:wrap;position:relative;z-index:2}@media (max-width: 768px){.tags{z-index:unset}}.tags .tag{font-size:.75rem;display:flex;width:auto;min-width:max-content;max-height:2rem;justify-content:space-between;align-items:center;text-transform:lowercase;margin:.5rem 1rem .5rem 0;padding:.5rem 1rem;border-radius:1.5rem;cursor:pointer}.df-cancel-btn{background-color:var(--white);color:var(--primary-400);border-color:var(--primary-400);margin:0 .5rem}.df-cancel-btn:hover,.df-cancel-btn:active{color:var(--primary-800);background-color:var(--primary-100)}.topic-list-container{overflow-y:auto;overflow-x:hidden;height:calc(100vh - 150px)!important}#topic-scroll::-webkit-scrollbar-track{box-shadow:inset 0 0 6px #0000004d;background-color:#ccc}#topic-scroll::-webkit-scrollbar{width:8px}#topic-scroll::-webkit-scrollbar-thumb{background:gray}.no-card-content{cursor:pointer;box-shadow:0 2px 1px -1px #0003,0 1px 1px #00000024,0 1px 3px #0000001f;background:var(--df-card-bg);color:var(--df-text);flex:1;height:auto;margin-bottom:0;transition:box-shadow .28s cubic-bezier(.4,0,.2,1);display:block;position:relative;padding:1rem;border-radius:.25rem;width:auto}.no-card-content .no-data-label{font-size:1.25rem;font-weight:700}.df-btn{white-space:nowrap;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;outline:0;display:inline-block;border:0;cursor:pointer;min-width:4rem;border-radius:.125rem;position:relative;line-height:1;text-transform:inherit;text-decoration:none}.df-btn-normal{height:2rem;padding:.5rem 1rem;font-size:.75rem}.df-btn-primary{background-color:var(--primary-400)}.df-btn-secondary{background-color:var(--secondary-200)}.df-btn-tertiary{background-color:var(--tertiary-100)}.df-btn-danger{background-color:var(--red-100)}.df-btn-danger:hover{background-color:var(--red-400)}.df-btn-primary,.df-btn-secondary,.df-btn-tertiary,.df-btn-danger{color:var(--df-btn-default-color)}.df-btn-primary.active,.df-btn-primary:active,.df-btn-primary:hover{background-color:var(--primary-800)}.df-btn-secondary.active,.df-btn-secondary:active,.df-btn-secondary:hover{background-color:var(--secondary-400)}.df-btn-tertiary.active,.df-btn-tertiary:active,.df-btn-tertiary:hover{background-color:var(--tertiary-400)}.tag{display:flex;width:17.25rem;height:2rem;border-radius:.25rem;justify-content:space-between;margin:.5rem 0;align-items:center;box-sizing:border-box}.custom-margin{margin-top:auto!important;margin-bottom:auto!important}@media (max-width: 768px){.right_tag_inner_box{width:100%;margin-left:0!important}}.update_box{box-sizing:border-box;margin-top:2rem;display:none}.update_box .update_inner_box{box-sizing:border-box;margin-top:1rem}.update_box .update_inner_box .update_card{box-sizing:border-box}.update_box .update_inner_box .update_card .card_head p.blue_heading{color:var(--primary);margin-bottom:.5rem}.update_box .update_inner_box .update_btn_box{width:100%;margin-top:.5rem}.update_box .update_inner_box .update_btn_box a.all_update_link{width:100%;padding:.5rem 0;text-align:center;color:var(--primary);border-radius:.25rem;border:.0625rem solid var(--black)}\n"] }]
3259
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: ConfigService }, { type: NavigationServiceService }]; }, propDecorators: { tags: [{
3260
+ type: Input
3261
+ }], stateChange: [{
3262
+ type: Output
3263
+ }] } });
3264
+
3265
+ // import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
3266
+ /* tslint:enable */
3267
+ class DiscussAllComponent {
3268
+ constructor(router, route, discussionService, configService, activatedRoute, telemetryUtils, navigationService
3269
+ // private modalService: BsModalService
3270
+ ) {
3271
+ this.router = router;
3272
+ this.route = route;
3273
+ this.discussionService = discussionService;
3274
+ this.configService = configService;
3275
+ this.activatedRoute = activatedRoute;
3276
+ this.telemetryUtils = telemetryUtils;
3277
+ this.navigationService = navigationService;
3278
+ this.stateChange = new EventEmitter();
3279
+ this.showStartDiscussionModal = false;
3280
+ this.isTopicCreator = false;
3281
+ this.showLoader = false;
3282
+ this.currentFilter = 'recent';
3283
+ this.currentActivePage = 1;
3284
+ this.cIds = [];
3285
+ this.sticky = false;
3286
+ }
3287
+ ngOnInit() {
3288
+ this.telemetryUtils.logImpression(NSDiscussData.IPageName.HOME);
3289
+ if (this.context) {
3290
+ this.isWidget = true;
3291
+ this.getForumIds();
3292
+ }
3293
+ else {
3294
+ this.cIds = this.configService.getCategories().result;
3295
+ this.loadDiscussionData();
3296
+ }
3297
+ }
3298
+ async getForumIds() {
3299
+ let body = {
3300
+ "identifier": this.context.contextIdArr,
3301
+ "type": this.context.contextType
3302
+ };
3303
+ let resp = await this.discussionService.getForumIds(body);
3304
+ if (resp.result.length > 0) {
3305
+ resp.result.forEach(forum => {
3306
+ this.cIds.push(forum.cid);
3307
+ });
3308
+ }
3309
+ else {
3310
+ this.discussionService.createForum(this.context.categoryObj).subscribe(((data) => {
3311
+ data.result.forEach(forum => {
3312
+ this.cIds.push(forum.newCid);
3313
+ });
3314
+ }));
3315
+ }
3316
+ this.loadDiscussionData();
3317
+ }
3318
+ loadDiscussionData() {
3319
+ // debugger
3320
+ // this.cIds = this.context ? this.context.categories : this.configService.getCategories()
3321
+ this.categoryId = this.discussionService.getContext(CONTEXT_PROPS.cid);
3322
+ if (this.configService.hasContext() || this.context) {
3323
+ this.getContextBasedDiscussion(this.cIds);
3324
+ // This is to show context based trending tags
3325
+ this.getContextBasedTags(this.cIds);
3326
+ }
3327
+ else {
3328
+ // this.currentActivePage = 1
3329
+ this.refreshData();
3330
+ // This is to show trending tags
3331
+ this.fetchAllTags();
3332
+ }
3333
+ }
3334
+ navigateToDiscussionDetails(discussionData) {
3335
+ const matchedTopic = _.find(this.telemetryUtils.getContext(), { type: 'Topic' });
3336
+ if (matchedTopic) {
3337
+ this.telemetryUtils.deleteContext(matchedTopic);
3338
+ }
3339
+ this.telemetryUtils.uppendContext({
3340
+ id: _.get(discussionData, 'tid'),
3341
+ type: 'Topic'
3342
+ });
3343
+ const slug = _.trim(_.get(discussionData, 'slug'));
3344
+ // tslint:disable-next-line: max-line-length
3345
+ const input = { data: { url: `${this.configService.getRouterSlug()}${ROUTES.TOPIC}${slug}`, queryParams: {} }, action: CATEGORY_DETAILS, };
3346
+ this.navigationService.navigate(input);
3347
+ this.stateChange.emit({ action: CATEGORY_DETAILS, title: discussionData.title, tid: discussionData.tid });
3348
+ // this.router.navigate([`${this.configService.getRouterSlug()}${CONSTANTS.ROUTES.TOPIC}${slug}`], { queryParamsHandling: "merge" });
3349
+ }
3350
+ acceptData(singleTagDetails) {
3351
+ // debugger
3352
+ if (this.context) {
3353
+ singleTagDetails.cIds = this.cIds;
3354
+ }
3355
+ this.stateChange.emit(singleTagDetails);
3356
+ }
3357
+ getDiscussionList(slug) {
3358
+ this.showLoader = true;
3359
+ // TODO : this.currentActivePage shoulb be dynamic when pagination will be implemented
3360
+ this.discussionService.getContextBasedTopic(slug, this.currentActivePage).subscribe(data => {
3361
+ this.showLoader = false;
3362
+ this.isTopicCreator = _.get(data, 'privileges.topics:create') === true ? true : false;
3363
+ this.discussionList = _.union(_.get(data, 'topics'), _.get(data, 'children'));
3364
+ }, error => {
3365
+ this.showLoader = false;
3366
+ // TODO: Toaster
3367
+ console.log('error fetching topic list', error);
3368
+ });
3369
+ }
3370
+ filter(key) {
3371
+ if (key) {
3372
+ this.currentFilter = key;
3373
+ switch (key) {
3374
+ case 'recent':
3375
+ this.cIds.length ? this.getContextData(this.cIds.result) : this.fillrecent();
3376
+ break;
3377
+ case 'popular':
3378
+ this.cIds.length ? this.getContextData(this.cIds.result) : this.fillPopular();
3379
+ break;
3380
+ default:
3381
+ break;
3382
+ }
3383
+ }
3384
+ }
3385
+ fillrecent(_page) {
3386
+ this.getRecentData();
3387
+ }
3388
+ fillPopular(page) {
3389
+ this.showLoader = true;
3390
+ return this.discussionService.fetchPopularD(page).subscribe((response) => {
3391
+ this.showLoader = false;
3392
+ this.discussionList = [];
3393
+ _.filter(response.topics, (topic) => {
3394
+ if (topic.user.uid !== 0 && topic.cid !== 1) {
3395
+ this.discussionList.push(topic);
3396
+ }
3397
+ });
3398
+ // this.discussionList = _.get(response, 'topics')
3399
+ }, error => {
3400
+ this.showLoader = false;
3401
+ // TODO: Toaster
3402
+ console.log('error fetching topic list', error);
3403
+ });
3404
+ }
3405
+ getContextBasedDiscussion(cid) {
3406
+ this.currentFilter === 'recent' ? this.getContextData(cid) : this.getContextData(cid);
3407
+ }
3408
+ refreshData(page) {
3409
+ this.currentFilter === 'recent' ? this.getRecentData() : this.fillPopular(page);
3410
+ }
3411
+ getRecentData() {
3412
+ this.showLoader = true;
3413
+ return this.discussionService.fetchRecentPost().subscribe((data) => {
3414
+ this.showLoader = false;
3415
+ this.discussionList = [];
3416
+ _.filter(data.topics, (topic) => {
3417
+ if (topic.user.uid !== 0 && topic.cid !== 1) {
3418
+ this.discussionList.push(topic);
3419
+ }
3420
+ });
3421
+ this.discussionList = _.get(data, 'posts');
3422
+ }, error => {
3423
+ this.showLoader = false;
3424
+ // TODO: Toaster
3425
+ console.log('error fetching topic list', error);
3426
+ });
3427
+ }
3428
+ getContextData(cid) {
3429
+ this.showLoader = true;
3430
+ const req = {
3431
+ // request: {
3432
+ cids: cid
3433
+ // }
3434
+ };
3435
+ return this.discussionService.getContextBasedDiscussion(req).subscribe((data) => {
3436
+ this.showLoader = false;
3437
+ let result = data.result;
3438
+ let res = result.filter((elem) => {
3439
+ return (elem.statusCode !== 404);
3440
+ });
3441
+ this.allTopics = _.map(res, (topic) => topic.topics);
3442
+ this.discussionList = _.flatten(this.allTopics);
3443
+ }, error => {
3444
+ this.showLoader = false;
3445
+ // TODO: Toaster
3446
+ console.log('error fetching topic list', error);
3447
+ });
3448
+ }
3449
+ fetchAllTags() {
3450
+ this.showLoader = true;
3451
+ this.discussionService.fetchAllTag().subscribe(data => {
3452
+ this.showLoader = false;
3453
+ this.trendingTags = _.get(data, 'tags');
3454
+ }, error => {
3455
+ this.showLoader = false;
3456
+ // TODO: toaster
3457
+ console.log('error fetching tags');
3458
+ });
3459
+ }
3460
+ getContextBasedTags(cid) {
3461
+ const req = {
3462
+ cids: cid
3463
+ };
3464
+ this.showLoader = true;
3465
+ this.discussionService.contextBasedTags(req).subscribe(data => {
3466
+ this.showLoader = false;
3467
+ this.trendingTags = _.get(data, 'result');
3468
+ }, error => {
3469
+ this.showLoader = false;
3470
+ // TODO: toaster
3471
+ console.log('error fetching tags');
3472
+ });
3473
+ }
3474
+ // startDiscussion(template: TemplateRef<any>) {
3475
+ // this.modalRef = this.modalService.show(template);
3476
+ // this.showStartDiscussionModal = true;
3477
+ // this.bsModalRef = this.modalService.show(DiscussStartComponent);
3478
+ // this.bsModalRef.content.onClose().subscribe(
3479
+ // console.log('completed')
3480
+ // );
3481
+ // }
3482
+ startDiscussion() {
3483
+ debugger;
3484
+ this.showStartDiscussionModal = true;
3485
+ if (this.context) {
3486
+ this.startDiscussionCategoryId = this.cIds;
3487
+ }
3488
+ }
3489
+ logTelemetry(event) {
3490
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.HOME);
3491
+ }
3492
+ closeModal(event) {
3493
+ if (_.get(event, 'message') === 'success') {
3494
+ if (this.context) {
3495
+ this.getContextBasedDiscussion(this.cIds);
3496
+ }
3497
+ else {
3498
+ this.refreshData();
3499
+ }
3500
+ // this.getDiscussionList(_.get(this.routeParams, 'slug'));
3501
+ }
3502
+ this.showStartDiscussionModal = false;
3503
+ }
3504
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussAllComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: DiscussionService }, { token: ConfigService }, { token: i1.ActivatedRoute }, { token: TelemetryUtilsService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
3505
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DiscussAllComponent, selector: "lib-discuss-all", inputs: { context: "context", categoryAction: "categoryAction" }, outputs: { stateChange: "stateChange" }, ngImport: i0, template: "<div class=\"main-div\">\n\n <!-- <button (click)=\"startDiscussion();logTelemetry($event)\" class=\"df-btn df-btn-normal df-btn-primary\" data-toggle=\"modal\"\n data-target=\"#myModal\" id=\"start-discussion\">Start Discussion</button> -->\n\n\n <div class=\"flex flex-1 custom discussion_outer_box\">\n <div class=\"flex flex-3 flex-column discussion_main_box\">\n <div (click)=\"startDiscussion();logTelemetry($event)\" data-toggle=\"modal\"\n data-target=\"#myModal\" id=\"start-discussion\">\n <a href=\"javascript:void(0)\" class=\"flex flex-1 cursor-pointer margin-fix height-48\" i18n-aria-label role=\"link\">\n <div\n class=\"flex flex-1 items-center border discuss border-solid discuss-border ws-mat-primary-background-op100 \">\n <div class=\"w-full discuss truncate\">\n <span class=\"overflow ml-4 start-btn-hint mb-0 mat-body-1\">Ask a question or post an idea</span>\n </div>\n <div class=\"discuss-home text-white flex items-center justify-center cursor-pointer mat-subheading-2\">\n Start discussion\n </div>\n </div>\n <!-- <div class=\"text-box\">Ask a question or post an idea</div> \n <div class=\"buton\">start discussion</div> -->\n </a>\n </div>\n\n <ng-container>\n <div class=\"flex flex-1 flex-row margin-fix tab_margin\">\n <div class=\"flex flex-1 filter max-height-60\">\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{'tabs-active' : currentFilter === 'recent',\n ' font-medium':currentFilter !== 'recent'}\" mat-button (click)=\"filter('recent')\" role=\"button\">Recent</a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{'tabs-active' : currentFilter === 'popular',\n ' font-medium':currentFilter !== 'popular'}\" mat-button (click)=\"filter('popular')\" role=\"button\">Popular</a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option watching_link\" mat-button role=\"button\">Watching</a>\n </div>\n <div class=\"flex items-center\">\n <a class=\"all_category_link mat-subheading-2 margin-remove\">All categories </a>\n </div>\n </div>\n </ng-container>\n <!-- <lib-app-loader *ngIf=\"showLoader\"></lib-app-loader> -->\n\n\n <ng-container *ngIf=\"discussionList && discussionList.length > 0\">\n <div (click)=\"navigateToDiscussionDetails(data);logTelemetry($event)\"\n *ngFor=\"let data of discussionList\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\" !(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n </ng-container>\n <!-- <div class=\"flex flex-1 flex-column margin-fix pagination-container\">\n <ws-app-pagination [pager]=\"pager\" (changePage)=\"navigateWithPage($event)\"></ws-app-pagination>\n </div> -->\n </div>\n <div *ngIf=\"!isWidget\" class=\"flex flex-1 right_tag_box\" #stickyMenu [class.sticky]=\"sticky\">\n <lib-discuss-trending-tags [tags]=\"trendingTags\" (stateChange)=\"acceptData($event)\"></lib-discuss-trending-tags>\n </div>\n </div>\n\n <lib-discuss-start (close)=\"closeModal($event)\" *ngIf=\"showStartDiscussionModal\" [categoryId]=\"startDiscussionCategoryId\">\n </lib-discuss-start>\n</div>", styles: [".fade:not(.show){opacity:1!important}.buton{display:flex;border:.0625rem solid;flex:1;background:var(--red);align-content:center;text-align:center}.sticky{position:fixed;top:0;overflow:hidden;z-index:10;width:100%}.text-box{display:flex;border:.0625rem solid;flex:3;align-content:center;text-align:center}.overflow{overflow:hidden}.font-medium{font-weight:500!important}.discuss-border{border-radius:.25rem;border:.0625rem solid var(--gray-200);flex:1}.discuss .mat-form-field-wrapper{padding-bottom:0}.discuss .mat-form-field-wrapper .mat-form-field-infix{border-top-width:.25rem!important;padding:0;padding-bottom:.25rem}.discuss-home{background:var(--primary) 0% 0% no-repeat padding-box;border-radius:0px .25rem .25rem 0px;padding:.875rem 2rem;min-width:-moz-fit-content;min-width:fit-content;margin:0 1rem 1rem}.flex-3{flex:3}.filter .filter-option{border-radius:0;border-bottom-width:.125rem;border-top-width:0;border-left-width:0;border-right-width:0;border-bottom:.0625rem solid var(--black)}.filter .filter-option.tabs-active{border-bottom:.1875rem solid var(--blue)}.start-btn-hint{display:block;margin-bottom:0;padding:1rem}.tab_margin{margin-bottom:1rem!important}a.all_category_link{color:var(--primary);display:none}.watching_link{display:none}@media (max-width: 768px){.main-div{display:block!important;width:100%!important;padding:0!important}.discussion_outer_box{display:block!important}.discussion_main_box,.right_tag_box{width:100%;display:block!important;float:none}}\n"], dependencies: [{ kind: "directive", type: i6.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DiscussCardComponent, selector: "lib-discuss-card", inputs: ["discussionData"] }, { kind: "component", type: DiscussStartComponent, selector: "lib-discuss-start", inputs: ["categoryId", "topicData", "mode"], outputs: ["close"] }, { kind: "component", type: TrendingTagsComponent, selector: "lib-discuss-trending-tags", inputs: ["tags"], outputs: ["stateChange"] }] }); }
3506
+ }
3507
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussAllComponent, decorators: [{
3508
+ type: Component,
3509
+ args: [{ selector: 'lib-discuss-all', template: "<div class=\"main-div\">\n\n <!-- <button (click)=\"startDiscussion();logTelemetry($event)\" class=\"df-btn df-btn-normal df-btn-primary\" data-toggle=\"modal\"\n data-target=\"#myModal\" id=\"start-discussion\">Start Discussion</button> -->\n\n\n <div class=\"flex flex-1 custom discussion_outer_box\">\n <div class=\"flex flex-3 flex-column discussion_main_box\">\n <div (click)=\"startDiscussion();logTelemetry($event)\" data-toggle=\"modal\"\n data-target=\"#myModal\" id=\"start-discussion\">\n <a href=\"javascript:void(0)\" class=\"flex flex-1 cursor-pointer margin-fix height-48\" i18n-aria-label role=\"link\">\n <div\n class=\"flex flex-1 items-center border discuss border-solid discuss-border ws-mat-primary-background-op100 \">\n <div class=\"w-full discuss truncate\">\n <span class=\"overflow ml-4 start-btn-hint mb-0 mat-body-1\">Ask a question or post an idea</span>\n </div>\n <div class=\"discuss-home text-white flex items-center justify-center cursor-pointer mat-subheading-2\">\n Start discussion\n </div>\n </div>\n <!-- <div class=\"text-box\">Ask a question or post an idea</div> \n <div class=\"buton\">start discussion</div> -->\n </a>\n </div>\n\n <ng-container>\n <div class=\"flex flex-1 flex-row margin-fix tab_margin\">\n <div class=\"flex flex-1 filter max-height-60\">\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{'tabs-active' : currentFilter === 'recent',\n ' font-medium':currentFilter !== 'recent'}\" mat-button (click)=\"filter('recent')\" role=\"button\">Recent</a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option\" [ngClass]=\"{'tabs-active' : currentFilter === 'popular',\n ' font-medium':currentFilter !== 'popular'}\" mat-button (click)=\"filter('popular')\" role=\"button\">Popular</a>\n <a href=\"javascript:void(0)\" role=\"link\" class=\"filter-option watching_link\" mat-button role=\"button\">Watching</a>\n </div>\n <div class=\"flex items-center\">\n <a class=\"all_category_link mat-subheading-2 margin-remove\">All categories </a>\n </div>\n </div>\n </ng-container>\n <!-- <lib-app-loader *ngIf=\"showLoader\"></lib-app-loader> -->\n\n\n <ng-container *ngIf=\"discussionList && discussionList.length > 0\">\n <div (click)=\"navigateToDiscussionDetails(data);logTelemetry($event)\"\n *ngFor=\"let data of discussionList\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\" !(discussionList && discussionList.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\">\n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n </ng-container>\n <!-- <div class=\"flex flex-1 flex-column margin-fix pagination-container\">\n <ws-app-pagination [pager]=\"pager\" (changePage)=\"navigateWithPage($event)\"></ws-app-pagination>\n </div> -->\n </div>\n <div *ngIf=\"!isWidget\" class=\"flex flex-1 right_tag_box\" #stickyMenu [class.sticky]=\"sticky\">\n <lib-discuss-trending-tags [tags]=\"trendingTags\" (stateChange)=\"acceptData($event)\"></lib-discuss-trending-tags>\n </div>\n </div>\n\n <lib-discuss-start (close)=\"closeModal($event)\" *ngIf=\"showStartDiscussionModal\" [categoryId]=\"startDiscussionCategoryId\">\n </lib-discuss-start>\n</div>", styles: [".fade:not(.show){opacity:1!important}.buton{display:flex;border:.0625rem solid;flex:1;background:var(--red);align-content:center;text-align:center}.sticky{position:fixed;top:0;overflow:hidden;z-index:10;width:100%}.text-box{display:flex;border:.0625rem solid;flex:3;align-content:center;text-align:center}.overflow{overflow:hidden}.font-medium{font-weight:500!important}.discuss-border{border-radius:.25rem;border:.0625rem solid var(--gray-200);flex:1}.discuss .mat-form-field-wrapper{padding-bottom:0}.discuss .mat-form-field-wrapper .mat-form-field-infix{border-top-width:.25rem!important;padding:0;padding-bottom:.25rem}.discuss-home{background:var(--primary) 0% 0% no-repeat padding-box;border-radius:0px .25rem .25rem 0px;padding:.875rem 2rem;min-width:-moz-fit-content;min-width:fit-content;margin:0 1rem 1rem}.flex-3{flex:3}.filter .filter-option{border-radius:0;border-bottom-width:.125rem;border-top-width:0;border-left-width:0;border-right-width:0;border-bottom:.0625rem solid var(--black)}.filter .filter-option.tabs-active{border-bottom:.1875rem solid var(--blue)}.start-btn-hint{display:block;margin-bottom:0;padding:1rem}.tab_margin{margin-bottom:1rem!important}a.all_category_link{color:var(--primary);display:none}.watching_link{display:none}@media (max-width: 768px){.main-div{display:block!important;width:100%!important;padding:0!important}.discussion_outer_box{display:block!important}.discussion_main_box,.right_tag_box{width:100%;display:block!important;float:none}}\n"] }]
3510
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: DiscussionService }, { type: ConfigService }, { type: i1.ActivatedRoute }, { type: TelemetryUtilsService }, { type: NavigationServiceService }]; }, propDecorators: { context: [{
3511
+ type: Input
3512
+ }], categoryAction: [{
3513
+ type: Input
3514
+ }], stateChange: [{
3515
+ type: Output
3516
+ }] } });
3517
+
3518
+ class TagAllDiscussionComponent {
3519
+ constructor(route, router, discussService, activatedRoute, configService, telemetryUtils, discussUtils, navigationService) {
3520
+ this.route = route;
3521
+ this.router = router;
3522
+ this.discussService = discussService;
3523
+ this.activatedRoute = activatedRoute;
3524
+ this.configService = configService;
3525
+ this.telemetryUtils = telemetryUtils;
3526
+ this.discussUtils = discussUtils;
3527
+ this.navigationService = navigationService;
3528
+ this.stateChange = new EventEmitter();
3529
+ this.fetchSingleCategoryLoader = false;
3530
+ this.defaultError = 'Something went wrong, Please try again after sometime!';
3531
+ this.pager = {};
3532
+ this.fetchNewData = false;
3533
+ }
3534
+ ngOnInit() {
3535
+ // debugger
3536
+ this.cIds = this.widgetcIds ? this.widgetcIds : this.configService.getCategories();
3537
+ if (this.widgetTagName) {
3538
+ this.tagName = this.widgetTagName;
3539
+ }
3540
+ else {
3541
+ this.activatedRoute.queryParams.subscribe((params) => {
3542
+ this.tagName = params.tagname ? params.tagname : this.tagName;
3543
+ });
3544
+ }
3545
+ // To check wheather any contexts are there or not from the config service
3546
+ if (this.configService.hasContext() || this.widgetcIds) {
3547
+ this.fetchContextBasedTagDetails(this.tagName, this.cIds, this.currentActivePage);
3548
+ }
3549
+ else {
3550
+ this.fetchSingleTagDetails(this.tagName, this.currentActivePage);
3551
+ }
3552
+ }
3553
+ /**Method to fetch the tag based discussion */
3554
+ fetchSingleTagDetails(tagname, page) {
3555
+ this.fetchSingleCategoryLoader = true;
3556
+ this.discussService.getTagBasedDiscussion(tagname).subscribe((data) => {
3557
+ this.similarPosts = data.topics;
3558
+ this.paginationData = data.pagination;
3559
+ this.fetchSingleCategoryLoader = false;
3560
+ this.setPagination();
3561
+ }, (err) => {
3562
+ console.error('Error in fetching single tag details', err);
3563
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError)
3564
+ this.fetchSingleCategoryLoader = false;
3565
+ });
3566
+ }
3567
+ /** Method to fetch the context based discussions */
3568
+ fetchContextBasedTagDetails(tagname, cid, page) {
3569
+ this.fetchSingleCategoryLoader = true;
3570
+ const req = {
3571
+ cid: cid.result,
3572
+ tag: tagname
3573
+ };
3574
+ this.discussService.getContextBasedTagDiscussion(req).subscribe((data) => {
3575
+ this.similarPosts = data.result;
3576
+ // this.paginationData = data.pagination
3577
+ this.fetchSingleCategoryLoader = false;
3578
+ this.setPagination();
3579
+ }, (err) => {
3580
+ console.error('Error in fetching context based tag details', err);
3581
+ // this.openSnackbar(err.error.message.split('|')[1] || this.defaultError)
3582
+ this.fetchSingleCategoryLoader = false;
3583
+ });
3584
+ }
3585
+ // TODO : for pagination
3586
+ // getNextData(tagname: string, page: any) {
3587
+ // return this.discussService.fetchNextTagD(tagname, page).subscribe(
3588
+ // (data: any) => {
3589
+ // this.paginationData = data.pagination
3590
+ // this.setPagination()
3591
+ // this.similarPosts = _.get(data, 'topics')
3592
+ // })
3593
+ // }
3594
+ setPagination() {
3595
+ this.pager = {
3596
+ startIndex: this.paginationData.first.page,
3597
+ endIndex: this.paginationData.last.page,
3598
+ pages: this.paginationData.pages,
3599
+ currentPage: this.paginationData.currentPage,
3600
+ totalPage: this.paginationData.pageCount,
3601
+ };
3602
+ }
3603
+ navigateWithPage(page) {
3604
+ if (page !== this.currentActivePage) {
3605
+ this.fetchNewData = true;
3606
+ this.router.navigate([`${this.configService.getRouterSlug()}${ROUTES.TAG}tag-discussions`], { queryParams: { page, tagname: this.queryParam }, queryParamsHandling: "merge" });
3607
+ }
3608
+ }
3609
+ /** Method to navigate to the dicussion detail page on click of tag related discussion */
3610
+ navigateToDiscussionDetails(discussionData) {
3611
+ const matchedTopic = ___default.find(this.telemetryUtils.getContext(), { type: 'Topic' });
3612
+ if (matchedTopic) {
3613
+ this.telemetryUtils.deleteContext(matchedTopic);
3614
+ }
3615
+ this.telemetryUtils.uppendContext({
3616
+ id: ___default.get(discussionData, 'tid'),
3617
+ type: 'Topic'
3618
+ });
3619
+ let slug = ___default.trim(___default.get(discussionData, 'slug'));
3620
+ let input = { data: { url: `${this.configService.getRouterSlug()}${ROUTES.TOPIC}${slug}`, queryParams: {} }, action: CATEGORY_DETAILS, };
3621
+ this.navigationService.navigate(input);
3622
+ this.stateChange.emit({ action: CATEGORY_DETAILS, title: discussionData.title, tid: discussionData.tid });
3623
+ // this.router.navigate([`${this.configService.getRouterSlug()}${CONSTANTS.ROUTES.TOPIC}${_.trim(_.get(discussionData, 'slug'))}`], { queryParamsHandling: "merge" });
3624
+ }
3625
+ logTelemetry(event) {
3626
+ this.telemetryUtils.logInteract(event, NSDiscussData.IPageName.HOME);
3627
+ }
3628
+ // TODO: add refershdata function
3629
+ // refreshData(tagname: string, page: any) {
3630
+ // if (this.fetchNewData) {
3631
+ // // this.getNextData(tagname, page)
3632
+ // }
3633
+ // }
3634
+ // for tag color
3635
+ getBgColor(tagTitle) {
3636
+ const bgColor = this.discussUtils.stringToColor(tagTitle.toLowerCase());
3637
+ const color = this.discussUtils.getContrast();
3638
+ return { color, 'background-color': bgColor };
3639
+ }
3640
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TagAllDiscussionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: DiscussionService }, { token: i1.ActivatedRoute }, { token: ConfigService }, { token: TelemetryUtilsService }, { token: DiscussUtilsService }, { token: NavigationServiceService }], target: i0.ɵɵFactoryTarget.Component }); }
3641
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TagAllDiscussionComponent, selector: "lib-tag-all-discussion", inputs: { widgetTagName: "widgetTagName", widgetcIds: "widgetcIds" }, outputs: { stateChange: "stateChange" }, ngImport: i0, template: "<div class=\"main-div\">\n <div class=\"flex flex-1 margin-top-xl\">\n <h2 class=\"margin-remove-bottom tagtitle\" [ngStyle]=\"getBgColor(tagName)\">{{tagName}}</h2>\n </div>\n <div>\n <span>&nbsp;</span>\n </div>\n <div class=\"flex flex-1 custom\">\n <div class=\"flex flex-1 flex-column margin-fix\">\n <lib-app-loader *ngIf=\"fetchSingleCategoryLoader\"></lib-app-loader>\n\n <ng-container *ngIf=\"similarPosts && similarPosts.length > 0\">\n <div (click)=\"navigateToDiscussionDetails(data);logTelemetry($event)\"\n *ngFor=\"let data of similarPosts\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!(similarPosts && similarPosts.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\"> \n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n <!-- <div class=\"flex flex-1 flex-column margin-top-xl margin-bottom-xl pagination-container\">\n <ws-app-pagination [pager]=\"pager\" (changePage)=\"navigateWithPage($event)\"></ws-app-pagination>\n </div> -->\n</div>", styles: [".flex.flex-5{flex-direction:column}.tagtitle{margin:0 .25rem;padding:.25rem 1rem;min-width:3.125rem;justify-content:center;border-radius:1.25rem .25rem .25rem 1.25rem}\n"], dependencies: [{ kind: "directive", type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: DiscussCardComponent, selector: "lib-discuss-card", inputs: ["discussionData"] }, { kind: "component", type: AppLoaderComponent, selector: "lib-app-loader", inputs: ["data"] }] }); }
3642
+ }
3643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TagAllDiscussionComponent, decorators: [{
3644
+ type: Component,
3645
+ args: [{ selector: 'lib-tag-all-discussion', template: "<div class=\"main-div\">\n <div class=\"flex flex-1 margin-top-xl\">\n <h2 class=\"margin-remove-bottom tagtitle\" [ngStyle]=\"getBgColor(tagName)\">{{tagName}}</h2>\n </div>\n <div>\n <span>&nbsp;</span>\n </div>\n <div class=\"flex flex-1 custom\">\n <div class=\"flex flex-1 flex-column margin-fix\">\n <lib-app-loader *ngIf=\"fetchSingleCategoryLoader\"></lib-app-loader>\n\n <ng-container *ngIf=\"similarPosts && similarPosts.length > 0\">\n <div (click)=\"navigateToDiscussionDetails(data);logTelemetry($event)\"\n *ngFor=\"let data of similarPosts\" id=\"discuss-card\">\n <lib-discuss-card [discussionData]=\"data\"></lib-discuss-card>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!(similarPosts && similarPosts.length > 0)\">\n <div class=\"no-card-content\" tabindex=\"0\"> \n <div class=\"no-data-label\">No Data</div>\n <div>\n <span>&nbsp;</span>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n <!-- <div class=\"flex flex-1 flex-column margin-top-xl margin-bottom-xl pagination-container\">\n <ws-app-pagination [pager]=\"pager\" (changePage)=\"navigateWithPage($event)\"></ws-app-pagination>\n </div> -->\n</div>", styles: [".flex.flex-5{flex-direction:column}.tagtitle{margin:0 .25rem;padding:.25rem 1rem;min-width:3.125rem;justify-content:center;border-radius:1.25rem .25rem .25rem 1.25rem}\n"] }]
3646
+ }], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i1.Router }, { type: DiscussionService }, { type: i1.ActivatedRoute }, { type: ConfigService }, { type: TelemetryUtilsService }, { type: DiscussUtilsService }, { type: NavigationServiceService }]; }, propDecorators: { widgetTagName: [{
3647
+ type: Input
3648
+ }], widgetcIds: [{
3649
+ type: Input
3650
+ }], stateChange: [{
3651
+ type: Output
3652
+ }] } });
3653
+
3654
+ class ComponentsModule {
3655
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3656
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: ComponentsModule, declarations: [SidePannelComponent,
3657
+ DiscussHomeComponent,
3658
+ DiscussCategoryComponent,
3659
+ DiscussTagsComponent,
3660
+ MyDiscussionComponent,
3661
+ DiscussionDetailsComponent,
3662
+ DiscussStartComponent,
3663
+ DiscussAllComponent,
3664
+ TagAllDiscussionComponent,
3665
+ TrendingTagsComponent], imports: [CommonModule,
3666
+ HttpClientModule,
3667
+ ElementsModule,
3668
+ FormsModule,
3669
+ ReactiveFormsModule,
3670
+ TagInputModule,
3671
+ PipesModule,
3672
+ InfiniteScrollModule], exports: [SidePannelComponent,
3673
+ DiscussHomeComponent,
3674
+ DiscussCategoryComponent,
3675
+ DiscussTagsComponent,
3676
+ MyDiscussionComponent,
3677
+ DiscussionDetailsComponent,
3678
+ DiscussStartComponent,
3679
+ // TODO: Add this components
3680
+ DiscussAllComponent,
3681
+ TagAllDiscussionComponent,
3682
+ TrendingTagsComponent] }); }
3683
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ComponentsModule, providers: [
3684
+ DiscussionService, ConfigService
3685
+ ], imports: [CommonModule,
3686
+ HttpClientModule,
3687
+ ElementsModule,
3688
+ FormsModule,
3689
+ ReactiveFormsModule,
3690
+ TagInputModule,
3691
+ PipesModule,
3692
+ InfiniteScrollModule] }); }
3693
+ }
3694
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ComponentsModule, decorators: [{
3695
+ type: NgModule,
3696
+ args: [{
3697
+ declarations: [
3698
+ SidePannelComponent,
3699
+ DiscussHomeComponent,
3700
+ DiscussCategoryComponent,
3701
+ DiscussTagsComponent,
3702
+ MyDiscussionComponent,
3703
+ DiscussionDetailsComponent,
3704
+ DiscussStartComponent,
3705
+ DiscussAllComponent,
3706
+ TagAllDiscussionComponent,
3707
+ TrendingTagsComponent,
3708
+ ],
3709
+ imports: [
3710
+ CommonModule,
3711
+ HttpClientModule,
3712
+ ElementsModule,
3713
+ FormsModule,
3714
+ ReactiveFormsModule,
3715
+ TagInputModule,
3716
+ PipesModule,
3717
+ InfiniteScrollModule
3718
+ ],
3719
+ exports: [
3720
+ SidePannelComponent,
3721
+ DiscussHomeComponent,
3722
+ DiscussCategoryComponent,
3723
+ DiscussTagsComponent,
3724
+ MyDiscussionComponent,
3725
+ DiscussionDetailsComponent,
3726
+ DiscussStartComponent,
3727
+ // TODO: Add this components
3728
+ DiscussAllComponent,
3729
+ TagAllDiscussionComponent,
3730
+ TrendingTagsComponent,
3731
+ ],
3732
+ providers: [
3733
+ DiscussionService, ConfigService
3734
+ ]
3735
+ }]
3736
+ }] });
3737
+
3738
+ const routes = [
3739
+ {
3740
+ path: '',
3741
+ component: LibEntryComponent,
3742
+ children: [
3743
+ {
3744
+ path: '',
3745
+ pathMatch: 'full',
3746
+ component: DiscussCategoryComponent
3747
+ },
3748
+ {
3749
+ path: 'all-discussions',
3750
+ pathMatch: 'full',
3751
+ component: DiscussAllComponent
3752
+ },
3753
+ {
3754
+ path: 'categories',
3755
+ pathMatch: 'full',
3756
+ component: DiscussCategoryComponent
3757
+ },
3758
+ {
3759
+ path: 'tags',
3760
+ pathMatch: 'full',
3761
+ component: DiscussTagsComponent
3762
+ },
3763
+ // TODO: ADD LATER
3764
+ {
3765
+ path: 'tags/tag-discussions',
3766
+ pathMatch: 'full',
3767
+ component: TagAllDiscussionComponent
3768
+ },
3769
+ {
3770
+ path: 'my-discussion',
3771
+ pathMatch: 'full',
3772
+ component: MyDiscussionComponent
3773
+ },
3774
+ {
3775
+ path: 'category/:slug',
3776
+ pathMatch: 'full',
3777
+ component: DiscussHomeComponent
3778
+ },
3779
+ {
3780
+ path: 'topic/:topicId/:slug',
3781
+ pathMatch: 'full',
3782
+ component: DiscussionDetailsComponent
3783
+ }
3784
+ ]
3785
+ },
3786
+ ];
3787
+ class DiscussionRoutingModule {
3788
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3789
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DiscussionRoutingModule, imports: [i1.RouterModule, CommonModule], exports: [RouterModule] }); }
3790
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionRoutingModule, imports: [RouterModule.forChild(routes),
3791
+ CommonModule, RouterModule] }); }
3792
+ }
3793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionRoutingModule, decorators: [{
3794
+ type: NgModule,
3795
+ args: [{
3796
+ declarations: [],
3797
+ imports: [
3798
+ RouterModule.forChild(routes),
3799
+ CommonModule
3800
+ ],
3801
+ exports: [RouterModule]
3802
+ }]
3803
+ }] });
3804
+
3805
+ class BaseWrapperComponent {
3806
+ constructor(navigationServiceService, eventService, configSvc, discussionService) {
3807
+ this.navigationServiceService = navigationServiceService;
3808
+ this.eventService = eventService;
3809
+ this.configSvc = configSvc;
3810
+ this.discussionService = discussionService;
3811
+ }
3812
+ ngOnInit() {
3813
+ this.navigationServiceService.initService('wrapperService');
3814
+ this.configSvc.setConfigFromWidgetBaseClass(this.config);
3815
+ this.discussionService.userId = _.get(this.config, 'userName');
3816
+ const rawCategories = _.get(this.config, 'categories');
3817
+ this.discussionService.forumIds = _.get(rawCategories, 'result');
3818
+ this.discussionService.initializeUserDetails(this.config.userName);
3819
+ this.eventService.toggleMenuItem.subscribe((data) => {
3820
+ this.wrapperEventListener(data);
3821
+ this.state = data.action;
3822
+ });
3823
+ this.wrapperInit();
3824
+ }
3825
+ wrapperInit() { }
3826
+ wrapperEventListener(data) { }
3827
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseWrapperComponent, deps: [{ token: NavigationServiceService }, { token: EventsService }, { token: ConfigService }, { token: DiscussionService }], target: i0.ɵɵFactoryTarget.Component }); }
3828
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BaseWrapperComponent, selector: "sb-base-wrapper", inputs: { config: "config" }, providers: [NavigationServiceService, EventsService], ngImport: i0, template: "<p>base-wrapper works!</p>\n", styles: [""] }); }
3829
+ }
3830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseWrapperComponent, decorators: [{
3831
+ type: Component,
3832
+ args: [{ selector: 'sb-base-wrapper', providers: [NavigationServiceService, EventsService], template: "<p>base-wrapper works!</p>\n" }]
3833
+ }], ctorParameters: function () { return [{ type: NavigationServiceService }, { type: EventsService }, { type: ConfigService }, { type: DiscussionService }]; }, propDecorators: { config: [{
3834
+ type: Input
3835
+ }] } });
3836
+
3837
+ class CategoryWidgetComponent extends BaseWrapperComponent {
3838
+ constructor(configSvc, discussionService, navigationServiceService, eventService) {
3839
+ super(navigationServiceService, eventService, configSvc, discussionService);
3840
+ this.detailsToggle = true;
3841
+ this.category = CATEGORY;
3842
+ this.detailsPage = CATEGORY_DETAILS;
3843
+ this.homePage = CATEGORY_HOME;
3844
+ }
3845
+ wrapperInit() {
3846
+ this.state = this.detailsPage;
3847
+ }
3848
+ stateChange(event) {
3849
+ this.state = event.action;
3850
+ if (event.action === this.detailsPage) {
3851
+ this.tid = event.tid;
3852
+ this.slug = event.title;
3853
+ }
3854
+ }
3855
+ wrapperEventListener(data) {
3856
+ }
3857
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategoryWidgetComponent, deps: [{ token: ConfigService }, { token: DiscussionService }, { token: NavigationServiceService }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Component }); }
3858
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CategoryWidgetComponent, selector: "sb-category-widget", usesInheritance: true, ngImport: i0, template: "<div class='widget-container'>\n <!-- <lib-discuss-category *ngIf='state === category ' [categoryAction]='homePage' (stateChange)='stateChange($event)'></lib-discuss-category>\n <lib-discuss-home *ngIf='state === homePage' [categoryHomeAction]='detailsPage' (stateChange)='stateChange($event)'></lib-discuss-home> -->\n <!-- <lib-discussion-details *ngIf='state === detailsPage' [widget]=\"true\" [topicId]='tid' [slug]='slug'></lib-discussion-details> -->\n <lib-discuss-all [context]='context'></lib-discuss-all>\n</div>", styles: [".widget-container{display:flex;width:100%}\n"], dependencies: [{ kind: "component", type: DiscussAllComponent, selector: "lib-discuss-all", inputs: ["context", "categoryAction"], outputs: ["stateChange"] }] }); }
3859
+ }
3860
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategoryWidgetComponent, decorators: [{
3861
+ type: Component,
3862
+ args: [{ selector: 'sb-category-widget', template: "<div class='widget-container'>\n <!-- <lib-discuss-category *ngIf='state === category ' [categoryAction]='homePage' (stateChange)='stateChange($event)'></lib-discuss-category>\n <lib-discuss-home *ngIf='state === homePage' [categoryHomeAction]='detailsPage' (stateChange)='stateChange($event)'></lib-discuss-home> -->\n <!-- <lib-discussion-details *ngIf='state === detailsPage' [widget]=\"true\" [topicId]='tid' [slug]='slug'></lib-discussion-details> -->\n <lib-discuss-all [context]='context'></lib-discuss-all>\n</div>", styles: [".widget-container{display:flex;width:100%}\n"] }]
3863
+ }], ctorParameters: function () { return [{ type: ConfigService }, { type: DiscussionService }, { type: NavigationServiceService }, { type: EventsService }]; } });
3864
+
3865
+ class TagsWidgetComponent extends BaseWrapperComponent {
3866
+ constructor(configSvc, discussionService, navigationServiceService, eventService) {
3867
+ super(navigationServiceService, eventService, configSvc, discussionService);
3868
+ this.tags = TAGS;
3869
+ this.tagsAll = TAGSALL;
3870
+ }
3871
+ wrapperInit() {
3872
+ this.state = this.tags;
3873
+ }
3874
+ wrapperEventListener(data) {
3875
+ // if (data.action === this.tags || data.action === this.tagName) {
3876
+ // this.state = data.action
3877
+ // }
3878
+ this.tagName = data.tagName;
3879
+ }
3880
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TagsWidgetComponent, deps: [{ token: ConfigService }, { token: DiscussionService }, { token: NavigationServiceService }, { token: EventsService }], target: i0.ɵɵFactoryTarget.Component }); }
3881
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TagsWidgetComponent, selector: "sb-tags-widget", usesInheritance: true, ngImport: i0, template: "<div >\n <lib-discuss-tags *ngIf='state === tags'></lib-discuss-tags>\n <!-- <lib-tag-all-discussion *ngIf='state === tagsAll' [tagName]='tagName'></lib-tag-all-discussion> -->\n <!-- <lib-discuss-home *ngIf='state === homePage'></lib-discuss-home>\n <lib-discussion-details *ngIf='state === detailsPage' [topicId]='tid' [slug]='slug'></lib-discussion-details> -->\n</div>", styles: [""], dependencies: [{ kind: "component", type: DiscussTagsComponent, selector: "lib-discuss-tags", outputs: ["stateChange"] }, { kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
3882
+ }
3883
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TagsWidgetComponent, decorators: [{
3884
+ type: Component,
3885
+ args: [{ selector: 'sb-tags-widget', template: "<div >\n <lib-discuss-tags *ngIf='state === tags'></lib-discuss-tags>\n <!-- <lib-tag-all-discussion *ngIf='state === tagsAll' [tagName]='tagName'></lib-tag-all-discussion> -->\n <!-- <lib-discuss-home *ngIf='state === homePage'></lib-discuss-home>\n <lib-discussion-details *ngIf='state === detailsPage' [topicId]='tid' [slug]='slug'></lib-discussion-details> -->\n</div>" }]
3886
+ }], ctorParameters: function () { return [{ type: ConfigService }, { type: DiscussionService }, { type: NavigationServiceService }, { type: EventsService }]; } });
3887
+
3888
+ function provideCsModule() {
3889
+ return window['CsModule'];
3890
+ }
3891
+ class DiscussionUiModule {
3892
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionUiModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
3893
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DiscussionUiModule, declarations: [LibEntryComponent, CategoryWidgetComponent, BaseWrapperComponent, TagsWidgetComponent], imports: [ComponentsModule,
3894
+ DiscussionRoutingModule,
3895
+ ElementsModule,
3896
+ CommonModule], exports: [ComponentsModule, CategoryWidgetComponent, BaseWrapperComponent, TagsWidgetComponent] }); }
3897
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionUiModule, providers: [DiscussionEventsService, TelemetryUtilsService, { provide: 'CsModule', useFactory: provideCsModule }], imports: [ComponentsModule,
3898
+ DiscussionRoutingModule,
3899
+ ElementsModule,
3900
+ CommonModule, ComponentsModule] }); }
3901
+ }
3902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DiscussionUiModule, decorators: [{
3903
+ type: NgModule,
3904
+ args: [{
3905
+ declarations: [LibEntryComponent, CategoryWidgetComponent, BaseWrapperComponent, TagsWidgetComponent],
3906
+ imports: [
3907
+ ComponentsModule,
3908
+ DiscussionRoutingModule,
3909
+ ElementsModule,
3910
+ CommonModule,
3911
+ ],
3912
+ exports: [ComponentsModule, CategoryWidgetComponent, BaseWrapperComponent, TagsWidgetComponent],
3913
+ providers: [DiscussionEventsService, TelemetryUtilsService, { provide: 'CsModule', useFactory: provideCsModule }]
3914
+ }]
3915
+ }] });
3916
+
3917
+ class AbstractConfigService {
3918
+ }
3919
+
3920
+ /*
3921
+ * Public API Surface of discussion-ui
3922
+ */
3923
+
3924
+ /**
3925
+ * Generated bundle index. Do not edit.
3926
+ */
3927
+
3928
+ export { AbstractConfigService, BaseWrapperComponent, CONTEXT_PROPS, CategoryWidgetComponent, ComponentsModule, ConfigService, DiscussAllComponent, DiscussCategoryComponent, DiscussHomeComponent, DiscussStartComponent, DiscussTagsComponent, DiscussionDetailsComponent, DiscussionEventsService, DiscussionService, DiscussionUiModule, EventsService, LibEntryComponent, MyDiscussionComponent, NavigationServiceService, SidePannelComponent, TagAllDiscussionComponent, TagsWidgetComponent, TrendingTagsComponent, WrapperNavigateService, provideCsModule };
3929
+ //# sourceMappingURL=jeraldj-discussions-ui.mjs.map