@wrcb/cb-common 1.0.911 → 1.0.913

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,6 @@
1
+ /**
2
+ * Idade completa em anos na data `now`. Aceita Date ou string ISO (YYYY-MM-DD
3
+ * ou data-hora). Devolve `null` se a data não existir ou for inválida.
4
+ * Usa UTC para a data de nascimento não "andar um dia" conforme o fuso.
5
+ */
6
+ export declare function ageFromBirthDate(birthDate: Date | string | null | undefined, now?: Date): number | null;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ageFromBirthDate = ageFromBirthDate;
4
+ /**
5
+ * Idade completa em anos na data `now`. Aceita Date ou string ISO (YYYY-MM-DD
6
+ * ou data-hora). Devolve `null` se a data não existir ou for inválida.
7
+ * Usa UTC para a data de nascimento não "andar um dia" conforme o fuso.
8
+ */
9
+ function ageFromBirthDate(birthDate, now = new Date()) {
10
+ if (!birthDate)
11
+ return null;
12
+ const birth = birthDate instanceof Date ? birthDate : new Date(birthDate);
13
+ if (Number.isNaN(birth.getTime()))
14
+ return null;
15
+ let age = now.getUTCFullYear() - birth.getUTCFullYear();
16
+ const beforeBirthday = now.getUTCMonth() < birth.getUTCMonth() ||
17
+ (now.getUTCMonth() === birth.getUTCMonth() &&
18
+ now.getUTCDate() < birth.getUTCDate());
19
+ if (beforeBirthday)
20
+ age -= 1;
21
+ return age < 0 ? null : age;
22
+ }
package/build/index.d.ts CHANGED
@@ -77,3 +77,4 @@ export * from './services/TenantDataService';
77
77
  export * from './services/CurrencyService';
78
78
  export * from './config/notasBrBilling';
79
79
  export * from './helpers/calculateBonus';
80
+ export * from './helpers/ageFromBirthDate';
package/build/index.js CHANGED
@@ -106,3 +106,4 @@ __exportStar(require("./services/CurrencyService"), exports);
106
106
  // notas-br — tabela de billing compartilhada entre gn-business e cb-payments
107
107
  __exportStar(require("./config/notasBrBilling"), exports);
108
108
  __exportStar(require("./helpers/calculateBonus"), exports);
109
+ __exportStar(require("./helpers/ageFromBirthDate"), exports);
@@ -378,6 +378,11 @@ export interface ClinicaQuickReply {
378
378
  text: string;
379
379
  createdAt: string;
380
380
  }
381
+ export interface ClinicaTag {
382
+ id: string;
383
+ name: string;
384
+ usageCount: number;
385
+ }
381
386
  export declare enum ClinicaOnboardingStepKey {
382
387
  Whatsapp = "Whatsapp",
383
388
  Clinic = "Clinic",
@@ -28,14 +28,18 @@ export interface InfluencerProfileDTO {
28
28
  userId: string;
29
29
  /** Descrição física que vale para TODAS as imagens dela. */
30
30
  visualPrompt: string;
31
+ /** Calculada da data de nascimento quando ela existe; senão, o valor guardado. */
31
32
  age: number;
33
+ /** Data de nascimento (ISO) usada para calcular a idade; `null` se ainda não informada. */
34
+ birthDate: string | null;
32
35
  referencePrompt: string;
33
36
  references: InfluencerReferenceSheetDTO[];
34
37
  loraStatus: InfluencerLoraStatus;
35
38
  }
36
39
  export interface UpsertInfluencerProfileBody {
37
40
  visualPrompt: string;
38
- age: number;
41
+ /** Data de nascimento (YYYY-MM-DD). A idade é sempre calculada a partir dela. */
42
+ birthDate?: string | null;
39
43
  }
40
44
  export interface GenerateInfluencerReferenceBody {
41
45
  /** Se vier, substitui o prompt de referência guardado. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrcb/cb-common",
3
- "version": "1.0.911",
3
+ "version": "1.0.913",
4
4
  "description": "Common resources between services",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",