@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
@@ -1,489 +0,0 @@
1
- import { InjectionToken, Component, Input, HostBinding, Injectable, ComponentFactoryResolver, Inject, ɵɵdefineInjectable, ɵɵinject, Directive, ViewContainerRef, NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { LoggerService, ConfigurationsService } from '@sunbird-cb/utils';
4
- import { DomSanitizer } from '@angular/platform-browser';
5
- import { MatButtonModule, MatIconModule, MatCardModule } from '@angular/material';
6
-
7
- const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken('Global Registration Configuration for Widget Resolvers');
8
- const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken('Scoped Registration Configuration for Widget Resolvers');
9
-
10
- function isStringArray(strArr) {
11
- return Array.isArray(strArr) && strArr.every((u => typeof u === 'string'));
12
- }
13
- function isCheckRequired(requiredPermission) {
14
- if (requiredPermission === undefined ||
15
- requiredPermission === null ||
16
- requiredPermission === '' ||
17
- (Array.isArray(requiredPermission) && requiredPermission.length === 0)) {
18
- return false;
19
- }
20
- return true;
21
- }
22
- function flipBoolean(value, flip = false) {
23
- return flip ? !value : value;
24
- }
25
- function permissionTest(testFor, requiredPermission, matchAgainst, isRestrictive = false) {
26
- if (!isCheckRequired(requiredPermission)) {
27
- return true;
28
- }
29
- if (typeof requiredPermission === 'string') {
30
- switch (testFor) {
31
- case 'all':
32
- case 'some':
33
- return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive);
34
- case 'none':
35
- return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive);
36
- }
37
- }
38
- if (Array.isArray(requiredPermission)) {
39
- const matcher = ((u) => typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive));
40
- switch (testFor) {
41
- case 'all':
42
- return requiredPermission.every(matcher);
43
- case 'some':
44
- return requiredPermission.some(matcher);
45
- case 'none':
46
- return !requiredPermission.every(matcher);
47
- }
48
- }
49
- return false;
50
- }
51
- function hasUnitPermission(requiredPermission, matchAgainst, isRestrictive = false) {
52
- if (!isCheckRequired(requiredPermission)) {
53
- return true;
54
- }
55
- const accessValues = matchAgainst instanceof Set
56
- ? matchAgainst
57
- : Array.isArray(matchAgainst) && isStringArray(matchAgainst)
58
- ? new Set(matchAgainst)
59
- : typeof matchAgainst === 'string'
60
- ? new Set([matchAgainst])
61
- : new Set();
62
- if (typeof requiredPermission === 'object' && requiredPermission !== null) {
63
- if (Array.isArray(requiredPermission)) {
64
- return permissionTest('all', requiredPermission, accessValues, isRestrictive);
65
- }
66
- return (permissionTest('all', 'all' in requiredPermission ? requiredPermission.all : null, accessValues, isRestrictive) &&
67
- permissionTest('some', 'some' in requiredPermission ? requiredPermission.some : null, accessValues, isRestrictive) &&
68
- permissionTest('none', 'none' in requiredPermission ? requiredPermission.none : null, accessValues, isRestrictive));
69
- }
70
- return false;
71
- }
72
- function hasPermissions(requiredPermission, availableRoles, availableGroups, restrictedFeatures) {
73
- if (!requiredPermission) {
74
- return true;
75
- }
76
- if (!requiredPermission.available || !requiredPermission.enabled) {
77
- return false;
78
- }
79
- return (hasUnitPermission(requiredPermission.groups, availableGroups) &&
80
- hasUnitPermission(requiredPermission.roles, availableRoles) &&
81
- hasUnitPermission(requiredPermission.features, restrictedFeatures, true));
82
- }
83
-
84
- class WidgetBaseComponent {
85
- constructor() {
86
- this.widgetType = '';
87
- this.widgetSubType = '';
88
- }
89
- updateBaseComponent(widgetType, widgetSubType, widgetInstanceId, widgetHostClass, widgetSafeStyle) {
90
- this.widgetType = widgetType;
91
- this.widgetSubType = widgetSubType;
92
- this.widgetInstanceId = widgetInstanceId;
93
- this.widgetHostClass = widgetHostClass;
94
- this.widgetSafeStyle = widgetSafeStyle;
95
- if (this.widgetHostClass) {
96
- this.className = `${this.className} ${this.widgetHostClass}`;
97
- }
98
- }
99
- ngAfterViewInit() {
100
- const hash = window.location.hash ? window.location.hash.split('#')[1] : '';
101
- if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {
102
- setTimeout((() => {
103
- const element = document.getElementById(this.widgetInstanceId || '');
104
- if (element) {
105
- element.scrollIntoView();
106
- }
107
- }), 200);
108
- }
109
- }
110
- }
111
- WidgetBaseComponent.decorators = [
112
- { type: Component, args: [{
113
- selector: 'ws-resolver-base',
114
- template: 'Base Component'
115
- }] }
116
- ];
117
- WidgetBaseComponent.propDecorators = {
118
- widgetType: [{ type: Input }],
119
- widgetSubType: [{ type: Input }],
120
- widgetHostClass: [{ type: Input }],
121
- widgetInstanceId: [{ type: Input }, { type: HostBinding, args: ['id',] }],
122
- widgetSafeStyle: [{ type: Input }, { type: HostBinding, args: ['style',] }],
123
- className: [{ type: Input }, { type: HostBinding, args: ['class',] }]
124
- };
125
- if (false) {
126
- WidgetBaseComponent.prototype.widgetType;
127
- WidgetBaseComponent.prototype.widgetSubType;
128
- WidgetBaseComponent.prototype.widgetHostClass;
129
- WidgetBaseComponent.prototype.widgetInstanceId;
130
- WidgetBaseComponent.prototype.widgetSafeStyle;
131
- WidgetBaseComponent.prototype.className;
132
- }
133
-
134
- class RestrictedComponent extends WidgetBaseComponent {
135
- constructor() {
136
- super(...arguments);
137
- this.showData = true;
138
- }
139
- ngOnInit() { }
140
- }
141
- RestrictedComponent.decorators = [
142
- { type: Component, args: [{
143
- selector: 'ws-resolver-restricted',
144
- 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>",
145
- styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}"]
146
- }] }
147
- ];
148
- RestrictedComponent.propDecorators = {
149
- widgetData: [{ type: Input }]
150
- };
151
- if (false) {
152
- RestrictedComponent.prototype.widgetData;
153
- RestrictedComponent.prototype.showData;
154
- }
155
-
156
- class InvalidRegistrationComponent extends WidgetBaseComponent {
157
- constructor() {
158
- super(...arguments);
159
- this.showData = true;
160
- }
161
- ngOnInit() { }
162
- }
163
- InvalidRegistrationComponent.decorators = [
164
- { type: Component, args: [{
165
- selector: 'ws-resolver-invalid-registration',
166
- 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>",
167
- styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}"]
168
- }] }
169
- ];
170
- InvalidRegistrationComponent.propDecorators = {
171
- widgetData: [{ type: Input }]
172
- };
173
- if (false) {
174
- InvalidRegistrationComponent.prototype.widgetData;
175
- InvalidRegistrationComponent.prototype.showData;
176
- }
177
-
178
- class InvalidPermissionComponent extends WidgetBaseComponent {
179
- constructor() {
180
- super(...arguments);
181
- this.showData = true;
182
- }
183
- ngOnInit() { }
184
- }
185
- InvalidPermissionComponent.decorators = [
186
- { type: Component, args: [{
187
- selector: 'ws-resolver-invalid-permission',
188
- 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>",
189
- styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}"]
190
- }] }
191
- ];
192
- InvalidPermissionComponent.propDecorators = {
193
- widgetType: [{ type: Input }],
194
- widgetSubType: [{ type: Input }],
195
- widgetInstanceId: [{ type: Input }],
196
- widgetData: [{ type: Input }]
197
- };
198
- if (false) {
199
- InvalidPermissionComponent.prototype.widgetType;
200
- InvalidPermissionComponent.prototype.widgetSubType;
201
- InvalidPermissionComponent.prototype.widgetInstanceId;
202
- InvalidPermissionComponent.prototype.widgetData;
203
- InvalidPermissionComponent.prototype.showData;
204
- }
205
-
206
- class UnresolvedComponent extends WidgetBaseComponent {
207
- constructor() {
208
- super(...arguments);
209
- this.showData = true;
210
- this.previewMode = false;
211
- this.searchArray = ['preview', 'channel'];
212
- }
213
- ngOnInit() {
214
- const url = window.location.href;
215
- this.previewMode = this.searchArray.some(((word) => {
216
- return url.indexOf(word) > -1;
217
- }));
218
- }
219
- }
220
- UnresolvedComponent.decorators = [
221
- { type: Component, args: [{
222
- selector: 'ws-resolver-unresolved',
223
- 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>",
224
- styles: [".mat-card-avatar-override{height:24px!important;width:24px!important}"]
225
- }] }
226
- ];
227
- UnresolvedComponent.propDecorators = {
228
- widgetData: [{ type: Input }]
229
- };
230
- if (false) {
231
- UnresolvedComponent.prototype.widgetData;
232
- UnresolvedComponent.prototype.showData;
233
- UnresolvedComponent.prototype.previewMode;
234
- UnresolvedComponent.prototype.searchArray;
235
- }
236
-
237
- class WidgetResolverService {
238
- constructor(domSanitizer, componentFactoryResolver, loggerSvc, globalConfig, scopedConfig) {
239
- this.domSanitizer = domSanitizer;
240
- this.componentFactoryResolver = componentFactoryResolver;
241
- this.loggerSvc = loggerSvc;
242
- this.globalConfig = globalConfig;
243
- this.scopedConfig = scopedConfig;
244
- this.roles = null;
245
- this.groups = null;
246
- this.restrictedFeatures = null;
247
- this.isInitialized = false;
248
- this.availableRegisteredWidgets = null;
249
- this.restrictedWidgetKeys = null;
250
- }
251
- static getWidgetKey(config) {
252
- return `widget:${config.widgetType}::${config.widgetSubType}`;
253
- }
254
- initialize(restrictedWidgetKeys, roles, groups, restrictedFeatures) {
255
- this.roles = roles;
256
- this.groups = groups;
257
- this.restrictedFeatures = restrictedFeatures;
258
- const restrictedWidgetKeysSet = restrictedWidgetKeys
259
- ? restrictedWidgetKeys
260
- : new Set();
261
- const registrationConfig = new Map();
262
- const allWidgetsConfigurations = [];
263
- if (this.globalConfig && Array.isArray(this.globalConfig)) {
264
- allWidgetsConfigurations.push(...this.globalConfig);
265
- }
266
- if (this.scopedConfig && Array.isArray(this.scopedConfig)) {
267
- allWidgetsConfigurations.push(...this.scopedConfig);
268
- }
269
- allWidgetsConfigurations.forEach((u => {
270
- const key = WidgetResolverService.getWidgetKey(u);
271
- if (!restrictedWidgetKeysSet.has(key)) {
272
- registrationConfig.set(key, u);
273
- }
274
- }));
275
- this.restrictedWidgetKeys = restrictedWidgetKeysSet;
276
- this.availableRegisteredWidgets = registrationConfig;
277
- this.isInitialized = true;
278
- this.loggerSvc.log(`Widget Configurations`, this.globalConfig, this.scopedConfig, this.availableRegisteredWidgets);
279
- }
280
- resolveWidget(receivedConfig, containerRef) {
281
- const key = WidgetResolverService.getWidgetKey(receivedConfig);
282
- if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {
283
- return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent);
284
- }
285
- if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {
286
- if (hasPermissions(receivedConfig.widgetPermission, this.roles, this.groups, this.restrictedFeatures)) {
287
- const config = this.availableRegisteredWidgets.get(key);
288
- if (config && config.component) {
289
- return this.widgetResolved(containerRef, receivedConfig, config.component);
290
- }
291
- return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent);
292
- }
293
- return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent);
294
- }
295
- return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent);
296
- }
297
- widgetResolved(containerRef, compData, component) {
298
- const factory = this.componentFactoryResolver.resolveComponentFactory(component);
299
- containerRef.clear();
300
- const compRef = containerRef.createComponent(factory);
301
- compRef.instance.widgetData = compData.widgetData;
302
- if (compRef.instance.updateBaseComponent) {
303
- const widgetSafeStyle = compData.widgetHostStyle
304
- ? this.domSanitizer.bypassSecurityTrustStyle(Object.entries(compData.widgetHostStyle).reduce(((s, [k, v]) => `${s}${k}:${v};`), ''))
305
- : undefined;
306
- compRef.instance.updateBaseComponent(compData.widgetType, compData.widgetSubType, compData.widgetInstanceId, compData.widgetHostClass, widgetSafeStyle);
307
- }
308
- return compRef;
309
- }
310
- }
311
- WidgetResolverService.decorators = [
312
- { type: Injectable, args: [{
313
- providedIn: 'root',
314
- },] }
315
- ];
316
- WidgetResolverService.ctorParameters = () => [
317
- { type: DomSanitizer },
318
- { type: ComponentFactoryResolver },
319
- { type: LoggerService },
320
- { type: undefined, decorators: [{ type: Inject, args: [WIDGET_RESOLVER_GLOBAL_CONFIG,] }] },
321
- { type: undefined, decorators: [{ type: Inject, args: [WIDGET_RESOLVER_SCOPED_CONFIG,] }] }
322
- ];
323
- /** @nocollapse */ WidgetResolverService.ngInjectableDef = ɵɵdefineInjectable({ factory: function WidgetResolverService_Factory() { return new WidgetResolverService(ɵɵinject(DomSanitizer), ɵɵinject(ComponentFactoryResolver), ɵɵinject(LoggerService), ɵɵinject(WIDGET_RESOLVER_GLOBAL_CONFIG), ɵɵinject(WIDGET_RESOLVER_SCOPED_CONFIG)); }, token: WidgetResolverService, providedIn: "root" });
324
- if (false) {
325
- WidgetResolverService.prototype.roles;
326
- WidgetResolverService.prototype.groups;
327
- WidgetResolverService.prototype.restrictedFeatures;
328
- WidgetResolverService.prototype.isInitialized;
329
- WidgetResolverService.prototype.availableRegisteredWidgets;
330
- WidgetResolverService.prototype.restrictedWidgetKeys;
331
- WidgetResolverService.prototype.domSanitizer;
332
- WidgetResolverService.prototype.componentFactoryResolver;
333
- WidgetResolverService.prototype.loggerSvc;
334
- WidgetResolverService.prototype.globalConfig;
335
- WidgetResolverService.prototype.scopedConfig;
336
- }
337
-
338
- class WidgetResolverDirective {
339
- constructor(viewContainerRef, widgetResolverSvc, logger) {
340
- this.viewContainerRef = viewContainerRef;
341
- this.widgetResolverSvc = widgetResolverSvc;
342
- this.logger = logger;
343
- this.wsResolverWidget = null;
344
- }
345
- ngOnChanges() {
346
- if (!this.widgetResolverSvc.isInitialized) {
347
- this.logger.error('Widgets Registration Not Done. Used Before Initialization.', this.wsResolverWidget);
348
- return;
349
- }
350
- if (this.wsResolverWidget) {
351
- const compRef = this.widgetResolverSvc.resolveWidget(this.wsResolverWidget, this.viewContainerRef);
352
- if (compRef) {
353
- compRef.changeDetectorRef.detectChanges();
354
- }
355
- }
356
- }
357
- }
358
- WidgetResolverDirective.decorators = [
359
- { type: Directive, args: [{
360
- selector: '[wsResolverWidget]',
361
- },] }
362
- ];
363
- WidgetResolverDirective.ctorParameters = () => [
364
- { type: ViewContainerRef },
365
- { type: WidgetResolverService },
366
- { type: LoggerService }
367
- ];
368
- WidgetResolverDirective.propDecorators = {
369
- wsResolverWidget: [{ type: Input }]
370
- };
371
- if (false) {
372
- WidgetResolverDirective.prototype.wsResolverWidget;
373
- WidgetResolverDirective.prototype.viewContainerRef;
374
- WidgetResolverDirective.prototype.widgetResolverSvc;
375
- WidgetResolverDirective.prototype.logger;
376
- }
377
-
378
- class WidgetResolverModule {
379
- static forRoot(config) {
380
- return {
381
- ngModule: WidgetResolverModule,
382
- providers: [
383
- WidgetResolverService,
384
- {
385
- provide: WIDGET_RESOLVER_GLOBAL_CONFIG,
386
- useValue: config,
387
- },
388
- {
389
- provide: WIDGET_RESOLVER_SCOPED_CONFIG,
390
- useValue: [],
391
- },
392
- ],
393
- };
394
- }
395
- static forChild(config) {
396
- return {
397
- ngModule: WidgetResolverModule,
398
- providers: [
399
- WidgetResolverService,
400
- {
401
- provide: WIDGET_RESOLVER_SCOPED_CONFIG,
402
- useValue: config,
403
- },
404
- ],
405
- };
406
- }
407
- }
408
- WidgetResolverModule.decorators = [
409
- { type: NgModule, args: [{
410
- declarations: [
411
- WidgetBaseComponent,
412
- WidgetResolverDirective,
413
- RestrictedComponent,
414
- InvalidRegistrationComponent,
415
- InvalidPermissionComponent,
416
- UnresolvedComponent,
417
- ],
418
- imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule],
419
- exports: [WidgetResolverDirective, WidgetBaseComponent],
420
- entryComponents: [
421
- RestrictedComponent,
422
- InvalidRegistrationComponent,
423
- InvalidPermissionComponent,
424
- UnresolvedComponent,
425
- WidgetBaseComponent,
426
- ],
427
- providers: [ConfigurationsService],
428
- },] }
429
- ];
430
-
431
- var NsWidgetResolver;
432
- (function (NsWidgetResolver) {
433
- function IUnitPermissionObject() { }
434
- NsWidgetResolver.IUnitPermissionObject = IUnitPermissionObject;
435
- if (false) {
436
- IUnitPermissionObject.prototype.all;
437
- IUnitPermissionObject.prototype.none;
438
- IUnitPermissionObject.prototype.some;
439
- }
440
- function IPermissions() { }
441
- NsWidgetResolver.IPermissions = IPermissions;
442
- if (false) {
443
- IPermissions.prototype.enabled;
444
- IPermissions.prototype.available;
445
- IPermissions.prototype.roles;
446
- IPermissions.prototype.features;
447
- IPermissions.prototype.groups;
448
- }
449
- function IBaseConfig() { }
450
- NsWidgetResolver.IBaseConfig = IBaseConfig;
451
- if (false) {
452
- IBaseConfig.prototype.widgetType;
453
- IBaseConfig.prototype.widgetSubType;
454
- }
455
- function IRegistrationConfig() { }
456
- NsWidgetResolver.IRegistrationConfig = IRegistrationConfig;
457
- if (false) {
458
- IRegistrationConfig.prototype.component;
459
- }
460
- function IRegistrationsPermissionConfig() { }
461
- NsWidgetResolver.IRegistrationsPermissionConfig = IRegistrationsPermissionConfig;
462
- if (false) {
463
- IRegistrationsPermissionConfig.prototype.widgetPermission;
464
- }
465
- function IRenderConfigWithTypedData() { }
466
- NsWidgetResolver.IRenderConfigWithTypedData = IRenderConfigWithTypedData;
467
- if (false) {
468
- IRenderConfigWithTypedData.prototype.widgetData;
469
- IRenderConfigWithTypedData.prototype.widgetInstanceId;
470
- IRenderConfigWithTypedData.prototype.widgetHostClass;
471
- IRenderConfigWithTypedData.prototype.widgetHostStyle;
472
- }
473
- function IWidgetData() { }
474
- NsWidgetResolver.IWidgetData = IWidgetData;
475
- if (false) {
476
- IWidgetData.prototype.widgetSafeStyle;
477
- IWidgetData.prototype.updateBaseComponent;
478
- }
479
- function ITitle() { }
480
- NsWidgetResolver.ITitle = ITitle;
481
- if (false) {
482
- ITitle.prototype.title;
483
- ITitle.prototype.url;
484
- ITitle.prototype.icon;
485
- }
486
- })(NsWidgetResolver || (NsWidgetResolver = {}));
487
-
488
- export { WidgetBaseComponent, WidgetResolverModule, WidgetResolverService, hasPermissions, hasUnitPermission, WidgetResolverDirective as ɵa, WIDGET_RESOLVER_GLOBAL_CONFIG as ɵb, WIDGET_RESOLVER_SCOPED_CONFIG as ɵc, RestrictedComponent as ɵe, InvalidRegistrationComponent as ɵf, InvalidPermissionComponent as ɵg, UnresolvedComponent as ɵh };
489
- //# sourceMappingURL=sunbird-cb-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sunbird-cb-resolver.js","sources":["ng://@sunbird-cb/resolver/lib/widget-resolver.constant.ts","ng://@sunbird-cb/resolver/lib/widget-resolver.permissions.ts","ng://@sunbird-cb/resolver/lib/widget-base.component.ts","ng://@sunbird-cb/resolver/lib/restricted/restricted.component.ts","ng://@sunbird-cb/resolver/lib/invalid-registration/invalid-registration.component.ts","ng://@sunbird-cb/resolver/lib/invalid-permission/invalid-permission.component.ts","ng://@sunbird-cb/resolver/lib/unresolved/unresolved.component.ts","ng://@sunbird-cb/resolver/lib/widget-resolver.service.ts","ng://@sunbird-cb/resolver/lib/widget-resolver.directive.ts","ng://@sunbird-cb/resolver/lib/widget-resolver.module.ts","ng://@sunbird-cb/resolver/lib/widget-resolver.model.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core'\r\nimport { NsWidgetResolver as resolver } from './widget-resolver.model'\r\n\r\nexport const WIDGET_RESOLVER_GLOBAL_CONFIG = new InjectionToken<resolver.IRegistrationConfig[]>(\r\n 'Global Registration Configuration for Widget Resolvers',\r\n)\r\n\r\nexport const WIDGET_RESOLVER_SCOPED_CONFIG = new InjectionToken<resolver.IRegistrationConfig[]>(\r\n 'Scoped Registration Configuration for Widget Resolvers',\r\n)\r\n","import { NsWidgetResolver } from './widget-resolver.model'\r\n\r\nfunction isStringArray(strArr: string[] | any): boolean {\r\n return Array.isArray(strArr) && strArr.every(u => typeof u === 'string')\r\n}\r\n\r\nfunction isCheckRequired(requiredPermission: NsWidgetResolver.UnitPermission): boolean {\r\n if (\r\n requiredPermission === undefined ||\r\n requiredPermission === null ||\r\n requiredPermission === '' ||\r\n (Array.isArray(requiredPermission) && requiredPermission.length === 0)\r\n ) {\r\n return false\r\n }\r\n return true\r\n}\r\n\r\nfunction flipBoolean(value: boolean, flip = false) {\r\n return flip ? !value : value\r\n}\r\n\r\nfunction permissionTest(\r\n testFor: 'all' | 'some' | 'none',\r\n requiredPermission: NsWidgetResolver.UnitPermissionPrimitive | string[],\r\n matchAgainst: Set<string>,\r\n isRestrictive = false,\r\n) {\r\n if (!isCheckRequired(requiredPermission)) {\r\n return true\r\n }\r\n if (typeof requiredPermission === 'string') {\r\n switch (testFor) {\r\n case 'all':\r\n case 'some':\r\n return flipBoolean(matchAgainst.has(requiredPermission), isRestrictive)\r\n case 'none':\r\n return flipBoolean(!matchAgainst.has(requiredPermission), isRestrictive)\r\n }\r\n }\r\n if (Array.isArray(requiredPermission)) {\r\n const matcher = (u: string) =>\r\n typeof u === 'string' && flipBoolean(matchAgainst.has(u), isRestrictive)\r\n switch (testFor) {\r\n case 'all':\r\n return requiredPermission.every(matcher)\r\n case 'some':\r\n return requiredPermission.some(matcher)\r\n case 'none':\r\n return !requiredPermission.every(matcher)\r\n }\r\n }\r\n return false\r\n}\r\n\r\nexport function hasUnitPermission(\r\n requiredPermission: NsWidgetResolver.UnitPermission,\r\n matchAgainst?: Set<string> | string[] | string | null | undefined,\r\n isRestrictive = false,\r\n): boolean {\r\n if (!isCheckRequired(requiredPermission)) {\r\n return true\r\n }\r\n const accessValues: Set<string> =\r\n matchAgainst instanceof Set\r\n ? matchAgainst\r\n : Array.isArray(matchAgainst) && isStringArray(matchAgainst)\r\n ? new Set(matchAgainst)\r\n : typeof matchAgainst === 'string'\r\n ? new Set([matchAgainst])\r\n : new Set()\r\n\r\n if (typeof requiredPermission === 'object' && requiredPermission !== null) {\r\n if (Array.isArray(requiredPermission)) {\r\n return permissionTest('all', requiredPermission, accessValues, isRestrictive)\r\n }\r\n return (\r\n permissionTest(\r\n 'all',\r\n 'all' in requiredPermission ? requiredPermission.all : null,\r\n accessValues,\r\n isRestrictive,\r\n ) &&\r\n permissionTest(\r\n 'some',\r\n 'some' in requiredPermission ? requiredPermission.some : null,\r\n accessValues,\r\n isRestrictive,\r\n ) &&\r\n permissionTest(\r\n 'none',\r\n 'none' in requiredPermission ? requiredPermission.none : null,\r\n accessValues,\r\n isRestrictive,\r\n )\r\n )\r\n }\r\n return false\r\n}\r\n\r\nexport function hasPermissions(\r\n requiredPermission?: NsWidgetResolver.IPermissions,\r\n availableRoles?: Set<string> | string | string[] | null | undefined,\r\n availableGroups?: Set<string> | string | string[] | null | undefined,\r\n restrictedFeatures?: Set<string> | string | string[] | null | undefined,\r\n): boolean {\r\n if (!requiredPermission) {\r\n return true\r\n }\r\n if (!requiredPermission.available || !requiredPermission.enabled) {\r\n return false\r\n }\r\n return (\r\n hasUnitPermission(requiredPermission.groups, availableGroups) &&\r\n hasUnitPermission(requiredPermission.roles, availableRoles) &&\r\n hasUnitPermission(requiredPermission.features, restrictedFeatures, true)\r\n )\r\n}\r\n","import { AfterViewInit, Component, HostBinding, Input } from '@angular/core'\r\nimport { SafeStyle } from '@angular/platform-browser'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\ntype TWidgetBase = Omit<NsWidgetResolver.IWidgetData<any>, 'widgetData'>\r\n\r\n@Component({\r\n selector: 'ws-resolver-base',\r\n template: 'Base Component',\r\n})\r\nexport class WidgetBaseComponent implements TWidgetBase, AfterViewInit {\r\n @Input() widgetType = ''\r\n @Input() widgetSubType = ''\r\n @Input() widgetHostClass?: string\r\n\r\n @Input()\r\n @HostBinding('id')\r\n public widgetInstanceId?: string\r\n\r\n @Input()\r\n @HostBinding('style')\r\n public widgetSafeStyle?: SafeStyle\r\n\r\n @Input()\r\n @HostBinding('class') className?: string\r\n\r\n updateBaseComponent(\r\n widgetType: string,\r\n widgetSubType: string,\r\n widgetInstanceId?: string,\r\n widgetHostClass?: string,\r\n widgetSafeStyle?: SafeStyle,\r\n ) {\r\n this.widgetType = widgetType\r\n this.widgetSubType = widgetSubType\r\n this.widgetInstanceId = widgetInstanceId\r\n this.widgetHostClass = widgetHostClass\r\n this.widgetSafeStyle = widgetSafeStyle\r\n if (this.widgetHostClass) {\r\n this.className = `${this.className} ${this.widgetHostClass}`\r\n }\r\n }\r\n\r\n ngAfterViewInit() {\r\n const hash: any = window.location.hash ? window.location.hash.split('#')[1] : ''\r\n if (hash && !isNaN(hash) && hash === this.widgetInstanceId) {\r\n setTimeout(\r\n () => {\r\n const element = document.getElementById(this.widgetInstanceId || '')\r\n if (element) {\r\n element.scrollIntoView()\r\n }\r\n },\r\n 200,\r\n )\r\n }\r\n }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\r\n selector: 'ws-resolver-restricted',\r\n templateUrl: './restricted.component.html',\r\n styleUrls: ['./restricted.component.scss'],\r\n})\r\nexport class RestrictedComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n\r\n ngOnInit() { }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\r\n selector: 'ws-resolver-invalid-registration',\r\n templateUrl: './invalid-registration.component.html',\r\n styleUrls: ['./invalid-registration.component.scss'],\r\n})\r\nexport class InvalidRegistrationComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n ngOnInit() { }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\n\r\n@Component({\r\n selector: 'ws-resolver-invalid-permission',\r\n templateUrl: './invalid-permission.component.html',\r\n styleUrls: ['./invalid-permission.component.scss'],\r\n})\r\nexport class InvalidPermissionComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetType!: string\r\n @Input() widgetSubType!: string\r\n @Input() widgetInstanceId?: string\r\n @Input() widgetData!: any\r\n showData = true\r\n\r\n ngOnInit() { }\r\n}\r\n","import { Component, OnInit, Input } from '@angular/core'\r\nimport { NsWidgetResolver } from '../widget-resolver.model'\r\nimport { WidgetBaseComponent } from '../widget-base.component'\r\n@Component({\r\n selector: 'ws-resolver-unresolved',\r\n templateUrl: './unresolved.component.html',\r\n styleUrls: ['./unresolved.component.scss'],\r\n})\r\nexport class UnresolvedComponent extends WidgetBaseComponent\r\n implements OnInit, NsWidgetResolver.IWidgetData<any> {\r\n @Input() widgetData!: any\r\n showData = true\r\n previewMode = false\r\n searchArray = ['preview', 'channel']\r\n\r\n ngOnInit() {\r\n const url = window.location.href\r\n this.previewMode = this.searchArray.some((word: string) => {\r\n return url.indexOf(word) > -1\r\n })\r\n }\r\n}\r\n","import {\r\n Injectable,\r\n Inject,\r\n ComponentFactoryResolver,\r\n ViewContainerRef,\r\n ComponentRef,\r\n Type,\r\n} from '@angular/core'\r\nimport {\r\n WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n WIDGET_RESOLVER_SCOPED_CONFIG,\r\n} from './widget-resolver.constant'\r\nimport { LoggerService } from '@sunbird-cb/utils'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { hasPermissions } from './widget-resolver.permissions'\r\nimport { RestrictedComponent } from './restricted/restricted.component'\r\nimport { InvalidRegistrationComponent } from './invalid-registration/invalid-registration.component'\r\nimport { InvalidPermissionComponent } from './invalid-permission/invalid-permission.component'\r\nimport { UnresolvedComponent } from './unresolved/unresolved.component'\r\nimport { DomSanitizer } from '@angular/platform-browser'\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class WidgetResolverService {\r\n private roles: Set<string> | null = null\r\n private groups: Set<string> | null = null\r\n private restrictedFeatures: Set<string> | null = null\r\n isInitialized = false\r\n constructor(\r\n private domSanitizer: DomSanitizer,\r\n private componentFactoryResolver: ComponentFactoryResolver,\r\n private loggerSvc: LoggerService,\r\n @Inject(WIDGET_RESOLVER_GLOBAL_CONFIG)\r\n private globalConfig: null | NsWidgetResolver.IRegistrationConfig[],\r\n @Inject(WIDGET_RESOLVER_SCOPED_CONFIG)\r\n private scopedConfig: null | NsWidgetResolver.IRegistrationConfig[],\r\n ) { }\r\n private availableRegisteredWidgets: Map<\r\n string,\r\n NsWidgetResolver.IRegistrationConfig\r\n > | null = null\r\n private restrictedWidgetKeys: Set<string> | null = null\r\n static getWidgetKey(config: NsWidgetResolver.IBaseConfig) {\r\n return `widget:${config.widgetType}::${config.widgetSubType}`\r\n }\r\n\r\n initialize(\r\n restrictedWidgetKeys: Set<string> | null,\r\n roles: Set<string> | null,\r\n groups: Set<string> | null,\r\n restrictedFeatures: Set<string> | null,\r\n ) {\r\n this.roles = roles\r\n\r\n this.groups = groups\r\n this.restrictedFeatures = restrictedFeatures\r\n const restrictedWidgetKeysSet: Set<string> = restrictedWidgetKeys\r\n ? restrictedWidgetKeys\r\n : new Set<string>()\r\n const registrationConfig: Map<string, NsWidgetResolver.IRegistrationConfig> = new Map()\r\n const allWidgetsConfigurations: NsWidgetResolver.IRegistrationConfig[] = []\r\n if (this.globalConfig && Array.isArray(this.globalConfig)) {\r\n allWidgetsConfigurations.push(...this.globalConfig)\r\n }\r\n if (this.scopedConfig && Array.isArray(this.scopedConfig)) {\r\n allWidgetsConfigurations.push(...this.scopedConfig)\r\n }\r\n allWidgetsConfigurations.forEach(u => {\r\n const key = WidgetResolverService.getWidgetKey(u)\r\n if (!restrictedWidgetKeysSet.has(key)) {\r\n registrationConfig.set(key, u)\r\n }\r\n })\r\n this.restrictedWidgetKeys = restrictedWidgetKeysSet\r\n this.availableRegisteredWidgets = registrationConfig\r\n this.isInitialized = true\r\n this.loggerSvc.log(\r\n `Widget Configurations`,\r\n this.globalConfig,\r\n this.scopedConfig,\r\n this.availableRegisteredWidgets,\r\n )\r\n }\r\n\r\n resolveWidget(\r\n receivedConfig: NsWidgetResolver.IRenderConfigWithAnyData,\r\n containerRef: ViewContainerRef,\r\n ): ComponentRef<any> | null {\r\n const key = WidgetResolverService.getWidgetKey(receivedConfig)\r\n if (this.restrictedWidgetKeys && this.restrictedWidgetKeys.has(key)) {\r\n // Restricted\r\n return this.widgetResolved(containerRef, receivedConfig, RestrictedComponent)\r\n }\r\n if (this.availableRegisteredWidgets && this.availableRegisteredWidgets.has(key)) {\r\n if (\r\n hasPermissions(\r\n receivedConfig.widgetPermission,\r\n this.roles,\r\n this.groups,\r\n this.restrictedFeatures,\r\n )\r\n ) {\r\n const config = this.availableRegisteredWidgets.get(key)\r\n if (config && config.component) {\r\n return this.widgetResolved(containerRef, receivedConfig, config.component)\r\n }\r\n // Not properly registered\r\n return this.widgetResolved(containerRef, receivedConfig, InvalidRegistrationComponent)\r\n }\r\n // No Permission\r\n return this.widgetResolved(containerRef, receivedConfig, InvalidPermissionComponent)\r\n }\r\n // Not Resolved\r\n return this.widgetResolved(containerRef, receivedConfig, UnresolvedComponent)\r\n }\r\n\r\n private widgetResolved(\r\n containerRef: ViewContainerRef,\r\n compData: NsWidgetResolver.IRenderConfigWithAnyData,\r\n component: Type<NsWidgetResolver.IWidgetData<any>>,\r\n ): ComponentRef<NsWidgetResolver.IWidgetData<any>> {\r\n const factory = this.componentFactoryResolver.resolveComponentFactory(component)\r\n containerRef.clear()\r\n const compRef: ComponentRef<NsWidgetResolver.IWidgetData<any>> = containerRef.createComponent(\r\n factory,\r\n )\r\n compRef.instance.widgetData = compData.widgetData\r\n if (compRef.instance.updateBaseComponent) {\r\n const widgetSafeStyle = compData.widgetHostStyle\r\n ? this.domSanitizer.bypassSecurityTrustStyle(\r\n Object.entries(compData.widgetHostStyle).reduce((s, [k, v]) => `${s}${k}:${v};`, ''),\r\n )\r\n : undefined\r\n compRef.instance.updateBaseComponent(\r\n compData.widgetType,\r\n compData.widgetSubType,\r\n compData.widgetInstanceId,\r\n compData.widgetHostClass,\r\n widgetSafeStyle,\r\n )\r\n }\r\n return compRef\r\n }\r\n}\r\n","import { Directive, Input, ViewContainerRef, OnChanges } from '@angular/core'\r\nimport { LoggerService } from '@sunbird-cb/utils'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { WidgetResolverService } from './widget-resolver.service'\r\n\r\n@Directive({\r\n selector: '[wsResolverWidget]',\r\n})\r\nexport class WidgetResolverDirective implements OnChanges {\r\n @Input() wsResolverWidget: NsWidgetResolver.IRenderConfigWithAnyData | null = null\r\n constructor(\r\n private viewContainerRef: ViewContainerRef,\r\n private widgetResolverSvc: WidgetResolverService,\r\n private logger: LoggerService,\r\n ) { }\r\n\r\n ngOnChanges() {\r\n if (!this.widgetResolverSvc.isInitialized) {\r\n this.logger.error(\r\n 'Widgets Registration Not Done. Used Before Initialization.',\r\n this.wsResolverWidget,\r\n )\r\n return\r\n }\r\n if (this.wsResolverWidget) {\r\n const compRef = this.widgetResolverSvc.resolveWidget(\r\n this.wsResolverWidget,\r\n this.viewContainerRef,\r\n )\r\n if (compRef) {\r\n compRef.changeDetectorRef.detectChanges()\r\n }\r\n }\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders } from '@angular/core'\r\nimport { CommonModule } from '@angular/common'\r\nimport { WidgetResolverDirective } from './widget-resolver.directive'\r\nimport { RestrictedComponent } from './restricted/restricted.component'\r\nimport { InvalidRegistrationComponent } from './invalid-registration/invalid-registration.component'\r\nimport { InvalidPermissionComponent } from './invalid-permission/invalid-permission.component'\r\nimport { UnresolvedComponent } from './unresolved/unresolved.component'\r\nimport { MatButtonModule, MatIconModule, MatCardModule } from '@angular/material'\r\nimport { NsWidgetResolver } from './widget-resolver.model'\r\nimport { WidgetResolverService } from './widget-resolver.service'\r\nimport { ConfigurationsService } from '@sunbird-cb/utils'\r\nimport {\r\n WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n WIDGET_RESOLVER_SCOPED_CONFIG,\r\n} from './widget-resolver.constant'\r\nimport { WidgetBaseComponent } from './widget-base.component'\r\n@NgModule({\r\n declarations: [\r\n WidgetBaseComponent,\r\n WidgetResolverDirective,\r\n RestrictedComponent,\r\n InvalidRegistrationComponent,\r\n InvalidPermissionComponent,\r\n UnresolvedComponent,\r\n ],\r\n imports: [CommonModule, MatButtonModule, MatIconModule, MatCardModule],\r\n exports: [WidgetResolverDirective, WidgetBaseComponent],\r\n entryComponents: [\r\n RestrictedComponent,\r\n InvalidRegistrationComponent,\r\n InvalidPermissionComponent,\r\n UnresolvedComponent,\r\n WidgetBaseComponent,\r\n ],\r\n providers: [ConfigurationsService],\r\n})\r\nexport class WidgetResolverModule {\r\n static forRoot(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders {\r\n return {\r\n ngModule: WidgetResolverModule,\r\n providers: [\r\n WidgetResolverService,\r\n {\r\n provide: WIDGET_RESOLVER_GLOBAL_CONFIG,\r\n useValue: config,\r\n },\r\n {\r\n provide: WIDGET_RESOLVER_SCOPED_CONFIG,\r\n useValue: [],\r\n },\r\n ],\r\n }\r\n }\r\n static forChild(config: NsWidgetResolver.IRegistrationConfig[]): ModuleWithProviders {\r\n return {\r\n ngModule: WidgetResolverModule,\r\n providers: [\r\n WidgetResolverService,\r\n {\r\n provide: WIDGET_RESOLVER_SCOPED_CONFIG,\r\n useValue: config,\r\n },\r\n ],\r\n }\r\n }\r\n}\r\n","import { Type } from '@angular/core'\r\nimport { SafeStyle } from '@angular/platform-browser'\r\ntype TUrl = undefined | 'none' | 'back' | string\r\nexport namespace NsWidgetResolver {\r\n export type UnitPermissionPrimitive = undefined | null | string\r\n export interface IUnitPermissionObject {\r\n all: UnitPermissionPrimitive | string[]\r\n none: UnitPermissionPrimitive | string[]\r\n some: UnitPermissionPrimitive | string[]\r\n }\r\n export type UnitPermission =\r\n | UnitPermissionPrimitive\r\n | string[]\r\n | IUnitPermissionObject\r\n | Pick<IUnitPermissionObject, 'all'>\r\n | Pick<IUnitPermissionObject, 'none'>\r\n | Pick<IUnitPermissionObject, 'some'>\r\n | Exclude<IUnitPermissionObject, 'all'>\r\n | Exclude<IUnitPermissionObject, 'none'>\r\n | Exclude<IUnitPermissionObject, 'some'>\r\n export interface IPermissions {\r\n enabled: boolean\r\n available: boolean\r\n roles?: UnitPermission\r\n features?: UnitPermission\r\n groups?: UnitPermission\r\n }\r\n\r\n export interface IBaseConfig {\r\n widgetType: string\r\n widgetSubType: string\r\n }\r\n\r\n export interface IRegistrationConfig extends IBaseConfig {\r\n component: Type<IWidgetData<any>>\r\n }\r\n\r\n export interface IRegistrationsPermissionConfig extends IBaseConfig {\r\n widgetPermission?: IPermissions\r\n }\r\n\r\n export interface IRenderConfigWithTypedData<T> extends IRegistrationsPermissionConfig {\r\n widgetData: T\r\n widgetInstanceId?: string\r\n widgetHostClass?: string\r\n widgetHostStyle?: { [key: string]: string }\r\n }\r\n export type IRenderConfigWithAnyData = IRenderConfigWithTypedData<any>\r\n export interface IWidgetData<T>\r\n extends Omit<IRenderConfigWithTypedData<T>, 'widgetPermission' | 'widgetHostStyle'> {\r\n widgetSafeStyle?: SafeStyle\r\n updateBaseComponent: (\r\n widgetType: string,\r\n widgetSubType: string,\r\n widgetInstanceId?: string,\r\n widgetHostClass?: string,\r\n widgetSafeStyle?: SafeStyle,\r\n ) => void\r\n }\r\n export interface ITitle {\r\n title: string,\r\n url: TUrl,\r\n icon?: string\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;MAGa,6BAA6B,GAAG,IAAI,cAAc,CAC7D,wDAAwD,CACzD;AAED,MAAa,6BAA6B,GAAG,IAAI,cAAc,CAC7D,wDAAwD,CACzD;;ACPD,SAAS,aAAa,CAAC,MAAsB;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,EAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAC,CAAA;CACzE;AAED,SAAS,eAAe,CAAC,kBAAmD;IAC1E,IACE,kBAAkB,KAAK,SAAS;QAChC,kBAAkB,KAAK,IAAI;QAC3B,kBAAkB,KAAK,EAAE;SACxB,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,CAAC,EACtE;QACA,OAAO,KAAK,CAAA;KACb;IACD,OAAO,IAAI,CAAA;CACZ;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,IAAI,GAAG,KAAK;IAC/C,OAAO,IAAI,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;CAC7B;AAED,SAAS,cAAc,CACrB,OAAgC,EAChC,kBAAuE,EACvE,YAAyB,EACzB,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,EAAE;QACxC,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE;QAC1C,QAAQ,OAAO;YACb,KAAK,KAAK,CAAC;YACX,KAAK,MAAM;gBACT,OAAO,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAA;YACzE,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