@fayz-ai/plugin-agenda 0.2.0 → 0.2.1

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,9 @@
1
+ /**
2
+ * Customer-facing booking surface. Default view is an overview (services +
3
+ * opening hours + CTA) like Quaddro; picking a service — or landing with
4
+ * ?service=… — enters a stepped flow (date → time → contact → confirmation)
5
+ * with a live progress + summary rail. Token-only, keyboard-accessible, 44px
6
+ * targets. Runs on mock slots today; real availability is a provider swap.
7
+ */
8
+ export declare function BookingWidget(): import("react").JSX.Element;
9
+ //# sourceMappingURL=BookingWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BookingWidget.d.ts","sourceRoot":"","sources":["../../src/public/BookingWidget.tsx"],"names":[],"mappings":"AAmMA;;;;;;GAMG;AACH,wBAAgB,aAAa,gCAirB5B"}
@@ -0,0 +1,37 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { PaymentProvider } from '@fayz-ai/core';
3
+ import type { AgendaDataProvider } from '../data/types';
4
+ import type { PublicService, BookingWindow, PublicBookingLabels, WorkingHours, ResolvedPayment } from './types';
5
+ /** Emitted when the customer's phone is verified / identity captured, for the
6
+ * host to bridge to auth (booking stays decoupled — data-only, optional). */
7
+ export type OnIdentityVerified = (identity: {
8
+ name: string;
9
+ phone: string;
10
+ email?: string;
11
+ }) => void;
12
+ export interface PublicBookingContextValue {
13
+ provider: AgendaDataProvider;
14
+ /** The professional/resource bookings are created against (POC: single professional). */
15
+ professionalId: string;
16
+ professionalName: string;
17
+ services: PublicService[];
18
+ /** Business opening hours, shown on the overview "Sobre" section. */
19
+ businessHours: WorkingHours;
20
+ /** Payment step config, or null when the flow ends at confirmation. */
21
+ payment: ResolvedPayment | null;
22
+ /** Injected charge provider (Pix). When absent, the payment step self-mocks. */
23
+ paymentProvider: PaymentProvider | null;
24
+ /** Fired on phone-verify / details submit so the host can sign the user in. */
25
+ onIdentityVerified: OnIdentityVerified | null;
26
+ window: BookingWindow;
27
+ labels: PublicBookingLabels;
28
+ /** Currency code for price formatting (e.g. 'BRL'). */
29
+ currency: string;
30
+ locale: string;
31
+ }
32
+ export declare function BookingProvider({ value, children }: {
33
+ value: PublicBookingContextValue;
34
+ children: ReactNode;
35
+ }): import("react").JSX.Element;
36
+ export declare function useBooking(): PublicBookingContextValue;
37
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/public/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE/G;8EAC8E;AAC9E,MAAM,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAA;AAEpG,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,yFAAyF;IACzF,cAAc,EAAE,MAAM,CAAA;IACtB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,qEAAqE;IACrE,aAAa,EAAE,YAAY,CAAA;IAC3B,uEAAuE;IACvE,OAAO,EAAE,eAAe,GAAG,IAAI,CAAA;IAC/B,gFAAgF;IAChF,eAAe,EAAE,eAAe,GAAG,IAAI,CAAA;IACvC,+EAA+E;IAC/E,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAC7C,MAAM,EAAE,aAAa,CAAA;IACrB,MAAM,EAAE,mBAAmB,CAAA;IAC3B,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAID,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAE7G;AAED,wBAAgB,UAAU,IAAI,yBAAyB,CAMtD"}
@@ -0,0 +1,45 @@
1
+ import { type FC, type ReactNode } from 'react';
2
+ import type { PluginManifest, PluginScope, VerticalId, PaymentProvider } from '@fayz-ai/core';
3
+ import type { AgendaDataProvider } from '../data/types';
4
+ import { type MockAgendaSeed } from '../data/mock';
5
+ import { type OnIdentityVerified } from './context';
6
+ import type { PublicService, BookingWindow, PublicBookingLabels, WorkingHours, PaymentConfig } from './types';
7
+ export interface PublicBookingOptions {
8
+ /** Mount path for the public booking route. Default '/agendar'. */
9
+ basePath?: string;
10
+ /** The single professional/resource bookings target (POC). */
11
+ professional?: {
12
+ id?: string;
13
+ name?: string;
14
+ };
15
+ /** Bookable services shown in the widget. */
16
+ services: PublicService[];
17
+ /** Working hours used to seed the mock provider's availability. */
18
+ workingHours?: WorkingHours;
19
+ /** Booking-window bounds for the date/slot picker. */
20
+ window?: Partial<BookingWindow>;
21
+ labels?: Partial<PublicBookingLabels>;
22
+ /** Adds a final Pagamento (Pix) step. Omit/disable to end the flow at confirmation. */
23
+ payment?: PaymentConfig;
24
+ /** Charge provider (from a payments plugin) used by the Pagamento step. Optional. */
25
+ paymentProvider?: PaymentProvider;
26
+ /** Host bridge: fired when the customer's phone is verified / details submitted. */
27
+ onIdentityVerified?: OnIdentityVerified;
28
+ currency?: string;
29
+ locale?: string;
30
+ /** Inject a custom provider (real availability). Overrides the safe resolver. */
31
+ dataProvider?: AgendaDataProvider;
32
+ /** Override the full mock seed (advanced). */
33
+ seed?: MockAgendaSeed;
34
+ scope?: PluginScope;
35
+ verticalId?: VerticalId;
36
+ }
37
+ export interface PublicBookingPlugin {
38
+ manifest: PluginManifest;
39
+ Provider: FC<{
40
+ children: ReactNode;
41
+ }>;
42
+ dataProvider: AgendaDataProvider;
43
+ }
44
+ export declare function createPublicBookingPlugin(options: PublicBookingOptions): PublicBookingPlugin;
45
+ //# sourceMappingURL=createPublicBookingPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPublicBookingPlugin.d.ts","sourceRoot":"","sources":["../../src/public/createPublicBookingPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE7F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAEvD,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAE5E,OAAO,EAAmD,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAEpG,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAmB,MAAM,SAAS,CAAA;AAE9H,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8DAA8D;IAC9D,YAAY,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,6CAA6C;IAC7C,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,mEAAmE;IACnE,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACrC,uFAAuF;IACvF,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,qFAAqF;IACrF,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iFAAiF;IACjF,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,EAAE,EAAE,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAA;IACrC,YAAY,EAAE,kBAAkB,CAAA;CACjC;AAkCD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CA6E5F"}
@@ -0,0 +1,32 @@
1
+ import type { PublicService, ContactInfo } from './types';
2
+ import type { TimeSlot } from '../types';
3
+ /** The configured bookable services (from context; POC-static, ERP-driven later). */
4
+ export declare function useServices(): PublicService[];
5
+ export interface UseAvailableSlotsResult {
6
+ slots: TimeSlot[];
7
+ loading: boolean;
8
+ error: Error | null;
9
+ }
10
+ /**
11
+ * Available time slots for a service on a given date. Delegates to
12
+ * provider.getAvailableSlots — mock now, real availability later, same call.
13
+ */
14
+ export declare function useAvailableSlots(params: {
15
+ serviceId: string | null;
16
+ date: string | null;
17
+ }): UseAvailableSlotsResult;
18
+ export interface CreatePublicBookingInput {
19
+ serviceId: string;
20
+ /** ISO datetime of the chosen slot start. */
21
+ startsAt: string;
22
+ contact: ContactInfo;
23
+ }
24
+ export interface UseCreateBookingResult {
25
+ submit: (input: CreatePublicBookingInput) => Promise<void>;
26
+ submitting: boolean;
27
+ error: Error | null;
28
+ done: boolean;
29
+ }
30
+ /** Create a booking via the provider. POC: mock append; real persistence later. */
31
+ export declare function useCreateBooking(): UseCreateBookingResult;
32
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/public/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,qFAAqF;AACrF,wBAAgB,WAAW,IAAI,aAAa,EAAE,CAE7C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,uBAAuB,CAqCpH;AAED,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1D,UAAU,EAAE,OAAO,CAAA;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,IAAI,sBAAsB,CA0CzD"}