@fayz-ai/plugin-shop 0.15.11 → 0.16.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/dist/index.js +30 -26
- package/dist/index.js.map +1 -1
- package/dist/views/ContentPage.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as React13 from 'react';
|
|
|
3
3
|
import React13__default, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
4
4
|
import { createConnectionStore, connectionSettings, connectionStatus, settingsStatus, connectionRuns, tl, getActiveTenantId, getSupabaseClientOptional, registerMessageDefaults, connectorRuntimeToken, CONNECTOR_RUNTIME_TOKEN_HEADER, countByTenant, errorMessage as errorMessage$1, emitDataChanged, resolveDataProvider } from '@fayz-ai/core';
|
|
5
5
|
import { getShopTenantId, setShopTenantResolver, buildShopMessageDefaults, registerShippingLabelProvider, getShopProvider, buildShopDomainEvents, axesFromOptions, planVariantMatrix, validateVariantAxes, hasOnlyDefaultVariant, MAX_VARIANT_AXES, leavesNothingSellable, productImageToMediaFile, formatVariantCombination, applyVariantMatrix } from '@fayz-ai/shop';
|
|
6
|
-
import { fayzConnectorOAuth, describeConnectorAccount, useOrganizationStore, registerEntityPath, registerPersonLookup, createCrudPage, adminNavigateTo, DetailTabHeader, useAgentSurface, askAI, AskAIButton, CrudFormPage, SettingsGroup, SelectRow, ToggleRow, useConnectors, useConnectorsPanelAvailable, openConnectorsPanel, MultiSelectRow, AddConnectorButton, AddConnectorPanel, ConnectorDetail, RegistryCrudView, TextRow, ConnectorRow, ConnectorMark, StateChip } from '@fayz-ai/admin';
|
|
7
|
-
import { Package, Eye, FileEdit, PackageX, UsersRound, Users, UserX, Filter, ShoppingBag, Repeat, CircleDollarSign, Tag, TicketCheck, Layers, CreditCard, ImageOff, Plus, Loader2, WandSparkles, ChevronLeft, ChevronRight, Download, RefreshCw, Trash2,
|
|
6
|
+
import { fayzConnectorOAuth, describeConnectorAccount, useOrganizationStore, registerEntityPath, registerPersonLookup, createCrudPage, adminNavigateTo, PageActions, DetailTabHeader, useAgentSurface, askAI, AskAIButton, CrudFormPage, SettingsGroup, SelectRow, ToggleRow, useConnectors, useConnectorsPanelAvailable, openConnectorsPanel, MultiSelectRow, AddConnectorButton, AddConnectorPanel, ConnectorDetail, RegistryCrudView, TextRow, ConnectorRow, ConnectorMark, StateChip } from '@fayz-ai/admin';
|
|
7
|
+
import { Package, Eye, FileEdit, PackageX, UsersRound, Users, UserX, Filter, ShoppingBag, Repeat, CircleDollarSign, Tag, TicketCheck, Layers, CreditCard, Upload, ImageOff, Plus, Loader2, WandSparkles, ChevronLeft, ChevronRight, Download, RefreshCw, Trash2, AlertTriangle, X, ExternalLink, Box, ChevronDown, Film, FileText, Warehouse, ArrowRight, MapPin, Car, Truck, Info, Check, Sparkles, Ban, ListChecks, Search, Building2 } from 'lucide-react';
|
|
8
8
|
import { PageHeaderActions, PageTabs, Card, Button, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalFooter, Thumbnail, PageHeader, toast, ConfirmDialog, Hint, ModalBody, Skeleton } from '@fayz-ai/ui';
|
|
9
9
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
10
|
import { listStockReasonCodes, resolveStockStore, createSupabaseStockStore } from '@fayz-ai/shop/inventory';
|
|
@@ -6462,6 +6462,7 @@ function ContentPage({ resolveProvider }) {
|
|
|
6462
6462
|
const [replacing, setReplacing] = React13__default.useState(false);
|
|
6463
6463
|
const [openId, setOpenId] = React13__default.useState(null);
|
|
6464
6464
|
const [dimensions, setDimensions] = React13__default.useState({});
|
|
6465
|
+
const uploadInputRef = React13__default.useRef(null);
|
|
6465
6466
|
const reload = React13__default.useCallback(async () => {
|
|
6466
6467
|
if (!provider.listMediaFiles) {
|
|
6467
6468
|
setFiles([]);
|
|
@@ -6579,6 +6580,16 @@ function ContentPage({ resolveProvider }) {
|
|
|
6579
6580
|
`${files.length} ${files.length === 1 ? "arquivo" : "arquivos"}`,
|
|
6580
6581
|
productCount > 0 ? `${productCount} ${productCount === 1 ? "de produto" : "de produtos"}` : ""
|
|
6581
6582
|
].filter(Boolean).join(" \xB7 ");
|
|
6583
|
+
const uploadActions = [{
|
|
6584
|
+
id: "upload",
|
|
6585
|
+
label: uploading ? "Enviando\u2026" : "Enviar arquivos",
|
|
6586
|
+
icon: Upload,
|
|
6587
|
+
intent: "primary",
|
|
6588
|
+
// It puts a new file in the library — the FAB is a "+", not a "⋮".
|
|
6589
|
+
creates: true,
|
|
6590
|
+
disabled: uploading,
|
|
6591
|
+
onSelect: () => uploadInputRef.current?.click()
|
|
6592
|
+
}];
|
|
6582
6593
|
const renderGrid = (list) => /* @__PURE__ */ jsx("div", { className: "fz-cards gap-4", children: list.map((file) => /* @__PURE__ */ jsx(
|
|
6583
6594
|
MediaCard,
|
|
6584
6595
|
{
|
|
@@ -6591,7 +6602,23 @@ function ContentPage({ resolveProvider }) {
|
|
|
6591
6602
|
file.id
|
|
6592
6603
|
)) });
|
|
6593
6604
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
6594
|
-
supported && provider.uploadMediaFile && /* @__PURE__ */
|
|
6605
|
+
supported && provider.uploadMediaFile && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6606
|
+
/* @__PURE__ */ jsx(
|
|
6607
|
+
"input",
|
|
6608
|
+
{
|
|
6609
|
+
ref: uploadInputRef,
|
|
6610
|
+
type: "file",
|
|
6611
|
+
multiple: true,
|
|
6612
|
+
className: "hidden",
|
|
6613
|
+
onChange: (e) => {
|
|
6614
|
+
void handleUpload(e.target.files).finally(() => {
|
|
6615
|
+
if (uploadInputRef.current) uploadInputRef.current.value = "";
|
|
6616
|
+
});
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
),
|
|
6620
|
+
/* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsx(PageActions, { actions: uploadActions }) })
|
|
6621
|
+
] }),
|
|
6595
6622
|
/* @__PURE__ */ jsx(
|
|
6596
6623
|
PageTabs,
|
|
6597
6624
|
{
|
|
@@ -6666,29 +6693,6 @@ function SectionTitle({ title, count }) {
|
|
|
6666
6693
|
] })
|
|
6667
6694
|
] });
|
|
6668
6695
|
}
|
|
6669
|
-
function UploadButton({ uploading, onPick }) {
|
|
6670
|
-
const inputRef = React13__default.useRef(null);
|
|
6671
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6672
|
-
/* @__PURE__ */ jsx(
|
|
6673
|
-
"input",
|
|
6674
|
-
{
|
|
6675
|
-
ref: inputRef,
|
|
6676
|
-
type: "file",
|
|
6677
|
-
multiple: true,
|
|
6678
|
-
className: "hidden",
|
|
6679
|
-
onChange: (e) => {
|
|
6680
|
-
void onPick(e.target.files).finally(() => {
|
|
6681
|
-
if (inputRef.current) inputRef.current.value = "";
|
|
6682
|
-
});
|
|
6683
|
-
}
|
|
6684
|
-
}
|
|
6685
|
-
),
|
|
6686
|
-
/* @__PURE__ */ jsxs(Button, { onClick: () => inputRef.current?.click(), disabled: uploading, children: [
|
|
6687
|
-
/* @__PURE__ */ jsx(Upload, { className: "mr-2 h-4 w-4" }),
|
|
6688
|
-
uploading ? "Enviando\u2026" : "Enviar arquivos"
|
|
6689
|
-
] })
|
|
6690
|
-
] });
|
|
6691
|
-
}
|
|
6692
6696
|
function KindIcon({ kind, className }) {
|
|
6693
6697
|
const Icon = kind === "video" ? Film : FileText;
|
|
6694
6698
|
return /* @__PURE__ */ jsx(Icon, { className });
|