@wrcb/cb-common 1.0.519 → 1.0.521
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.
|
@@ -8,6 +8,11 @@ export interface CategoryConfiguration {
|
|
|
8
8
|
allowedTags: UserTags[];
|
|
9
9
|
allowedProducts: ProductTypes[];
|
|
10
10
|
}
|
|
11
|
+
export interface RatingCriteria {
|
|
12
|
+
criteriaOptions: string[];
|
|
13
|
+
minCriteriaCount: number;
|
|
14
|
+
maxCriteriaCount: number;
|
|
15
|
+
}
|
|
11
16
|
export interface TenantData {
|
|
12
17
|
TENANT: Tenant;
|
|
13
18
|
SITE_NAME: string;
|
|
@@ -30,6 +35,7 @@ export interface TenantData {
|
|
|
30
35
|
GOOGLE_ANALYTICS_MEASUREMENT_ID: string;
|
|
31
36
|
GOOGLE_VERIFICATION: string;
|
|
32
37
|
MEDIA_CONFIG: MediaConfiguration;
|
|
38
|
+
RATING_CRITERIA?: RatingCriteria;
|
|
33
39
|
}
|
|
34
40
|
export declare class TenantDataService {
|
|
35
41
|
private static tenantDataMap;
|
|
@@ -42,4 +48,11 @@ export declare class TenantDataService {
|
|
|
42
48
|
static getProductsForCategory(tenant: Tenant, category: UserCategory): ProductTypes[];
|
|
43
49
|
static getAllProductsForTenant(tenant: Tenant): ProductTypes[];
|
|
44
50
|
static getAllTagsForTenant(tenant: Tenant): UserTags[];
|
|
51
|
+
static getRatingCriteria(tenant: Tenant): RatingCriteria | null;
|
|
52
|
+
static getAvailableCriteriaOptions(tenant: Tenant): string[];
|
|
53
|
+
static isRatingEnabledForTenant(tenant: Tenant): boolean;
|
|
54
|
+
static validateRatingCriteria(tenant: Tenant, criteria: Record<string, number>): {
|
|
55
|
+
isValid: boolean;
|
|
56
|
+
errors: string[];
|
|
57
|
+
};
|
|
45
58
|
}
|
|
@@ -58,6 +58,45 @@ class TenantDataService {
|
|
|
58
58
|
});
|
|
59
59
|
return Array.from(allTags);
|
|
60
60
|
}
|
|
61
|
+
static getRatingCriteria(tenant) {
|
|
62
|
+
const data = this.getTenantData(tenant);
|
|
63
|
+
return data.RATING_CRITERIA || null;
|
|
64
|
+
}
|
|
65
|
+
static getAvailableCriteriaOptions(tenant) {
|
|
66
|
+
const criteria = this.getRatingCriteria(tenant);
|
|
67
|
+
return criteria ? criteria.criteriaOptions : [];
|
|
68
|
+
}
|
|
69
|
+
static isRatingEnabledForTenant(tenant) {
|
|
70
|
+
return this.getRatingCriteria(tenant) !== null;
|
|
71
|
+
}
|
|
72
|
+
static validateRatingCriteria(tenant, criteria) {
|
|
73
|
+
const config = this.getRatingCriteria(tenant);
|
|
74
|
+
// Se não há configuração de rating para este tenant
|
|
75
|
+
if (!config) {
|
|
76
|
+
return {
|
|
77
|
+
isValid: false,
|
|
78
|
+
errors: ['Sistema de avaliações não disponível para este tenant']
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const errors = [];
|
|
82
|
+
const criteriaKeys = Object.keys(criteria);
|
|
83
|
+
// Validar quantidade
|
|
84
|
+
if (criteriaKeys.length < config.minCriteriaCount) {
|
|
85
|
+
errors.push(`Mínimo ${config.minCriteriaCount} critérios necessários`);
|
|
86
|
+
}
|
|
87
|
+
if (criteriaKeys.length > config.maxCriteriaCount) {
|
|
88
|
+
errors.push(`Máximo ${config.maxCriteriaCount} critérios permitidos`);
|
|
89
|
+
}
|
|
90
|
+
// Validar critérios permitidos
|
|
91
|
+
const invalidCriteria = criteriaKeys.filter(key => !config.criteriaOptions.includes(key));
|
|
92
|
+
if (invalidCriteria.length > 0) {
|
|
93
|
+
errors.push(`Critérios inválidos: ${invalidCriteria.join(', ')}`);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
isValid: errors.length === 0,
|
|
97
|
+
errors
|
|
98
|
+
};
|
|
99
|
+
}
|
|
61
100
|
}
|
|
62
101
|
exports.TenantDataService = TenantDataService;
|
|
63
102
|
TenantDataService.tenantDataMap = {
|
|
@@ -169,6 +208,16 @@ TenantDataService.tenantDataMap = {
|
|
|
169
208
|
medium: { width: 800, height: 800, quality: 85 },
|
|
170
209
|
large: { width: 1920, height: 1920, quality: 90 }
|
|
171
210
|
}
|
|
211
|
+
},
|
|
212
|
+
RATING_CRITERIA: {
|
|
213
|
+
criteriaOptions: [
|
|
214
|
+
'Qualidade do Serviço',
|
|
215
|
+
'Comunicação',
|
|
216
|
+
'Custo-Benefício',
|
|
217
|
+
'Limpeza'
|
|
218
|
+
],
|
|
219
|
+
minCriteriaCount: 1,
|
|
220
|
+
maxCriteriaCount: 5
|
|
172
221
|
}
|
|
173
222
|
},
|
|
174
223
|
[tenant_1.Tenant.PrivateShow]: {
|
|
@@ -222,6 +271,16 @@ TenantDataService.tenantDataMap = {
|
|
|
222
271
|
medium: { width: 800, height: 800, quality: 85 },
|
|
223
272
|
large: { width: 1920, height: 1920, quality: 90 }
|
|
224
273
|
}
|
|
274
|
+
},
|
|
275
|
+
RATING_CRITERIA: {
|
|
276
|
+
criteriaOptions: [
|
|
277
|
+
'Performance',
|
|
278
|
+
'Interação',
|
|
279
|
+
'Qualidade do Áudio/Vídeo',
|
|
280
|
+
'Simpatia'
|
|
281
|
+
],
|
|
282
|
+
minCriteriaCount: 1,
|
|
283
|
+
maxCriteriaCount: 5
|
|
225
284
|
}
|
|
226
285
|
}
|
|
227
286
|
};
|