@mercurjs/admin 2.0.0-canary.27 → 2.0.0-canary.30
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-TXOODRHB.js → add-campaign-promotions-UVEH25GZ.js} +3 -3
- package/dist/{adjust-inventory-6RA7MJEM.js → adjust-inventory-B7O6DYKO.js} +5 -4
- package/dist/{api-key-management-detail-24BNBQNS.js → api-key-management-detail-4LXV7JDA.js} +5 -4
- package/dist/{campaign-detail-FBUQQL2W.js → campaign-detail-5Z7GPFAK.js} +8 -7
- package/dist/{categories-metadata-7NJ5AUE7.js → categories-metadata-BZXXH7O2.js} +5 -4
- package/dist/{category-detail-IQ4PUZG7.js → category-detail-RUHIR23W.js} +9 -8
- package/dist/{category-products-FSVFQAE4.js → category-products-HCTOGNYC.js} +9 -8
- package/dist/{chunk-4XHMNG3H.js → chunk-5X5373EQ.js} +11 -20
- package/dist/{chunk-PASXA3UX.js → chunk-7J3HKFZC.js} +22 -1
- package/dist/chunk-A4X5VP3G.js +102 -0
- package/dist/{chunk-NKLW7RD6.js → chunk-DTDWXHUJ.js} +1 -1
- package/dist/{chunk-TO7KBKHJ.js → chunk-F5PEK3DA.js} +5 -2
- package/dist/{chunk-6KI3GDYH.js → chunk-FMOQNZFZ.js} +39 -3
- package/dist/{chunk-6NNBZIM7.js → chunk-GFZ7GOEU.js} +4 -1
- package/dist/{chunk-RILFAVKM.js → chunk-HOZHWCST.js} +1 -1
- package/dist/{chunk-QM2TMBP3.js → chunk-KCCJYRBN.js} +9 -19
- package/dist/{chunk-AAW22JWF.js → chunk-O5AT2SQW.js} +1 -1
- package/dist/chunk-SWL7ZCP3.js +11 -0
- package/dist/{chunk-ZGQV4I7U.js → chunk-SXC5ZMLI.js} +3 -3
- package/dist/{chunk-KW56S7WF.js → chunk-VVWB3GIK.js} +5 -2
- package/dist/chunk-VZEMURY7.js +35 -0
- package/dist/{chunk-SJKPESDA.js → chunk-XE6KSRKQ.js} +1 -1
- package/dist/{collection-add-products-4HTDHYXO.js → collection-add-products-RPYKLNNJ.js} +9 -8
- package/dist/{collection-detail-CWGP5ICA.js → collection-detail-GWMDEONO.js} +9 -8
- package/dist/{collection-list-6DZKMCB5.js → collection-list-7YAMMLFL.js} +17 -16
- package/dist/{collection-metadata-7BON4MGI.js → collection-metadata-H53GCXYR.js} +5 -4
- package/dist/commission-rate-create-MSQJGMDS.js +777 -0
- package/dist/commission-rate-detail-FR6JFGB4.js +440 -0
- package/dist/commission-rate-edit-KPZXPZE7.js +760 -0
- package/dist/commission-rate-list-FCQ3HXC7.js +196 -0
- package/dist/{customer-detail-46UYP6GW.js → customer-detail-M7QXH7SD.js} +10 -9
- package/dist/{customer-group-detail-3RD6DT7U.js → customer-group-detail-QULQ5ZIZ.js} +8 -7
- package/dist/{customer-group-list-TFM2WJ4X.js → customer-group-list-SGAMPEJD.js} +5 -4
- package/dist/{customer-group-metadata-P7QANREG.js → customer-group-metadata-J3FH457E.js} +5 -4
- package/dist/{customer-metadata-MBI3NDAU.js → customer-metadata-ZU6PXP7M.js} +5 -4
- package/dist/{customers-add-customer-group-IHI2A5OO.js → customers-add-customer-group-TGJ422S7.js} +8 -7
- package/dist/{edit-inventory-item-EULGCSM4.js → edit-inventory-item-6Q5W6WJ2.js} +5 -4
- package/dist/{edit-inventory-item-attributes-56QN6GHF.js → edit-inventory-item-attributes-MPZZJFDD.js} +5 -4
- package/dist/{edit-rules-3WAX7GEP.js → edit-rules-HKGBBMHG.js} +5 -4
- package/dist/index.js +206 -124
- package/dist/{inventory-create-WCI6KWDJ.js → inventory-create-R33QWQMU.js} +5 -4
- package/dist/{inventory-detail-WDI5KD2U.js → inventory-detail-GN5KKOGO.js} +5 -4
- package/dist/{inventory-metadata-S34DYKIW.js → inventory-metadata-DN6CK42E.js} +5 -4
- package/dist/{inventory-stock-ITSFGRAG.js → inventory-stock-BIV6VHGX.js} +5 -4
- package/dist/{location-detail-DIAY4ZPW.js → location-detail-BXACBEYM.js} +5 -4
- package/dist/{location-fulfillment-providers-EBFA6G7P.js → location-fulfillment-providers-TGTZNVTK.js} +7 -6
- package/dist/{location-list-ZWDA6NC3.js → location-list-M5DLUBHD.js} +5 -4
- package/dist/{location-service-zone-shipping-option-create-LNLXDZYF.js → location-service-zone-shipping-option-create-P44YZNQP.js} +5 -4
- package/dist/{login-FXV4BRJ2.js → login-EVOZGQN3.js} +5 -4
- package/dist/{marketplace-detail-GOA4HYOL.js → marketplace-detail-LMLLZFKR.js} +5 -4
- package/dist/{marketplace-metadata-GCD7VD34.js → marketplace-metadata-O24YYWMO.js} +5 -4
- package/dist/{order-create-claim-OT3YIYG7.js → order-create-claim-3H6Q6BOK.js} +5 -4
- package/dist/{order-create-edit-KF5V64D7.js → order-create-edit-2Q5WZDWV.js} +5 -4
- package/dist/{order-create-exchange-5PH2DDPB.js → order-create-exchange-EWAOCVAD.js} +5 -4
- package/dist/{order-create-fulfillment-MIJWDDL2.js → order-create-fulfillment-S4FLI7H4.js} +5 -4
- package/dist/{order-create-refund-56LLPYLA.js → order-create-refund-EZRAUHW5.js} +5 -4
- package/dist/{order-create-shipment-TCGKO67Z.js → order-create-shipment-P6W3MIUO.js} +5 -4
- package/dist/{order-detail-ZDPCS42E.js → order-detail-CSNUBXUB.js} +5 -4
- package/dist/{order-edit-billing-address-C7YX7626.js → order-edit-billing-address-7OTVEKSV.js} +6 -5
- package/dist/{order-edit-email-7NMGVKNJ.js → order-edit-email-YL7HUYWW.js} +5 -4
- package/dist/{order-edit-shipping-address-BSWGO3G3.js → order-edit-shipping-address-OD6Q2YJB.js} +5 -4
- package/dist/{order-list-Y3CNRMSU.js → order-list-MVWNUSCV.js} +35 -16
- package/dist/{order-metadata-XXEPKUFM.js → order-metadata-HIKCMASJ.js} +5 -4
- package/dist/{order-receive-return-JFIMIGGV.js → order-receive-return-FFS3UDIX.js} +5 -4
- package/dist/{order-request-transfer-TXC2FK4A.js → order-request-transfer-AJ7Y7O4M.js} +5 -4
- package/dist/{price-list-configuration-GK4MA3BE.js → price-list-configuration-LIE2Z77K.js} +2 -2
- package/dist/{price-list-create-L5KWHQIJ.js → price-list-create-CJDS5WL6.js} +11 -10
- package/dist/{price-list-detail-E3F63UB6.js → price-list-detail-EXSNCIVE.js} +9 -8
- package/dist/{price-list-prices-add-OHMQZH73.js → price-list-prices-add-CM6ZTB5H.js} +9 -8
- package/dist/{price-list-prices-edit-ORJ3VWX2.js → price-list-prices-edit-WJP5NDFZ.js} +5 -4
- package/dist/{product-create-FWHZORNL.js → product-create-JL6E6O4U.js} +38 -6
- package/dist/{product-create-variant-ZMSJOFSJ.js → product-create-variant-MPXN3APE.js} +5 -4
- package/dist/{product-detail-V24PBFTX.js → product-detail-5EKZ4LHH.js} +10 -5
- package/dist/{product-export-H5Z6JVW7.js → product-export-5ZUQERTW.js} +17 -16
- package/dist/{product-import-HYPRL63J.js → product-import-KKR33B54.js} +5 -4
- package/dist/{product-list-XWJ5JFO2.js → product-list-PO7KEKYD.js} +17 -8
- package/dist/{product-media-TGVTQNDO.js → product-media-Z2DCRZSU.js} +2 -2
- package/dist/{product-metadata-LP6ZZFCV.js → product-metadata-VJLPWS6G.js} +5 -4
- package/dist/{product-stock-S6XIQVMO.js → product-stock-WRLT45MY.js} +5 -4
- package/dist/{product-tag-create-WIROVJ3M.js → product-tag-create-OQ5GZSH2.js} +5 -4
- package/dist/{product-tag-detail-F27ML7MQ.js → product-tag-detail-SRNMX6IT.js} +18 -17
- package/dist/{product-tag-edit-7A2H7OW2.js → product-tag-edit-4NRAHR44.js} +5 -4
- package/dist/{product-tag-list-KMVTIS7O.js → product-tag-list-A73YMLOW.js} +18 -17
- package/dist/{product-tag-metadata-AZUT3RGE.js → product-tag-metadata-KGMZ2FM5.js} +5 -4
- package/dist/{product-type-detail-LHNEJ5V3.js → product-type-detail-VLW54AOG.js} +9 -8
- package/dist/{product-type-metadata-SB7Z6X6E.js → product-type-metadata-S4BQXNMD.js} +5 -4
- package/dist/{product-variant-detail-VA7DHMCF.js → product-variant-detail-5ZXWEHCR.js} +16 -5
- package/dist/{product-variant-edit-FCOJQ4E7.js → product-variant-edit-LI37UINW.js} +5 -4
- package/dist/{product-variant-metadata-TH6U2EQW.js → product-variant-metadata-QMG7QSRO.js} +5 -4
- package/dist/{promotion-create-7L5LWMEM.js → promotion-create-CBUVIGJJ.js} +5 -4
- package/dist/{promotion-detail-NGOQNJER.js → promotion-detail-T3XF7SQY.js} +7 -6
- package/dist/{promotion-list-CV35S2NN.js → promotion-list-SJYMXQXT.js} +3 -3
- package/dist/{refund-reason-create-V2VJFJQ2.js → refund-reason-create-3FFIHVIK.js} +5 -4
- package/dist/{refund-reason-edit-ZTSUQ7IF.js → refund-reason-edit-CUCFK6QT.js} +5 -4
- package/dist/{refund-reason-list-FYROEGE3.js → refund-reason-list-MWO4CGF3.js} +7 -6
- package/dist/{region-metadata-R4EIHSPF.js → region-metadata-L2ZFFSYU.js} +5 -4
- package/dist/{reservation-detail-MKH3WGNU.js → reservation-detail-PRFJ3DCG.js} +5 -4
- package/dist/{reservation-metadata-W3BBPRGI.js → reservation-metadata-4UKKCAQW.js} +5 -4
- package/dist/{reset-password-EEDB3CUC.js → reset-password-WNANNJDX.js} +1 -1
- package/dist/{return-reason-list-B32WYMI2.js → return-reason-list-NDRI73EJ.js} +2 -2
- package/dist/{sales-channel-add-products-LHMQAZUR.js → sales-channel-add-products-BMFVRAEH.js} +9 -8
- package/dist/{sales-channel-detail-MYCYNGWP.js → sales-channel-detail-3X2A3IU3.js} +9 -8
- package/dist/{sales-channel-list-UK62MLV6.js → sales-channel-list-TOHSZEWI.js} +5 -4
- package/dist/{sales-channel-metadata-YQG6HIJA.js → sales-channel-metadata-NNGECIDY.js} +5 -4
- package/dist/seller-address-edit-ZD3CYNHQ.js +223 -0
- package/dist/{seller-details-MSDVT5IO.js → seller-details-4TOSFX3P.js} +172 -231
- package/dist/{seller-edit-RUYGO7CB.js → seller-edit-DL7IFKVU.js} +5 -212
- package/dist/{seller-list-B45KDWT7.js → seller-list-IXZYLSWC.js} +42 -2
- package/dist/{shipping-option-type-create-MPIM2Y2U.js → shipping-option-type-create-V7NL6F5R.js} +5 -4
- package/dist/{shipping-option-type-detail-FTLW2VVA.js → shipping-option-type-detail-EFGMRTEM.js} +6 -5
- package/dist/{shipping-option-type-edit-AAKLLV23.js → shipping-option-type-edit-4AZ42T5Y.js} +5 -4
- package/dist/{shipping-option-type-list-UDGLHQWB.js → shipping-option-type-list-NK6K72MU.js} +6 -5
- package/dist/{shipping-profile-metadata-D74JJSCX.js → shipping-profile-metadata-KFVHD2O7.js} +5 -4
- package/dist/{tax-region-create-JNOTV4L4.js → tax-region-create-BZJTEBMQ.js} +6 -5
- package/dist/{tax-region-detail-EKF3UNHB.js → tax-region-detail-BXFEMVY5.js} +7 -6
- package/dist/{tax-region-edit-4RUDAWE6.js → tax-region-edit-44S4TJNT.js} +5 -4
- package/dist/{tax-region-metadata-7DE72RDE.js → tax-region-metadata-FHBJJJRJ.js} +5 -4
- package/dist/{tax-region-province-detail-ENOLU5SV.js → tax-region-province-detail-2F4YIIAJ.js} +7 -6
- package/dist/{tax-region-tax-override-create-EAUDM7RZ.js → tax-region-tax-override-create-IURFV4MN.js} +20 -17
- package/dist/{tax-region-tax-override-edit-H5I3E3AJ.js → tax-region-tax-override-edit-XIPVZQSN.js} +20 -17
- package/dist/{user-metadata-4EBEIV3V.js → user-metadata-JDY6236C.js} +5 -4
- package/package.json +1 -1
- package/dist/{chunk-QNGHZSK3.js → chunk-24CEDEWS.js} +3 -3
- package/dist/{chunk-O4E3MAKS.js → chunk-BGDOVLJF.js} +3 -3
- package/dist/{customer-group-add-customers-FTRCJHE7.js → customer-group-add-customers-KG6P27YA.js} +3 -3
- package/dist/{customer-list-DYQHKNJV.js → customer-list-RK3BEFV7.js} +3 -3
- package/dist/{product-type-list-T5KO5J3W.js → product-type-list-BYHYR2PL.js} +3 -3
- package/dist/{region-list-PGWUOULN.js → region-list-IBVQAMBQ.js} +3 -3
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import "./chunk-LTBX54CI.js";
|
|
2
|
+
import {
|
|
3
|
+
SectionRow
|
|
4
|
+
} from "./chunk-3XPXUIK3.js";
|
|
5
|
+
import {
|
|
6
|
+
SingleColumnPage
|
|
7
|
+
} from "./chunk-U2UCL2VG.js";
|
|
8
|
+
import {
|
|
9
|
+
SingleColumnPageSkeleton
|
|
10
|
+
} from "./chunk-INNFZYX2.js";
|
|
11
|
+
import {
|
|
12
|
+
ActionMenu
|
|
13
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
14
|
+
import "./chunk-LAVHRER2.js";
|
|
15
|
+
import "./chunk-Y7QKP6QU.js";
|
|
16
|
+
import "./chunk-KCCJYRBN.js";
|
|
17
|
+
import "./chunk-ODBDAABQ.js";
|
|
18
|
+
import "./chunk-CDQJKJMX.js";
|
|
19
|
+
import "./chunk-JLATVDLM.js";
|
|
20
|
+
import "./chunk-GPRBBA7S.js";
|
|
21
|
+
import {
|
|
22
|
+
useProductTypes
|
|
23
|
+
} from "./chunk-E7ZBQO6E.js";
|
|
24
|
+
import "./chunk-XGHM75N2.js";
|
|
25
|
+
import "./chunk-U2GCSKW3.js";
|
|
26
|
+
import "./chunk-RTAIDSDS.js";
|
|
27
|
+
import "./chunk-LW3UWYZU.js";
|
|
28
|
+
import {
|
|
29
|
+
commissionRatesQueryKeys,
|
|
30
|
+
useCommissionRate,
|
|
31
|
+
useDeleteCommissionRate,
|
|
32
|
+
useUpdateCommissionRate
|
|
33
|
+
} from "./chunk-A4X5VP3G.js";
|
|
34
|
+
import "./chunk-NNZP4PYP.js";
|
|
35
|
+
import "./chunk-GF4QHVX3.js";
|
|
36
|
+
import "./chunk-JOQ3RTF5.js";
|
|
37
|
+
import "./chunk-V534K7G4.js";
|
|
38
|
+
import "./chunk-A5XOYSDC.js";
|
|
39
|
+
import "./chunk-TQI3DOQ5.js";
|
|
40
|
+
import "./chunk-5PB7KCTF.js";
|
|
41
|
+
import {
|
|
42
|
+
useShippingOptions
|
|
43
|
+
} from "./chunk-YOIARITB.js";
|
|
44
|
+
import "./chunk-W7G64ULL.js";
|
|
45
|
+
import "./chunk-6C7TCU42.js";
|
|
46
|
+
import "./chunk-4YF3GAKE.js";
|
|
47
|
+
import "./chunk-LORVU5II.js";
|
|
48
|
+
import "./chunk-36ORDF7W.js";
|
|
49
|
+
import "./chunk-QSM56ZOP.js";
|
|
50
|
+
import "./chunk-MIHEJ6Y6.js";
|
|
51
|
+
import "./chunk-3VZV6SJQ.js";
|
|
52
|
+
import {
|
|
53
|
+
useProducts
|
|
54
|
+
} from "./chunk-K357FGGP.js";
|
|
55
|
+
import {
|
|
56
|
+
queryClient
|
|
57
|
+
} from "./chunk-RHKRREUU.js";
|
|
58
|
+
import "./chunk-ZA2KFUFR.js";
|
|
59
|
+
import {
|
|
60
|
+
sdk
|
|
61
|
+
} from "./chunk-ZYNBKBY3.js";
|
|
62
|
+
import "./chunk-NBMM2TZK.js";
|
|
63
|
+
|
|
64
|
+
// src/pages/commission-rates/commission-rate-detail/breadcrumb.tsx
|
|
65
|
+
import { jsx } from "react/jsx-runtime";
|
|
66
|
+
var CommissionRateDetailBreadcrumb = (props) => {
|
|
67
|
+
const { id } = props.params || {};
|
|
68
|
+
const { commission_rate } = useCommissionRate(id, void 0, {
|
|
69
|
+
initialData: props.data,
|
|
70
|
+
enabled: Boolean(id)
|
|
71
|
+
});
|
|
72
|
+
if (!commission_rate) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ jsx("span", { children: commission_rate.name });
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/pages/commission-rates/commission-rate-detail/loader.ts
|
|
79
|
+
var commissionRateQuery = (id) => ({
|
|
80
|
+
queryKey: commissionRatesQueryKeys.detail(id),
|
|
81
|
+
queryFn: async () => sdk.admin.commissionRates.$id.query({ $id: id, fields: "*rules" })
|
|
82
|
+
});
|
|
83
|
+
var commissionRateLoader = async ({
|
|
84
|
+
params
|
|
85
|
+
}) => {
|
|
86
|
+
const id = params.id;
|
|
87
|
+
const query = commissionRateQuery(id);
|
|
88
|
+
return queryClient.getQueryData(query.queryKey) ?? await queryClient.fetchQuery(query);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// src/pages/commission-rates/commission-rate-detail/commission-rate-detail.tsx
|
|
92
|
+
import { useLoaderData, useParams } from "react-router-dom";
|
|
93
|
+
|
|
94
|
+
// src/pages/commission-rates/commission-rate-detail/components/commission-rate-general-section/commission-rate-general-section.tsx
|
|
95
|
+
import { PencilSquare, Trash, XCircle, CheckCircle } from "@medusajs/icons";
|
|
96
|
+
import { Badge, Container, Heading, StatusBadge, toast, usePrompt } from "@medusajs/ui";
|
|
97
|
+
import { useTranslation } from "react-i18next";
|
|
98
|
+
import { useNavigate } from "react-router-dom";
|
|
99
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
100
|
+
var CommissionRateGeneralSection = ({
|
|
101
|
+
commissionRate
|
|
102
|
+
}) => {
|
|
103
|
+
const formatValue = () => {
|
|
104
|
+
if (commissionRate.type === "percentage") {
|
|
105
|
+
return `${commissionRate.value}%`;
|
|
106
|
+
}
|
|
107
|
+
return commissionRate.currency_code ? `${commissionRate.value} ${commissionRate.currency_code.toUpperCase()}` : `${commissionRate.value}`;
|
|
108
|
+
};
|
|
109
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
111
|
+
/* @__PURE__ */ jsx2(Heading, { children: commissionRate.name }),
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
113
|
+
/* @__PURE__ */ jsx2(StatusBadge, { color: commissionRate.is_enabled ? "green" : "grey", children: commissionRate.is_enabled ? "Enabled" : "Disabled" }),
|
|
114
|
+
/* @__PURE__ */ jsx2(CommissionRateActions, { commissionRate })
|
|
115
|
+
] })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx2(
|
|
118
|
+
SectionRow,
|
|
119
|
+
{
|
|
120
|
+
title: "Code",
|
|
121
|
+
value: /* @__PURE__ */ jsx2(Badge, { size: "2xsmall", className: "uppercase", children: commissionRate.code })
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx2(
|
|
125
|
+
SectionRow,
|
|
126
|
+
{
|
|
127
|
+
title: "Type",
|
|
128
|
+
value: /* @__PURE__ */ jsx2(
|
|
129
|
+
Badge,
|
|
130
|
+
{
|
|
131
|
+
size: "2xsmall",
|
|
132
|
+
color: commissionRate.type === "percentage" ? "blue" : "grey",
|
|
133
|
+
children: commissionRate.type === "percentage" ? "Percentage" : "Fixed"
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx2(SectionRow, { title: "Value", value: formatValue() }),
|
|
139
|
+
/* @__PURE__ */ jsx2(
|
|
140
|
+
SectionRow,
|
|
141
|
+
{
|
|
142
|
+
title: "Target",
|
|
143
|
+
value: commissionRate.target === "item" ? "Item" : "Shipping"
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
/* @__PURE__ */ jsx2(
|
|
147
|
+
SectionRow,
|
|
148
|
+
{
|
|
149
|
+
title: "Include Tax",
|
|
150
|
+
value: commissionRate.include_tax ? "Yes" : "No"
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx2(SectionRow, { title: "Priority", value: String(commissionRate.priority) }),
|
|
154
|
+
commissionRate.min_amount != null && /* @__PURE__ */ jsx2(
|
|
155
|
+
SectionRow,
|
|
156
|
+
{
|
|
157
|
+
title: "Minimum Amount",
|
|
158
|
+
value: commissionRate.currency_code ? `${commissionRate.min_amount} ${commissionRate.currency_code.toUpperCase()}` : String(commissionRate.min_amount)
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] });
|
|
162
|
+
};
|
|
163
|
+
var CommissionRateActions = ({
|
|
164
|
+
commissionRate
|
|
165
|
+
}) => {
|
|
166
|
+
const navigate = useNavigate();
|
|
167
|
+
const { t } = useTranslation();
|
|
168
|
+
const { mutateAsync } = useDeleteCommissionRate(commissionRate.id);
|
|
169
|
+
const { mutateAsync: updateCommissionRate } = useUpdateCommissionRate(commissionRate.id);
|
|
170
|
+
const prompt = usePrompt();
|
|
171
|
+
const handleToggleEnabled = async () => {
|
|
172
|
+
const newEnabled = !commissionRate.is_enabled;
|
|
173
|
+
await updateCommissionRate(
|
|
174
|
+
{ is_enabled: newEnabled },
|
|
175
|
+
{
|
|
176
|
+
onSuccess: () => {
|
|
177
|
+
toast.success(
|
|
178
|
+
newEnabled ? "Commission rate enabled successfully" : "Commission rate disabled successfully"
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
onError: (e) => {
|
|
182
|
+
toast.error(e.message);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
const handleDelete = async () => {
|
|
188
|
+
const res = await prompt({
|
|
189
|
+
title: t("general.areYouSure"),
|
|
190
|
+
description: `Are you sure you want to delete the commission rate "${commissionRate.name}"?`,
|
|
191
|
+
confirmText: t("actions.delete"),
|
|
192
|
+
cancelText: t("actions.cancel")
|
|
193
|
+
});
|
|
194
|
+
if (!res) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
await mutateAsync(void 0, {
|
|
198
|
+
onSuccess: () => {
|
|
199
|
+
toast.success("Commission rate deleted successfully");
|
|
200
|
+
navigate("/settings/commission-rates", { replace: true });
|
|
201
|
+
},
|
|
202
|
+
onError: (e) => {
|
|
203
|
+
toast.error(e.message);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
return /* @__PURE__ */ jsx2(
|
|
208
|
+
ActionMenu,
|
|
209
|
+
{
|
|
210
|
+
groups: [
|
|
211
|
+
{
|
|
212
|
+
actions: [
|
|
213
|
+
{
|
|
214
|
+
icon: /* @__PURE__ */ jsx2(PencilSquare, {}),
|
|
215
|
+
label: t("actions.edit"),
|
|
216
|
+
to: `/settings/commission-rates/${commissionRate.id}/edit`
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
icon: commissionRate.is_enabled ? /* @__PURE__ */ jsx2(XCircle, {}) : /* @__PURE__ */ jsx2(CheckCircle, {}),
|
|
220
|
+
label: commissionRate.is_enabled ? t("actions.disable") : t("actions.enable"),
|
|
221
|
+
onClick: handleToggleEnabled
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
actions: [
|
|
227
|
+
{
|
|
228
|
+
icon: /* @__PURE__ */ jsx2(Trash, {}),
|
|
229
|
+
label: t("actions.delete"),
|
|
230
|
+
onClick: handleDelete
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/pages/commission-rates/commission-rate-detail/components/commission-rate-rules-section/commission-rate-rules-section.tsx
|
|
240
|
+
import { ArrowDownRightMini } from "@medusajs/icons";
|
|
241
|
+
import {
|
|
242
|
+
Badge as Badge2,
|
|
243
|
+
Container as Container2,
|
|
244
|
+
Heading as Heading2,
|
|
245
|
+
Text,
|
|
246
|
+
Tooltip
|
|
247
|
+
} from "@medusajs/ui";
|
|
248
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
249
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
250
|
+
var CommissionRateRulesSection = ({
|
|
251
|
+
commissionRate
|
|
252
|
+
}) => {
|
|
253
|
+
const { t } = useTranslation2();
|
|
254
|
+
const rules = commissionRate.rules || [];
|
|
255
|
+
const groupedRules = rules.reduce(
|
|
256
|
+
(acc, rule) => {
|
|
257
|
+
if (!acc[rule.reference]) {
|
|
258
|
+
acc[rule.reference] = [];
|
|
259
|
+
}
|
|
260
|
+
acc[rule.reference].push(rule.reference_id);
|
|
261
|
+
return acc;
|
|
262
|
+
},
|
|
263
|
+
{}
|
|
264
|
+
);
|
|
265
|
+
const entries = Object.entries(groupedRules);
|
|
266
|
+
return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", children: [
|
|
267
|
+
/* @__PURE__ */ jsx3("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx3(Heading2, { level: "h2", children: t("taxRegions.fields.targets.label") }) }),
|
|
268
|
+
entries.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center px-6 py-8", children: /* @__PURE__ */ jsx3(Text, { size: "small", className: "text-ui-fg-subtle", children: "No rules configured" }) }) : /* @__PURE__ */ jsx3("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-3", children: [
|
|
269
|
+
/* @__PURE__ */ jsx3("div", { className: "text-ui-fg-muted flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx3(ArrowDownRightMini, {}) }),
|
|
270
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-x-1.5 gap-y-2", children: [
|
|
271
|
+
/* @__PURE__ */ jsx3(
|
|
272
|
+
Text,
|
|
273
|
+
{
|
|
274
|
+
size: "small",
|
|
275
|
+
leading: "compact",
|
|
276
|
+
className: "text-ui-fg-subtle",
|
|
277
|
+
children: t("taxRegions.fields.targets.operators.on")
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
entries.map(([reference, ids], index) => {
|
|
281
|
+
return /* @__PURE__ */ jsxs2(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className: "flex items-center gap-x-1.5",
|
|
285
|
+
children: [
|
|
286
|
+
/* @__PURE__ */ jsx3(
|
|
287
|
+
Reference,
|
|
288
|
+
{
|
|
289
|
+
reference,
|
|
290
|
+
ids
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
index < entries.length - 1 && /* @__PURE__ */ jsx3(
|
|
294
|
+
Text,
|
|
295
|
+
{
|
|
296
|
+
size: "small",
|
|
297
|
+
leading: "compact",
|
|
298
|
+
className: "text-ui-fg-subtle",
|
|
299
|
+
children: t("taxRegions.fields.targets.operators.and")
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
reference
|
|
305
|
+
);
|
|
306
|
+
})
|
|
307
|
+
] })
|
|
308
|
+
] }) })
|
|
309
|
+
] });
|
|
310
|
+
};
|
|
311
|
+
var Reference = ({
|
|
312
|
+
reference,
|
|
313
|
+
ids
|
|
314
|
+
}) => {
|
|
315
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-x-1.5", children: [
|
|
316
|
+
/* @__PURE__ */ jsx3(ReferenceBadge, { reference }),
|
|
317
|
+
/* @__PURE__ */ jsx3(ReferenceValues, { type: reference, ids })
|
|
318
|
+
] });
|
|
319
|
+
};
|
|
320
|
+
var ReferenceBadge = ({
|
|
321
|
+
reference
|
|
322
|
+
}) => {
|
|
323
|
+
const { t } = useTranslation2();
|
|
324
|
+
let label = null;
|
|
325
|
+
switch (reference) {
|
|
326
|
+
case "product" /* PRODUCT */:
|
|
327
|
+
label = t("taxRegions.fields.targets.tags.product");
|
|
328
|
+
break;
|
|
329
|
+
case "product_type" /* PRODUCT_TYPE */:
|
|
330
|
+
label = t("taxRegions.fields.targets.tags.productType");
|
|
331
|
+
break;
|
|
332
|
+
case "shipping_option" /* SHIPPING_OPTION */:
|
|
333
|
+
label = t("taxRegions.fields.targets.tags.shippingOption");
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
if (!label) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
return /* @__PURE__ */ jsx3(Badge2, { size: "2xsmall", children: label });
|
|
340
|
+
};
|
|
341
|
+
var ReferenceValues = ({
|
|
342
|
+
type,
|
|
343
|
+
ids
|
|
344
|
+
}) => {
|
|
345
|
+
const { t } = useTranslation2();
|
|
346
|
+
const { isPending, additional, labels, isError, error } = useReferenceValues(
|
|
347
|
+
type,
|
|
348
|
+
ids
|
|
349
|
+
);
|
|
350
|
+
if (isError) {
|
|
351
|
+
throw error;
|
|
352
|
+
}
|
|
353
|
+
if (isPending) {
|
|
354
|
+
return /* @__PURE__ */ jsx3("div", { className: "bg-ui-tag-neutral-bg border-ui-tag-neutral-border h-5 w-14 animate-pulse rounded-md" });
|
|
355
|
+
}
|
|
356
|
+
return /* @__PURE__ */ jsx3(
|
|
357
|
+
Tooltip,
|
|
358
|
+
{
|
|
359
|
+
content: /* @__PURE__ */ jsxs2("ul", { children: [
|
|
360
|
+
labels?.map((label, index) => /* @__PURE__ */ jsx3("li", { children: label }, index)),
|
|
361
|
+
additional > 0 && /* @__PURE__ */ jsx3("li", { children: t("taxRegions.fields.targets.additionalValues", {
|
|
362
|
+
count: additional
|
|
363
|
+
}) })
|
|
364
|
+
] }),
|
|
365
|
+
children: /* @__PURE__ */ jsx3(Badge2, { size: "2xsmall", children: t("taxRegions.fields.targets.values", {
|
|
366
|
+
count: ids.length
|
|
367
|
+
}) })
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
var useReferenceValues = (type, ids) => {
|
|
372
|
+
const products = useProducts(
|
|
373
|
+
{ id: ids, limit: 10 },
|
|
374
|
+
{ enabled: !!ids.length && type === "product" /* PRODUCT */ }
|
|
375
|
+
);
|
|
376
|
+
const productTypes = useProductTypes(
|
|
377
|
+
{ id: ids, limit: 10 },
|
|
378
|
+
{ enabled: !!ids.length && type === "product_type" /* PRODUCT_TYPE */ }
|
|
379
|
+
);
|
|
380
|
+
const shippingOptions = useShippingOptions(
|
|
381
|
+
{ id: ids, limit: 10 },
|
|
382
|
+
{
|
|
383
|
+
enabled: !!ids.length && type === "shipping_option" /* SHIPPING_OPTION */
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
switch (type) {
|
|
387
|
+
case "product" /* PRODUCT */:
|
|
388
|
+
return {
|
|
389
|
+
labels: products.products?.map((product) => product.title),
|
|
390
|
+
isPending: products.isPending,
|
|
391
|
+
additional: products.products && products.count ? products.count - products.products.length : 0,
|
|
392
|
+
isError: products.isError,
|
|
393
|
+
error: products.error
|
|
394
|
+
};
|
|
395
|
+
case "product_type" /* PRODUCT_TYPE */:
|
|
396
|
+
return {
|
|
397
|
+
labels: productTypes.product_types?.map((type2) => type2.value),
|
|
398
|
+
isPending: productTypes.isPending,
|
|
399
|
+
additional: productTypes.product_types && productTypes.count ? productTypes.count - productTypes.product_types.length : 0,
|
|
400
|
+
isError: productTypes.isError,
|
|
401
|
+
error: productTypes.error
|
|
402
|
+
};
|
|
403
|
+
case "shipping_option" /* SHIPPING_OPTION */:
|
|
404
|
+
return {
|
|
405
|
+
labels: shippingOptions.shipping_options?.map((option) => option.name),
|
|
406
|
+
isPending: shippingOptions.isPending,
|
|
407
|
+
additional: shippingOptions.count ? shippingOptions.count - (shippingOptions.shipping_options?.length || 0) : 0,
|
|
408
|
+
isError: shippingOptions.isError,
|
|
409
|
+
error: shippingOptions.error
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// src/pages/commission-rates/commission-rate-detail/commission-rate-detail.tsx
|
|
415
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
416
|
+
var CommissionRateDetail = () => {
|
|
417
|
+
const initialData = useLoaderData();
|
|
418
|
+
const { id } = useParams();
|
|
419
|
+
const {
|
|
420
|
+
commission_rate,
|
|
421
|
+
isPending: isLoading,
|
|
422
|
+
isError,
|
|
423
|
+
error
|
|
424
|
+
} = useCommissionRate(id, { fields: "*rules" }, { initialData });
|
|
425
|
+
if (isLoading || !commission_rate) {
|
|
426
|
+
return /* @__PURE__ */ jsx4(SingleColumnPageSkeleton, { sections: 2, showJSON: true, showMetadata: true });
|
|
427
|
+
}
|
|
428
|
+
if (isError) {
|
|
429
|
+
throw error;
|
|
430
|
+
}
|
|
431
|
+
return /* @__PURE__ */ jsxs3(SingleColumnPage, { data: commission_rate, showJSON: true, showMetadata: true, children: [
|
|
432
|
+
/* @__PURE__ */ jsx4(CommissionRateGeneralSection, { commissionRate: commission_rate }),
|
|
433
|
+
/* @__PURE__ */ jsx4(CommissionRateRulesSection, { commissionRate: commission_rate })
|
|
434
|
+
] });
|
|
435
|
+
};
|
|
436
|
+
export {
|
|
437
|
+
CommissionRateDetailBreadcrumb as Breadcrumb,
|
|
438
|
+
CommissionRateDetail as Component,
|
|
439
|
+
commissionRateLoader as loader
|
|
440
|
+
};
|