@fayz-ai/plugin-agenda 0.3.0 → 0.8.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.
- package/README.md +2 -0
- package/dist/bridges/create-financial-bridge.d.ts.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/index.cjs +77 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +77 -65
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +8 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/public/createPublicBookingPlugin.d.ts.map +1 -1
- package/dist/public/index.cjs +16 -16
- package/dist/public/index.cjs.map +1 -1
- package/dist/public/index.js +17 -17
- package/dist/public/index.js.map +1 -1
- package/dist/registries.d.ts.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +21 -14
- package/src/bridges/create-financial-bridge.ts +6 -8
- package/src/components/AppointmentModal.tsx +4 -4
- package/src/config.ts +2 -2
- package/src/data/supabase.ts +26 -25
- package/src/index.ts +1 -1
- package/src/integrations/google-calendar/index.ts +1 -1
- package/src/integrations/google-calendar/migrations/001_google_calendar.sql +6 -6
- package/src/migrations/000b_v_bookings_rename.sql +21 -0
- package/src/migrations/000c_dedupe_customer_phones.sql +43 -0
- package/src/migrations/001_public_booking.sql +40 -27
- package/src/migrations/002_v_bookings_compat.sql +14 -0
- package/src/migrations/index.ts +134 -29
- package/src/public/createPublicBookingPlugin.ts +23 -20
- package/src/public/data.supabase.ts +4 -4
- package/src/registries.ts +1 -2
- package/src/types.ts +4 -4
package/dist/public/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMockAgendaProvider } from '../chunk-DRZF6CV2.js';
|
|
2
2
|
import { createContext, useState, useEffect, useMemo, useContext, useRef, createElement } from 'react';
|
|
3
3
|
import { ChevronLeft, ShieldCheck, Clock, ChevronRight, User, Check, Calendar, ChevronDown, Loader2, CreditCard, Plus, QrCode, CalendarCheck, Copy, Video } from 'lucide-react';
|
|
4
|
-
import { DEFAULT_COUNTRY, getCountry, maskPhone, unmaskPhone,
|
|
4
|
+
import { DEFAULT_COUNTRY, getCountry, maskPhone, unmaskPhone, getSupabaseClientOptional, getFayzCloudClient, COUNTRIES } from '@fayz-ai/core';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
// src/public/data.ts
|
|
@@ -48,9 +48,7 @@ function createMockPublicBookingProvider(options) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
function getClient() {
|
|
51
|
-
|
|
52
|
-
if (!client) throw new Error("[plugin-agenda/public] Supabase client not initialized");
|
|
53
|
-
return client;
|
|
51
|
+
return getSupabaseClientOptional() ?? getFayzCloudClient();
|
|
54
52
|
}
|
|
55
53
|
function toPhoneDigits(phone) {
|
|
56
54
|
return (phone ?? "").replace(/\D/g, "");
|
|
@@ -1338,21 +1336,23 @@ function createPublicBookingPlugin(options) {
|
|
|
1338
1336
|
schedules: buildSchedules(mockProfessionalId, hours),
|
|
1339
1337
|
bookings: []
|
|
1340
1338
|
};
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1339
|
+
let provider;
|
|
1340
|
+
if (options.dataProvider) {
|
|
1341
|
+
provider = options.dataProvider;
|
|
1342
|
+
} else if (options.tenantId) {
|
|
1343
|
+
provider = createSupabasePublicBookingProvider({ tenantId: options.tenantId });
|
|
1344
|
+
} else {
|
|
1345
|
+
if (typeof console !== "undefined") {
|
|
1346
|
+
console.warn(
|
|
1347
|
+
"[plugin-agenda/public] no `tenantId` and no `dataProvider` \u2014 falling back to the seeded MOCK provider. Pass `tenantId` to book against Fayz Cloud, or inject a dataProvider."
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
provider = createMockPublicBookingProvider({
|
|
1351
1351
|
seed: mockSeed,
|
|
1352
1352
|
services: staticServices ?? [],
|
|
1353
1353
|
professionalId: mockProfessionalId
|
|
1354
|
-
})
|
|
1355
|
-
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
1356
|
const base = {
|
|
1357
1357
|
provider,
|
|
1358
1358
|
professionalId,
|
|
@@ -1384,7 +1384,7 @@ function createPublicBookingPlugin(options) {
|
|
|
1384
1384
|
id: "booking",
|
|
1385
1385
|
name: "Agendamento",
|
|
1386
1386
|
icon: "CalendarCheck",
|
|
1387
|
-
version: "0.
|
|
1387
|
+
version: "0.4.0",
|
|
1388
1388
|
scope: options.scope ?? "universal",
|
|
1389
1389
|
verticalId: options.verticalId,
|
|
1390
1390
|
scaffolds: ["website", "landing_page"],
|