@posiwise/resource-module 0.0.92

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.
@@ -0,0 +1,427 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, ViewEncapsulation, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import * as i3 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i8 from '@angular/forms';
6
+ import { UntypedFormBuilder, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
+ import * as i2 from '@posiwise/common-services';
8
+ import { GoogleAnalyticsService } from '@posiwise/common-services';
9
+ import { CoreTranslocoModule } from '@posiwise/core-transloco';
10
+ import * as i9 from '@posiwise/directives';
11
+ import { DirectivesModule } from '@posiwise/directives';
12
+ import * as i9$1 from '@posiwise/pipes';
13
+ import { PipesModule } from '@posiwise/pipes';
14
+ import { PublicModule } from '@posiwise/public-modules';
15
+ import * as i6 from '@posiwise/shared-components';
16
+ import { SharedComponentsModule } from '@posiwise/shared-components';
17
+ import * as i1 from 'ngx-quill';
18
+ import { QuillModule } from 'ngx-quill';
19
+ import * as i7 from 'ngx-sharebuttons/buttons';
20
+ import { ShareButtonsModule } from 'ngx-sharebuttons/buttons';
21
+ import { ShareIconsModule } from 'ngx-sharebuttons/icons';
22
+ import { NgxUploaderModule } from 'ngx-uploader';
23
+ import * as i10 from '@jsverse/transloco';
24
+ import { TranslocoModule } from '@jsverse/transloco';
25
+ import { HelperService } from '@posiwise/helper-service';
26
+ import { AppBaseComponent } from '@posiwise/app-base-component';
27
+ import { TOKEN_KEY } from '@posiwise/common-utilities';
28
+ import { forkJoin } from 'rxjs';
29
+ import * as i4 from '@angular/router';
30
+ import { RouterModule } from '@angular/router';
31
+ import * as i5 from 'primeng/progressspinner';
32
+ import * as i3$1 from '@angular/platform-browser';
33
+
34
+ class ResourceService {
35
+ constructor(api) {
36
+ this.api = api;
37
+ this.resource = '/posts';
38
+ this.comments = '/comments';
39
+ }
40
+ getPublicPosts(master_subscription_id, page, pageSize, search) {
41
+ return this.api.get(`${this.resource}/get_all?master_subscription_id=${master_subscription_id}&page=${page}&page_size=${pageSize}&search=${search}`);
42
+ }
43
+ getAdminPosts(subscriptionId, paging) {
44
+ return this.api.getWithParams(`${this.resource}/admin_get_all`, {
45
+ ...HelperService.getPagingParams(paging),
46
+ subscription_id: subscriptionId
47
+ });
48
+ }
49
+ addPost(post) {
50
+ const formData = new FormData();
51
+ // eslint-disable-next-line no-restricted-syntax
52
+ for (const key in post) {
53
+ if (key in post) {
54
+ formData.append(key, post[key]);
55
+ }
56
+ }
57
+ return this.api.post(this.resource, formData);
58
+ }
59
+ getPostBySlug(slug) {
60
+ return this.api.get(`${this.resource}/${slug}`);
61
+ }
62
+ deletePost(id) {
63
+ return this.api.delete(`${this.resource}/${id}`);
64
+ }
65
+ updatePost(post, id) {
66
+ const formData = new FormData();
67
+ // eslint-disable-next-line no-restricted-syntax
68
+ for (const key in post) {
69
+ if (key in post) {
70
+ formData.append(key, post[key]);
71
+ }
72
+ }
73
+ return this.api.put(`${this.resource}/${id}`, formData);
74
+ }
75
+ getComments() {
76
+ return this.api.get(`${this.comments}/get_all`);
77
+ }
78
+ postComments(post) {
79
+ return this.api.post(this.comments, post);
80
+ }
81
+ getResourceInsight(subscription_id, starting_at, ending_at) {
82
+ return this.api.getWithParams(`/admin/posts_analytics?type=views&subscription_id=${subscription_id}`, { starting_at, ending_at });
83
+ }
84
+ getResourcePostsInsight(id) {
85
+ return this.api.get(`${this.resource}/${id}/insights`);
86
+ }
87
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceService, deps: [{ token: i2.MainApiHttpService }], target: i0.ɵɵFactoryTarget.Injectable }); }
88
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceService }); }
89
+ }
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceService, decorators: [{
91
+ type: Injectable
92
+ }], ctorParameters: () => [{ type: i2.MainApiHttpService }] });
93
+
94
+ class ResourceListComponent extends AppBaseComponent {
95
+ constructor(resourceService, tagService, injector) {
96
+ super(injector);
97
+ this.resourceService = resourceService;
98
+ this.tagService = tagService;
99
+ this.delayTimeout = null;
100
+ this.data = [];
101
+ this.posts = [];
102
+ this.tags = [];
103
+ this.searchTextItems = '';
104
+ this.searchInput = false;
105
+ this.loading = true;
106
+ this.loaded = false;
107
+ }
108
+ ngOnInit() {
109
+ this.localStorage.getItem$(TOKEN_KEY).subscribe(res => {
110
+ this.userLoggedIn = !!res;
111
+ if (this.userLoggedIn) {
112
+ this.localStorage.getItem$('product').subscribe(res => {
113
+ const data = res ? JSON.parse(res) : null;
114
+ this.subscriptionId = data?.subscriptionId;
115
+ });
116
+ }
117
+ });
118
+ this.masterSubscriptionId = this.appConfig.master_subscription.subscription_id;
119
+ this.getPostsAndTags();
120
+ this.readingTime = 0;
121
+ }
122
+ getPostsAndTags() {
123
+ this.loading = true;
124
+ this.loaded = false;
125
+ forkJoin({
126
+ resPosts: this.resourceService.getPublicPosts(this.masterSubscriptionId, 1, 100, this.searchTextItems),
127
+ resTags: this.tagService.getTagsByType('post_categories', {}, this.subscriptionId || this.masterSubscriptionId)
128
+ })
129
+ .subscribe(res => {
130
+ // posts
131
+ this.posts = res?.resPosts?.posts;
132
+ this.data = res?.resPosts?.posts;
133
+ this.totalRecords = this.posts?.length;
134
+ // tags
135
+ this.tags = res?.resTags?.tags;
136
+ })
137
+ .add(() => {
138
+ this.loading = false;
139
+ this.loaded = true;
140
+ });
141
+ }
142
+ getPosts(page, pageSize) {
143
+ this.loading = true;
144
+ this.loaded = false;
145
+ this.resourceService
146
+ .getPublicPosts(this.masterSubscriptionId, page, pageSize, this.searchTextItems)
147
+ .subscribe(response => {
148
+ this.posts = response.posts;
149
+ this.data = response.posts;
150
+ this.totalRecords = this.posts?.length;
151
+ })
152
+ .add(() => {
153
+ this.loading = false;
154
+ this.loaded = true;
155
+ });
156
+ }
157
+ showSearch(close) {
158
+ this.searchInput = !this.searchInput;
159
+ if (close) {
160
+ this.searchTextItems = '';
161
+ this.getPosts(1, 100);
162
+ }
163
+ }
164
+ onSearch(seconds) {
165
+ let delay = 0;
166
+ delay = seconds * 1000;
167
+ clearTimeout(this.delayTimeout);
168
+ // wait for timeout before get posts
169
+ const delayTimeout = setTimeout(() => {
170
+ this.getPosts(1, 100);
171
+ }, delay);
172
+ this.delayTimeout = delayTimeout;
173
+ }
174
+ tagPost(selectedTag) {
175
+ let filtered;
176
+ this.data = [];
177
+ this.posts.forEach(element => {
178
+ if (element.tags.length > 0) {
179
+ filtered = element.tags.filter(tag => tag.id === selectedTag.id);
180
+ if (filtered.length > 0) {
181
+ this.data.push(element);
182
+ }
183
+ }
184
+ });
185
+ }
186
+ thisPostReadingTime(text) {
187
+ if (text) {
188
+ const wordsPerMinute = 200;
189
+ const noOfWords = text.split(/\s/g).length;
190
+ const minutes = noOfWords / wordsPerMinute;
191
+ const readTime = Math.ceil(minutes);
192
+ return `${readTime} minute read`;
193
+ }
194
+ return '';
195
+ }
196
+ ngOnDestroy() {
197
+ super.ngOnDestroy();
198
+ }
199
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceListComponent, deps: [{ token: ResourceService }, { token: i2.TagService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
200
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: ResourceListComponent, selector: "pw-posts-list", usesInheritance: true, ngImport: i0, template: "<pw-header/>\n<div class=\"all-posts py-5\">\n <div class=\"row mt-5 mb-4 px-2\">\n <div class=\"col-md-9\">\n <ul class=\"tags\">\n <li (keydown.enter)=\"getPosts(1, 100)\" (click)=\"getPosts(1, 100)\">All Resources</li>\n <li *ngFor=\"let tag of tags\"\n (keydown.enter)=\"tagPost(tag)\"\n (click)=\"tagPost(tag)\">{{ tag.name }}</li>\n </ul>\n </div>\n <div class=\"col-md-3\">\n <div class=\"search\"\n *ngIf=\"searchInput; else searchIcon\">\n <input type=\"text\"\n class=\"w-100\"\n placeholder=\"search...\"\n [(ngModel)]=\"searchTextItems\"\n (keydown.enter)=\"onSearch(0.5)\" />\n <i class=\"fa fa-times\" (click)=\"showSearch('close')\" (keydown.enter)=\"showSearch('close')\" aria-hidden=\"true\"></i>\n </div>\n <ng-template #searchIcon>\n <i\n class=\"fa fa-search w-100 text-end\"\n (click)=\"showSearch('open')\"\n (keydown.enter)=\"showSearch('open')\"\n aria-hidden=\"true\"\n ></i>\n </ng-template>\n </div>\n </div>\n <ng-container *ngIf=\"loading && !loaded\">\n <div class=\"w-100 text-center mt-3\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"posts?.length && !loading\">\n <div class=\"blog-list\">\n <div class=\"row mt-4 ms-1 me-1 blog-listing\"\n *ngFor=\"let post of data\">\n <div class=\"col-md-6 col-sm-12 col-xs-12 my-auto\"\n [routerLink]=\"['/resource', post.slug]\">\n <div class=\"list-blog-image\">\n <img [src]=\"post.picture?.url\"\n alt=\"Post List\"\n class=\"img-fluid\" />\n </div>\n </div>\n <div class=\"col-md-6 col-sm-12 col-xs-12 px-4 position-relative\">\n <div class=\"mt-4\">\n <div class=\"author mb-3 d-flex\">\n <div class=\"avatar-image\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\">\n <img *ngIf=\"post.author?.avatar\"\n [src]=\"post.author?.avatar[0]?.url\"\n alt=\"Author\" />\n <img *ngIf=\"!post.author?.avatar\"\n src=\"/assets/img/icons/male.png\"\n alt=\"Author\"\n class=\"default-user-image\" />\n </a>\n </div>\n\n <div class=\"author-name ps-2\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\"\n class=\"name\">\n {{ post.author.first_name }}\n <i class=\"fas fa-crown\" aria-hidden=\"true\"></i></a>\n <ul>\n <li>\n <a href=\"javascript:void(0);\">\n {{ post.published_at | date: 'dd/MM/yyyy' }}\n </a>\n </li>\n <li>.</li>\n <li>\n <a href=\"javascript:void(0);\">{{ thisPostReadingTime(post.body) }}\n </a>\n </li>\n </ul>\n </div>\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n aria-label=\"Post Menu\"\n id=\"dropdownMenuLink\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink\">\n <a class=\"dropdown-item\"\n href=\"http://www.facebook.com/\"\n rel=\"noopener noreferrer\"\n target=\"_blank\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </div>\n <h4 [routerLink]=\"['/resource', post.slug]\"\n class=\"title my-3\">{{ post.title }}</h4>\n <p [routerLink]=\"['/resource', post.slug]\"\n class=\"body mb-5 pb-3 post-body-text\">\n {{ post.body | removeHtml: 'quill' | textTruncate: 200 }}\n </p>\n <div class=\"blog-view py-3 blog-list-write-view\">\n <ul class=\"d-flex\">\n <li>{{ post.view !== null ? post.view : '0' }} View</li>\n <li><a [routerLink]=\"['/resource', post.slug]\">Write Comment</a></li>\n <li>\n <a [routerLink]=\"['/resource', post.slug]\" aria-label=\"Blog\"><i class=\"far fa-heart\" aria-hidden=\"true\"></i></a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!posts?.length && loaded\">\n <p>No blog posts available</p>\n </ng-container>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: rgb(70, 136, 236);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}body{background:#fff}.blog-listing{border:1px solid rgb(238,238,238);cursor:pointer}.all-posts{margin:5em auto 0;max-width:980px;padding:14px 20px;width:100%}ul.tags{display:inline-flex;font-size:16px;font-weight:400}ul.tags li{color:#337ab7;cursor:pointer;font-weight:600;margin-right:20px}ul.tags li:hover{color:#000}.search{position:relative}.search input{border:0;border-bottom:1px solid rgb(213,206,206)}.search i{position:absolute;right:5px}.blog-list .blog-listing h4{color:#000;font:28px/1.3 Roboto,sans-serif;transition:all .5s}.blog-list .blog-listing h4:hover{color:#0045c7}.blog-list .blog-listing p.body{color:#b3b3b3;font:16px/1.4 Roboto,sans-serif;transition:all .5s}.blog-list .blog-listing p.body:hover{color:#0045c7}.blog-list .blog-listing p.body p{color:inherit;font:inherit;transition:inherit}.blog-list .blog-listing p.body p:hover{color:#0045c7}.blog-list .blog-listing .list-blog-image img{padding:25px}.blog-list .blog-listing .author .avatar-image{border:1px solid rgb(0,0,0);border-radius:50px;height:50px;clip-path:circle(50% at 50% 50%);width:50px}.blog-list .blog-listing .author .avatar-image img{left:50%;position:relative;top:50%;transform:translate(-50%,-50%)}.blog-list .blog-listing .author .avatar-image .default-user-image{width:50px}.blog-list .blog-listing .author .author-name p.name{color:#000;font:14px/1 Roboto,sans-serif;margin:0;transition:all .5s}.blog-list .blog-listing .author .author-name p.name:hover{color:#0045c7}.blog-list .blog-listing .author .author-name p.name i{color:#000}.blog-list .blog-listing .author .author-name ul li{display:inline-block;padding-right:10px;vertical-align:middle}.blog-list .blog-listing .author .author-name ul li a{color:#b3b3b3;font:12px/1 Roboto,sans-serif}.blog-list .blog-listing .author .share-post{flex-grow:3;position:relative;text-align:right}.blog-list .blog-listing .author .share-post i{color:var(--first)}.blog-list .blog-listing .author .share-post .dropdown-menu{border:0 0;box-shadow:0 3px 8px #0003;left:auto!important;right:0;top:20px!important;transform:translate(0)!important}.blog-list .blog-listing .blog-view{border-top:1px solid rgb(238,238,238)}.blog-list .blog-listing .blog-view ul li{color:#b3b3b3;font:12px/1 Roboto,sans-serif;padding-right:14px}.blog-list .blog-listing .blog-view ul li a{color:inherit;font:inherit;transition:all .5s}.blog-list .blog-listing .blog-view ul li a:hover{color:#0045c7}.blog-list .blog-listing .blog-view ul li:last-child{flex-grow:3;padding-right:0;text-align:right}.blog-list .blog-listing .blog-view ul li:last-child i{color:#e84a43;font-size:14px}@media only screen and (max-width: 1024px){.cust-mt{padding:14px 5px}.cust-mt .blog-list .blog-listing h4{font:20px/1.3 Roboto,sans-serif}.cust-mt .blog-list .blog-listing p.body{font:.9rem/1.3 Roboto,sans-serif}.cust-mt .blog-list .blog-listing p.body p{font:inherit}.cust-mt .blog-list .blog-listing .blog-image{height:300px}}@media only screen and (max-width: 767px){.blog-list .blog-listing{height:auto;max-height:none;overflow:visible}.blog-list .blog-listing .blog-view{padding-bottom:1rem}}@media (min-width: 768px){.blog-list-write-view{position:absolute}.blog-view{bottom:0;width:92%}}.post-body-text:hover{color:var(--titles)!important}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["styleClass", "style", "strokeWidth", "fill", "animationDuration", "ariaLabel"] }, { kind: "component", type: i6.HeaderComponent, selector: "pw-header", inputs: ["landing"] }, { kind: "directive", type: i8.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: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i9.LazyImgDirective, selector: "img" }, { kind: "pipe", type: i3.DatePipe, name: "date" }, { kind: "pipe", type: i9$1.RemoveHtmlPipe, name: "removeHtml" }, { kind: "pipe", type: i9$1.TextTruncatePipe, name: "textTruncate" }], encapsulation: i0.ViewEncapsulation.None }); }
201
+ }
202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceListComponent, decorators: [{
203
+ type: Component,
204
+ args: [{ selector: 'pw-posts-list', encapsulation: ViewEncapsulation.None, template: "<pw-header/>\n<div class=\"all-posts py-5\">\n <div class=\"row mt-5 mb-4 px-2\">\n <div class=\"col-md-9\">\n <ul class=\"tags\">\n <li (keydown.enter)=\"getPosts(1, 100)\" (click)=\"getPosts(1, 100)\">All Resources</li>\n <li *ngFor=\"let tag of tags\"\n (keydown.enter)=\"tagPost(tag)\"\n (click)=\"tagPost(tag)\">{{ tag.name }}</li>\n </ul>\n </div>\n <div class=\"col-md-3\">\n <div class=\"search\"\n *ngIf=\"searchInput; else searchIcon\">\n <input type=\"text\"\n class=\"w-100\"\n placeholder=\"search...\"\n [(ngModel)]=\"searchTextItems\"\n (keydown.enter)=\"onSearch(0.5)\" />\n <i class=\"fa fa-times\" (click)=\"showSearch('close')\" (keydown.enter)=\"showSearch('close')\" aria-hidden=\"true\"></i>\n </div>\n <ng-template #searchIcon>\n <i\n class=\"fa fa-search w-100 text-end\"\n (click)=\"showSearch('open')\"\n (keydown.enter)=\"showSearch('open')\"\n aria-hidden=\"true\"\n ></i>\n </ng-template>\n </div>\n </div>\n <ng-container *ngIf=\"loading && !loaded\">\n <div class=\"w-100 text-center mt-3\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n </ng-container>\n <ng-container *ngIf=\"posts?.length && !loading\">\n <div class=\"blog-list\">\n <div class=\"row mt-4 ms-1 me-1 blog-listing\"\n *ngFor=\"let post of data\">\n <div class=\"col-md-6 col-sm-12 col-xs-12 my-auto\"\n [routerLink]=\"['/resource', post.slug]\">\n <div class=\"list-blog-image\">\n <img [src]=\"post.picture?.url\"\n alt=\"Post List\"\n class=\"img-fluid\" />\n </div>\n </div>\n <div class=\"col-md-6 col-sm-12 col-xs-12 px-4 position-relative\">\n <div class=\"mt-4\">\n <div class=\"author mb-3 d-flex\">\n <div class=\"avatar-image\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\">\n <img *ngIf=\"post.author?.avatar\"\n [src]=\"post.author?.avatar[0]?.url\"\n alt=\"Author\" />\n <img *ngIf=\"!post.author?.avatar\"\n src=\"/assets/img/icons/male.png\"\n alt=\"Author\"\n class=\"default-user-image\" />\n </a>\n </div>\n\n <div class=\"author-name ps-2\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\"\n class=\"name\">\n {{ post.author.first_name }}\n <i class=\"fas fa-crown\" aria-hidden=\"true\"></i></a>\n <ul>\n <li>\n <a href=\"javascript:void(0);\">\n {{ post.published_at | date: 'dd/MM/yyyy' }}\n </a>\n </li>\n <li>.</li>\n <li>\n <a href=\"javascript:void(0);\">{{ thisPostReadingTime(post.body) }}\n </a>\n </li>\n </ul>\n </div>\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n aria-label=\"Post Menu\"\n id=\"dropdownMenuLink\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink\">\n <a class=\"dropdown-item\"\n href=\"http://www.facebook.com/\"\n rel=\"noopener noreferrer\"\n target=\"_blank\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </div>\n <h4 [routerLink]=\"['/resource', post.slug]\"\n class=\"title my-3\">{{ post.title }}</h4>\n <p [routerLink]=\"['/resource', post.slug]\"\n class=\"body mb-5 pb-3 post-body-text\">\n {{ post.body | removeHtml: 'quill' | textTruncate: 200 }}\n </p>\n <div class=\"blog-view py-3 blog-list-write-view\">\n <ul class=\"d-flex\">\n <li>{{ post.view !== null ? post.view : '0' }} View</li>\n <li><a [routerLink]=\"['/resource', post.slug]\">Write Comment</a></li>\n <li>\n <a [routerLink]=\"['/resource', post.slug]\" aria-label=\"Blog\"><i class=\"far fa-heart\" aria-hidden=\"true\"></i></a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"!posts?.length && loaded\">\n <p>No blog posts available</p>\n </ng-container>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: rgb(70, 136, 236);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}body{background:#fff}.blog-listing{border:1px solid rgb(238,238,238);cursor:pointer}.all-posts{margin:5em auto 0;max-width:980px;padding:14px 20px;width:100%}ul.tags{display:inline-flex;font-size:16px;font-weight:400}ul.tags li{color:#337ab7;cursor:pointer;font-weight:600;margin-right:20px}ul.tags li:hover{color:#000}.search{position:relative}.search input{border:0;border-bottom:1px solid rgb(213,206,206)}.search i{position:absolute;right:5px}.blog-list .blog-listing h4{color:#000;font:28px/1.3 Roboto,sans-serif;transition:all .5s}.blog-list .blog-listing h4:hover{color:#0045c7}.blog-list .blog-listing p.body{color:#b3b3b3;font:16px/1.4 Roboto,sans-serif;transition:all .5s}.blog-list .blog-listing p.body:hover{color:#0045c7}.blog-list .blog-listing p.body p{color:inherit;font:inherit;transition:inherit}.blog-list .blog-listing p.body p:hover{color:#0045c7}.blog-list .blog-listing .list-blog-image img{padding:25px}.blog-list .blog-listing .author .avatar-image{border:1px solid rgb(0,0,0);border-radius:50px;height:50px;clip-path:circle(50% at 50% 50%);width:50px}.blog-list .blog-listing .author .avatar-image img{left:50%;position:relative;top:50%;transform:translate(-50%,-50%)}.blog-list .blog-listing .author .avatar-image .default-user-image{width:50px}.blog-list .blog-listing .author .author-name p.name{color:#000;font:14px/1 Roboto,sans-serif;margin:0;transition:all .5s}.blog-list .blog-listing .author .author-name p.name:hover{color:#0045c7}.blog-list .blog-listing .author .author-name p.name i{color:#000}.blog-list .blog-listing .author .author-name ul li{display:inline-block;padding-right:10px;vertical-align:middle}.blog-list .blog-listing .author .author-name ul li a{color:#b3b3b3;font:12px/1 Roboto,sans-serif}.blog-list .blog-listing .author .share-post{flex-grow:3;position:relative;text-align:right}.blog-list .blog-listing .author .share-post i{color:var(--first)}.blog-list .blog-listing .author .share-post .dropdown-menu{border:0 0;box-shadow:0 3px 8px #0003;left:auto!important;right:0;top:20px!important;transform:translate(0)!important}.blog-list .blog-listing .blog-view{border-top:1px solid rgb(238,238,238)}.blog-list .blog-listing .blog-view ul li{color:#b3b3b3;font:12px/1 Roboto,sans-serif;padding-right:14px}.blog-list .blog-listing .blog-view ul li a{color:inherit;font:inherit;transition:all .5s}.blog-list .blog-listing .blog-view ul li a:hover{color:#0045c7}.blog-list .blog-listing .blog-view ul li:last-child{flex-grow:3;padding-right:0;text-align:right}.blog-list .blog-listing .blog-view ul li:last-child i{color:#e84a43;font-size:14px}@media only screen and (max-width: 1024px){.cust-mt{padding:14px 5px}.cust-mt .blog-list .blog-listing h4{font:20px/1.3 Roboto,sans-serif}.cust-mt .blog-list .blog-listing p.body{font:.9rem/1.3 Roboto,sans-serif}.cust-mt .blog-list .blog-listing p.body p{font:inherit}.cust-mt .blog-list .blog-listing .blog-image{height:300px}}@media only screen and (max-width: 767px){.blog-list .blog-listing{height:auto;max-height:none;overflow:visible}.blog-list .blog-listing .blog-view{padding-bottom:1rem}}@media (min-width: 768px){.blog-list-write-view{position:absolute}.blog-view{bottom:0;width:92%}}.post-body-text:hover{color:var(--titles)!important}\n"] }]
205
+ }], ctorParameters: () => [{ type: ResourceService }, { type: i2.TagService }, { type: i0.Injector }] });
206
+
207
+ class ResourceBlog {
208
+ static getResourcePostsForm() {
209
+ return new UntypedFormBuilder().group({
210
+ related_entity_id: [''],
211
+ related_entity_type: [''],
212
+ comment: [null, Validators.required],
213
+ user_id: ['']
214
+ });
215
+ }
216
+ }
217
+
218
+ class ResourceReadComponent extends AppBaseComponent {
219
+ constructor(resourceService, toastr, injector, sanitizer) {
220
+ super(injector);
221
+ this.resourceService = resourceService;
222
+ this.toastr = toastr;
223
+ this.sanitizer = sanitizer;
224
+ this.recentPosts = [];
225
+ this.postComments = [];
226
+ this.userLoggedIn = false;
227
+ this.buttonBusy = false;
228
+ this.commentForm = ResourceBlog.getResourcePostsForm();
229
+ }
230
+ ngOnInit() {
231
+ this.masterSubscriptionId = this.appConfig.master_subscription.subscription_id;
232
+ this.route.params.subscribe(params => {
233
+ this.slug = params['slug'] || '';
234
+ this.getBlogItem(this.slug);
235
+ });
236
+ this.localStorage.getItem$(TOKEN_KEY).subscribe(res => {
237
+ this.userLoggedIn = !!res;
238
+ if (this.userLoggedIn) {
239
+ this.userService.getUserInfo().subscribe(data => {
240
+ this.user = data;
241
+ });
242
+ }
243
+ });
244
+ }
245
+ readingTime(text) {
246
+ if (text) {
247
+ const textContent = text.toString();
248
+ const wordsPerMinute = 200;
249
+ const noOfWords = textContent.split(/\s/g).length;
250
+ const minutes = noOfWords / wordsPerMinute;
251
+ const readTime = Math.ceil(minutes);
252
+ return `${readTime} minute read`;
253
+ }
254
+ return '';
255
+ }
256
+ handleImageError(event, fallbackPath) {
257
+ HelperService.handleImageFallbackPath(event, fallbackPath);
258
+ }
259
+ getBlogItem(slug) {
260
+ this.resourceService.getPostBySlug(slug).subscribe(response => {
261
+ let blogBody;
262
+ if (response?.body) {
263
+ blogBody = HelperService.sanitizeQuillBody(response.body, this.sanitizer);
264
+ }
265
+ this.post = { ...response, body: blogBody };
266
+ this.postComments = response.entity_comments;
267
+ this.getPosts(1, 4);
268
+ });
269
+ }
270
+ getPosts(page, pageSize) {
271
+ this.resourceService
272
+ .getPublicPosts(this.masterSubscriptionId, page, pageSize, '')
273
+ .subscribe(response => {
274
+ this.recentPosts = response.posts.filter(post => post.slug !== this.post.slug);
275
+ });
276
+ }
277
+ onComment() {
278
+ this.buttonBusy = true;
279
+ const data = { ...this.commentForm.value };
280
+ data.related_entity_id = this.post?.id;
281
+ data.related_entity_type = 'Post';
282
+ data.user_id = this.user?.id;
283
+ this.resourceService
284
+ .postComments(data)
285
+ .subscribe(() => {
286
+ this.getBlogItem(this.slug);
287
+ this.commentForm.reset();
288
+ this.toastr.success(this.translation.translate('Resource.Posts.CommentAdded'));
289
+ })
290
+ .add(() => {
291
+ this.buttonBusy = false;
292
+ });
293
+ }
294
+ tagPost(selectedTag) {
295
+ this.recentPosts = this.recentPosts.filter(element => {
296
+ let filtered;
297
+ if (element.tags?.length) {
298
+ filtered = element.tags.filter(tag => tag.tag_category_id === selectedTag.tag_category_id);
299
+ return { element, filtered };
300
+ }
301
+ return {};
302
+ });
303
+ }
304
+ trackByTagId(_index, item) {
305
+ return item.id;
306
+ }
307
+ trackByRecentPost(_index, item) {
308
+ return item.id;
309
+ }
310
+ trackByComment(_index, item) {
311
+ return item.id;
312
+ }
313
+ ngOnDestroy() {
314
+ super.ngOnDestroy();
315
+ }
316
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceReadComponent, deps: [{ token: ResourceService }, { token: i2.CustomToastService }, { token: i0.Injector }, { token: i3$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
317
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.11", type: ResourceReadComponent, selector: "pw-post-read", usesInheritance: true, ngImport: i0, template: "<pw-header/>\n<div class=\"read-post mt-5 pt-5\">\n <div class=\"show-blog\">\n <div class=\"row\">\n <!-- content -->\n <div class=\"col-12\">\n <ul class=\"d-flex align-items-center mb-4 position-relative\">\n <li>\n <a href=\"javascript:void(0);\">\n <div class=\"avatar-image\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\">\n <img *ngIf=\"post?.author?.avatar\"\n [src]=\"post?.author?.avatar[0].url\"\n alt=\"author\" />\n <img *ngIf=\"!post?.author?.avatar\"\n height=\"45\"\n width=\"45\"\n src=\"/assets/img/icons/male.png\"\n alt=\"author\" /></a>\n </div>\n </a>\n </li>\n <li>\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\"\n class=\"name\">\n {{ post?.author?.first_name }}\n <i class=\"fas fa-crown\" aria-hidden=\"true\"></i></a>\n </li>\n <li>\n <a class=\"text-dark\"\n href=\"javascript:void(0);\">{{\n post?.author.published_at\n }}</a>\n </li>\n <li>.</li>\n <li>\n <a class=\"text-dark\"\n href=\"javascript:void(0);\">\n {{ readingTime(post?.body) }}\n </a>\n </li>\n <li class=\"social-media\">\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n id=\"dropdownMenuLink2\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n aria-label=\"Menu\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink2\">\n <a data-bs-toggle=\"modal\"\n data-bs-target=\"#exampleModal\"\n class=\"dropdown-item\"\n href=\"javascript:void(0);\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </li>\n </ul>\n <h2 class=\"mb-3\">{{ post?.title }}</h2>\n <div class=\"ql-snow body-quill\"\n >\n <div class=\"ql-editor body post-body-text\"\n [innerHTML]=\"post?.body\">\n </div>\n </div>\n\n <ul class=\"bottom-social-icons d-flex justify-content-between mt-5 border-top border-bottom py-3\">\n <li class=\"social-media-blog-page\">\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n aria-label=\"Menu\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n id=\"dropdownMenuLink\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink\">\n <a data-bs-toggle=\"modal\"\n data-bs-target=\"#exampleModal\"\n class=\"dropdown-item\"\n href=\"javascript:void(0);\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </li>\n <li>\n <ul>\n <li *ngFor=\"let tag of post?.tags; trackBy: trackByTagId\"\n (keydown.enter)=\"tagPost(tag)\"\n (click)=\"tagPost(tag)\">\n {{ tag.name }}\n </li>\n </ul>\n </li>\n </ul>\n <ul class=\"d-flex justify-content-between mt-3 views\">\n <li>\n <span>{{ post?.view || 0 }} views</span>\n </li>\n <li><i class=\"far fa-heart\" aria-hidden=\"true\"></i></li>\n </ul>\n </div>\n <!--content end -->\n </div>\n <!-- modal for share buttons -->\n <div class=\"modal fade\"\n id=\"exampleModal\"\n tabindex=\"-1\"\n aria-labelledby=\"exampleModalLabel\">\n <div class=\"modal-dialog modal-dialog-centered\" >\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\"\n id=\"exampleModalLabel\">Share the post</h5>\n <button type=\"button\"\n class=\"btn-close float-end\"\n data-dismiss=\"modal\"\n aria-label=\"Close\">\n <span>&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <share-buttons theme=\"material-dark\"\n show=\"7\"></share-buttons>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-primary\"\n data-dismiss=\"modal\">\n Close\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <!-- recent posts -->\n <div class=\"related-posts mt-5\">\n <ul class=\"d-flex justify-content-between\">\n <li>\n <h5>Recent Resources</h5>\n </li>\n <li><a [routerLink]=\"['/resource']\">See All</a></li>\n </ul>\n <div class=\"row mt-4\">\n <div class=\"col-sm-6 col-md-6 col-lg-4 col-xs-12 mb-2\"\n *ngFor=\"let recentPost of recentPosts; trackBy: trackByRecentPost\">\n <div class=\"recent-post\"\n [routerLink]=\"['/resource', recentPost.slug]\">\n <div class=\"blog-image\">\n <img [src]=\"recentPost.picture.url\"\n alt=\"Resource\" />\n </div>\n <h5 class=\"pt-4 blog-title ps-3 pe-3\">{{ recentPost?.title }}</h5>\n <div class=\"blog-view pt-3 ps-3 pe-3\">\n <p>{{ recentPost.view !== null ? recentPost.view : '0' }} View</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row mt-5 mb-4\">\n <div class=\"col-12\">\n <form class=\"comments-sec\"\n [formGroup]=\"commentForm\"\n (ngSubmit)=\"onComment()\"\n *ngIf=\"userLoggedIn; else userLoggedOut\">\n <div class=\"col-12 pt-4\">\n <!-- Comment Massage -->\n <pw-input-container label=\"Write a response\"\n name=\"comment\"\n errorMsg=\"Please enter comment\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"comment\"></textarea>\n </pw-input-container>\n\n <div class=\"text-end mt-4\">\n <button type=\"submit\"\n [buttonBusy]=\"buttonBusy\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n <ng-template #userLoggedOut>\n <p class=\"text-center pt-3 pb-3 userNotLoggedIn\">\n <a [routerLink]=\"['/login']\">Log in</a>\n to leave a comment!\n </p>\n </ng-template>\n </div>\n </div>\n <div class=\"row mt-5 mb-5\">\n <div class=\"col-12\"\n *ngFor=\"let comment of postComments; trackBy: trackByComment\">\n <div class=\"comment-post mt-2\">\n <img *ngIf=\"comment?.user?.avatar\"\n [src]=\"comment.user?.avatar[0]?.url\"\n alt=\"avatar\"\n width=\"45\"\n height=\"45\"\n class=\"rounded-circle me-3 mb-2\"\n (error)=\"handleImageError($event, 'assets/img/icons/male.png')\" />\n <img *ngIf=\"!comment?.user?.avatar\"\n alt=\"avatar\"\n width=\"45\"\n height=\"45\"\n class=\"rounded-circle me-3 mb-2\"\n src=\"assets/img/icons/male.png\" />\n <small>{{ comment.user?.first_name ? comment.user?.first_name : '' }}\n {{ comment.user?.last_name ? comment.user?.last_name : '' }}\n </small>\n <p>{{ comment.comment }}</p>\n <p class=\"text-end comment-date\">{{ comment.created_at | date: 'dd/MM/yyyy' }}</p>\n </div>\n </div>\n </div>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: rgb(70, 136, 236);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.show-blog,.recent-post{border:1px solid rgb(238,238,238)}.recent-post .blog-image{height:250px;min-height:250px}.recent-post .blog-image img{height:100%;width:100%}.recent-post .blog-title{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:300px}.recent-post .blog-view{border-top:1px solid rgb(238,238,238)}body{background:#fff}form.comments-sec{background-color:#f7f7f7;border:1px solid rgb(238,238,238)}form.comments-sec .no-padding{padding:0}form.comments-sec button{font-size:16px;margin-bottom:20px;margin-right:20px;padding:10px 25px;text-transform:uppercase}form.comments-sec label{background-color:#eee;color:gray;display:inline-block;margin:0;padding:15px;width:100%}form.comments-sec .mb-3{margin:0;padding:20px}form.comments-sec .mb-3 textarea{border:1px solid rgb(238,238,238);height:150px}.userNotLoggedIn{background:#f7f7f7;border:1px solid rgb(238,238,238);font-weight:400}.userNotLoggedIn a{color:#4444bc!important}.comment-post{background:#f7f7f7;border:1px solid rgb(238,238,238);padding:20px}.comment-post .comment-date{color:#777;font-size:14px;font-style:italic;margin:0}share-buttons{background-color:#eee;margin-bottom:10px}.read-post{margin:0 auto 20px;max-width:940px;padding-top:20px}.read-post .show-blog{padding:5rem 5rem 3rem}.read-post .show-blog ul li{display:inline-block;padding-right:10px}.read-post .show-blog ul li a{font:13px/1 Roboto,sans-serif}.read-post .show-blog ul li a .avatar-image{border-radius:50px;height:50px;overflow:hidden;width:50px}.read-post .show-blog ul li a .avatar-image i{color:#000}.read-post .show-blog ul li a .avatar-image i,.read-post .show-blog ul li a .avatar-image img{left:50%;position:relative;top:50%;transform:translate(-50%,-50%)}.read-post .show-blog ul li p.name{color:#000;font:14px/1 Roboto,sans-serif;margin:0;transition:all .5s}.read-post .show-blog ul li p.name:hover{color:#0045c7}.read-post .show-blog ul li p.name i{color:#000}.read-post .show-blog ul.views li:nth-child(2) i{color:#e84a43;font-size:14px}.read-post .show-blog ul.bottom-social-icons li:first-child ul li{padding-right:35px}.read-post .show-blog ul.bottom-social-icons li:first-child ul li i{color:#000}.read-post .show-blog ul.bottom-social-icons li:nth-child(2){padding:0}.read-post .show-blog ul.bottom-social-icons li:nth-child(2) ul li{padding-left:30px}.read-post .show-blog ul.bottom-social-icons li:nth-child(2) ul li a{color:#000}.read-post .show-blog .social-media{position:absolute;right:0;top:50%;transform:translateY(-50%)}.read-post .show-blog .social-media .share-post{flex-grow:3;position:relative;text-align:right}.read-post .show-blog .social-media .share-post i{color:var(--first)}.read-post .show-blog .social-media .share-post .dropdown-menu{border:0 none;box-shadow:0 3px 8px #0003;left:auto!important;right:0;top:20px!important;transform:translate(0)!important}.read-post .show-blog .body p img{max-width:100%}.social-media-blog-page a{color:#000}@media only screen and (max-width: 1024px){.read-post{padding:1rem}.read-post .show-blog{padding:.5rem}.read-post .show-blog h2{font-size:30px}}@media only screen and (max-width: 767px){.read-post,.read-post .show-blog{padding:.5rem}.read-post .show-blog ul{flex-wrap:wrap}.read-post .show-blog ul.bottom-social-icons li{width:100%}.read-post .show-blog ul.bottom-social-icons li ul{display:flex;justify-content:space-around;margin:10px 0}.read-post .show-blog ul.bottom-social-icons li ul li{padding:0!important;text-align:center;width:33.333%}.read-post .show-blog ul li{font:12px/1 Roboto,sans-serif;padding-right:5px}.read-post .show-blog ul li a{font:11px/1 Roboto,sans-serif}.read-post .show-blog ul li p.name{font:12px/1 Roboto,sans-serif}.read-post .show-blog h2{font-size:26px}.read-post .show-blog .body p{font-size:.8rem}}.subscribe-btn{background-color:var(--first);color:#fff}.subscribe-btn:hover{background-color:#fff;color:var(--first)}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i6.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText", "showTriangle", "afterLabel", "showAfterLabel", "showTriangleText", "isLeftTooltip"] }, { kind: "component", type: i6.HeaderComponent, selector: "pw-header", inputs: ["landing"] }, { kind: "component", type: i7.ShareButtons, selector: "share-buttons", inputs: ["theme", "include", "exclude", "show", "url", "title", "description", "image", "tags", "redirectUrl", "autoSetMeta", "showIcon", "showText", "disabled"], outputs: ["opened", "closed"] }, { kind: "directive", type: i8.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i8.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: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i8.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i8.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i9.ButtonBusyDirective, selector: "[buttonBusy]", inputs: ["buttonBusy", "busyText"] }, { kind: "directive", type: i9.LazyImgDirective, selector: "img" }, { kind: "pipe", type: i3.DatePipe, name: "date" }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }], encapsulation: i0.ViewEncapsulation.None }); }
318
+ }
319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceReadComponent, decorators: [{
320
+ type: Component,
321
+ args: [{ selector: 'pw-post-read', encapsulation: ViewEncapsulation.None, template: "<pw-header/>\n<div class=\"read-post mt-5 pt-5\">\n <div class=\"show-blog\">\n <div class=\"row\">\n <!-- content -->\n <div class=\"col-12\">\n <ul class=\"d-flex align-items-center mb-4 position-relative\">\n <li>\n <a href=\"javascript:void(0);\">\n <div class=\"avatar-image\">\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\">\n <img *ngIf=\"post?.author?.avatar\"\n [src]=\"post?.author?.avatar[0].url\"\n alt=\"author\" />\n <img *ngIf=\"!post?.author?.avatar\"\n height=\"45\"\n width=\"45\"\n src=\"/assets/img/icons/male.png\"\n alt=\"author\" /></a>\n </div>\n </a>\n </li>\n <li>\n <a [attr.disabled]=\"!userLoggedIn\"\n [routerLink]=\"['/members', post?.author?.slug]\"\n class=\"name\">\n {{ post?.author?.first_name }}\n <i class=\"fas fa-crown\" aria-hidden=\"true\"></i></a>\n </li>\n <li>\n <a class=\"text-dark\"\n href=\"javascript:void(0);\">{{\n post?.author.published_at\n }}</a>\n </li>\n <li>.</li>\n <li>\n <a class=\"text-dark\"\n href=\"javascript:void(0);\">\n {{ readingTime(post?.body) }}\n </a>\n </li>\n <li class=\"social-media\">\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n id=\"dropdownMenuLink2\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n aria-label=\"Menu\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink2\">\n <a data-bs-toggle=\"modal\"\n data-bs-target=\"#exampleModal\"\n class=\"dropdown-item\"\n href=\"javascript:void(0);\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </li>\n </ul>\n <h2 class=\"mb-3\">{{ post?.title }}</h2>\n <div class=\"ql-snow body-quill\"\n >\n <div class=\"ql-editor body post-body-text\"\n [innerHTML]=\"post?.body\">\n </div>\n </div>\n\n <ul class=\"bottom-social-icons d-flex justify-content-between mt-5 border-top border-bottom py-3\">\n <li class=\"social-media-blog-page\">\n <div class=\"share-post\">\n <div class=\"dropdown\">\n <a href=\"#\"\n aria-label=\"Menu\"\n (keydown.enter)=\"$event.preventDefault(); $event.target.click()\"\n (keydown.space)=\"$event.preventDefault(); $event.target.click()\"\n id=\"dropdownMenuLink\"\n data-bs-toggle=\"dropdown\"\n aria-haspopup=\"true\"\n aria-expanded=\"false\">\n <i class=\"fas fa-ellipsis-v\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"dropdown-menu\"\n aria-labelledby=\"dropdownMenuLink\">\n <a data-bs-toggle=\"modal\"\n data-bs-target=\"#exampleModal\"\n class=\"dropdown-item\"\n href=\"javascript:void(0);\">\n <i class=\"fas fa-share\" aria-hidden=\"true\"></i> Share Post\n </a>\n </div>\n </div>\n </div>\n </li>\n <li>\n <ul>\n <li *ngFor=\"let tag of post?.tags; trackBy: trackByTagId\"\n (keydown.enter)=\"tagPost(tag)\"\n (click)=\"tagPost(tag)\">\n {{ tag.name }}\n </li>\n </ul>\n </li>\n </ul>\n <ul class=\"d-flex justify-content-between mt-3 views\">\n <li>\n <span>{{ post?.view || 0 }} views</span>\n </li>\n <li><i class=\"far fa-heart\" aria-hidden=\"true\"></i></li>\n </ul>\n </div>\n <!--content end -->\n </div>\n <!-- modal for share buttons -->\n <div class=\"modal fade\"\n id=\"exampleModal\"\n tabindex=\"-1\"\n aria-labelledby=\"exampleModalLabel\">\n <div class=\"modal-dialog modal-dialog-centered\" >\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h5 class=\"modal-title\"\n id=\"exampleModalLabel\">Share the post</h5>\n <button type=\"button\"\n class=\"btn-close float-end\"\n data-dismiss=\"modal\"\n aria-label=\"Close\">\n <span>&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <share-buttons theme=\"material-dark\"\n show=\"7\"></share-buttons>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-primary\"\n data-dismiss=\"modal\">\n Close\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <!-- recent posts -->\n <div class=\"related-posts mt-5\">\n <ul class=\"d-flex justify-content-between\">\n <li>\n <h5>Recent Resources</h5>\n </li>\n <li><a [routerLink]=\"['/resource']\">See All</a></li>\n </ul>\n <div class=\"row mt-4\">\n <div class=\"col-sm-6 col-md-6 col-lg-4 col-xs-12 mb-2\"\n *ngFor=\"let recentPost of recentPosts; trackBy: trackByRecentPost\">\n <div class=\"recent-post\"\n [routerLink]=\"['/resource', recentPost.slug]\">\n <div class=\"blog-image\">\n <img [src]=\"recentPost.picture.url\"\n alt=\"Resource\" />\n </div>\n <h5 class=\"pt-4 blog-title ps-3 pe-3\">{{ recentPost?.title }}</h5>\n <div class=\"blog-view pt-3 ps-3 pe-3\">\n <p>{{ recentPost.view !== null ? recentPost.view : '0' }} View</p>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row mt-5 mb-4\">\n <div class=\"col-12\">\n <form class=\"comments-sec\"\n [formGroup]=\"commentForm\"\n (ngSubmit)=\"onComment()\"\n *ngIf=\"userLoggedIn; else userLoggedOut\">\n <div class=\"col-12 pt-4\">\n <!-- Comment Massage -->\n <pw-input-container label=\"Write a response\"\n name=\"comment\"\n errorMsg=\"Please enter comment\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"comment\"></textarea>\n </pw-input-container>\n\n <div class=\"text-end mt-4\">\n <button type=\"submit\"\n [buttonBusy]=\"buttonBusy\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n </div>\n </form>\n <ng-template #userLoggedOut>\n <p class=\"text-center pt-3 pb-3 userNotLoggedIn\">\n <a [routerLink]=\"['/login']\">Log in</a>\n to leave a comment!\n </p>\n </ng-template>\n </div>\n </div>\n <div class=\"row mt-5 mb-5\">\n <div class=\"col-12\"\n *ngFor=\"let comment of postComments; trackBy: trackByComment\">\n <div class=\"comment-post mt-2\">\n <img *ngIf=\"comment?.user?.avatar\"\n [src]=\"comment.user?.avatar[0]?.url\"\n alt=\"avatar\"\n width=\"45\"\n height=\"45\"\n class=\"rounded-circle me-3 mb-2\"\n (error)=\"handleImageError($event, 'assets/img/icons/male.png')\" />\n <img *ngIf=\"!comment?.user?.avatar\"\n alt=\"avatar\"\n width=\"45\"\n height=\"45\"\n class=\"rounded-circle me-3 mb-2\"\n src=\"assets/img/icons/male.png\" />\n <small>{{ comment.user?.first_name ? comment.user?.first_name : '' }}\n {{ comment.user?.last_name ? comment.user?.last_name : '' }}\n </small>\n <p>{{ comment.comment }}</p>\n <p class=\"text-end comment-date\">{{ comment.created_at | date: 'dd/MM/yyyy' }}</p>\n </div>\n </div>\n </div>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_sub_bg: rgb(70, 136, 236);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.show-blog,.recent-post{border:1px solid rgb(238,238,238)}.recent-post .blog-image{height:250px;min-height:250px}.recent-post .blog-image img{height:100%;width:100%}.recent-post .blog-title{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:300px}.recent-post .blog-view{border-top:1px solid rgb(238,238,238)}body{background:#fff}form.comments-sec{background-color:#f7f7f7;border:1px solid rgb(238,238,238)}form.comments-sec .no-padding{padding:0}form.comments-sec button{font-size:16px;margin-bottom:20px;margin-right:20px;padding:10px 25px;text-transform:uppercase}form.comments-sec label{background-color:#eee;color:gray;display:inline-block;margin:0;padding:15px;width:100%}form.comments-sec .mb-3{margin:0;padding:20px}form.comments-sec .mb-3 textarea{border:1px solid rgb(238,238,238);height:150px}.userNotLoggedIn{background:#f7f7f7;border:1px solid rgb(238,238,238);font-weight:400}.userNotLoggedIn a{color:#4444bc!important}.comment-post{background:#f7f7f7;border:1px solid rgb(238,238,238);padding:20px}.comment-post .comment-date{color:#777;font-size:14px;font-style:italic;margin:0}share-buttons{background-color:#eee;margin-bottom:10px}.read-post{margin:0 auto 20px;max-width:940px;padding-top:20px}.read-post .show-blog{padding:5rem 5rem 3rem}.read-post .show-blog ul li{display:inline-block;padding-right:10px}.read-post .show-blog ul li a{font:13px/1 Roboto,sans-serif}.read-post .show-blog ul li a .avatar-image{border-radius:50px;height:50px;overflow:hidden;width:50px}.read-post .show-blog ul li a .avatar-image i{color:#000}.read-post .show-blog ul li a .avatar-image i,.read-post .show-blog ul li a .avatar-image img{left:50%;position:relative;top:50%;transform:translate(-50%,-50%)}.read-post .show-blog ul li p.name{color:#000;font:14px/1 Roboto,sans-serif;margin:0;transition:all .5s}.read-post .show-blog ul li p.name:hover{color:#0045c7}.read-post .show-blog ul li p.name i{color:#000}.read-post .show-blog ul.views li:nth-child(2) i{color:#e84a43;font-size:14px}.read-post .show-blog ul.bottom-social-icons li:first-child ul li{padding-right:35px}.read-post .show-blog ul.bottom-social-icons li:first-child ul li i{color:#000}.read-post .show-blog ul.bottom-social-icons li:nth-child(2){padding:0}.read-post .show-blog ul.bottom-social-icons li:nth-child(2) ul li{padding-left:30px}.read-post .show-blog ul.bottom-social-icons li:nth-child(2) ul li a{color:#000}.read-post .show-blog .social-media{position:absolute;right:0;top:50%;transform:translateY(-50%)}.read-post .show-blog .social-media .share-post{flex-grow:3;position:relative;text-align:right}.read-post .show-blog .social-media .share-post i{color:var(--first)}.read-post .show-blog .social-media .share-post .dropdown-menu{border:0 none;box-shadow:0 3px 8px #0003;left:auto!important;right:0;top:20px!important;transform:translate(0)!important}.read-post .show-blog .body p img{max-width:100%}.social-media-blog-page a{color:#000}@media only screen and (max-width: 1024px){.read-post{padding:1rem}.read-post .show-blog{padding:.5rem}.read-post .show-blog h2{font-size:30px}}@media only screen and (max-width: 767px){.read-post,.read-post .show-blog{padding:.5rem}.read-post .show-blog ul{flex-wrap:wrap}.read-post .show-blog ul.bottom-social-icons li{width:100%}.read-post .show-blog ul.bottom-social-icons li ul{display:flex;justify-content:space-around;margin:10px 0}.read-post .show-blog ul.bottom-social-icons li ul li{padding:0!important;text-align:center;width:33.333%}.read-post .show-blog ul li{font:12px/1 Roboto,sans-serif;padding-right:5px}.read-post .show-blog ul li a{font:11px/1 Roboto,sans-serif}.read-post .show-blog ul li p.name{font:12px/1 Roboto,sans-serif}.read-post .show-blog h2{font-size:26px}.read-post .show-blog .body p{font-size:.8rem}}.subscribe-btn{background-color:var(--first);color:#fff}.subscribe-btn:hover{background-color:#fff;color:var(--first)}\n"] }]
322
+ }], ctorParameters: () => [{ type: ResourceService }, { type: i2.CustomToastService }, { type: i0.Injector }, { type: i3$1.DomSanitizer }] });
323
+
324
+ // These are the private routes. The public routes and modules needs to be defined in public.routes.ts
325
+ const routes = [
326
+ {
327
+ path: '',
328
+ component: ResourceListComponent,
329
+ data: {
330
+ title: 'Resource Posts Admin',
331
+ permission: 'Pages.Blog'
332
+ }
333
+ },
334
+ {
335
+ path: ':slug',
336
+ component: ResourceReadComponent,
337
+ data: {
338
+ title: 'Resource Post Admin',
339
+ permission: 'Pages.Blog'
340
+ }
341
+ }
342
+ ];
343
+ class BlogPublicRoutingModule {
344
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: BlogPublicRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
345
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: BlogPublicRoutingModule, imports: [i4.RouterModule], exports: [RouterModule] }); }
346
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: BlogPublicRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] }); }
347
+ }
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: BlogPublicRoutingModule, decorators: [{
349
+ type: NgModule,
350
+ args: [{
351
+ imports: [RouterModule.forChild(routes)],
352
+ exports: [RouterModule]
353
+ }]
354
+ }] });
355
+
356
+ class ResourcePublicModule {
357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourcePublicModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
358
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: ResourcePublicModule, declarations: [ResourceListComponent, ResourceReadComponent], imports: [CommonModule,
359
+ PipesModule,
360
+ SharedComponentsModule,
361
+ NgxUploaderModule,
362
+ BlogPublicRoutingModule,
363
+ ShareButtonsModule,
364
+ ShareIconsModule, i1.QuillModule, FormsModule,
365
+ PublicModule,
366
+ CoreTranslocoModule,
367
+ TranslocoModule,
368
+ ReactiveFormsModule,
369
+ DirectivesModule] }); }
370
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourcePublicModule, providers: [ResourceService, GoogleAnalyticsService], imports: [CommonModule,
371
+ PipesModule,
372
+ SharedComponentsModule,
373
+ NgxUploaderModule,
374
+ BlogPublicRoutingModule,
375
+ ShareButtonsModule,
376
+ ShareIconsModule,
377
+ QuillModule.forRoot(),
378
+ FormsModule,
379
+ PublicModule,
380
+ CoreTranslocoModule,
381
+ TranslocoModule,
382
+ ReactiveFormsModule,
383
+ DirectivesModule] }); }
384
+ }
385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourcePublicModule, decorators: [{
386
+ type: NgModule,
387
+ args: [{
388
+ declarations: [ResourceListComponent, ResourceReadComponent],
389
+ imports: [
390
+ CommonModule,
391
+ PipesModule,
392
+ SharedComponentsModule,
393
+ NgxUploaderModule,
394
+ BlogPublicRoutingModule,
395
+ ShareButtonsModule,
396
+ ShareIconsModule,
397
+ QuillModule.forRoot(),
398
+ FormsModule,
399
+ PublicModule,
400
+ CoreTranslocoModule,
401
+ TranslocoModule,
402
+ ReactiveFormsModule,
403
+ DirectivesModule
404
+ ],
405
+ providers: [ResourceService, GoogleAnalyticsService],
406
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
407
+ }]
408
+ }] });
409
+
410
+ class ResourceModule {
411
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
412
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: ResourceModule, imports: [ResourcePublicModule] }); }
413
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceModule, imports: [ResourcePublicModule] }); }
414
+ }
415
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ResourceModule, decorators: [{
416
+ type: NgModule,
417
+ args: [{
418
+ imports: [ResourcePublicModule]
419
+ }]
420
+ }] });
421
+
422
+ /**
423
+ * Generated bundle index. Do not edit.
424
+ */
425
+
426
+ export { ResourceListComponent, ResourceModule, ResourcePublicModule, ResourceReadComponent };
427
+ //# sourceMappingURL=posiwise-resource-module.mjs.map