@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.
@@ -7573,12 +7573,12 @@ const addressSchema = objectType({
7573
7573
  first_name: stringType().min(1),
7574
7574
  last_name: stringType().min(1),
7575
7575
  address_1: stringType().min(1),
7576
- address_2: stringType().optional(),
7577
- company: stringType().optional(),
7576
+ address_2: stringType().nullish(),
7577
+ company: stringType().nullish(),
7578
7578
  city: stringType().min(1),
7579
- province: stringType().optional(),
7579
+ province: stringType().nullish(),
7580
7580
  postal_code: stringType().min(1),
7581
- phone: stringType().optional()
7581
+ phone: stringType().nullish()
7582
7582
  });
7583
7583
  const Create = () => {
7584
7584
  return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { children: /* @__PURE__ */ jsxRuntime.jsx(CreateForm, {}) });
@@ -8328,7 +8328,7 @@ const ActivitySection = ({ order, changes }) => {
8328
8328
  () => getActivityItems(order, changes),
8329
8329
  [order, changes]
8330
8330
  );
8331
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0 overflow-hidden", children: [
8331
+ return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "overflow-hidden p-0", children: [
8332
8332
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Activity" }) }),
8333
8333
  /* @__PURE__ */ jsxRuntime.jsx(ActivityItemList, { items: activityItems })
8334
8334
  ] });
@@ -8359,8 +8359,8 @@ const CollapsibleActivityItemList = ({
8359
8359
  const [open, setOpen] = React.useState(false);
8360
8360
  return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Collapsible.Root, { open, onOpenChange: setOpen, children: [
8361
8361
  !open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[20px_1fr] items-start gap-2", children: [
8362
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.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" }) }),
8363
- /* @__PURE__ */ jsxRuntime.jsx(radixUi.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__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8362
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full flex-col items-center", children: /* @__PURE__ */ jsxRuntime.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" }) }),
8363
+ /* @__PURE__ */ jsxRuntime.jsx(radixUi.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__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: `Show ${items.length} more ${items.length === 1 ? "activity" : "activities"}` }) })
8364
8364
  ] }),
8365
8365
  /* @__PURE__ */ jsxRuntime.jsx(radixUi.Collapsible.Content, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-0.5", children: items.map((item, idx) => {
8366
8366
  return /* @__PURE__ */ jsxRuntime.jsx(ActivityItem, { item }, idx);
@@ -8378,14 +8378,14 @@ const ActivityItem = ({ item, isFirst = false }) => {
8378
8378
  return /* @__PURE__ */ jsxRuntime.jsxs(
8379
8379
  "div",
8380
8380
  {
8381
- className: ui.clx("grid grid-cols-[20px_1fr] items-start gap-x-2 w-full"),
8381
+ className: ui.clx("grid w-full grid-cols-[20px_1fr] items-start gap-x-2"),
8382
8382
  children: [
8383
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-0.5 h-full", children: [
8384
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-2.5 rounded-full shadow-borders-base flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-1.5 rounded-full bg-ui-tag-neutral-icon" }) }) }),
8385
- !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-px bg-ui-border-base" }) })
8383
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col items-center gap-0.5", children: [
8384
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shadow-borders-base flex size-2.5 items-center justify-center rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-neutral-icon size-1.5 rounded-full" }) }) }),
8385
+ !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-border-base h-full w-px" }) })
8386
8386
  ] }),
8387
8387
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.clx("flex flex-col", !isFirst && "pb-4"), children: [
8388
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-between", children: [
8388
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
8389
8389
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: item.label }),
8390
8390
  /* @__PURE__ */ jsxRuntime.jsx(
8391
8391
  ui.Tooltip,
@@ -8396,7 +8396,7 @@ const ActivityItem = ({ item, isFirst = false }) => {
8396
8396
  )
8397
8397
  ] }),
8398
8398
  item.content && renderContent(item.content),
8399
- item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-2 text-ui-fg-muted", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-1.5 w-fit", children: [
8399
+ item.userId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-muted pt-2", children: isUserLoaded ? /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Link, { to: `/settings/users/${user.id}`, className: "w-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-fit items-center gap-x-1.5", children: [
8400
8400
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
8401
8401
  /* @__PURE__ */ jsxRuntime.jsx(
8402
8402
  ui.Avatar,
@@ -8412,8 +8412,8 @@ const ActivityItem = ({ item, isFirst = false }) => {
8412
8412
  ] })
8413
8413
  ] }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
8414
8414
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "By" }),
8415
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "rounded-full w-5 h-5" }),
8416
- /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "w-[75px] h-4" })
8415
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-5 w-5 rounded-full" }),
8416
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-4 w-[75px]" })
8417
8417
  ] }) })
8418
8418
  ] })
8419
8419
  ]
@@ -8436,7 +8436,12 @@ function getEditActivityItems(change) {
8436
8436
  promotionsAdded: 0,
8437
8437
  promotionsRemoved: 0
8438
8438
  };
8439
- for (const action of change.actions) {
8439
+ const orderedActions = change.actions.sort((a, b) => {
8440
+ return a.ordering - b.ordering;
8441
+ });
8442
+ const addedPromotionMap = /* @__PURE__ */ new Map();
8443
+ const removedPromotionMap = /* @__PURE__ */ new Map();
8444
+ for (const action of orderedActions) {
8440
8445
  if (!action.details) {
8441
8446
  continue;
8442
8447
  }
@@ -8454,13 +8459,21 @@ function getEditActivityItems(change) {
8454
8459
  case "SHIPPING_REMOVE":
8455
8460
  counts.shippingMethodsRemoved += 1;
8456
8461
  break;
8457
- case "PROMOTION_ADD":
8458
- counts.promotionsAdded += 1;
8462
+ case "PROMOTION_ADD": {
8463
+ addedPromotionMap.set(action.reference_id, true);
8459
8464
  break;
8460
- case "PROMOTION_REMOVE":
8461
- counts.promotionsRemoved += 1;
8465
+ }
8466
+ case "PROMOTION_REMOVE": {
8467
+ if (addedPromotionMap.has(action.reference_id)) {
8468
+ addedPromotionMap.delete(action.reference_id);
8469
+ } else {
8470
+ removedPromotionMap.set(action.reference_id, true);
8471
+ }
8462
8472
  break;
8473
+ }
8463
8474
  }
8475
+ counts.promotionsAdded = addedPromotionMap.size;
8476
+ counts.promotionsRemoved = removedPromotionMap.size;
8464
8477
  }
8465
8478
  const createActivityItem = (type, added, removed) => {
8466
8479
  if (added === 0 && removed === 0) return;
@@ -9560,10 +9573,10 @@ const ID = () => {
9560
9573
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9561
9574
  ] });
9562
9575
  };
9563
- const Email = () => {
9576
+ const BillingAddress = () => {
9564
9577
  const { id } = reactRouterDom.useParams();
9565
9578
  const { order, isPending, isError, error } = useOrder(id, {
9566
- fields: "+email"
9579
+ fields: "+billing_address"
9567
9580
  });
9568
9581
  if (isError) {
9569
9582
  throw error;
@@ -9571,16 +9584,26 @@ const Email = () => {
9571
9584
  const isReady = !isPending && !!order;
9572
9585
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9573
9586
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9574
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9575
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9587
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9588
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9576
9589
  ] }),
9577
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9590
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9578
9591
  ] });
9579
9592
  };
9580
- const EmailForm = ({ order }) => {
9593
+ const BillingAddressForm = ({ order }) => {
9594
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9581
9595
  const form = reactHookForm.useForm({
9582
9596
  defaultValues: {
9583
- email: order.email ?? ""
9597
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9598
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9599
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9600
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9601
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9602
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9603
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9604
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9605
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9606
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9584
9607
  },
9585
9608
  resolver: zod.zodResolver(schema$5)
9586
9609
  });
@@ -9588,7 +9611,7 @@ const EmailForm = ({ order }) => {
9588
9611
  const { handleSuccess } = useRouteModal();
9589
9612
  const onSubmit = form.handleSubmit(async (data) => {
9590
9613
  await mutateAsync(
9591
- { email: data.email },
9614
+ { billing_address: data },
9592
9615
  {
9593
9616
  onSuccess: () => {
9594
9617
  handleSuccess();
@@ -9605,18 +9628,132 @@ const EmailForm = ({ order }) => {
9605
9628
  className: "flex flex-1 flex-col overflow-hidden",
9606
9629
  onSubmit,
9607
9630
  children: [
9608
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9609
- Form$2.Field,
9610
- {
9611
- control: form.control,
9612
- name: "email",
9613
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9614
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9615
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9616
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9617
- ] })
9618
- }
9619
- ) }),
9631
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
9632
+ /* @__PURE__ */ jsxRuntime.jsx(
9633
+ Form$2.Field,
9634
+ {
9635
+ control: form.control,
9636
+ name: "country_code",
9637
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9639
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9640
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9641
+ ] })
9642
+ }
9643
+ ),
9644
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9645
+ /* @__PURE__ */ jsxRuntime.jsx(
9646
+ Form$2.Field,
9647
+ {
9648
+ control: form.control,
9649
+ name: "first_name",
9650
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9652
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9653
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9654
+ ] })
9655
+ }
9656
+ ),
9657
+ /* @__PURE__ */ jsxRuntime.jsx(
9658
+ Form$2.Field,
9659
+ {
9660
+ control: form.control,
9661
+ name: "last_name",
9662
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9664
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9665
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9666
+ ] })
9667
+ }
9668
+ )
9669
+ ] }),
9670
+ /* @__PURE__ */ jsxRuntime.jsx(
9671
+ Form$2.Field,
9672
+ {
9673
+ control: form.control,
9674
+ name: "company",
9675
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9677
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9678
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9679
+ ] })
9680
+ }
9681
+ ),
9682
+ /* @__PURE__ */ jsxRuntime.jsx(
9683
+ Form$2.Field,
9684
+ {
9685
+ control: form.control,
9686
+ name: "address_1",
9687
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9689
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9690
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9691
+ ] })
9692
+ }
9693
+ ),
9694
+ /* @__PURE__ */ jsxRuntime.jsx(
9695
+ Form$2.Field,
9696
+ {
9697
+ control: form.control,
9698
+ name: "address_2",
9699
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9701
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9702
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9703
+ ] })
9704
+ }
9705
+ ),
9706
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9707
+ /* @__PURE__ */ jsxRuntime.jsx(
9708
+ Form$2.Field,
9709
+ {
9710
+ control: form.control,
9711
+ name: "postal_code",
9712
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9714
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9715
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9716
+ ] })
9717
+ }
9718
+ ),
9719
+ /* @__PURE__ */ jsxRuntime.jsx(
9720
+ Form$2.Field,
9721
+ {
9722
+ control: form.control,
9723
+ name: "city",
9724
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9726
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9727
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9728
+ ] })
9729
+ }
9730
+ )
9731
+ ] }),
9732
+ /* @__PURE__ */ jsxRuntime.jsx(
9733
+ Form$2.Field,
9734
+ {
9735
+ control: form.control,
9736
+ name: "province",
9737
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9739
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9740
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9741
+ ] })
9742
+ }
9743
+ ),
9744
+ /* @__PURE__ */ jsxRuntime.jsx(
9745
+ Form$2.Field,
9746
+ {
9747
+ control: form.control,
9748
+ name: "phone",
9749
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9751
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9752
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9753
+ ] })
9754
+ }
9755
+ )
9756
+ ] }) }),
9620
9757
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9621
9758
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9622
9759
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -9625,7 +9762,26 @@ const EmailForm = ({ order }) => {
9625
9762
  }
9626
9763
  ) });
9627
9764
  };
9628
- const schema$5 = objectType({
9765
+ const schema$5 = addressSchema;
9766
+ const CustomItems = () => {
9767
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9768
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
9769
+ /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
9770
+ ] });
9771
+ };
9772
+ const CustomItemsForm = () => {
9773
+ const form = reactHookForm.useForm({
9774
+ resolver: zod.zodResolver(schema$4)
9775
+ });
9776
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9777
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
9778
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9779
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9780
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
9781
+ ] }) })
9782
+ ] }) });
9783
+ };
9784
+ const schema$4 = objectType({
9629
9785
  email: stringType().email()
9630
9786
  });
9631
9787
  const NumberInput = React.forwardRef(
@@ -9911,7 +10067,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9911
10067
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 flex-col items-center overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-6 px-6 py-16", children: [
9912
10068
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9913
10069
  /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Items" }) }),
9914
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order." }) })
10070
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Edit the items in the draft order" }) })
9915
10071
  ] }),
9916
10072
  /* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
9917
10073
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6", children: [
@@ -9952,13 +10108,13 @@ const ItemsForm = ({ preview, currencyCode }) => {
9952
10108
  ] })
9953
10109
  ] }),
9954
10110
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
9955
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-[1fr_1fr_1fr_28px] gap-3 px-4 py-2 text-ui-fg-muted", children: [
10111
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-[5px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-muted grid grid-cols-[2fr_1fr_2fr_28px] gap-3 px-4 py-2", children: [
9956
10112
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Item" }) }),
9957
10113
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Quantity" }) }),
9958
10114
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Price" }) }),
9959
10115
  /* @__PURE__ */ jsxRuntime.jsx("div", {})
9960
10116
  ] }) }),
9961
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.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: [
10117
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: itemCount <= 0 ? /* @__PURE__ */ jsxRuntime.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: [
9962
10118
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "There are no items in this order" }),
9963
10119
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add items to the order to get started." })
9964
10120
  ] }) : matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -9969,7 +10125,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
9969
10125
  currencyCode
9970
10126
  },
9971
10127
  item.id
9972
- )) : /* @__PURE__ */ jsxRuntime.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: [
10128
+ )) : /* @__PURE__ */ jsxRuntime.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: [
9973
10129
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
9974
10130
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
9975
10131
  'No items found for "',
@@ -10008,7 +10164,7 @@ const ItemsForm = ({ preview, currencyCode }) => {
10008
10164
  ]
10009
10165
  }
10010
10166
  ) }),
10011
- /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10167
+ /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10012
10168
  /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10013
10169
  /* @__PURE__ */ jsxRuntime.jsx(
10014
10170
  ui.Button,
@@ -10084,8 +10240,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10084
10240
  }
10085
10241
  );
10086
10242
  });
10087
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.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: [
10088
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3 w-full", children: [
10243
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.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: [
10244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-x-3", children: [
10089
10245
  /* @__PURE__ */ jsxRuntime.jsx(
10090
10246
  Thumbnail,
10091
10247
  {
@@ -10121,7 +10277,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10121
10277
  )
10122
10278
  ] })
10123
10279
  ] }),
10124
- editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10280
+ editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
10125
10281
  Form$2.Field,
10126
10282
  {
10127
10283
  control: form.control,
@@ -10130,8 +10286,8 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10130
10286
  return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field }) }) });
10131
10287
  }
10132
10288
  }
10133
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: item.quantity }) }),
10134
- editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
10289
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: item.quantity }) }),
10290
+ editing ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
10135
10291
  Form$2.Field,
10136
10292
  {
10137
10293
  control: form.control,
@@ -10148,7 +10304,7 @@ const VariantItem = ({ item, preview, currencyCode }) => {
10148
10304
  ) }) });
10149
10305
  }
10150
10306
  }
10151
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-end w-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10307
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10152
10308
  /* @__PURE__ */ jsxRuntime.jsx(
10153
10309
  ui.IconButton,
10154
10310
  {
@@ -10243,7 +10399,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10243
10399
  }
10244
10400
  );
10245
10401
  });
10246
- return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.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: [
10402
+ return /* @__PURE__ */ jsxRuntime.jsx(Form$2, { ...form, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit, children: /* @__PURE__ */ jsxRuntime.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: [
10247
10403
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
10248
10404
  /* @__PURE__ */ jsxRuntime.jsx(
10249
10405
  Thumbnail,
@@ -10290,7 +10446,7 @@ const CustomItem = ({ item, preview, currencyCode }) => {
10290
10446
  ) }) });
10291
10447
  }
10292
10448
  }
10293
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10449
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: getLocaleAmount(item.unit_price, currencyCode) }) }),
10294
10450
  /* @__PURE__ */ jsxRuntime.jsx(
10295
10451
  ui.IconButton,
10296
10452
  {
@@ -10415,7 +10571,7 @@ const ExistingItemsForm = ({ orderId, items }) => {
10415
10571
  autoFocusSearch: true
10416
10572
  }
10417
10573
  ) }),
10418
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10574
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10419
10575
  /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10420
10576
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Update items" })
10421
10577
  ] }) })
@@ -10583,15 +10739,15 @@ const CustomItemForm = ({ orderId, currencyCode }) => {
10583
10739
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Quantity" }),
10584
10740
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Enter the quantity of the item" })
10585
10741
  ] }),
10586
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 w-full", children: [
10587
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10742
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex-1", children: [
10743
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(NumberInput, { ...field, className: "w-full" }) }) }),
10588
10744
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
10589
10745
  ] })
10590
10746
  ] }) })
10591
10747
  }
10592
10748
  )
10593
10749
  ] }) }) }),
10594
- /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2 justify-end", children: [
10750
+ /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
10595
10751
  /* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
10596
10752
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "button", onClick: onSubmit, children: "Add item" })
10597
10753
  ] }) })
@@ -10996,22 +11152,22 @@ const PromotionForm = ({ preview }) => {
10996
11152
  const [comboboxValue, setComboboxValue] = React.useState("");
10997
11153
  const { handleSuccess } = useRouteModal();
10998
11154
  const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
10999
- const promoCodes = getPromotionCodes(items, shipping_methods);
11155
+ const promoIds = getPromotionIds(items, shipping_methods);
11000
11156
  const { promotions, isPending, isError, error } = usePromotions(
11001
11157
  {
11002
- code: promoCodes
11158
+ id: promoIds
11003
11159
  },
11004
11160
  {
11005
- enabled: !!promoCodes.length
11161
+ enabled: !!promoIds.length
11006
11162
  }
11007
11163
  );
11008
11164
  const comboboxData = useComboboxData({
11009
- queryKey: ["promotions", "combobox", promoCodes],
11165
+ queryKey: ["promotions", "combobox", promoIds],
11010
11166
  queryFn: async (params) => {
11011
11167
  return await sdk.admin.promotion.list({
11012
11168
  ...params,
11013
- code: {
11014
- $nin: promoCodes
11169
+ id: {
11170
+ $nin: promoIds
11015
11171
  }
11016
11172
  });
11017
11173
  },
@@ -11147,7 +11303,7 @@ const PromotionItem = ({
11147
11303
  "div",
11148
11304
  {
11149
11305
  className: ui.clx(
11150
- "px-3 py-2 rounded-lg bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between",
11306
+ "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
11151
11307
  {
11152
11308
  "animate-pulse": isLoading
11153
11309
  }
@@ -11155,7 +11311,7 @@ const PromotionItem = ({
11155
11311
  children: [
11156
11312
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11157
11313
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
11158
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-ui-fg-subtle", children: [
11314
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
11159
11315
  displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
11160
11316
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
11161
11317
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
@@ -11207,13 +11363,13 @@ const formatPercentage = (value, isPercentageValue = false) => {
11207
11363
  }
11208
11364
  return formatter.format(val);
11209
11365
  };
11210
- function getPromotionCodes(items, shippingMethods) {
11211
- const codes = /* @__PURE__ */ new Set();
11366
+ function getPromotionIds(items, shippingMethods) {
11367
+ const promotionIds = /* @__PURE__ */ new Set();
11212
11368
  for (const item of items) {
11213
11369
  if (item.adjustments) {
11214
11370
  for (const adjustment of item.adjustments) {
11215
- if (adjustment.code) {
11216
- codes.add(adjustment.code);
11371
+ if (adjustment.promotion_id) {
11372
+ promotionIds.add(adjustment.promotion_id);
11217
11373
  }
11218
11374
  }
11219
11375
  }
@@ -11221,13 +11377,13 @@ function getPromotionCodes(items, shippingMethods) {
11221
11377
  for (const shippingMethod of shippingMethods) {
11222
11378
  if (shippingMethod.adjustments) {
11223
11379
  for (const adjustment of shippingMethod.adjustments) {
11224
- if (adjustment.code) {
11225
- codes.add(adjustment.code);
11380
+ if (adjustment.promotion_id) {
11381
+ promotionIds.add(adjustment.promotion_id);
11226
11382
  }
11227
11383
  }
11228
11384
  }
11229
11385
  }
11230
- return Array.from(codes);
11386
+ return Array.from(promotionIds);
11231
11387
  }
11232
11388
  const SalesChannel = () => {
11233
11389
  const { id } = reactRouterDom.useParams();
@@ -11257,7 +11413,7 @@ const SalesChannelForm = ({ order }) => {
11257
11413
  defaultValues: {
11258
11414
  sales_channel_id: order.sales_channel_id || ""
11259
11415
  },
11260
- resolver: zod.zodResolver(schema$4)
11416
+ resolver: zod.zodResolver(schema$3)
11261
11417
  });
11262
11418
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11263
11419
  const { handleSuccess } = useRouteModal();
@@ -11332,7 +11488,7 @@ const SalesChannelField = ({ control, order }) => {
11332
11488
  }
11333
11489
  );
11334
11490
  };
11335
- const schema$4 = objectType({
11491
+ const schema$3 = objectType({
11336
11492
  sales_channel_id: stringType().min(1)
11337
11493
  });
11338
11494
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
@@ -12174,7 +12330,7 @@ const ShippingAddressForm = ({ order }) => {
12174
12330
  postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12175
12331
  phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12176
12332
  },
12177
- resolver: zod.zodResolver(schema$3)
12333
+ resolver: zod.zodResolver(schema$2)
12178
12334
  });
12179
12335
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12180
12336
  const { handleSuccess } = useRouteModal();
@@ -12344,7 +12500,7 @@ const ShippingAddressForm = ({ order }) => {
12344
12500
  }
12345
12501
  ) });
12346
12502
  };
12347
- const schema$3 = addressSchema;
12503
+ const schema$2 = addressSchema;
12348
12504
  const TransferOwnership = () => {
12349
12505
  const { id } = reactRouterDom.useParams();
12350
12506
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12368,7 +12524,7 @@ const TransferOwnershipForm = ({ order }) => {
12368
12524
  defaultValues: {
12369
12525
  customer_id: order.customer_id || ""
12370
12526
  },
12371
- resolver: zod.zodResolver(schema$2)
12527
+ resolver: zod.zodResolver(schema$1)
12372
12528
  });
12373
12529
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12374
12530
  const { handleSuccess } = useRouteModal();
@@ -12818,34 +12974,13 @@ const Illustration = () => {
12818
12974
  }
12819
12975
  );
12820
12976
  };
12821
- const schema$2 = objectType({
12822
- customer_id: stringType().min(1)
12823
- });
12824
- const CustomItems = () => {
12825
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12826
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
12827
- /* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
12828
- ] });
12829
- };
12830
- const CustomItemsForm = () => {
12831
- const form = reactHookForm.useForm({
12832
- resolver: zod.zodResolver(schema$1)
12833
- });
12834
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
12835
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
12836
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12837
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12838
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
12839
- ] }) })
12840
- ] }) });
12841
- };
12842
12977
  const schema$1 = objectType({
12843
- email: stringType().email()
12978
+ customer_id: stringType().min(1)
12844
12979
  });
12845
- const BillingAddress = () => {
12980
+ const Email = () => {
12846
12981
  const { id } = reactRouterDom.useParams();
12847
12982
  const { order, isPending, isError, error } = useOrder(id, {
12848
- fields: "+billing_address"
12983
+ fields: "+email"
12849
12984
  });
12850
12985
  if (isError) {
12851
12986
  throw error;
@@ -12853,26 +12988,16 @@ const BillingAddress = () => {
12853
12988
  const isReady = !isPending && !!order;
12854
12989
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12855
12990
  /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12856
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12857
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12991
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12992
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12858
12993
  ] }),
12859
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12994
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12860
12995
  ] });
12861
12996
  };
12862
- const BillingAddressForm = ({ order }) => {
12863
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12997
+ const EmailForm = ({ order }) => {
12864
12998
  const form = reactHookForm.useForm({
12865
12999
  defaultValues: {
12866
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12867
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12868
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12869
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12870
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12871
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12872
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12873
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12874
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12875
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
13000
+ email: order.email ?? ""
12876
13001
  },
12877
13002
  resolver: zod.zodResolver(schema)
12878
13003
  });
@@ -12880,7 +13005,7 @@ const BillingAddressForm = ({ order }) => {
12880
13005
  const { handleSuccess } = useRouteModal();
12881
13006
  const onSubmit = form.handleSubmit(async (data) => {
12882
13007
  await mutateAsync(
12883
- { billing_address: data },
13008
+ { email: data.email },
12884
13009
  {
12885
13010
  onSuccess: () => {
12886
13011
  handleSuccess();
@@ -12897,132 +13022,18 @@ const BillingAddressForm = ({ order }) => {
12897
13022
  className: "flex flex-1 flex-col overflow-hidden",
12898
13023
  onSubmit,
12899
13024
  children: [
12900
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
12901
- /* @__PURE__ */ jsxRuntime.jsx(
12902
- Form$2.Field,
12903
- {
12904
- control: form.control,
12905
- name: "country_code",
12906
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12907
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12908
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12909
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12910
- ] })
12911
- }
12912
- ),
12913
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12914
- /* @__PURE__ */ jsxRuntime.jsx(
12915
- Form$2.Field,
12916
- {
12917
- control: form.control,
12918
- name: "first_name",
12919
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12921
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12922
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12923
- ] })
12924
- }
12925
- ),
12926
- /* @__PURE__ */ jsxRuntime.jsx(
12927
- Form$2.Field,
12928
- {
12929
- control: form.control,
12930
- name: "last_name",
12931
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12934
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12935
- ] })
12936
- }
12937
- )
12938
- ] }),
12939
- /* @__PURE__ */ jsxRuntime.jsx(
12940
- Form$2.Field,
12941
- {
12942
- control: form.control,
12943
- name: "company",
12944
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12946
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12947
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12948
- ] })
12949
- }
12950
- ),
12951
- /* @__PURE__ */ jsxRuntime.jsx(
12952
- Form$2.Field,
12953
- {
12954
- control: form.control,
12955
- name: "address_1",
12956
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12959
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12960
- ] })
12961
- }
12962
- ),
12963
- /* @__PURE__ */ jsxRuntime.jsx(
12964
- Form$2.Field,
12965
- {
12966
- control: form.control,
12967
- name: "address_2",
12968
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12971
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12972
- ] })
12973
- }
12974
- ),
12975
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12976
- /* @__PURE__ */ jsxRuntime.jsx(
12977
- Form$2.Field,
12978
- {
12979
- control: form.control,
12980
- name: "postal_code",
12981
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12983
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12984
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12985
- ] })
12986
- }
12987
- ),
12988
- /* @__PURE__ */ jsxRuntime.jsx(
12989
- Form$2.Field,
12990
- {
12991
- control: form.control,
12992
- name: "city",
12993
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12996
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12997
- ] })
12998
- }
12999
- )
13000
- ] }),
13001
- /* @__PURE__ */ jsxRuntime.jsx(
13002
- Form$2.Field,
13003
- {
13004
- control: form.control,
13005
- name: "province",
13006
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13008
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13009
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13010
- ] })
13011
- }
13012
- ),
13013
- /* @__PURE__ */ jsxRuntime.jsx(
13014
- Form$2.Field,
13015
- {
13016
- control: form.control,
13017
- name: "phone",
13018
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13021
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13022
- ] })
13023
- }
13024
- )
13025
- ] }) }),
13025
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
13026
+ Form$2.Field,
13027
+ {
13028
+ control: form.control,
13029
+ name: "email",
13030
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13031
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
13032
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13033
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13034
+ ] })
13035
+ }
13036
+ ) }),
13026
13037
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13027
13038
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13028
13039
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -13031,7 +13042,9 @@ const BillingAddressForm = ({ order }) => {
13031
13042
  }
13032
13043
  ) });
13033
13044
  };
13034
- const schema = addressSchema;
13045
+ const schema = objectType({
13046
+ email: stringType().email()
13047
+ });
13035
13048
  const widgetModule = { widgets: [] };
13036
13049
  const routeModule = {
13037
13050
  routes: [
@@ -13053,8 +13066,12 @@ const routeModule = {
13053
13066
  loader,
13054
13067
  children: [
13055
13068
  {
13056
- Component: Email,
13057
- path: "/draft-orders/:id/email"
13069
+ Component: BillingAddress,
13070
+ path: "/draft-orders/:id/billing-address"
13071
+ },
13072
+ {
13073
+ Component: CustomItems,
13074
+ path: "/draft-orders/:id/custom-items"
13058
13075
  },
13059
13076
  {
13060
13077
  Component: Items,
@@ -13085,12 +13102,8 @@ const routeModule = {
13085
13102
  path: "/draft-orders/:id/transfer-ownership"
13086
13103
  },
13087
13104
  {
13088
- Component: CustomItems,
13089
- path: "/draft-orders/:id/custom-items"
13090
- },
13091
- {
13092
- Component: BillingAddress,
13093
- path: "/draft-orders/:id/billing-address"
13105
+ Component: Email,
13106
+ path: "/draft-orders/:id/email"
13094
13107
  }
13095
13108
  ]
13096
13109
  }