@fayz-ai/plugin-clinical 0.3.3 → 0.4.0

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type PluginManifest } from '@fayz-ai/core';
2
- export * from './types';
2
+ export type { ClinicalPrepaidOutcome, ClinicalRequirementKind, ClinicalRequirementScope, ClinicalRequirementStatus, ClinicalSessionStatus, } from './types';
3
3
  export interface ClinicalPluginOptions {
4
4
  /** Onde o item entra no menu. Ausente = o plugin não desenha navegação. */
5
5
  navPosition?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAGjE,cAAc,SAAS,CAAA;AAEvB,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,GAAE,qBAA0B,GAAG,cAAc,CAmBzF;AAED,eAAe,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAIjE,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,qBAAqB;IACpC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,GAAE,qBAA0B,GAAG,cAAc,CAoBzF;AAED,eAAe,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- import { definePlugin } from '@fayz-ai/core';
1
+ import { tl, definePlugin } from '@fayz-ai/core';
2
+ import { defineSettingsTab, attendanceSettingsParent } from '@fayz-ai/admin';
2
3
 
3
4
  // src/index.ts
4
5
 
@@ -3713,6 +3714,21 @@ BEGIN
3713
3714
  END;
3714
3715
  END $function$;
3715
3716
  `;
3717
+ var MIGRATION_025_AS_REGRAS_DO_ATENDIMENTO_SAO_CONFIGURACAO = `-- The attendance rules 004 already reads, registered as setting keys so the
3718
+ -- settings screen can write them through tenant_setting_set (typed, permission
3719
+ -- checked). Same paths the V1 import wrote: tenants.settings.execution_requirements.mode
3720
+ -- and tenants.settings.evaluation_flow.*. Nested writes keep the sibling keys.
3721
+ --
3722
+ -- Idempotent.
3723
+ SELECT app.seed_setting_keys($$[
3724
+ { "key": "execution_requirements.mode", "type": "string", "default": "off", "scope": "tenant", "reader": "plugin:clinical",
3725
+ "description": "Execution requirements: off, shadow (warn only) or on (block). V1: general_settings.execution_requirements.mode." },
3726
+ { "key": "evaluation_flow.require_evaluation_for_kind_service", "type": "boolean", "default": false, "scope": "tenant", "reader": "plugin:clinical",
3727
+ "description": "A paid service needs a linked evaluation. V1: general_settings.evaluation_flow." },
3728
+ { "key": "evaluation_flow.revision_link_required", "type": "boolean", "default": false, "scope": "tenant", "reader": "plugin:clinical",
3729
+ "description": "A revision must be linked to the original service; blocks start and finish. V1: general_settings.evaluation_flow." }
3730
+ ]$$::jsonb);
3731
+ `;
3716
3732
  var MIGRATIONS = [
3717
3733
  { id: "001_o_atendimento_clinico_tem_onde_morar", sql: MIGRATION_001_O_ATENDIMENTO_CLINICO_TEM_ONDE_MORAR },
3718
3734
  { id: "002_o_prontuario_do_v1_atravessa", sql: MIGRATION_002_O_PRONTUARIO_DO_V1_ATRAVESSA },
@@ -3737,8 +3753,35 @@ var MIGRATIONS = [
3737
3753
  { id: "021_agendamento_nascido_no_v2_tambem_tem_regua", sql: MIGRATION_021_AGENDAMENTO_NASCIDO_NO_V2_TAMBEM_TEM_REGUA },
3738
3754
  { id: "022_a_vista_do_que_executar_respeita_a_cerca", sql: MIGRATION_022_A_VISTA_DO_QUE_EXECUTAR_RESPEITA_A_CERCA },
3739
3755
  { id: "023_a_revisao_se_escolhe_ao_agendar", sql: MIGRATION_023_A_REVISAO_SE_ESCOLHE_AO_AGENDAR },
3740
- { id: "024_a_avaliacao_desta_visita_vale_para_o_que_ela_contratou", sql: MIGRATION_024_A_AVALIACAO_DESTA_VISITA_VALE_PARA_O_QUE_ELA_CONTRATOU }
3756
+ { id: "024_a_avaliacao_desta_visita_vale_para_o_que_ela_contratou", sql: MIGRATION_024_A_AVALIACAO_DESTA_VISITA_VALE_PARA_O_QUE_ELA_CONTRATOU },
3757
+ { id: "025_as_regras_do_atendimento_sao_configuracao", sql: MIGRATION_025_AS_REGRAS_DO_ATENDIMENTO_SAO_CONFIGURACAO }
3741
3758
  ];
3759
+ var attendanceSettingsTab = defineSettingsTab({
3760
+ id: "clinical-attendance-rules",
3761
+ label: tl("Rules", "Regras"),
3762
+ icon: "ClipboardCheck",
3763
+ section: "operations",
3764
+ parent: attendanceSettingsParent(),
3765
+ order: 2,
3766
+ keywords: [tl("Attendance rules", "Regras do atendimento"), tl("Evaluation", "Avalia\xE7\xE3o")],
3767
+ defaults: {
3768
+ "execution_requirements.mode": "off",
3769
+ "evaluation_flow.require_evaluation_for_kind_service": false,
3770
+ "evaluation_flow.revision_link_required": false
3771
+ },
3772
+ sections: [{
3773
+ description: tl("What must be done before an attendance starts or finishes.", "O que precisa estar feito antes de come\xE7ar ou terminar um atendimento."),
3774
+ fields: [
3775
+ { key: "execution_requirements.mode", type: "select", label: tl("Execution requirements", "Exig\xEAncias de execu\xE7\xE3o"), options: [
3776
+ { value: "off", label: tl("Off", "Desligado") },
3777
+ { value: "shadow", label: tl("Warn only", "S\xF3 avisar") },
3778
+ { value: "on", label: tl("Enforce", "Exigir") }
3779
+ ] },
3780
+ { key: "evaluation_flow.require_evaluation_for_kind_service", type: "boolean", label: tl("A paid service needs an evaluation", "Servi\xE7o pago precisa de avalia\xE7\xE3o vinculada") },
3781
+ { key: "evaluation_flow.revision_link_required", type: "boolean", label: tl("A revision must point to the original service", "Revis\xE3o precisa estar ligada ao servi\xE7o original") }
3782
+ ]
3783
+ }]
3784
+ });
3742
3785
 
3743
3786
  // src/index.ts
3744
3787
  function createClinicalPlugin(_options = {}) {
@@ -3753,6 +3796,7 @@ function createClinicalPlugin(_options = {}) {
3753
3796
  dependencies: ["agenda"],
3754
3797
  navigation: [],
3755
3798
  routes: [],
3799
+ settings: [attendanceSettingsTab],
3756
3800
  migrations: MIGRATIONS.map((entry) => ({
3757
3801
  id: `clinical-${entry.id}`,
3758
3802
  version: "1.0.0",