@fayz-ai/plugin-inventory 0.13.0 → 0.13.2
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.js +12 -15
- package/dist/index.js.map +1 -1
- package/dist/views/InventoryPage.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React3, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
2
2
|
import { toast, defineKpiWidget, defineCustomWidget, PageTransition, ModulePage, Button, SubpageHeader, SearchSelect, cn, DatePicker, ListView, ConfirmDialog, Badge, DraftCommitBar, Switch, useSaveBar, DataTable, DashboardCanvas, Thumbnail, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, StockEntryForm, KpiCard, Card, CardHeader, CardTitle, CardContent, Skeleton } from '@fayz-ai/ui';
|
|
3
|
-
import { createPluginContext, PluginSettingsPanel, dedup, useTenantPluginSettings, useModuleNavigation, createViewRouter, ModuleActionBar, SettingsGroup, ToggleRow, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, formatCurrency, useAgentSurface, askAI, PermissionGate, QuickActionsButton, invalidateLimit } from '@fayz-ai/admin';
|
|
3
|
+
import { createPluginContext, PluginSettingsPanel, dedup, useTenantPluginSettings, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, SettingsGroup, ToggleRow, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, formatCurrency, useAgentSurface, askAI, PermissionGate, QuickActionsButton, invalidateLimit } from '@fayz-ai/admin';
|
|
4
4
|
import { createSafeDataProvider, registerTranslations, countByTenant, useTranslation, getActiveUnitId, createPendingCommand, errorMessage, useDataChanged, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { Trash2, ArrowRightLeft, RefreshCw, ArrowUpRight, ArrowDownRight, Package, Ruler, MapPin, Loader2, Check, ChevronRight, CircleSlash, CircleCheck, ListFilter, CalendarRange, PackageCheck, ClipboardCheck, AlertTriangle, Plus, BookOpen, Layers, Clock, Coins, Building2, Undo2, PackageX } from 'lucide-react';
|
|
@@ -3552,24 +3552,18 @@ function InventoryPage({ config: appConfig, provider, store, registries }) {
|
|
|
3552
3552
|
"recipes-detail": 1,
|
|
3553
3553
|
settings: 1
|
|
3554
3554
|
}, "dashboard");
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
}
|
|
3561
|
-
});
|
|
3555
|
+
const checkExistingData = React3.useCallback(
|
|
3556
|
+
async () => (await provider.getProducts({ pageSize: 1 })).total > 0,
|
|
3557
|
+
[provider]
|
|
3558
|
+
);
|
|
3559
|
+
const onboarding = usePluginOnboardingGate("saas-core:inventory-onboarded", checkExistingData);
|
|
3562
3560
|
const isSettings = view === "settings";
|
|
3563
3561
|
const isSummary = view === "dashboard" || view === "";
|
|
3564
3562
|
const nav = buildNav(config, view, navigate, t2);
|
|
3565
3563
|
const completeOnboarding = React3.useCallback(async () => {
|
|
3566
3564
|
await provider.ensureReferenceData?.();
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
localStorage.setItem("saas-core:inventory-onboarded", "true");
|
|
3570
|
-
} catch {
|
|
3571
|
-
}
|
|
3572
|
-
}, [provider]);
|
|
3565
|
+
onboarding.complete();
|
|
3566
|
+
}, [provider, onboarding.complete]);
|
|
3573
3567
|
const quickActions = useMemo(() => {
|
|
3574
3568
|
const actions = [
|
|
3575
3569
|
// Dropped with the catalogue module: offering "new product" while the
|
|
@@ -3598,7 +3592,10 @@ function InventoryPage({ config: appConfig, provider, store, registries }) {
|
|
|
3598
3592
|
];
|
|
3599
3593
|
return actions;
|
|
3600
3594
|
}, []);
|
|
3601
|
-
if (
|
|
3595
|
+
if (isSummary && onboarding.status === "checking") {
|
|
3596
|
+
return /* @__PURE__ */ jsx(InventoryContextProvider, { config, provider, store, children: /* @__PURE__ */ jsx(PluginOnboardingGateSkeleton, {}) });
|
|
3597
|
+
}
|
|
3598
|
+
if (isSummary && onboarding.status === "needed") {
|
|
3602
3599
|
return /* @__PURE__ */ jsx(InventoryContextProvider, { config, provider, store, children: /* @__PURE__ */ jsx(InventoryOnboarding, { onComplete: completeOnboarding }) });
|
|
3603
3600
|
}
|
|
3604
3601
|
if (isSettings && registries && registries.length > 0) {
|