@mercurjs/admin 2.2.0-canary.18 → 2.2.0-canary.19
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-4QP4LF7G.js → add-campaign-promotions-KK4JMLSK.js} +3 -3
- package/dist/{adjust-inventory-AHIKDW7M.js → adjust-inventory-F3OTF6O6.js} +5 -5
- package/dist/{api-key-management-detail-ZRLG6YRB.js → api-key-management-detail-JMWPGN6M.js} +6 -6
- package/dist/{attribute-create-NIYUQEHQ.js → attribute-create-TJRNP5SK.js} +7 -7
- package/dist/{attribute-detail-GA4FDSAG.js → attribute-detail-7I2SQCDK.js} +6 -6
- package/dist/{attribute-edit-KJL36HQ4.js → attribute-edit-UBG6SMUF.js} +2 -2
- package/dist/{attribute-edit-possible-value-LGOD3ZKQ.js → attribute-edit-possible-value-3BYEPC4X.js} +2 -2
- package/dist/{attribute-list-A3RFO32Z.js → attribute-list-EFU4DPB5.js} +5 -5
- package/dist/{campaign-detail-A7ZM4Q7M.js → campaign-detail-H32E6EDD.js} +9 -9
- package/dist/{categories-metadata-FCV4YK74.js → categories-metadata-V37DXTVZ.js} +5 -5
- package/dist/{category-detail-CIEHVR4M.js → category-detail-5MRHPG6T.js} +10 -10
- package/dist/{category-products-AB3YAGSW.js → category-products-3KYY662O.js} +9 -9
- package/dist/{chunk-WUGV75DM.js → chunk-3F6U44M6.js} +1 -1
- package/dist/{chunk-IBX52HBP.js → chunk-3N7QXAMO.js} +1 -1
- package/dist/{chunk-K2C42QAV.js → chunk-4DYSSDAA.js} +4 -4
- package/dist/{chunk-2PUBUYFG.js → chunk-5GXPXVVD.js} +2 -2
- package/dist/{chunk-CIKXWLWE.js → chunk-6AYGDFNE.js} +2 -2
- package/dist/{chunk-G5DQCCPL.js → chunk-6LG3VL3Q.js} +2 -2
- package/dist/{chunk-A2GVK4VZ.js → chunk-AXVZ56UD.js} +2 -2
- package/dist/{chunk-2LKMOTLX.js → chunk-B7HIZN4V.js} +2 -2
- package/dist/{chunk-EOLSQKPV.js → chunk-BJQ4UBK7.js} +529 -480
- package/dist/{chunk-OMBP3YSV.js → chunk-CFBEBAQS.js} +1 -1
- package/dist/{chunk-FJRNNDZS.js → chunk-EASE3NLF.js} +1 -1
- package/dist/chunk-EG45GIE3.js +368 -0
- package/dist/{chunk-TWCYZF6X.js → chunk-EM5TF7YZ.js} +1 -1
- package/dist/{chunk-MEXH366L.js → chunk-FCLS6CKW.js} +2 -2
- package/dist/{chunk-ENFXIYIH.js → chunk-FYKG35MR.js} +1 -1
- package/dist/{chunk-VZ7GNMGX.js → chunk-GA4ZFAOV.js} +1 -1
- package/dist/{chunk-RZ5SFALB.js → chunk-GFUCELIZ.js} +2 -2
- package/dist/{chunk-OFOKVLV3.js → chunk-GHGOOZEL.js} +2 -2
- package/dist/{chunk-CVZA23ES.js → chunk-GNWWL47L.js} +3 -3
- package/dist/{chunk-MR3MLNWV.js → chunk-HYQPZADS.js} +1 -1
- package/dist/{chunk-DELK6EWH.js → chunk-IHTQOPB6.js} +1 -1
- package/dist/chunk-JEJQKTZO.js +191 -0
- package/dist/{chunk-5BF5JDWT.js → chunk-JWE2IW4R.js} +5 -5
- package/dist/chunk-KZB7LCF2.js +82 -0
- package/dist/{chunk-N6YOACEW.js → chunk-L5Z4JGRD.js} +1 -1
- package/dist/{chunk-3VDLE5GA.js → chunk-LVCIAKJI.js} +1 -1
- package/dist/{chunk-PE6JFXWU.js → chunk-MFIT2RX5.js} +1 -1
- package/dist/{chunk-ZB4TESPP.js → chunk-O62SUNK2.js} +16 -7
- package/dist/{chunk-Q5WTOVZZ.js → chunk-O63MLTQV.js} +71 -0
- package/dist/{chunk-WPVDACTL.js → chunk-OA24YN34.js} +1 -1
- package/dist/{chunk-3DMUKRIX.js → chunk-OXONMLRP.js} +2 -2
- package/dist/{chunk-LJDGVBOQ.js → chunk-PJR6W35H.js} +1 -1
- package/dist/chunk-PN5C4AND.js +115 -0
- package/dist/chunk-QR3GYYX6.js +0 -0
- package/dist/{chunk-VT6QIVZW.js → chunk-RMAQKNBA.js} +10 -1
- package/dist/{chunk-IEPH6A2W.js → chunk-RV7DWZZB.js} +2 -2
- package/dist/chunk-RXRDZ47F.js +103 -0
- package/dist/{chunk-623TMW36.js → chunk-T53YX34K.js} +1 -1
- package/dist/{chunk-EYFWEKFJ.js → chunk-TLOJG7LK.js} +2 -2
- package/dist/{chunk-7Y6A7XK6.js → chunk-UCHVBAUB.js} +2 -2
- package/dist/{chunk-47W2JHOE.js → chunk-UT2O7IS7.js} +2 -2
- package/dist/{chunk-B4K7H6DH.js → chunk-UUTACMA5.js} +1 -1
- package/dist/{chunk-JSMUFZZN.js → chunk-WHIYSLYW.js} +1 -1
- package/dist/{chunk-SEQJOCTT.js → chunk-X4N7EMFO.js} +2 -2
- package/dist/{chunk-RUSMGNQ6.js → chunk-X7E65HM2.js} +1 -1
- package/dist/{chunk-RWRL4AXD.js → chunk-XKD67CD4.js} +2 -2
- package/dist/{chunk-UCYSCKZV.js → chunk-Y7FNFQCU.js} +1 -6
- package/dist/{chunk-HEGPAGJT.js → chunk-YI7I7JFX.js} +2 -2
- package/dist/{chunk-EB6ZFOTO.js → chunk-YLK2WZU3.js} +2 -2
- package/dist/{chunk-OCRKS4Z7.js → chunk-ZDJWTF64.js} +2 -2
- package/dist/{chunk-T4GL73RP.js → chunk-ZG6DNI7O.js} +1 -1
- package/dist/{chunk-OHOWEMHO.js → chunk-ZIFHQXP3.js} +31 -25
- package/dist/{collection-add-products-KTUW23TD.js → collection-add-products-4EZ6W4N6.js} +9 -9
- package/dist/{collection-detail-TR7TDQZG.js → collection-detail-X22ZIM5S.js} +10 -10
- package/dist/{collection-list-FOWSOTS7.js → collection-list-6CUEOLUU.js} +9 -9
- package/dist/{collection-metadata-DS32TGOK.js → collection-metadata-AWJYPZKR.js} +5 -5
- package/dist/commission-rule-commission-edit-TA3H3EEN.js +196 -0
- package/dist/commission-rule-create-O7Z25SC7.js +412 -0
- package/dist/commission-rule-detail-I7LVSNAM.js +45 -0
- package/dist/commission-rule-edit-YSHDTYZY.js +342 -0
- package/dist/{commission-rate-list-Y5XLEO67.js → commissions-list-OUGVPED6.js} +13 -4
- package/dist/{customer-detail-5XGZ2K3H.js → customer-detail-6MBW3FHO.js} +6 -6
- package/dist/{customer-group-detail-JX3BEYFG.js → customer-group-detail-G53RB6EA.js} +5 -5
- package/dist/{customer-group-list-F5TFLDVH.js → customer-group-list-XDNCZ4K6.js} +5 -5
- package/dist/{customer-group-metadata-CHOTUAS2.js → customer-group-metadata-FWLKUHIZ.js} +5 -5
- package/dist/{customer-metadata-LG6HA56I.js → customer-metadata-KU4YWD3R.js} +5 -5
- package/dist/{customers-add-customer-group-3YKZEZKJ.js → customers-add-customer-group-5Y5XPN7C.js} +5 -5
- package/dist/{edit-inventory-item-5EYVQ6CM.js → edit-inventory-item-MBLHBGBH.js} +5 -5
- package/dist/{edit-inventory-item-attributes-7QM4YHAQ.js → edit-inventory-item-attributes-GTTGNBO4.js} +5 -5
- package/dist/{edit-rules-2S5H7MC2.js → edit-rules-UFGKSAJV.js} +5 -5
- package/dist/global-commission-edit-LCD6JJUX.js +194 -0
- package/dist/index.js +158 -150
- package/dist/{inventory-create-RBMMOSC3.js → inventory-create-4O4L6NXK.js} +5 -5
- package/dist/{inventory-detail-LSAJ3ZB5.js → inventory-detail-ZWHSLLLI.js} +5 -5
- package/dist/{inventory-metadata-OZAKLWNY.js → inventory-metadata-GZYYWU3S.js} +5 -5
- package/dist/{inventory-stock-WUAIUFQS.js → inventory-stock-S5B6ZZQW.js} +5 -5
- package/dist/{location-detail-PBCP7BBV.js → location-detail-QS7HM2KG.js} +5 -5
- package/dist/{location-fulfillment-providers-D4EFIF3Z.js → location-fulfillment-providers-6RUGYQ3W.js} +7 -7
- package/dist/{location-list-DM4WU57J.js → location-list-7RTDLHGR.js} +5 -5
- package/dist/{location-service-zone-shipping-option-create-T4LT4E6M.js → location-service-zone-shipping-option-create-UKULBDGM.js} +5 -5
- package/dist/{login-LTASZXSR.js → login-SFGV4QGP.js} +5 -5
- package/dist/{marketplace-detail-GSPPUVR7.js → marketplace-detail-7VPTFUPB.js} +5 -5
- package/dist/{marketplace-metadata-PB7JEK2K.js → marketplace-metadata-E25VT5TH.js} +5 -5
- package/dist/{offers-D2QQQD2F.js → offers-WYAJB75N.js} +9 -9
- package/dist/{order-create-claim-HND7RODU.js → order-create-claim-3AQK3FH2.js} +3 -3
- package/dist/{order-create-edit-LIQGALQ2.js → order-create-edit-UFD26FE2.js} +2 -2
- package/dist/{order-create-exchange-QE2TJ36U.js → order-create-exchange-QCYD3DC4.js} +7 -7
- package/dist/{order-create-refund-37JJA6MM.js → order-create-refund-TR4XMHRY.js} +5 -5
- package/dist/{order-create-return-AVVT3OUO.js → order-create-return-Y7QS52UL.js} +2 -2
- package/dist/{order-detail-A2WC2OZU.js → order-detail-FZT74HMD.js} +10 -10
- package/dist/{order-edit-billing-address-IPWVSYR2.js → order-edit-billing-address-OJZICMBN.js} +6 -6
- package/dist/{order-edit-email-ZQZNTV4P.js → order-edit-email-TH26N5HK.js} +5 -5
- package/dist/{order-edit-shipping-address-YPYWT3YN.js → order-edit-shipping-address-GBOUGZPD.js} +5 -5
- package/dist/{order-list-QR3ZVI4U.js → order-list-C5YOR6B5.js} +2 -2
- package/dist/{order-metadata-E25YHGCC.js → order-metadata-RT3BVTYZ.js} +5 -5
- package/dist/{order-request-transfer-XDNXRB66.js → order-request-transfer-3HTFPYFD.js} +5 -5
- package/dist/pages/index.d.ts +5 -23
- package/dist/pages/index.js +79 -77
- package/dist/{price-list-create-GBUUE3NP.js → price-list-create-XQWV352E.js} +10 -10
- package/dist/{price-list-detail-77FAEXXO.js → price-list-detail-347UU3LU.js} +10 -10
- package/dist/{price-list-prices-add-2XS5TX5X.js → price-list-prices-add-R656I6QF.js} +10 -10
- package/dist/{price-list-prices-edit-C2C3I64A.js → price-list-prices-edit-BOKBTLEI.js} +5 -5
- package/dist/{product-add-existing-attributes-NFXKW6SW.js → product-add-existing-attributes-MNGWZFGD.js} +7 -7
- package/dist/{product-create-AG4AYDM3.js → product-create-LMYR36NA.js} +9 -9
- package/dist/{product-create-variant-7DVYYUDX.js → product-create-variant-XETT2WJC.js} +3 -3
- package/dist/{product-detail-CNVETME5.js → product-detail-WSL4PXKK.js} +7 -7
- package/dist/{product-edit-attribute-GXFMVPCQ.js → product-edit-attribute-XEYHQJ6D.js} +2 -2
- package/dist/{product-list-KM37QJ6F.js → product-list-7YPGRGHX.js} +10 -10
- package/dist/{product-media-H5DAWUYR.js → product-media-H6SYBNLI.js} +2 -2
- package/dist/{product-metadata-4ZLL42UF.js → product-metadata-MGLJJ7QG.js} +5 -5
- package/dist/{product-tag-create-KKRQQT3A.js → product-tag-create-JCYAG42N.js} +5 -5
- package/dist/{product-tag-detail-R6UFJDCW.js → product-tag-detail-AUNKJJLP.js} +12 -12
- package/dist/{product-tag-edit-TISDF4FQ.js → product-tag-edit-2FREKKVN.js} +5 -5
- package/dist/{product-tag-list-NFPQVVMO.js → product-tag-list-IKL46JZT.js} +12 -12
- package/dist/{product-tag-metadata-GJFYX5HU.js → product-tag-metadata-UV3TBPXS.js} +5 -5
- package/dist/{product-type-detail-XJPSQDL2.js → product-type-detail-DKHKFADI.js} +13 -13
- package/dist/{product-type-metadata-GKVLFBF6.js → product-type-metadata-22OACFMD.js} +8 -8
- package/dist/{product-variant-detail-VCMC4BZP.js → product-variant-detail-MNMJBYIP.js} +5 -5
- package/dist/{product-variant-edit-QLDFN6LI.js → product-variant-edit-THZLEOGL.js} +7 -7
- package/dist/{product-variant-metadata-VZZMPRRG.js → product-variant-metadata-7N7PL7WY.js} +5 -5
- package/dist/{promotion-create-POBB7B23.js → promotion-create-RB3AA5GE.js} +5 -5
- package/dist/{promotion-detail-NSOGXQAY.js → promotion-detail-PEDTLXZ4.js} +8 -8
- package/dist/{promotion-list-7C3SQCSO.js → promotion-list-MCYWN5TF.js} +4 -4
- package/dist/{refund-reason-create-HPLJOL6S.js → refund-reason-create-YWA5XP4J.js} +5 -5
- package/dist/{refund-reason-edit-JI4U4RWO.js → refund-reason-edit-MBG5WL43.js} +5 -5
- package/dist/{refund-reason-list-SWU4B2ED.js → refund-reason-list-GPDRI2QM.js} +10 -10
- package/dist/{region-metadata-LDWMTB7G.js → region-metadata-WDZ7DRGU.js} +5 -5
- package/dist/{reservation-detail-BLPISKPA.js → reservation-detail-WTYOR6IB.js} +5 -5
- package/dist/{reservation-metadata-AZ265HZI.js → reservation-metadata-PJVHEJRU.js} +5 -5
- package/dist/{reset-password-6CAYNSJ6.js → reset-password-2NVKH6QA.js} +1 -1
- package/dist/{return-reason-list-7HTIV7NK.js → return-reason-list-E6L7VJY7.js} +5 -5
- package/dist/{sales-channel-add-products-S47CQCJF.js → sales-channel-add-products-BKT3CFLY.js} +9 -9
- package/dist/{sales-channel-detail-6JPHP4FZ.js → sales-channel-detail-MUBMJGQV.js} +10 -10
- package/dist/{sales-channel-list-D673ONK2.js → sales-channel-list-O5SFOGMA.js} +5 -5
- package/dist/{sales-channel-metadata-OY47MCFI.js → sales-channel-metadata-67RGBA7X.js} +5 -5
- package/dist/{shipping-option-type-create-H2YRDETZ.js → shipping-option-type-create-OBF6GG5W.js} +5 -5
- package/dist/{shipping-option-type-detail-NVSXILP4.js → shipping-option-type-detail-TJC2GBUA.js} +7 -7
- package/dist/{shipping-option-type-edit-KBPDYAUJ.js → shipping-option-type-edit-INKLJRSH.js} +5 -5
- package/dist/{shipping-option-type-list-OUKJZJ6R.js → shipping-option-type-list-WKA64NYE.js} +7 -7
- package/dist/{shipping-profile-metadata-CQCDC45M.js → shipping-profile-metadata-RI6Y2N6V.js} +5 -5
- package/dist/{store-bulk-edit-DXWHZMGL.js → store-bulk-edit-WML2DUA4.js} +1 -1
- package/dist/{store-create-MVHUY3I3.js → store-create-AGF2LZWR.js} +5 -5
- package/dist/{store-details-V3NMV665.js → store-details-3HWOCRYI.js} +11 -11
- package/dist/{store-edit-6CC2GBFY.js → store-edit-5WWOOSHT.js} +3 -3
- package/dist/{store-list-WV6XHGLU.js → store-list-YEEKX2AV.js} +9 -9
- package/dist/{store-member-invite-7YIXFC56.js → store-member-invite-TULPI3N5.js} +1 -1
- package/dist/{tax-region-create-RGE5ZIBR.js → tax-region-create-X2LAHX27.js} +6 -6
- package/dist/{tax-region-detail-OKEK6WNJ.js → tax-region-detail-3X3TNFJA.js} +5 -5
- package/dist/{tax-region-edit-QQ3LB74P.js → tax-region-edit-7ECYGXEA.js} +5 -5
- package/dist/{tax-region-metadata-GPTD6KZB.js → tax-region-metadata-FQLEYY2R.js} +5 -5
- package/dist/{tax-region-province-detail-WHO3RLUX.js → tax-region-province-detail-DIV5AAFQ.js} +5 -5
- package/dist/{tax-region-tax-override-create-223MPYUG.js → tax-region-tax-override-create-BV4O3QCU.js} +14 -16
- package/dist/{tax-region-tax-override-edit-WFOXP6A7.js → tax-region-tax-override-edit-QUA77YTI.js} +16 -18
- package/dist/{user-metadata-A3JS6O4K.js → user-metadata-64LX64QI.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-AKTAFKIU.js +0 -228
- package/dist/chunk-HLJ24XVH.js +0 -390
- package/dist/chunk-SWL7ZCP3.js +0 -11
- package/dist/commission-rate-create-G42ZUJPH.js +0 -782
- package/dist/commission-rate-detail-VGYTGWLH.js +0 -85
- package/dist/commission-rate-edit-3CYWYOMS.js +0 -767
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDeleteCommissionRuleAction,
|
|
3
|
+
useScopeReferenceNames
|
|
4
|
+
} from "./chunk-RXRDZ47F.js";
|
|
5
|
+
import {
|
|
6
|
+
formatCommissionValue,
|
|
7
|
+
getIsActiveProps,
|
|
8
|
+
getScopeSummary,
|
|
9
|
+
getScopeTypeLabel
|
|
10
|
+
} from "./chunk-PN5C4AND.js";
|
|
11
|
+
import {
|
|
12
|
+
TextCell,
|
|
13
|
+
TextHeader
|
|
14
|
+
} from "./chunk-JHIMVLB2.js";
|
|
15
|
+
import {
|
|
16
|
+
_DataTable,
|
|
17
|
+
useDataTable
|
|
18
|
+
} from "./chunk-NQEXDLYH.js";
|
|
19
|
+
import {
|
|
20
|
+
SectionRow
|
|
21
|
+
} from "./chunk-3XPXUIK3.js";
|
|
22
|
+
import {
|
|
23
|
+
SingleColumnPage
|
|
24
|
+
} from "./chunk-H6MYB7GB.js";
|
|
25
|
+
import {
|
|
26
|
+
useQueryParams
|
|
27
|
+
} from "./chunk-THHRRYRS.js";
|
|
28
|
+
import {
|
|
29
|
+
useCommissionRules,
|
|
30
|
+
useDefaultCommission
|
|
31
|
+
} from "./chunk-ZIFHQXP3.js";
|
|
32
|
+
import {
|
|
33
|
+
ActionMenu
|
|
34
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
35
|
+
import {
|
|
36
|
+
Skeleton
|
|
37
|
+
} from "./chunk-INNFZYX2.js";
|
|
38
|
+
|
|
39
|
+
// src/pages/commissions/commissions-list/commissions-page.tsx
|
|
40
|
+
import { Children } from "react";
|
|
41
|
+
|
|
42
|
+
// src/pages/commissions/commissions-list/components/global-commission-section/global-commission-section.tsx
|
|
43
|
+
import { PencilSquare } from "@medusajs/icons";
|
|
44
|
+
import { Container, Heading } from "@medusajs/ui";
|
|
45
|
+
import { useTranslation } from "react-i18next";
|
|
46
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
47
|
+
var GLOBAL_COMMISSION_ROWS = [
|
|
48
|
+
{ key: "code", fallback: "Code" },
|
|
49
|
+
{ key: "type", fallback: "Type" },
|
|
50
|
+
{ key: "value", fallback: "Value" },
|
|
51
|
+
{ key: "tax", fallback: "Tax" },
|
|
52
|
+
{ key: "shipping", fallback: "Shipping" }
|
|
53
|
+
];
|
|
54
|
+
var GlobalCommissionSection = () => {
|
|
55
|
+
const { t } = useTranslation();
|
|
56
|
+
const { default_commission, isLoading, isError, error } = useDefaultCommission();
|
|
57
|
+
if (isError) {
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
const rate = default_commission;
|
|
61
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", "data-testid": "global-commission-section", children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(Heading, { children: t("commissions.global.title", "Global Commission") }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
ActionMenu,
|
|
66
|
+
{
|
|
67
|
+
groups: [
|
|
68
|
+
{
|
|
69
|
+
actions: [
|
|
70
|
+
{
|
|
71
|
+
label: t("actions.edit"),
|
|
72
|
+
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
73
|
+
to: "edit-global"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }),
|
|
81
|
+
isLoading || !rate ? GLOBAL_COMMISSION_ROWS.map(({ key, fallback }) => /* @__PURE__ */ jsx(
|
|
82
|
+
SectionRow,
|
|
83
|
+
{
|
|
84
|
+
title: t(`commissions.global.${key}`, fallback),
|
|
85
|
+
value: /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-24" })
|
|
86
|
+
},
|
|
87
|
+
key
|
|
88
|
+
)) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
SectionRow,
|
|
91
|
+
{
|
|
92
|
+
title: t("commissions.global.code", "Code"),
|
|
93
|
+
value: rate.code
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
SectionRow,
|
|
98
|
+
{
|
|
99
|
+
title: t("commissions.global.type", "Type"),
|
|
100
|
+
value: rate.type === "percentage" ? t("commissions.fields.type.percentage", "Percentage") : t("commissions.fields.type.fixed", "Fixed")
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
SectionRow,
|
|
105
|
+
{
|
|
106
|
+
title: t("commissions.global.value", "Value"),
|
|
107
|
+
value: formatCommissionValue(rate)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
SectionRow,
|
|
112
|
+
{
|
|
113
|
+
title: t("commissions.global.tax", "Tax"),
|
|
114
|
+
value: rate.include_tax ? t("commissions.global.included", "Included in commission") : t("commissions.global.notIncluded", "Not included")
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
SectionRow,
|
|
119
|
+
{
|
|
120
|
+
title: t("commissions.global.shipping", "Shipping"),
|
|
121
|
+
value: rate.include_shipping ? t("commissions.global.included", "Included in commission") : t("commissions.global.notIncluded", "Not included")
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
] });
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/commission-rules-table.tsx
|
|
129
|
+
import { Container as Container2 } from "@medusajs/ui";
|
|
130
|
+
|
|
131
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/commission-rules-data-table.tsx
|
|
132
|
+
import { PencilSquare as PencilSquare2, Trash } from "@medusajs/icons";
|
|
133
|
+
import { StatusBadge } from "@medusajs/ui";
|
|
134
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
135
|
+
import { createColumnHelper } from "@tanstack/react-table";
|
|
136
|
+
import { useMemo as useMemo2 } from "react";
|
|
137
|
+
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
138
|
+
|
|
139
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/use-commission-rules-filters.tsx
|
|
140
|
+
import { useMemo } from "react";
|
|
141
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
142
|
+
var useCommissionRulesFilters = () => {
|
|
143
|
+
const { t } = useTranslation2();
|
|
144
|
+
return useMemo(
|
|
145
|
+
() => [
|
|
146
|
+
{
|
|
147
|
+
key: "type",
|
|
148
|
+
label: t("commissions.fields.type.label", "Type"),
|
|
149
|
+
type: "select",
|
|
150
|
+
multiple: true,
|
|
151
|
+
options: [
|
|
152
|
+
{
|
|
153
|
+
label: t("commissions.fields.type.percentage", "Percentage"),
|
|
154
|
+
value: "percentage"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: t("commissions.fields.type.fixed", "Fixed"),
|
|
158
|
+
value: "fixed"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: "is_enabled",
|
|
164
|
+
label: t("commissions.fields.status", "Status"),
|
|
165
|
+
type: "select",
|
|
166
|
+
options: [
|
|
167
|
+
{ label: t("commissions.status.enabled", "Active"), value: "true" },
|
|
168
|
+
{
|
|
169
|
+
label: t("commissions.status.disabled", "Inactive"),
|
|
170
|
+
value: "false"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
[t]
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/use-commission-rules-query.tsx
|
|
180
|
+
var useCommissionRulesQuery = ({
|
|
181
|
+
prefix,
|
|
182
|
+
pageSize = 20
|
|
183
|
+
} = {}) => {
|
|
184
|
+
const queryObject = useQueryParams(
|
|
185
|
+
["offset", "q", "order", "is_enabled", "type"],
|
|
186
|
+
prefix
|
|
187
|
+
);
|
|
188
|
+
const { offset, q, order, is_enabled, type } = queryObject;
|
|
189
|
+
const searchParams = {
|
|
190
|
+
limit: pageSize,
|
|
191
|
+
offset: offset ? Number(offset) : 0,
|
|
192
|
+
order: order || void 0,
|
|
193
|
+
q: q || void 0,
|
|
194
|
+
is_enabled: is_enabled ? is_enabled === "true" : void 0,
|
|
195
|
+
type: type ? type.split(",") : void 0
|
|
196
|
+
};
|
|
197
|
+
return { searchParams, raw: queryObject };
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/commission-rules-data-table.tsx
|
|
201
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
202
|
+
var PAGE_SIZE = 20;
|
|
203
|
+
var CommissionRulesDataTable = () => {
|
|
204
|
+
const { t } = useTranslation3();
|
|
205
|
+
const { searchParams, raw } = useCommissionRulesQuery({ pageSize: PAGE_SIZE });
|
|
206
|
+
const filters = useCommissionRulesFilters();
|
|
207
|
+
const {
|
|
208
|
+
commission_rates,
|
|
209
|
+
count,
|
|
210
|
+
isPending: isLoading,
|
|
211
|
+
isError,
|
|
212
|
+
error
|
|
213
|
+
} = useCommissionRules(
|
|
214
|
+
{
|
|
215
|
+
...searchParams,
|
|
216
|
+
is_default: false,
|
|
217
|
+
fields: "id,name,code,type,value,currency_code,is_enabled,*rules,*values"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
placeholderData: keepPreviousData
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
const data = commission_rates ?? [];
|
|
224
|
+
const allRules = useMemo2(
|
|
225
|
+
() => data.flatMap((rate) => rate.rules ?? []),
|
|
226
|
+
[data]
|
|
227
|
+
);
|
|
228
|
+
const { names } = useScopeReferenceNames(allRules);
|
|
229
|
+
const columns = useColumns(names);
|
|
230
|
+
const { table } = useDataTable({
|
|
231
|
+
data,
|
|
232
|
+
columns,
|
|
233
|
+
count: count ?? 0,
|
|
234
|
+
enablePagination: true,
|
|
235
|
+
getRowId: (row) => row.id,
|
|
236
|
+
pageSize: PAGE_SIZE
|
|
237
|
+
});
|
|
238
|
+
if (isError) {
|
|
239
|
+
throw error;
|
|
240
|
+
}
|
|
241
|
+
return /* @__PURE__ */ jsx2(
|
|
242
|
+
_DataTable,
|
|
243
|
+
{
|
|
244
|
+
table,
|
|
245
|
+
columns,
|
|
246
|
+
count: count ?? 0,
|
|
247
|
+
pageSize: PAGE_SIZE,
|
|
248
|
+
isLoading,
|
|
249
|
+
queryObject: raw,
|
|
250
|
+
filters,
|
|
251
|
+
navigateTo: (row) => `${row.original.id}`,
|
|
252
|
+
pagination: true,
|
|
253
|
+
search: true,
|
|
254
|
+
orderBy: [
|
|
255
|
+
{ key: "name", label: t("commissions.rules.columns.rule", "Rule") },
|
|
256
|
+
{ key: "created_at", label: t("fields.createdAt") },
|
|
257
|
+
{ key: "updated_at", label: t("fields.updatedAt") }
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
};
|
|
262
|
+
var CommissionRuleRowActions = ({ rule }) => {
|
|
263
|
+
const { t } = useTranslation3();
|
|
264
|
+
const handleDelete = useDeleteCommissionRuleAction(rule);
|
|
265
|
+
return /* @__PURE__ */ jsx2(
|
|
266
|
+
ActionMenu,
|
|
267
|
+
{
|
|
268
|
+
groups: [
|
|
269
|
+
{
|
|
270
|
+
actions: [
|
|
271
|
+
{
|
|
272
|
+
label: t("actions.edit"),
|
|
273
|
+
to: `/settings/commissions/${rule.id}/edit`,
|
|
274
|
+
icon: /* @__PURE__ */ jsx2(PencilSquare2, {})
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
actions: [
|
|
280
|
+
{
|
|
281
|
+
label: t("actions.delete"),
|
|
282
|
+
onClick: handleDelete,
|
|
283
|
+
icon: /* @__PURE__ */ jsx2(Trash, {})
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
};
|
|
291
|
+
var columnHelper = createColumnHelper();
|
|
292
|
+
var useColumns = (names) => {
|
|
293
|
+
const { t } = useTranslation3();
|
|
294
|
+
return useMemo2(
|
|
295
|
+
() => [
|
|
296
|
+
columnHelper.accessor("name", {
|
|
297
|
+
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("commissions.rules.columns.rule", "Rule") }),
|
|
298
|
+
cell: ({ getValue }) => /* @__PURE__ */ jsx2(TextCell, { text: getValue() })
|
|
299
|
+
}),
|
|
300
|
+
columnHelper.display({
|
|
301
|
+
id: "type",
|
|
302
|
+
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("commissions.rules.columns.type", "Type") }),
|
|
303
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(TextCell, { text: getScopeTypeLabel(row.original.rules, t) })
|
|
304
|
+
}),
|
|
305
|
+
columnHelper.display({
|
|
306
|
+
id: "scope",
|
|
307
|
+
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("commissions.rules.columns.scope", "Scope") }),
|
|
308
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(TextCell, { text: getScopeSummary(row.original.rules, names) })
|
|
309
|
+
}),
|
|
310
|
+
columnHelper.display({
|
|
311
|
+
id: "value",
|
|
312
|
+
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("commissions.rules.columns.value", "Value") }),
|
|
313
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(TextCell, { text: formatCommissionValue(row.original) })
|
|
314
|
+
}),
|
|
315
|
+
columnHelper.accessor("is_enabled", {
|
|
316
|
+
header: () => /* @__PURE__ */ jsx2(TextHeader, { text: t("commissions.rules.columns.status", "Status") }),
|
|
317
|
+
cell: ({ getValue }) => {
|
|
318
|
+
const props = getIsActiveProps(getValue(), t);
|
|
319
|
+
return /* @__PURE__ */ jsx2(StatusBadge, { color: props.color, children: props.label });
|
|
320
|
+
}
|
|
321
|
+
}),
|
|
322
|
+
columnHelper.display({
|
|
323
|
+
id: "actions",
|
|
324
|
+
cell: ({ row }) => /* @__PURE__ */ jsx2(CommissionRuleRowActions, { rule: row.original })
|
|
325
|
+
})
|
|
326
|
+
],
|
|
327
|
+
[t, names]
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/commission-rules-header.tsx
|
|
332
|
+
import { Button, Heading as Heading2 } from "@medusajs/ui";
|
|
333
|
+
import { useTranslation as useTranslation4 } from "react-i18next";
|
|
334
|
+
import { Link } from "react-router-dom";
|
|
335
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
336
|
+
var CommissionRulesHeader = () => {
|
|
337
|
+
const { t } = useTranslation4();
|
|
338
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
339
|
+
/* @__PURE__ */ jsx3(Heading2, { children: t("commissions.rules.title", "Commission Rules") }),
|
|
340
|
+
/* @__PURE__ */ jsx3(Button, { size: "small", variant: "secondary", asChild: true, children: /* @__PURE__ */ jsx3(Link, { to: "create", children: t("actions.create") }) })
|
|
341
|
+
] });
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
// src/pages/commissions/commissions-list/components/commission-rules-table/commission-rules-table.tsx
|
|
345
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
346
|
+
var CommissionRulesTable = () => {
|
|
347
|
+
return /* @__PURE__ */ jsxs3(Container2, { className: "divide-y p-0", children: [
|
|
348
|
+
/* @__PURE__ */ jsx4(CommissionRulesHeader, {}),
|
|
349
|
+
/* @__PURE__ */ jsx4(CommissionRulesDataTable, {})
|
|
350
|
+
] });
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// src/pages/commissions/commissions-list/commissions-page.tsx
|
|
354
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
355
|
+
var Root = ({ children }) => {
|
|
356
|
+
return /* @__PURE__ */ jsx5(SingleColumnPage, { hasOutlet: true, "data-testid": "commissions-page", children: Children.count(children) > 0 ? children : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
357
|
+
/* @__PURE__ */ jsx5(GlobalCommissionSection, {}),
|
|
358
|
+
/* @__PURE__ */ jsx5(CommissionRulesTable, {})
|
|
359
|
+
] }) });
|
|
360
|
+
};
|
|
361
|
+
var CommissionsPage = Object.assign(Root, {
|
|
362
|
+
GlobalCommission: GlobalCommissionSection,
|
|
363
|
+
RulesTable: CommissionRulesTable
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
export {
|
|
367
|
+
CommissionsPage
|
|
368
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDeleteShippingOptionTypeAction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L5Z4JGRD.js";
|
|
4
4
|
import {
|
|
5
5
|
useDateTableFilters
|
|
6
6
|
} from "./chunk-26OOAKQ6.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-THHRRYRS.js";
|
|
23
23
|
import {
|
|
24
24
|
useShippingOptionTypes
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-PJR6W35H.js";
|
|
26
26
|
import {
|
|
27
27
|
ActionMenu
|
|
28
28
|
} from "./chunk-BDGZ4EQO.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useDeleteProductTagAction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FYKG35MR.js";
|
|
4
4
|
import {
|
|
5
5
|
useProductTagTableColumns
|
|
6
6
|
} from "./chunk-5A4JNOK3.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-KOURHC2N.js";
|
|
10
10
|
import {
|
|
11
11
|
useProductTagTableQuery
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HYQPZADS.js";
|
|
13
13
|
import {
|
|
14
14
|
_DataTable,
|
|
15
15
|
useDataTable
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-H6MYB7GB.js";
|
|
20
20
|
import {
|
|
21
21
|
useProductTags
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PJR6W35H.js";
|
|
23
23
|
import {
|
|
24
24
|
ActionMenu
|
|
25
25
|
} from "./chunk-BDGZ4EQO.js";
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useDeleteCommissionRuleAction,
|
|
3
|
+
useScopeReferenceNames
|
|
4
|
+
} from "./chunk-RXRDZ47F.js";
|
|
5
|
+
import {
|
|
6
|
+
formatCommissionValue,
|
|
7
|
+
getIsActiveProps,
|
|
8
|
+
getScopeSummary,
|
|
9
|
+
getScopeTypeLabel,
|
|
10
|
+
referenceIds
|
|
11
|
+
} from "./chunk-PN5C4AND.js";
|
|
12
|
+
import {
|
|
13
|
+
SectionRow
|
|
14
|
+
} from "./chunk-3XPXUIK3.js";
|
|
15
|
+
import {
|
|
16
|
+
SingleColumnPage
|
|
17
|
+
} from "./chunk-H6MYB7GB.js";
|
|
18
|
+
import {
|
|
19
|
+
useCommissionRule
|
|
20
|
+
} from "./chunk-ZIFHQXP3.js";
|
|
21
|
+
import {
|
|
22
|
+
ActionMenu
|
|
23
|
+
} from "./chunk-BDGZ4EQO.js";
|
|
24
|
+
|
|
25
|
+
// src/pages/commissions/commission-rule-detail/commission-rule-detail.tsx
|
|
26
|
+
import { PencilSquare, Trash } from "@medusajs/icons";
|
|
27
|
+
import { Container, Heading, StatusBadge } from "@medusajs/ui";
|
|
28
|
+
import { useTranslation } from "react-i18next";
|
|
29
|
+
import { useParams } from "react-router-dom";
|
|
30
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
|
+
var ScopeSection = ({ rule }) => {
|
|
32
|
+
const { t } = useTranslation();
|
|
33
|
+
const handleDelete = useDeleteCommissionRuleAction(rule);
|
|
34
|
+
const statusProps = getIsActiveProps(rule.is_enabled, t);
|
|
35
|
+
const { names } = useScopeReferenceNames(rule.rules);
|
|
36
|
+
const stores = referenceIds(rule.rules, "seller");
|
|
37
|
+
const productTypes = referenceIds(rule.rules, "product_type");
|
|
38
|
+
const categories = referenceIds(rule.rules, "product_category");
|
|
39
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Heading, { children: rule.name }),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(StatusBadge, { color: statusProps.color, children: statusProps.label }),
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
ActionMenu,
|
|
46
|
+
{
|
|
47
|
+
groups: [
|
|
48
|
+
{
|
|
49
|
+
actions: [
|
|
50
|
+
{
|
|
51
|
+
label: t("actions.edit"),
|
|
52
|
+
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
53
|
+
to: "edit"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
actions: [
|
|
59
|
+
{
|
|
60
|
+
label: t("actions.delete"),
|
|
61
|
+
icon: /* @__PURE__ */ jsx(Trash, {}),
|
|
62
|
+
onClick: handleDelete
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
] }),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
SectionRow,
|
|
73
|
+
{
|
|
74
|
+
title: t("commissions.fields.code", "Code"),
|
|
75
|
+
value: rule.code
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
SectionRow,
|
|
80
|
+
{
|
|
81
|
+
title: t("commissions.rules.columns.type", "Type"),
|
|
82
|
+
value: getScopeTypeLabel(rule.rules, t)
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
stores.length > 0 && /* @__PURE__ */ jsx(
|
|
86
|
+
SectionRow,
|
|
87
|
+
{
|
|
88
|
+
title: t("commissions.fields.stores", "Stores"),
|
|
89
|
+
value: getScopeSummary(
|
|
90
|
+
(rule.rules ?? []).filter((r) => r.reference === "seller"),
|
|
91
|
+
names
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
productTypes.length > 0 && /* @__PURE__ */ jsx(
|
|
96
|
+
SectionRow,
|
|
97
|
+
{
|
|
98
|
+
title: t("commissions.fields.productTypes", "Product Types"),
|
|
99
|
+
value: getScopeSummary(
|
|
100
|
+
(rule.rules ?? []).filter((r) => r.reference === "product_type"),
|
|
101
|
+
names
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
categories.length > 0 && /* @__PURE__ */ jsx(
|
|
106
|
+
SectionRow,
|
|
107
|
+
{
|
|
108
|
+
title: t("commissions.fields.categories", "Categories"),
|
|
109
|
+
value: getScopeSummary(
|
|
110
|
+
(rule.rules ?? []).filter(
|
|
111
|
+
(r) => r.reference === "product_category"
|
|
112
|
+
),
|
|
113
|
+
names
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] });
|
|
118
|
+
};
|
|
119
|
+
var CommissionSection = ({ rule }) => {
|
|
120
|
+
const { t } = useTranslation();
|
|
121
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Heading, { children: t("commissions.create.commission", "Commission") }),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
ActionMenu,
|
|
126
|
+
{
|
|
127
|
+
groups: [
|
|
128
|
+
{
|
|
129
|
+
actions: [
|
|
130
|
+
{
|
|
131
|
+
label: t("actions.edit"),
|
|
132
|
+
icon: /* @__PURE__ */ jsx(PencilSquare, {}),
|
|
133
|
+
to: "edit-commission"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
SectionRow,
|
|
143
|
+
{
|
|
144
|
+
title: t("commissions.fields.type.label", "Type"),
|
|
145
|
+
value: rule.type === "percentage" ? t("commissions.fields.type.percentage", "Percentage") : t("commissions.fields.type.fixed", "Fixed")
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
SectionRow,
|
|
150
|
+
{
|
|
151
|
+
title: t("commissions.global.value", "Value"),
|
|
152
|
+
value: formatCommissionValue(rule)
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
SectionRow,
|
|
157
|
+
{
|
|
158
|
+
title: t("commissions.global.tax", "Tax"),
|
|
159
|
+
value: rule.include_tax ? t("commissions.global.included", "Included in commission") : t("commissions.global.notIncluded", "Not included")
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
SectionRow,
|
|
164
|
+
{
|
|
165
|
+
title: t("commissions.global.shipping", "Shipping"),
|
|
166
|
+
value: rule.include_shipping ? t("commissions.global.included", "Included in commission") : t("commissions.global.notIncluded", "Not included")
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] });
|
|
170
|
+
};
|
|
171
|
+
var CommissionRuleDetail = () => {
|
|
172
|
+
const { id } = useParams();
|
|
173
|
+
const { commission_rate, isLoading, isError, error } = useCommissionRule(
|
|
174
|
+
id,
|
|
175
|
+
{ fields: "*rules,*values" }
|
|
176
|
+
);
|
|
177
|
+
if (isError) {
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
if (isLoading || !commission_rate) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
return /* @__PURE__ */ jsxs(SingleColumnPage, { hasOutlet: true, data: commission_rate, children: [
|
|
184
|
+
/* @__PURE__ */ jsx(ScopeSection, { rule: commission_rate }),
|
|
185
|
+
/* @__PURE__ */ jsx(CommissionSection, { rule: commission_rate })
|
|
186
|
+
] });
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export {
|
|
190
|
+
CommissionRuleDetail
|
|
191
|
+
};
|