@fayz-ai/plugin-agenda 0.8.4 → 0.9.0-next.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAiBnD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,cAAc,CA8NhF;AAGD,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAC5E,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAClI,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAGlG,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAiBnD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,cAAc,CAsQhF;AAGD,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,YAAY,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAC5E,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAClI,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAGlG,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createMockAgendaProvider, createSupabasePublicBookingProvider } from './chunk-Q2PAWBPR.js';
2
2
  export { createMockAgendaProvider } from './chunk-Q2PAWBPR.js';
3
3
  import React13, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
4
- import { getSupabaseClientOptional, getActiveTenantId, registerTranslations, createSafeDataProvider, usePluginRuntimeOptional, useTranslation, getCurrentLocale, useDataChanged, formatCurrency } from '@fayz-ai/core';
4
+ import { getSupabaseClientOptional, getActiveTenantId, registerTranslations, createSafeDataProvider, emitDataChanged, usePluginRuntimeOptional, useTranslation, getCurrentLocale, useDataChanged, formatCurrency } from '@fayz-ai/core';
5
5
  import { createPluginContext, setScheduleBlockConfig, getScheduleBlockConfig, PluginSettingsPanel, dedup, useTenantPluginSettings, SettingsGroup, ToggleRow, SelectRow, usePluginPrefs, PersonLink, useLimitGuard, CrudFormPage, CrudDetailPage, ContactPicker, invalidateLimit } from '@fayz-ai/saas';
6
6
  import FullCalendar from '@fullcalendar/react';
7
7
  import dayGridPlugin from '@fullcalendar/daygrid';
@@ -3689,6 +3689,7 @@ function createAgendaStore(provider2, financialBridge) {
3689
3689
  const bookings = await provider2.getBookings(getCurrentBookingQuery(state));
3690
3690
  set({ bookings });
3691
3691
  }
3692
+ emitDataChanged({ table: "appointments", op: "create", id: booking.id, source: "ui" });
3692
3693
  toast.success("Appointment created");
3693
3694
  return booking;
3694
3695
  } catch (err) {
@@ -3704,6 +3705,7 @@ function createAgendaStore(provider2, financialBridge) {
3704
3705
  const bookings = await provider2.getBookings(getCurrentBookingQuery(state));
3705
3706
  set({ bookings });
3706
3707
  }
3708
+ emitDataChanged({ table: "appointments", op: "update", id, source: "ui" });
3707
3709
  toast.success("Appointment updated");
3708
3710
  return booking;
3709
3711
  } catch (err) {
@@ -3719,6 +3721,7 @@ function createAgendaStore(provider2, financialBridge) {
3719
3721
  const bookings = await provider2.getBookings(getCurrentBookingQuery(state));
3720
3722
  set({ bookings });
3721
3723
  }
3724
+ emitDataChanged({ table: "appointments", op: "delete", id, source: "ui" });
3722
3725
  toast.success("Appointment deleted");
3723
3726
  } catch (err) {
3724
3727
  toast.error("Failed to delete appointment", { description: err?.message });
@@ -3735,6 +3738,7 @@ function createAgendaStore(provider2, financialBridge) {
3735
3738
  const bookings = await provider2.getBookings(getCurrentBookingQuery(state));
3736
3739
  set({ bookings });
3737
3740
  }
3741
+ emitDataChanged({ table: "appointments", op: "update", id, source: "ui" });
3738
3742
  toast.success("Status updated");
3739
3743
  } catch (err) {
3740
3744
  set({ bookings: prev });
@@ -5699,6 +5703,12 @@ function createAgendaPlugin(options) {
5699
5703
  kind: "write",
5700
5704
  description: "Guarded appointment create: agent_guard (role\u2192plan\u2192bookings_month cap), working hours, race-safe conflict check, audited.",
5701
5705
  audits: true
5706
+ },
5707
+ {
5708
+ name: "agent_agenda_update_appointment",
5709
+ kind: "write",
5710
+ description: "Guarded appointment reschedule/reassign/cancel: agent_guard (role\u2192plan, no cap), working hours, race-safe conflict check that skips the appointment itself, audited.",
5711
+ audits: true
5702
5712
  }
5703
5713
  ],
5704
5714
  navigation: [
@@ -5768,6 +5778,35 @@ function createAgendaPlugin(options) {
5768
5778
  ],
5769
5779
  permission: { feature: "appointments", action: "create" }
5770
5780
  },
5781
+ {
5782
+ id: "agenda.update-appointment",
5783
+ name: "updateAppointment",
5784
+ description: "Changes an appointment that ALREADY EXISTS: reschedule (starts_at), reassign (professional_id), cancel or confirm (status), or annotate (notes). This is the ONLY way to change an appointment \u2014 the appointments entity is a read-only view, so updateRecord cannot touch it. NEVER answer a reschedule or a cancellation by creating a new appointment: that leaves the original standing and double-books the professional. Takes the appointment id from a previous search. The duration is preserved automatically. The user confirms before anything changes.",
5785
+ icon: "CalendarClock",
5786
+ mode: "persist",
5787
+ execution: { plane: "server", kind: "rpc", rpc: "agent_agenda_update_appointment" },
5788
+ category: "Scheduling",
5789
+ parameters: {
5790
+ type: "object",
5791
+ properties: {
5792
+ appointment_id: { type: "string", description: "Id of the appointment to change (from a search)" },
5793
+ starts_at: { type: "string", description: "New LOCAL date-time of the business, NO timezone suffix \u2014 e.g. '2026-07-27T16:30'. Omit to keep the current time." },
5794
+ professional_id: { type: "string", description: "Move to another professional (optional)" },
5795
+ status: {
5796
+ type: "string",
5797
+ description: 'New status \u2014 use "cancelled" to cancel',
5798
+ enum: ["scheduled", "confirmed", "in_progress", "completed", "cancelled", "no_show"]
5799
+ },
5800
+ notes: { type: "string", description: "Optional notes" }
5801
+ },
5802
+ required: ["appointment_id"]
5803
+ },
5804
+ suggestions: [
5805
+ { label: "Remarca o Gustavo para 16:30" },
5806
+ { label: "Cancela o atendimento das 10h" }
5807
+ ],
5808
+ permission: { feature: "appointments", action: "edit" }
5809
+ },
5771
5810
  {
5772
5811
  id: "agenda.check-availability",
5773
5812
  name: "checkAvailability",