@fayz-ai/plugin-shop 0.24.6 → 0.24.7
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-OUV3FITM.js} +17 -6
- package/dist/ShopPage-OUV3FITM.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 +1 -1
- 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;
|
|
@@ -1788,6 +1793,7 @@ function fromSession(session) {
|
|
|
1788
1793
|
}
|
|
1789
1794
|
var shopShipmentsCache = /* @__PURE__ */ new Map();
|
|
1790
1795
|
function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
1796
|
+
const [deliveryStage, setDeliveryStage] = useState(void 0);
|
|
1791
1797
|
const runtime = usePluginRuntimeOptional();
|
|
1792
1798
|
const hasFinancial = (runtime?.activePlugins ?? []).some(
|
|
1793
1799
|
(p) => p.routes?.some((r) => r.path === "/financial")
|
|
@@ -2173,7 +2179,8 @@ function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
|
2173
2179
|
onChanged: () => {
|
|
2174
2180
|
void reloadShipments();
|
|
2175
2181
|
void loadReceivable(true);
|
|
2176
|
-
}
|
|
2182
|
+
},
|
|
2183
|
+
onStage: setDeliveryStage
|
|
2177
2184
|
}
|
|
2178
2185
|
),
|
|
2179
2186
|
/* @__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 +2229,11 @@ function OrderDetailView({ orderId, provider, onBack, fallback }) {
|
|
|
2222
2229
|
}
|
|
2223
2230
|
)
|
|
2224
2231
|
] }, s.id)) }),
|
|
2225
|
-
order.fulfillmentStatus !== "fulfilled" &&
|
|
2232
|
+
order.fulfillmentStatus !== "fulfilled" && deliveryStage !== null && deliveryStage !== void 0 && // A delivery-flow order ships through its steps (Saiu para
|
|
2233
|
+
// entrega creates the shipment and tells the customer); a
|
|
2234
|
+
// second button here would ship it behind the steps' back.
|
|
2235
|
+
/* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: "O envio desta entrega segue os passos do bloco Delivery." }),
|
|
2236
|
+
order.fulfillmentStatus !== "fulfilled" && deliveryStage === null && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2226
2237
|
/* @__PURE__ */ jsx(ShipWithCarrier, { orderId: order.id, provider, onShipped: reloadShipments }),
|
|
2227
2238
|
/* @__PURE__ */ jsx(ShipOrderForm, { orderId: order.id, provider, onShipped: reloadShipments })
|
|
2228
2239
|
] })
|
|
@@ -4313,5 +4324,5 @@ var ShopPage = ({ provider, section }) => {
|
|
|
4313
4324
|
ShopPage.displayName = "ShopPage";
|
|
4314
4325
|
|
|
4315
4326
|
export { ShopOrderDetailSlot, ShopPage };
|
|
4316
|
-
//# sourceMappingURL=ShopPage-
|
|
4317
|
-
//# sourceMappingURL=ShopPage-
|
|
4327
|
+
//# sourceMappingURL=ShopPage-OUV3FITM.js.map
|
|
4328
|
+
//# sourceMappingURL=ShopPage-OUV3FITM.js.map
|