valtech-components 4.0.209 → 4.0.210
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.
- package/esm2022/lib/components/molecules/load-more/load-more.component.mjs +11 -7
- package/esm2022/lib/components/molecules/reaction-bar/reaction-bar.component.mjs +326 -0
- package/esm2022/lib/components/molecules/reaction-bar/types.mjs +2 -0
- package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +12 -9
- package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.component.mjs +79 -5
- package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.i18n.mjs +5 -1
- package/esm2022/lib/components/organisms/toolbar/toolbar.component.mjs +3 -3
- package/esm2022/lib/components/templates/page-wrapper/page-wrapper.component.mjs +108 -135
- package/esm2022/lib/services/auth/org-switch.service.mjs +11 -1
- package/esm2022/lib/services/reactions/config.mjs +22 -0
- package/esm2022/lib/services/reactions/index.mjs +3 -0
- package/esm2022/lib/services/reactions/reactions.service.mjs +89 -0
- package/esm2022/lib/services/reactions/types.mjs +2 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/valtech-components.mjs +648 -156
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/molecules/reaction-bar/reaction-bar.component.d.ts +44 -0
- package/lib/components/molecules/reaction-bar/types.d.ts +55 -0
- package/lib/components/organisms/organization-view/organization-view.component.d.ts +1 -0
- package/lib/components/organisms/switch-org-modal/switch-org-modal.component.d.ts +5 -1
- package/lib/services/auth/org-switch.service.d.ts +9 -0
- package/lib/services/reactions/config.d.ts +20 -0
- package/lib/services/reactions/index.d.ts +3 -0
- package/lib/services/reactions/reactions.service.d.ts +42 -0
- package/lib/services/reactions/types.d.ts +48 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { ReactionBarMetadata, ReactionBarEvent, EnrichedReaction } from './types';
|
|
3
|
+
import { ReactionSet } from '../../../services/reactions/types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Barra de reacciones emoji configurables por contexto.
|
|
7
|
+
*
|
|
8
|
+
* Muestra un set de emojis y permite al usuario reaccionar a una entidad.
|
|
9
|
+
* Soporta conteos, multiples reacciones y modo picker (popup).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* html
|
|
13
|
+
* <val-reaction-bar
|
|
14
|
+
* [props]="{
|
|
15
|
+
* entityRef: { entityType: 'post', entityId: 'p1' },
|
|
16
|
+
* reactionSet: mySet,
|
|
17
|
+
* showCounts: true
|
|
18
|
+
* }"
|
|
19
|
+
* (reactionChange)="onReaction($event)"
|
|
20
|
+
* />
|
|
21
|
+
*/
|
|
22
|
+
export declare class ReactionBarComponent implements OnInit {
|
|
23
|
+
props: ReactionBarMetadata;
|
|
24
|
+
reactionChange: EventEmitter<ReactionBarEvent>;
|
|
25
|
+
private reactionsService;
|
|
26
|
+
private i18n;
|
|
27
|
+
protected reactionSet: import("@angular/core").WritableSignal<ReactionSet>;
|
|
28
|
+
protected myReactions: import("@angular/core").WritableSignal<string[]>;
|
|
29
|
+
protected counts: import("@angular/core").WritableSignal<Record<string, number>>;
|
|
30
|
+
protected isLoading: import("@angular/core").WritableSignal<boolean>;
|
|
31
|
+
protected pickerOpen: import("@angular/core").WritableSignal<boolean>;
|
|
32
|
+
protected enrichedReactions: import("@angular/core").Signal<EnrichedReaction[]>;
|
|
33
|
+
constructor();
|
|
34
|
+
ngOnInit(): void;
|
|
35
|
+
private loadSetAndCounts;
|
|
36
|
+
private loadCounts;
|
|
37
|
+
protected onReact(token: string): void;
|
|
38
|
+
protected onReactAndClosePicker(token: string): void;
|
|
39
|
+
protected togglePicker(): void;
|
|
40
|
+
private handleReact;
|
|
41
|
+
protected t(key: string): string;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReactionBarComponent, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ReactionBarComponent, "val-reaction-bar", never, { "props": { "alias": "props"; "required": false; }; }, { "reactionChange": "reactionChange"; }, never, never, true, never>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ReactionSet } from '../../../services/reactions/types';
|
|
2
|
+
export interface ReactionBarMetadata {
|
|
3
|
+
/** Referencia a la entidad a reaccionar */
|
|
4
|
+
entityRef: {
|
|
5
|
+
entityType: string;
|
|
6
|
+
entityId: string;
|
|
7
|
+
};
|
|
8
|
+
/** ID del set de reacciones a mostrar. Si no se provee, se carga desde el binding. */
|
|
9
|
+
reactionSetId?: string;
|
|
10
|
+
/** Set completo (si ya se tiene, evita fetch) */
|
|
11
|
+
reactionSet?: ReactionSet;
|
|
12
|
+
/** Max reacciones permitidas por usuario: 1=swap, 0=multiples */
|
|
13
|
+
maxReactions?: number;
|
|
14
|
+
/** Tamano visual */
|
|
15
|
+
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
/** Mostrar conteos numericos junto al emoji */
|
|
17
|
+
showCounts?: boolean;
|
|
18
|
+
/** Layout: row=barra horizontal, picker=popup selector */
|
|
19
|
+
layout?: 'row' | 'picker';
|
|
20
|
+
/** Modo readonly */
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
/** appId para la API */
|
|
23
|
+
appId?: string;
|
|
24
|
+
/** Reacciones del usuario ya conocidas (evita fetch inicial) */
|
|
25
|
+
initialMyReactions?: string[];
|
|
26
|
+
/** Conteos ya conocidos (evita fetch inicial) */
|
|
27
|
+
initialCounts?: Record<string, number>;
|
|
28
|
+
/** Omitir carga inicial desde API */
|
|
29
|
+
skipInitialLoad?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ReactionBarState {
|
|
32
|
+
reactionSet: ReactionSet | null;
|
|
33
|
+
myReactions: string[];
|
|
34
|
+
counts: Record<string, number>;
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface ReactionBarEvent {
|
|
39
|
+
token: string;
|
|
40
|
+
active: boolean;
|
|
41
|
+
entityRef: {
|
|
42
|
+
entityType: string;
|
|
43
|
+
entityId: string;
|
|
44
|
+
};
|
|
45
|
+
counts: Record<string, number>;
|
|
46
|
+
}
|
|
47
|
+
export interface EnrichedReaction {
|
|
48
|
+
token: string;
|
|
49
|
+
emoji: string;
|
|
50
|
+
label: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
order: number;
|
|
53
|
+
count: number;
|
|
54
|
+
active: boolean;
|
|
55
|
+
}
|
|
@@ -32,6 +32,8 @@ export declare class SwitchOrgModalComponent {
|
|
|
32
32
|
onProfileClick?: () => void;
|
|
33
33
|
/** Callback al hacer clic en "Nueva organización". Si está presente, muestra el CTA. */
|
|
34
34
|
onCreateOrg?: () => void;
|
|
35
|
+
/** Callback al hacer clic en "Administrar" de la org activa. Si está presente, muestra el botón. */
|
|
36
|
+
onManageOrg?: () => void;
|
|
35
37
|
/** Namespace i18n con que la vista resuelve sus textos. */
|
|
36
38
|
i18nNamespace: string;
|
|
37
39
|
readonly orgs: import("@angular/core").WritableSignal<Organization[]>;
|
|
@@ -48,6 +50,7 @@ export declare class SwitchOrgModalComponent {
|
|
|
48
50
|
protected onLogoError(orgId: string): void;
|
|
49
51
|
protected readonly userInitials: import("@angular/core").Signal<string>;
|
|
50
52
|
readonly activeOrgId: import("@angular/core").Signal<string>;
|
|
53
|
+
readonly activeOrg: import("@angular/core").Signal<Organization>;
|
|
51
54
|
readonly filteredOrgs: import("@angular/core").Signal<Organization[]>;
|
|
52
55
|
constructor();
|
|
53
56
|
onQueryChange(value: string): void;
|
|
@@ -55,9 +58,10 @@ export declare class SwitchOrgModalComponent {
|
|
|
55
58
|
private loadOrgs;
|
|
56
59
|
loadMore(): void;
|
|
57
60
|
onProfile(): void;
|
|
61
|
+
onManage(): void;
|
|
58
62
|
onCreateNew(): void;
|
|
59
63
|
dismiss(): void;
|
|
60
64
|
t(key: string): string;
|
|
61
65
|
static ɵfac: i0.ɵɵFactoryDeclaration<SwitchOrgModalComponent, never>;
|
|
62
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SwitchOrgModalComponent, "val-switch-org-modal", never, { "_modalRef": { "alias": "_modalRef"; "required": false; }; "onSuccess": { "alias": "onSuccess"; "required": false; }; "onProfileClick": { "alias": "onProfileClick"; "required": false; }; "onCreateOrg": { "alias": "onCreateOrg"; "required": false; }; "i18nNamespace": { "alias": "i18nNamespace"; "required": false; }; }, {}, never, never, true, never>;
|
|
66
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SwitchOrgModalComponent, "val-switch-org-modal", never, { "_modalRef": { "alias": "_modalRef"; "required": false; }; "onSuccess": { "alias": "onSuccess"; "required": false; }; "onProfileClick": { "alias": "onProfileClick"; "required": false; }; "onCreateOrg": { "alias": "onCreateOrg"; "required": false; }; "onManageOrg": { "alias": "onManageOrg"; "required": false; }; "i18nNamespace": { "alias": "i18nNamespace"; "required": false; }; }, {}, never, never, true, never>;
|
|
63
67
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AuthService } from './auth.service';
|
|
3
|
+
import { Organization } from '../org/types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
/**
|
|
5
6
|
* Event emitted when the active organization changes.
|
|
@@ -89,6 +90,7 @@ export declare class OrgSwitchService {
|
|
|
89
90
|
private auth;
|
|
90
91
|
private readonly _switching;
|
|
91
92
|
private readonly _orgChanged;
|
|
93
|
+
private readonly _orgDataUpdated;
|
|
92
94
|
/**
|
|
93
95
|
* `true` while a switch is in flight. UI should disable interactions
|
|
94
96
|
* with org-scoped data and show a loading indicator.
|
|
@@ -102,6 +104,13 @@ export declare class OrgSwitchService {
|
|
|
102
104
|
* see the updated Firebase user / activeOrg claim.
|
|
103
105
|
*/
|
|
104
106
|
readonly orgChanged$: Observable<OrgChangedEvent>;
|
|
107
|
+
/**
|
|
108
|
+
* Fires when org data (name, logoUrl, etc.) changes without a full org switch.
|
|
109
|
+
* Subscribe in the app shell to keep the header org avatar up to date.
|
|
110
|
+
*/
|
|
111
|
+
readonly orgDataUpdated$: Observable<Organization>;
|
|
112
|
+
/** Notify subscribers that the active org's data was updated. */
|
|
113
|
+
notifyOrgDataUpdated(org: Organization): void;
|
|
105
114
|
constructor(auth: AuthService);
|
|
106
115
|
/**
|
|
107
116
|
* Switch the user's active organization.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EnvironmentProviders, InjectionToken } from '@angular/core';
|
|
2
|
+
import { ValtechReactionsConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Token de inyeccion para la configuracion del servicio de Reactions.
|
|
5
|
+
*/
|
|
6
|
+
export declare const VALTECH_REACTIONS_CONFIG: InjectionToken<ValtechReactionsConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* Provee el servicio de reactions a la aplicacion Angular.
|
|
9
|
+
*
|
|
10
|
+
* @param config - Configuracion de reactions
|
|
11
|
+
* @returns EnvironmentProviders para usar en bootstrapApplication
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* bootstrapApplication(AppComponent, {
|
|
15
|
+
* providers: [
|
|
16
|
+
* provideValtechReactions({ apiUrl: environment.apiUrl, appId: 'my-app' }),
|
|
17
|
+
* ],
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export declare function provideValtechReactions(config: ValtechReactionsConfig): EnvironmentProviders;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { VALTECH_REACTIONS_CONFIG, provideValtechReactions } from './config';
|
|
2
|
+
export { ReactionsService } from './reactions.service';
|
|
3
|
+
export type { ValtechReactionsConfig, ReactionSetContext, ReactionDefinition, ReactionSet, ReactionCounts, ReactRequest, ReactResponse, GetCountsResponse, GetMyReactionsResponse, } from './types';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ReactRequest, ReactResponse, GetCountsResponse, ReactionSet } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Servicio para gestionar reacciones emoji configurables por contexto.
|
|
6
|
+
*
|
|
7
|
+
* Requiere provideValtechReactions() en el bootstrap de la app.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const svc = inject(ReactionsService);
|
|
11
|
+
* svc.react({ entityRef: { entityType: 'post', entityId: '1' }, token: 'heart', appId: 'app' })
|
|
12
|
+
* .subscribe(res => console.log(res.counts));
|
|
13
|
+
*/
|
|
14
|
+
export declare class ReactionsService {
|
|
15
|
+
private http;
|
|
16
|
+
private config;
|
|
17
|
+
constructor();
|
|
18
|
+
private get apiUrl();
|
|
19
|
+
private get baseUrl();
|
|
20
|
+
/**
|
|
21
|
+
* Toggle reaccion — retorna estado nuevo + conteos actualizados.
|
|
22
|
+
*/
|
|
23
|
+
react(req: ReactRequest): Observable<ReactResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Conteos + reacciones del usuario para una entidad.
|
|
26
|
+
*/
|
|
27
|
+
getCounts(appId: string, entityType: string, entityId: string): Observable<GetCountsResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Solo mis tokens activos para una entidad.
|
|
30
|
+
*/
|
|
31
|
+
getMyReactions(appId: string, entityType: string, entityId: string): Observable<string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Obtener un set de reacciones por ID.
|
|
34
|
+
*/
|
|
35
|
+
getSet(setId: string): Observable<ReactionSet>;
|
|
36
|
+
/**
|
|
37
|
+
* Listar todos los sets disponibles para una app.
|
|
38
|
+
*/
|
|
39
|
+
listSets(appId: string): Observable<ReactionSet[]>;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ReactionsService, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ReactionsService>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type ReactionSetContext = 'formal' | 'social' | 'celebration' | 'opinion' | 'custom';
|
|
2
|
+
export interface ReactionDefinition {
|
|
3
|
+
token: string;
|
|
4
|
+
emoji: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
order: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ReactionSet {
|
|
10
|
+
setId: string;
|
|
11
|
+
appId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
context: ReactionSetContext;
|
|
14
|
+
reactions: ReactionDefinition[];
|
|
15
|
+
isPreset: boolean;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ReactionCounts {
|
|
20
|
+
counts: Record<string, number>;
|
|
21
|
+
}
|
|
22
|
+
export interface ReactRequest {
|
|
23
|
+
entityRef: {
|
|
24
|
+
entityType: string;
|
|
25
|
+
entityId: string;
|
|
26
|
+
};
|
|
27
|
+
token: string;
|
|
28
|
+
appId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ReactResponse {
|
|
31
|
+
operationId: string;
|
|
32
|
+
token: string;
|
|
33
|
+
active: boolean;
|
|
34
|
+
counts: Record<string, number>;
|
|
35
|
+
}
|
|
36
|
+
export interface GetCountsResponse {
|
|
37
|
+
operationId: string;
|
|
38
|
+
counts: Record<string, number>;
|
|
39
|
+
myReactions: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface GetMyReactionsResponse {
|
|
42
|
+
operationId: string;
|
|
43
|
+
tokens: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface ValtechReactionsConfig {
|
|
46
|
+
apiUrl: string;
|
|
47
|
+
appId?: string;
|
|
48
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -412,6 +412,9 @@ export * from './lib/components/molecules/request-form/request-form.component';
|
|
|
412
412
|
export * from './lib/components/molecules/request-form/types';
|
|
413
413
|
export * from './lib/components/molecules/content-reaction/content-reaction.component';
|
|
414
414
|
export * from './lib/components/molecules/content-reaction/types';
|
|
415
|
+
export * from './lib/services/reactions/index';
|
|
416
|
+
export * from './lib/components/molecules/reaction-bar/reaction-bar.component';
|
|
417
|
+
export * from './lib/components/molecules/reaction-bar/types';
|
|
415
418
|
export * from './lib/services/splash-screen';
|
|
416
419
|
export * from './lib/services/haptics';
|
|
417
420
|
export * from './lib/components/templates/docs-layout/docs-layout.component';
|