@medusajs/draft-order 2.21.0 → 2.22.0-snapshot-20260911183712

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.
@@ -5979,195 +5979,6 @@ const ID = () => {
5979
5979
  }
5980
5980
  );
5981
5981
  };
5982
- const BillingAddress = () => {
5983
- const { id } = reactRouterDom.useParams();
5984
- const { order, isPending, isError, error } = useOrder(id, {
5985
- fields: "+billing_address"
5986
- });
5987
- if (isError) {
5988
- throw error;
5989
- }
5990
- const isReady = !isPending && !!order;
5991
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
5992
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
5993
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
5994
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
5995
- ] }),
5996
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
5997
- ] });
5998
- };
5999
- const BillingAddressForm = ({ order }) => {
6000
- const form = reactHookForm.useForm({
6001
- defaultValues: {
6002
- first_name: order.billing_address?.first_name ?? "",
6003
- last_name: order.billing_address?.last_name ?? "",
6004
- company: order.billing_address?.company ?? "",
6005
- address_1: order.billing_address?.address_1 ?? "",
6006
- address_2: order.billing_address?.address_2 ?? "",
6007
- city: order.billing_address?.city ?? "",
6008
- province: order.billing_address?.province ?? "",
6009
- country_code: order.billing_address?.country_code ?? "",
6010
- postal_code: order.billing_address?.postal_code ?? "",
6011
- phone: order.billing_address?.phone ?? ""
6012
- },
6013
- resolver: zod$1.zodResolver(schema$5)
6014
- });
6015
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
6016
- const { handleSuccess } = useRouteModal();
6017
- const onSubmit = form.handleSubmit(async (data) => {
6018
- await mutateAsync(
6019
- { billing_address: data },
6020
- {
6021
- onSuccess: () => {
6022
- handleSuccess();
6023
- },
6024
- onError: (error) => {
6025
- ui.toast.error(error.message);
6026
- }
6027
- }
6028
- );
6029
- });
6030
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
6031
- KeyboundForm,
6032
- {
6033
- className: "flex flex-1 flex-col overflow-hidden",
6034
- onSubmit,
6035
- children: [
6036
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
6037
- /* @__PURE__ */ jsxRuntime.jsx(
6038
- Form$2.Field,
6039
- {
6040
- control: form.control,
6041
- name: "country_code",
6042
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6043
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
6044
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
6045
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6046
- ] })
6047
- }
6048
- ),
6049
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
6050
- /* @__PURE__ */ jsxRuntime.jsx(
6051
- Form$2.Field,
6052
- {
6053
- control: form.control,
6054
- name: "first_name",
6055
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6056
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
6057
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6058
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6059
- ] })
6060
- }
6061
- ),
6062
- /* @__PURE__ */ jsxRuntime.jsx(
6063
- Form$2.Field,
6064
- {
6065
- control: form.control,
6066
- name: "last_name",
6067
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6068
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
6069
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6070
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6071
- ] })
6072
- }
6073
- )
6074
- ] }),
6075
- /* @__PURE__ */ jsxRuntime.jsx(
6076
- Form$2.Field,
6077
- {
6078
- control: form.control,
6079
- name: "company",
6080
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6081
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
6082
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6083
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6084
- ] })
6085
- }
6086
- ),
6087
- /* @__PURE__ */ jsxRuntime.jsx(
6088
- Form$2.Field,
6089
- {
6090
- control: form.control,
6091
- name: "address_1",
6092
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6093
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
6094
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6095
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6096
- ] })
6097
- }
6098
- ),
6099
- /* @__PURE__ */ jsxRuntime.jsx(
6100
- Form$2.Field,
6101
- {
6102
- control: form.control,
6103
- name: "address_2",
6104
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6105
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
6106
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6107
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6108
- ] })
6109
- }
6110
- ),
6111
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
6112
- /* @__PURE__ */ jsxRuntime.jsx(
6113
- Form$2.Field,
6114
- {
6115
- control: form.control,
6116
- name: "postal_code",
6117
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6118
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
6119
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6120
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6121
- ] })
6122
- }
6123
- ),
6124
- /* @__PURE__ */ jsxRuntime.jsx(
6125
- Form$2.Field,
6126
- {
6127
- control: form.control,
6128
- name: "city",
6129
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6130
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
6131
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6132
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6133
- ] })
6134
- }
6135
- )
6136
- ] }),
6137
- /* @__PURE__ */ jsxRuntime.jsx(
6138
- Form$2.Field,
6139
- {
6140
- control: form.control,
6141
- name: "province",
6142
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6143
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
6144
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6145
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6146
- ] })
6147
- }
6148
- ),
6149
- /* @__PURE__ */ jsxRuntime.jsx(
6150
- Form$2.Field,
6151
- {
6152
- control: form.control,
6153
- name: "phone",
6154
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
6155
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
6156
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
6157
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
6158
- ] })
6159
- }
6160
- )
6161
- ] }) }),
6162
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
6163
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
6164
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
6165
- ] }) })
6166
- ]
6167
- }
6168
- ) });
6169
- };
6170
- const schema$5 = addressSchema;
6171
5982
  const CustomItems = () => {
6172
5983
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
6173
5984
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -6176,7 +5987,7 @@ const CustomItems = () => {
6176
5987
  };
6177
5988
  const CustomItemsForm = () => {
6178
5989
  const form = reactHookForm.useForm({
6179
- resolver: zod$1.zodResolver(schema$4)
5990
+ resolver: zod$1.zodResolver(schema$5)
6180
5991
  });
6181
5992
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
6182
5993
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -6186,7 +5997,7 @@ const CustomItemsForm = () => {
6186
5997
  ] }) })
6187
5998
  ] }) });
6188
5999
  };
6189
- const schema$4 = zod.z.object({
6000
+ const schema$5 = zod.z.object({
6190
6001
  email: zod.z.string().email()
6191
6002
  });
6192
6003
  const Email = () => {
@@ -6211,7 +6022,7 @@ const EmailForm = ({ order }) => {
6211
6022
  defaultValues: {
6212
6023
  email: order.email ?? ""
6213
6024
  },
6214
- resolver: zod$1.zodResolver(schema$3)
6025
+ resolver: zod$1.zodResolver(schema$4)
6215
6026
  });
6216
6027
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
6217
6028
  const { handleSuccess } = useRouteModal();
@@ -6254,7 +6065,7 @@ const EmailForm = ({ order }) => {
6254
6065
  }
6255
6066
  ) });
6256
6067
  };
6257
- const schema$3 = zod.z.object({
6068
+ const schema$4 = zod.z.object({
6258
6069
  email: zod.z.string().email()
6259
6070
  });
6260
6071
  const NumberInput = React.forwardRef(
@@ -7276,54 +7087,10 @@ const customItemSchema = zod.z.object({
7276
7087
  quantity: zod.z.number(),
7277
7088
  unit_price: zod.z.union([zod.z.number(), zod.z.string()])
7278
7089
  });
7279
- const InlineTip = React.forwardRef(
7280
- ({ variant = "tip", label, className, children, ...props }, ref) => {
7281
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
7282
- return /* @__PURE__ */ jsxRuntime.jsxs(
7283
- "div",
7284
- {
7285
- ref,
7286
- className: ui.clx(
7287
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
7288
- className
7289
- ),
7290
- ...props,
7291
- children: [
7292
- /* @__PURE__ */ jsxRuntime.jsx(
7293
- "div",
7294
- {
7295
- role: "presentation",
7296
- className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
7297
- "bg-ui-tag-orange-icon": variant === "warning"
7298
- })
7299
- }
7300
- ),
7301
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
7302
- /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
7303
- labelValue,
7304
- ":"
7305
- ] }),
7306
- " ",
7307
- children
7308
- ] })
7309
- ]
7310
- }
7311
- );
7312
- }
7313
- );
7314
- InlineTip.displayName = "InlineTip";
7315
- const MetadataFieldSchema = zod.z.object({
7316
- key: zod.z.string(),
7317
- disabled: zod.z.boolean().optional(),
7318
- value: zod.z.any()
7319
- });
7320
- const MetadataSchema = zod.z.object({
7321
- metadata: zod.z.array(MetadataFieldSchema)
7322
- });
7323
- const Metadata = () => {
7090
+ const BillingAddress = () => {
7324
7091
  const { id } = reactRouterDom.useParams();
7325
7092
  const { order, isPending, isError, error } = useOrder(id, {
7326
- fields: "metadata"
7093
+ fields: "+billing_address"
7327
7094
  });
7328
7095
  if (isError) {
7329
7096
  throw error;
@@ -7331,33 +7098,35 @@ const Metadata = () => {
7331
7098
  const isReady = !isPending && !!order;
7332
7099
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
7333
7100
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
7334
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
7335
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
7101
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
7102
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
7336
7103
  ] }),
7337
- !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order?.metadata })
7104
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
7338
7105
  ] });
7339
7106
  };
7340
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
7341
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
7342
- const MetadataForm = ({ orderId, metadata }) => {
7343
- const { handleSuccess } = useRouteModal();
7344
- const hasUneditableRows = getHasUneditableRows(metadata);
7345
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
7107
+ const BillingAddressForm = ({ order }) => {
7346
7108
  const form = reactHookForm.useForm({
7347
7109
  defaultValues: {
7348
- metadata: getDefaultValues(metadata)
7110
+ first_name: order.billing_address?.first_name ?? "",
7111
+ last_name: order.billing_address?.last_name ?? "",
7112
+ company: order.billing_address?.company ?? "",
7113
+ address_1: order.billing_address?.address_1 ?? "",
7114
+ address_2: order.billing_address?.address_2 ?? "",
7115
+ city: order.billing_address?.city ?? "",
7116
+ province: order.billing_address?.province ?? "",
7117
+ country_code: order.billing_address?.country_code ?? "",
7118
+ postal_code: order.billing_address?.postal_code ?? "",
7119
+ phone: order.billing_address?.phone ?? ""
7349
7120
  },
7350
- resolver: zod$1.zodResolver(MetadataSchema)
7121
+ resolver: zod$1.zodResolver(schema$3)
7351
7122
  });
7352
- const handleSubmit = form.handleSubmit(async (data) => {
7353
- const parsedData = parseValues(data);
7123
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
7124
+ const { handleSuccess } = useRouteModal();
7125
+ const onSubmit = form.handleSubmit(async (data) => {
7354
7126
  await mutateAsync(
7355
- {
7356
- metadata: parsedData
7357
- },
7127
+ { billing_address: data },
7358
7128
  {
7359
7129
  onSuccess: () => {
7360
- ui.toast.success("Metadata updated");
7361
7130
  handleSuccess();
7362
7131
  },
7363
7132
  onError: (error) => {
@@ -7366,266 +7135,147 @@ const MetadataForm = ({ orderId, metadata }) => {
7366
7135
  }
7367
7136
  );
7368
7137
  });
7369
- const { fields, insert, remove } = reactHookForm.useFieldArray({
7370
- control: form.control,
7371
- name: "metadata"
7372
- });
7373
- function deleteRow(index) {
7374
- remove(index);
7375
- if (fields.length === 1) {
7376
- insert(0, {
7377
- key: "",
7378
- value: "",
7379
- disabled: false
7380
- });
7381
- }
7382
- }
7383
- function insertRow(index, position) {
7384
- insert(index + (position === "above" ? 0 : 1), {
7385
- key: "",
7386
- value: "",
7387
- disabled: false
7388
- });
7389
- }
7390
7138
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
7391
7139
  KeyboundForm,
7392
7140
  {
7393
- onSubmit: handleSubmit,
7394
7141
  className: "flex flex-1 flex-col overflow-hidden",
7142
+ onSubmit,
7395
7143
  children: [
7396
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
7397
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
7398
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
7399
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
7400
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
7401
- ] }),
7402
- fields.map((field, index) => {
7403
- const isDisabled = field.disabled || false;
7404
- let placeholder = "-";
7405
- if (typeof field.value === "object") {
7406
- placeholder = "{ ... }";
7144
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
7145
+ /* @__PURE__ */ jsxRuntime.jsx(
7146
+ Form$2.Field,
7147
+ {
7148
+ control: form.control,
7149
+ name: "country_code",
7150
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7151
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
7152
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
7153
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7154
+ ] })
7155
+ }
7156
+ ),
7157
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7158
+ /* @__PURE__ */ jsxRuntime.jsx(
7159
+ Form$2.Field,
7160
+ {
7161
+ control: form.control,
7162
+ name: "first_name",
7163
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7164
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
7165
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7166
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7167
+ ] })
7407
7168
  }
7408
- if (Array.isArray(field.value)) {
7409
- placeholder = "[ ... ]";
7169
+ ),
7170
+ /* @__PURE__ */ jsxRuntime.jsx(
7171
+ Form$2.Field,
7172
+ {
7173
+ control: form.control,
7174
+ name: "last_name",
7175
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7176
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
7177
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7178
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7179
+ ] })
7410
7180
  }
7411
- return /* @__PURE__ */ jsxRuntime.jsx(
7412
- ConditionalTooltip,
7413
- {
7414
- showTooltip: isDisabled,
7415
- content: "This row is disabled because it contains non-primitive data.",
7416
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
7417
- /* @__PURE__ */ jsxRuntime.jsxs(
7418
- "div",
7419
- {
7420
- className: ui.clx("grid grid-cols-2 divide-x", {
7421
- "overflow-hidden rounded-b-lg": index === fields.length - 1
7422
- }),
7423
- children: [
7424
- /* @__PURE__ */ jsxRuntime.jsx(
7425
- Form$2.Field,
7426
- {
7427
- control: form.control,
7428
- name: `metadata.${index}.key`,
7429
- render: ({ field: field2 }) => {
7430
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
7431
- GridInput,
7432
- {
7433
- "aria-labelledby": METADATA_KEY_LABEL_ID,
7434
- ...field2,
7435
- disabled: isDisabled,
7436
- placeholder: "Key"
7437
- }
7438
- ) }) });
7439
- }
7440
- }
7441
- ),
7442
- /* @__PURE__ */ jsxRuntime.jsx(
7443
- Form$2.Field,
7444
- {
7445
- control: form.control,
7446
- name: `metadata.${index}.value`,
7447
- render: ({ field: { value, ...field2 } }) => {
7448
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
7449
- GridInput,
7450
- {
7451
- "aria-labelledby": METADATA_VALUE_LABEL_ID,
7452
- ...field2,
7453
- value: isDisabled ? placeholder : value,
7454
- disabled: isDisabled,
7455
- placeholder: "Value"
7456
- }
7457
- ) }) });
7458
- }
7459
- }
7460
- )
7461
- ]
7462
- }
7463
- ),
7464
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
7465
- /* @__PURE__ */ jsxRuntime.jsx(
7466
- ui.DropdownMenu.Trigger,
7467
- {
7468
- className: ui.clx(
7469
- "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
7470
- {
7471
- hidden: isDisabled
7472
- }
7473
- ),
7474
- disabled: isDisabled,
7475
- asChild: true,
7476
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
7477
- }
7478
- ),
7479
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
7480
- /* @__PURE__ */ jsxRuntime.jsxs(
7481
- ui.DropdownMenu.Item,
7482
- {
7483
- className: "gap-x-2",
7484
- onClick: () => insertRow(index, "above"),
7485
- children: [
7486
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
7487
- "Insert row above"
7488
- ]
7489
- }
7490
- ),
7491
- /* @__PURE__ */ jsxRuntime.jsxs(
7492
- ui.DropdownMenu.Item,
7493
- {
7494
- className: "gap-x-2",
7495
- onClick: () => insertRow(index, "below"),
7496
- children: [
7497
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
7498
- "Insert row below"
7499
- ]
7500
- }
7501
- ),
7502
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
7503
- /* @__PURE__ */ jsxRuntime.jsxs(
7504
- ui.DropdownMenu.Item,
7505
- {
7506
- className: "gap-x-2",
7507
- onClick: () => deleteRow(index),
7508
- children: [
7509
- /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
7510
- "Delete row"
7511
- ]
7512
- }
7513
- )
7514
- ] })
7515
- ] })
7516
- ] })
7517
- },
7518
- field.id
7519
- );
7520
- })
7181
+ )
7521
7182
  ] }),
7522
- hasUneditableRows && /* @__PURE__ */ jsxRuntime.jsx(InlineTip, { variant: "warning", label: "Some rows are disabled", children: "This object contains non-primitive metadata, such as arrays or objects, that can't be edited here. To edit the disabled rows, use the API directly." })
7523
- ] }),
7524
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
7525
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
7183
+ /* @__PURE__ */ jsxRuntime.jsx(
7184
+ Form$2.Field,
7185
+ {
7186
+ control: form.control,
7187
+ name: "company",
7188
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7189
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
7190
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7191
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7192
+ ] })
7193
+ }
7194
+ ),
7195
+ /* @__PURE__ */ jsxRuntime.jsx(
7196
+ Form$2.Field,
7197
+ {
7198
+ control: form.control,
7199
+ name: "address_1",
7200
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7201
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
7202
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7203
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7204
+ ] })
7205
+ }
7206
+ ),
7207
+ /* @__PURE__ */ jsxRuntime.jsx(
7208
+ Form$2.Field,
7209
+ {
7210
+ control: form.control,
7211
+ name: "address_2",
7212
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7213
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
7214
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7215
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7216
+ ] })
7217
+ }
7218
+ ),
7219
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
7220
+ /* @__PURE__ */ jsxRuntime.jsx(
7221
+ Form$2.Field,
7222
+ {
7223
+ control: form.control,
7224
+ name: "postal_code",
7225
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7226
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
7227
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7228
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7229
+ ] })
7230
+ }
7231
+ ),
7232
+ /* @__PURE__ */ jsxRuntime.jsx(
7233
+ Form$2.Field,
7234
+ {
7235
+ control: form.control,
7236
+ name: "city",
7237
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7238
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
7239
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7240
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7241
+ ] })
7242
+ }
7243
+ )
7244
+ ] }),
7245
+ /* @__PURE__ */ jsxRuntime.jsx(
7246
+ Form$2.Field,
7247
+ {
7248
+ control: form.control,
7249
+ name: "province",
7250
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7251
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
7252
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7253
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7254
+ ] })
7255
+ }
7256
+ ),
7257
+ /* @__PURE__ */ jsxRuntime.jsx(
7258
+ Form$2.Field,
7259
+ {
7260
+ control: form.control,
7261
+ name: "phone",
7262
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7263
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
7264
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
7265
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
7266
+ ] })
7267
+ }
7268
+ )
7269
+ ] }) }),
7270
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
7271
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
7526
7272
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
7527
7273
  ] }) })
7528
7274
  ]
7529
7275
  }
7530
7276
  ) });
7531
7277
  };
7532
- const GridInput = React.forwardRef(({ className, ...props }, ref) => {
7533
- return /* @__PURE__ */ jsxRuntime.jsx(
7534
- "input",
7535
- {
7536
- ref,
7537
- ...props,
7538
- autoComplete: "off",
7539
- className: ui.clx(
7540
- "txt-compact-small text-ui-fg-base placeholder:text-ui-fg-muted disabled:text-ui-fg-disabled disabled:bg-ui-bg-base bg-transparent px-2 py-1.5 outline-none",
7541
- className
7542
- )
7543
- }
7544
- );
7545
- });
7546
- GridInput.displayName = "MetadataForm.GridInput";
7547
- const PlaceholderInner = () => {
7548
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
7549
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
7550
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
7551
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
7552
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
7553
- ] }) })
7554
- ] });
7555
- };
7556
- const EDITABLE_TYPES = ["string", "number", "boolean"];
7557
- function getDefaultValues(metadata) {
7558
- if (!metadata || !Object.keys(metadata).length) {
7559
- return [
7560
- {
7561
- key: "",
7562
- value: "",
7563
- disabled: false
7564
- }
7565
- ];
7566
- }
7567
- return Object.entries(metadata).map(([key, value]) => {
7568
- if (!EDITABLE_TYPES.includes(typeof value)) {
7569
- return {
7570
- key,
7571
- value,
7572
- disabled: true
7573
- };
7574
- }
7575
- let stringValue = value;
7576
- if (typeof value !== "string") {
7577
- stringValue = JSON.stringify(value);
7578
- }
7579
- return {
7580
- key,
7581
- value: stringValue,
7582
- original_key: key
7583
- };
7584
- });
7585
- }
7586
- function parseValues(values) {
7587
- const metadata = values.metadata;
7588
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
7589
- if (isEmpty) {
7590
- return null;
7591
- }
7592
- const update = {};
7593
- metadata.forEach((field) => {
7594
- let key = field.key;
7595
- let value = field.value;
7596
- const disabled = field.disabled;
7597
- if (!key || !value) {
7598
- return;
7599
- }
7600
- if (disabled) {
7601
- update[key] = value;
7602
- return;
7603
- }
7604
- key = key.trim();
7605
- value = value.trim();
7606
- if (value === "true") {
7607
- update[key] = true;
7608
- } else if (value === "false") {
7609
- update[key] = false;
7610
- } else {
7611
- const parsedNumber = parseFloat(value);
7612
- if (!isNaN(parsedNumber)) {
7613
- update[key] = parsedNumber;
7614
- } else {
7615
- update[key] = value;
7616
- }
7617
- }
7618
- });
7619
- return update;
7620
- }
7621
- function getHasUneditableRows(metadata) {
7622
- if (!metadata) {
7623
- return false;
7624
- }
7625
- return Object.values(metadata).some(
7626
- (value) => !EDITABLE_TYPES.includes(typeof value)
7627
- );
7628
- }
7278
+ const schema$3 = addressSchema;
7629
7279
  const PROMOTION_QUERY_KEY = "promotions";
7630
7280
  const promotionsQueryKeys = {
7631
7281
  list: (query2) => [
@@ -7900,113 +7550,7 @@ function getPromotionIds(items, shippingMethods) {
7900
7550
  }
7901
7551
  }
7902
7552
  return Array.from(promotionIds);
7903
- }
7904
- const SalesChannel = () => {
7905
- const { id } = reactRouterDom.useParams();
7906
- const { draft_order, isPending, isError, error } = useDraftOrder(
7907
- id,
7908
- {
7909
- fields: "+sales_channel_id"
7910
- },
7911
- {
7912
- enabled: !!id
7913
- }
7914
- );
7915
- if (isError) {
7916
- throw error;
7917
- }
7918
- const ISrEADY = !!draft_order && !isPending;
7919
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
7920
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
7921
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
7922
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
7923
- ] }),
7924
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
7925
- ] });
7926
- };
7927
- const SalesChannelForm = ({ order }) => {
7928
- const form = reactHookForm.useForm({
7929
- defaultValues: {
7930
- sales_channel_id: order.sales_channel_id || ""
7931
- },
7932
- resolver: zod$1.zodResolver(schema$2)
7933
- });
7934
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
7935
- const { handleSuccess } = useRouteModal();
7936
- const onSubmit = form.handleSubmit(async (data) => {
7937
- await mutateAsync(
7938
- {
7939
- sales_channel_id: data.sales_channel_id
7940
- },
7941
- {
7942
- onSuccess: () => {
7943
- ui.toast.success("Sales channel updated");
7944
- handleSuccess();
7945
- },
7946
- onError: (error) => {
7947
- ui.toast.error(error.message);
7948
- }
7949
- }
7950
- );
7951
- });
7952
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
7953
- KeyboundForm,
7954
- {
7955
- className: "flex flex-1 flex-col overflow-hidden",
7956
- onSubmit,
7957
- children: [
7958
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
7959
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
7960
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
7961
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
7962
- ] }) })
7963
- ]
7964
- }
7965
- ) });
7966
- };
7967
- const SalesChannelField = ({ control, order }) => {
7968
- const salesChannels = useComboboxData({
7969
- queryFn: async (params) => {
7970
- return await sdk.admin.salesChannel.list(params);
7971
- },
7972
- queryKey: ["sales-channels"],
7973
- getOptions: (data) => {
7974
- return data.sales_channels.map((salesChannel) => ({
7975
- label: salesChannel.name,
7976
- value: salesChannel.id
7977
- }));
7978
- },
7979
- defaultValue: order.sales_channel_id || void 0
7980
- });
7981
- return /* @__PURE__ */ jsxRuntime.jsx(
7982
- Form$2.Field,
7983
- {
7984
- control,
7985
- name: "sales_channel_id",
7986
- render: ({ field }) => {
7987
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
7988
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
7989
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
7990
- Combobox,
7991
- {
7992
- options: salesChannels.options,
7993
- fetchNextPage: salesChannels.fetchNextPage,
7994
- isFetchingNextPage: salesChannels.isFetchingNextPage,
7995
- searchValue: salesChannels.searchValue,
7996
- onSearchValueChange: salesChannels.onSearchValueChange,
7997
- placeholder: "Select sales channel",
7998
- ...field
7999
- }
8000
- ) }),
8001
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
8002
- ] });
8003
- }
8004
- }
8005
- );
8006
- };
8007
- const schema$2 = zod.z.object({
8008
- sales_channel_id: zod.z.string().min(1)
8009
- });
7553
+ }
8010
7554
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
8011
7555
  const Shipping = () => {
8012
7556
  const { id } = reactRouterDom.useParams();
@@ -8832,7 +8376,7 @@ const ShippingAddressForm = ({ order }) => {
8832
8376
  postal_code: order.shipping_address?.postal_code ?? "",
8833
8377
  phone: order.shipping_address?.phone ?? ""
8834
8378
  },
8835
- resolver: zod$1.zodResolver(schema$1)
8379
+ resolver: zod$1.zodResolver(schema$2)
8836
8380
  });
8837
8381
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
8838
8382
  const { handleSuccess } = useRouteModal();
@@ -9002,7 +8546,7 @@ const ShippingAddressForm = ({ order }) => {
9002
8546
  }
9003
8547
  ) });
9004
8548
  };
9005
- const schema$1 = addressSchema;
8549
+ const schema$2 = addressSchema;
9006
8550
  const TransferOwnership = () => {
9007
8551
  const { id } = reactRouterDom.useParams();
9008
8552
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -9025,7 +8569,7 @@ const TransferOwnershipForm = ({ order }) => {
9025
8569
  defaultValues: {
9026
8570
  customer_id: order.customer_id || ""
9027
8571
  },
9028
- resolver: zod$1.zodResolver(schema)
8572
+ resolver: zod$1.zodResolver(schema$1)
9029
8573
  });
9030
8574
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9031
8575
  const { handleSuccess } = useRouteModal();
@@ -9455,28 +8999,484 @@ const Illustration = () => {
9455
8999
  /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
9456
9000
  "rect",
9457
9001
  {
9458
- width: "12",
9459
- height: "12",
9460
- fill: "white",
9461
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
9002
+ width: "12",
9003
+ height: "12",
9004
+ fill: "white",
9005
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
9006
+ }
9007
+ ) }),
9008
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
9009
+ "rect",
9010
+ {
9011
+ width: "12",
9012
+ height: "12",
9013
+ fill: "white",
9014
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
9015
+ }
9016
+ ) })
9017
+ ] })
9018
+ ]
9019
+ }
9020
+ );
9021
+ };
9022
+ const schema$1 = zod.z.object({
9023
+ customer_id: zod.z.string().min(1)
9024
+ });
9025
+ const InlineTip = React.forwardRef(
9026
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
9027
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
9028
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9029
+ "div",
9030
+ {
9031
+ ref,
9032
+ className: ui.clx(
9033
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
9034
+ className
9035
+ ),
9036
+ ...props,
9037
+ children: [
9038
+ /* @__PURE__ */ jsxRuntime.jsx(
9039
+ "div",
9040
+ {
9041
+ role: "presentation",
9042
+ className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
9043
+ "bg-ui-tag-orange-icon": variant === "warning"
9044
+ })
9045
+ }
9046
+ ),
9047
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
9048
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
9049
+ labelValue,
9050
+ ":"
9051
+ ] }),
9052
+ " ",
9053
+ children
9054
+ ] })
9055
+ ]
9056
+ }
9057
+ );
9058
+ }
9059
+ );
9060
+ InlineTip.displayName = "InlineTip";
9061
+ const MetadataFieldSchema = zod.z.object({
9062
+ key: zod.z.string(),
9063
+ disabled: zod.z.boolean().optional(),
9064
+ value: zod.z.any()
9065
+ });
9066
+ const MetadataSchema = zod.z.object({
9067
+ metadata: zod.z.array(MetadataFieldSchema)
9068
+ });
9069
+ const Metadata = () => {
9070
+ const { id } = reactRouterDom.useParams();
9071
+ const { order, isPending, isError, error } = useOrder(id, {
9072
+ fields: "metadata"
9073
+ });
9074
+ if (isError) {
9075
+ throw error;
9076
+ }
9077
+ const isReady = !isPending && !!order;
9078
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9079
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9080
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
9081
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
9082
+ ] }),
9083
+ !isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order?.metadata })
9084
+ ] });
9085
+ };
9086
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
9087
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
9088
+ const MetadataForm = ({ orderId, metadata }) => {
9089
+ const { handleSuccess } = useRouteModal();
9090
+ const hasUneditableRows = getHasUneditableRows(metadata);
9091
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
9092
+ const form = reactHookForm.useForm({
9093
+ defaultValues: {
9094
+ metadata: getDefaultValues(metadata)
9095
+ },
9096
+ resolver: zod$1.zodResolver(MetadataSchema)
9097
+ });
9098
+ const handleSubmit = form.handleSubmit(async (data) => {
9099
+ const parsedData = parseValues(data);
9100
+ await mutateAsync(
9101
+ {
9102
+ metadata: parsedData
9103
+ },
9104
+ {
9105
+ onSuccess: () => {
9106
+ ui.toast.success("Metadata updated");
9107
+ handleSuccess();
9108
+ },
9109
+ onError: (error) => {
9110
+ ui.toast.error(error.message);
9111
+ }
9112
+ }
9113
+ );
9114
+ });
9115
+ const { fields, insert, remove } = reactHookForm.useFieldArray({
9116
+ control: form.control,
9117
+ name: "metadata"
9118
+ });
9119
+ function deleteRow(index) {
9120
+ remove(index);
9121
+ if (fields.length === 1) {
9122
+ insert(0, {
9123
+ key: "",
9124
+ value: "",
9125
+ disabled: false
9126
+ });
9127
+ }
9128
+ }
9129
+ function insertRow(index, position) {
9130
+ insert(index + (position === "above" ? 0 : 1), {
9131
+ key: "",
9132
+ value: "",
9133
+ disabled: false
9134
+ });
9135
+ }
9136
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9137
+ KeyboundForm,
9138
+ {
9139
+ onSubmit: handleSubmit,
9140
+ className: "flex flex-1 flex-col overflow-hidden",
9141
+ children: [
9142
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
9143
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
9144
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
9145
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
9146
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
9147
+ ] }),
9148
+ fields.map((field, index) => {
9149
+ const isDisabled = field.disabled || false;
9150
+ let placeholder = "-";
9151
+ if (typeof field.value === "object") {
9152
+ placeholder = "{ ... }";
9153
+ }
9154
+ if (Array.isArray(field.value)) {
9155
+ placeholder = "[ ... ]";
9156
+ }
9157
+ return /* @__PURE__ */ jsxRuntime.jsx(
9158
+ ConditionalTooltip,
9159
+ {
9160
+ showTooltip: isDisabled,
9161
+ content: "This row is disabled because it contains non-primitive data.",
9162
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
9163
+ /* @__PURE__ */ jsxRuntime.jsxs(
9164
+ "div",
9165
+ {
9166
+ className: ui.clx("grid grid-cols-2 divide-x", {
9167
+ "overflow-hidden rounded-b-lg": index === fields.length - 1
9168
+ }),
9169
+ children: [
9170
+ /* @__PURE__ */ jsxRuntime.jsx(
9171
+ Form$2.Field,
9172
+ {
9173
+ control: form.control,
9174
+ name: `metadata.${index}.key`,
9175
+ render: ({ field: field2 }) => {
9176
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
9177
+ GridInput,
9178
+ {
9179
+ "aria-labelledby": METADATA_KEY_LABEL_ID,
9180
+ ...field2,
9181
+ disabled: isDisabled,
9182
+ placeholder: "Key"
9183
+ }
9184
+ ) }) });
9185
+ }
9186
+ }
9187
+ ),
9188
+ /* @__PURE__ */ jsxRuntime.jsx(
9189
+ Form$2.Field,
9190
+ {
9191
+ control: form.control,
9192
+ name: `metadata.${index}.value`,
9193
+ render: ({ field: { value, ...field2 } }) => {
9194
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
9195
+ GridInput,
9196
+ {
9197
+ "aria-labelledby": METADATA_VALUE_LABEL_ID,
9198
+ ...field2,
9199
+ value: isDisabled ? placeholder : value,
9200
+ disabled: isDisabled,
9201
+ placeholder: "Value"
9202
+ }
9203
+ ) }) });
9204
+ }
9205
+ }
9206
+ )
9207
+ ]
9208
+ }
9209
+ ),
9210
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
9211
+ /* @__PURE__ */ jsxRuntime.jsx(
9212
+ ui.DropdownMenu.Trigger,
9213
+ {
9214
+ className: ui.clx(
9215
+ "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
9216
+ {
9217
+ hidden: isDisabled
9218
+ }
9219
+ ),
9220
+ disabled: isDisabled,
9221
+ asChild: true,
9222
+ children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
9223
+ }
9224
+ ),
9225
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
9226
+ /* @__PURE__ */ jsxRuntime.jsxs(
9227
+ ui.DropdownMenu.Item,
9228
+ {
9229
+ className: "gap-x-2",
9230
+ onClick: () => insertRow(index, "above"),
9231
+ children: [
9232
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
9233
+ "Insert row above"
9234
+ ]
9235
+ }
9236
+ ),
9237
+ /* @__PURE__ */ jsxRuntime.jsxs(
9238
+ ui.DropdownMenu.Item,
9239
+ {
9240
+ className: "gap-x-2",
9241
+ onClick: () => insertRow(index, "below"),
9242
+ children: [
9243
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
9244
+ "Insert row below"
9245
+ ]
9246
+ }
9247
+ ),
9248
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
9249
+ /* @__PURE__ */ jsxRuntime.jsxs(
9250
+ ui.DropdownMenu.Item,
9251
+ {
9252
+ className: "gap-x-2",
9253
+ onClick: () => deleteRow(index),
9254
+ children: [
9255
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
9256
+ "Delete row"
9257
+ ]
9258
+ }
9259
+ )
9260
+ ] })
9261
+ ] })
9262
+ ] })
9263
+ },
9264
+ field.id
9265
+ );
9266
+ })
9267
+ ] }),
9268
+ hasUneditableRows && /* @__PURE__ */ jsxRuntime.jsx(InlineTip, { variant: "warning", label: "Some rows are disabled", children: "This object contains non-primitive metadata, such as arrays or objects, that can't be edited here. To edit the disabled rows, use the API directly." })
9269
+ ] }),
9270
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
9271
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
9272
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9273
+ ] }) })
9274
+ ]
9275
+ }
9276
+ ) });
9277
+ };
9278
+ const GridInput = React.forwardRef(({ className, ...props }, ref) => {
9279
+ return /* @__PURE__ */ jsxRuntime.jsx(
9280
+ "input",
9281
+ {
9282
+ ref,
9283
+ ...props,
9284
+ autoComplete: "off",
9285
+ className: ui.clx(
9286
+ "txt-compact-small text-ui-fg-base placeholder:text-ui-fg-muted disabled:text-ui-fg-disabled disabled:bg-ui-bg-base bg-transparent px-2 py-1.5 outline-none",
9287
+ className
9288
+ )
9289
+ }
9290
+ );
9291
+ });
9292
+ GridInput.displayName = "MetadataForm.GridInput";
9293
+ const PlaceholderInner = () => {
9294
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
9295
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
9296
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
9297
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
9298
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
9299
+ ] }) })
9300
+ ] });
9301
+ };
9302
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
9303
+ function getDefaultValues(metadata) {
9304
+ if (!metadata || !Object.keys(metadata).length) {
9305
+ return [
9306
+ {
9307
+ key: "",
9308
+ value: "",
9309
+ disabled: false
9310
+ }
9311
+ ];
9312
+ }
9313
+ return Object.entries(metadata).map(([key, value]) => {
9314
+ if (!EDITABLE_TYPES.includes(typeof value)) {
9315
+ return {
9316
+ key,
9317
+ value,
9318
+ disabled: true
9319
+ };
9320
+ }
9321
+ let stringValue = value;
9322
+ if (typeof value !== "string") {
9323
+ stringValue = JSON.stringify(value);
9324
+ }
9325
+ return {
9326
+ key,
9327
+ value: stringValue,
9328
+ original_key: key
9329
+ };
9330
+ });
9331
+ }
9332
+ function parseValues(values) {
9333
+ const metadata = values.metadata;
9334
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
9335
+ if (isEmpty) {
9336
+ return null;
9337
+ }
9338
+ const update = {};
9339
+ metadata.forEach((field) => {
9340
+ let key = field.key;
9341
+ let value = field.value;
9342
+ const disabled = field.disabled;
9343
+ if (!key || !value) {
9344
+ return;
9345
+ }
9346
+ if (disabled) {
9347
+ update[key] = value;
9348
+ return;
9349
+ }
9350
+ key = key.trim();
9351
+ value = value.trim();
9352
+ if (value === "true") {
9353
+ update[key] = true;
9354
+ } else if (value === "false") {
9355
+ update[key] = false;
9356
+ } else {
9357
+ const parsedNumber = parseFloat(value);
9358
+ if (!isNaN(parsedNumber)) {
9359
+ update[key] = parsedNumber;
9360
+ } else {
9361
+ update[key] = value;
9362
+ }
9363
+ }
9364
+ });
9365
+ return update;
9366
+ }
9367
+ function getHasUneditableRows(metadata) {
9368
+ if (!metadata) {
9369
+ return false;
9370
+ }
9371
+ return Object.values(metadata).some(
9372
+ (value) => !EDITABLE_TYPES.includes(typeof value)
9373
+ );
9374
+ }
9375
+ const SalesChannel = () => {
9376
+ const { id } = reactRouterDom.useParams();
9377
+ const { draft_order, isPending, isError, error } = useDraftOrder(
9378
+ id,
9379
+ {
9380
+ fields: "+sales_channel_id"
9381
+ },
9382
+ {
9383
+ enabled: !!id
9384
+ }
9385
+ );
9386
+ if (isError) {
9387
+ throw error;
9388
+ }
9389
+ const ISrEADY = !!draft_order && !isPending;
9390
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9391
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9392
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
9393
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
9394
+ ] }),
9395
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
9396
+ ] });
9397
+ };
9398
+ const SalesChannelForm = ({ order }) => {
9399
+ const form = reactHookForm.useForm({
9400
+ defaultValues: {
9401
+ sales_channel_id: order.sales_channel_id || ""
9402
+ },
9403
+ resolver: zod$1.zodResolver(schema)
9404
+ });
9405
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9406
+ const { handleSuccess } = useRouteModal();
9407
+ const onSubmit = form.handleSubmit(async (data) => {
9408
+ await mutateAsync(
9409
+ {
9410
+ sales_channel_id: data.sales_channel_id
9411
+ },
9412
+ {
9413
+ onSuccess: () => {
9414
+ ui.toast.success("Sales channel updated");
9415
+ handleSuccess();
9416
+ },
9417
+ onError: (error) => {
9418
+ ui.toast.error(error.message);
9419
+ }
9420
+ }
9421
+ );
9422
+ });
9423
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9424
+ KeyboundForm,
9425
+ {
9426
+ className: "flex flex-1 flex-col overflow-hidden",
9427
+ onSubmit,
9428
+ children: [
9429
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
9430
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9431
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9432
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9433
+ ] }) })
9434
+ ]
9435
+ }
9436
+ ) });
9437
+ };
9438
+ const SalesChannelField = ({ control, order }) => {
9439
+ const salesChannels = useComboboxData({
9440
+ queryFn: async (params) => {
9441
+ return await sdk.admin.salesChannel.list(params);
9442
+ },
9443
+ queryKey: ["sales-channels"],
9444
+ getOptions: (data) => {
9445
+ return data.sales_channels.map((salesChannel) => ({
9446
+ label: salesChannel.name,
9447
+ value: salesChannel.id
9448
+ }));
9449
+ },
9450
+ defaultValue: order.sales_channel_id || void 0
9451
+ });
9452
+ return /* @__PURE__ */ jsxRuntime.jsx(
9453
+ Form$2.Field,
9454
+ {
9455
+ control,
9456
+ name: "sales_channel_id",
9457
+ render: ({ field }) => {
9458
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9459
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
9460
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
9461
+ Combobox,
9462
+ {
9463
+ options: salesChannels.options,
9464
+ fetchNextPage: salesChannels.fetchNextPage,
9465
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
9466
+ searchValue: salesChannels.searchValue,
9467
+ onSearchValueChange: salesChannels.onSearchValueChange,
9468
+ placeholder: "Select sales channel",
9469
+ ...field
9462
9470
  }
9463
9471
  ) }),
9464
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
9465
- "rect",
9466
- {
9467
- width: "12",
9468
- height: "12",
9469
- fill: "white",
9470
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
9471
- }
9472
- ) })
9473
- ] })
9474
- ]
9472
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9473
+ ] });
9474
+ }
9475
9475
  }
9476
9476
  );
9477
9477
  };
9478
9478
  const schema = zod.z.object({
9479
- customer_id: zod.z.string().min(1)
9479
+ sales_channel_id: zod.z.string().min(1)
9480
9480
  });
9481
9481
  const widgetModule = { widgets: [] };
9482
9482
  const routeModule = {
@@ -9498,10 +9498,6 @@ const routeModule = {
9498
9498
  handle,
9499
9499
  loader,
9500
9500
  children: [
9501
- {
9502
- Component: BillingAddress,
9503
- path: "/draft-orders/:id/billing-address"
9504
- },
9505
9501
  {
9506
9502
  Component: CustomItems,
9507
9503
  path: "/draft-orders/:id/custom-items"
@@ -9515,17 +9511,13 @@ const routeModule = {
9515
9511
  path: "/draft-orders/:id/items"
9516
9512
  },
9517
9513
  {
9518
- Component: Metadata,
9519
- path: "/draft-orders/:id/metadata"
9514
+ Component: BillingAddress,
9515
+ path: "/draft-orders/:id/billing-address"
9520
9516
  },
9521
9517
  {
9522
9518
  Component: Promotions,
9523
9519
  path: "/draft-orders/:id/promotions"
9524
9520
  },
9525
- {
9526
- Component: SalesChannel,
9527
- path: "/draft-orders/:id/sales-channel"
9528
- },
9529
9521
  {
9530
9522
  Component: Shipping,
9531
9523
  path: "/draft-orders/:id/shipping"
@@ -9537,6 +9529,14 @@ const routeModule = {
9537
9529
  {
9538
9530
  Component: TransferOwnership,
9539
9531
  path: "/draft-orders/:id/transfer-ownership"
9532
+ },
9533
+ {
9534
+ Component: Metadata,
9535
+ path: "/draft-orders/:id/metadata"
9536
+ },
9537
+ {
9538
+ Component: SalesChannel,
9539
+ path: "/draft-orders/:id/sales-channel"
9540
9540
  }
9541
9541
  ]
9542
9542
  }