@medusajs/draft-order 2.22.3-snapshot-20261030141225 → 2.22.3
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/.medusa/server/src/admin/index.js +326 -166
- package/.medusa/server/src/admin/index.mjs +326 -166
- package/AGENTS.md +1 -0
- package/package.json +19 -19
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const adminSdk = require("@medusajs/admin-sdk");
|
|
4
4
|
const components = require("@medusajs/dashboard/components");
|
|
5
|
+
const hooks = require("@medusajs/dashboard/hooks");
|
|
5
6
|
const ui = require("@medusajs/ui");
|
|
6
7
|
const reactQuery = require("@tanstack/react-query");
|
|
7
8
|
const React = require("react");
|
|
@@ -942,8 +943,42 @@ const useDataTableDateFilters = (disableRangeOption) => {
|
|
|
942
943
|
];
|
|
943
944
|
}, [dateFilterOptions, getFullDate, rangeOptions]);
|
|
944
945
|
};
|
|
946
|
+
const VIEW_DRAFT_ORDER_PERMISSIONS = ["order:read"];
|
|
947
|
+
const CREATE_DRAFT_ORDER_PERMISSIONS = [
|
|
948
|
+
"order:read",
|
|
949
|
+
"order:create",
|
|
950
|
+
"region:read",
|
|
951
|
+
"sales_channel:read"
|
|
952
|
+
];
|
|
953
|
+
const EDIT_DRAFT_ORDER_PERMISSIONS = [
|
|
954
|
+
"order:read",
|
|
955
|
+
"order:update"
|
|
956
|
+
];
|
|
957
|
+
const EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS = [
|
|
958
|
+
"order:read",
|
|
959
|
+
"order:update",
|
|
960
|
+
"sales_channel:read"
|
|
961
|
+
];
|
|
962
|
+
const TRANSFER_DRAFT_ORDER_PERMISSIONS = [
|
|
963
|
+
"order:read",
|
|
964
|
+
"order:update",
|
|
965
|
+
"customer:read"
|
|
966
|
+
];
|
|
967
|
+
const EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS = [
|
|
968
|
+
"order:read",
|
|
969
|
+
"order:update",
|
|
970
|
+
"promotion:read",
|
|
971
|
+
"order_change:read",
|
|
972
|
+
"order_change:update"
|
|
973
|
+
];
|
|
974
|
+
const EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS = [
|
|
975
|
+
"order:read",
|
|
976
|
+
"order:update",
|
|
977
|
+
"shipping_option:read",
|
|
978
|
+
"stock_location:read"
|
|
979
|
+
];
|
|
945
980
|
const PAGE_SIZE = 20;
|
|
946
|
-
const handle$
|
|
981
|
+
const handle$c = {
|
|
947
982
|
breadcrumb: () => "Draft Orders"
|
|
948
983
|
};
|
|
949
984
|
const List = () => {
|
|
@@ -963,6 +998,8 @@ const List = () => {
|
|
|
963
998
|
);
|
|
964
999
|
const columns = useColumns$1();
|
|
965
1000
|
const filters = useFilters();
|
|
1001
|
+
const { hasAllPermissions } = hooks.usePermissions();
|
|
1002
|
+
const canCreate = hasAllPermissions(CREATE_DRAFT_ORDER_PERMISSIONS);
|
|
966
1003
|
if (isError) {
|
|
967
1004
|
throw error;
|
|
968
1005
|
}
|
|
@@ -983,10 +1020,10 @@ const List = () => {
|
|
|
983
1020
|
pageSize: PAGE_SIZE,
|
|
984
1021
|
rowCount: count,
|
|
985
1022
|
heading: t("draftOrders.domain"),
|
|
986
|
-
action: {
|
|
1023
|
+
action: canCreate ? {
|
|
987
1024
|
label: t("actions.create"),
|
|
988
1025
|
to: "create"
|
|
989
|
-
},
|
|
1026
|
+
} : void 0,
|
|
990
1027
|
rowHref: (row) => `${row.id}`,
|
|
991
1028
|
emptyState: {
|
|
992
1029
|
empty: {
|
|
@@ -1006,7 +1043,8 @@ const List = () => {
|
|
|
1006
1043
|
};
|
|
1007
1044
|
const config = adminSdk.defineRouteConfig({
|
|
1008
1045
|
label: "Drafts",
|
|
1009
|
-
nested: "/orders"
|
|
1046
|
+
nested: "/orders",
|
|
1047
|
+
permissions: VIEW_DRAFT_ORDER_PERMISSIONS
|
|
1010
1048
|
});
|
|
1011
1049
|
const columnHelper$1 = ui.createDataTableColumnHelper();
|
|
1012
1050
|
const useColumns$1 = () => {
|
|
@@ -1059,13 +1097,18 @@ const useColumns$1 = () => {
|
|
|
1059
1097
|
};
|
|
1060
1098
|
const useFilters = () => {
|
|
1061
1099
|
const dateFilterOptions = useDataTableDateFilters();
|
|
1100
|
+
const { hasPermission } = hooks.usePermissions();
|
|
1101
|
+
const canReadCustomers = hasPermission("customer:read");
|
|
1102
|
+
const canReadSalesChannels = hasPermission("sales_channel:read");
|
|
1103
|
+
const canReadRegions = hasPermission("region:read");
|
|
1062
1104
|
const { customers } = useCustomers(
|
|
1063
1105
|
{
|
|
1064
1106
|
limit: 1e3,
|
|
1065
1107
|
fields: "id,email"
|
|
1066
1108
|
},
|
|
1067
1109
|
{
|
|
1068
|
-
throwOnError: true
|
|
1110
|
+
throwOnError: true,
|
|
1111
|
+
enabled: canReadCustomers
|
|
1069
1112
|
}
|
|
1070
1113
|
);
|
|
1071
1114
|
const { sales_channels } = useSalesChannels(
|
|
@@ -1074,7 +1117,8 @@ const useFilters = () => {
|
|
|
1074
1117
|
fields: "id,name"
|
|
1075
1118
|
},
|
|
1076
1119
|
{
|
|
1077
|
-
throwOnError: true
|
|
1120
|
+
throwOnError: true,
|
|
1121
|
+
enabled: canReadSalesChannels
|
|
1078
1122
|
}
|
|
1079
1123
|
);
|
|
1080
1124
|
const { regions } = useRegions(
|
|
@@ -1082,11 +1126,12 @@ const useFilters = () => {
|
|
|
1082
1126
|
limit: 1e3,
|
|
1083
1127
|
fields: "id,name"
|
|
1084
1128
|
},
|
|
1085
|
-
{ throwOnError: true }
|
|
1129
|
+
{ throwOnError: true, enabled: canReadRegions }
|
|
1086
1130
|
);
|
|
1087
1131
|
return React.useMemo(() => {
|
|
1088
|
-
|
|
1089
|
-
|
|
1132
|
+
const filters = [];
|
|
1133
|
+
if (canReadCustomers) {
|
|
1134
|
+
filters.push({
|
|
1090
1135
|
id: "customer_id",
|
|
1091
1136
|
label: "Customer",
|
|
1092
1137
|
options: customers?.filter(
|
|
@@ -1096,8 +1141,10 @@ const useFilters = () => {
|
|
|
1096
1141
|
value: customer.id
|
|
1097
1142
|
})) ?? [],
|
|
1098
1143
|
type: "select"
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
if (canReadSalesChannels) {
|
|
1147
|
+
filters.push({
|
|
1101
1148
|
id: "sales_channel_id",
|
|
1102
1149
|
label: "Sales Channel",
|
|
1103
1150
|
options: sales_channels?.map((sales_channel) => ({
|
|
@@ -1105,8 +1152,10 @@ const useFilters = () => {
|
|
|
1105
1152
|
value: sales_channel.id
|
|
1106
1153
|
})) ?? [],
|
|
1107
1154
|
type: "select"
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
if (canReadRegions) {
|
|
1158
|
+
filters.push({
|
|
1110
1159
|
id: "region_id",
|
|
1111
1160
|
label: "Region",
|
|
1112
1161
|
options: regions?.map((region) => ({
|
|
@@ -1114,10 +1163,18 @@ const useFilters = () => {
|
|
|
1114
1163
|
value: region.id
|
|
1115
1164
|
})) ?? [],
|
|
1116
1165
|
type: "select"
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
];
|
|
1120
|
-
}, [
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
return [...filters, ...dateFilterOptions];
|
|
1169
|
+
}, [
|
|
1170
|
+
canReadCustomers,
|
|
1171
|
+
canReadSalesChannels,
|
|
1172
|
+
canReadRegions,
|
|
1173
|
+
customers,
|
|
1174
|
+
sales_channels,
|
|
1175
|
+
regions,
|
|
1176
|
+
dateFilterOptions
|
|
1177
|
+
]);
|
|
1121
1178
|
};
|
|
1122
1179
|
const useDraftOrderTableQuery = ({
|
|
1123
1180
|
prefix,
|
|
@@ -3962,7 +4019,7 @@ const useComboboxData = ({
|
|
|
3962
4019
|
limit: Array.isArray(defaultValue) ? defaultValue.length : 1
|
|
3963
4020
|
});
|
|
3964
4021
|
},
|
|
3965
|
-
enabled: !!defaultValue
|
|
4022
|
+
enabled: enabled && !!defaultValue
|
|
3966
4023
|
});
|
|
3967
4024
|
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
3968
4025
|
queryKey: [...queryKey, query2],
|
|
@@ -4016,6 +4073,8 @@ const Create = () => {
|
|
|
4016
4073
|
};
|
|
4017
4074
|
const CreateForm = () => {
|
|
4018
4075
|
const { handleSuccess } = useRouteModal();
|
|
4076
|
+
const { hasPermission } = hooks.usePermissions();
|
|
4077
|
+
const canReadCustomers = hasPermission("customer:read");
|
|
4019
4078
|
const form = reactHookForm.useForm({
|
|
4020
4079
|
defaultValues: {
|
|
4021
4080
|
region_id: "",
|
|
@@ -4158,8 +4217,16 @@ const CreateForm = () => {
|
|
|
4158
4217
|
}
|
|
4159
4218
|
) }),
|
|
4160
4219
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
4161
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4162
|
-
|
|
4220
|
+
canReadCustomers && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4221
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4222
|
+
CustomerField$1,
|
|
4223
|
+
{
|
|
4224
|
+
control: form.control,
|
|
4225
|
+
setValue: form.setValue
|
|
4226
|
+
}
|
|
4227
|
+
),
|
|
4228
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" })
|
|
4229
|
+
] }),
|
|
4163
4230
|
/* @__PURE__ */ jsxRuntime.jsx(EmailField, { control: form.control }),
|
|
4164
4231
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
4165
4232
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4303,6 +4370,8 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
4303
4370
|
const customerId = reactHookForm.useWatch({ control, name: "customer_id" });
|
|
4304
4371
|
const addressId = reactHookForm.useWatch({ control, name: `${type}_id` });
|
|
4305
4372
|
const sameAsShipping = reactHookForm.useWatch({ control, name: "same_as_shipping" });
|
|
4373
|
+
const { hasPermission } = hooks.usePermissions();
|
|
4374
|
+
const canReadAddresses = hasPermission("customer_address:read");
|
|
4306
4375
|
const { customer } = useCustomer(
|
|
4307
4376
|
customerId,
|
|
4308
4377
|
{},
|
|
@@ -4335,7 +4404,7 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
4335
4404
|
};
|
|
4336
4405
|
});
|
|
4337
4406
|
},
|
|
4338
|
-
enabled: !!customerId
|
|
4407
|
+
enabled: !!customerId && canReadAddresses
|
|
4339
4408
|
});
|
|
4340
4409
|
const onSelectAddress = async (addressId2) => {
|
|
4341
4410
|
if (!addressId2 || !customerId) {
|
|
@@ -4400,7 +4469,7 @@ const AddressField = ({ type, control, setValue }) => {
|
|
|
4400
4469
|
}
|
|
4401
4470
|
),
|
|
4402
4471
|
showFields && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
4403
|
-
customerId && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
4472
|
+
customerId && canReadAddresses && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
4404
4473
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4405
4474
|
Form$2.Field,
|
|
4406
4475
|
{
|
|
@@ -4624,6 +4693,9 @@ const schema$6 = zod.z.object({
|
|
|
4624
4693
|
}
|
|
4625
4694
|
}
|
|
4626
4695
|
});
|
|
4696
|
+
const handle$b = {
|
|
4697
|
+
permissions: CREATE_DRAFT_ORDER_PERMISSIONS
|
|
4698
|
+
};
|
|
4627
4699
|
const PageSkeleton = ({
|
|
4628
4700
|
mainSections = 2,
|
|
4629
4701
|
sidebarSections = 1,
|
|
@@ -4674,6 +4746,8 @@ const DETAILS_PAGE_REGEX = /\/draft-orders\/[a-zA-Z0-9_-]+\/?$/;
|
|
|
4674
4746
|
const ActiveOrderChange = ({ orderId }) => {
|
|
4675
4747
|
const { order: preview } = useOrderPreview(orderId);
|
|
4676
4748
|
const location = reactRouterDom.useLocation();
|
|
4749
|
+
const { hasPermission } = hooks.usePermissions();
|
|
4750
|
+
const canUpdate = hasPermission("order:update");
|
|
4677
4751
|
const isPending = preview?.order_change?.status === "pending";
|
|
4678
4752
|
const isDetailsPage = DETAILS_PAGE_REGEX.test(location.pathname);
|
|
4679
4753
|
const { mutateAsync, isPending: isMutating } = useDraftOrderCancelEdit(orderId);
|
|
@@ -4706,28 +4780,30 @@ const ActiveOrderChange = ({ orderId }) => {
|
|
|
4706
4780
|
] }),
|
|
4707
4781
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
4708
4782
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-pretty", children: noActions ? "There is a pending edit on this draft order with no changes. Click below to cancel it, or open one of the menus to start making changes." : "There is a pending edit on this draft order with changes. Click below to cancel it, or continue to complete the edit." }) }),
|
|
4709
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4783
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4784
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
4785
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-component px-6 py-4 justify-end items-center flex gap-x-2", children: [
|
|
4786
|
+
!noActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4787
|
+
ui.Button,
|
|
4788
|
+
{
|
|
4789
|
+
size: "small",
|
|
4790
|
+
variant: "secondary",
|
|
4791
|
+
isLoading: isMutating,
|
|
4792
|
+
onClick: onCancel,
|
|
4793
|
+
children: "Continue"
|
|
4794
|
+
}
|
|
4795
|
+
),
|
|
4796
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4797
|
+
ui.Button,
|
|
4798
|
+
{
|
|
4799
|
+
size: "small",
|
|
4800
|
+
variant: "secondary",
|
|
4801
|
+
isLoading: isMutating,
|
|
4802
|
+
onClick: onCancel,
|
|
4803
|
+
children: "Cancel"
|
|
4804
|
+
}
|
|
4805
|
+
)
|
|
4806
|
+
] })
|
|
4731
4807
|
] })
|
|
4732
4808
|
] })
|
|
4733
4809
|
}
|
|
@@ -4798,8 +4874,10 @@ const CollapsibleActivityItemList = ({
|
|
|
4798
4874
|
] });
|
|
4799
4875
|
};
|
|
4800
4876
|
const ActivityItem = ({ item, isFirst = false }) => {
|
|
4877
|
+
const { hasPermission } = hooks.usePermissions();
|
|
4878
|
+
const showUser = !!item.userId && hasPermission("user:read");
|
|
4801
4879
|
const { user, isPending, isError, error } = useUser(item.userId, void 0, {
|
|
4802
|
-
enabled:
|
|
4880
|
+
enabled: showUser
|
|
4803
4881
|
});
|
|
4804
4882
|
if (isError) {
|
|
4805
4883
|
throw error;
|
|
@@ -4826,7 +4904,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
|
|
|
4826
4904
|
)
|
|
4827
4905
|
] }),
|
|
4828
4906
|
item.content && renderContent(item.content),
|
|
4829
|
-
|
|
4907
|
+
showUser && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
|
|
4830
4908
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
|
|
4831
4909
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4832
4910
|
ui.Avatar,
|
|
@@ -5055,44 +5133,51 @@ const CustomerSection = ({ order }) => {
|
|
|
5055
5133
|
] });
|
|
5056
5134
|
};
|
|
5057
5135
|
const Header = () => {
|
|
5136
|
+
const { hasAllPermissions } = hooks.usePermissions();
|
|
5137
|
+
const canTransfer = hasAllPermissions(TRANSFER_DRAFT_ORDER_PERMISSIONS);
|
|
5138
|
+
const canEdit = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
|
|
5058
5139
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-6 py-4 gap-2", children: [
|
|
5059
5140
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Customer" }),
|
|
5060
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5141
|
+
(canTransfer || canEdit) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5061
5142
|
ActionMenu,
|
|
5062
5143
|
{
|
|
5063
5144
|
groups: [
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5145
|
+
...canTransfer ? [
|
|
5146
|
+
{
|
|
5147
|
+
actions: [
|
|
5148
|
+
{
|
|
5149
|
+
label: "Transfer ownership",
|
|
5150
|
+
to: "transfer-ownership",
|
|
5151
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, {})
|
|
5152
|
+
}
|
|
5153
|
+
]
|
|
5154
|
+
}
|
|
5155
|
+
] : [],
|
|
5156
|
+
...canEdit ? [
|
|
5157
|
+
{
|
|
5158
|
+
actions: [
|
|
5159
|
+
{
|
|
5160
|
+
label: "Edit shipping address",
|
|
5161
|
+
to: "shipping-address",
|
|
5162
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.FlyingBox, {})
|
|
5163
|
+
},
|
|
5164
|
+
{
|
|
5165
|
+
label: "Edit billing address",
|
|
5166
|
+
to: "billing-address",
|
|
5167
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CurrencyDollar, {})
|
|
5168
|
+
}
|
|
5169
|
+
]
|
|
5170
|
+
},
|
|
5171
|
+
{
|
|
5172
|
+
actions: [
|
|
5173
|
+
{
|
|
5174
|
+
label: "Edit email",
|
|
5175
|
+
to: `email`,
|
|
5176
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Envelope, {})
|
|
5177
|
+
}
|
|
5178
|
+
]
|
|
5179
|
+
}
|
|
5180
|
+
] : []
|
|
5096
5181
|
]
|
|
5097
5182
|
}
|
|
5098
5183
|
)
|
|
@@ -5202,12 +5287,18 @@ const Addresses = ({ order }) => {
|
|
|
5202
5287
|
};
|
|
5203
5288
|
const GeneralSection = ({ order }) => {
|
|
5204
5289
|
const navigate = reactRouterDom.useNavigate();
|
|
5290
|
+
const { hasPermission, hasAllPermissions } = hooks.usePermissions();
|
|
5291
|
+
const canReadRegion = hasPermission("region:read");
|
|
5292
|
+
const canEditSalesChannel = hasAllPermissions(
|
|
5293
|
+
EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS
|
|
5294
|
+
);
|
|
5295
|
+
const canDelete = hasPermission("order:delete");
|
|
5205
5296
|
const { mutateAsync: deleteDraftOrder, isPending: isDeleting } = useDeleteDraftOrder();
|
|
5206
5297
|
const { region, isPending, isError, error } = useRegion(
|
|
5207
5298
|
order.region_id,
|
|
5208
5299
|
void 0,
|
|
5209
5300
|
{
|
|
5210
|
-
enabled: !!order.region_id
|
|
5301
|
+
enabled: canReadRegion && !!order.region_id
|
|
5211
5302
|
}
|
|
5212
5303
|
);
|
|
5213
5304
|
const isRegionLoaded = !!region && !isPending;
|
|
@@ -5222,37 +5313,41 @@ const GeneralSection = ({ order }) => {
|
|
|
5222
5313
|
order.display_id
|
|
5223
5314
|
] }),
|
|
5224
5315
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content: `#${order.display_id}` }),
|
|
5225
|
-
isRegionLoaded ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", rounded: "full", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/regions/${region?.id}`, children: region?.name }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "w-14 h-5 rounded-full" })
|
|
5316
|
+
canReadRegion && (isRegionLoaded ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", rounded: "full", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/regions/${region?.id}`, children: region?.name }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "w-14 h-5 rounded-full" }))
|
|
5226
5317
|
] }),
|
|
5227
5318
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: `${getFullDate({
|
|
5228
5319
|
date: order.created_at,
|
|
5229
5320
|
includeTime: true
|
|
5230
5321
|
})} from ${order.sales_channel?.name}` })
|
|
5231
5322
|
] }),
|
|
5232
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5323
|
+
(canEditSalesChannel || canDelete) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5233
5324
|
ActionMenu,
|
|
5234
5325
|
{
|
|
5235
5326
|
groups: [
|
|
5236
5327
|
{
|
|
5237
5328
|
actions: [
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5329
|
+
...canEditSalesChannel ? [
|
|
5330
|
+
{
|
|
5331
|
+
label: "Edit sales channel",
|
|
5332
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Channels, {}),
|
|
5333
|
+
to: "sales-channel"
|
|
5334
|
+
}
|
|
5335
|
+
] : [],
|
|
5336
|
+
...canDelete ? [
|
|
5337
|
+
{
|
|
5338
|
+
label: "Delete draft order",
|
|
5339
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
|
|
5340
|
+
onClick: async () => {
|
|
5341
|
+
try {
|
|
5342
|
+
await deleteDraftOrder(order.id);
|
|
5343
|
+
navigate("/draft-orders");
|
|
5344
|
+
} catch (error2) {
|
|
5345
|
+
ui.toast.error(error2.message);
|
|
5346
|
+
}
|
|
5347
|
+
},
|
|
5348
|
+
disabled: isDeleting
|
|
5349
|
+
}
|
|
5350
|
+
] : []
|
|
5256
5351
|
]
|
|
5257
5352
|
}
|
|
5258
5353
|
]
|
|
@@ -5393,6 +5488,8 @@ const Copied = ({ style, value }) => {
|
|
|
5393
5488
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { ...style, ...styl }, onClick: handler, children: /* @__PURE__ */ jsxRuntime.jsx(icons.SquareTwoStack, { className: "text-ui-contrast-fg-secondary" }) });
|
|
5394
5489
|
};
|
|
5395
5490
|
const MetadataSection = ({ order }) => {
|
|
5491
|
+
const { hasAllPermissions } = hooks.usePermissions();
|
|
5492
|
+
const canEdit = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
|
|
5396
5493
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex items-center justify-between", children: [
|
|
5397
5494
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
5398
5495
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Metadata" }),
|
|
@@ -5401,7 +5498,7 @@ const MetadataSection = ({ order }) => {
|
|
|
5401
5498
|
" keys"
|
|
5402
5499
|
] })
|
|
5403
5500
|
] }),
|
|
5404
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5501
|
+
canEdit && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5405
5502
|
ui.IconButton,
|
|
5406
5503
|
{
|
|
5407
5504
|
variant: "transparent",
|
|
@@ -5428,6 +5525,10 @@ const Thumbnail = ({ thumbnail, alt = "" }) => {
|
|
|
5428
5525
|
};
|
|
5429
5526
|
const ShippingSection = ({ order }) => {
|
|
5430
5527
|
const orderHasShipping = order.shipping_methods.length > 0;
|
|
5528
|
+
const { hasAllPermissions } = hooks.usePermissions();
|
|
5529
|
+
const canEditShipping = hasAllPermissions(
|
|
5530
|
+
EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS
|
|
5531
|
+
);
|
|
5431
5532
|
const {
|
|
5432
5533
|
shipping_options = [],
|
|
5433
5534
|
isPending,
|
|
@@ -5481,8 +5582,10 @@ const ShippingSection = ({ order }) => {
|
|
|
5481
5582
|
shipping_options,
|
|
5482
5583
|
idx === data.length - 1
|
|
5483
5584
|
) }, profile.id)) }),
|
|
5484
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5485
|
-
|
|
5585
|
+
canEditShipping && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5586
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
5587
|
+
/* @__PURE__ */ jsxRuntime.jsx(Footer$1, { isSomeProfilesAssigned })
|
|
5588
|
+
] })
|
|
5486
5589
|
] });
|
|
5487
5590
|
};
|
|
5488
5591
|
function renderShippingProfile(profile, shippingOptions, isLast) {
|
|
@@ -5737,31 +5840,41 @@ const getStylizedAmount = (amount, currencyCode) => {
|
|
|
5737
5840
|
};
|
|
5738
5841
|
const SummarySection = ({ order }) => {
|
|
5739
5842
|
const promotions = order.promotions || [];
|
|
5843
|
+
const { hasAllPermissions, hasPermission } = hooks.usePermissions();
|
|
5844
|
+
const canEditItems = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
|
|
5845
|
+
const canEditPromotions = hasAllPermissions(
|
|
5846
|
+
EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS
|
|
5847
|
+
);
|
|
5848
|
+
const canConvert = hasPermission("order:update");
|
|
5740
5849
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0 overflow-hidden", children: [
|
|
5741
5850
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4 flex items-center justify-between gap-x-4", children: [
|
|
5742
5851
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Summary" }),
|
|
5743
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5852
|
+
(canEditItems || canEditPromotions) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5744
5853
|
ActionMenu,
|
|
5745
5854
|
{
|
|
5746
5855
|
groups: [
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5856
|
+
...canEditItems ? [
|
|
5857
|
+
{
|
|
5858
|
+
actions: [
|
|
5859
|
+
{
|
|
5860
|
+
label: "Edit items",
|
|
5861
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
|
|
5862
|
+
to: "items"
|
|
5863
|
+
}
|
|
5864
|
+
]
|
|
5865
|
+
}
|
|
5866
|
+
] : [],
|
|
5867
|
+
...canEditPromotions ? [
|
|
5868
|
+
{
|
|
5869
|
+
actions: [
|
|
5870
|
+
{
|
|
5871
|
+
label: "Edit promotions",
|
|
5872
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.ReceiptPercent, {}),
|
|
5873
|
+
to: "promotions"
|
|
5874
|
+
}
|
|
5875
|
+
]
|
|
5876
|
+
}
|
|
5877
|
+
] : []
|
|
5765
5878
|
]
|
|
5766
5879
|
}
|
|
5767
5880
|
)
|
|
@@ -5790,8 +5903,10 @@ const SummarySection = ({ order }) => {
|
|
|
5790
5903
|
itemCount: order.items?.reduce((acc, item) => acc + item.quantity, 0) || 0
|
|
5791
5904
|
}
|
|
5792
5905
|
),
|
|
5793
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5794
|
-
|
|
5906
|
+
canConvert && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5907
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
5908
|
+
/* @__PURE__ */ jsxRuntime.jsx(Footer, { order })
|
|
5909
|
+
] })
|
|
5795
5910
|
] });
|
|
5796
5911
|
};
|
|
5797
5912
|
const Item$1 = ({ item, currencyCode }) => {
|
|
@@ -5926,8 +6041,9 @@ async function loader({ params }) {
|
|
|
5926
6041
|
});
|
|
5927
6042
|
return data;
|
|
5928
6043
|
}
|
|
5929
|
-
const handle = {
|
|
5930
|
-
breadcrumb: (match) => `#${match.loaderData.order.display_id}
|
|
6044
|
+
const handle$a = {
|
|
6045
|
+
breadcrumb: (match) => `#${match.loaderData.order.display_id}`,
|
|
6046
|
+
permissions: VIEW_DRAFT_ORDER_PERMISSIONS
|
|
5931
6047
|
};
|
|
5932
6048
|
const ID = () => {
|
|
5933
6049
|
const { id } = reactRouterDom.useParams();
|
|
@@ -5971,7 +6087,7 @@ const ID = () => {
|
|
|
5971
6087
|
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ActiveOrderChange", children: /* @__PURE__ */ jsxRuntime.jsx(ActiveOrderChange, { orderId: order.id }) }),
|
|
5972
6088
|
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GeneralSection", children: /* @__PURE__ */ jsxRuntime.jsx(GeneralSection, { order }) }),
|
|
5973
6089
|
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "SummarySection", children: /* @__PURE__ */ jsxRuntime.jsx(SummarySection, { order }) }),
|
|
5974
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsxRuntime.jsx(ShippingSection, { order }) }),
|
|
6090
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsxRuntime.jsx(hooks.PermissionGuard, { permission: "shipping_option:read", children: /* @__PURE__ */ jsxRuntime.jsx(ShippingSection, { order }) }) }),
|
|
5975
6091
|
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "MetadataSection", children: /* @__PURE__ */ jsxRuntime.jsx(MetadataSection, { order }) }),
|
|
5976
6092
|
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "JsonViewSection", children: /* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data: order }) })
|
|
5977
6093
|
] }),
|
|
@@ -6172,6 +6288,33 @@ const BillingAddressForm = ({ order }) => {
|
|
|
6172
6288
|
) });
|
|
6173
6289
|
};
|
|
6174
6290
|
const schema$5 = addressSchema;
|
|
6291
|
+
const handle$9 = {
|
|
6292
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
6293
|
+
};
|
|
6294
|
+
const CustomItems = () => {
|
|
6295
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
6296
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
6297
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
6298
|
+
] });
|
|
6299
|
+
};
|
|
6300
|
+
const CustomItemsForm = () => {
|
|
6301
|
+
const form = reactHookForm.useForm({
|
|
6302
|
+
resolver: zod$1.zodResolver(schema$4)
|
|
6303
|
+
});
|
|
6304
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
6305
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
6306
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
6307
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
6308
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
6309
|
+
] }) })
|
|
6310
|
+
] }) });
|
|
6311
|
+
};
|
|
6312
|
+
const schema$4 = zod.z.object({
|
|
6313
|
+
email: zod.z.string().email()
|
|
6314
|
+
});
|
|
6315
|
+
const handle$8 = {
|
|
6316
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
6317
|
+
};
|
|
6175
6318
|
const Email = () => {
|
|
6176
6319
|
const { id } = reactRouterDom.useParams();
|
|
6177
6320
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -6194,7 +6337,7 @@ const EmailForm = ({ order }) => {
|
|
|
6194
6337
|
defaultValues: {
|
|
6195
6338
|
email: order.email ?? ""
|
|
6196
6339
|
},
|
|
6197
|
-
resolver: zod$1.zodResolver(schema$
|
|
6340
|
+
resolver: zod$1.zodResolver(schema$3)
|
|
6198
6341
|
});
|
|
6199
6342
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
6200
6343
|
const { handleSuccess } = useRouteModal();
|
|
@@ -6237,30 +6380,12 @@ const EmailForm = ({ order }) => {
|
|
|
6237
6380
|
}
|
|
6238
6381
|
) });
|
|
6239
6382
|
};
|
|
6240
|
-
const schema$4 = zod.z.object({
|
|
6241
|
-
email: zod.z.string().email()
|
|
6242
|
-
});
|
|
6243
|
-
const CustomItems = () => {
|
|
6244
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
6245
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
6246
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
6247
|
-
] });
|
|
6248
|
-
};
|
|
6249
|
-
const CustomItemsForm = () => {
|
|
6250
|
-
const form = reactHookForm.useForm({
|
|
6251
|
-
resolver: zod$1.zodResolver(schema$3)
|
|
6252
|
-
});
|
|
6253
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
6254
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
6255
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
6256
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
6257
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
6258
|
-
] }) })
|
|
6259
|
-
] }) });
|
|
6260
|
-
};
|
|
6261
6383
|
const schema$3 = zod.z.object({
|
|
6262
6384
|
email: zod.z.string().email()
|
|
6263
6385
|
});
|
|
6386
|
+
const handle$7 = {
|
|
6387
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
6388
|
+
};
|
|
6264
6389
|
const NumberInput = React.forwardRef(
|
|
6265
6390
|
({
|
|
6266
6391
|
value,
|
|
@@ -6476,6 +6601,8 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
6476
6601
|
);
|
|
6477
6602
|
const { handleSuccess } = useRouteModal();
|
|
6478
6603
|
const { searchValue, onSearchValueChange, query: query2 } = useDebouncedSearch();
|
|
6604
|
+
const { hasPermission } = hooks.usePermissions();
|
|
6605
|
+
const canReadVariants = hasPermission("product_variant:read");
|
|
6479
6606
|
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
6480
6607
|
const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
|
|
6481
6608
|
const itemCount = preview.items?.reduce((acc, item) => acc + item.quantity, 0) || 0;
|
|
@@ -6565,7 +6692,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
|
|
|
6565
6692
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
6566
6693
|
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { type: "button", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}) }) }),
|
|
6567
6694
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
|
|
6568
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6695
|
+
canReadVariants && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6569
6696
|
StackedModalTrigger$1,
|
|
6570
6697
|
{
|
|
6571
6698
|
type: "add-items",
|
|
@@ -7280,6 +7407,9 @@ const customItemSchema = zod.z.object({
|
|
|
7280
7407
|
quantity: zod.z.number(),
|
|
7281
7408
|
unit_price: zod.z.union([zod.z.number(), zod.z.string()])
|
|
7282
7409
|
});
|
|
7410
|
+
const handle$6 = {
|
|
7411
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
7412
|
+
};
|
|
7283
7413
|
const InlineTip = React.forwardRef(
|
|
7284
7414
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
7285
7415
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -7630,6 +7760,9 @@ function getHasUneditableRows(metadata) {
|
|
|
7630
7760
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
7631
7761
|
);
|
|
7632
7762
|
}
|
|
7763
|
+
const handle$5 = {
|
|
7764
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
7765
|
+
};
|
|
7633
7766
|
const PROMOTION_QUERY_KEY = "promotions";
|
|
7634
7767
|
const promotionsQueryKeys = {
|
|
7635
7768
|
list: (query2) => [
|
|
@@ -7905,6 +8038,9 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
7905
8038
|
}
|
|
7906
8039
|
return Array.from(promotionIds);
|
|
7907
8040
|
}
|
|
8041
|
+
const handle$4 = {
|
|
8042
|
+
permissions: EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS
|
|
8043
|
+
};
|
|
7908
8044
|
const SalesChannel = () => {
|
|
7909
8045
|
const { id } = reactRouterDom.useParams();
|
|
7910
8046
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -8011,6 +8147,9 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
8011
8147
|
const schema$2 = zod.z.object({
|
|
8012
8148
|
sales_channel_id: zod.z.string().min(1)
|
|
8013
8149
|
});
|
|
8150
|
+
const handle$3 = {
|
|
8151
|
+
permissions: EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS
|
|
8152
|
+
};
|
|
8014
8153
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
8015
8154
|
const Shipping = () => {
|
|
8016
8155
|
const { id } = reactRouterDom.useParams();
|
|
@@ -8805,6 +8944,9 @@ const CustomAmountField = ({
|
|
|
8805
8944
|
}
|
|
8806
8945
|
);
|
|
8807
8946
|
};
|
|
8947
|
+
const handle$2 = {
|
|
8948
|
+
permissions: EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS
|
|
8949
|
+
};
|
|
8808
8950
|
const ShippingAddress = () => {
|
|
8809
8951
|
const { id } = reactRouterDom.useParams();
|
|
8810
8952
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9007,6 +9149,9 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
9007
9149
|
) });
|
|
9008
9150
|
};
|
|
9009
9151
|
const schema$1 = addressSchema;
|
|
9152
|
+
const handle$1 = {
|
|
9153
|
+
permissions: EDIT_DRAFT_ORDER_PERMISSIONS
|
|
9154
|
+
};
|
|
9010
9155
|
const TransferOwnership = () => {
|
|
9011
9156
|
const { id } = reactRouterDom.useParams();
|
|
9012
9157
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -9484,65 +9629,79 @@ const Illustration = () => {
|
|
|
9484
9629
|
const schema = zod.z.object({
|
|
9485
9630
|
customer_id: zod.z.string().min(1)
|
|
9486
9631
|
});
|
|
9632
|
+
const handle = {
|
|
9633
|
+
permissions: TRANSFER_DRAFT_ORDER_PERMISSIONS
|
|
9634
|
+
};
|
|
9487
9635
|
const widgetModule = { widgets: [] };
|
|
9488
9636
|
const routeModule = {
|
|
9489
9637
|
routes: [
|
|
9490
9638
|
{
|
|
9491
9639
|
Component: List,
|
|
9492
9640
|
path: "/draft-orders",
|
|
9493
|
-
handle: { label: config.label, translationNs: config.translationNs, ...handle$
|
|
9641
|
+
handle: { label: config.label, translationNs: config.translationNs, permissions: config.permissions, ...handle$c },
|
|
9494
9642
|
children: [
|
|
9495
9643
|
{
|
|
9496
9644
|
Component: Create,
|
|
9497
|
-
path: "/draft-orders/create"
|
|
9645
|
+
path: "/draft-orders/create",
|
|
9646
|
+
handle: handle$b
|
|
9498
9647
|
}
|
|
9499
9648
|
]
|
|
9500
9649
|
},
|
|
9501
9650
|
{
|
|
9502
9651
|
Component: ID,
|
|
9503
9652
|
path: "/draft-orders/:id",
|
|
9504
|
-
handle,
|
|
9653
|
+
handle: handle$a,
|
|
9505
9654
|
loader,
|
|
9506
9655
|
children: [
|
|
9507
9656
|
{
|
|
9508
9657
|
Component: BillingAddress,
|
|
9509
|
-
path: "/draft-orders/:id/billing-address"
|
|
9658
|
+
path: "/draft-orders/:id/billing-address",
|
|
9659
|
+
handle: handle$9
|
|
9510
9660
|
},
|
|
9511
9661
|
{
|
|
9512
|
-
Component:
|
|
9513
|
-
path: "/draft-orders/:id/
|
|
9662
|
+
Component: CustomItems,
|
|
9663
|
+
path: "/draft-orders/:id/custom-items",
|
|
9664
|
+
handle: handle$8
|
|
9514
9665
|
},
|
|
9515
9666
|
{
|
|
9516
|
-
Component:
|
|
9517
|
-
path: "/draft-orders/:id/
|
|
9667
|
+
Component: Email,
|
|
9668
|
+
path: "/draft-orders/:id/email",
|
|
9669
|
+
handle: handle$7
|
|
9518
9670
|
},
|
|
9519
9671
|
{
|
|
9520
9672
|
Component: Items,
|
|
9521
|
-
path: "/draft-orders/:id/items"
|
|
9673
|
+
path: "/draft-orders/:id/items",
|
|
9674
|
+
handle: handle$6
|
|
9522
9675
|
},
|
|
9523
9676
|
{
|
|
9524
9677
|
Component: Metadata,
|
|
9525
|
-
path: "/draft-orders/:id/metadata"
|
|
9678
|
+
path: "/draft-orders/:id/metadata",
|
|
9679
|
+
handle: handle$5
|
|
9526
9680
|
},
|
|
9527
9681
|
{
|
|
9528
9682
|
Component: Promotions,
|
|
9529
|
-
path: "/draft-orders/:id/promotions"
|
|
9683
|
+
path: "/draft-orders/:id/promotions",
|
|
9684
|
+
handle: handle$4
|
|
9530
9685
|
},
|
|
9531
9686
|
{
|
|
9532
9687
|
Component: SalesChannel,
|
|
9533
|
-
path: "/draft-orders/:id/sales-channel"
|
|
9688
|
+
path: "/draft-orders/:id/sales-channel",
|
|
9689
|
+
handle: handle$3
|
|
9534
9690
|
},
|
|
9535
9691
|
{
|
|
9536
9692
|
Component: Shipping,
|
|
9537
|
-
path: "/draft-orders/:id/shipping"
|
|
9693
|
+
path: "/draft-orders/:id/shipping",
|
|
9694
|
+
handle: handle$2
|
|
9538
9695
|
},
|
|
9539
9696
|
{
|
|
9540
9697
|
Component: ShippingAddress,
|
|
9541
|
-
path: "/draft-orders/:id/shipping-address"
|
|
9698
|
+
path: "/draft-orders/:id/shipping-address",
|
|
9699
|
+
handle: handle$1
|
|
9542
9700
|
},
|
|
9543
9701
|
{
|
|
9544
9702
|
Component: TransferOwnership,
|
|
9545
|
-
path: "/draft-orders/:id/transfer-ownership"
|
|
9703
|
+
path: "/draft-orders/:id/transfer-ownership",
|
|
9704
|
+
handle
|
|
9546
9705
|
}
|
|
9547
9706
|
]
|
|
9548
9707
|
}
|
|
@@ -9556,7 +9715,8 @@ const menuItemModule = {
|
|
|
9556
9715
|
path: "/draft-orders",
|
|
9557
9716
|
nested: "/orders",
|
|
9558
9717
|
rank: void 0,
|
|
9559
|
-
translationNs: void 0
|
|
9718
|
+
translationNs: void 0,
|
|
9719
|
+
permissions: config.permissions
|
|
9560
9720
|
}
|
|
9561
9721
|
]
|
|
9562
9722
|
};
|