@medusajs/draft-order 2.22.2 → 2.22.3-snapshot-20261103230838

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.
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { defineRouteConfig } from "@medusajs/admin-sdk";
3
3
  import { LayoutComposer } from "@medusajs/dashboard/components";
4
+ import { usePermissions, PermissionGuard } from "@medusajs/dashboard/hooks";
4
5
  import { Tooltip, DropdownMenu, clx, IconButton, useDataTable, DataTable as DataTable$1, Heading, Text, Button, createDataTableFilterHelper, createDataTableColumnHelper, Container, Badge, Skeleton, Avatar, Label as Label$1, Hint as Hint$1, Prompt, Drawer, FocusModal, toast, Divider, Input, Switch, Copy, Kbd, StatusBadge, usePrompt, CurrencyInput, Select } from "@medusajs/ui";
5
6
  import { useQuery, useQueryClient, useMutation, keepPreviousData, useInfiniteQuery } from "@tanstack/react-query";
6
7
  import React, { useState, useCallback, useMemo, createContext, forwardRef, useId, useContext, useTransition, useRef, useImperativeHandle, useDeferredValue, Fragment, useEffect, Suspense } from "react";
@@ -935,8 +936,42 @@ const useDataTableDateFilters = (disableRangeOption) => {
935
936
  ];
936
937
  }, [dateFilterOptions, getFullDate, rangeOptions]);
937
938
  };
939
+ const VIEW_DRAFT_ORDER_PERMISSIONS = ["order:read"];
940
+ const CREATE_DRAFT_ORDER_PERMISSIONS = [
941
+ "order:read",
942
+ "order:create",
943
+ "region:read",
944
+ "sales_channel:read"
945
+ ];
946
+ const EDIT_DRAFT_ORDER_PERMISSIONS = [
947
+ "order:read",
948
+ "order:update"
949
+ ];
950
+ const EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS = [
951
+ "order:read",
952
+ "order:update",
953
+ "sales_channel:read"
954
+ ];
955
+ const TRANSFER_DRAFT_ORDER_PERMISSIONS = [
956
+ "order:read",
957
+ "order:update",
958
+ "customer:read"
959
+ ];
960
+ const EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS = [
961
+ "order:read",
962
+ "order:update",
963
+ "promotion:read",
964
+ "order_change:read",
965
+ "order_change:update"
966
+ ];
967
+ const EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS = [
968
+ "order:read",
969
+ "order:update",
970
+ "shipping_option:read",
971
+ "stock_location:read"
972
+ ];
938
973
  const PAGE_SIZE = 20;
939
- const handle$1 = {
974
+ const handle$c = {
940
975
  breadcrumb: () => "Draft Orders"
941
976
  };
942
977
  const List = () => {
@@ -956,6 +991,8 @@ const List = () => {
956
991
  );
957
992
  const columns = useColumns$1();
958
993
  const filters = useFilters();
994
+ const { hasAllPermissions } = usePermissions();
995
+ const canCreate = hasAllPermissions(CREATE_DRAFT_ORDER_PERMISSIONS);
959
996
  if (isError) {
960
997
  throw error;
961
998
  }
@@ -976,10 +1013,10 @@ const List = () => {
976
1013
  pageSize: PAGE_SIZE,
977
1014
  rowCount: count,
978
1015
  heading: t("draftOrders.domain"),
979
- action: {
1016
+ action: canCreate ? {
980
1017
  label: t("actions.create"),
981
1018
  to: "create"
982
- },
1019
+ } : void 0,
983
1020
  rowHref: (row) => `${row.id}`,
984
1021
  emptyState: {
985
1022
  empty: {
@@ -999,7 +1036,8 @@ const List = () => {
999
1036
  };
1000
1037
  const config = defineRouteConfig({
1001
1038
  label: "Drafts",
1002
- nested: "/orders"
1039
+ nested: "/orders",
1040
+ permissions: VIEW_DRAFT_ORDER_PERMISSIONS
1003
1041
  });
1004
1042
  const columnHelper$1 = createDataTableColumnHelper();
1005
1043
  const useColumns$1 = () => {
@@ -1052,13 +1090,18 @@ const useColumns$1 = () => {
1052
1090
  };
1053
1091
  const useFilters = () => {
1054
1092
  const dateFilterOptions = useDataTableDateFilters();
1093
+ const { hasPermission } = usePermissions();
1094
+ const canReadCustomers = hasPermission("customer:read");
1095
+ const canReadSalesChannels = hasPermission("sales_channel:read");
1096
+ const canReadRegions = hasPermission("region:read");
1055
1097
  const { customers } = useCustomers(
1056
1098
  {
1057
1099
  limit: 1e3,
1058
1100
  fields: "id,email"
1059
1101
  },
1060
1102
  {
1061
- throwOnError: true
1103
+ throwOnError: true,
1104
+ enabled: canReadCustomers
1062
1105
  }
1063
1106
  );
1064
1107
  const { sales_channels } = useSalesChannels(
@@ -1067,7 +1110,8 @@ const useFilters = () => {
1067
1110
  fields: "id,name"
1068
1111
  },
1069
1112
  {
1070
- throwOnError: true
1113
+ throwOnError: true,
1114
+ enabled: canReadSalesChannels
1071
1115
  }
1072
1116
  );
1073
1117
  const { regions } = useRegions(
@@ -1075,11 +1119,12 @@ const useFilters = () => {
1075
1119
  limit: 1e3,
1076
1120
  fields: "id,name"
1077
1121
  },
1078
- { throwOnError: true }
1122
+ { throwOnError: true, enabled: canReadRegions }
1079
1123
  );
1080
1124
  return useMemo(() => {
1081
- return [
1082
- {
1125
+ const filters = [];
1126
+ if (canReadCustomers) {
1127
+ filters.push({
1083
1128
  id: "customer_id",
1084
1129
  label: "Customer",
1085
1130
  options: customers?.filter(
@@ -1089,8 +1134,10 @@ const useFilters = () => {
1089
1134
  value: customer.id
1090
1135
  })) ?? [],
1091
1136
  type: "select"
1092
- },
1093
- {
1137
+ });
1138
+ }
1139
+ if (canReadSalesChannels) {
1140
+ filters.push({
1094
1141
  id: "sales_channel_id",
1095
1142
  label: "Sales Channel",
1096
1143
  options: sales_channels?.map((sales_channel) => ({
@@ -1098,8 +1145,10 @@ const useFilters = () => {
1098
1145
  value: sales_channel.id
1099
1146
  })) ?? [],
1100
1147
  type: "select"
1101
- },
1102
- {
1148
+ });
1149
+ }
1150
+ if (canReadRegions) {
1151
+ filters.push({
1103
1152
  id: "region_id",
1104
1153
  label: "Region",
1105
1154
  options: regions?.map((region) => ({
@@ -1107,10 +1156,18 @@ const useFilters = () => {
1107
1156
  value: region.id
1108
1157
  })) ?? [],
1109
1158
  type: "select"
1110
- },
1111
- ...dateFilterOptions
1112
- ];
1113
- }, [customers, sales_channels, regions, dateFilterOptions]);
1159
+ });
1160
+ }
1161
+ return [...filters, ...dateFilterOptions];
1162
+ }, [
1163
+ canReadCustomers,
1164
+ canReadSalesChannels,
1165
+ canReadRegions,
1166
+ customers,
1167
+ sales_channels,
1168
+ regions,
1169
+ dateFilterOptions
1170
+ ]);
1114
1171
  };
1115
1172
  const useDraftOrderTableQuery = ({
1116
1173
  prefix,
@@ -3955,7 +4012,7 @@ const useComboboxData = ({
3955
4012
  limit: Array.isArray(defaultValue) ? defaultValue.length : 1
3956
4013
  });
3957
4014
  },
3958
- enabled: !!defaultValue
4015
+ enabled: enabled && !!defaultValue
3959
4016
  });
3960
4017
  const { data, ...rest } = useInfiniteQuery({
3961
4018
  queryKey: [...queryKey, query2],
@@ -4009,6 +4066,8 @@ const Create = () => {
4009
4066
  };
4010
4067
  const CreateForm = () => {
4011
4068
  const { handleSuccess } = useRouteModal();
4069
+ const { hasPermission } = usePermissions();
4070
+ const canReadCustomers = hasPermission("customer:read");
4012
4071
  const form = useForm({
4013
4072
  defaultValues: {
4014
4073
  region_id: "",
@@ -4151,8 +4210,16 @@ const CreateForm = () => {
4151
4210
  }
4152
4211
  ) }),
4153
4212
  /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4154
- /* @__PURE__ */ jsx(CustomerField$1, { control: form.control, setValue: form.setValue }),
4155
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4213
+ canReadCustomers && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4214
+ /* @__PURE__ */ jsx(
4215
+ CustomerField$1,
4216
+ {
4217
+ control: form.control,
4218
+ setValue: form.setValue
4219
+ }
4220
+ ),
4221
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" })
4222
+ ] }),
4156
4223
  /* @__PURE__ */ jsx(EmailField, { control: form.control }),
4157
4224
  /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4158
4225
  /* @__PURE__ */ jsx(
@@ -4296,6 +4363,8 @@ const AddressField = ({ type, control, setValue }) => {
4296
4363
  const customerId = useWatch({ control, name: "customer_id" });
4297
4364
  const addressId = useWatch({ control, name: `${type}_id` });
4298
4365
  const sameAsShipping = useWatch({ control, name: "same_as_shipping" });
4366
+ const { hasPermission } = usePermissions();
4367
+ const canReadAddresses = hasPermission("customer_address:read");
4299
4368
  const { customer } = useCustomer(
4300
4369
  customerId,
4301
4370
  {},
@@ -4328,7 +4397,7 @@ const AddressField = ({ type, control, setValue }) => {
4328
4397
  };
4329
4398
  });
4330
4399
  },
4331
- enabled: !!customerId
4400
+ enabled: !!customerId && canReadAddresses
4332
4401
  });
4333
4402
  const onSelectAddress = async (addressId2) => {
4334
4403
  if (!addressId2 || !customerId) {
@@ -4393,7 +4462,7 @@ const AddressField = ({ type, control, setValue }) => {
4393
4462
  }
4394
4463
  ),
4395
4464
  showFields && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
4396
- customerId && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
4465
+ customerId && canReadAddresses && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
4397
4466
  /* @__PURE__ */ jsx(
4398
4467
  Form$2.Field,
4399
4468
  {
@@ -4617,6 +4686,9 @@ const schema$6 = z.object({
4617
4686
  }
4618
4687
  }
4619
4688
  });
4689
+ const handle$b = {
4690
+ permissions: CREATE_DRAFT_ORDER_PERMISSIONS
4691
+ };
4620
4692
  const PageSkeleton = ({
4621
4693
  mainSections = 2,
4622
4694
  sidebarSections = 1,
@@ -4667,6 +4739,8 @@ const DETAILS_PAGE_REGEX = /\/draft-orders\/[a-zA-Z0-9_-]+\/?$/;
4667
4739
  const ActiveOrderChange = ({ orderId }) => {
4668
4740
  const { order: preview } = useOrderPreview(orderId);
4669
4741
  const location = useLocation();
4742
+ const { hasPermission } = usePermissions();
4743
+ const canUpdate = hasPermission("order:update");
4670
4744
  const isPending = preview?.order_change?.status === "pending";
4671
4745
  const isDetailsPage = DETAILS_PAGE_REGEX.test(location.pathname);
4672
4746
  const { mutateAsync, isPending: isMutating } = useDraftOrderCancelEdit(orderId);
@@ -4699,28 +4773,30 @@ const ActiveOrderChange = ({ orderId }) => {
4699
4773
  ] }),
4700
4774
  /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4701
4775
  /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(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." }) }),
4702
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4703
- /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-component px-6 py-4 justify-end items-center flex gap-x-2", children: [
4704
- !noActions && /* @__PURE__ */ jsx(
4705
- Button,
4706
- {
4707
- size: "small",
4708
- variant: "secondary",
4709
- isLoading: isMutating,
4710
- onClick: onCancel,
4711
- children: "Continue"
4712
- }
4713
- ),
4714
- /* @__PURE__ */ jsx(
4715
- Button,
4716
- {
4717
- size: "small",
4718
- variant: "secondary",
4719
- isLoading: isMutating,
4720
- onClick: onCancel,
4721
- children: "Cancel"
4722
- }
4723
- )
4776
+ canUpdate && /* @__PURE__ */ jsxs(Fragment$1, { children: [
4777
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
4778
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-component px-6 py-4 justify-end items-center flex gap-x-2", children: [
4779
+ !noActions && /* @__PURE__ */ jsx(
4780
+ Button,
4781
+ {
4782
+ size: "small",
4783
+ variant: "secondary",
4784
+ isLoading: isMutating,
4785
+ onClick: onCancel,
4786
+ children: "Continue"
4787
+ }
4788
+ ),
4789
+ /* @__PURE__ */ jsx(
4790
+ Button,
4791
+ {
4792
+ size: "small",
4793
+ variant: "secondary",
4794
+ isLoading: isMutating,
4795
+ onClick: onCancel,
4796
+ children: "Cancel"
4797
+ }
4798
+ )
4799
+ ] })
4724
4800
  ] })
4725
4801
  ] })
4726
4802
  }
@@ -4791,8 +4867,10 @@ const CollapsibleActivityItemList = ({
4791
4867
  ] });
4792
4868
  };
4793
4869
  const ActivityItem = ({ item, isFirst = false }) => {
4870
+ const { hasPermission } = usePermissions();
4871
+ const showUser = !!item.userId && hasPermission("user:read");
4794
4872
  const { user, isPending, isError, error } = useUser(item.userId, void 0, {
4795
- enabled: !!item.userId
4873
+ enabled: showUser
4796
4874
  });
4797
4875
  if (isError) {
4798
4876
  throw error;
@@ -4819,7 +4897,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
4819
4897
  )
4820
4898
  ] }),
4821
4899
  item.content && renderContent(item.content),
4822
- item.userId && /* @__PURE__ */ jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsx(Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
4900
+ showUser && /* @__PURE__ */ jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsx(Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
4823
4901
  /* @__PURE__ */ jsx(Text, { size: "small", children: "By" }),
4824
4902
  /* @__PURE__ */ jsx(
4825
4903
  Avatar,
@@ -5048,44 +5126,51 @@ const CustomerSection = ({ order }) => {
5048
5126
  ] });
5049
5127
  };
5050
5128
  const Header = () => {
5129
+ const { hasAllPermissions } = usePermissions();
5130
+ const canTransfer = hasAllPermissions(TRANSFER_DRAFT_ORDER_PERMISSIONS);
5131
+ const canEdit = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
5051
5132
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 gap-2", children: [
5052
5133
  /* @__PURE__ */ jsx(Heading, { level: "h2", children: "Customer" }),
5053
- /* @__PURE__ */ jsx(
5134
+ (canTransfer || canEdit) && /* @__PURE__ */ jsx(
5054
5135
  ActionMenu,
5055
5136
  {
5056
5137
  groups: [
5057
- {
5058
- actions: [
5059
- {
5060
- label: "Transfer ownership",
5061
- to: "transfer-ownership",
5062
- icon: /* @__PURE__ */ jsx(ArrowPath, {})
5063
- }
5064
- ]
5065
- },
5066
- {
5067
- actions: [
5068
- {
5069
- label: "Edit shipping address",
5070
- to: "shipping-address",
5071
- icon: /* @__PURE__ */ jsx(FlyingBox, {})
5072
- },
5073
- {
5074
- label: "Edit billing address",
5075
- to: "billing-address",
5076
- icon: /* @__PURE__ */ jsx(CurrencyDollar, {})
5077
- }
5078
- ]
5079
- },
5080
- {
5081
- actions: [
5082
- {
5083
- label: "Edit email",
5084
- to: `email`,
5085
- icon: /* @__PURE__ */ jsx(Envelope, {})
5086
- }
5087
- ]
5088
- }
5138
+ ...canTransfer ? [
5139
+ {
5140
+ actions: [
5141
+ {
5142
+ label: "Transfer ownership",
5143
+ to: "transfer-ownership",
5144
+ icon: /* @__PURE__ */ jsx(ArrowPath, {})
5145
+ }
5146
+ ]
5147
+ }
5148
+ ] : [],
5149
+ ...canEdit ? [
5150
+ {
5151
+ actions: [
5152
+ {
5153
+ label: "Edit shipping address",
5154
+ to: "shipping-address",
5155
+ icon: /* @__PURE__ */ jsx(FlyingBox, {})
5156
+ },
5157
+ {
5158
+ label: "Edit billing address",
5159
+ to: "billing-address",
5160
+ icon: /* @__PURE__ */ jsx(CurrencyDollar, {})
5161
+ }
5162
+ ]
5163
+ },
5164
+ {
5165
+ actions: [
5166
+ {
5167
+ label: "Edit email",
5168
+ to: `email`,
5169
+ icon: /* @__PURE__ */ jsx(Envelope, {})
5170
+ }
5171
+ ]
5172
+ }
5173
+ ] : []
5089
5174
  ]
5090
5175
  }
5091
5176
  )
@@ -5195,12 +5280,18 @@ const Addresses = ({ order }) => {
5195
5280
  };
5196
5281
  const GeneralSection = ({ order }) => {
5197
5282
  const navigate = useNavigate();
5283
+ const { hasPermission, hasAllPermissions } = usePermissions();
5284
+ const canReadRegion = hasPermission("region:read");
5285
+ const canEditSalesChannel = hasAllPermissions(
5286
+ EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS
5287
+ );
5288
+ const canDelete = hasPermission("order:delete");
5198
5289
  const { mutateAsync: deleteDraftOrder, isPending: isDeleting } = useDeleteDraftOrder();
5199
5290
  const { region, isPending, isError, error } = useRegion(
5200
5291
  order.region_id,
5201
5292
  void 0,
5202
5293
  {
5203
- enabled: !!order.region_id
5294
+ enabled: canReadRegion && !!order.region_id
5204
5295
  }
5205
5296
  );
5206
5297
  const isRegionLoaded = !!region && !isPending;
@@ -5215,37 +5306,41 @@ const GeneralSection = ({ order }) => {
5215
5306
  order.display_id
5216
5307
  ] }),
5217
5308
  /* @__PURE__ */ jsx(Copy, { content: `#${order.display_id}` }),
5218
- isRegionLoaded ? /* @__PURE__ */ jsx(Badge, { size: "2xsmall", rounded: "full", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: `/settings/regions/${region?.id}`, children: region?.name }) }) : /* @__PURE__ */ jsx(Skeleton, { className: "w-14 h-5 rounded-full" })
5309
+ canReadRegion && (isRegionLoaded ? /* @__PURE__ */ jsx(Badge, { size: "2xsmall", rounded: "full", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: `/settings/regions/${region?.id}`, children: region?.name }) }) : /* @__PURE__ */ jsx(Skeleton, { className: "w-14 h-5 rounded-full" }))
5219
5310
  ] }),
5220
5311
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: `${getFullDate({
5221
5312
  date: order.created_at,
5222
5313
  includeTime: true
5223
5314
  })} from ${order.sales_channel?.name}` })
5224
5315
  ] }),
5225
- /* @__PURE__ */ jsx(
5316
+ (canEditSalesChannel || canDelete) && /* @__PURE__ */ jsx(
5226
5317
  ActionMenu,
5227
5318
  {
5228
5319
  groups: [
5229
5320
  {
5230
5321
  actions: [
5231
- {
5232
- label: "Edit sales channel",
5233
- icon: /* @__PURE__ */ jsx(Channels, {}),
5234
- to: "sales-channel"
5235
- },
5236
- {
5237
- label: "Delete draft order",
5238
- icon: /* @__PURE__ */ jsx(Trash, {}),
5239
- onClick: async () => {
5240
- try {
5241
- await deleteDraftOrder(order.id);
5242
- navigate("/draft-orders");
5243
- } catch (error2) {
5244
- toast.error(error2.message);
5245
- }
5246
- },
5247
- disabled: isDeleting
5248
- }
5322
+ ...canEditSalesChannel ? [
5323
+ {
5324
+ label: "Edit sales channel",
5325
+ icon: /* @__PURE__ */ jsx(Channels, {}),
5326
+ to: "sales-channel"
5327
+ }
5328
+ ] : [],
5329
+ ...canDelete ? [
5330
+ {
5331
+ label: "Delete draft order",
5332
+ icon: /* @__PURE__ */ jsx(Trash, {}),
5333
+ onClick: async () => {
5334
+ try {
5335
+ await deleteDraftOrder(order.id);
5336
+ navigate("/draft-orders");
5337
+ } catch (error2) {
5338
+ toast.error(error2.message);
5339
+ }
5340
+ },
5341
+ disabled: isDeleting
5342
+ }
5343
+ ] : []
5249
5344
  ]
5250
5345
  }
5251
5346
  ]
@@ -5386,6 +5481,8 @@ const Copied = ({ style, value }) => {
5386
5481
  return /* @__PURE__ */ jsx("span", { style: { ...style, ...styl }, onClick: handler, children: /* @__PURE__ */ jsx(SquareTwoStack, { className: "text-ui-contrast-fg-secondary" }) });
5387
5482
  };
5388
5483
  const MetadataSection = ({ order }) => {
5484
+ const { hasAllPermissions } = usePermissions();
5485
+ const canEdit = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
5389
5486
  return /* @__PURE__ */ jsxs(Container, { className: "flex items-center justify-between", children: [
5390
5487
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
5391
5488
  /* @__PURE__ */ jsx(Heading, { level: "h2", children: "Metadata" }),
@@ -5394,7 +5491,7 @@ const MetadataSection = ({ order }) => {
5394
5491
  " keys"
5395
5492
  ] })
5396
5493
  ] }),
5397
- /* @__PURE__ */ jsx(
5494
+ canEdit && /* @__PURE__ */ jsx(
5398
5495
  IconButton,
5399
5496
  {
5400
5497
  variant: "transparent",
@@ -5421,6 +5518,10 @@ const Thumbnail = ({ thumbnail, alt = "" }) => {
5421
5518
  };
5422
5519
  const ShippingSection = ({ order }) => {
5423
5520
  const orderHasShipping = order.shipping_methods.length > 0;
5521
+ const { hasAllPermissions } = usePermissions();
5522
+ const canEditShipping = hasAllPermissions(
5523
+ EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS
5524
+ );
5424
5525
  const {
5425
5526
  shipping_options = [],
5426
5527
  isPending,
@@ -5474,8 +5575,10 @@ const ShippingSection = ({ order }) => {
5474
5575
  shipping_options,
5475
5576
  idx === data.length - 1
5476
5577
  ) }, profile.id)) }),
5477
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
5478
- /* @__PURE__ */ jsx(Footer$1, { isSomeProfilesAssigned })
5578
+ canEditShipping && /* @__PURE__ */ jsxs(Fragment$1, { children: [
5579
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
5580
+ /* @__PURE__ */ jsx(Footer$1, { isSomeProfilesAssigned })
5581
+ ] })
5479
5582
  ] });
5480
5583
  };
5481
5584
  function renderShippingProfile(profile, shippingOptions, isLast) {
@@ -5730,31 +5833,41 @@ const getStylizedAmount = (amount, currencyCode) => {
5730
5833
  };
5731
5834
  const SummarySection = ({ order }) => {
5732
5835
  const promotions = order.promotions || [];
5836
+ const { hasAllPermissions, hasPermission } = usePermissions();
5837
+ const canEditItems = hasAllPermissions(EDIT_DRAFT_ORDER_PERMISSIONS);
5838
+ const canEditPromotions = hasAllPermissions(
5839
+ EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS
5840
+ );
5841
+ const canConvert = hasPermission("order:update");
5733
5842
  return /* @__PURE__ */ jsxs(Container, { className: "p-0 overflow-hidden", children: [
5734
5843
  /* @__PURE__ */ jsxs("div", { className: "px-6 py-4 flex items-center justify-between gap-x-4", children: [
5735
5844
  /* @__PURE__ */ jsx(Heading, { children: "Summary" }),
5736
- /* @__PURE__ */ jsx(
5845
+ (canEditItems || canEditPromotions) && /* @__PURE__ */ jsx(
5737
5846
  ActionMenu,
5738
5847
  {
5739
5848
  groups: [
5740
- {
5741
- actions: [
5742
- {
5743
- label: "Edit items",
5744
- icon: /* @__PURE__ */ jsx(Plus, {}),
5745
- to: "items"
5746
- }
5747
- ]
5748
- },
5749
- {
5750
- actions: [
5751
- {
5752
- label: "Edit promotions",
5753
- icon: /* @__PURE__ */ jsx(ReceiptPercent, {}),
5754
- to: "promotions"
5755
- }
5756
- ]
5757
- }
5849
+ ...canEditItems ? [
5850
+ {
5851
+ actions: [
5852
+ {
5853
+ label: "Edit items",
5854
+ icon: /* @__PURE__ */ jsx(Plus, {}),
5855
+ to: "items"
5856
+ }
5857
+ ]
5858
+ }
5859
+ ] : [],
5860
+ ...canEditPromotions ? [
5861
+ {
5862
+ actions: [
5863
+ {
5864
+ label: "Edit promotions",
5865
+ icon: /* @__PURE__ */ jsx(ReceiptPercent, {}),
5866
+ to: "promotions"
5867
+ }
5868
+ ]
5869
+ }
5870
+ ] : []
5758
5871
  ]
5759
5872
  }
5760
5873
  )
@@ -5783,8 +5896,10 @@ const SummarySection = ({ order }) => {
5783
5896
  itemCount: order.items?.reduce((acc, item) => acc + item.quantity, 0) || 0
5784
5897
  }
5785
5898
  ),
5786
- /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
5787
- /* @__PURE__ */ jsx(Footer, { order })
5899
+ canConvert && /* @__PURE__ */ jsxs(Fragment$1, { children: [
5900
+ /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
5901
+ /* @__PURE__ */ jsx(Footer, { order })
5902
+ ] })
5788
5903
  ] });
5789
5904
  };
5790
5905
  const Item$1 = ({ item, currencyCode }) => {
@@ -5919,8 +6034,9 @@ async function loader({ params }) {
5919
6034
  });
5920
6035
  return data;
5921
6036
  }
5922
- const handle = {
5923
- breadcrumb: (match) => `#${match.loaderData.order.display_id}`
6037
+ const handle$a = {
6038
+ breadcrumb: (match) => `#${match.loaderData.order.display_id}`,
6039
+ permissions: VIEW_DRAFT_ORDER_PERMISSIONS
5924
6040
  };
5925
6041
  const ID = () => {
5926
6042
  const { id } = useParams();
@@ -5964,7 +6080,7 @@ const ID = () => {
5964
6080
  /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ActiveOrderChange", children: /* @__PURE__ */ jsx(ActiveOrderChange, { orderId: order.id }) }),
5965
6081
  /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "GeneralSection", children: /* @__PURE__ */ jsx(GeneralSection, { order }) }),
5966
6082
  /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "SummarySection", children: /* @__PURE__ */ jsx(SummarySection, { order }) }),
5967
- /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsx(ShippingSection, { order }) }),
6083
+ /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "ShippingSection", children: /* @__PURE__ */ jsx(PermissionGuard, { permission: "shipping_option:read", children: /* @__PURE__ */ jsx(ShippingSection, { order }) }) }),
5968
6084
  /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "MetadataSection", children: /* @__PURE__ */ jsx(MetadataSection, { order }) }),
5969
6085
  /* @__PURE__ */ jsx(LayoutComposer.Entry, { id: "JsonViewSection", children: /* @__PURE__ */ jsx(JsonViewSection, { data: order }) })
5970
6086
  ] }),
@@ -6165,6 +6281,9 @@ const BillingAddressForm = ({ order }) => {
6165
6281
  ) });
6166
6282
  };
6167
6283
  const schema$5 = addressSchema;
6284
+ const handle$9 = {
6285
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
6286
+ };
6168
6287
  const CustomItems = () => {
6169
6288
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
6170
6289
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -6186,6 +6305,9 @@ const CustomItemsForm = () => {
6186
6305
  const schema$4 = z.object({
6187
6306
  email: z.string().email()
6188
6307
  });
6308
+ const handle$8 = {
6309
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
6310
+ };
6189
6311
  const Email = () => {
6190
6312
  const { id } = useParams();
6191
6313
  const { order, isPending, isError, error } = useOrder(id, {
@@ -6254,6 +6376,9 @@ const EmailForm = ({ order }) => {
6254
6376
  const schema$3 = z.object({
6255
6377
  email: z.string().email()
6256
6378
  });
6379
+ const handle$7 = {
6380
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
6381
+ };
6257
6382
  const NumberInput = forwardRef(
6258
6383
  ({
6259
6384
  value,
@@ -6469,6 +6594,8 @@ const ItemsForm = ({ preview, currencyCode }) => {
6469
6594
  );
6470
6595
  const { handleSuccess } = useRouteModal();
6471
6596
  const { searchValue, onSearchValueChange, query: query2 } = useDebouncedSearch();
6597
+ const { hasPermission } = usePermissions();
6598
+ const canReadVariants = hasPermission("product_variant:read");
6472
6599
  const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
6473
6600
  const { mutateAsync: requestOrderEdit } = useDraftOrderRequestEdit(preview.id);
6474
6601
  const itemCount = preview.items?.reduce((acc, item) => acc + item.quantity, 0) || 0;
@@ -6558,7 +6685,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
6558
6685
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6559
6686
  /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { type: "button", children: /* @__PURE__ */ jsx(Plus, {}) }) }),
6560
6687
  /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
6561
- /* @__PURE__ */ jsx(
6688
+ canReadVariants && /* @__PURE__ */ jsx(
6562
6689
  StackedModalTrigger$1,
6563
6690
  {
6564
6691
  type: "add-items",
@@ -7273,6 +7400,9 @@ const customItemSchema = z.object({
7273
7400
  quantity: z.number(),
7274
7401
  unit_price: z.union([z.number(), z.string()])
7275
7402
  });
7403
+ const handle$6 = {
7404
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
7405
+ };
7276
7406
  const InlineTip = forwardRef(
7277
7407
  ({ variant = "tip", label, className, children, ...props }, ref) => {
7278
7408
  const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
@@ -7623,6 +7753,9 @@ function getHasUneditableRows(metadata) {
7623
7753
  (value) => !EDITABLE_TYPES.includes(typeof value)
7624
7754
  );
7625
7755
  }
7756
+ const handle$5 = {
7757
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
7758
+ };
7626
7759
  const PROMOTION_QUERY_KEY = "promotions";
7627
7760
  const promotionsQueryKeys = {
7628
7761
  list: (query2) => [
@@ -7898,6 +8031,118 @@ function getPromotionIds(items, shippingMethods) {
7898
8031
  }
7899
8032
  return Array.from(promotionIds);
7900
8033
  }
8034
+ const handle$4 = {
8035
+ permissions: EDIT_DRAFT_ORDER_PROMOTIONS_PERMISSIONS
8036
+ };
8037
+ const SalesChannel = () => {
8038
+ const { id } = useParams();
8039
+ const { draft_order, isPending, isError, error } = useDraftOrder(
8040
+ id,
8041
+ {
8042
+ fields: "+sales_channel_id"
8043
+ },
8044
+ {
8045
+ enabled: !!id
8046
+ }
8047
+ );
8048
+ if (isError) {
8049
+ throw error;
8050
+ }
8051
+ const ISrEADY = !!draft_order && !isPending;
8052
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
8053
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
8054
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
8055
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
8056
+ ] }),
8057
+ ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
8058
+ ] });
8059
+ };
8060
+ const SalesChannelForm = ({ order }) => {
8061
+ const form = useForm({
8062
+ defaultValues: {
8063
+ sales_channel_id: order.sales_channel_id || ""
8064
+ },
8065
+ resolver: zodResolver(schema$2)
8066
+ });
8067
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
8068
+ const { handleSuccess } = useRouteModal();
8069
+ const onSubmit = form.handleSubmit(async (data) => {
8070
+ await mutateAsync(
8071
+ {
8072
+ sales_channel_id: data.sales_channel_id
8073
+ },
8074
+ {
8075
+ onSuccess: () => {
8076
+ toast.success("Sales channel updated");
8077
+ handleSuccess();
8078
+ },
8079
+ onError: (error) => {
8080
+ toast.error(error.message);
8081
+ }
8082
+ }
8083
+ );
8084
+ });
8085
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
8086
+ KeyboundForm,
8087
+ {
8088
+ className: "flex flex-1 flex-col overflow-hidden",
8089
+ onSubmit,
8090
+ children: [
8091
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
8092
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
8093
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
8094
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
8095
+ ] }) })
8096
+ ]
8097
+ }
8098
+ ) });
8099
+ };
8100
+ const SalesChannelField = ({ control, order }) => {
8101
+ const salesChannels = useComboboxData({
8102
+ queryFn: async (params) => {
8103
+ return await sdk.admin.salesChannel.list(params);
8104
+ },
8105
+ queryKey: ["sales-channels"],
8106
+ getOptions: (data) => {
8107
+ return data.sales_channels.map((salesChannel) => ({
8108
+ label: salesChannel.name,
8109
+ value: salesChannel.id
8110
+ }));
8111
+ },
8112
+ defaultValue: order.sales_channel_id || void 0
8113
+ });
8114
+ return /* @__PURE__ */ jsx(
8115
+ Form$2.Field,
8116
+ {
8117
+ control,
8118
+ name: "sales_channel_id",
8119
+ render: ({ field }) => {
8120
+ return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
8121
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
8122
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
8123
+ Combobox,
8124
+ {
8125
+ options: salesChannels.options,
8126
+ fetchNextPage: salesChannels.fetchNextPage,
8127
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
8128
+ searchValue: salesChannels.searchValue,
8129
+ onSearchValueChange: salesChannels.onSearchValueChange,
8130
+ placeholder: "Select sales channel",
8131
+ ...field
8132
+ }
8133
+ ) }),
8134
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
8135
+ ] });
8136
+ }
8137
+ }
8138
+ );
8139
+ };
8140
+ const schema$2 = z.object({
8141
+ sales_channel_id: z.string().min(1)
8142
+ });
8143
+ const handle$3 = {
8144
+ permissions: EDIT_DRAFT_ORDER_SALES_CHANNEL_PERMISSIONS
8145
+ };
7901
8146
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
7902
8147
  const Shipping = () => {
7903
8148
  const { id } = useParams();
@@ -8692,6 +8937,9 @@ const CustomAmountField = ({
8692
8937
  }
8693
8938
  );
8694
8939
  };
8940
+ const handle$2 = {
8941
+ permissions: EDIT_DRAFT_ORDER_SHIPPING_PERMISSIONS
8942
+ };
8695
8943
  const ShippingAddress = () => {
8696
8944
  const { id } = useParams();
8697
8945
  const { order, isPending, isError, error } = useOrder(id, {
@@ -8723,7 +8971,7 @@ const ShippingAddressForm = ({ order }) => {
8723
8971
  postal_code: order.shipping_address?.postal_code ?? "",
8724
8972
  phone: order.shipping_address?.phone ?? ""
8725
8973
  },
8726
- resolver: zodResolver(schema$2)
8974
+ resolver: zodResolver(schema$1)
8727
8975
  });
8728
8976
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
8729
8977
  const { handleSuccess } = useRouteModal();
@@ -8893,7 +9141,10 @@ const ShippingAddressForm = ({ order }) => {
8893
9141
  }
8894
9142
  ) });
8895
9143
  };
8896
- const schema$2 = addressSchema;
9144
+ const schema$1 = addressSchema;
9145
+ const handle$1 = {
9146
+ permissions: EDIT_DRAFT_ORDER_PERMISSIONS
9147
+ };
8897
9148
  const TransferOwnership = () => {
8898
9149
  const { id } = useParams();
8899
9150
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -8916,7 +9167,7 @@ const TransferOwnershipForm = ({ order }) => {
8916
9167
  defaultValues: {
8917
9168
  customer_id: order.customer_id || ""
8918
9169
  },
8919
- resolver: zodResolver(schema$1)
9170
+ resolver: zodResolver(schema)
8920
9171
  });
8921
9172
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
8922
9173
  const { handleSuccess } = useRouteModal();
@@ -9368,174 +9619,82 @@ const Illustration = () => {
9368
9619
  }
9369
9620
  );
9370
9621
  };
9371
- const schema$1 = z.object({
9622
+ const schema = z.object({
9372
9623
  customer_id: z.string().min(1)
9373
9624
  });
9374
- const SalesChannel = () => {
9375
- const { id } = useParams();
9376
- const { draft_order, isPending, isError, error } = useDraftOrder(
9377
- id,
9378
- {
9379
- fields: "+sales_channel_id"
9380
- },
9381
- {
9382
- enabled: !!id
9383
- }
9384
- );
9385
- if (isError) {
9386
- throw error;
9387
- }
9388
- const ISrEADY = !!draft_order && !isPending;
9389
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9390
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9391
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
9392
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
9393
- ] }),
9394
- ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
9395
- ] });
9396
- };
9397
- const SalesChannelForm = ({ order }) => {
9398
- const form = useForm({
9399
- defaultValues: {
9400
- sales_channel_id: order.sales_channel_id || ""
9401
- },
9402
- resolver: zodResolver(schema)
9403
- });
9404
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9405
- const { handleSuccess } = useRouteModal();
9406
- const onSubmit = form.handleSubmit(async (data) => {
9407
- await mutateAsync(
9408
- {
9409
- sales_channel_id: data.sales_channel_id
9410
- },
9411
- {
9412
- onSuccess: () => {
9413
- toast.success("Sales channel updated");
9414
- handleSuccess();
9415
- },
9416
- onError: (error) => {
9417
- toast.error(error.message);
9418
- }
9419
- }
9420
- );
9421
- });
9422
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9423
- KeyboundForm,
9424
- {
9425
- className: "flex flex-1 flex-col overflow-hidden",
9426
- onSubmit,
9427
- children: [
9428
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
9429
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9430
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9431
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9432
- ] }) })
9433
- ]
9434
- }
9435
- ) });
9436
- };
9437
- const SalesChannelField = ({ control, order }) => {
9438
- const salesChannels = useComboboxData({
9439
- queryFn: async (params) => {
9440
- return await sdk.admin.salesChannel.list(params);
9441
- },
9442
- queryKey: ["sales-channels"],
9443
- getOptions: (data) => {
9444
- return data.sales_channels.map((salesChannel) => ({
9445
- label: salesChannel.name,
9446
- value: salesChannel.id
9447
- }));
9448
- },
9449
- defaultValue: order.sales_channel_id || void 0
9450
- });
9451
- return /* @__PURE__ */ jsx(
9452
- Form$2.Field,
9453
- {
9454
- control,
9455
- name: "sales_channel_id",
9456
- render: ({ field }) => {
9457
- return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9458
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
9459
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
9460
- Combobox,
9461
- {
9462
- options: salesChannels.options,
9463
- fetchNextPage: salesChannels.fetchNextPage,
9464
- isFetchingNextPage: salesChannels.isFetchingNextPage,
9465
- searchValue: salesChannels.searchValue,
9466
- onSearchValueChange: salesChannels.onSearchValueChange,
9467
- placeholder: "Select sales channel",
9468
- ...field
9469
- }
9470
- ) }),
9471
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9472
- ] });
9473
- }
9474
- }
9475
- );
9625
+ const handle = {
9626
+ permissions: TRANSFER_DRAFT_ORDER_PERMISSIONS
9476
9627
  };
9477
- const schema = z.object({
9478
- sales_channel_id: z.string().min(1)
9479
- });
9480
9628
  const widgetModule = { widgets: [] };
9481
9629
  const routeModule = {
9482
9630
  routes: [
9483
9631
  {
9484
9632
  Component: List,
9485
9633
  path: "/draft-orders",
9486
- handle: { label: config.label, translationNs: config.translationNs, ...handle$1 },
9634
+ handle: { label: config.label, translationNs: config.translationNs, permissions: config.permissions, ...handle$c },
9487
9635
  children: [
9488
9636
  {
9489
9637
  Component: Create,
9490
- path: "/draft-orders/create"
9638
+ path: "/draft-orders/create",
9639
+ handle: handle$b
9491
9640
  }
9492
9641
  ]
9493
9642
  },
9494
9643
  {
9495
9644
  Component: ID,
9496
9645
  path: "/draft-orders/:id",
9497
- handle,
9646
+ handle: handle$a,
9498
9647
  loader,
9499
9648
  children: [
9500
9649
  {
9501
9650
  Component: BillingAddress,
9502
- path: "/draft-orders/:id/billing-address"
9651
+ path: "/draft-orders/:id/billing-address",
9652
+ handle: handle$9
9503
9653
  },
9504
9654
  {
9505
9655
  Component: CustomItems,
9506
- path: "/draft-orders/:id/custom-items"
9656
+ path: "/draft-orders/:id/custom-items",
9657
+ handle: handle$8
9507
9658
  },
9508
9659
  {
9509
9660
  Component: Email,
9510
- path: "/draft-orders/:id/email"
9661
+ path: "/draft-orders/:id/email",
9662
+ handle: handle$7
9511
9663
  },
9512
9664
  {
9513
9665
  Component: Items,
9514
- path: "/draft-orders/:id/items"
9666
+ path: "/draft-orders/:id/items",
9667
+ handle: handle$6
9515
9668
  },
9516
9669
  {
9517
9670
  Component: Metadata,
9518
- path: "/draft-orders/:id/metadata"
9671
+ path: "/draft-orders/:id/metadata",
9672
+ handle: handle$5
9519
9673
  },
9520
9674
  {
9521
9675
  Component: Promotions,
9522
- path: "/draft-orders/:id/promotions"
9676
+ path: "/draft-orders/:id/promotions",
9677
+ handle: handle$4
9678
+ },
9679
+ {
9680
+ Component: SalesChannel,
9681
+ path: "/draft-orders/:id/sales-channel",
9682
+ handle: handle$3
9523
9683
  },
9524
9684
  {
9525
9685
  Component: Shipping,
9526
- path: "/draft-orders/:id/shipping"
9686
+ path: "/draft-orders/:id/shipping",
9687
+ handle: handle$2
9527
9688
  },
9528
9689
  {
9529
9690
  Component: ShippingAddress,
9530
- path: "/draft-orders/:id/shipping-address"
9691
+ path: "/draft-orders/:id/shipping-address",
9692
+ handle: handle$1
9531
9693
  },
9532
9694
  {
9533
9695
  Component: TransferOwnership,
9534
- path: "/draft-orders/:id/transfer-ownership"
9535
- },
9536
- {
9537
- Component: SalesChannel,
9538
- path: "/draft-orders/:id/sales-channel"
9696
+ path: "/draft-orders/:id/transfer-ownership",
9697
+ handle
9539
9698
  }
9540
9699
  ]
9541
9700
  }
@@ -9549,7 +9708,8 @@ const menuItemModule = {
9549
9708
  path: "/draft-orders",
9550
9709
  nested: "/orders",
9551
9710
  rank: void 0,
9552
- translationNs: void 0
9711
+ translationNs: void 0,
9712
+ permissions: config.permissions
9553
9713
  }
9554
9714
  ]
9555
9715
  };