@mercurjs/vendor 2.2.0-canary.46 → 2.2.0-canary.47

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.
@@ -54,6 +54,7 @@ import {
54
54
  import { Heading } from "@medusajs/ui";
55
55
  import { useTranslation as useTranslation2 } from "react-i18next";
56
56
  import { useParams } from "react-router-dom";
57
+ import { linkFields, useExtension } from "@mercurjs/dashboard-shared";
57
58
 
58
59
  // src/pages/products/[id]/edit/edit-product-form/edit-product-form.tsx
59
60
  var import_types = __toESM(require_dist(), 1);
@@ -230,7 +231,11 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
230
231
  var Component = () => {
231
232
  const { id } = useParams();
232
233
  const { t } = useTranslation2();
233
- const { product, isLoading, isError, error } = useProduct(id);
234
+ const links = useExtension().getLinks("product");
235
+ const { product, isLoading, isError, error } = useProduct(
236
+ id,
237
+ links.length ? { fields: linkFields(links) } : void 0
238
+ );
234
239
  if (isError) {
235
240
  throw error;
236
241
  }
@@ -71,6 +71,7 @@ import { toast as toast4 } from "@medusajs/ui";
71
71
  import { useEffect } from "react";
72
72
  import { useTranslation as useTranslation7 } from "react-i18next";
73
73
  import { useNavigate, useParams } from "react-router-dom";
74
+ import { useExtension, withLinkFields } from "@mercurjs/dashboard-shared";
74
75
 
75
76
  // src/pages/orders/[id]/edit/_components/order-edit-create-form/order-edit-create-form.tsx
76
77
  import { zodResolver } from "@hookform/resolvers/zod";
@@ -824,13 +825,17 @@ var Component = () => {
824
825
  const navigate = useNavigate();
825
826
  const { t } = useTranslation7();
826
827
  const orderId = id ?? "";
828
+ const links = useExtension().getLinks("order");
827
829
  const { order } = useOrder(orderId, {
828
830
  // Use the `<rel>.*` suffix form. Combining `*foo` with `*foo.bar`
829
831
  // (or the `+foo.bar.baz` form) makes Medusa's query parser try to
830
832
  // look up a literal property called `*items` / `+items` on Order
831
833
  // and 500. See packages/core/src/api/vendor/orders/query-config.ts
832
834
  // for the matching guidance applied to the defaults.
833
- fields: "currency_code,total,items.*,items.variant.*"
835
+ fields: withLinkFields(
836
+ "currency_code,total,items.*,items.variant.*",
837
+ links
838
+ )
834
839
  });
835
840
  const { order: preview } = useOrderPreview(orderId);
836
841
  const { mutateAsync: createOrderEdit } = useCreateOrderEdit(orderId);
package/dist/index.js CHANGED
@@ -2968,7 +2968,7 @@ function getRouteMap({
2968
2968
  children: [
2969
2969
  {
2970
2970
  path: "edit",
2971
- lazy: () => import("./edit-QWNPRSN4.js")
2971
+ lazy: () => import("./edit-QAEVZCLC.js")
2972
2972
  },
2973
2973
  {
2974
2974
  path: "edit-variant",
@@ -3109,7 +3109,7 @@ function getRouteMap({
3109
3109
  },
3110
3110
  {
3111
3111
  path: "edit",
3112
- lazy: () => import("./edit-QC2NDPFQ.js")
3112
+ lazy: () => import("./edit-ZGMYP6EK.js")
3113
3113
  },
3114
3114
  {
3115
3115
  path: "exchanges/create",
@@ -3812,7 +3812,7 @@ function getRouteMap({
3812
3812
  {
3813
3813
  path: "",
3814
3814
  lazy: async () => {
3815
- const { StoreDetailPage } = await import("./store-XYSWOMLU.js");
3815
+ const { StoreDetailPage } = await import("./store-UF2WKDSZ.js");
3816
3816
  return { Component: StoreDetailPage };
3817
3817
  },
3818
3818
  children: [
@@ -42,6 +42,7 @@ import "./chunk-PUAWN7SS.js";
42
42
  import {
43
43
  membersQueryKeys,
44
44
  useMe,
45
+ useSeller,
45
46
  useUpdateSeller
46
47
  } from "./chunk-4NADEZZQ.js";
47
48
  import "./chunk-XWHHBJGS.js";
@@ -71,7 +72,11 @@ import {
71
72
  import { Children as Children3 } from "react";
72
73
  import { Alert, Text as Text5 } from "@medusajs/ui";
73
74
  import { useTranslation as useTranslation7 } from "react-i18next";
74
- import { WidgetZone } from "@mercurjs/dashboard-shared";
75
+ import {
76
+ WidgetZone,
77
+ useExtension,
78
+ useLinkQuery
79
+ } from "@mercurjs/dashboard-shared";
75
80
  var import_types2 = __toESM(require_dist(), 1);
76
81
 
77
82
  // src/pages/settings/store/_components/store-address-section.tsx
@@ -593,16 +598,28 @@ var StoreProfessionalDetailsSection = ({
593
598
 
594
599
  // src/pages/settings/store/store-detail-page.tsx
595
600
  import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
601
+ var ME_SELLER_FIELDS = "+seller.*,+seller.address.*,+seller.payment_details.*,+seller.professional_details.*";
602
+ var SELLER_DETAIL_FIELDS = "+address.*,+payment_details.*,+professional_details.*";
596
603
  var Root = ({ children }) => {
597
604
  const { t } = useTranslation7();
598
- const { seller_member, isPending, isError, error } = useMe();
599
- const seller = seller_member?.seller;
600
- if (isPending || !seller) {
601
- return /* @__PURE__ */ jsx7(TwoColumnPageSkeleton, { mainSections: 3, sidebarSections: 3 });
602
- }
605
+ const { seller_member, isPending, isError, error } = useMe({
606
+ fields: ME_SELLER_FIELDS
607
+ });
608
+ const meSeller = seller_member?.seller;
609
+ const needsLinks = useExtension().getLinks("seller").length > 0;
610
+ const query = useLinkQuery("seller", SELLER_DETAIL_FIELDS);
611
+ const { seller: linkedSeller, isPending: linkedPending } = useSeller(
612
+ meSeller?.id ?? "",
613
+ query,
614
+ { enabled: needsLinks && !!meSeller?.id }
615
+ );
616
+ const seller = needsLinks ? linkedSeller : meSeller;
603
617
  if (isError) {
604
618
  throw error;
605
619
  }
620
+ if (isPending || !seller || needsLinks && linkedPending) {
621
+ return /* @__PURE__ */ jsx7(TwoColumnPageSkeleton, { mainSections: 3, sidebarSections: 3 });
622
+ }
606
623
  const statusAlert = (() => {
607
624
  switch (seller.status) {
608
625
  case import_types2.SellerStatus.TERMINATED:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mercurjs/vendor",
3
- "version": "2.2.0-canary.46",
3
+ "version": "2.2.0-canary.47",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mercurjs/mercur",
@@ -34,8 +34,8 @@
34
34
  "lint": "oxlint --max-warnings 0"
35
35
  },
36
36
  "dependencies": {
37
- "@mercurjs/dashboard-shared": "2.2.0-canary.46",
38
- "@mercurjs/client": "2.2.0-canary.46",
37
+ "@mercurjs/dashboard-shared": "2.2.0-canary.47",
38
+ "@mercurjs/client": "2.2.0-canary.47",
39
39
  "@ariakit/react": "^0.4.15",
40
40
  "@babel/runtime": "^7.26.10",
41
41
  "@dnd-kit/core": "^6.1.0",
@@ -88,8 +88,8 @@
88
88
  "tsup": "^8.0.2",
89
89
  "typescript": "5.9.3",
90
90
  "@medusajs/types": "2.17.2",
91
- "@mercurjs/core": "2.2.0-canary.46",
92
- "@mercurjs/dashboard-sdk": "2.2.0-canary.46",
93
- "@mercurjs/types": "2.2.0-canary.46"
91
+ "@mercurjs/core": "2.2.0-canary.47",
92
+ "@mercurjs/dashboard-sdk": "2.2.0-canary.47",
93
+ "@mercurjs/types": "2.2.0-canary.47"
94
94
  }
95
95
  }