@sunbird-cb/resolver 0.0.3 → 1.0.0-ang-13-16

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 (79) hide show
  1. package/esm2022/lib/invalid-permission/invalid-permission.component.mjs +29 -0
  2. package/esm2022/lib/invalid-registration/invalid-registration.component.mjs +23 -0
  3. package/esm2022/lib/restricted/restricted.component.mjs +23 -0
  4. package/esm2022/lib/unresolved/unresolved.component.mjs +30 -0
  5. package/esm2022/lib/widget-base.component.mjs +60 -0
  6. package/esm2022/lib/widget-resolver.constant.mjs +4 -0
  7. package/esm2022/lib/widget-resolver.directive.mjs +35 -0
  8. package/esm2022/lib/widget-resolver.model.mjs +2 -0
  9. package/esm2022/lib/widget-resolver.module.mjs +70 -0
  10. package/esm2022/lib/widget-resolver.permissions.mjs +74 -0
  11. package/esm2022/lib/widget-resolver.service.mjs +96 -0
  12. package/esm2022/public-api.mjs +7 -0
  13. package/esm2022/sunbird-cb-resolver.mjs +2 -0
  14. package/fesm2022/sunbird-cb-resolver.mjs +401 -0
  15. package/fesm2022/sunbird-cb-resolver.mjs.map +1 -0
  16. package/index.d.ts +3 -0
  17. package/lib/invalid-permission/invalid-permission.component.d.ts +15 -11
  18. package/lib/invalid-permission/invalid-permission.component.d.ts.map +1 -0
  19. package/lib/invalid-registration/invalid-registration.component.d.ts +12 -8
  20. package/lib/invalid-registration/invalid-registration.component.d.ts.map +1 -0
  21. package/lib/restricted/restricted.component.d.ts +12 -8
  22. package/lib/restricted/restricted.component.d.ts.map +1 -0
  23. package/lib/unresolved/unresolved.component.d.ts +14 -10
  24. package/lib/unresolved/unresolved.component.d.ts.map +1 -0
  25. package/lib/widget-base.component.d.ts +19 -15
  26. package/lib/widget-base.component.d.ts.map +1 -0
  27. package/lib/widget-resolver.constant.d.ts +5 -4
  28. package/lib/widget-resolver.constant.d.ts.map +1 -0
  29. package/lib/widget-resolver.directive.d.ts +16 -12
  30. package/lib/widget-resolver.directive.d.ts.map +1 -0
  31. package/lib/widget-resolver.model.d.ts +49 -48
  32. package/lib/widget-resolver.model.d.ts.map +1 -0
  33. package/lib/widget-resolver.module.d.ts +21 -6
  34. package/lib/widget-resolver.module.d.ts.map +1 -0
  35. package/lib/widget-resolver.permissions.d.ts +4 -3
  36. package/lib/widget-resolver.permissions.d.ts.map +1 -0
  37. package/lib/widget-resolver.service.d.ts +24 -22
  38. package/lib/widget-resolver.service.d.ts.map +1 -0
  39. package/package.json +30 -25
  40. package/public-api.d.ts +7 -5
  41. package/public-api.d.ts.map +1 -0
  42. package/sunbird-cb-resolver-1.0.0-ang-13-16.tgz +0 -0
  43. package/sunbird-cb-resolver.d.ts.map +1 -0
  44. package/bundles/sunbird-cb-resolver.umd.js +0 -750
  45. package/bundles/sunbird-cb-resolver.umd.js.map +0 -1
  46. package/bundles/sunbird-cb-resolver.umd.min.js +0 -16
  47. package/bundles/sunbird-cb-resolver.umd.min.js.map +0 -1
  48. package/esm2015/lib/invalid-permission/invalid-permission.component.js +0 -30
  49. package/esm2015/lib/invalid-registration/invalid-registration.component.js +0 -24
  50. package/esm2015/lib/restricted/restricted.component.js +0 -24
  51. package/esm2015/lib/unresolved/unresolved.component.js +0 -33
  52. package/esm2015/lib/widget-base.component.js +0 -51
  53. package/esm2015/lib/widget-resolver.constant.js +0 -4
  54. package/esm2015/lib/widget-resolver.directive.js +0 -43
  55. package/esm2015/lib/widget-resolver.model.js +0 -57
  56. package/esm2015/lib/widget-resolver.module.js +0 -65
  57. package/esm2015/lib/widget-resolver.permissions.js +0 -74
  58. package/esm2015/lib/widget-resolver.service.js +0 -114
  59. package/esm2015/public-api.js +0 -6
  60. package/esm2015/sunbird-cb-resolver.js +0 -8
  61. package/esm5/lib/invalid-permission/invalid-permission.component.js +0 -35
  62. package/esm5/lib/invalid-registration/invalid-registration.component.js +0 -29
  63. package/esm5/lib/restricted/restricted.component.js +0 -29
  64. package/esm5/lib/unresolved/unresolved.component.js +0 -38
  65. package/esm5/lib/widget-base.component.js +0 -54
  66. package/esm5/lib/widget-resolver.constant.js +0 -4
  67. package/esm5/lib/widget-resolver.directive.js +0 -45
  68. package/esm5/lib/widget-resolver.model.js +0 -57
  69. package/esm5/lib/widget-resolver.module.js +0 -69
  70. package/esm5/lib/widget-resolver.permissions.js +0 -79
  71. package/esm5/lib/widget-resolver.service.js +0 -120
  72. package/esm5/public-api.js +0 -6
  73. package/esm5/sunbird-cb-resolver.js +0 -8
  74. package/fesm2015/sunbird-cb-resolver.js +0 -489
  75. package/fesm2015/sunbird-cb-resolver.js.map +0 -1
  76. package/fesm5/sunbird-cb-resolver.js +0 -517
  77. package/fesm5/sunbird-cb-resolver.js.map +0 -1
  78. package/sunbird-cb-resolver.d.ts +0 -8
  79. package/sunbird-cb-resolver.metadata.json +0 -1
@@ -0,0 +1,96 @@
1
+ import { Injectable, Inject, } from '@angular/core';
2
+ import { WIDGET_RESOLVER_GLOBAL_CONFIG, WIDGET_RESOLVER_SCOPED_CONFIG, } from './widget-resolver.constant';
3
+ import { hasPermissions } from './widget-resolver.permissions';
4
+ import { RestrictedComponent } from './restricted/restricted.component';
5
+ import { InvalidRegistrationComponent } from './invalid-registration/invalid-registration.component';
6
+ import { InvalidPermissionComponent } from './invalid-permission/invalid-permission.component';
7
+ import { UnresolvedComponent } from './unresolved/unresolved.component';
8
+ import * as i0 from "@angular/core";
9
+ import * as i1 from "@angular/platform-browser";
10
+ export class WidgetResolverService {
11
+ constructor(domSanitizer, componentFactoryResolver, globalConfig, scopedConfig) {
12
+ this.domSanitizer = domSanitizer;
13
+ this.componentFactoryResolver = componentFactoryResolver;
14
+ this.globalConfig = globalConfig;
15
+ this.scopedConfig = scopedConfig;
16
+ this.roles = null;
17
+ this.groups = null;
18
+ this.restrictedFeatures = null;
19
+ this.isInitialized = false;
20
+ this.availableRegisteredWidgets = null;
21
+ this.restrictedWidgetKeys = null;
22
+ }
23
+ static getWidgetKey(config) {
24
+ return `widget:${config.widgetType}::${config.widgetSubType}`;
25
+ }
26
+ initialize(restrictedWidgetKeys, roles, groups, restrictedFeatures) {
27
+ this.roles = roles;
28
+ this.groups = groups;
29
+ this.restrictedFeatures = restrictedFeatures;
30
+ const restrictedWidgetKeysSet = restrictedWidgetKeys
31
+ ? restrictedWidgetKeys
32
+ : new Set();
33
+ const registrationConfig = new Map();
34
+ const allWidgetsConfigurations = [];
35
+ if (this.globalConfig && Array.isArray(this.globalConfig)) {
36
+ allWidgetsConfigurations.push(...this.globalConfig);
37
+ }
38
+ if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
39
+ allWidgetsConfigurations.push(...this.scopedConfig);
40
+ }
41
+ allWidgetsConfigurations.forEach(u => {
42
+ const key = WidgetResolverService.getWidgetKey(u);
43
+ if (!restrictedWidgetKeysSet.has(key)) {
44
+ registrationConfig.set(key, u);
45
+ }
46
+ });
47
+ this.restrictedWidgetKeys = restrictedWidgetKeysSet;
48
+ this.availableRegisteredWidgets = registrationConfig;
49
+ this.isInitialized = true;
50
+ }
51
+ resolveWidget(receivedConfig, containerRef) {
52
+ const key = WidgetResolverService.getWidgetKey(receivedConfig);
53
+ if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
54
+ return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
55
+ }
56
+ if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
57
+ if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
58
+ const config = this.availableRegisteredWidgets.get(key);
59
+ if (config && config.component) {
60
+ return this.widgetResolved(containerRef, receivedConfig, config.component);
61
+ }
62
+ return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
63
+ }
64
+ return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
65
+ }
66
+ return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
67
+ }
68
+ widgetResolved(containerRef, compData, component) {
69
+ const factory = this.componentFactoryResolver.resolveComponentFactory(component);
70
+ containerRef.clear();
71
+ const compRef = containerRef.createComponent(factory);
72
+ compRef.instance.widgetData = compData.widgetData;
73
+ if (compRef.instance.updateBaseComponent) {
74
+ const widgetSafeStyle = compData.widgetHostStyle
75
+ ? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''))
76
+ : undefined;
77
+ compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
78
+ }
79
+ return compRef;
80
+ }
81
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, deps: [{ token: i1.DomSanitizer }, { token: i0.ComponentFactoryResolver }, { token: WIDGET_RESOLVER_GLOBAL_CONFIG }, { token: WIDGET_RESOLVER_SCOPED_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
82
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, providedIn: 'root' }); }
83
+ }
84
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, decorators: [{
85
+ type: Injectable,
86
+ args: [{
87
+ providedIn: 'root',
88
+ }]
89
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
90
+ type: Inject,
91
+ args: [WIDGET_RESOLVER_GLOBAL_CONFIG]
92
+ }] }, { type: undefined, decorators: [{
93
+ type: Inject,
94
+ args: [WIDGET_RESOLVER_SCOPED_CONFIG]
95
+ }] }]; } });
96
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2lkZ2V0LXJlc29sdmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJyY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hbmNlLndpZGdldERhdGEgPSBjb21wRGF0YS53aWRnZXREYXRhXHJcbiAgICBpZiAoY29tcFJlZi5pbnN0YW5jZS51cGRhdGVCYXNlQ29tcG9uZW50KSB7XHJcbiAgICAgIGNvbnN0IHdpZGdldFNhZmVTdHlsZSA9IGNvbXBEYXRhLndpZGdldEhvc3RTdHlsZVxyXG4gICAgICAgID8gdGhpcy5kb21TYW5pdGl6ZXIuYnlwYXNzU2VjdXJpdHlUcnVzdFN0eWxlKFxyXG4gICAgICAgICAgT2JqZWN0LmVudHJpZXMoY29tcERhdGEud2lkZ2V0SG9zdFN0eWxlKS5yZWR1Y2UoKHMsIFtrLCB2XSkgPT4gYCR7c30ke2t9OiR7dn07YCwgJycpLFxyXG4gICAgICAgIClcclxuICAgICAgICA6IHVuZGVmaW5lZFxyXG4gICAgICBjb21wUmVmLmluc3RhbmNlLnVwZGF0ZUJhc2VDb21wb25lbnQoXHJcbiAgICAgICAgY29tcERhdGEud2lkZ2V0VHlwZSxcclxuICAgICAgICBjb21wRGF0YS53aWRnZXRTdWJUeXBlLFxyXG4gICAgICAgIGNvbXBEYXRhLndpZGdldEluc3RhbmNlSWQsXHJcbiAgICAgICAgY29tcERhdGEud2lkZ2V0SG9zdENsYXNzLFxyXG4gICAgICAgIHdpZGdldFNhZmVTdHlsZSxcclxuICAgICAgKVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGNvbXBSZWZcclxuICB9XHJcbn1cclxuIl19
@@ -0,0 +1,7 @@
1
+ export * from './lib/widget-resolver.module';
2
+ export * from './lib/widget-resolver.service';
3
+ export * from './lib/widget-resolver.model';
4
+ export * from './lib/widget-resolver.permissions';
5
+ export * from './lib/widget-base.component';
6
+ export * from './lib/widget-resolver.directive';
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnJ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leC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,401 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, Component, Input, HostBinding, Injectable, Inject, Directive, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i2 from '@angular/material/legacy-button';
6
+ import { MatLegacyButtonModule } from '@angular/material/legacy-button';
7
+ import * as i3 from '@angular/material/icon';
8
+ import { MatIconModule } from '@angular/material/icon';
9
+ import * as i4 from '@angular/material/legacy-card';
10
+ import { MatLegacyCardModule } from '@angular/material/legacy-card';
11
+ import * as i1$1 from '@angular/platform-browser';
12
+ import * as i2$1 from '@sunbird-cb/utils';
13
+ import { ConfigurationsService } from '@sunbird-cb/utils';
14
+
15
+ const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken('Global Registration Configuration for Widget Resolvers');
16
+ const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken('Scoped Registration Configuration for Widget Resolvers');
17
+
18
+ function isStringArray(strArr) {
19
+ return Array.isArray(strArr) && strArr.every(u => typeof u === 'string');
20
+ }
21
+ function isCheckRequired(requiredPermission) {
22
+ if (requiredPermission === undefined ||
23
+ requiredPermission === null ||
24
+ requiredPermission === '' ||
25
+ (Array.isArray(requiredPermission) && requiredPermission.length === 0)) {
26
+ return false;
27
+ }
28
+ return true;
29
+ }
30
+ function flipBoolean(value, flip = false) {
31
+ return flip ? !value : value;
32
+ }
33
+ function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive = false) {
34
+ if (!isCheckRequired(requiredPermission)) {
35
+ return true;
36
+ }
37
+ if (typeof requiredPermission === 'string') {
38
+ switch (testFor) {
39
+ case 'all':
40
+ case 'some':
41
+ return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive);
42
+ case 'none':
43
+ return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive);
44
+ }
45
+ }
46
+ if (Array.isArray(requiredPermission)) {
47
+ const matcher = (u) => typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive);
48
+ switch (testFor) {
49
+ case 'all':
50
+ return requiredPermission.every(matcher);
51
+ case 'some':
52
+ return requiredPermission.some(matcher);
53
+ case 'none':
54
+ return !requiredPermission.every(matcher);
55
+ }
56
+ }
57
+ return false;
58
+ }
59
+ function hasUnitPermission(requiredPermission, matchAgainst, isRestrictive = false) {
60
+ if (!isCheckRequired(requiredPermission)) {
61
+ return true;
62
+ }
63
+ const accessValues = matchAgainst instanceof Set
64
+ ? matchAgainst
65
+ : Array.isArray(matchAgainst) && isStringArray(matchAgainst)
66
+ ? new Set(matchAgainst)
67
+ : typeof matchAgainst === 'string'
68
+ ? new Set([matchAgainst])
69
+ : new Set();
70
+ if (typeof requiredPermission === 'object' && requiredPermission !== null) {
71
+ if (Array.isArray(requiredPermission)) {
72
+ return permissionTest('all', requiredPermission, accessValues, isRestrictive);
73
+ }
74
+ return (permissionTest('all', 'all' in requiredPermission ? requiredPermission.all : null, accessValues, isRestrictive) &&
75
+ permissionTest('some', 'some' in requiredPermission ? requiredPermission.some : null, accessValues, isRestrictive) &&
76
+ permissionTest('none', 'none' in requiredPermission ? requiredPermission.none : null, accessValues, isRestrictive));
77
+ }
78
+ return false;
79
+ }
80
+ function hasPermissions(requiredPermission, availableRoles, availableGroups, restrictedFeatures) {
81
+ if (!requiredPermission) {
82
+ return true;
83
+ }
84
+ if (!requiredPermission.available || !requiredPermission.enabled) {
85
+ return false;
86
+ }
87
+ return (hasUnitPermission(requiredPermission.groups, availableGroups) &&
88
+ hasUnitPermission(requiredPermission.roles, availableRoles) &&
89
+ hasUnitPermission(requiredPermission.features, restrictedFeatures, true));
90
+ }
91
+
92
+ class WidgetBaseComponent {
93
+ constructor() {
94
+ this.widgetType = '';
95
+ this.widgetSubType = '';
96
+ }
97
+ updateBaseComponent(widgetType, widgetSubType, widgetInstanceId, widgetHostClass, widgetSafeStyle) {
98
+ this.widgetType = widgetType;
99
+ this.widgetSubType = widgetSubType;
100
+ this.widgetInstanceId = widgetInstanceId;
101
+ this.widgetHostClass = widgetHostClass;
102
+ this.widgetSafeStyle = widgetSafeStyle;
103
+ if (this.widgetHostClass) {
104
+ this.className = `${this.className} ${this.widgetHostClass}`;
105
+ }
106
+ }
107
+ ngAfterViewInit() {
108
+ const hash = window.location.hash ? window.location.hash.split('#')[1] : '';
109
+ if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
110
+ setTimeout(() => {
111
+ const element = document.getElementById(this.widgetInstanceId || '');
112
+ if (element) {
113
+ element.scrollIntoView();
114
+ }
115
+ }, 200);
116
+ }
117
+ }
118
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
119
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WidgetBaseComponent, selector: "ws-resolver-base", inputs: { widgetType: "widgetType", widgetSubType: "widgetSubType", widgetHostClass: "widgetHostClass", widgetInstanceId: "widgetInstanceId", widgetSafeStyle: "widgetSafeStyle", className: "className" }, host: { properties: { "id": "this.widgetInstanceId", "style": "this.widgetSafeStyle", "class": "this.className" } }, ngImport: i0, template: 'Base Component', isInline: true }); }
120
+ }
121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetBaseComponent, decorators: [{
122
+ type: Component,
123
+ args: [{
124
+ selector: 'ws-resolver-base',
125
+ template: 'Base Component',
126
+ }]
127
+ }], propDecorators: { widgetType: [{
128
+ type: Input
129
+ }], widgetSubType: [{
130
+ type: Input
131
+ }], widgetHostClass: [{
132
+ type: Input
133
+ }], widgetInstanceId: [{
134
+ type: Input
135
+ }, {
136
+ type: HostBinding,
137
+ args: ['id']
138
+ }], widgetSafeStyle: [{
139
+ type: Input
140
+ }, {
141
+ type: HostBinding,
142
+ args: ['style']
143
+ }], className: [{
144
+ type: Input
145
+ }, {
146
+ type: HostBinding,
147
+ args: ['class']
148
+ }] } });
149
+
150
+ class RestrictedComponent extends WidgetBaseComponent {
151
+ constructor() {
152
+ super(...arguments);
153
+ this.showData = true;
154
+ }
155
+ ngOnInit() { }
156
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestrictedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
157
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RestrictedComponent, selector: "ws-resolver-restricted", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Restricted Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatLegacyCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i4.MatLegacyCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatLegacyCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatLegacyCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
158
+ }
159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RestrictedComponent, decorators: [{
160
+ type: Component,
161
+ args: [{ selector: 'ws-resolver-restricted', template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Restricted Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
162
+ }], propDecorators: { widgetData: [{
163
+ type: Input
164
+ }] } });
165
+
166
+ class InvalidRegistrationComponent extends WidgetBaseComponent {
167
+ constructor() {
168
+ super(...arguments);
169
+ this.showData = true;
170
+ }
171
+ ngOnInit() { }
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InvalidRegistrationComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
173
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InvalidRegistrationComponent, selector: "ws-resolver-invalid-registration", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Registration for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatLegacyCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i4.MatLegacyCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatLegacyCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatLegacyCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InvalidRegistrationComponent, decorators: [{
176
+ type: Component,
177
+ args: [{ selector: 'ws-resolver-invalid-registration', template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Registration for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
178
+ }], propDecorators: { widgetData: [{
179
+ type: Input
180
+ }] } });
181
+
182
+ class InvalidPermissionComponent extends WidgetBaseComponent {
183
+ constructor() {
184
+ super(...arguments);
185
+ this.showData = true;
186
+ }
187
+ ngOnInit() { }
188
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InvalidPermissionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
189
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InvalidPermissionComponent, selector: "ws-resolver-invalid-permission", inputs: { widgetType: "widgetType", widgetSubType: "widgetSubType", widgetInstanceId: "widgetInstanceId", widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Permission for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatLegacyCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i4.MatLegacyCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatLegacyCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatLegacyCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
190
+ }
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InvalidPermissionComponent, decorators: [{
192
+ type: Component,
193
+ args: [{ selector: 'ws-resolver-invalid-permission', template: "<mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error as Invalid Permission for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s \"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n</mat-card>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
194
+ }], propDecorators: { widgetType: [{
195
+ type: Input
196
+ }], widgetSubType: [{
197
+ type: Input
198
+ }], widgetInstanceId: [{
199
+ type: Input
200
+ }], widgetData: [{
201
+ type: Input
202
+ }] } });
203
+
204
+ class UnresolvedComponent extends WidgetBaseComponent {
205
+ constructor() {
206
+ super(...arguments);
207
+ this.showData = true;
208
+ this.previewMode = false;
209
+ this.searchArray = ['preview', 'channel'];
210
+ }
211
+ ngOnInit() {
212
+ const url = window.location.href;
213
+ this.previewMode = this.searchArray.some((word) => {
214
+ return url.indexOf(word) > -1;
215
+ });
216
+ }
217
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UnresolvedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
218
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: UnresolvedComponent, selector: "ws-resolver-unresolved", inputs: { widgetData: "widgetData" }, usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"previewMode\" [ngTemplateOutlet]=\"previewCardTemplate\"></ng-container>\r\n<ng-container *ngIf=\"!previewMode\" [ngTemplateOutlet]=\"unresolvedTemplate\"></ng-container>\r\n\r\n<ng-template #unresolvedTemplate>\r\n <mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error in Resolving Json for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s\"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n </mat-card>\r\n</ng-template>\r\n<ng-template #previewCardTemplate>\r\n <mat-card>\r\n <div class=\"w-full\">\r\n <div class=\"p-4\">\r\n <div class=\"text-3xl font-semibold text-center leading-tight\" i18n>\r\n Content not available\r\n </div>\r\n <br />\r\n <div class=\"text-base font-medium text-center leading-normal\" i18n>\r\n Please add widget or provide data to widget template\r\n </div>\r\n </div>\r\n </div>\r\n </mat-card>\r\n</ng-template>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatLegacyCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "component", type: i4.MatLegacyCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i4.MatLegacyCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatLegacyCardAvatar, selector: "[mat-card-avatar], [matCardAvatar]" }, { kind: "pipe", type: i1.JsonPipe, name: "json" }] }); }
219
+ }
220
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UnresolvedComponent, decorators: [{
221
+ type: Component,
222
+ args: [{ selector: 'ws-resolver-unresolved', template: "<ng-container *ngIf=\"previewMode\" [ngTemplateOutlet]=\"previewCardTemplate\"></ng-container>\r\n<ng-container *ngIf=\"!previewMode\" [ngTemplateOutlet]=\"unresolvedTemplate\"></ng-container>\r\n\r\n<ng-template #unresolvedTemplate>\r\n <mat-card class=\"margin-m\">\r\n <mat-card-header>\r\n <div mat-card-avatar class=\"mat-card-avatar-override\">\r\n <mat-icon color=\"warn\">report_problem</mat-icon>\r\n </div>\r\n <mat-card-title>\r\n <ng-container i18n>\r\n Error in Resolving Json for Widget\r\n </ng-container>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <div class=\"flex flex-wrap flex-between\">\r\n <div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Type :\r\n </span>\r\n {{ widgetType }}\r\n </div>\r\n <div class=\"margin-top-s\">\r\n <span class=\"mat-body-2 font-bold\" i18n>\r\n Widget Sub Type :\r\n </span>\r\n {{ widgetSubType }}\r\n </div>\r\n </div>\r\n <div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"!showData\" (click)=\"showData = true\">\r\n <ng-container i18n>See Details</ng-container>\r\n <mat-icon>arrow_drop_down</mat-icon>\r\n </button>\r\n <button mat-raised-button class=\"margin-top-m\" color=\"primary\" *ngIf=\"showData\" (click)=\"showData = false\">\r\n <ng-container i18n>Hide Details</ng-container>\r\n <mat-icon>arrow_drop_up</mat-icon>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"widgetData\">\r\n <pre *ngIf=\"showData\" class=\"margin-top-s\"><span i18n class=\"mat-body-2 font-bold\">Widget Data :</span>\r\n{{ widgetData | json }}\r\n </pre>\r\n </ng-container>\r\n </mat-card>\r\n</ng-template>\r\n<ng-template #previewCardTemplate>\r\n <mat-card>\r\n <div class=\"w-full\">\r\n <div class=\"p-4\">\r\n <div class=\"text-3xl font-semibold text-center leading-tight\" i18n>\r\n Content not available\r\n </div>\r\n <br />\r\n <div class=\"text-base font-medium text-center leading-normal\" i18n>\r\n Please add widget or provide data to widget template\r\n </div>\r\n </div>\r\n </div>\r\n </mat-card>\r\n</ng-template>", styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}\n"] }]
223
+ }], propDecorators: { widgetData: [{
224
+ type: Input
225
+ }] } });
226
+
227
+ class WidgetResolverService {
228
+ constructor(domSanitizer, componentFactoryResolver, globalConfig, scopedConfig) {
229
+ this.domSanitizer = domSanitizer;
230
+ this.componentFactoryResolver = componentFactoryResolver;
231
+ this.globalConfig = globalConfig;
232
+ this.scopedConfig = scopedConfig;
233
+ this.roles = null;
234
+ this.groups = null;
235
+ this.restrictedFeatures = null;
236
+ this.isInitialized = false;
237
+ this.availableRegisteredWidgets = null;
238
+ this.restrictedWidgetKeys = null;
239
+ }
240
+ static getWidgetKey(config) {
241
+ return `widget:${config.widgetType}::${config.widgetSubType}`;
242
+ }
243
+ initialize(restrictedWidgetKeys, roles, groups, restrictedFeatures) {
244
+ this.roles = roles;
245
+ this.groups = groups;
246
+ this.restrictedFeatures = restrictedFeatures;
247
+ const restrictedWidgetKeysSet = restrictedWidgetKeys
248
+ ? restrictedWidgetKeys
249
+ : new Set();
250
+ const registrationConfig = new Map();
251
+ const allWidgetsConfigurations = [];
252
+ if (this.globalConfig && Array.isArray(this.globalConfig)) {
253
+ allWidgetsConfigurations.push(...this.globalConfig);
254
+ }
255
+ if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
256
+ allWidgetsConfigurations.push(...this.scopedConfig);
257
+ }
258
+ allWidgetsConfigurations.forEach(u => {
259
+ const key = WidgetResolverService.getWidgetKey(u);
260
+ if (!restrictedWidgetKeysSet.has(key)) {
261
+ registrationConfig.set(key, u);
262
+ }
263
+ });
264
+ this.restrictedWidgetKeys = restrictedWidgetKeysSet;
265
+ this.availableRegisteredWidgets = registrationConfig;
266
+ this.isInitialized = true;
267
+ }
268
+ resolveWidget(receivedConfig, containerRef) {
269
+ const key = WidgetResolverService.getWidgetKey(receivedConfig);
270
+ if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
271
+ return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
272
+ }
273
+ if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
274
+ if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
275
+ const config = this.availableRegisteredWidgets.get(key);
276
+ if (config && config.component) {
277
+ return this.widgetResolved(containerRef, receivedConfig, config.component);
278
+ }
279
+ return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
280
+ }
281
+ return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
282
+ }
283
+ return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
284
+ }
285
+ widgetResolved(containerRef, compData, component) {
286
+ const factory = this.componentFactoryResolver.resolveComponentFactory(component);
287
+ containerRef.clear();
288
+ const compRef = containerRef.createComponent(factory);
289
+ compRef.instance.widgetData = compData.widgetData;
290
+ if (compRef.instance.updateBaseComponent) {
291
+ const widgetSafeStyle = compData.widgetHostStyle
292
+ ? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''))
293
+ : undefined;
294
+ compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
295
+ }
296
+ return compRef;
297
+ }
298
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, deps: [{ token: i1$1.DomSanitizer }, { token: i0.ComponentFactoryResolver }, { token: WIDGET_RESOLVER_GLOBAL_CONFIG }, { token: WIDGET_RESOLVER_SCOPED_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
299
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, providedIn: 'root' }); }
300
+ }
301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverService, decorators: [{
302
+ type: Injectable,
303
+ args: [{
304
+ providedIn: 'root',
305
+ }]
306
+ }], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }, { type: i0.ComponentFactoryResolver }, { type: undefined, decorators: [{
307
+ type: Inject,
308
+ args: [WIDGET_RESOLVER_GLOBAL_CONFIG]
309
+ }] }, { type: undefined, decorators: [{
310
+ type: Inject,
311
+ args: [WIDGET_RESOLVER_SCOPED_CONFIG]
312
+ }] }]; } });
313
+
314
+ class WidgetResolverDirective {
315
+ constructor(viewContainerRef, widgetResolverSvc, logger) {
316
+ this.viewContainerRef = viewContainerRef;
317
+ this.widgetResolverSvc = widgetResolverSvc;
318
+ this.logger = logger;
319
+ this.wsResolverWidget = null;
320
+ }
321
+ ngOnChanges() {
322
+ if (!this.widgetResolverSvc.isInitialized) {
323
+ this.logger.error('Widgets Registration Not Done. Used Before Initialization.', this.wsResolverWidget);
324
+ return;
325
+ }
326
+ if (this.wsResolverWidget) {
327
+ const compRef = this.widgetResolverSvc.resolveWidget(this.wsResolverWidget, this.viewContainerRef);
328
+ if (compRef) {
329
+ compRef.changeDetectorRef.detectChanges();
330
+ }
331
+ }
332
+ }
333
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverDirective, deps: [{ token: i0.ViewContainerRef }, { token: WidgetResolverService }, { token: i2$1.LoggerService }], target: i0.ɵɵFactoryTarget.Directive }); }
334
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: WidgetResolverDirective, selector: "[wsResolverWidget]", inputs: { wsResolverWidget: "wsResolverWidget" }, usesOnChanges: true, ngImport: i0 }); }
335
+ }
336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverDirective, decorators: [{
337
+ type: Directive,
338
+ args: [{
339
+ selector: '[wsResolverWidget]',
340
+ }]
341
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: WidgetResolverService }, { type: i2$1.LoggerService }]; }, propDecorators: { wsResolverWidget: [{
342
+ type: Input
343
+ }] } });
344
+
345
+ class WidgetResolverModule {
346
+ static forRoot(config) {
347
+ return {
348
+ ngModule: WidgetResolverModule,
349
+ providers: [
350
+ WidgetResolverService,
351
+ {
352
+ provide: WIDGET_RESOLVER_GLOBAL_CONFIG,
353
+ useValue: config,
354
+ },
355
+ {
356
+ provide: WIDGET_RESOLVER_SCOPED_CONFIG,
357
+ useValue: [],
358
+ },
359
+ ],
360
+ };
361
+ }
362
+ static forChild(config) {
363
+ return {
364
+ ngModule: WidgetResolverModule,
365
+ providers: [
366
+ WidgetResolverService,
367
+ {
368
+ provide: WIDGET_RESOLVER_SCOPED_CONFIG,
369
+ useValue: config,
370
+ },
371
+ ],
372
+ };
373
+ }
374
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
375
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverModule, declarations: [WidgetBaseComponent,
376
+ WidgetResolverDirective,
377
+ RestrictedComponent,
378
+ InvalidRegistrationComponent,
379
+ InvalidPermissionComponent,
380
+ UnresolvedComponent], imports: [CommonModule, MatLegacyButtonModule, MatIconModule, MatLegacyCardModule], exports: [WidgetResolverDirective, WidgetBaseComponent] }); }
381
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverModule, providers: [ConfigurationsService], imports: [CommonModule, MatLegacyButtonModule, MatIconModule, MatLegacyCardModule] }); }
382
+ }
383
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WidgetResolverModule, decorators: [{
384
+ type: NgModule,
385
+ args: [{
386
+ declarations: [
387
+ WidgetBaseComponent,
388
+ WidgetResolverDirective,
389
+ RestrictedComponent,
390
+ InvalidRegistrationComponent,
391
+ InvalidPermissionComponent,
392
+ UnresolvedComponent,
393
+ ],
394
+ imports: [CommonModule, MatLegacyButtonModule, MatIconModule, MatLegacyCardModule],
395
+ exports: [WidgetResolverDirective, WidgetBaseComponent],
396
+ providers: [ConfigurationsService]
397
+ }]
398
+ }] });
399
+
400
+ export { WidgetBaseComponent, WidgetResolverDirective, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission };
401
+ //# sourceMappingURL=sunbird-cb-resolver.mjs.map