@fayz-ai/plugin-shop 0.10.0 → 0.11.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/{ShopPage-ZBJRNMKQ.js → ShopPage-YB5ZWECJ.js} +16 -32
- package/dist/ShopPage-YB5ZWECJ.js.map +1 -0
- package/dist/analytics/cards.d.ts.map +1 -1
- package/dist/{chunk-EW4XJRA2.js → chunk-HAKXHHAG.js} +52 -5
- package/dist/chunk-HAKXHHAG.js.map +1 -0
- package/dist/data/productDataProvider.d.ts.map +1 -1
- package/dist/data/shared.d.ts +12 -2
- package/dist/data/shared.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +213 -13
- package/dist/index.js.map +1 -1
- package/dist/integrations/vindi/connectorDef.d.ts +76 -0
- package/dist/integrations/vindi/connectorDef.d.ts.map +1 -0
- package/dist/views/NewOrderPage.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/ShopPage-ZBJRNMKQ.js.map +0 -1
- package/dist/chunk-EW4XJRA2.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { errorMessage, buildStockLocationsRegistry } from './chunk-
|
|
1
|
+
import { errorMessage, shopCustomerLookup, listProductsDetailed, invalidateProductLists, buildStockLocationsRegistry } from './chunk-HAKXHHAG.js';
|
|
2
2
|
import React2, { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
3
3
|
import { Thumbnail, Button, DataTable, toast, ConfirmDialog, formatPhone, SearchSelect, Modal, ModalPortal, ModalOverlay, ModalContent, ModalHeader, ModalTitle, ModalBody, ModalFooter, Skeleton, PhoneField } from '@fayz-ai/ui';
|
|
4
4
|
import { Minus, Plus, Trash2, CreditCard, XCircle, ShoppingBag, Package, Wallet, X, Pencil, MapPin, Search, Check, Copy, MessageCircle, CheckCircle2, Printer, RefreshCw, ExternalLink, Truck, AlertTriangle, Loader2 } from 'lucide-react';
|
|
@@ -7,31 +7,6 @@ import { useAdminPath, adminNavigateTo, OrderFormBlock, OrderFormView, OrderDeta
|
|
|
7
7
|
import { usePluginRuntimeOptional, getSupabaseClientOptional } from '@fayz-ai/core';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
|
-
// src/views/customerLookup.ts
|
|
11
|
-
function shopCustomerLookup(provider) {
|
|
12
|
-
return {
|
|
13
|
-
async getById(id) {
|
|
14
|
-
const c = await provider().getCustomer(id);
|
|
15
|
-
if (!c) return null;
|
|
16
|
-
const name = [c.firstName, c.lastName].filter(Boolean).join(" ");
|
|
17
|
-
return {
|
|
18
|
-
id: c.id,
|
|
19
|
-
label: name || c.email || "Cliente",
|
|
20
|
-
subtitle: c.email ?? void 0,
|
|
21
|
-
group: "shop_customer",
|
|
22
|
-
// PersonLink reads contact fields off `data`, so the keys must match the
|
|
23
|
-
// shape it expects (email/phone), not our camelCase type.
|
|
24
|
-
data: {
|
|
25
|
-
email: c.email ?? void 0,
|
|
26
|
-
phone: c.phone ?? void 0,
|
|
27
|
-
kind: "shop_customer",
|
|
28
|
-
orders_count: c.ordersCount,
|
|
29
|
-
total_spent: c.totalSpent
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
10
|
function ShipOrderForm({ orderId, provider, onShipped }) {
|
|
36
11
|
const [open, setOpen] = useState(false);
|
|
37
12
|
const [carrier, setCarrier] = useState("");
|
|
@@ -1210,7 +1185,7 @@ function OrderDetailView({ orderId, provider, onBack }) {
|
|
|
1210
1185
|
personId: order.customerId,
|
|
1211
1186
|
name: order.customerName ?? order.customerEmail ?? "Cliente",
|
|
1212
1187
|
lookup: shopCustomerLookup(provider),
|
|
1213
|
-
|
|
1188
|
+
kind: "shop_customer",
|
|
1214
1189
|
className: "font-medium"
|
|
1215
1190
|
}
|
|
1216
1191
|
) : /* @__PURE__ */ jsx("p", { className: "font-medium", children: order.customerName ?? "\u2014" }),
|
|
@@ -1951,8 +1926,15 @@ function NewOrderPage({ provider, onDone, onCancel }) {
|
|
|
1951
1926
|
}
|
|
1952
1927
|
function ProductPicker({ provider, onPick, currency: currency2 }) {
|
|
1953
1928
|
const [open, setOpen] = useState(false);
|
|
1929
|
+
const [fromCache, setFromCache] = useState(false);
|
|
1954
1930
|
const search = useCallback(
|
|
1955
|
-
|
|
1931
|
+
// Same cache funnel as the products page: a catalogue the merchant just
|
|
1932
|
+
// browsed answers the picker without a round-trip.
|
|
1933
|
+
async (term) => {
|
|
1934
|
+
const answer = await listProductsDetailed(provider, { search: term || void 0, status: "active", limit: 20 });
|
|
1935
|
+
setFromCache(Boolean(answer.cached || answer.stale));
|
|
1936
|
+
return answer.rows;
|
|
1937
|
+
},
|
|
1956
1938
|
[provider]
|
|
1957
1939
|
);
|
|
1958
1940
|
async function add(products) {
|
|
@@ -2000,7 +1982,9 @@ function ProductPicker({ provider, onPick, currency: currency2 }) {
|
|
|
2000
1982
|
}),
|
|
2001
1983
|
onConfirm: (products) => {
|
|
2002
1984
|
void add(products);
|
|
2003
|
-
}
|
|
1985
|
+
},
|
|
1986
|
+
onRefresh: invalidateProductLists,
|
|
1987
|
+
fromCache
|
|
2004
1988
|
}
|
|
2005
1989
|
)
|
|
2006
1990
|
] });
|
|
@@ -2701,7 +2685,7 @@ function OrdersTab({ provider }) {
|
|
|
2701
2685
|
personId: o.customerId,
|
|
2702
2686
|
name: label,
|
|
2703
2687
|
lookup: shopCustomerLookup(() => resolveShopProvider(provider)),
|
|
2704
|
-
|
|
2688
|
+
kind: "shop_customer"
|
|
2705
2689
|
}
|
|
2706
2690
|
);
|
|
2707
2691
|
}
|
|
@@ -2938,5 +2922,5 @@ var ShopPage = ({ provider, section }) => {
|
|
|
2938
2922
|
ShopPage.displayName = "ShopPage";
|
|
2939
2923
|
|
|
2940
2924
|
export { ShopPage };
|
|
2941
|
-
//# sourceMappingURL=ShopPage-
|
|
2942
|
-
//# sourceMappingURL=ShopPage-
|
|
2925
|
+
//# sourceMappingURL=ShopPage-YB5ZWECJ.js.map
|
|
2926
|
+
//# sourceMappingURL=ShopPage-YB5ZWECJ.js.map
|