@medusajs/draft-order 2.10.2-preview-20250905060154 → 2.10.2-preview-20250905090156

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.
@@ -7567,12 +7567,12 @@ const addressSchema = objectType({
7567
7567
  first_name: stringType().min(1),
7568
7568
  last_name: stringType().min(1),
7569
7569
  address_1: stringType().min(1),
7570
- address_2: stringType().optional(),
7571
- company: stringType().optional(),
7570
+ address_2: stringType().nullish(),
7571
+ company: stringType().nullish(),
7572
7572
  city: stringType().min(1),
7573
- province: stringType().optional(),
7573
+ province: stringType().nullish(),
7574
7574
  postal_code: stringType().min(1),
7575
- phone: stringType().optional()
7575
+ phone: stringType().nullish()
7576
7576
  });
7577
7577
  const Create = () => {
7578
7578
  return /* @__PURE__ */ jsx(RouteFocusModal, { children: /* @__PURE__ */ jsx(CreateForm, {}) });
@@ -8322,7 +8322,7 @@ const ActivitySection = ({ order, changes }) => {
8322
8322
  () => getActivityItems(order, changes),
8323
8323
  [order, changes]
8324
8324
  );
8325
- return /* @__PURE__ */ jsxs(Container, { className: "p-0 overflow-hidden", children: [
8325
+ return /* @__PURE__ */ jsxs(Container, { className: "overflow-hidden p-0", children: [
8326
8326
  /* @__PURE__ */ jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsx(Heading, { children: "Activity" }) }),
8327
8327
  /* @__PURE__ */ jsx(ActivityItemList, { items: activityItems })
8328
8328
  ] });
@@ -8353,8 +8353,8 @@ const CollapsibleActivityItemList = ({
8353
8353
  const [open, setOpen] = useState(false);
8354
8354
  return /* @__PURE__ */ jsxs(Collapsible.Root, { open, onOpenChange: setOpen, children: [
8355
8355
  !open && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
8356
- /* @__PURE__ */ jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-right bg-repeat-y bg-clip-content" }) }),
8357
- /* @__PURE__ */ jsx(Collapsible.Trigger, { className: "text-left p-0 m-0 pb-4 text-ui-fg-muted hover:text-ui-fg-base focus:text-ui-fg-base outline-none transition-colors", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8356
+ /* @__PURE__ */ jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "border-ui-border-strong w-px flex-1 bg-[linear-gradient(var(--border-strong)_33%,rgba(255,255,255,0)_0%)] bg-[length:1px_3px] bg-clip-content bg-right bg-repeat-y" }) }),
8357
+ /* @__PURE__ */ jsx(Collapsible.Trigger, { className: "text-ui-fg-muted hover:text-ui-fg-base focus:text-ui-fg-base m-0 p-0 pb-4 text-left outline-none transition-colors", children: /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8358
8358
  ] }),
8359
8359
  /* @__PURE__ */ jsx(Collapsible.Content, { children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-0.5", children: items.map((item, idx) => {
8360
8360
  return /* @__PURE__ */ jsx(ActivityItem, { item }, idx);
@@ -8372,14 +8372,14 @@ const ActivityItem = ({ item, isFirst = false }) => {
8372
8372
  return /* @__PURE__ */ jsxs(
8373
8373
  "div",
8374
8374
  {
8375
- className: clx("grid grid-cols-[20px_1fr] items-start gap-x-2 w-full"),
8375
+ className: clx("grid w-full grid-cols-[20px_1fr] items-start gap-x-2"),
8376
8376
  children: [
8377
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-0.5 h-full", children: [
8378
- /* @__PURE__ */ jsx("div", { className: "size-5 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "size-2.5 rounded-full shadow-borders-base flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "size-1.5 rounded-full bg-ui-tag-neutral-icon" }) }) }),
8379
- !isFirst && /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-full w-px bg-ui-border-base" }) })
8377
+ /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col items-center gap-0.5", children: [
8378
+ /* @__PURE__ */ jsx("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-tag-neutral-icon size-1.5 rounded-full" }) }) }),
8379
+ !isFirst && /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-border-base h-full w-px" }) })
8380
8380
  ] }),
8381
8381
  /* @__PURE__ */ jsxs("div", { className: clx("flex flex-col", !isFirst && "pb-4"), children: [
8382
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-between", children: [
8382
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
8383
8383
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: item.label }),
8384
8384
  /* @__PURE__ */ jsx(
8385
8385
  Tooltip,
@@ -8390,7 +8390,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
8390
8390
  )
8391
8391
  ] }),
8392
8392
  item.content && renderContent(item.content),
8393
- item.userId && /* @__PURE__ */ jsx("div", { className: "pt-2 text-ui-fg-muted", children: isUserLoaded ? /* @__PURE__ */ jsx(Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1.5 w-fit", children: [
8393
+ item.userId && /* @__PURE__ */ jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsx(Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
8394
8394
  /* @__PURE__ */ jsx(Text, { size: "small", children: "By" }),
8395
8395
  /* @__PURE__ */ jsx(
8396
8396
  Avatar,
@@ -8406,8 +8406,8 @@ const ActivityItem = ({ item, isFirst = false }) => {
8406
8406
  ] })
8407
8407
  ] }) }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1.5", children: [
8408
8408
  /* @__PURE__ */ jsx(Text, { size: "small", children: "By" }),
8409
- /* @__PURE__ */ jsx(Skeleton, { className: "rounded-full w-5 h-5" }),
8410
- /* @__PURE__ */ jsx(Skeleton, { className: "w-[75px] h-4" })
8409
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-5 rounded-full" }),
8410
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-[75px]" })
8411
8411
  ] }) })
8412
8412
  ] })
8413
8413
  ]
@@ -8430,7 +8430,12 @@ function getEditActivityItems(change) {
8430
8430
  promotionsAdded: 0,
8431
8431
  promotionsRemoved: 0
8432
8432
  };
8433
- for (const action of change.actions) {
8433
+ const orderedActions = change.actions.sort((a, b) => {
8434
+ return a.ordering - b.ordering;
8435
+ });
8436
+ const addedPromotionMap = /* @__PURE__ */ new Map();
8437
+ const removedPromotionMap = /* @__PURE__ */ new Map();
8438
+ for (const action of orderedActions) {
8434
8439
  if (!action.details) {
8435
8440
  continue;
8436
8441
  }
@@ -8448,13 +8453,21 @@ function getEditActivityItems(change) {
8448
8453
  case "SHIPPING_REMOVE":
8449
8454
  counts.shippingMethodsRemoved += 1;
8450
8455
  break;
8451
- case "PROMOTION_ADD":
8452
- counts.promotionsAdded += 1;
8456
+ case "PROMOTION_ADD": {
8457
+ addedPromotionMap.set(action.reference_id, true);
8453
8458
  break;
8454
- case "PROMOTION_REMOVE":
8455
- counts.promotionsRemoved += 1;
8459
+ }
8460
+ case "PROMOTION_REMOVE": {
8461
+ if (addedPromotionMap.has(action.reference_id)) {
8462
+ addedPromotionMap.delete(action.reference_id);
8463
+ } else {
8464
+ removedPromotionMap.set(action.reference_id, true);
8465
+ }
8456
8466
  break;
8467
+ }
8457
8468
  }
8469
+ counts.promotionsAdded = addedPromotionMap.size;
8470
+ counts.promotionsRemoved = removedPromotionMap.size;
8458
8471
  }
8459
8472
  const createActivityItem = (type, added, removed) => {
8460
8473
  if (added === 0 && removed === 0) return;
@@ -9554,10 +9567,10 @@ const ID = () => {
9554
9567
  /* @__PURE__ */ jsx(Outlet, {})
9555
9568
  ] });
9556
9569
  };
9557
- const Email = () => {
9570
+ const BillingAddress = () => {
9558
9571
  const { id } = useParams();
9559
9572
  const { order, isPending, isError, error } = useOrder(id, {
9560
- fields: "+email"
9573
+ fields: "+billing_address"
9561
9574
  });
9562
9575
  if (isError) {
9563
9576
  throw error;
@@ -9565,16 +9578,26 @@ const Email = () => {
9565
9578
  const isReady = !isPending && !!order;
9566
9579
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9567
9580
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
9568
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
9569
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9581
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
9582
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9570
9583
  ] }),
9571
- isReady && /* @__PURE__ */ jsx(EmailForm, { order })
9584
+ isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
9572
9585
  ] });
9573
9586
  };
9574
- const EmailForm = ({ order }) => {
9587
+ const BillingAddressForm = ({ order }) => {
9588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9575
9589
  const form = useForm({
9576
9590
  defaultValues: {
9577
- email: order.email ?? ""
9591
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9592
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9593
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9594
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9595
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9596
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9597
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9598
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9599
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9600
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9578
9601
  },
9579
9602
  resolver: zodResolver(schema$5)
9580
9603
  });
@@ -9582,7 +9605,7 @@ const EmailForm = ({ order }) => {
9582
9605
  const { handleSuccess } = useRouteModal();
9583
9606
  const onSubmit = form.handleSubmit(async (data) => {
9584
9607
  await mutateAsync(
9585
- { email: data.email },
9608
+ { billing_address: data },
9586
9609
  {
9587
9610
  onSuccess: () => {
9588
9611
  handleSuccess();
@@ -9599,18 +9622,132 @@ const EmailForm = ({ order }) => {
9599
9622
  className: "flex flex-1 flex-col overflow-hidden",
9600
9623
  onSubmit,
9601
9624
  children: [
9602
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
9603
- Form$2.Field,
9604
- {
9605
- control: form.control,
9606
- name: "email",
9607
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9608
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
9609
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9610
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9611
- ] })
9612
- }
9613
- ) }),
9625
+ /* @__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: [
9626
+ /* @__PURE__ */ jsx(
9627
+ Form$2.Field,
9628
+ {
9629
+ control: form.control,
9630
+ name: "country_code",
9631
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9632
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
9633
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
9634
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9635
+ ] })
9636
+ }
9637
+ ),
9638
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9639
+ /* @__PURE__ */ jsx(
9640
+ Form$2.Field,
9641
+ {
9642
+ control: form.control,
9643
+ name: "first_name",
9644
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9645
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
9646
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9647
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9648
+ ] })
9649
+ }
9650
+ ),
9651
+ /* @__PURE__ */ jsx(
9652
+ Form$2.Field,
9653
+ {
9654
+ control: form.control,
9655
+ name: "last_name",
9656
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9657
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
9658
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9659
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9660
+ ] })
9661
+ }
9662
+ )
9663
+ ] }),
9664
+ /* @__PURE__ */ jsx(
9665
+ Form$2.Field,
9666
+ {
9667
+ control: form.control,
9668
+ name: "company",
9669
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9670
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
9671
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9672
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9673
+ ] })
9674
+ }
9675
+ ),
9676
+ /* @__PURE__ */ jsx(
9677
+ Form$2.Field,
9678
+ {
9679
+ control: form.control,
9680
+ name: "address_1",
9681
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9682
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
9683
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9684
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9685
+ ] })
9686
+ }
9687
+ ),
9688
+ /* @__PURE__ */ jsx(
9689
+ Form$2.Field,
9690
+ {
9691
+ control: form.control,
9692
+ name: "address_2",
9693
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9694
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9695
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9696
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9697
+ ] })
9698
+ }
9699
+ ),
9700
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9701
+ /* @__PURE__ */ jsx(
9702
+ Form$2.Field,
9703
+ {
9704
+ control: form.control,
9705
+ name: "postal_code",
9706
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9707
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
9708
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9709
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9710
+ ] })
9711
+ }
9712
+ ),
9713
+ /* @__PURE__ */ jsx(
9714
+ Form$2.Field,
9715
+ {
9716
+ control: form.control,
9717
+ name: "city",
9718
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9719
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
9720
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9721
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9722
+ ] })
9723
+ }
9724
+ )
9725
+ ] }),
9726
+ /* @__PURE__ */ jsx(
9727
+ Form$2.Field,
9728
+ {
9729
+ control: form.control,
9730
+ name: "province",
9731
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9732
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9733
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9734
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9735
+ ] })
9736
+ }
9737
+ ),
9738
+ /* @__PURE__ */ jsx(
9739
+ Form$2.Field,
9740
+ {
9741
+ control: form.control,
9742
+ name: "phone",
9743
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
9744
+ /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
9745
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
9746
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
9747
+ ] })
9748
+ }
9749
+ )
9750
+ ] }) }),
9614
9751
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9615
9752
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9616
9753
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9619,7 +9756,26 @@ const EmailForm = ({ order }) => {
9619
9756
  }
9620
9757
  ) });
9621
9758
  };
9622
- const schema$5 = objectType({
9759
+ const schema$5 = addressSchema;
9760
+ const CustomItems = () => {
9761
+ return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
9762
+ /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
9763
+ /* @__PURE__ */ jsx(CustomItemsForm, {})
9764
+ ] });
9765
+ };
9766
+ const CustomItemsForm = () => {
9767
+ const form = useForm({
9768
+ resolver: zodResolver(schema$4)
9769
+ });
9770
+ return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9771
+ /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
9772
+ /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
9773
+ /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9774
+ /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
9775
+ ] }) })
9776
+ ] }) });
9777
+ };
9778
+ const schema$4 = objectType({
9623
9779
  email: stringType().email()
9624
9780
  });
9625
9781
  const NumberInput = forwardRef(
@@ -9905,7 +10061,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9905
10061
  /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
9906
10062
  /* @__PURE__ */ jsxs("div", { children: [
9907
10063
  /* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Items" }) }),
9908
- /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order." }) })
10064
+ /* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order" }) })
9909
10065
  ] }),
9910
10066
  /* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
9911
10067
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-6", children: [
@@ -9946,13 +10102,13 @@ const ItemsForm = ({ preview, currencyCode }) => {
9946
10102
  ] })
9947
10103
  ] }),
9948
10104
  /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
9949
- /* @__PURE__ */ jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_1fr_1fr_28px] gap-3 px-4 py-2 text-ui-fg-muted", children: [
10105
+ /* @__PURE__ */ jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-muted grid grid-cols-[2fr_1fr_2fr_28px] gap-3 px-4 py-2", children: [
9950
10106
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Item" }) }),
9951
10107
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Quantity" }) }),
9952
10108
  /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: "Price" }) }),
9953
10109
  /* @__PURE__ */ jsx("div", {})
9954
10110
  ] }) }),
9955
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
10111
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
9956
10112
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "There are no items in this order" }),
9957
10113
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Add items to the order to get started." })
9958
10114
  ] }) : matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsx(
@@ -9963,7 +10119,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9963
10119
  currencyCode
9964
10120
  },
9965
10121
  item.id
9966
- )) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-3 bg-ui-bg-base rounded-lg p-4 shadow-elevation-card-rest flex-col gap-1", children: [
10122
+ )) : /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex flex-col items-center justify-center gap-1 gap-x-3 rounded-lg p-4", children: [
9967
10123
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
9968
10124
  /* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
9969
10125
  'No items found for "',
@@ -10002,7 +10158,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
10002
10158
  ]
10003
10159
  }
10004
10160
  ) }),
10005
- /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10161
+ /* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10006
10162
  /* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10007
10163
  /* @__PURE__ */ jsx(
10008
10164
  Button,
@@ -10078,8 +10234,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10078
10234
  }
10079
10235
  );
10080
10236
  });
10081
- return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx("form", { onSubmit, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_28px] gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center", children: [
10082
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3 w-full", children: [
10237
+ return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx("form", { onSubmit, children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
10238
+ /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center gap-x-3", children: [
10083
10239
  /* @__PURE__ */ jsx(
10084
10240
  Thumbnail,
10085
10241
  {
@@ -10115,7 +10271,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10115
10271
  )
10116
10272
  ] })
10117
10273
  ] }),
10118
- editing ? /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(
10274
+ editing ? /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(
10119
10275
  Form$2.Field,
10120
10276
  {
10121
10277
  control: form.control,
@@ -10124,8 +10280,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10124
10280
  return /* @__PURE__ */ jsx(Form$2.Item, { children: /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(NumberInput, { ...field }) }) });
10125
10281
  }
10126
10282
  }
10127
- ) }) : /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: item.quantity }) }),
10128
- editing ? /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(
10283
+ ) }) : /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: item.quantity }) }),
10284
+ editing ? /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(
10129
10285
  Form$2.Field,
10130
10286
  {
10131
10287
  control: form.control,
@@ -10142,7 +10298,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10142
10298
  ) }) });
10143
10299
  }
10144
10300
  }
10145
- ) }) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-end w-full", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10301
+ ) }) : /* @__PURE__ */ jsx("div", { className: "flex w-full flex-1 items-center justify-end", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10146
10302
  /* @__PURE__ */ jsx(
10147
10303
  IconButton,
10148
10304
  {
@@ -10237,7 +10393,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10237
10393
  }
10238
10394
  );
10239
10395
  });
10240
- return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx("form", { onSubmit, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_28px] gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center", children: [
10396
+ return /* @__PURE__ */ jsx(Form$2, { ...form, children: /* @__PURE__ */ jsx("form", { onSubmit, children: /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,2fr)_28px] items-center gap-3 rounded-lg px-4 py-2", children: [
10241
10397
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
10242
10398
  /* @__PURE__ */ jsx(
10243
10399
  Thumbnail,
@@ -10284,7 +10440,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10284
10440
  ) }) });
10285
10441
  }
10286
10442
  }
10287
- ) : /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-end", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10443
+ ) : /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-end", children: /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10288
10444
  /* @__PURE__ */ jsx(
10289
10445
  IconButton,
10290
10446
  {
@@ -10409,7 +10565,7 @@ const ExistingItemsForm = ({ orderId, items }) => {
10409
10565
  autoFocusSearch: true
10410
10566
  }
10411
10567
  ) }),
10412
- /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10568
+ /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10413
10569
  /* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10414
10570
  /* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Update items" })
10415
10571
  ] }) })
@@ -10577,15 +10733,15 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10577
10733
  /* @__PURE__ */ jsx(Form$2.Label, { children: "Quantity" }),
10578
10734
  /* @__PURE__ */ jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10579
10735
  ] }),
10580
- /* @__PURE__ */ jsxs("div", { className: "flex-1 w-full", children: [
10581
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10736
+ /* @__PURE__ */ jsxs("div", { className: "w-full flex-1", children: [
10737
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10582
10738
  /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
10583
10739
  ] })
10584
10740
  ] }) })
10585
10741
  }
10586
10742
  )
10587
10743
  ] }) }) }),
10588
- /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10744
+ /* @__PURE__ */ jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10589
10745
  /* @__PURE__ */ jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10590
10746
  /* @__PURE__ */ jsx(Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10591
10747
  ] }) })
@@ -10990,22 +11146,22 @@ const PromotionForm = ({ preview }) => {
10990
11146
  const [comboboxValue, setComboboxValue] = useState("");
10991
11147
  const { handleSuccess } = useRouteModal();
10992
11148
  const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
10993
- const promoCodes = getPromotionCodes(items, shipping_methods);
11149
+ const promoIds = getPromotionIds(items, shipping_methods);
10994
11150
  const { promotions, isPending, isError, error } = usePromotions(
10995
11151
  {
10996
- code: promoCodes
11152
+ id: promoIds
10997
11153
  },
10998
11154
  {
10999
- enabled: !!promoCodes.length
11155
+ enabled: !!promoIds.length
11000
11156
  }
11001
11157
  );
11002
11158
  const comboboxData = useComboboxData({
11003
- queryKey: ["promotions", "combobox", promoCodes],
11159
+ queryKey: ["promotions", "combobox", promoIds],
11004
11160
  queryFn: async (params) => {
11005
11161
  return await sdk.admin.promotion.list({
11006
11162
  ...params,
11007
- code: {
11008
- $nin: promoCodes
11163
+ id: {
11164
+ $nin: promoIds
11009
11165
  }
11010
11166
  });
11011
11167
  },
@@ -11141,7 +11297,7 @@ const PromotionItem = ({
11141
11297
  "div",
11142
11298
  {
11143
11299
  className: clx(
11144
- "px-3 py-2 rounded-lg bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between",
11300
+ "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11145
11301
  {
11146
11302
  "animate-pulse": isLoading
11147
11303
  }
@@ -11149,7 +11305,7 @@ const PromotionItem = ({
11149
11305
  children: [
11150
11306
  /* @__PURE__ */ jsxs("div", { children: [
11151
11307
  /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11152
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-ui-fg-subtle", children: [
11308
+ /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11153
11309
  displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
11154
11310
  /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
11155
11311
  /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
@@ -11201,13 +11357,13 @@ const formatPercentage = (value, isPercentageValue = false) => {
11201
11357
  }
11202
11358
  return formatter.format(val);
11203
11359
  };
11204
- function getPromotionCodes(items, shippingMethods) {
11205
- const codes = /* @__PURE__ */ new Set();
11360
+ function getPromotionIds(items, shippingMethods) {
11361
+ const promotionIds = /* @__PURE__ */ new Set();
11206
11362
  for (const item of items) {
11207
11363
  if (item.adjustments) {
11208
11364
  for (const adjustment of item.adjustments) {
11209
- if (adjustment.code) {
11210
- codes.add(adjustment.code);
11365
+ if (adjustment.promotion_id) {
11366
+ promotionIds.add(adjustment.promotion_id);
11211
11367
  }
11212
11368
  }
11213
11369
  }
@@ -11215,13 +11371,13 @@ function getPromotionCodes(items, shippingMethods) {
11215
11371
  for (const shippingMethod of shippingMethods) {
11216
11372
  if (shippingMethod.adjustments) {
11217
11373
  for (const adjustment of shippingMethod.adjustments) {
11218
- if (adjustment.code) {
11219
- codes.add(adjustment.code);
11374
+ if (adjustment.promotion_id) {
11375
+ promotionIds.add(adjustment.promotion_id);
11220
11376
  }
11221
11377
  }
11222
11378
  }
11223
11379
  }
11224
- return Array.from(codes);
11380
+ return Array.from(promotionIds);
11225
11381
  }
11226
11382
  const SalesChannel = () => {
11227
11383
  const { id } = useParams();
@@ -11251,7 +11407,7 @@ const SalesChannelForm = ({ order }) => {
11251
11407
  defaultValues: {
11252
11408
  sales_channel_id: order.sales_channel_id || ""
11253
11409
  },
11254
- resolver: zodResolver(schema$4)
11410
+ resolver: zodResolver(schema$3)
11255
11411
  });
11256
11412
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11257
11413
  const { handleSuccess } = useRouteModal();
@@ -11326,7 +11482,7 @@ const SalesChannelField = ({ control, order }) => {
11326
11482
  }
11327
11483
  );
11328
11484
  };
11329
- const schema$4 = objectType({
11485
+ const schema$3 = objectType({
11330
11486
  sales_channel_id: stringType().min(1)
11331
11487
  });
11332
11488
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12168,7 +12324,7 @@ const ShippingAddressForm = ({ order }) => {
12168
12324
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12169
12325
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12170
12326
  },
12171
- resolver: zodResolver(schema$3)
12327
+ resolver: zodResolver(schema$2)
12172
12328
  });
12173
12329
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12174
12330
  const { handleSuccess } = useRouteModal();
@@ -12338,7 +12494,7 @@ const ShippingAddressForm = ({ order }) => {
12338
12494
  }
12339
12495
  ) });
12340
12496
  };
12341
- const schema$3 = addressSchema;
12497
+ const schema$2 = addressSchema;
12342
12498
  const TransferOwnership = () => {
12343
12499
  const { id } = useParams();
12344
12500
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12362,7 +12518,7 @@ const TransferOwnershipForm = ({ order }) => {
12362
12518
  defaultValues: {
12363
12519
  customer_id: order.customer_id || ""
12364
12520
  },
12365
- resolver: zodResolver(schema$2)
12521
+ resolver: zodResolver(schema$1)
12366
12522
  });
12367
12523
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12368
12524
  const { handleSuccess } = useRouteModal();
@@ -12812,34 +12968,13 @@ const Illustration = () => {
12812
12968
  }
12813
12969
  );
12814
12970
  };
12815
- const schema$2 = objectType({
12816
- customer_id: stringType().min(1)
12817
- });
12818
- const CustomItems = () => {
12819
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12820
- /* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
12821
- /* @__PURE__ */ jsx(CustomItemsForm, {})
12822
- ] });
12823
- };
12824
- const CustomItemsForm = () => {
12825
- const form = useForm({
12826
- resolver: zodResolver(schema$1)
12827
- });
12828
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12829
- /* @__PURE__ */ jsx(RouteDrawer.Body, {}),
12830
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
12831
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12832
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
12833
- ] }) })
12834
- ] }) });
12835
- };
12836
12971
  const schema$1 = objectType({
12837
- email: stringType().email()
12972
+ customer_id: stringType().min(1)
12838
12973
  });
12839
- const BillingAddress = () => {
12974
+ const Email = () => {
12840
12975
  const { id } = useParams();
12841
12976
  const { order, isPending, isError, error } = useOrder(id, {
12842
- fields: "+billing_address"
12977
+ fields: "+email"
12843
12978
  });
12844
12979
  if (isError) {
12845
12980
  throw error;
@@ -12847,26 +12982,16 @@ const BillingAddress = () => {
12847
12982
  const isReady = !isPending && !!order;
12848
12983
  return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
12849
12984
  /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
12850
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Billing Address" }) }),
12851
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12985
+ /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Email" }) }),
12986
+ /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12852
12987
  ] }),
12853
- isReady && /* @__PURE__ */ jsx(BillingAddressForm, { order })
12988
+ isReady && /* @__PURE__ */ jsx(EmailForm, { order })
12854
12989
  ] });
12855
12990
  };
12856
- const BillingAddressForm = ({ order }) => {
12857
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12991
+ const EmailForm = ({ order }) => {
12858
12992
  const form = useForm({
12859
12993
  defaultValues: {
12860
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12861
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12862
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12863
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12864
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12865
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12866
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12867
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12868
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12869
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12994
+ email: order.email ?? ""
12870
12995
  },
12871
12996
  resolver: zodResolver(schema)
12872
12997
  });
@@ -12874,7 +12999,7 @@ const BillingAddressForm = ({ order }) => {
12874
12999
  const { handleSuccess } = useRouteModal();
12875
13000
  const onSubmit = form.handleSubmit(async (data) => {
12876
13001
  await mutateAsync(
12877
- { billing_address: data },
13002
+ { email: data.email },
12878
13003
  {
12879
13004
  onSuccess: () => {
12880
13005
  handleSuccess();
@@ -12891,132 +13016,18 @@ const BillingAddressForm = ({ order }) => {
12891
13016
  className: "flex flex-1 flex-col overflow-hidden",
12892
13017
  onSubmit,
12893
13018
  children: [
12894
- /* @__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: [
12895
- /* @__PURE__ */ jsx(
12896
- Form$2.Field,
12897
- {
12898
- control: form.control,
12899
- name: "country_code",
12900
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12901
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
12902
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
12903
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12904
- ] })
12905
- }
12906
- ),
12907
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12908
- /* @__PURE__ */ jsx(
12909
- Form$2.Field,
12910
- {
12911
- control: form.control,
12912
- name: "first_name",
12913
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12914
- /* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
12915
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12916
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12917
- ] })
12918
- }
12919
- ),
12920
- /* @__PURE__ */ jsx(
12921
- Form$2.Field,
12922
- {
12923
- control: form.control,
12924
- name: "last_name",
12925
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12926
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
12927
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12928
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12929
- ] })
12930
- }
12931
- )
12932
- ] }),
12933
- /* @__PURE__ */ jsx(
12934
- Form$2.Field,
12935
- {
12936
- control: form.control,
12937
- name: "company",
12938
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12939
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
12940
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12941
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12942
- ] })
12943
- }
12944
- ),
12945
- /* @__PURE__ */ jsx(
12946
- Form$2.Field,
12947
- {
12948
- control: form.control,
12949
- name: "address_1",
12950
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12951
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
12952
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12953
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12954
- ] })
12955
- }
12956
- ),
12957
- /* @__PURE__ */ jsx(
12958
- Form$2.Field,
12959
- {
12960
- control: form.control,
12961
- name: "address_2",
12962
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12963
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12964
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12965
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12966
- ] })
12967
- }
12968
- ),
12969
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12970
- /* @__PURE__ */ jsx(
12971
- Form$2.Field,
12972
- {
12973
- control: form.control,
12974
- name: "postal_code",
12975
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12976
- /* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
12977
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12978
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12979
- ] })
12980
- }
12981
- ),
12982
- /* @__PURE__ */ jsx(
12983
- Form$2.Field,
12984
- {
12985
- control: form.control,
12986
- name: "city",
12987
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
12988
- /* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
12989
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
12990
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
12991
- ] })
12992
- }
12993
- )
12994
- ] }),
12995
- /* @__PURE__ */ jsx(
12996
- Form$2.Field,
12997
- {
12998
- control: form.control,
12999
- name: "province",
13000
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13001
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13002
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13003
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13004
- ] })
13005
- }
13006
- ),
13007
- /* @__PURE__ */ jsx(
13008
- Form$2.Field,
13009
- {
13010
- control: form.control,
13011
- name: "phone",
13012
- render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13013
- /* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
13014
- /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13015
- /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13016
- ] })
13017
- }
13018
- )
13019
- ] }) }),
13019
+ /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
13020
+ Form$2.Field,
13021
+ {
13022
+ control: form.control,
13023
+ name: "email",
13024
+ render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
13025
+ /* @__PURE__ */ jsx(Form$2.Label, { children: "Email" }),
13026
+ /* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
13027
+ /* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
13028
+ ] })
13029
+ }
13030
+ ) }),
13020
13031
  /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
13021
13032
  /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13022
13033
  /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -13025,7 +13036,9 @@ const BillingAddressForm = ({ order }) => {
13025
13036
  }
13026
13037
  ) });
13027
13038
  };
13028
- const schema = addressSchema;
13039
+ const schema = objectType({
13040
+ email: stringType().email()
13041
+ });
13029
13042
  const widgetModule = { widgets: [] };
13030
13043
  const routeModule = {
13031
13044
  routes: [
@@ -13047,8 +13060,12 @@ const routeModule = {
13047
13060
  loader,
13048
13061
  children: [
13049
13062
  {
13050
- Component: Email,
13051
- path: "/draft-orders/:id/email"
13063
+ Component: BillingAddress,
13064
+ path: "/draft-orders/:id/billing-address"
13065
+ },
13066
+ {
13067
+ Component: CustomItems,
13068
+ path: "/draft-orders/:id/custom-items"
13052
13069
  },
13053
13070
  {
13054
13071
  Component: Items,
@@ -13079,12 +13096,8 @@ const routeModule = {
13079
13096
  path: "/draft-orders/:id/transfer-ownership"
13080
13097
  },
13081
13098
  {
13082
- Component: CustomItems,
13083
- path: "/draft-orders/:id/custom-items"
13084
- },
13085
- {
13086
- Component: BillingAddress,
13087
- path: "/draft-orders/:id/billing-address"
13099
+ Component: Email,
13100
+ path: "/draft-orders/:id/email"
13088
13101
  }
13089
13102
  ]
13090
13103
  }