@medusajs/dashboard 2.10.4-preview-20250924060154 → 2.10.4-preview-20250924120212

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.
Files changed (138) hide show
  1. package/dist/{add-campaign-promotions-BWIP24MA.mjs → add-campaign-promotions-APV4J7Z2.mjs} +4 -4
  2. package/dist/{api-key-management-detail-WGWZQCFC.mjs → api-key-management-detail-P2CXWYQG.mjs} +2 -2
  3. package/dist/{api-key-management-sales-channels-H5TVIHTV.mjs → api-key-management-sales-channels-ESGRJKDT.mjs} +1 -1
  4. package/dist/app.css +0 -3
  5. package/dist/app.js +3533 -3527
  6. package/dist/app.mjs +3 -3
  7. package/dist/{campaign-budget-edit-OXNTSPGE.mjs → campaign-budget-edit-UWGCET5Z.mjs} +1 -1
  8. package/dist/{campaign-configuration-Z5HA2DG3.mjs → campaign-configuration-WWCCFNYQ.mjs} +1 -1
  9. package/dist/{campaign-create-GRKYQY5D.mjs → campaign-create-CQ3XBHSY.mjs} +2 -2
  10. package/dist/{campaign-detail-EJD7LQCW.mjs → campaign-detail-CBO7PBOR.mjs} +4 -4
  11. package/dist/{campaign-edit-3TDW52BO.mjs → campaign-edit-R43GXNET.mjs} +1 -1
  12. package/dist/{campaign-list-IDPRC2MD.mjs → campaign-list-CDO5PRTL.mjs} +1 -1
  13. package/dist/{categories-metadata-JFNWZA5D.mjs → categories-metadata-HNABPXTE.mjs} +1 -1
  14. package/dist/{category-detail-CL3XCV7E.mjs → category-detail-JUKMFR4W.mjs} +1 -1
  15. package/dist/{category-products-UZEG63WY.mjs → category-products-CWLUKUVK.mjs} +1 -1
  16. package/dist/{chunk-U2FXUMKA.mjs → chunk-3S523T5F.mjs} +1 -1
  17. package/dist/{chunk-FUQ27NT5.mjs → chunk-5FAWKUSU.mjs} +1 -1
  18. package/dist/{chunk-OQPVQGSH.mjs → chunk-7GBCLBMX.mjs} +24 -11
  19. package/dist/{chunk-LJDVFJK7.mjs → chunk-AXXGAOQL.mjs} +1 -1
  20. package/dist/{chunk-CAZKNJTG.mjs → chunk-FGF5B6J4.mjs} +112 -112
  21. package/dist/{chunk-4CGHNQP2.mjs → chunk-G3VGLFVH.mjs} +47 -47
  22. package/dist/{chunk-YPSSUJUZ.mjs → chunk-KTBA6OOV.mjs} +7 -3
  23. package/dist/{chunk-2252SSK6.mjs → chunk-NUA3JO5E.mjs} +1 -1
  24. package/dist/{chunk-ZODJNBAV.mjs → chunk-R2G2B47Y.mjs} +1 -0
  25. package/dist/{chunk-V53HAFWH.mjs → chunk-TEMN4ESF.mjs} +1 -1
  26. package/dist/{chunk-6RWF7BPW.mjs → chunk-V6JXTITD.mjs} +1 -1
  27. package/dist/{chunk-WP5CXGGO.mjs → chunk-ZWWM2OU2.mjs} +1 -1
  28. package/dist/{collection-add-products-QTFBLLND.mjs → collection-add-products-E22XLIP7.mjs} +1 -1
  29. package/dist/{collection-detail-ZEAUSZBJ.mjs → collection-detail-LOJ6WZLT.mjs} +1 -1
  30. package/dist/{collection-list-V27JHDAD.mjs → collection-list-KKEZLFLJ.mjs} +1 -1
  31. package/dist/{collection-metadata-JAEMZMU6.mjs → collection-metadata-MEA56JQC.mjs} +1 -1
  32. package/dist/{customer-detail-YBOM6KGC.mjs → customer-detail-Z5TU254N.mjs} +1 -1
  33. package/dist/{customer-group-detail-72VFORGF.mjs → customer-group-detail-VCRUQIYD.mjs} +1 -1
  34. package/dist/{customer-group-list-UTC5ZCJZ.mjs → customer-group-list-MCQ4AUJF.mjs} +2 -2
  35. package/dist/{customers-add-customer-group-ZUCFXW2U.mjs → customers-add-customer-group-X3VHASZ6.mjs} +1 -1
  36. package/dist/{edit-rules-RY7JMYLR.mjs → edit-rules-SVG7IOSY.mjs} +2 -2
  37. package/dist/{inventory-create-F5PSTEN2.mjs → inventory-create-DR5LNYQB.mjs} +1 -1
  38. package/dist/{inventory-detail-BO5E7KXO.mjs → inventory-detail-D4MBCFS2.mjs} +2 -2
  39. package/dist/{inventory-metadata-QGPVSAUI.mjs → inventory-metadata-T22JZF4O.mjs} +1 -1
  40. package/dist/{inventory-stock-VQNXCIOA.mjs → inventory-stock-CPNDJYBD.mjs} +1 -1
  41. package/dist/{location-detail-M4CYDTSY.mjs → location-detail-SG4X4HBT.mjs} +1 -1
  42. package/dist/{location-edit-RNGPJ26L.mjs → location-edit-X6JBEWIF.mjs} +1 -1
  43. package/dist/{location-fulfillment-providers-XVEQZCUD.mjs → location-fulfillment-providers-YNKCL3FV.mjs} +1 -1
  44. package/dist/location-list-VNEYHAKV.mjs +323 -0
  45. package/dist/{location-sales-channels-NSXV65ZM.mjs → location-sales-channels-HVZHZMBY.mjs} +1 -1
  46. package/dist/{location-service-zone-shipping-option-create-I3HAEEFA.mjs → location-service-zone-shipping-option-create-PF7YJSC3.mjs} +1 -1
  47. package/dist/{login-QOENXTB7.mjs → login-23RIW4IY.mjs} +1 -1
  48. package/dist/{order-create-claim-MOBLO4YM.mjs → order-create-claim-LBA6UTTF.mjs} +1 -1
  49. package/dist/{order-create-edit-C75GUZJE.mjs → order-create-edit-7GLQP5CD.mjs} +1 -1
  50. package/dist/{order-create-exchange-RCUALEXO.mjs → order-create-exchange-IXPHBHKP.mjs} +1 -1
  51. package/dist/{order-create-fulfillment-EZTEZ4CF.mjs → order-create-fulfillment-5UJQFERR.mjs} +1 -1
  52. package/dist/{order-create-refund-4FAIESAN.mjs → order-create-refund-QZRNHK2D.mjs} +1 -1
  53. package/dist/{order-create-shipment-PTUJKVWK.mjs → order-create-shipment-TQJHHC7T.mjs} +1 -1
  54. package/dist/{order-detail-6XQLJ5TU.mjs → order-detail-NERZLT7X.mjs} +31 -23
  55. package/dist/{order-edit-billing-address-46CFUZGL.mjs → order-edit-billing-address-BMUX3GJL.mjs} +1 -1
  56. package/dist/{order-edit-email-FOK5GQW2.mjs → order-edit-email-CS4AIJZS.mjs} +1 -1
  57. package/dist/{order-edit-shipping-address-WFN2SVKM.mjs → order-edit-shipping-address-GXSNNDBC.mjs} +1 -1
  58. package/dist/{order-list-OTPVQKU6.mjs → order-list-YWPAJ7FR.mjs} +2 -2
  59. package/dist/{order-metadata-COJNFRPZ.mjs → order-metadata-KWZX64YP.mjs} +1 -1
  60. package/dist/{order-receive-return-P4OPVOPM.mjs → order-receive-return-EXZAUMCI.mjs} +1 -1
  61. package/dist/{order-request-transfer-HRPCEL5L.mjs → order-request-transfer-RLU2TK44.mjs} +1 -1
  62. package/dist/{price-list-create-FJ2FM6GL.mjs → price-list-create-RHSKBROB.mjs} +1 -1
  63. package/dist/{price-list-detail-VNZ3Q426.mjs → price-list-detail-7E2SZNKI.mjs} +1 -1
  64. package/dist/{price-list-prices-add-FMZKGOHD.mjs → price-list-prices-add-RM5FDABU.mjs} +1 -1
  65. package/dist/{product-attributes-5PLACMXK.mjs → product-attributes-K5EMRHFS.mjs} +4 -4
  66. package/dist/{product-create-6FMLIS5X.mjs → product-create-5KQFXFJF.mjs} +5 -5
  67. package/dist/{product-create-variant-KGBSFIKQ.mjs → product-create-variant-37CVX4QI.mjs} +1 -1
  68. package/dist/{product-detail-2BJJMCCO.mjs → product-detail-UM6PIKWQ.mjs} +5 -5
  69. package/dist/{product-edit-N5P7RVNS.mjs → product-edit-QSCZEH74.mjs} +4 -4
  70. package/dist/{product-export-XA5POQKT.mjs → product-export-JNLDMDUS.mjs} +1 -1
  71. package/dist/{product-import-DYTT4YDA.mjs → product-import-CA75XMEH.mjs} +1 -1
  72. package/dist/{product-list-EUQX3NBE.mjs → product-list-XA5SJLXF.mjs} +3 -3
  73. package/dist/{product-media-XJGAON6B.mjs → product-media-36YW62IO.mjs} +2 -2
  74. package/dist/{product-metadata-44VYAXZD.mjs → product-metadata-JKWIAMVB.mjs} +1 -1
  75. package/dist/{product-organization-FB6BVKKL.mjs → product-organization-YL4ZUCC4.mjs} +4 -4
  76. package/dist/{product-sales-channels-QBQDLU7Z.mjs → product-sales-channels-UX7AOJIF.mjs} +1 -1
  77. package/dist/{product-shipping-profile-UZQSV54B.mjs → product-shipping-profile-PEIUF5AK.mjs} +4 -4
  78. package/dist/{product-stock-PX5NAHH6.mjs → product-stock-4XECV73O.mjs} +1 -1
  79. package/dist/{product-tag-create-R4YSSXD6.mjs → product-tag-create-U5DAEOBS.mjs} +1 -1
  80. package/dist/{product-tag-detail-XJEGQD7U.mjs → product-tag-detail-YB44E6JT.mjs} +1 -1
  81. package/dist/{product-tag-edit-7JXF42HY.mjs → product-tag-edit-J3OPHCDJ.mjs} +1 -1
  82. package/dist/{product-tag-list-GTUMQQ6V.mjs → product-tag-list-6TGDOAMD.mjs} +1 -1
  83. package/dist/{product-tag-metadata-5QV3HMXJ.mjs → product-tag-metadata-VAHEGSFJ.mjs} +1 -1
  84. package/dist/{product-type-detail-CN74BB3Y.mjs → product-type-detail-EN3WAIVO.mjs} +1 -1
  85. package/dist/{product-type-metadata-JPFREADV.mjs → product-type-metadata-R3YLZGY5.mjs} +1 -1
  86. package/dist/{product-variant-detail-BSLEUW5J.mjs → product-variant-detail-TYV4BYNG.mjs} +1 -1
  87. package/dist/{product-variant-edit-VOW5633S.mjs → product-variant-edit-YPQDVG5C.mjs} +1 -1
  88. package/dist/{product-variant-metadata-KDSV47PE.mjs → product-variant-metadata-DII5YHIK.mjs} +1 -1
  89. package/dist/{promotion-add-campaign-JXBRCUXL.mjs → promotion-add-campaign-YREHV6TQ.mjs} +7 -20
  90. package/dist/{promotion-create-YPX2R3ZB.mjs → promotion-create-TLW6T5IO.mjs} +4 -4
  91. package/dist/{promotion-detail-VB5GZDCC.mjs → promotion-detail-BYA66IL7.mjs} +113 -64
  92. package/dist/{promotion-edit-details-I5DYHQUM.mjs → promotion-edit-details-A2UUSAZA.mjs} +1 -1
  93. package/dist/{promotion-list-NAUTWXNU.mjs → promotion-list-TOYJAQ4D.mjs} +4 -4
  94. package/dist/{refund-reason-create-CYHPXX2O.mjs → refund-reason-create-D5DJVOXP.mjs} +1 -1
  95. package/dist/{refund-reason-list-VBHGRLJJ.mjs → refund-reason-list-V7UO2NAY.mjs} +10 -5
  96. package/dist/{region-metadata-NXD563F4.mjs → region-metadata-23FQEWQ7.mjs} +1 -1
  97. package/dist/{reservation-detail-64MMXK7D.mjs → reservation-detail-USSX2THW.mjs} +1 -1
  98. package/dist/{reservation-metadata-4GZCEGM7.mjs → reservation-metadata-PKWRLWNT.mjs} +1 -1
  99. package/dist/{reset-password-ZCKXQZNQ.mjs → reset-password-EKZEJXQU.mjs} +1 -1
  100. package/dist/{sales-channel-add-products-EAWW7ADY.mjs → sales-channel-add-products-DKDV65UU.mjs} +1 -1
  101. package/dist/{sales-channel-detail-3F3HFTD2.mjs → sales-channel-detail-JKJLEM4C.mjs} +1 -1
  102. package/dist/{sales-channel-list-R4HT6A7P.mjs → sales-channel-list-FOAVTG7H.mjs} +2 -2
  103. package/dist/{sales-channel-metadata-LAHTTRLQ.mjs → sales-channel-metadata-3RXYX7U2.mjs} +1 -1
  104. package/dist/{shipping-option-type-create-IPKK5MRS.mjs → shipping-option-type-create-ZLYFQFYI.mjs} +1 -1
  105. package/dist/{shipping-option-type-detail-NEQ4RA5F.mjs → shipping-option-type-detail-OMVJZSOI.mjs} +1 -1
  106. package/dist/{shipping-option-type-edit-CC64TWSB.mjs → shipping-option-type-edit-5XHFIDEZ.mjs} +1 -1
  107. package/dist/{shipping-option-type-list-3GTGTBK7.mjs → shipping-option-type-list-SGTTVHWK.mjs} +1 -1
  108. package/dist/{shipping-profile-metadata-EPVLPEEM.mjs → shipping-profile-metadata-3TZDQ27Z.mjs} +1 -1
  109. package/dist/{store-detail-PUOKMK4K.mjs → store-detail-72GMDFY7.mjs} +1 -1
  110. package/dist/{store-metadata-JYIVRRLW.mjs → store-metadata-TXSRTL6B.mjs} +1 -1
  111. package/dist/{tax-region-create-2GDG36NQ.mjs → tax-region-create-U6XXHBMJ.mjs} +2 -2
  112. package/dist/{tax-region-detail-MQKBEBOZ.mjs → tax-region-detail-V4E63XUI.mjs} +1 -1
  113. package/dist/{tax-region-edit-2H5ACSFG.mjs → tax-region-edit-2DQPKIJG.mjs} +1 -1
  114. package/dist/{tax-region-province-detail-HNK2ZJWL.mjs → tax-region-province-detail-P6LPVSQJ.mjs} +1 -1
  115. package/dist/{tax-region-tax-override-create-XZJ3EIFJ.mjs → tax-region-tax-override-create-BPZKBPN6.mjs} +1 -1
  116. package/dist/{tax-region-tax-override-edit-QHQHFI2Y.mjs → tax-region-tax-override-edit-O7LUBRQN.mjs} +1 -1
  117. package/dist/{user-list-TPBPZ7KJ.mjs → user-list-G4H2RSDX.mjs} +1 -1
  118. package/dist/{user-metadata-F6KRFYDW.mjs → user-metadata-TM3FFLIR.mjs} +1 -1
  119. package/dist/{workflow-execution-detail-JRJZATNU.mjs → workflow-execution-detail-3IBZZVRE.mjs} +1 -1
  120. package/package.json +9 -9
  121. package/src/components/data-table/data-table.tsx +64 -46
  122. package/src/hooks/api/campaigns.tsx +1 -0
  123. package/src/i18n/translations/$schema.json +19 -2
  124. package/src/i18n/translations/en.json +7 -3
  125. package/src/routes/locations/location-edit/components/edit-location-form/edit-location-form.tsx +1 -1
  126. package/src/routes/locations/location-list/index.ts +0 -1
  127. package/src/routes/locations/location-list/location-list.tsx +52 -14
  128. package/src/routes/locations/location-list/use-location-list-table-columns.tsx +185 -0
  129. package/src/routes/locations/location-list/use-location-list-table-query.tsx +22 -0
  130. package/src/routes/orders/order-detail/components/order-activity-section/order-timeline.tsx +13 -5
  131. package/src/routes/promotions/promotion-add-campaign/components/add-campaign-promotion-form/add-campaign-promotion-form.tsx +45 -52
  132. package/src/routes/promotions/promotion-add-campaign/promotion-add-campaign.tsx +4 -21
  133. package/src/routes/refund-reasons/refund-reason-list/components/refund-reason-list-table/refund-reason-list-table.tsx +12 -4
  134. package/dist/chunk-BKJC5BGQ.mjs +0 -53
  135. package/dist/location-list-NKIOBHG4.mjs +0 -298
  136. package/src/routes/locations/location-list/components/location-list-header/index.ts +0 -1
  137. package/src/routes/locations/location-list/components/location-list-header/location-list-header.tsx +0 -21
  138. package/src/routes/locations/location-list/loader.ts +0 -36
@@ -1,298 +0,0 @@
1
- import {
2
- BadgeListSummary
3
- } from "./chunk-BKJC5BGQ.mjs";
4
- import "./chunk-PYIO3TDQ.mjs";
5
- import {
6
- LinkButton
7
- } from "./chunk-6WKBBTKM.mjs";
8
- import {
9
- SidebarLink
10
- } from "./chunk-HWKLNKOY.mjs";
11
- import "./chunk-EQTBJSBZ.mjs";
12
- import {
13
- getFormattedAddress
14
- } from "./chunk-B6ZOPCPA.mjs";
15
- import {
16
- TwoColumnPage
17
- } from "./chunk-GIZFNLKK.mjs";
18
- import {
19
- useExtension
20
- } from "./chunk-C5P5PL3E.mjs";
21
- import "./chunk-DG7J63J2.mjs";
22
- import {
23
- ActionMenu
24
- } from "./chunk-OZPB6JBL.mjs";
25
- import "./chunk-OC7BQLYI.mjs";
26
- import "./chunk-S4DMV3ZT.mjs";
27
- import {
28
- stockLocationsQueryKeys,
29
- useDeleteStockLocation,
30
- useStockLocations
31
- } from "./chunk-32IQRUVY.mjs";
32
- import {
33
- queryClient
34
- } from "./chunk-FXYH54JP.mjs";
35
- import "./chunk-774WSTCC.mjs";
36
- import {
37
- sdk
38
- } from "./chunk-DEQUVHHE.mjs";
39
- import "./chunk-RPUOO7AV.mjs";
40
-
41
- // src/routes/locations/location-list/loader.ts
42
- import { redirect } from "react-router-dom";
43
-
44
- // src/routes/locations/location-list/constants.ts
45
- var LOCATION_LIST_FIELDS = "name,*sales_channels,*address,*fulfillment_sets,*fulfillment_sets.service_zones,*fulfillment_sets.service_zones.shipping_options,*fulfillment_sets.service_zones.shipping_options.shipping_profile";
46
-
47
- // src/routes/locations/location-list/loader.ts
48
- var shippingListQuery = () => ({
49
- queryKey: stockLocationsQueryKeys.lists(),
50
- queryFn: async () => {
51
- return await sdk.admin.stockLocation.list({
52
- // TODO: change this when RQ is fixed
53
- fields: LOCATION_LIST_FIELDS
54
- }).catch((error) => {
55
- if (error.status === 401) {
56
- throw redirect("/login");
57
- }
58
- throw error;
59
- });
60
- }
61
- });
62
- var shippingListLoader = async (_) => {
63
- const query = shippingListQuery();
64
- return queryClient.getQueryData(
65
- query.queryKey
66
- ) ?? await queryClient.fetchQuery(query);
67
- };
68
-
69
- // src/routes/locations/location-list/location-list.tsx
70
- import { ShoppingBag, TruckFast } from "@medusajs/icons";
71
- import { Container as Container3, Heading as Heading2 } from "@medusajs/ui";
72
- import { useTranslation as useTranslation3 } from "react-i18next";
73
- import { useLoaderData } from "react-router-dom";
74
-
75
- // src/routes/locations/location-list/components/location-list-item/location-list-item.tsx
76
- import { Buildings, PencilSquare, Trash } from "@medusajs/icons";
77
- import { Container, StatusBadge, Text, toast, usePrompt } from "@medusajs/ui";
78
- import { useTranslation } from "react-i18next";
79
- import { jsx, jsxs } from "react/jsx-runtime";
80
- function SalesChannels(props) {
81
- const { t } = useTranslation();
82
- const { salesChannels } = props;
83
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
84
- /* @__PURE__ */ jsx(
85
- Text,
86
- {
87
- size: "small",
88
- weight: "plus",
89
- className: "text-ui-fg-subtle flex-1",
90
- as: "div",
91
- children: t(`stockLocations.salesChannels.label`)
92
- }
93
- ),
94
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: salesChannels?.length ? /* @__PURE__ */ jsx(
95
- BadgeListSummary,
96
- {
97
- rounded: true,
98
- inline: true,
99
- n: 3,
100
- list: salesChannels.map((s) => s.name)
101
- }
102
- ) : "-" })
103
- ] }) });
104
- }
105
- function FulfillmentSet(props) {
106
- const { t } = useTranslation();
107
- const { fulfillmentSet, type } = props;
108
- const fulfillmentSetExists = !!fulfillmentSet;
109
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
110
- /* @__PURE__ */ jsx(
111
- Text,
112
- {
113
- size: "small",
114
- weight: "plus",
115
- className: "text-ui-fg-subtle flex-1",
116
- as: "div",
117
- children: t(`stockLocations.fulfillmentSets.${type}.header`)
118
- }
119
- ),
120
- /* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: /* @__PURE__ */ jsx(StatusBadge, { color: fulfillmentSetExists ? "green" : "grey", children: t(fulfillmentSetExists ? "statuses.enabled" : "statuses.disabled") }) })
121
- ] }) });
122
- }
123
- function LocationListItem(props) {
124
- const { location } = props;
125
- const { t } = useTranslation();
126
- const prompt = usePrompt();
127
- const { mutateAsync: deleteLocation } = useDeleteStockLocation(location.id);
128
- const handleDelete = async () => {
129
- const result = await prompt({
130
- title: t("general.areYouSure"),
131
- description: t("stockLocations.delete.confirmation", {
132
- name: location.name
133
- }),
134
- confirmText: t("actions.remove"),
135
- cancelText: t("actions.cancel")
136
- });
137
- if (!result) {
138
- return;
139
- }
140
- await deleteLocation(void 0, {
141
- onSuccess: () => {
142
- toast.success(
143
- t("shippingProfile.delete.successToast", {
144
- name: location.name
145
- })
146
- );
147
- },
148
- onError: (e) => {
149
- toast.error(e.message);
150
- }
151
- });
152
- };
153
- return /* @__PURE__ */ jsxs(Container, { className: "flex flex-col divide-y p-0", children: [
154
- /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between gap-x-4", children: [
155
- /* @__PURE__ */ jsx("div", { className: "shadow-borders-base flex size-7 items-center justify-center rounded-md", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-field flex size-6 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ jsx(Buildings, { className: "text-ui-fg-subtle" }) }) }),
156
- /* @__PURE__ */ jsxs("div", { className: "grow-1 flex flex-1 flex-col", children: [
157
- /* @__PURE__ */ jsx(Text, { weight: "plus", children: location.name }),
158
- /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle txt-small", children: getFormattedAddress({ address: location.address }).join(", ") })
159
- ] }),
160
- /* @__PURE__ */ jsxs("div", { className: "flex grow-0 items-center gap-4", children: [
161
- /* @__PURE__ */ jsx(
162
- ActionMenu,
163
- {
164
- groups: [
165
- {
166
- actions: [
167
- {
168
- label: t("actions.edit"),
169
- icon: /* @__PURE__ */ jsx(PencilSquare, {}),
170
- to: `/settings/locations/${location.id}/edit`
171
- }
172
- ]
173
- },
174
- {
175
- actions: [
176
- {
177
- label: t("actions.delete"),
178
- icon: /* @__PURE__ */ jsx(Trash, {}),
179
- onClick: handleDelete
180
- }
181
- ]
182
- }
183
- ]
184
- }
185
- ),
186
- /* @__PURE__ */ jsx("div", { className: "bg-ui-border-strong h-[12px] w-[1px]" }),
187
- /* @__PURE__ */ jsx(LinkButton, { to: `/settings/locations/${location.id}`, children: t("actions.viewDetails") })
188
- ] })
189
- ] }) }),
190
- /* @__PURE__ */ jsx(SalesChannels, { salesChannels: location.sales_channels }),
191
- /* @__PURE__ */ jsx(
192
- FulfillmentSet,
193
- {
194
- type: "pickup" /* Pickup */,
195
- fulfillmentSet: location.fulfillment_sets?.find(
196
- (f) => f.type === "pickup" /* Pickup */
197
- )
198
- }
199
- ),
200
- /* @__PURE__ */ jsx(
201
- FulfillmentSet,
202
- {
203
- type: "shipping" /* Shipping */,
204
- fulfillmentSet: location.fulfillment_sets?.find(
205
- (f) => f.type === "shipping" /* Shipping */
206
- )
207
- }
208
- )
209
- ] });
210
- }
211
- var location_list_item_default = LocationListItem;
212
-
213
- // src/routes/locations/location-list/components/location-list-header/location-list-header.tsx
214
- import { Button, Container as Container2, Heading, Text as Text2 } from "@medusajs/ui";
215
- import { useTranslation as useTranslation2 } from "react-i18next";
216
- import { Link } from "react-router-dom";
217
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
218
- var LocationListHeader = () => {
219
- const { t } = useTranslation2();
220
- return /* @__PURE__ */ jsxs2(Container2, { className: "flex h-fit items-center justify-between gap-x-4 px-6 py-4", children: [
221
- /* @__PURE__ */ jsxs2("div", { children: [
222
- /* @__PURE__ */ jsx2(Heading, { children: t("stockLocations.domain") }),
223
- /* @__PURE__ */ jsx2(Text2, { className: "text-ui-fg-subtle txt-small", children: t("stockLocations.list.description") })
224
- ] }),
225
- /* @__PURE__ */ jsx2(Button, { size: "small", className: "shrink-0", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx2(Link, { to: "create", children: t("actions.create") }) })
226
- ] });
227
- };
228
-
229
- // src/routes/locations/location-list/location-list.tsx
230
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
231
- function LocationList() {
232
- const initialData = useLoaderData();
233
- const {
234
- stock_locations: stockLocations = [],
235
- isError,
236
- error
237
- } = useStockLocations(
238
- {
239
- fields: LOCATION_LIST_FIELDS
240
- },
241
- { initialData }
242
- );
243
- const { getWidgets } = useExtension();
244
- if (isError) {
245
- throw error;
246
- }
247
- return /* @__PURE__ */ jsxs3(
248
- TwoColumnPage,
249
- {
250
- widgets: {
251
- after: getWidgets("location.list.after"),
252
- before: getWidgets("location.list.before"),
253
- sideAfter: getWidgets("location.list.side.after"),
254
- sideBefore: getWidgets("location.list.side.before")
255
- },
256
- showJSON: true,
257
- children: [
258
- /* @__PURE__ */ jsxs3(TwoColumnPage.Main, { children: [
259
- /* @__PURE__ */ jsx3(LocationListHeader, {}),
260
- /* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-3 lg:col-span-2", children: stockLocations.map((location) => /* @__PURE__ */ jsx3(location_list_item_default, { location }, location.id)) })
261
- ] }),
262
- /* @__PURE__ */ jsx3(TwoColumnPage.Sidebar, { children: /* @__PURE__ */ jsx3(LinksSection, {}) })
263
- ]
264
- }
265
- );
266
- }
267
- var LinksSection = () => {
268
- const { t } = useTranslation3();
269
- return /* @__PURE__ */ jsxs3(Container3, { className: "p-0", children: [
270
- /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading2, { level: "h2", children: t("stockLocations.sidebar.header") }) }),
271
- /* @__PURE__ */ jsx3(
272
- SidebarLink,
273
- {
274
- to: "/settings/locations/shipping-profiles",
275
- labelKey: t("stockLocations.sidebar.shippingProfiles.label"),
276
- descriptionKey: t(
277
- "stockLocations.sidebar.shippingProfiles.description"
278
- ),
279
- icon: /* @__PURE__ */ jsx3(ShoppingBag, {})
280
- }
281
- ),
282
- /* @__PURE__ */ jsx3(
283
- SidebarLink,
284
- {
285
- to: "/settings/locations/shipping-option-types",
286
- labelKey: t("stockLocations.sidebar.shippingOptionTypes.label"),
287
- descriptionKey: t(
288
- "stockLocations.sidebar.shippingOptionTypes.description"
289
- ),
290
- icon: /* @__PURE__ */ jsx3(TruckFast, {})
291
- }
292
- )
293
- ] });
294
- };
295
- export {
296
- LocationList as Component,
297
- shippingListLoader as loader
298
- };
@@ -1 +0,0 @@
1
- export * from "./location-list-header"
@@ -1,21 +0,0 @@
1
- import { Button, Container, Heading, Text } from "@medusajs/ui"
2
- import { useTranslation } from "react-i18next"
3
- import { Link } from "react-router-dom"
4
-
5
- export const LocationListHeader = () => {
6
- const { t } = useTranslation()
7
-
8
- return (
9
- <Container className="flex h-fit items-center justify-between gap-x-4 px-6 py-4">
10
- <div>
11
- <Heading>{t("stockLocations.domain")}</Heading>
12
- <Text className="text-ui-fg-subtle txt-small">
13
- {t("stockLocations.list.description")}
14
- </Text>
15
- </div>
16
- <Button size="small" className="shrink-0" variant="secondary" asChild>
17
- <Link to="create">{t("actions.create")}</Link>
18
- </Button>
19
- </Container>
20
- )
21
- }
@@ -1,36 +0,0 @@
1
- import { FetchError } from "@medusajs/js-sdk"
2
- import { LoaderFunctionArgs, redirect } from "react-router-dom"
3
-
4
- import { HttpTypes } from "@medusajs/types"
5
- import { stockLocationsQueryKeys } from "../../../hooks/api/stock-locations"
6
- import { sdk } from "../../../lib/client"
7
- import { queryClient } from "../../../lib/query-client"
8
- import { LOCATION_LIST_FIELDS } from "./constants"
9
-
10
- const shippingListQuery = () => ({
11
- queryKey: stockLocationsQueryKeys.lists(),
12
- queryFn: async () => {
13
- return await sdk.admin.stockLocation
14
- .list({
15
- // TODO: change this when RQ is fixed
16
- fields: LOCATION_LIST_FIELDS,
17
- })
18
- .catch((error: FetchError) => {
19
- if (error.status === 401) {
20
- throw redirect("/login")
21
- }
22
-
23
- throw error
24
- })
25
- },
26
- })
27
-
28
- export const shippingListLoader = async (_: LoaderFunctionArgs) => {
29
- const query = shippingListQuery()
30
-
31
- return (
32
- queryClient.getQueryData<HttpTypes.AdminStockLocationListResponse>(
33
- query.queryKey
34
- ) ?? (await queryClient.fetchQuery(query))
35
- )
36
- }