valtech-components 2.0.803 → 2.0.804

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
+ import { ValtechDonationConfig } from './types';
3
+ /**
4
+ * Token de inyección para la configuración de Donation/Support.
5
+ */
6
+ export declare const VALTECH_DONATION_CONFIG: InjectionToken<ValtechDonationConfig>;
7
+ /** Configuración por defecto — sin métodos habilitados. */
8
+ export declare const DEFAULT_DONATION_CONFIG: Partial<ValtechDonationConfig>;
9
+ /**
10
+ * Provee el feature de aportes (Support) a la aplicación Angular.
11
+ *
12
+ * Cada app del factory declara qué métodos habilita. La vista de Support
13
+ * (heredada o local) renderiza solo los métodos configurados.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // main.ts
18
+ * provideValtechDonations({
19
+ * appId: 'showcase',
20
+ * methods: ['coffee', 'bank', 'ads'],
21
+ * coffee: { provider: 'buymeacoffee', url: 'https://buymeacoffee.com/valtech' },
22
+ * bank: {
23
+ * accounts: [{
24
+ * country: 'CL', bank: 'Banco X', accountType: 'Cuenta Corriente',
25
+ * number: '000000000', taxId: '11.111.111-1', holder: 'Valtech SpA',
26
+ * email: 'aportes@valtech.com', currency: 'CLP',
27
+ * }],
28
+ * },
29
+ * ads: { provider: 'admob', rewardedUnitId: 'ca-app-pub-xxx' },
30
+ * }),
31
+ * ```
32
+ */
33
+ export declare function provideValtechDonations(config: ValtechDonationConfig): EnvironmentProviders;
@@ -0,0 +1,54 @@
1
+ import { BankAccount, DonationActionResult, DonationMethod } from './types';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * `DonationService`
5
+ *
6
+ * Servicio cross-app para el feature de aportes voluntarios (Support).
7
+ * Patrón factory: cada app llama `provideValtechDonations(...)` y este
8
+ * servicio expone solo los métodos habilitados.
9
+ *
10
+ * **Fase 0 (placeholder)** — abre links externos + expone datos de config.
11
+ * Sin backend. Fases futuras: rewarded ads reales, webhook de café,
12
+ * registro de intents para una página de transparencia.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * private donations = inject(DonationService);
17
+ *
18
+ * methods = this.donations.enabledMethods(); // ['coffee', 'bank']
19
+ * onCoffee() { this.donations.openCoffee(); }
20
+ * accounts = this.donations.bankAccounts();
21
+ * ```
22
+ */
23
+ export declare class DonationService {
24
+ private readonly config;
25
+ /** Último intent registrado — útil para tests / debugging / UI feedback. */
26
+ private readonly _lastIntent;
27
+ readonly lastIntent: import("@angular/core").Signal<DonationMethod>;
28
+ /** Métodos habilitados por la app, en orden de config. */
29
+ readonly enabledMethods: import("@angular/core").Signal<DonationMethod[]>;
30
+ /** `true` si el método está habilitado en la config de la app. */
31
+ isEnabled(method: DonationMethod): boolean;
32
+ /** Cuentas bancarias configuradas (vacío si `bank` no está habilitado). */
33
+ bankAccounts(): BankAccount[];
34
+ /** Cuentas filtradas por país ISO — para apps multi-mercado. */
35
+ bankAccountsByCountry(country: string): BankAccount[];
36
+ /**
37
+ * Abre el checkout de "café" (Buy Me a Coffee / Ko-fi) en una pestaña nueva.
38
+ * El proveedor es el merchant of record — Valtech no procesa el pago.
39
+ */
40
+ openCoffee(): DonationActionResult;
41
+ /**
42
+ * Muestra un anuncio rewarded (opt-in). **Fase 0: no implementado** —
43
+ * placeholder hasta integrar el plugin de ads (AdMob/AdSense) + la
44
+ * categoría de consentimiento. Retorna `not-supported`.
45
+ */
46
+ showRewardedAd(): Promise<DonationActionResult>;
47
+ /**
48
+ * Registra la intención de aporte. **Fase 0: solo estado local.**
49
+ * Fase 4 — POST a un endpoint para una página de transparencia.
50
+ */
51
+ recordIntent(method: DonationMethod): void;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<DonationService, never>;
53
+ static ɵprov: i0.ɵɵInjectableDeclaration<DonationService>;
54
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Valtech Donation / Support Service
3
+ *
4
+ * Feature cross-app de aportes voluntarios. Patrón factory: cada app llama
5
+ * `provideValtechDonations(...)` y habilita los métodos que quiera
6
+ * (`ads` · `coffee` · `bank`).
7
+ *
8
+ * Importante (legal): el dinero recibido por una entidad con fines de lucro
9
+ * es ingreso afecto a impuesto, NO una donación deducible. La UI debe usar
10
+ * lenguaje de "aporte voluntario / apoyo", nunca "donación".
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // main.ts
15
+ * provideValtechDonations({
16
+ * appId: 'showcase',
17
+ * methods: ['coffee', 'bank'],
18
+ * coffee: { provider: 'buymeacoffee', url: 'https://buymeacoffee.com/valtech' },
19
+ * bank: { accounts: [ ... ] },
20
+ * }),
21
+ * ```
22
+ */
23
+ export { VALTECH_DONATION_CONFIG, provideValtechDonations, DEFAULT_DONATION_CONFIG, } from './config';
24
+ export { DonationService } from './donation.service';
25
+ export { DonationMethod, CoffeeProvider, AdsProvider, BankAccount, CoffeeConfig, AdsConfig, ValtechDonationConfig, DonationActionResult, } from './types';
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Valtech Donation / Support — tipos.
3
+ *
4
+ * Nota legal importante: el dinero recibido por una entidad con fines de lucro
5
+ * NO es una "donación" deducible de impuestos — es ingreso afecto. Por eso la
6
+ * UI debe usar lenguaje de "aporte voluntario / apoyo", nunca "donación" en su
7
+ * sentido jurídico. Ver `docs/` (pendiente) y la vista Support del consumer.
8
+ */
9
+ /**
10
+ * Métodos de aporte soportados.
11
+ * - `ads` — el usuario ve publicidad rewarded (opt-in) para apoyar.
12
+ * - `coffee` — pago único vía proveedor externo (Buy Me a Coffee / Ko-fi).
13
+ * - `bank` — transferencia bancaria directa (se muestran los datos).
14
+ */
15
+ export type DonationMethod = 'ads' | 'coffee' | 'bank';
16
+ /** Proveedor del método "café". El merchant of record es el proveedor. */
17
+ export type CoffeeProvider = 'buymeacoffee' | 'kofi' | 'custom';
18
+ /** Proveedor de publicidad rewarded. */
19
+ export type AdsProvider = 'admob' | 'adsense' | 'custom';
20
+ /**
21
+ * Datos de una cuenta bancaria para transferencia. Pensado para ser
22
+ * por-país (el modelo factory es 1 producto = 1 dominio, con datos
23
+ * fiscales/bancarios distintos por mercado).
24
+ */
25
+ export interface BankAccount {
26
+ /** ISO country code — ej. 'CL', 'AR', 'MX'. */
27
+ country: string;
28
+ /** Nombre del banco. */
29
+ bank: string;
30
+ /** Tipo de cuenta — ej. 'Cuenta Corriente', 'Vista', 'Checking'. */
31
+ accountType: string;
32
+ /** Número de cuenta / IBAN / CBU. */
33
+ number: string;
34
+ /** Identificador fiscal del titular — RUT, CUIT, RFC, etc. */
35
+ taxId: string;
36
+ /** Nombre del titular de la cuenta. */
37
+ holder: string;
38
+ /** Email para enviar comprobante de transferencia. */
39
+ email?: string;
40
+ /** Moneda — ej. 'CLP', 'USD'. */
41
+ currency?: string;
42
+ }
43
+ /** Config del método "café". */
44
+ export interface CoffeeConfig {
45
+ provider: CoffeeProvider;
46
+ /** URL pública del perfil (BMC/Ko-fi) o checkout custom. */
47
+ url: string;
48
+ }
49
+ /** Config del método "ads" (rewarded, opt-in). */
50
+ export interface AdsConfig {
51
+ provider: AdsProvider;
52
+ /** ID de la unidad de anuncio rewarded. */
53
+ rewardedUnitId?: string;
54
+ }
55
+ /**
56
+ * Configuración del feature Donation/Support.
57
+ *
58
+ * Cada app del factory declara qué métodos habilita. Una vista heredada
59
+ * (`val-*` page) renderiza solo los métodos en `methods`.
60
+ */
61
+ export interface ValtechDonationConfig {
62
+ /** AppID — para tracking de intents (ej. analytics). */
63
+ appId?: string;
64
+ /** Métodos habilitados, en orden de aparición en la UI. */
65
+ methods: DonationMethod[];
66
+ /** Config del método café — requerido si `methods` incluye `'coffee'`. */
67
+ coffee?: CoffeeConfig;
68
+ /** Cuentas bancarias — requerido si `methods` incluye `'bank'`. */
69
+ bank?: {
70
+ accounts: BankAccount[];
71
+ };
72
+ /** Config de ads — requerido si `methods` incluye `'ads'`. */
73
+ ads?: AdsConfig;
74
+ }
75
+ /**
76
+ * Resultado de un intento de aporte. Devuelto por los métodos del servicio
77
+ * de forma descriptiva (no se lanzan excepciones para flujos esperables).
78
+ */
79
+ export interface DonationActionResult {
80
+ method: DonationMethod;
81
+ /** `true` si la acción se inició correctamente. */
82
+ ok: boolean;
83
+ /** Motivo cuando `ok` es `false` — ej. 'not-configured', 'not-supported'. */
84
+ reason?: string;
85
+ }
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "2.0.803";
5
+ export declare const VERSION = "2.0.804";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.803",
3
+ "version": "2.0.804",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -272,6 +272,7 @@ export * from './lib/services/ads';
272
272
  export * from './lib/components/molecules/ad-slot/ad-slot.component';
273
273
  export * from './lib/services/content';
274
274
  export * from './lib/services/feedback';
275
+ export * from './lib/services/donation';
275
276
  export * from './lib/components/molecules/feedback-form/feedback-form.component';
276
277
  export * from './lib/components/molecules/feedback-form/types';
277
278
  export * from './lib/components/molecules/content-reaction/content-reaction.component';