@fayz-ai/plugin-shop 0.24.6 → 0.24.8
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-NARKHXOO.js → ShopPage-Z4MF334D.js} +22 -7
- package/dist/ShopPage-Z4MF334D.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/views/OrderDeliveryPanel.d.ts +3 -1
- package/dist/views/OrderDeliveryPanel.d.ts.map +1 -1
- package/dist/views/OrderDetailView.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/ShopPage-NARKHXOO.js.map +0 -1
|
@@ -907,7 +907,7 @@ var NOTICE_STATUS = {
|
|
|
907
907
|
function when(iso) {
|
|
908
908
|
return iso ? new Date(iso).toLocaleString("pt-BR", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" }) : "";
|
|
909
909
|
}
|
|
910
|
-
function OrderDeliveryPanel({ orderId, paid, total, money: money5, onChanged }) {
|
|
910
|
+
function OrderDeliveryPanel({ orderId, paid, total, money: money5, onChanged, onStage }) {
|
|
911
911
|
const [ext, setExt] = React7__default.useState(null);
|
|
912
912
|
const [notices, setNotices] = React7__default.useState([]);
|
|
913
913
|
const [refunds, setRefunds] = React7__default.useState([]);
|
|
@@ -918,7 +918,10 @@ function OrderDeliveryPanel({ orderId, paid, total, money: money5, onChanged })
|
|
|
918
918
|
const [error, setError] = React7__default.useState(null);
|
|
919
919
|
React7__default.useEffect(() => {
|
|
920
920
|
const db = getSupabaseClientOptional();
|
|
921
|
-
if (!db)
|
|
921
|
+
if (!db) {
|
|
922
|
+
onStage?.(null);
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
922
925
|
let cancelled = false;
|
|
923
926
|
void Promise.all([
|
|
924
927
|
db.from("plg_shop_order_extensions").select("delivery_stage, accepted_at, dispatched_at, delivered_at, rejected_at, reject_reason, fulfillment_type").eq("order_id", orderId).maybeSingle(),
|
|
@@ -927,9 +930,11 @@ function OrderDeliveryPanel({ orderId, paid, total, money: money5, onChanged })
|
|
|
927
930
|
]).then(([e, n, r]) => {
|
|
928
931
|
if (cancelled) return;
|
|
929
932
|
setExt(e?.data ?? null);
|
|
933
|
+
onStage?.((e?.data ?? null)?.delivery_stage ?? null);
|
|
930
934
|
setNotices(n?.data ?? []);
|
|
931
935
|
setRefunds(r?.data ?? []);
|
|
932
936
|
}).catch(() => {
|
|
937
|
+
if (!cancelled) onStage?.(null);
|
|
933
938
|
});
|
|
934
939
|
return () => {
|
|
935
940
|
cancelled = true;
|
|
@@ -1706,6 +1711,10 @@ var SHIPMENT_LABEL = {
|
|
|
1706
1711
|
returned: "Devolvido",
|
|
1707
1712
|
cancelled: "Cancelado"
|
|
1708
1713
|
};
|
|
1714
|
+
function receivableRoute(bills) {
|
|
1715
|
+
const bill = (bills ?? [])[0];
|
|
1716
|
+
return bill?.financial_invoice_id ? `/financial/receivables/detail/${bill.financial_invoice_id}` : "/financial/receivables/list";
|
|
1717
|
+
}
|
|
1709
1718
|
function toModalInstallment(bill) {
|
|
1710
1719
|
return {
|
|
1711
1720
|
id: bill.id,
|
|
@@ -1788,6 +1797,7 @@ function fromSession(session) {
|
|
|
1788
1797
|
}
|
|
1789
1798
|
var shopShipmentsCache = /* @__PURE__ */ new Map();
|
|
1790
1799
|
function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
1800
|
+
const [deliveryStage, setDeliveryStage] = useState(void 0);
|
|
1791
1801
|
const runtime = usePluginRuntimeOptional();
|
|
1792
1802
|
const hasFinancial = (runtime?.activePlugins ?? []).some(
|
|
1793
1803
|
(p) => p.routes?.some((r) => r.path === "/financial")
|
|
@@ -2154,7 +2164,7 @@ function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
|
2154
2164
|
variant: "bare",
|
|
2155
2165
|
size: "bare",
|
|
2156
2166
|
type: "button",
|
|
2157
|
-
onClick: () => adminNavigateTo(
|
|
2167
|
+
onClick: () => adminNavigateTo(receivableRoute(receivable?.bills)),
|
|
2158
2168
|
className: "rounded-md border px-3 py-1.5 text-sm font-medium transition hover:bg-muted",
|
|
2159
2169
|
children: "Abrir no Financeiro"
|
|
2160
2170
|
}
|
|
@@ -2173,7 +2183,8 @@ function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
|
2173
2183
|
onChanged: () => {
|
|
2174
2184
|
void reloadShipments();
|
|
2175
2185
|
void loadReceivable(true);
|
|
2176
|
-
}
|
|
2186
|
+
},
|
|
2187
|
+
onStage: setDeliveryStage
|
|
2177
2188
|
}
|
|
2178
2189
|
),
|
|
2179
2190
|
/* @__PURE__ */ jsx(OrderDetailBlock, { title: "Entrega", hint: "O que a log\xEDstica precisa", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 text-sm", children: [
|
|
@@ -2222,7 +2233,11 @@ function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
|
2222
2233
|
}
|
|
2223
2234
|
)
|
|
2224
2235
|
] }, s.id)) }),
|
|
2225
|
-
order.fulfillmentStatus !== "fulfilled" &&
|
|
2236
|
+
order.fulfillmentStatus !== "fulfilled" && deliveryStage !== null && deliveryStage !== void 0 && // A delivery-flow order ships through its steps (Saiu para
|
|
2237
|
+
// entrega creates the shipment and tells the customer); a
|
|
2238
|
+
// second button here would ship it behind the steps' back.
|
|
2239
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: "O envio desta entrega segue os passos do bloco Delivery." }),
|
|
2240
|
+
order.fulfillmentStatus !== "fulfilled" && deliveryStage === null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2226
2241
|
/* @__PURE__ */ jsx(ShipWithCarrier, { orderId: order.id, provider, onShipped: reloadShipments }),
|
|
2227
2242
|
/* @__PURE__ */ jsx(ShipOrderForm, { orderId: order.id, provider, onShipped: reloadShipments })
|
|
2228
2243
|
] })
|
|
@@ -4313,5 +4328,5 @@ var ShopPage = ({ provider, section }) => {
|
|
|
4313
4328
|
ShopPage.displayName = "ShopPage";
|
|
4314
4329
|
|
|
4315
4330
|
export { ShopOrderDetailSlot, ShopPage };
|
|
4316
|
-
//# sourceMappingURL=ShopPage-
|
|
4317
|
-
//# sourceMappingURL=ShopPage-
|
|
4331
|
+
//# sourceMappingURL=ShopPage-Z4MF334D.js.map
|
|
4332
|
+
//# sourceMappingURL=ShopPage-Z4MF334D.js.map
|