@medusajs/draft-order 2.11.2-preview-20251028031854 → 2.11.2-preview-20251028060159

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.
@@ -9565,196 +9565,6 @@ const ID = () => {
9565
9565
  /* @__PURE__ */ jsx(Outlet, {})
9566
9566
  ] });
9567
9567
  };
9568
- const BillingAddress = () => {
9569
- const { id } = useParams();
9570
- const { order, isPending, isError, error } = useOrder(id, {
9571
- fields: "+billing_address"
9572
- });
9573
- if (isError) {
9574
- throw error;
9575
- }
9576
- const isReady = !isPending && !!order;
9577
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9578
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9579
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9580
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9581
- ] }),
9582
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9583
- ] });
9584
- };
9585
- const BillingAddressForm = ({ order }) => {
9586
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9587
- const form = useForm({
9588
- defaultValues: {
9589
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9590
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9591
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9592
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9593
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9594
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9595
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9596
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9597
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9598
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9599
- },
9600
- resolver: zodResolver(schema$5)
9601
- });
9602
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9603
- const { handleSuccess } = useRouteModal();
9604
- const onSubmit = form.handleSubmit(async (data) => {
9605
- await mutateAsync(
9606
- { billing_address: data },
9607
- {
9608
- onSuccess: () => {
9609
- handleSuccess();
9610
- },
9611
- onError: (error) => {
9612
- toast.error(error.message);
9613
- }
9614
- }
9615
- );
9616
- });
9617
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9618
- KeyboundForm,
9619
- {
9620
- className: "flex flex-1 flex-col overflow-hidden",
9621
- onSubmit,
9622
- children: [
9623
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
9624
- /* @__PURE__ */ jsx(
9625
- Form$2.Field,
9626
- {
9627
- control: form.control,
9628
- name: "country_code",
9629
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9630
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9631
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9632
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9633
- ] })
9634
- }
9635
- ),
9636
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9637
- /* @__PURE__ */ jsx(
9638
- Form$2.Field,
9639
- {
9640
- control: form.control,
9641
- name: "first_name",
9642
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9643
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9644
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9645
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9646
- ] })
9647
- }
9648
- ),
9649
- /* @__PURE__ */ jsx(
9650
- Form$2.Field,
9651
- {
9652
- control: form.control,
9653
- name: "last_name",
9654
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9655
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9656
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9657
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9658
- ] })
9659
- }
9660
- )
9661
- ] }),
9662
- /* @__PURE__ */ jsx(
9663
- Form$2.Field,
9664
- {
9665
- control: form.control,
9666
- name: "company",
9667
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9668
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9669
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9670
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9671
- ] })
9672
- }
9673
- ),
9674
- /* @__PURE__ */ jsx(
9675
- Form$2.Field,
9676
- {
9677
- control: form.control,
9678
- name: "address_1",
9679
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9680
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9681
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9682
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9683
- ] })
9684
- }
9685
- ),
9686
- /* @__PURE__ */ jsx(
9687
- Form$2.Field,
9688
- {
9689
- control: form.control,
9690
- name: "address_2",
9691
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9692
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9693
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9694
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9695
- ] })
9696
- }
9697
- ),
9698
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9699
- /* @__PURE__ */ jsx(
9700
- Form$2.Field,
9701
- {
9702
- control: form.control,
9703
- name: "postal_code",
9704
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9705
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9706
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9707
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9708
- ] })
9709
- }
9710
- ),
9711
- /* @__PURE__ */ jsx(
9712
- Form$2.Field,
9713
- {
9714
- control: form.control,
9715
- name: "city",
9716
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9717
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9718
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9719
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9720
- ] })
9721
- }
9722
- )
9723
- ] }),
9724
- /* @__PURE__ */ jsx(
9725
- Form$2.Field,
9726
- {
9727
- control: form.control,
9728
- name: "province",
9729
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9730
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9731
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9732
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9733
- ] })
9734
- }
9735
- ),
9736
- /* @__PURE__ */ jsx(
9737
- Form$2.Field,
9738
- {
9739
- control: form.control,
9740
- name: "phone",
9741
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9742
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9743
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9744
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9745
- ] })
9746
- }
9747
- )
9748
- ] }) }),
9749
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9750
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9751
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9752
- ] }) })
9753
- ]
9754
- }
9755
- ) });
9756
- };
9757
- const schema$5 = addressSchema;
9758
9568
  const CustomItems = () => {
9759
9569
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9760
9570
  /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
@@ -9763,7 +9573,7 @@ const CustomItems = () => {
9763
9573
  };
9764
9574
  const CustomItemsForm = () => {
9765
9575
  const form = useForm({
9766
- resolver: zodResolver(schema$4)
9576
+ resolver: zodResolver(schema$5)
9767
9577
  });
9768
9578
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9769
9579
  /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
@@ -9773,93 +9583,25 @@ const CustomItemsForm = () => {
9773
9583
  ] }) })
9774
9584
  ] }) });
9775
9585
  };
9776
- const schema$4 = objectType({
9586
+ const schema$5 = objectType({
9777
9587
  email: stringType().email()
9778
9588
  });
9779
- const Email = () => {
9780
- const { id } = useParams();
9781
- const { order, isPending, isError, error } = useOrder(id, {
9782
- fields: "+email"
9783
- });
9784
- if (isError) {
9785
- throw error;
9786
- }
9787
- const isReady = !isPending && !!order;
9788
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9789
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9790
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9791
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9792
- ] }),
9793
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9794
- ] });
9795
- };
9796
- const EmailForm = ({ order }) => {
9797
- const form = useForm({
9798
- defaultValues: {
9799
- email: order.email ?? ""
9800
- },
9801
- resolver: zodResolver(schema$3)
9802
- });
9803
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9804
- const { handleSuccess } = useRouteModal();
9805
- const onSubmit = form.handleSubmit(async (data) => {
9806
- await mutateAsync(
9807
- { email: data.email },
9808
- {
9809
- onSuccess: () => {
9810
- handleSuccess();
9811
- },
9812
- onError: (error) => {
9813
- toast.error(error.message);
9814
- }
9815
- }
9816
- );
9817
- });
9818
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
9819
- KeyboundForm,
9820
- {
9821
- className: "flex flex-1 flex-col overflow-hidden",
9822
- onSubmit,
9823
- children: [
9824
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9825
- Form$2.Field,
9826
- {
9827
- control: form.control,
9828
- name: "email",
9829
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9830
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9831
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9832
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9833
- ] })
9834
- }
9835
- ) }),
9836
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9837
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9838
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9839
- ] }) })
9840
- ]
9841
- }
9842
- ) });
9843
- };
9844
- const schema$3 = objectType({
9845
- email: stringType().email()
9846
- });
9847
- const NumberInput = forwardRef(
9848
- ({
9849
- value,
9850
- onChange,
9851
- size = "base",
9852
- min = 0,
9853
- max = 100,
9854
- step = 1,
9855
- className,
9856
- disabled,
9857
- ...props
9858
- }, ref) => {
9859
- const handleChange = (event) => {
9860
- const newValue = event.target.value === "" ? min : Number(event.target.value);
9861
- if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9862
- onChange(newValue);
9589
+ const NumberInput = forwardRef(
9590
+ ({
9591
+ value,
9592
+ onChange,
9593
+ size = "base",
9594
+ min = 0,
9595
+ max = 100,
9596
+ step = 1,
9597
+ className,
9598
+ disabled,
9599
+ ...props
9600
+ }, ref) => {
9601
+ const handleChange = (event) => {
9602
+ const newValue = event.target.value === "" ? min : Number(event.target.value);
9603
+ if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9604
+ onChange(newValue);
9863
9605
  }
9864
9606
  };
9865
9607
  const handleIncrement = () => {
@@ -10818,6 +10560,356 @@ const customItemSchema = objectType({
10818
10560
  quantity: numberType(),
10819
10561
  unit_price: unionType([numberType(), stringType()])
10820
10562
  });
10563
+ const InlineTip = forwardRef(
10564
+ ({ variant = "tip", label, className, children, ...props }, ref) => {
10565
+ const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
10566
+ return /* @__PURE__ */ jsxs(
10567
+ "div",
10568
+ {
10569
+ ref,
10570
+ className: clx(
10571
+ "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
10572
+ className
10573
+ ),
10574
+ ...props,
10575
+ children: [
10576
+ /* @__PURE__ */ jsx(
10577
+ "div",
10578
+ {
10579
+ role: "presentation",
10580
+ className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
10581
+ "bg-ui-tag-orange-icon": variant === "warning"
10582
+ })
10583
+ }
10584
+ ),
10585
+ /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
10586
+ /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
10587
+ labelValue,
10588
+ ":"
10589
+ ] }),
10590
+ " ",
10591
+ children
10592
+ ] })
10593
+ ]
10594
+ }
10595
+ );
10596
+ }
10597
+ );
10598
+ InlineTip.displayName = "InlineTip";
10599
+ const MetadataFieldSchema = objectType({
10600
+ key: stringType(),
10601
+ disabled: booleanType().optional(),
10602
+ value: anyType()
10603
+ });
10604
+ const MetadataSchema = objectType({
10605
+ metadata: arrayType(MetadataFieldSchema)
10606
+ });
10607
+ const Metadata = () => {
10608
+ const { id } = useParams();
10609
+ const { order, isPending, isError, error } = useOrder(id, {
10610
+ fields: "metadata"
10611
+ });
10612
+ if (isError) {
10613
+ throw error;
10614
+ }
10615
+ const isReady = !isPending && !!order;
10616
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
10617
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
10618
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
10619
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
10620
+ ] }),
10621
+ !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
10622
+ ] });
10623
+ };
10624
+ const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
10625
+ const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
10626
+ const MetadataForm = ({ orderId, metadata }) => {
10627
+ const { handleSuccess } = useRouteModal();
10628
+ const hasUneditableRows = getHasUneditableRows(metadata);
10629
+ const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
10630
+ const form = useForm({
10631
+ defaultValues: {
10632
+ metadata: getDefaultValues(metadata)
10633
+ },
10634
+ resolver: zodResolver(MetadataSchema)
10635
+ });
10636
+ const handleSubmit = form.handleSubmit(async (data) => {
10637
+ const parsedData = parseValues(data);
10638
+ await mutateAsync(
10639
+ {
10640
+ metadata: parsedData
10641
+ },
10642
+ {
10643
+ onSuccess: () => {
10644
+ toast.success("Metadata updated");
10645
+ handleSuccess();
10646
+ },
10647
+ onError: (error) => {
10648
+ toast.error(error.message);
10649
+ }
10650
+ }
10651
+ );
10652
+ });
10653
+ const { fields, insert, remove } = useFieldArray({
10654
+ control: form.control,
10655
+ name: "metadata"
10656
+ });
10657
+ function deleteRow(index) {
10658
+ remove(index);
10659
+ if (fields.length === 1) {
10660
+ insert(0, {
10661
+ key: "",
10662
+ value: "",
10663
+ disabled: false
10664
+ });
10665
+ }
10666
+ }
10667
+ function insertRow(index, position) {
10668
+ insert(index + (position === "above" ? 0 : 1), {
10669
+ key: "",
10670
+ value: "",
10671
+ disabled: false
10672
+ });
10673
+ }
10674
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
10675
+ KeyboundForm,
10676
+ {
10677
+ onSubmit: handleSubmit,
10678
+ className: "flex flex-1 flex-col overflow-hidden",
10679
+ children: [
10680
+ /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
10681
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
10682
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
10683
+ /* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
10684
+ /* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
10685
+ ] }),
10686
+ fields.map((field, index) => {
10687
+ const isDisabled = field.disabled || false;
10688
+ let placeholder = "-";
10689
+ if (typeof field.value === "object") {
10690
+ placeholder = "{ ... }";
10691
+ }
10692
+ if (Array.isArray(field.value)) {
10693
+ placeholder = "[ ... ]";
10694
+ }
10695
+ return /* @__PURE__ */ jsx(
10696
+ ConditionalTooltip,
10697
+ {
10698
+ showTooltip: isDisabled,
10699
+ content: "This row is disabled because it contains non-primitive data.",
10700
+ children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
10701
+ /* @__PURE__ */ jsxs(
10702
+ "div",
10703
+ {
10704
+ className: clx("grid grid-cols-2 divide-x", {
10705
+ "overflow-hidden rounded-b-lg": index === fields.length - 1
10706
+ }),
10707
+ children: [
10708
+ /* @__PURE__ */ jsx(
10709
+ Form$2.Field,
10710
+ {
10711
+ control: form.control,
10712
+ name: `metadata.${index}.key`,
10713
+ render: ({ field: field2 }) => {
10714
+ return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
10715
+ GridInput,
10716
+ {
10717
+ "aria-labelledby": METADATA_KEY_LABEL_ID,
10718
+ ...field2,
10719
+ disabled: isDisabled,
10720
+ placeholder: "Key"
10721
+ }
10722
+ ) }) });
10723
+ }
10724
+ }
10725
+ ),
10726
+ /* @__PURE__ */ jsx(
10727
+ Form$2.Field,
10728
+ {
10729
+ control: form.control,
10730
+ name: `metadata.${index}.value`,
10731
+ render: ({ field: { value, ...field2 } }) => {
10732
+ return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
10733
+ GridInput,
10734
+ {
10735
+ "aria-labelledby": METADATA_VALUE_LABEL_ID,
10736
+ ...field2,
10737
+ value: isDisabled ? placeholder : value,
10738
+ disabled: isDisabled,
10739
+ placeholder: "Value"
10740
+ }
10741
+ ) }) });
10742
+ }
10743
+ }
10744
+ )
10745
+ ]
10746
+ }
10747
+ ),
10748
+ /* @__PURE__ */ jsxs(DropdownMenu, { children: [
10749
+ /* @__PURE__ */ jsx(
10750
+ DropdownMenu.Trigger,
10751
+ {
10752
+ className: clx(
10753
+ "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
10754
+ {
10755
+ hidden: isDisabled
10756
+ }
10757
+ ),
10758
+ disabled: isDisabled,
10759
+ asChild: true,
10760
+ children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
10761
+ }
10762
+ ),
10763
+ /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
10764
+ /* @__PURE__ */ jsxs(
10765
+ DropdownMenu.Item,
10766
+ {
10767
+ className: "gap-x-2",
10768
+ onClick: () => insertRow(index, "above"),
10769
+ children: [
10770
+ /* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
10771
+ "Insert row above"
10772
+ ]
10773
+ }
10774
+ ),
10775
+ /* @__PURE__ */ jsxs(
10776
+ DropdownMenu.Item,
10777
+ {
10778
+ className: "gap-x-2",
10779
+ onClick: () => insertRow(index, "below"),
10780
+ children: [
10781
+ /* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
10782
+ "Insert row below"
10783
+ ]
10784
+ }
10785
+ ),
10786
+ /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
10787
+ /* @__PURE__ */ jsxs(
10788
+ DropdownMenu.Item,
10789
+ {
10790
+ className: "gap-x-2",
10791
+ onClick: () => deleteRow(index),
10792
+ children: [
10793
+ /* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
10794
+ "Delete row"
10795
+ ]
10796
+ }
10797
+ )
10798
+ ] })
10799
+ ] })
10800
+ ] })
10801
+ },
10802
+ field.id
10803
+ );
10804
+ })
10805
+ ] }),
10806
+ hasUneditableRows && /* @__PURE__ */ 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." })
10807
+ ] }),
10808
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10809
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10810
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
10811
+ ] }) })
10812
+ ]
10813
+ }
10814
+ ) });
10815
+ };
10816
+ const GridInput = forwardRef(({ className, ...props }, ref) => {
10817
+ return /* @__PURE__ */ jsx(
10818
+ "input",
10819
+ {
10820
+ ref,
10821
+ ...props,
10822
+ autoComplete: "off",
10823
+ className: clx(
10824
+ "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",
10825
+ className
10826
+ )
10827
+ }
10828
+ );
10829
+ });
10830
+ GridInput.displayName = "MetadataForm.GridInput";
10831
+ const PlaceholderInner = () => {
10832
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
10833
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
10834
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10835
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
10836
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
10837
+ ] }) })
10838
+ ] });
10839
+ };
10840
+ const EDITABLE_TYPES = ["string", "number", "boolean"];
10841
+ function getDefaultValues(metadata) {
10842
+ if (!metadata || !Object.keys(metadata).length) {
10843
+ return [
10844
+ {
10845
+ key: "",
10846
+ value: "",
10847
+ disabled: false
10848
+ }
10849
+ ];
10850
+ }
10851
+ return Object.entries(metadata).map(([key, value]) => {
10852
+ if (!EDITABLE_TYPES.includes(typeof value)) {
10853
+ return {
10854
+ key,
10855
+ value,
10856
+ disabled: true
10857
+ };
10858
+ }
10859
+ let stringValue = value;
10860
+ if (typeof value !== "string") {
10861
+ stringValue = JSON.stringify(value);
10862
+ }
10863
+ return {
10864
+ key,
10865
+ value: stringValue,
10866
+ original_key: key
10867
+ };
10868
+ });
10869
+ }
10870
+ function parseValues(values) {
10871
+ const metadata = values.metadata;
10872
+ const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
10873
+ if (isEmpty) {
10874
+ return null;
10875
+ }
10876
+ const update = {};
10877
+ metadata.forEach((field) => {
10878
+ let key = field.key;
10879
+ let value = field.value;
10880
+ const disabled = field.disabled;
10881
+ if (!key || !value) {
10882
+ return;
10883
+ }
10884
+ if (disabled) {
10885
+ update[key] = value;
10886
+ return;
10887
+ }
10888
+ key = key.trim();
10889
+ value = value.trim();
10890
+ if (value === "true") {
10891
+ update[key] = true;
10892
+ } else if (value === "false") {
10893
+ update[key] = false;
10894
+ } else {
10895
+ const parsedNumber = parseFloat(value);
10896
+ if (!isNaN(parsedNumber)) {
10897
+ update[key] = parsedNumber;
10898
+ } else {
10899
+ update[key] = value;
10900
+ }
10901
+ }
10902
+ });
10903
+ return update;
10904
+ }
10905
+ function getHasUneditableRows(metadata) {
10906
+ if (!metadata) {
10907
+ return false;
10908
+ }
10909
+ return Object.values(metadata).some(
10910
+ (value) => !EDITABLE_TYPES.includes(typeof value)
10911
+ );
10912
+ }
10821
10913
  const PROMOTION_QUERY_KEY = "promotions";
10822
10914
  const promotionsQueryKeys = {
10823
10915
  list: (query2) => [
@@ -11095,88 +11187,46 @@ function getPromotionIds(items, shippingMethods) {
11095
11187
  }
11096
11188
  return Array.from(promotionIds);
11097
11189
  }
11098
- const InlineTip = forwardRef(
11099
- ({ variant = "tip", label, className, children, ...props }, ref) => {
11100
- const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
11101
- return /* @__PURE__ */ jsxs(
11102
- "div",
11103
- {
11104
- ref,
11105
- className: clx(
11106
- "bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
11107
- className
11108
- ),
11109
- ...props,
11110
- children: [
11111
- /* @__PURE__ */ jsx(
11112
- "div",
11113
- {
11114
- role: "presentation",
11115
- className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
11116
- "bg-ui-tag-orange-icon": variant === "warning"
11117
- })
11118
- }
11119
- ),
11120
- /* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
11121
- /* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
11122
- labelValue,
11123
- ":"
11124
- ] }),
11125
- " ",
11126
- children
11127
- ] })
11128
- ]
11129
- }
11130
- );
11131
- }
11132
- );
11133
- InlineTip.displayName = "InlineTip";
11134
- const MetadataFieldSchema = objectType({
11135
- key: stringType(),
11136
- disabled: booleanType().optional(),
11137
- value: anyType()
11138
- });
11139
- const MetadataSchema = objectType({
11140
- metadata: arrayType(MetadataFieldSchema)
11141
- });
11142
- const Metadata = () => {
11190
+ const SalesChannel = () => {
11143
11191
  const { id } = useParams();
11144
- const { order, isPending, isError, error } = useOrder(id, {
11145
- fields: "metadata"
11146
- });
11192
+ const { draft_order, isPending, isError, error } = useDraftOrder(
11193
+ id,
11194
+ {
11195
+ fields: "+sales_channel_id"
11196
+ },
11197
+ {
11198
+ enabled: !!id
11199
+ }
11200
+ );
11147
11201
  if (isError) {
11148
11202
  throw error;
11149
11203
  }
11150
- const isReady = !isPending && !!order;
11204
+ const ISrEADY = !!draft_order && !isPending;
11151
11205
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
11152
11206
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
11153
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
11154
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
11207
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
11208
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11155
11209
  ] }),
11156
- !isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
11210
+ ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
11157
11211
  ] });
11158
11212
  };
11159
- const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
11160
- const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
11161
- const MetadataForm = ({ orderId, metadata }) => {
11162
- const { handleSuccess } = useRouteModal();
11163
- const hasUneditableRows = getHasUneditableRows(metadata);
11164
- const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
11213
+ const SalesChannelForm = ({ order }) => {
11165
11214
  const form = useForm({
11166
11215
  defaultValues: {
11167
- metadata: getDefaultValues(metadata)
11216
+ sales_channel_id: order.sales_channel_id || ""
11168
11217
  },
11169
- resolver: zodResolver(MetadataSchema)
11218
+ resolver: zodResolver(schema$4)
11170
11219
  });
11171
- const handleSubmit = form.handleSubmit(async (data) => {
11172
- const parsedData = parseValues(data);
11220
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11221
+ const { handleSuccess } = useRouteModal();
11222
+ const onSubmit = form.handleSubmit(async (data) => {
11173
11223
  await mutateAsync(
11174
11224
  {
11175
- metadata: parsedData
11225
+ sales_channel_id: data.sales_channel_id
11176
11226
  },
11177
11227
  {
11178
11228
  onSuccess: () => {
11179
- toast.success("Metadata updated");
11229
+ toast.success("Sales channel updated");
11180
11230
  handleSuccess();
11181
11231
  },
11182
11232
  onError: (error) => {
@@ -11185,266 +11235,64 @@ const MetadataForm = ({ orderId, metadata }) => {
11185
11235
  }
11186
11236
  );
11187
11237
  });
11188
- const { fields, insert, remove } = useFieldArray({
11189
- control: form.control,
11190
- name: "metadata"
11191
- });
11192
- function deleteRow(index) {
11193
- remove(index);
11194
- if (fields.length === 1) {
11195
- insert(0, {
11196
- key: "",
11197
- value: "",
11198
- disabled: false
11199
- });
11200
- }
11201
- }
11202
- function insertRow(index, position) {
11203
- insert(index + (position === "above" ? 0 : 1), {
11204
- key: "",
11205
- value: "",
11206
- disabled: false
11207
- });
11208
- }
11209
11238
  return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
11210
11239
  KeyboundForm,
11211
11240
  {
11212
- onSubmit: handleSubmit,
11213
11241
  className: "flex flex-1 flex-col overflow-hidden",
11214
- children: [
11215
- /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
11216
- /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
11217
- /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
11218
- /* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
11219
- /* @__PURE__ */ jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
11220
- ] }),
11221
- fields.map((field, index) => {
11222
- const isDisabled = field.disabled || false;
11223
- let placeholder = "-";
11224
- if (typeof field.value === "object") {
11225
- placeholder = "{ ... }";
11226
- }
11227
- if (Array.isArray(field.value)) {
11228
- placeholder = "[ ... ]";
11229
- }
11230
- return /* @__PURE__ */ jsx(
11231
- ConditionalTooltip,
11232
- {
11233
- showTooltip: isDisabled,
11234
- content: "This row is disabled because it contains non-primitive data.",
11235
- children: /* @__PURE__ */ jsxs("div", { className: "group/table relative", children: [
11236
- /* @__PURE__ */ jsxs(
11237
- "div",
11238
- {
11239
- className: clx("grid grid-cols-2 divide-x", {
11240
- "overflow-hidden rounded-b-lg": index === fields.length - 1
11241
- }),
11242
- children: [
11243
- /* @__PURE__ */ jsx(
11244
- Form$2.Field,
11245
- {
11246
- control: form.control,
11247
- name: `metadata.${index}.key`,
11248
- render: ({ field: field2 }) => {
11249
- return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11250
- GridInput,
11251
- {
11252
- "aria-labelledby": METADATA_KEY_LABEL_ID,
11253
- ...field2,
11254
- disabled: isDisabled,
11255
- placeholder: "Key"
11256
- }
11257
- ) }) });
11258
- }
11259
- }
11260
- ),
11261
- /* @__PURE__ */ jsx(
11262
- Form$2.Field,
11263
- {
11264
- control: form.control,
11265
- name: `metadata.${index}.value`,
11266
- render: ({ field: { value, ...field2 } }) => {
11267
- return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11268
- GridInput,
11269
- {
11270
- "aria-labelledby": METADATA_VALUE_LABEL_ID,
11271
- ...field2,
11272
- value: isDisabled ? placeholder : value,
11273
- disabled: isDisabled,
11274
- placeholder: "Value"
11275
- }
11276
- ) }) });
11277
- }
11278
- }
11279
- )
11280
- ]
11281
- }
11282
- ),
11283
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [
11284
- /* @__PURE__ */ jsx(
11285
- DropdownMenu.Trigger,
11286
- {
11287
- className: clx(
11288
- "invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
11289
- {
11290
- hidden: isDisabled
11291
- }
11292
- ),
11293
- disabled: isDisabled,
11294
- asChild: true,
11295
- children: /* @__PURE__ */ jsx(IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsx(EllipsisVertical, {}) })
11296
- }
11297
- ),
11298
- /* @__PURE__ */ jsxs(DropdownMenu.Content, { children: [
11299
- /* @__PURE__ */ jsxs(
11300
- DropdownMenu.Item,
11301
- {
11302
- className: "gap-x-2",
11303
- onClick: () => insertRow(index, "above"),
11304
- children: [
11305
- /* @__PURE__ */ jsx(ArrowUpMini, { className: "text-ui-fg-subtle" }),
11306
- "Insert row above"
11307
- ]
11308
- }
11309
- ),
11310
- /* @__PURE__ */ jsxs(
11311
- DropdownMenu.Item,
11312
- {
11313
- className: "gap-x-2",
11314
- onClick: () => insertRow(index, "below"),
11315
- children: [
11316
- /* @__PURE__ */ jsx(ArrowDownMini, { className: "text-ui-fg-subtle" }),
11317
- "Insert row below"
11318
- ]
11319
- }
11320
- ),
11321
- /* @__PURE__ */ jsx(DropdownMenu.Separator, {}),
11322
- /* @__PURE__ */ jsxs(
11323
- DropdownMenu.Item,
11324
- {
11325
- className: "gap-x-2",
11326
- onClick: () => deleteRow(index),
11327
- children: [
11328
- /* @__PURE__ */ jsx(Trash, { className: "text-ui-fg-subtle" }),
11329
- "Delete row"
11330
- ]
11331
- }
11332
- )
11333
- ] })
11334
- ] })
11335
- ] })
11336
- },
11337
- field.id
11338
- );
11339
- })
11340
- ] }),
11341
- hasUneditableRows && /* @__PURE__ */ 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." })
11342
- ] }),
11343
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11344
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
11242
+ onSubmit,
11243
+ children: [
11244
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
11245
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
11246
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11345
11247
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11346
11248
  ] }) })
11347
11249
  ]
11348
11250
  }
11349
11251
  ) });
11350
11252
  };
11351
- const GridInput = forwardRef(({ className, ...props }, ref) => {
11253
+ const SalesChannelField = ({ control, order }) => {
11254
+ const salesChannels = useComboboxData({
11255
+ queryFn: async (params) => {
11256
+ return await sdk.admin.salesChannel.list(params);
11257
+ },
11258
+ queryKey: ["sales-channels"],
11259
+ getOptions: (data) => {
11260
+ return data.sales_channels.map((salesChannel) => ({
11261
+ label: salesChannel.name,
11262
+ value: salesChannel.id
11263
+ }));
11264
+ },
11265
+ defaultValue: order.sales_channel_id || void 0
11266
+ });
11352
11267
  return /* @__PURE__ */ jsx(
11353
- "input",
11268
+ Form$2.Field,
11354
11269
  {
11355
- ref,
11356
- ...props,
11357
- autoComplete: "off",
11358
- className: clx(
11359
- "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",
11360
- className
11361
- )
11362
- }
11363
- );
11364
- });
11365
- GridInput.displayName = "MetadataForm.GridInput";
11366
- const PlaceholderInner = () => {
11367
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
11368
- /* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
11369
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
11370
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" }),
11371
- /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-12 rounded-md" })
11372
- ] }) })
11373
- ] });
11374
- };
11375
- const EDITABLE_TYPES = ["string", "number", "boolean"];
11376
- function getDefaultValues(metadata) {
11377
- if (!metadata || !Object.keys(metadata).length) {
11378
- return [
11379
- {
11380
- key: "",
11381
- value: "",
11382
- disabled: false
11383
- }
11384
- ];
11385
- }
11386
- return Object.entries(metadata).map(([key, value]) => {
11387
- if (!EDITABLE_TYPES.includes(typeof value)) {
11388
- return {
11389
- key,
11390
- value,
11391
- disabled: true
11392
- };
11393
- }
11394
- let stringValue = value;
11395
- if (typeof value !== "string") {
11396
- stringValue = JSON.stringify(value);
11397
- }
11398
- return {
11399
- key,
11400
- value: stringValue,
11401
- original_key: key
11402
- };
11403
- });
11404
- }
11405
- function parseValues(values) {
11406
- const metadata = values.metadata;
11407
- const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
11408
- if (isEmpty) {
11409
- return null;
11410
- }
11411
- const update = {};
11412
- metadata.forEach((field) => {
11413
- let key = field.key;
11414
- let value = field.value;
11415
- const disabled = field.disabled;
11416
- if (!key || !value) {
11417
- return;
11418
- }
11419
- if (disabled) {
11420
- update[key] = value;
11421
- return;
11422
- }
11423
- key = key.trim();
11424
- value = value.trim();
11425
- if (value === "true") {
11426
- update[key] = true;
11427
- } else if (value === "false") {
11428
- update[key] = false;
11429
- } else {
11430
- const parsedNumber = parseFloat(value);
11431
- if (!isNaN(parsedNumber)) {
11432
- update[key] = parsedNumber;
11433
- } else {
11434
- update[key] = value;
11270
+ control,
11271
+ name: "sales_channel_id",
11272
+ render: ({ field }) => {
11273
+ return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
11274
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
11275
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
11276
+ Combobox,
11277
+ {
11278
+ options: salesChannels.options,
11279
+ fetchNextPage: salesChannels.fetchNextPage,
11280
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
11281
+ searchValue: salesChannels.searchValue,
11282
+ onSearchValueChange: salesChannels.onSearchValueChange,
11283
+ placeholder: "Select sales channel",
11284
+ ...field
11285
+ }
11286
+ ) }),
11287
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
11288
+ ] });
11435
11289
  }
11436
11290
  }
11437
- });
11438
- return update;
11439
- }
11440
- function getHasUneditableRows(metadata) {
11441
- if (!metadata) {
11442
- return false;
11443
- }
11444
- return Object.values(metadata).some(
11445
- (value) => !EDITABLE_TYPES.includes(typeof value)
11446
11291
  );
11447
- }
11292
+ };
11293
+ const schema$4 = objectType({
11294
+ sales_channel_id: stringType().min(1)
11295
+ });
11448
11296
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11449
11297
  const Shipping = () => {
11450
11298
  var _a;
@@ -12284,7 +12132,7 @@ const ShippingAddressForm = ({ order }) => {
12284
12132
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12285
12133
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12286
12134
  },
12287
- resolver: zodResolver(schema$2)
12135
+ resolver: zodResolver(schema$3)
12288
12136
  });
12289
12137
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12290
12138
  const { handleSuccess } = useRouteModal();
@@ -12454,7 +12302,7 @@ const ShippingAddressForm = ({ order }) => {
12454
12302
  }
12455
12303
  ) });
12456
12304
  };
12457
- const schema$2 = addressSchema;
12305
+ const schema$3 = addressSchema;
12458
12306
  const TransferOwnership = () => {
12459
12307
  const { id } = useParams();
12460
12308
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12478,7 +12326,7 @@ const TransferOwnershipForm = ({ order }) => {
12478
12326
  defaultValues: {
12479
12327
  customer_id: order.customer_id || ""
12480
12328
  },
12481
- resolver: zodResolver(schema$1)
12329
+ resolver: zodResolver(schema$2)
12482
12330
  });
12483
12331
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12484
12332
  const { handleSuccess } = useRouteModal();
@@ -12881,83 +12729,267 @@ const Illustration = () => {
12881
12729
  /* @__PURE__ */ jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsx(
12882
12730
  "rect",
12883
12731
  {
12884
- width: "12",
12885
- height: "12",
12886
- fill: "white",
12887
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12732
+ width: "12",
12733
+ height: "12",
12734
+ fill: "white",
12735
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12736
+ }
12737
+ ) }),
12738
+ /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12739
+ "rect",
12740
+ {
12741
+ width: "12",
12742
+ height: "12",
12743
+ fill: "white",
12744
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12745
+ }
12746
+ ) }),
12747
+ /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
12748
+ "rect",
12749
+ {
12750
+ width: "12",
12751
+ height: "12",
12752
+ fill: "white",
12753
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12754
+ }
12755
+ ) }),
12756
+ /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
12757
+ "rect",
12758
+ {
12759
+ width: "12",
12760
+ height: "12",
12761
+ fill: "white",
12762
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12763
+ }
12764
+ ) }),
12765
+ /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
12766
+ "rect",
12767
+ {
12768
+ width: "12",
12769
+ height: "12",
12770
+ fill: "white",
12771
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12772
+ }
12773
+ ) })
12774
+ ] })
12775
+ ]
12776
+ }
12777
+ );
12778
+ };
12779
+ const schema$2 = objectType({
12780
+ customer_id: stringType().min(1)
12781
+ });
12782
+ const BillingAddress = () => {
12783
+ const { id } = useParams();
12784
+ const { order, isPending, isError, error } = useOrder(id, {
12785
+ fields: "+billing_address"
12786
+ });
12787
+ if (isError) {
12788
+ throw error;
12789
+ }
12790
+ const isReady = !isPending && !!order;
12791
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12792
+ /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12793
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12794
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12795
+ ] }),
12796
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12797
+ ] });
12798
+ };
12799
+ const BillingAddressForm = ({ order }) => {
12800
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12801
+ const form = useForm({
12802
+ defaultValues: {
12803
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12804
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12805
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12806
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12807
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12808
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12809
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12810
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12811
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12812
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12813
+ },
12814
+ resolver: zodResolver(schema$1)
12815
+ });
12816
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12817
+ const { handleSuccess } = useRouteModal();
12818
+ const onSubmit = form.handleSubmit(async (data) => {
12819
+ await mutateAsync(
12820
+ { billing_address: data },
12821
+ {
12822
+ onSuccess: () => {
12823
+ handleSuccess();
12824
+ },
12825
+ onError: (error) => {
12826
+ toast.error(error.message);
12827
+ }
12828
+ }
12829
+ );
12830
+ });
12831
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
12832
+ KeyboundForm,
12833
+ {
12834
+ className: "flex flex-1 flex-col overflow-hidden",
12835
+ onSubmit,
12836
+ children: [
12837
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
12838
+ /* @__PURE__ */ jsx(
12839
+ Form$2.Field,
12840
+ {
12841
+ control: form.control,
12842
+ name: "country_code",
12843
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12844
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12845
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12846
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12847
+ ] })
12848
+ }
12849
+ ),
12850
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12851
+ /* @__PURE__ */ jsx(
12852
+ Form$2.Field,
12853
+ {
12854
+ control: form.control,
12855
+ name: "first_name",
12856
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12857
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12858
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12859
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12860
+ ] })
12861
+ }
12862
+ ),
12863
+ /* @__PURE__ */ jsx(
12864
+ Form$2.Field,
12865
+ {
12866
+ control: form.control,
12867
+ name: "last_name",
12868
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12869
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12870
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12871
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12872
+ ] })
12873
+ }
12874
+ )
12875
+ ] }),
12876
+ /* @__PURE__ */ jsx(
12877
+ Form$2.Field,
12878
+ {
12879
+ control: form.control,
12880
+ name: "company",
12881
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12882
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12883
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12884
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12885
+ ] })
12888
12886
  }
12889
- ) }),
12890
- /* @__PURE__ */ jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsx(
12891
- "rect",
12887
+ ),
12888
+ /* @__PURE__ */ jsx(
12889
+ Form$2.Field,
12892
12890
  {
12893
- width: "12",
12894
- height: "12",
12895
- fill: "white",
12896
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12891
+ control: form.control,
12892
+ name: "address_1",
12893
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12894
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12895
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12896
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12897
+ ] })
12897
12898
  }
12898
- ) }),
12899
- /* @__PURE__ */ jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsx(
12900
- "rect",
12899
+ ),
12900
+ /* @__PURE__ */ jsx(
12901
+ Form$2.Field,
12901
12902
  {
12902
- width: "12",
12903
- height: "12",
12904
- fill: "white",
12905
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12903
+ control: form.control,
12904
+ name: "address_2",
12905
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12906
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12907
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12908
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12909
+ ] })
12906
12910
  }
12907
- ) }),
12908
- /* @__PURE__ */ jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsx(
12909
- "rect",
12911
+ ),
12912
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12913
+ /* @__PURE__ */ jsx(
12914
+ Form$2.Field,
12915
+ {
12916
+ control: form.control,
12917
+ name: "postal_code",
12918
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12919
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12920
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12921
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12922
+ ] })
12923
+ }
12924
+ ),
12925
+ /* @__PURE__ */ jsx(
12926
+ Form$2.Field,
12927
+ {
12928
+ control: form.control,
12929
+ name: "city",
12930
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12931
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12932
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12933
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12934
+ ] })
12935
+ }
12936
+ )
12937
+ ] }),
12938
+ /* @__PURE__ */ jsx(
12939
+ Form$2.Field,
12910
12940
  {
12911
- width: "12",
12912
- height: "12",
12913
- fill: "white",
12914
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12941
+ control: form.control,
12942
+ name: "province",
12943
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12944
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12945
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12946
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12947
+ ] })
12915
12948
  }
12916
- ) }),
12917
- /* @__PURE__ */ jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsx(
12918
- "rect",
12949
+ ),
12950
+ /* @__PURE__ */ jsx(
12951
+ Form$2.Field,
12919
12952
  {
12920
- width: "12",
12921
- height: "12",
12922
- fill: "white",
12923
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12953
+ control: form.control,
12954
+ name: "phone",
12955
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12956
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
12957
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12958
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12959
+ ] })
12924
12960
  }
12925
- ) })
12926
- ] })
12961
+ )
12962
+ ] }) }),
12963
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12964
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12965
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12966
+ ] }) })
12927
12967
  ]
12928
12968
  }
12929
- );
12969
+ ) });
12930
12970
  };
12931
- const schema$1 = objectType({
12932
- customer_id: stringType().min(1)
12933
- });
12934
- const SalesChannel = () => {
12971
+ const schema$1 = addressSchema;
12972
+ const Email = () => {
12935
12973
  const { id } = useParams();
12936
- const { draft_order, isPending, isError, error } = useDraftOrder(
12937
- id,
12938
- {
12939
- fields: "+sales_channel_id"
12940
- },
12941
- {
12942
- enabled: !!id
12943
- }
12944
- );
12974
+ const { order, isPending, isError, error } = useOrder(id, {
12975
+ fields: "+email"
12976
+ });
12945
12977
  if (isError) {
12946
12978
  throw error;
12947
12979
  }
12948
- const ISrEADY = !!draft_order && !isPending;
12980
+ const isReady = !isPending && !!order;
12949
12981
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12950
12982
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12951
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Sales Channel" }) }),
12952
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
12983
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12984
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12953
12985
  ] }),
12954
- ISrEADY && /* @__PURE__ */ jsx(SalesChannelForm, { order: draft_order })
12986
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12955
12987
  ] });
12956
12988
  };
12957
- const SalesChannelForm = ({ order }) => {
12989
+ const EmailForm = ({ order }) => {
12958
12990
  const form = useForm({
12959
12991
  defaultValues: {
12960
- sales_channel_id: order.sales_channel_id || ""
12992
+ email: order.email ?? ""
12961
12993
  },
12962
12994
  resolver: zodResolver(schema)
12963
12995
  });
@@ -12965,12 +12997,9 @@ const SalesChannelForm = ({ order }) => {
12965
12997
  const { handleSuccess } = useRouteModal();
12966
12998
  const onSubmit = form.handleSubmit(async (data) => {
12967
12999
  await mutateAsync(
12968
- {
12969
- sales_channel_id: data.sales_channel_id
12970
- },
13000
+ { email: data.email },
12971
13001
  {
12972
13002
  onSuccess: () => {
12973
- toast.success("Sales channel updated");
12974
13003
  handleSuccess();
12975
13004
  },
12976
13005
  onError: (error) => {
@@ -12985,7 +13014,18 @@ const SalesChannelForm = ({ order }) => {
12985
13014
  className: "flex flex-1 flex-col overflow-hidden",
12986
13015
  onSubmit,
12987
13016
  children: [
12988
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(SalesChannelField, { control: form.control, order }) }),
13017
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13018
+ Form$2.Field,
13019
+ {
13020
+ control: form.control,
13021
+ name: "email",
13022
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13023
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13024
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13025
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13026
+ ] })
13027
+ }
13028
+ ) }),
12989
13029
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12990
13030
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12991
13031
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -12994,48 +13034,8 @@ const SalesChannelForm = ({ order }) => {
12994
13034
  }
12995
13035
  ) });
12996
13036
  };
12997
- const SalesChannelField = ({ control, order }) => {
12998
- const salesChannels = useComboboxData({
12999
- queryFn: async (params) => {
13000
- return await sdk.admin.salesChannel.list(params);
13001
- },
13002
- queryKey: ["sales-channels"],
13003
- getOptions: (data) => {
13004
- return data.sales_channels.map((salesChannel) => ({
13005
- label: salesChannel.name,
13006
- value: salesChannel.id
13007
- }));
13008
- },
13009
- defaultValue: order.sales_channel_id || void 0
13010
- });
13011
- return /* @__PURE__ */ jsx(
13012
- Form$2.Field,
13013
- {
13014
- control,
13015
- name: "sales_channel_id",
13016
- render: ({ field }) => {
13017
- return /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13018
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Sales Channel" }),
13019
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(
13020
- Combobox,
13021
- {
13022
- options: salesChannels.options,
13023
- fetchNextPage: salesChannels.fetchNextPage,
13024
- isFetchingNextPage: salesChannels.isFetchingNextPage,
13025
- searchValue: salesChannels.searchValue,
13026
- onSearchValueChange: salesChannels.onSearchValueChange,
13027
- placeholder: "Select sales channel",
13028
- ...field
13029
- }
13030
- ) }),
13031
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13032
- ] });
13033
- }
13034
- }
13035
- );
13036
- };
13037
13037
  const schema = objectType({
13038
- sales_channel_id: stringType().min(1)
13038
+ email: stringType().email()
13039
13039
  });
13040
13040
  const widgetModule = { widgets: [] };
13041
13041
  const routeModule = {
@@ -13057,29 +13057,25 @@ const routeModule = {
13057
13057
  handle,
13058
13058
  loader,
13059
13059
  children: [
13060
- {
13061
- Component: BillingAddress,
13062
- path: "/draft-orders/:id/billing-address"
13063
- },
13064
13060
  {
13065
13061
  Component: CustomItems,
13066
13062
  path: "/draft-orders/:id/custom-items"
13067
13063
  },
13068
- {
13069
- Component: Email,
13070
- path: "/draft-orders/:id/email"
13071
- },
13072
13064
  {
13073
13065
  Component: Items,
13074
13066
  path: "/draft-orders/:id/items"
13075
13067
  },
13068
+ {
13069
+ Component: Metadata,
13070
+ path: "/draft-orders/:id/metadata"
13071
+ },
13076
13072
  {
13077
13073
  Component: Promotions,
13078
13074
  path: "/draft-orders/:id/promotions"
13079
13075
  },
13080
13076
  {
13081
- Component: Metadata,
13082
- path: "/draft-orders/:id/metadata"
13077
+ Component: SalesChannel,
13078
+ path: "/draft-orders/:id/sales-channel"
13083
13079
  },
13084
13080
  {
13085
13081
  Component: Shipping,
@@ -13094,8 +13090,12 @@ const routeModule = {
13094
13090
  path: "/draft-orders/:id/transfer-ownership"
13095
13091
  },
13096
13092
  {
13097
- Component: SalesChannel,
13098
- path: "/draft-orders/:id/sales-channel"
13093
+ Component: BillingAddress,
13094
+ path: "/draft-orders/:id/billing-address"
13095
+ },
13096
+ {
13097
+ Component: Email,
13098
+ path: "/draft-orders/:id/email"
13099
13099
  }
13100
13100
  ]
13101
13101
  }