@medusajs/dashboard 2.10.4-snapshot-20250922195925 → 2.10.4-snapshot-20250923121159
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/{add-campaign-promotions-PLZXWFNV.mjs → add-campaign-promotions-JOVLXLS4.mjs} +3 -3
- package/dist/{api-key-management-detail-ZQFNZNWW.mjs → api-key-management-detail-I7T67TXF.mjs} +2 -3
- package/dist/{api-key-management-sales-channels-WL5L5XWM.mjs → api-key-management-sales-channels-6GN6RVZ2.mjs} +1 -1
- package/dist/app.css +0 -3
- package/dist/app.js +3320 -4024
- package/dist/app.mjs +3 -4
- package/dist/{campaign-detail-VTCCVWKS.mjs → campaign-detail-NRZHGINV.mjs} +4 -5
- package/dist/{categories-metadata-FTFYPASQ.mjs → categories-metadata-GXWJ3HOG.mjs} +1 -2
- package/dist/{category-detail-QHU2CLYA.mjs → category-detail-ENUI5EFL.mjs} +2 -3
- package/dist/{category-products-YGTL7GXQ.mjs → category-products-ZG5QDWSW.mjs} +2 -3
- package/dist/{chunk-JO6QASTJ.mjs → chunk-37UXEJF2.mjs} +1 -1
- package/dist/{chunk-BM5ZIV5V.mjs → chunk-5WKYR6PY.mjs} +1 -1
- package/dist/{chunk-VE7JFMAN.mjs → chunk-6AGMMT5H.mjs} +2 -2
- package/dist/{chunk-XTNS2NRD.mjs → chunk-BHZAQZYP.mjs} +1 -1
- package/dist/{chunk-6V6KATTW.mjs → chunk-JHXKKOHO.mjs} +10 -33
- package/dist/{chunk-FTVAORQM.mjs → chunk-JIQQKKLO.mjs} +1 -1
- package/dist/{chunk-5CE3JPWD.mjs → chunk-JMQ6V54O.mjs} +1 -1
- package/dist/{chunk-CU5EFQSB.mjs → chunk-NRBOPOMS.mjs} +1 -1
- package/dist/{chunk-BSBCIU6C.mjs → chunk-OGHQ6VJI.mjs} +5 -0
- package/dist/{chunk-K3OMOMRB.mjs → chunk-OKMF4YI7.mjs} +0 -25
- package/dist/{chunk-PHXKD2LR.mjs → chunk-OLUNPPBR.mjs} +1 -1
- package/dist/{chunk-WYDDFRYM.mjs → chunk-RVOPC44F.mjs} +103 -135
- package/dist/{chunk-YPDTZXV6.mjs → chunk-Y4YXZY7R.mjs} +1 -1
- package/dist/{chunk-UNM3LPTG.mjs → chunk-YM4QJC6Y.mjs} +24 -11
- package/dist/{chunk-PPI7PTY6.mjs → chunk-ZJA7VBUR.mjs} +6 -33
- package/dist/{collection-add-products-OJ2EZLC7.mjs → collection-add-products-2ISNNIHD.mjs} +2 -3
- package/dist/{collection-detail-RMZK523E.mjs → collection-detail-OSX6NHNQ.mjs} +2 -3
- package/dist/{collection-list-BJ3VNZAA.mjs → collection-list-MPIYSHQJ.mjs} +3 -4
- package/dist/{collection-metadata-R3DI65D3.mjs → collection-metadata-EOFYXEQI.mjs} +1 -2
- package/dist/{customer-detail-G7G6PYOO.mjs → customer-detail-FCNRRZSW.mjs} +1 -2
- package/dist/{customer-group-detail-XQ32DPQ3.mjs → customer-group-detail-QI3QLJJL.mjs} +1 -2
- package/dist/{customer-group-list-CARES5CM.mjs → customer-group-list-D26UKQMR.mjs} +2 -3
- package/dist/{customers-add-customer-group-NLPVKARS.mjs → customers-add-customer-group-5TFTVDB6.mjs} +1 -2
- package/dist/{edit-rules-JRLCVE26.mjs → edit-rules-63NG4QVR.mjs} +1 -2
- package/dist/{inventory-create-ZC6HV2FY.mjs → inventory-create-RIVJFJJQ.mjs} +1 -2
- package/dist/{inventory-detail-WVI4FTTH.mjs → inventory-detail-QHL7TJFZ.mjs} +2 -3
- package/dist/{inventory-metadata-BLIJBNQS.mjs → inventory-metadata-FH4CHJBA.mjs} +1 -2
- package/dist/{inventory-stock-ZCTXWRK6.mjs → inventory-stock-D6E4LQRK.mjs} +1 -2
- package/dist/{location-detail-GV3POY4C.mjs → location-detail-Z6ZDX6RY.mjs} +1 -2
- package/dist/{location-fulfillment-providers-INUQXJYU.mjs → location-fulfillment-providers-45VXZMZI.mjs} +2 -3
- package/dist/location-list-62KBWY4T.mjs +316 -0
- package/dist/{location-sales-channels-2BOIPBBG.mjs → location-sales-channels-O5XLIPAR.mjs} +1 -1
- package/dist/{location-service-zone-shipping-option-create-6KO3QDMQ.mjs → location-service-zone-shipping-option-create-NO3665DC.mjs} +1 -2
- package/dist/{login-57FIKGXA.mjs → login-DSPNELTI.mjs} +1 -2
- package/dist/{order-create-claim-LXKBCAWN.mjs → order-create-claim-V63BWLB5.mjs} +1 -2
- package/dist/{order-create-edit-264PTIEI.mjs → order-create-edit-NPF4UZ4D.mjs} +1 -2
- package/dist/{order-create-exchange-ZMUVPYM3.mjs → order-create-exchange-RHIPPSKU.mjs} +1 -2
- package/dist/{order-create-fulfillment-LE6O3SA5.mjs → order-create-fulfillment-4SSUHQ75.mjs} +1 -2
- package/dist/{order-create-refund-B7BO2EJL.mjs → order-create-refund-QVQC5ZP5.mjs} +1 -2
- package/dist/{order-create-shipment-UOPCS5N7.mjs → order-create-shipment-TJAARKWA.mjs} +1 -2
- package/dist/{order-detail-SG7AXBRS.mjs → order-detail-2MIN6B2I.mjs} +1 -2
- package/dist/{order-edit-billing-address-RPPJ4Z36.mjs → order-edit-billing-address-QP2I5F3E.mjs} +1 -2
- package/dist/{order-edit-email-A7D5HTU6.mjs → order-edit-email-7WT7XTHB.mjs} +1 -2
- package/dist/{order-edit-shipping-address-LXKC5CJE.mjs → order-edit-shipping-address-3QFMQP4I.mjs} +1 -2
- package/dist/{order-list-ZCMNSZYB.mjs → order-list-73DBATIK.mjs} +2 -2
- package/dist/{order-metadata-KS47UOEE.mjs → order-metadata-YJS26DHK.mjs} +1 -2
- package/dist/{order-receive-return-PDU2YVLT.mjs → order-receive-return-PZMMMUB2.mjs} +1 -2
- package/dist/{order-request-transfer-WMQKDLDF.mjs → order-request-transfer-QBIZD36E.mjs} +1 -2
- package/dist/{price-list-create-QZSB4W5Z.mjs → price-list-create-RXDH5CXF.mjs} +2 -3
- package/dist/{price-list-detail-2FMINPFT.mjs → price-list-detail-PKIKOJ4H.mjs} +2 -3
- package/dist/{price-list-prices-add-WYK2QBAI.mjs → price-list-prices-add-2CDPUSYA.mjs} +2 -3
- package/dist/{product-attributes-KDXI2RNP.mjs → product-attributes-FQDJCNUB.mjs} +4 -5
- package/dist/{product-create-TVYPK4VC.mjs → product-create-W37RQLON.mjs} +5 -6
- package/dist/{product-create-variant-6YWLDA2X.mjs → product-create-variant-KJKQ6ROY.mjs} +1 -2
- package/dist/{product-detail-RFKXMYE5.mjs → product-detail-TANIKAEK.mjs} +5 -6
- package/dist/{product-edit-5FNY7HG4.mjs → product-edit-DO76GHBI.mjs} +4 -5
- package/dist/{product-export-BEAUMFAZ.mjs → product-export-XERWEI5H.mjs} +2 -3
- package/dist/{product-import-SOX4UJPM.mjs → product-import-AGFJMSVK.mjs} +1 -2
- package/dist/{product-list-ZVXATJRE.mjs → product-list-KJ3HXPLB.mjs} +4 -5
- package/dist/{product-media-JPU23SPH.mjs → product-media-VG4YM2W6.mjs} +2 -2
- package/dist/{product-metadata-QRRCHZZB.mjs → product-metadata-NZ3HKO67.mjs} +1 -2
- package/dist/{product-organization-QTWB7VMB.mjs → product-organization-OOVUGXNP.mjs} +4 -5
- package/dist/{product-sales-channels-UGPAXFAV.mjs → product-sales-channels-QEJRSCAU.mjs} +1 -1
- package/dist/{product-shipping-profile-Q6UX6ZNJ.mjs → product-shipping-profile-FFMKOF6B.mjs} +4 -5
- package/dist/{product-stock-TSAIHVY6.mjs → product-stock-SUVEQZML.mjs} +1 -2
- package/dist/{product-tag-create-5NZJS2D2.mjs → product-tag-create-T6HVAQKN.mjs} +1 -2
- package/dist/{product-tag-detail-3XHUROBO.mjs → product-tag-detail-HOWUZC3P.mjs} +5 -6
- package/dist/{product-tag-edit-YYOOHKGG.mjs → product-tag-edit-WWQDNDRC.mjs} +1 -2
- package/dist/{product-tag-list-5XTTMNOA.mjs → product-tag-list-FAKSLONF.mjs} +5 -6
- package/dist/{product-tag-metadata-YAD3MPWF.mjs → product-tag-metadata-6B56VEZU.mjs} +1 -2
- package/dist/{product-type-detail-MNTAHQKJ.mjs → product-type-detail-KN64HYUV.mjs} +2 -3
- package/dist/{product-type-metadata-HWR3WBGT.mjs → product-type-metadata-F3FTI6OG.mjs} +1 -2
- package/dist/{product-variant-detail-DKFAG3KO.mjs → product-variant-detail-OUHBUY4J.mjs} +1 -2
- package/dist/{product-variant-edit-EZENYVAN.mjs → product-variant-edit-NBYHDUJ5.mjs} +1 -2
- package/dist/{product-variant-metadata-S7QENSUG.mjs → product-variant-metadata-XDVLJYGQ.mjs} +1 -2
- package/dist/{promotion-create-O3KUSPIU.mjs → promotion-create-UUOG52D5.mjs} +1 -2
- package/dist/{promotion-detail-5DU6ULJG.mjs → promotion-detail-GONXLJZ2.mjs} +113 -65
- package/dist/{promotion-list-Q2FOGORE.mjs → promotion-list-NNEMVJ6I.mjs} +3 -3
- package/dist/{region-metadata-G3JH5ZN6.mjs → region-metadata-IQVB4ERU.mjs} +1 -2
- package/dist/{reservation-detail-PJXS67UM.mjs → reservation-detail-RTGHD35L.mjs} +1 -2
- package/dist/{reservation-metadata-UCKQB66O.mjs → reservation-metadata-WKJXBRLQ.mjs} +1 -2
- package/dist/{reset-password-5KIEBJHN.mjs → reset-password-ANJHGYUE.mjs} +1 -1
- package/dist/{return-reason-list-OGFYWMC5.mjs → return-reason-list-MOP7YWMZ.mjs} +2 -2
- package/dist/{sales-channel-add-products-CSMNFGHD.mjs → sales-channel-add-products-OKVZJ6FI.mjs} +2 -3
- package/dist/{sales-channel-detail-ZSA3HNWW.mjs → sales-channel-detail-WESBK6Q7.mjs} +2 -3
- package/dist/{sales-channel-list-X5ADP34V.mjs → sales-channel-list-LKVHXUXW.mjs} +2 -3
- package/dist/{sales-channel-metadata-ABWIDI3B.mjs → sales-channel-metadata-2OQAHYB4.mjs} +1 -2
- package/dist/{shipping-option-type-create-Q2X5OMJS.mjs → shipping-option-type-create-3CGPGDYJ.mjs} +1 -2
- package/dist/{shipping-option-type-detail-VT3Y5QQ4.mjs → shipping-option-type-detail-S23H2OGW.mjs} +2 -3
- package/dist/{shipping-option-type-edit-IA3EER2N.mjs → shipping-option-type-edit-IHE7XM6M.mjs} +1 -2
- package/dist/{shipping-option-type-list-JZPKAL3H.mjs → shipping-option-type-list-47GRJ6EC.mjs} +2 -3
- package/dist/{shipping-profile-metadata-EYXBWBF2.mjs → shipping-profile-metadata-OXWOXAAR.mjs} +1 -2
- package/dist/{store-detail-LI72QMUZ.mjs → store-detail-4K7TW2TP.mjs} +1 -2
- package/dist/{store-metadata-ZITLAS5H.mjs → store-metadata-JP2CI7EF.mjs} +1 -2
- package/dist/{tax-region-create-IU2R5VIY.mjs → tax-region-create-IWM4755I.mjs} +2 -3
- package/dist/{tax-region-detail-6FHD35LB.mjs → tax-region-detail-V2F2DONN.mjs} +1 -2
- package/dist/{tax-region-edit-O2WJXYIE.mjs → tax-region-edit-CJPMYTBF.mjs} +1 -2
- package/dist/{tax-region-province-detail-YDBU4CUU.mjs → tax-region-province-detail-4PUQ5ADW.mjs} +1 -2
- package/dist/{tax-region-tax-override-create-EF3LLZWM.mjs → tax-region-tax-override-create-3SCIOK4P.mjs} +5 -6
- package/dist/{tax-region-tax-override-edit-2DG3J6CO.mjs → tax-region-tax-override-edit-P3QJKET3.mjs} +5 -6
- package/dist/{user-list-3YFYZFSK.mjs → user-list-MKJLB5CQ.mjs} +1 -1
- package/dist/{user-metadata-QUIFIM5G.mjs → user-metadata-ZURLDLGC.mjs} +1 -2
- package/dist/{workflow-execution-detail-PVSQ2VGE.mjs → workflow-execution-detail-4R6AFFHV.mjs} +1 -2
- package/package.json +9 -9
- package/src/components/data-table/data-table.tsx +64 -46
- package/src/components/layout/settings-layout/settings-layout.tsx +0 -4
- package/src/dashboard-app/routes/get-route.map.tsx +0 -36
- package/src/hooks/api/refund-reasons.tsx +9 -113
- package/src/hooks/table/columns/index.ts +0 -1
- package/src/hooks/table/query/index.ts +0 -1
- package/src/i18n/translations/$schema.json +19 -112
- package/src/i18n/translations/en.json +6 -33
- package/src/routes/locations/location-list/index.ts +0 -1
- package/src/routes/locations/location-list/location-list.tsx +51 -19
- package/src/routes/locations/location-list/use-location-list-table-columns.tsx +185 -0
- package/src/routes/locations/location-list/use-location-list-table-query.tsx +22 -0
- package/dist/chunk-BKJC5BGQ.mjs +0 -53
- package/dist/chunk-YZJ3W776.mjs +0 -87
- package/dist/location-list-BKK2PAKF.mjs +0 -297
- package/dist/refund-reason-create-NSZFGXWI.mjs +0 -158
- package/dist/refund-reason-edit-RKUSPQCL.mjs +0 -144
- package/dist/refund-reason-list-2F5PFERT.mjs +0 -273
- package/src/hooks/table/columns/use-refund-reason-table-columns.tsx +0 -28
- package/src/hooks/table/query/use-refund-reason-table-query.tsx +0 -32
- package/src/routes/locations/location-list/components/location-list-header/index.ts +0 -1
- package/src/routes/locations/location-list/components/location-list-header/location-list-header.tsx +0 -21
- package/src/routes/locations/location-list/loader.ts +0 -36
- package/src/routes/refund-reasons/common/hooks/use-delete-refund-reason-action.tsx +0 -34
- package/src/routes/refund-reasons/refund-reason-create/components/refund-reason-create-form/index.ts +0 -1
- package/src/routes/refund-reasons/refund-reason-create/components/refund-reason-create-form/refund-reason-create-form.tsx +0 -131
- package/src/routes/refund-reasons/refund-reason-create/index.ts +0 -1
- package/src/routes/refund-reasons/refund-reason-create/refund-reason-create.tsx +0 -10
- package/src/routes/refund-reasons/refund-reason-edit/components/refund-reason-edit-form/index.ts +0 -1
- package/src/routes/refund-reasons/refund-reason-edit/components/refund-reason-edit-form/refund-reason-edit-form.tsx +0 -119
- package/src/routes/refund-reasons/refund-reason-edit/index.ts +0 -1
- package/src/routes/refund-reasons/refund-reason-edit/refund-reason-edit.tsx +0 -33
- package/src/routes/refund-reasons/refund-reason-list/components/refund-reason-list-table/index.ts +0 -1
- package/src/routes/refund-reasons/refund-reason-list/components/refund-reason-list-table/refund-reason-list-table.tsx +0 -131
- package/src/routes/refund-reasons/refund-reason-list/index.ts +0 -2
- package/src/routes/refund-reasons/refund-reason-list/loader.ts +0 -16
- package/src/routes/refund-reasons/refund-reason-list/refund-reason-list.tsx +0 -21
@@ -1,119 +0,0 @@
|
|
1
|
-
import { zodResolver } from "@hookform/resolvers/zod"
|
2
|
-
import { HttpTypes } from "@medusajs/types"
|
3
|
-
import { Button, Input, Textarea, toast } from "@medusajs/ui"
|
4
|
-
import { useForm } from "react-hook-form"
|
5
|
-
import { useTranslation } from "react-i18next"
|
6
|
-
import { z } from "zod"
|
7
|
-
|
8
|
-
import { Form } from "../../../../../components/common/form"
|
9
|
-
import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
10
|
-
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
11
|
-
import { useUpdateRefundReason } from "../../../../../hooks/api/refund-reasons"
|
12
|
-
|
13
|
-
type RefundReasonEditFormProps = {
|
14
|
-
refundReason: HttpTypes.AdminRefundReason
|
15
|
-
}
|
16
|
-
|
17
|
-
const RefundReasonEditSchema = z.object({
|
18
|
-
label: z.string().min(1),
|
19
|
-
description: z.string().optional(),
|
20
|
-
})
|
21
|
-
|
22
|
-
export const RefundReasonEditForm = ({
|
23
|
-
refundReason,
|
24
|
-
}: RefundReasonEditFormProps) => {
|
25
|
-
const { t } = useTranslation()
|
26
|
-
const { handleSuccess } = useRouteModal()
|
27
|
-
|
28
|
-
const form = useForm<z.infer<typeof RefundReasonEditSchema>>({
|
29
|
-
defaultValues: {
|
30
|
-
label: refundReason.label,
|
31
|
-
description: refundReason.description ?? undefined,
|
32
|
-
},
|
33
|
-
resolver: zodResolver(RefundReasonEditSchema),
|
34
|
-
})
|
35
|
-
|
36
|
-
const { mutateAsync, isPending } = useUpdateRefundReason(refundReason.id)
|
37
|
-
|
38
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
39
|
-
await mutateAsync(data, {
|
40
|
-
onSuccess: ({ refund_reason }) => {
|
41
|
-
toast.success(
|
42
|
-
t("refundReasons.edit.successToast", {
|
43
|
-
label: refund_reason.label,
|
44
|
-
})
|
45
|
-
)
|
46
|
-
handleSuccess()
|
47
|
-
},
|
48
|
-
onError: (error) => {
|
49
|
-
toast.error(error.message)
|
50
|
-
},
|
51
|
-
})
|
52
|
-
})
|
53
|
-
|
54
|
-
return (
|
55
|
-
<RouteDrawer.Form form={form}>
|
56
|
-
<KeyboundForm
|
57
|
-
className="flex size-full flex-col overflow-hidden"
|
58
|
-
onSubmit={handleSubmit}
|
59
|
-
>
|
60
|
-
<RouteDrawer.Body className="flex flex-1 flex-col gap-y-4 overflow-auto">
|
61
|
-
<Form.Field
|
62
|
-
control={form.control}
|
63
|
-
name="label"
|
64
|
-
render={({ field }) => {
|
65
|
-
return (
|
66
|
-
<Form.Item>
|
67
|
-
<Form.Label>
|
68
|
-
{t("refundReasons.fields.label.label")}
|
69
|
-
</Form.Label>
|
70
|
-
<Form.Control>
|
71
|
-
<Input
|
72
|
-
{...field}
|
73
|
-
placeholder={t("refundReasons.fields.label.placeholder")}
|
74
|
-
/>
|
75
|
-
</Form.Control>
|
76
|
-
<Form.ErrorMessage />
|
77
|
-
</Form.Item>
|
78
|
-
)
|
79
|
-
}}
|
80
|
-
/>
|
81
|
-
<Form.Field
|
82
|
-
control={form.control}
|
83
|
-
name="description"
|
84
|
-
render={({ field }) => {
|
85
|
-
return (
|
86
|
-
<Form.Item>
|
87
|
-
<Form.Label optional>
|
88
|
-
{t("refundReasons.fields.description.label")}
|
89
|
-
</Form.Label>
|
90
|
-
<Form.Control>
|
91
|
-
<Textarea
|
92
|
-
{...field}
|
93
|
-
placeholder={t(
|
94
|
-
"refundReasons.fields.description.placeholder"
|
95
|
-
)}
|
96
|
-
/>
|
97
|
-
</Form.Control>
|
98
|
-
<Form.ErrorMessage />
|
99
|
-
</Form.Item>
|
100
|
-
)
|
101
|
-
}}
|
102
|
-
/>
|
103
|
-
</RouteDrawer.Body>
|
104
|
-
<RouteDrawer.Footer>
|
105
|
-
<div className="flex items-center justify-end gap-x-2">
|
106
|
-
<RouteDrawer.Close asChild>
|
107
|
-
<Button variant="secondary" size="small" type="button">
|
108
|
-
{t("actions.cancel")}
|
109
|
-
</Button>
|
110
|
-
</RouteDrawer.Close>
|
111
|
-
<Button size="small" type="submit" isLoading={isPending}>
|
112
|
-
{t("actions.save")}
|
113
|
-
</Button>
|
114
|
-
</div>
|
115
|
-
</RouteDrawer.Footer>
|
116
|
-
</KeyboundForm>
|
117
|
-
</RouteDrawer.Form>
|
118
|
-
)
|
119
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { RefundReasonEdit as Component } from "./refund-reason-edit"
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { Heading } from "@medusajs/ui"
|
2
|
-
import { useTranslation } from "react-i18next"
|
3
|
-
import { useParams } from "react-router-dom"
|
4
|
-
import { RouteDrawer } from "../../../components/modals"
|
5
|
-
import { useRefundReason } from "../../../hooks/api/refund-reasons"
|
6
|
-
import { RefundReasonEditForm } from "./components/refund-reason-edit-form"
|
7
|
-
|
8
|
-
export const RefundReasonEdit = () => {
|
9
|
-
const { id } = useParams()
|
10
|
-
const { t } = useTranslation()
|
11
|
-
|
12
|
-
const { refund_reason, isPending, isError, error } = useRefundReason(id!)
|
13
|
-
|
14
|
-
const ready = !isPending && !!refund_reason
|
15
|
-
|
16
|
-
if (isError) {
|
17
|
-
throw error
|
18
|
-
}
|
19
|
-
|
20
|
-
return (
|
21
|
-
<RouteDrawer>
|
22
|
-
<RouteDrawer.Header>
|
23
|
-
<RouteDrawer.Title asChild>
|
24
|
-
<Heading>{t("refundReasons.edit.header")}</Heading>
|
25
|
-
</RouteDrawer.Title>
|
26
|
-
<RouteDrawer.Description className="sr-only">
|
27
|
-
{t("refundReasons.edit.subtitle")}
|
28
|
-
</RouteDrawer.Description>
|
29
|
-
</RouteDrawer.Header>
|
30
|
-
{ready && <RefundReasonEditForm refundReason={refund_reason} />}
|
31
|
-
</RouteDrawer>
|
32
|
-
)
|
33
|
-
}
|
package/src/routes/refund-reasons/refund-reason-list/components/refund-reason-list-table/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { RefundReasonListTable } from "./refund-reason-list-table"
|
@@ -1,131 +0,0 @@
|
|
1
|
-
import { PencilSquare, Trash } from "@medusajs/icons"
|
2
|
-
import { HttpTypes } from "@medusajs/types"
|
3
|
-
import { Button, Container, Heading, Text } from "@medusajs/ui"
|
4
|
-
import { keepPreviousData } from "@tanstack/react-query"
|
5
|
-
import { createColumnHelper } from "@tanstack/react-table"
|
6
|
-
import { useMemo } from "react"
|
7
|
-
import { useTranslation } from "react-i18next"
|
8
|
-
import { Link } from "react-router-dom"
|
9
|
-
|
10
|
-
import { ActionMenu } from "../../../../../components/common/action-menu"
|
11
|
-
import { _DataTable } from "../../../../../components/table/data-table"
|
12
|
-
import { useRefundReasons } from "../../../../../hooks/api"
|
13
|
-
import { useRefundReasonTableColumns } from "../../../../../hooks/table/columns"
|
14
|
-
import { useRefundReasonTableQuery } from "../../../../../hooks/table/query"
|
15
|
-
import { useDataTable } from "../../../../../hooks/use-data-table"
|
16
|
-
import { useDeleteRefundReasonAction } from "../../../common/hooks/use-delete-refund-reason-action"
|
17
|
-
|
18
|
-
const PAGE_SIZE = 20
|
19
|
-
|
20
|
-
export const RefundReasonListTable = () => {
|
21
|
-
const { t } = useTranslation()
|
22
|
-
const { searchParams, raw } = useRefundReasonTableQuery({
|
23
|
-
pageSize: PAGE_SIZE,
|
24
|
-
})
|
25
|
-
|
26
|
-
const { refund_reasons, count, isPending, isError, error } = useRefundReasons(
|
27
|
-
searchParams,
|
28
|
-
{
|
29
|
-
placeholderData: keepPreviousData,
|
30
|
-
}
|
31
|
-
)
|
32
|
-
|
33
|
-
const columns = useColumns()
|
34
|
-
|
35
|
-
const { table } = useDataTable({
|
36
|
-
data: refund_reasons,
|
37
|
-
columns,
|
38
|
-
count,
|
39
|
-
getRowId: (row) => row.id,
|
40
|
-
pageSize: PAGE_SIZE,
|
41
|
-
})
|
42
|
-
|
43
|
-
if (isError) {
|
44
|
-
throw error
|
45
|
-
}
|
46
|
-
|
47
|
-
return (
|
48
|
-
<Container className="divide-y px-0 py-0">
|
49
|
-
<div className="flex items-center justify-between px-6 py-4">
|
50
|
-
<div>
|
51
|
-
<Heading>{t("refundReasons.domain")}</Heading>
|
52
|
-
<Text className="text-ui-fg-subtle" size="small">
|
53
|
-
{t("refundReasons.subtitle")}
|
54
|
-
</Text>
|
55
|
-
</div>
|
56
|
-
<Button variant="secondary" size="small" asChild>
|
57
|
-
<Link to="create">{t("actions.create")}</Link>
|
58
|
-
</Button>
|
59
|
-
</div>
|
60
|
-
<_DataTable
|
61
|
-
table={table}
|
62
|
-
queryObject={raw}
|
63
|
-
count={count}
|
64
|
-
isLoading={isPending}
|
65
|
-
columns={columns}
|
66
|
-
pageSize={PAGE_SIZE}
|
67
|
-
noHeader={true}
|
68
|
-
pagination
|
69
|
-
search
|
70
|
-
/>
|
71
|
-
</Container>
|
72
|
-
)
|
73
|
-
}
|
74
|
-
|
75
|
-
type RefundReasonRowActionsProps = {
|
76
|
-
refundReason: HttpTypes.AdminRefundReason
|
77
|
-
}
|
78
|
-
|
79
|
-
const RefundReasonRowActions = ({
|
80
|
-
refundReason,
|
81
|
-
}: RefundReasonRowActionsProps) => {
|
82
|
-
const { t } = useTranslation()
|
83
|
-
const handleDelete = useDeleteRefundReasonAction(
|
84
|
-
refundReason.id,
|
85
|
-
refundReason.label
|
86
|
-
)
|
87
|
-
|
88
|
-
return (
|
89
|
-
<ActionMenu
|
90
|
-
groups={[
|
91
|
-
{
|
92
|
-
actions: [
|
93
|
-
{
|
94
|
-
icon: <PencilSquare />,
|
95
|
-
label: t("actions.edit"),
|
96
|
-
to: `${refundReason.id}/edit`,
|
97
|
-
},
|
98
|
-
],
|
99
|
-
},
|
100
|
-
{
|
101
|
-
actions: [
|
102
|
-
{
|
103
|
-
icon: <Trash />,
|
104
|
-
label: t("actions.delete"),
|
105
|
-
onClick: handleDelete,
|
106
|
-
},
|
107
|
-
],
|
108
|
-
},
|
109
|
-
]}
|
110
|
-
/>
|
111
|
-
)
|
112
|
-
}
|
113
|
-
|
114
|
-
const columnHelper = createColumnHelper<HttpTypes.AdminRefundReason>()
|
115
|
-
|
116
|
-
const useColumns = () => {
|
117
|
-
const base = useRefundReasonTableColumns()
|
118
|
-
|
119
|
-
return useMemo(
|
120
|
-
() => [
|
121
|
-
...base,
|
122
|
-
columnHelper.display({
|
123
|
-
id: "actions",
|
124
|
-
cell: ({ row }) => (
|
125
|
-
<RefundReasonRowActions refundReason={row.original} />
|
126
|
-
),
|
127
|
-
}),
|
128
|
-
],
|
129
|
-
[base]
|
130
|
-
)
|
131
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { refundReasonsQueryKeys } from "../../../hooks/api"
|
2
|
-
import { sdk } from "../../../lib/client"
|
3
|
-
import { queryClient } from "../../../lib/query-client"
|
4
|
-
|
5
|
-
const refundReasonListQuery = () => ({
|
6
|
-
queryKey: refundReasonsQueryKeys.list(),
|
7
|
-
queryFn: async () => sdk.admin.refundReason.list(),
|
8
|
-
})
|
9
|
-
|
10
|
-
export const refundReasonListLoader = async () => {
|
11
|
-
const query = refundReasonListQuery()
|
12
|
-
return (
|
13
|
-
queryClient.getQueryData(query.queryKey) ??
|
14
|
-
(await queryClient.fetchQuery(query))
|
15
|
-
)
|
16
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { SingleColumnPage } from "../../../components/layout/pages"
|
2
|
-
import { useExtension } from "../../../providers/extension-provider"
|
3
|
-
import { RefundReasonListTable } from "./components/refund-reason-list-table"
|
4
|
-
|
5
|
-
export const RefundReasonList = () => {
|
6
|
-
const { getWidgets } = useExtension()
|
7
|
-
|
8
|
-
return (
|
9
|
-
<SingleColumnPage
|
10
|
-
showMetadata={false}
|
11
|
-
showJSON={false}
|
12
|
-
hasOutlet
|
13
|
-
widgets={{
|
14
|
-
after: getWidgets("refund_reason.list.after"),
|
15
|
-
before: getWidgets("refund_reason.list.before"),
|
16
|
-
}}
|
17
|
-
>
|
18
|
-
<RefundReasonListTable />
|
19
|
-
</SingleColumnPage>
|
20
|
-
)
|
21
|
-
}
|