@medusajs/draft-order 2.11.1-preview-20251023150219 → 2.11.1-preview-20251023210200

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.
@@ -9571,6 +9571,196 @@ const ID = () => {
9571
9571
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
9572
9572
  ] });
9573
9573
  };
9574
+ const BillingAddress = () => {
9575
+ const { id } = reactRouterDom.useParams();
9576
+ const { order, isPending, isError, error } = useOrder(id, {
9577
+ fields: "+billing_address"
9578
+ });
9579
+ if (isError) {
9580
+ throw error;
9581
+ }
9582
+ const isReady = !isPending && !!order;
9583
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9584
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9585
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
9586
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
9587
+ ] }),
9588
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
9589
+ ] });
9590
+ };
9591
+ const BillingAddressForm = ({ order }) => {
9592
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
9593
+ const form = reactHookForm.useForm({
9594
+ defaultValues: {
9595
+ first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
9596
+ last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
9597
+ company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
9598
+ address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
9599
+ address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
9600
+ city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
9601
+ province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
9602
+ country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
9603
+ postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
9604
+ phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
9605
+ },
9606
+ resolver: zod.zodResolver(schema$5)
9607
+ });
9608
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9609
+ const { handleSuccess } = useRouteModal();
9610
+ const onSubmit = form.handleSubmit(async (data) => {
9611
+ await mutateAsync(
9612
+ { billing_address: data },
9613
+ {
9614
+ onSuccess: () => {
9615
+ handleSuccess();
9616
+ },
9617
+ onError: (error) => {
9618
+ ui.toast.error(error.message);
9619
+ }
9620
+ }
9621
+ );
9622
+ });
9623
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9624
+ KeyboundForm,
9625
+ {
9626
+ className: "flex flex-1 flex-col overflow-hidden",
9627
+ onSubmit,
9628
+ children: [
9629
+ /* @__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: [
9630
+ /* @__PURE__ */ jsxRuntime.jsx(
9631
+ Form$2.Field,
9632
+ {
9633
+ control: form.control,
9634
+ name: "country_code",
9635
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9636
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
9637
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
9638
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9639
+ ] })
9640
+ }
9641
+ ),
9642
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9643
+ /* @__PURE__ */ jsxRuntime.jsx(
9644
+ Form$2.Field,
9645
+ {
9646
+ control: form.control,
9647
+ name: "first_name",
9648
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9649
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
9650
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9651
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9652
+ ] })
9653
+ }
9654
+ ),
9655
+ /* @__PURE__ */ jsxRuntime.jsx(
9656
+ Form$2.Field,
9657
+ {
9658
+ control: form.control,
9659
+ name: "last_name",
9660
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9661
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
9662
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9663
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9664
+ ] })
9665
+ }
9666
+ )
9667
+ ] }),
9668
+ /* @__PURE__ */ jsxRuntime.jsx(
9669
+ Form$2.Field,
9670
+ {
9671
+ control: form.control,
9672
+ name: "company",
9673
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9674
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
9675
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9676
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9677
+ ] })
9678
+ }
9679
+ ),
9680
+ /* @__PURE__ */ jsxRuntime.jsx(
9681
+ Form$2.Field,
9682
+ {
9683
+ control: form.control,
9684
+ name: "address_1",
9685
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9686
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
9687
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9688
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9689
+ ] })
9690
+ }
9691
+ ),
9692
+ /* @__PURE__ */ jsxRuntime.jsx(
9693
+ Form$2.Field,
9694
+ {
9695
+ control: form.control,
9696
+ name: "address_2",
9697
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9698
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
9699
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9700
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9701
+ ] })
9702
+ }
9703
+ ),
9704
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
9705
+ /* @__PURE__ */ jsxRuntime.jsx(
9706
+ Form$2.Field,
9707
+ {
9708
+ control: form.control,
9709
+ name: "postal_code",
9710
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9711
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
9712
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9713
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9714
+ ] })
9715
+ }
9716
+ ),
9717
+ /* @__PURE__ */ jsxRuntime.jsx(
9718
+ Form$2.Field,
9719
+ {
9720
+ control: form.control,
9721
+ name: "city",
9722
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9723
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
9724
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9725
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9726
+ ] })
9727
+ }
9728
+ )
9729
+ ] }),
9730
+ /* @__PURE__ */ jsxRuntime.jsx(
9731
+ Form$2.Field,
9732
+ {
9733
+ control: form.control,
9734
+ name: "province",
9735
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9736
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
9737
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9738
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9739
+ ] })
9740
+ }
9741
+ ),
9742
+ /* @__PURE__ */ jsxRuntime.jsx(
9743
+ Form$2.Field,
9744
+ {
9745
+ control: form.control,
9746
+ name: "phone",
9747
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9748
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
9749
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9750
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9751
+ ] })
9752
+ }
9753
+ )
9754
+ ] }) }),
9755
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9756
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9757
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9758
+ ] }) })
9759
+ ]
9760
+ }
9761
+ ) });
9762
+ };
9763
+ const schema$5 = addressSchema;
9574
9764
  const CustomItems = () => {
9575
9765
  return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9576
9766
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
@@ -9579,7 +9769,7 @@ const CustomItems = () => {
9579
9769
  };
9580
9770
  const CustomItemsForm = () => {
9581
9771
  const form = reactHookForm.useForm({
9582
- resolver: zod.zodResolver(schema$5)
9772
+ resolver: zod.zodResolver(schema$4)
9583
9773
  });
9584
9774
  return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
9585
9775
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
@@ -9589,45 +9779,113 @@ const CustomItemsForm = () => {
9589
9779
  ] }) })
9590
9780
  ] }) });
9591
9781
  };
9592
- const schema$5 = objectType({
9782
+ const schema$4 = objectType({
9593
9783
  email: stringType().email()
9594
9784
  });
9595
- const NumberInput = React.forwardRef(
9596
- ({
9597
- value,
9598
- onChange,
9599
- size = "base",
9600
- min = 0,
9601
- max = 100,
9602
- step = 1,
9603
- className,
9604
- disabled,
9605
- ...props
9606
- }, ref) => {
9607
- const handleChange = (event) => {
9608
- const newValue = event.target.value === "" ? min : Number(event.target.value);
9609
- if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9610
- onChange(newValue);
9611
- }
9612
- };
9613
- const handleIncrement = () => {
9614
- const newValue = value + step;
9615
- if (max === void 0 || newValue <= max) {
9616
- onChange(newValue);
9617
- }
9618
- };
9619
- const handleDecrement = () => {
9620
- const newValue = value - step;
9621
- if (min === void 0 || newValue >= min) {
9622
- onChange(newValue);
9623
- }
9624
- };
9625
- return /* @__PURE__ */ jsxRuntime.jsxs(
9626
- "div",
9785
+ const Email = () => {
9786
+ const { id } = reactRouterDom.useParams();
9787
+ const { order, isPending, isError, error } = useOrder(id, {
9788
+ fields: "+email"
9789
+ });
9790
+ if (isError) {
9791
+ throw error;
9792
+ }
9793
+ const isReady = !isPending && !!order;
9794
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
9795
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
9796
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
9797
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
9798
+ ] }),
9799
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
9800
+ ] });
9801
+ };
9802
+ const EmailForm = ({ order }) => {
9803
+ const form = reactHookForm.useForm({
9804
+ defaultValues: {
9805
+ email: order.email ?? ""
9806
+ },
9807
+ resolver: zod.zodResolver(schema$3)
9808
+ });
9809
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
9810
+ const { handleSuccess } = useRouteModal();
9811
+ const onSubmit = form.handleSubmit(async (data) => {
9812
+ await mutateAsync(
9813
+ { email: data.email },
9627
9814
  {
9628
- className: ui.clx(
9629
- "inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
9630
- "[&:has(input:focus)]:shadow-borders-interactive-with-active",
9815
+ onSuccess: () => {
9816
+ handleSuccess();
9817
+ },
9818
+ onError: (error) => {
9819
+ ui.toast.error(error.message);
9820
+ }
9821
+ }
9822
+ );
9823
+ });
9824
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
9825
+ KeyboundForm,
9826
+ {
9827
+ className: "flex flex-1 flex-col overflow-hidden",
9828
+ onSubmit,
9829
+ children: [
9830
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
9831
+ Form$2.Field,
9832
+ {
9833
+ control: form.control,
9834
+ name: "email",
9835
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
9836
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
9837
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
9838
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
9839
+ ] })
9840
+ }
9841
+ ) }),
9842
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
9843
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
9844
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
9845
+ ] }) })
9846
+ ]
9847
+ }
9848
+ ) });
9849
+ };
9850
+ const schema$3 = objectType({
9851
+ email: stringType().email()
9852
+ });
9853
+ const NumberInput = React.forwardRef(
9854
+ ({
9855
+ value,
9856
+ onChange,
9857
+ size = "base",
9858
+ min = 0,
9859
+ max = 100,
9860
+ step = 1,
9861
+ className,
9862
+ disabled,
9863
+ ...props
9864
+ }, ref) => {
9865
+ const handleChange = (event) => {
9866
+ const newValue = event.target.value === "" ? min : Number(event.target.value);
9867
+ if (!isNaN(newValue) && (max === void 0 || newValue <= max) && (min === void 0 || newValue >= min)) {
9868
+ onChange(newValue);
9869
+ }
9870
+ };
9871
+ const handleIncrement = () => {
9872
+ const newValue = value + step;
9873
+ if (max === void 0 || newValue <= max) {
9874
+ onChange(newValue);
9875
+ }
9876
+ };
9877
+ const handleDecrement = () => {
9878
+ const newValue = value - step;
9879
+ if (min === void 0 || newValue >= min) {
9880
+ onChange(newValue);
9881
+ }
9882
+ };
9883
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9884
+ "div",
9885
+ {
9886
+ className: ui.clx(
9887
+ "inline-flex rounded-md bg-ui-bg-field shadow-borders-base overflow-hidden divide-x transition-fg",
9888
+ "[&:has(input:focus)]:shadow-borders-interactive-with-active",
9631
9889
  {
9632
9890
  "h-7": size === "small",
9633
9891
  "h-8": size === "base"
@@ -11196,303 +11454,58 @@ function getPromotionIds(items, shippingMethods) {
11196
11454
  const SalesChannel = () => {
11197
11455
  const { id } = reactRouterDom.useParams();
11198
11456
  const { draft_order, isPending, isError, error } = useDraftOrder(
11199
- id,
11200
- {
11201
- fields: "+sales_channel_id"
11202
- },
11203
- {
11204
- enabled: !!id
11205
- }
11206
- );
11207
- if (isError) {
11208
- throw error;
11209
- }
11210
- const ISrEADY = !!draft_order && !isPending;
11211
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11212
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11213
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11214
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11215
- ] }),
11216
- ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11217
- ] });
11218
- };
11219
- const SalesChannelForm = ({ order }) => {
11220
- const form = reactHookForm.useForm({
11221
- defaultValues: {
11222
- sales_channel_id: order.sales_channel_id || ""
11223
- },
11224
- resolver: zod.zodResolver(schema$4)
11225
- });
11226
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11227
- const { handleSuccess } = useRouteModal();
11228
- const onSubmit = form.handleSubmit(async (data) => {
11229
- await mutateAsync(
11230
- {
11231
- sales_channel_id: data.sales_channel_id
11232
- },
11233
- {
11234
- onSuccess: () => {
11235
- ui.toast.success("Sales channel updated");
11236
- handleSuccess();
11237
- },
11238
- onError: (error) => {
11239
- ui.toast.error(error.message);
11240
- }
11241
- }
11242
- );
11243
- });
11244
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11245
- KeyboundForm,
11246
- {
11247
- className: "flex flex-1 flex-col overflow-hidden",
11248
- onSubmit,
11249
- children: [
11250
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11251
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11252
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11253
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
11254
- ] }) })
11255
- ]
11256
- }
11257
- ) });
11258
- };
11259
- const SalesChannelField = ({ control, order }) => {
11260
- const salesChannels = useComboboxData({
11261
- queryFn: async (params) => {
11262
- return await sdk.admin.salesChannel.list(params);
11263
- },
11264
- queryKey: ["sales-channels"],
11265
- getOptions: (data) => {
11266
- return data.sales_channels.map((salesChannel) => ({
11267
- label: salesChannel.name,
11268
- value: salesChannel.id
11269
- }));
11270
- },
11271
- defaultValue: order.sales_channel_id || void 0
11272
- });
11273
- return /* @__PURE__ */ jsxRuntime.jsx(
11274
- Form$2.Field,
11275
- {
11276
- control,
11277
- name: "sales_channel_id",
11278
- render: ({ field }) => {
11279
- return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11280
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11281
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11282
- Combobox,
11283
- {
11284
- options: salesChannels.options,
11285
- fetchNextPage: salesChannels.fetchNextPage,
11286
- isFetchingNextPage: salesChannels.isFetchingNextPage,
11287
- searchValue: salesChannels.searchValue,
11288
- onSearchValueChange: salesChannels.onSearchValueChange,
11289
- placeholder: "Select sales channel",
11290
- ...field
11291
- }
11292
- ) }),
11293
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11294
- ] });
11295
- }
11296
- }
11297
- );
11298
- };
11299
- const schema$4 = objectType({
11300
- sales_channel_id: stringType().min(1)
11301
- });
11302
- const ShippingAddress = () => {
11303
- const { id } = reactRouterDom.useParams();
11304
- const { order, isPending, isError, error } = useOrder(id, {
11305
- fields: "+shipping_address"
11306
- });
11307
- if (isError) {
11308
- throw error;
11309
- }
11310
- const isReady = !isPending && !!order;
11311
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11312
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11313
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
11314
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
11315
- ] }),
11316
- isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
11317
- ] });
11318
- };
11319
- const ShippingAddressForm = ({ order }) => {
11320
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
11321
- const form = reactHookForm.useForm({
11322
- defaultValues: {
11323
- first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
11324
- last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
11325
- company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
11326
- address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
11327
- address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
11328
- city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
11329
- province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
11330
- country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
11331
- postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
11332
- phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
11333
- },
11334
- resolver: zod.zodResolver(schema$3)
11335
- });
11336
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11337
- const { handleSuccess } = useRouteModal();
11338
- const onSubmit = form.handleSubmit(async (data) => {
11339
- await mutateAsync(
11340
- {
11341
- shipping_address: {
11342
- first_name: data.first_name,
11343
- last_name: data.last_name,
11344
- company: data.company,
11345
- address_1: data.address_1,
11346
- address_2: data.address_2,
11347
- city: data.city,
11348
- province: data.province,
11349
- country_code: data.country_code,
11350
- postal_code: data.postal_code,
11351
- phone: data.phone
11352
- }
11353
- },
11354
- {
11355
- onSuccess: () => {
11356
- handleSuccess();
11357
- },
11358
- onError: (error) => {
11359
- ui.toast.error(error.message);
11360
- }
11361
- }
11362
- );
11363
- });
11364
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11365
- KeyboundForm,
11366
- {
11367
- className: "flex flex-1 flex-col overflow-hidden",
11368
- onSubmit,
11369
- children: [
11370
- /* @__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: [
11371
- /* @__PURE__ */ jsxRuntime.jsx(
11372
- Form$2.Field,
11373
- {
11374
- control: form.control,
11375
- name: "country_code",
11376
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11377
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
11378
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
11379
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11380
- ] })
11381
- }
11382
- ),
11383
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11384
- /* @__PURE__ */ jsxRuntime.jsx(
11385
- Form$2.Field,
11386
- {
11387
- control: form.control,
11388
- name: "first_name",
11389
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11390
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
11391
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11392
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11393
- ] })
11394
- }
11395
- ),
11396
- /* @__PURE__ */ jsxRuntime.jsx(
11397
- Form$2.Field,
11398
- {
11399
- control: form.control,
11400
- name: "last_name",
11401
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11402
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
11403
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11404
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11405
- ] })
11406
- }
11407
- )
11408
- ] }),
11409
- /* @__PURE__ */ jsxRuntime.jsx(
11410
- Form$2.Field,
11411
- {
11412
- control: form.control,
11413
- name: "company",
11414
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11415
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
11416
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11417
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11418
- ] })
11419
- }
11420
- ),
11421
- /* @__PURE__ */ jsxRuntime.jsx(
11422
- Form$2.Field,
11423
- {
11424
- control: form.control,
11425
- name: "address_1",
11426
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11427
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
11428
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11429
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11430
- ] })
11431
- }
11432
- ),
11433
- /* @__PURE__ */ jsxRuntime.jsx(
11434
- Form$2.Field,
11435
- {
11436
- control: form.control,
11437
- name: "address_2",
11438
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11439
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
11440
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11441
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11442
- ] })
11443
- }
11444
- ),
11445
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11446
- /* @__PURE__ */ jsxRuntime.jsx(
11447
- Form$2.Field,
11448
- {
11449
- control: form.control,
11450
- name: "postal_code",
11451
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11452
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
11453
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11454
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11455
- ] })
11456
- }
11457
- ),
11458
- /* @__PURE__ */ jsxRuntime.jsx(
11459
- Form$2.Field,
11460
- {
11461
- control: form.control,
11462
- name: "city",
11463
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11464
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
11465
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11466
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11467
- ] })
11468
- }
11469
- )
11470
- ] }),
11471
- /* @__PURE__ */ jsxRuntime.jsx(
11472
- Form$2.Field,
11473
- {
11474
- control: form.control,
11475
- name: "province",
11476
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11477
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
11478
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11479
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11480
- ] })
11481
- }
11482
- ),
11483
- /* @__PURE__ */ jsxRuntime.jsx(
11484
- Form$2.Field,
11485
- {
11486
- control: form.control,
11487
- name: "phone",
11488
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11489
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
11490
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
11491
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11492
- ] })
11493
- }
11494
- )
11495
- ] }) }),
11457
+ id,
11458
+ {
11459
+ fields: "+sales_channel_id"
11460
+ },
11461
+ {
11462
+ enabled: !!id
11463
+ }
11464
+ );
11465
+ if (isError) {
11466
+ throw error;
11467
+ }
11468
+ const ISrEADY = !!draft_order && !isPending;
11469
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
11470
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
11471
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
11472
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Update which sales channel the draft order is associated with" }) })
11473
+ ] }),
11474
+ ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
11475
+ ] });
11476
+ };
11477
+ const SalesChannelForm = ({ order }) => {
11478
+ const form = reactHookForm.useForm({
11479
+ defaultValues: {
11480
+ sales_channel_id: order.sales_channel_id || ""
11481
+ },
11482
+ resolver: zod.zodResolver(schema$2)
11483
+ });
11484
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
11485
+ const { handleSuccess } = useRouteModal();
11486
+ const onSubmit = form.handleSubmit(async (data) => {
11487
+ await mutateAsync(
11488
+ {
11489
+ sales_channel_id: data.sales_channel_id
11490
+ },
11491
+ {
11492
+ onSuccess: () => {
11493
+ ui.toast.success("Sales channel updated");
11494
+ handleSuccess();
11495
+ },
11496
+ onError: (error) => {
11497
+ ui.toast.error(error.message);
11498
+ }
11499
+ }
11500
+ );
11501
+ });
11502
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
11503
+ KeyboundForm,
11504
+ {
11505
+ className: "flex flex-1 flex-col overflow-hidden",
11506
+ onSubmit,
11507
+ children: [
11508
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
11496
11509
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
11497
11510
  /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
11498
11511
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
@@ -11501,7 +11514,49 @@ const ShippingAddressForm = ({ order }) => {
11501
11514
  }
11502
11515
  ) });
11503
11516
  };
11504
- const schema$3 = addressSchema;
11517
+ const SalesChannelField = ({ control, order }) => {
11518
+ const salesChannels = useComboboxData({
11519
+ queryFn: async (params) => {
11520
+ return await sdk.admin.salesChannel.list(params);
11521
+ },
11522
+ queryKey: ["sales-channels"],
11523
+ getOptions: (data) => {
11524
+ return data.sales_channels.map((salesChannel) => ({
11525
+ label: salesChannel.name,
11526
+ value: salesChannel.id
11527
+ }));
11528
+ },
11529
+ defaultValue: order.sales_channel_id || void 0
11530
+ });
11531
+ return /* @__PURE__ */ jsxRuntime.jsx(
11532
+ Form$2.Field,
11533
+ {
11534
+ control,
11535
+ name: "sales_channel_id",
11536
+ render: ({ field }) => {
11537
+ return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
11538
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
11539
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
11540
+ Combobox,
11541
+ {
11542
+ options: salesChannels.options,
11543
+ fetchNextPage: salesChannels.fetchNextPage,
11544
+ isFetchingNextPage: salesChannels.isFetchingNextPage,
11545
+ searchValue: salesChannels.searchValue,
11546
+ onSearchValueChange: salesChannels.onSearchValueChange,
11547
+ placeholder: "Select sales channel",
11548
+ ...field
11549
+ }
11550
+ ) }),
11551
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
11552
+ ] });
11553
+ }
11554
+ }
11555
+ );
11556
+ };
11557
+ const schema$2 = objectType({
11558
+ sales_channel_id: stringType().min(1)
11559
+ });
11505
11560
  const STACKED_FOCUS_MODAL_ID = "shipping-form";
11506
11561
  const Shipping = () => {
11507
11562
  var _a;
@@ -12256,59 +12311,262 @@ const ShippingOptionField = ({
12256
12311
  /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Choose the shipping option to use." })
12257
12312
  ] }),
12258
12313
  /* @__PURE__ */ jsxRuntime.jsx(
12259
- ConditionalTooltip,
12314
+ ConditionalTooltip,
12315
+ {
12316
+ content: tooltipContent,
12317
+ showTooltip: !locationId || !shippingProfileId,
12318
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12319
+ Combobox,
12320
+ {
12321
+ options: shippingOptions.options,
12322
+ fetchNextPage: shippingOptions.fetchNextPage,
12323
+ isFetchingNextPage: shippingOptions.isFetchingNextPage,
12324
+ searchValue: shippingOptions.searchValue,
12325
+ onSearchValueChange: shippingOptions.onSearchValueChange,
12326
+ placeholder: "Select shipping option",
12327
+ ...field,
12328
+ disabled: !locationId || !shippingProfileId
12329
+ }
12330
+ ) }) })
12331
+ }
12332
+ )
12333
+ ] }) });
12334
+ }
12335
+ }
12336
+ );
12337
+ };
12338
+ const CustomAmountField = ({
12339
+ control,
12340
+ currencyCode
12341
+ }) => {
12342
+ return /* @__PURE__ */ jsxRuntime.jsx(
12343
+ Form$2.Field,
12344
+ {
12345
+ control,
12346
+ name: "custom_amount",
12347
+ render: ({ field: { onChange, ...field } }) => {
12348
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
12349
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12350
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
12351
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
12352
+ ] }),
12353
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12354
+ ui.CurrencyInput,
12355
+ {
12356
+ ...field,
12357
+ onValueChange: (value) => onChange(value),
12358
+ symbol: getNativeSymbol(currencyCode),
12359
+ code: currencyCode
12360
+ }
12361
+ ) })
12362
+ ] });
12363
+ }
12364
+ }
12365
+ );
12366
+ };
12367
+ const ShippingAddress = () => {
12368
+ const { id } = reactRouterDom.useParams();
12369
+ const { order, isPending, isError, error } = useOrder(id, {
12370
+ fields: "+shipping_address"
12371
+ });
12372
+ if (isError) {
12373
+ throw error;
12374
+ }
12375
+ const isReady = !isPending && !!order;
12376
+ return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12377
+ /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12378
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
12379
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
12380
+ ] }),
12381
+ isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
12382
+ ] });
12383
+ };
12384
+ const ShippingAddressForm = ({ order }) => {
12385
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12386
+ const form = reactHookForm.useForm({
12387
+ defaultValues: {
12388
+ first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
12389
+ last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
12390
+ company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
12391
+ address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
12392
+ address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
12393
+ city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
12394
+ province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
12395
+ country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
12396
+ postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
12397
+ phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
12398
+ },
12399
+ resolver: zod.zodResolver(schema$1)
12400
+ });
12401
+ const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12402
+ const { handleSuccess } = useRouteModal();
12403
+ const onSubmit = form.handleSubmit(async (data) => {
12404
+ await mutateAsync(
12405
+ {
12406
+ shipping_address: {
12407
+ first_name: data.first_name,
12408
+ last_name: data.last_name,
12409
+ company: data.company,
12410
+ address_1: data.address_1,
12411
+ address_2: data.address_2,
12412
+ city: data.city,
12413
+ province: data.province,
12414
+ country_code: data.country_code,
12415
+ postal_code: data.postal_code,
12416
+ phone: data.phone
12417
+ }
12418
+ },
12419
+ {
12420
+ onSuccess: () => {
12421
+ handleSuccess();
12422
+ },
12423
+ onError: (error) => {
12424
+ ui.toast.error(error.message);
12425
+ }
12426
+ }
12427
+ );
12428
+ });
12429
+ return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12430
+ KeyboundForm,
12431
+ {
12432
+ className: "flex flex-1 flex-col overflow-hidden",
12433
+ onSubmit,
12434
+ children: [
12435
+ /* @__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: [
12436
+ /* @__PURE__ */ jsxRuntime.jsx(
12437
+ Form$2.Field,
12438
+ {
12439
+ control: form.control,
12440
+ name: "country_code",
12441
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12442
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12443
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12444
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12445
+ ] })
12446
+ }
12447
+ ),
12448
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12449
+ /* @__PURE__ */ jsxRuntime.jsx(
12450
+ Form$2.Field,
12451
+ {
12452
+ control: form.control,
12453
+ name: "first_name",
12454
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12455
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12456
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12457
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12458
+ ] })
12459
+ }
12460
+ ),
12461
+ /* @__PURE__ */ jsxRuntime.jsx(
12462
+ Form$2.Field,
12463
+ {
12464
+ control: form.control,
12465
+ name: "last_name",
12466
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12467
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12468
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12469
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12470
+ ] })
12471
+ }
12472
+ )
12473
+ ] }),
12474
+ /* @__PURE__ */ jsxRuntime.jsx(
12475
+ Form$2.Field,
12260
12476
  {
12261
- content: tooltipContent,
12262
- showTooltip: !locationId || !shippingProfileId,
12263
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12264
- Combobox,
12265
- {
12266
- options: shippingOptions.options,
12267
- fetchNextPage: shippingOptions.fetchNextPage,
12268
- isFetchingNextPage: shippingOptions.isFetchingNextPage,
12269
- searchValue: shippingOptions.searchValue,
12270
- onSearchValueChange: shippingOptions.onSearchValueChange,
12271
- placeholder: "Select shipping option",
12272
- ...field,
12273
- disabled: !locationId || !shippingProfileId
12274
- }
12275
- ) }) })
12477
+ control: form.control,
12478
+ name: "company",
12479
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12480
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12481
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12482
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12483
+ ] })
12276
12484
  }
12277
- )
12278
- ] }) });
12279
- }
12280
- }
12281
- );
12282
- };
12283
- const CustomAmountField = ({
12284
- control,
12285
- currencyCode
12286
- }) => {
12287
- return /* @__PURE__ */ jsxRuntime.jsx(
12288
- Form$2.Field,
12289
- {
12290
- control,
12291
- name: "custom_amount",
12292
- render: ({ field: { onChange, ...field } }) => {
12293
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
12294
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
12295
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
12296
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
12485
+ ),
12486
+ /* @__PURE__ */ jsxRuntime.jsx(
12487
+ Form$2.Field,
12488
+ {
12489
+ control: form.control,
12490
+ name: "address_1",
12491
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12492
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12493
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12494
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12495
+ ] })
12496
+ }
12497
+ ),
12498
+ /* @__PURE__ */ jsxRuntime.jsx(
12499
+ Form$2.Field,
12500
+ {
12501
+ control: form.control,
12502
+ name: "address_2",
12503
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12504
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12505
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12506
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12507
+ ] })
12508
+ }
12509
+ ),
12510
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12511
+ /* @__PURE__ */ jsxRuntime.jsx(
12512
+ Form$2.Field,
12513
+ {
12514
+ control: form.control,
12515
+ name: "postal_code",
12516
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12517
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12518
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12519
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12520
+ ] })
12521
+ }
12522
+ ),
12523
+ /* @__PURE__ */ jsxRuntime.jsx(
12524
+ Form$2.Field,
12525
+ {
12526
+ control: form.control,
12527
+ name: "city",
12528
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12529
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
12530
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12531
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12532
+ ] })
12533
+ }
12534
+ )
12297
12535
  ] }),
12298
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
12299
- ui.CurrencyInput,
12536
+ /* @__PURE__ */ jsxRuntime.jsx(
12537
+ Form$2.Field,
12300
12538
  {
12301
- ...field,
12302
- onValueChange: (value) => onChange(value),
12303
- symbol: getNativeSymbol(currencyCode),
12304
- code: currencyCode
12539
+ control: form.control,
12540
+ name: "province",
12541
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12542
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
12543
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12544
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12545
+ ] })
12305
12546
  }
12306
- ) })
12307
- ] });
12308
- }
12547
+ ),
12548
+ /* @__PURE__ */ jsxRuntime.jsx(
12549
+ Form$2.Field,
12550
+ {
12551
+ control: form.control,
12552
+ name: "phone",
12553
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12554
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
12555
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12556
+ /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12557
+ ] })
12558
+ }
12559
+ )
12560
+ ] }) }),
12561
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12562
+ /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12563
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12564
+ ] }) })
12565
+ ]
12309
12566
  }
12310
- );
12567
+ ) });
12311
12568
  };
12569
+ const schema$1 = addressSchema;
12312
12570
  const TransferOwnership = () => {
12313
12571
  const { id } = reactRouterDom.useParams();
12314
12572
  const { draft_order, isPending, isError, error } = useDraftOrder(id, {
@@ -12332,7 +12590,7 @@ const TransferOwnershipForm = ({ order }) => {
12332
12590
  defaultValues: {
12333
12591
  customer_id: order.customer_id || ""
12334
12592
  },
12335
- resolver: zod.zodResolver(schema$2)
12593
+ resolver: zod.zodResolver(schema)
12336
12594
  });
12337
12595
  const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12338
12596
  const { handleSuccess } = useRouteModal();
@@ -12719,330 +12977,72 @@ const Illustration = () => {
12719
12977
  stroke: "#A1A1AA",
12720
12978
  strokeWidth: "1.5",
12721
12979
  strokeLinecap: "round",
12722
- strokeLinejoin: "round"
12723
- }
12724
- ) }),
12725
- /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
12726
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12727
- "rect",
12728
- {
12729
- width: "12",
12730
- height: "12",
12731
- fill: "white",
12732
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12733
- }
12734
- ) }),
12735
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12736
- "rect",
12737
- {
12738
- width: "12",
12739
- height: "12",
12740
- fill: "white",
12741
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12742
- }
12743
- ) }),
12744
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12745
- "rect",
12746
- {
12747
- width: "12",
12748
- height: "12",
12749
- fill: "white",
12750
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12751
- }
12752
- ) }),
12753
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12754
- "rect",
12755
- {
12756
- width: "12",
12757
- height: "12",
12758
- fill: "white",
12759
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12760
- }
12761
- ) }),
12762
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12763
- "rect",
12764
- {
12765
- width: "12",
12766
- height: "12",
12767
- fill: "white",
12768
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
12769
- }
12770
- ) }),
12771
- /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12772
- "rect",
12773
- {
12774
- width: "12",
12775
- height: "12",
12776
- fill: "white",
12777
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
12778
- }
12779
- ) })
12780
- ] })
12781
- ]
12782
- }
12783
- );
12784
- };
12785
- const schema$2 = objectType({
12786
- customer_id: stringType().min(1)
12787
- });
12788
- const Email = () => {
12789
- const { id } = reactRouterDom.useParams();
12790
- const { order, isPending, isError, error } = useOrder(id, {
12791
- fields: "+email"
12792
- });
12793
- if (isError) {
12794
- throw error;
12795
- }
12796
- const isReady = !isPending && !!order;
12797
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12798
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12799
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
12800
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
12801
- ] }),
12802
- isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
12803
- ] });
12804
- };
12805
- const EmailForm = ({ order }) => {
12806
- const form = reactHookForm.useForm({
12807
- defaultValues: {
12808
- email: order.email ?? ""
12809
- },
12810
- resolver: zod.zodResolver(schema$1)
12811
- });
12812
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12813
- const { handleSuccess } = useRouteModal();
12814
- const onSubmit = form.handleSubmit(async (data) => {
12815
- await mutateAsync(
12816
- { email: data.email },
12817
- {
12818
- onSuccess: () => {
12819
- handleSuccess();
12820
- },
12821
- onError: (error) => {
12822
- ui.toast.error(error.message);
12823
- }
12824
- }
12825
- );
12826
- });
12827
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12828
- KeyboundForm,
12829
- {
12830
- className: "flex flex-1 flex-col overflow-hidden",
12831
- onSubmit,
12832
- children: [
12833
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
12834
- Form$2.Field,
12835
- {
12836
- control: form.control,
12837
- name: "email",
12838
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12839
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
12840
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12841
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12842
- ] })
12980
+ strokeLinejoin: "round"
12843
12981
  }
12844
12982
  ) }),
12845
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
12846
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
12847
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
12848
- ] }) })
12849
- ]
12850
- }
12851
- ) });
12852
- };
12853
- const schema$1 = objectType({
12854
- email: stringType().email()
12855
- });
12856
- const BillingAddress = () => {
12857
- const { id } = reactRouterDom.useParams();
12858
- const { order, isPending, isError, error } = useOrder(id, {
12859
- fields: "+billing_address"
12860
- });
12861
- if (isError) {
12862
- throw error;
12863
- }
12864
- const isReady = !isPending && !!order;
12865
- return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
12866
- /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
12867
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
12868
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
12869
- ] }),
12870
- isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
12871
- ] });
12872
- };
12873
- const BillingAddressForm = ({ order }) => {
12874
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12875
- const form = reactHookForm.useForm({
12876
- defaultValues: {
12877
- first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
12878
- last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
12879
- company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
12880
- address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
12881
- address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
12882
- city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
12883
- province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
12884
- country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
12885
- postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
12886
- phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
12887
- },
12888
- resolver: zod.zodResolver(schema)
12889
- });
12890
- const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
12891
- const { handleSuccess } = useRouteModal();
12892
- const onSubmit = form.handleSubmit(async (data) => {
12893
- await mutateAsync(
12894
- { billing_address: data },
12895
- {
12896
- onSuccess: () => {
12897
- handleSuccess();
12898
- },
12899
- onError: (error) => {
12900
- ui.toast.error(error.message);
12901
- }
12902
- }
12903
- );
12904
- });
12905
- return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
12906
- KeyboundForm,
12907
- {
12908
- className: "flex flex-1 flex-col overflow-hidden",
12909
- onSubmit,
12910
- children: [
12911
- /* @__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: [
12912
- /* @__PURE__ */ jsxRuntime.jsx(
12913
- Form$2.Field,
12983
+ /* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
12984
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12985
+ "rect",
12914
12986
  {
12915
- control: form.control,
12916
- name: "country_code",
12917
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12918
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
12919
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
12920
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12921
- ] })
12987
+ width: "12",
12988
+ height: "12",
12989
+ fill: "white",
12990
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
12922
12991
  }
12923
- ),
12924
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12925
- /* @__PURE__ */ jsxRuntime.jsx(
12926
- Form$2.Field,
12927
- {
12928
- control: form.control,
12929
- name: "first_name",
12930
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12931
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
12932
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12933
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12934
- ] })
12935
- }
12936
- ),
12937
- /* @__PURE__ */ jsxRuntime.jsx(
12938
- Form$2.Field,
12939
- {
12940
- control: form.control,
12941
- name: "last_name",
12942
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12943
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
12944
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12945
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12946
- ] })
12947
- }
12948
- )
12949
- ] }),
12950
- /* @__PURE__ */ jsxRuntime.jsx(
12951
- Form$2.Field,
12992
+ ) }),
12993
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip1_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
12994
+ "rect",
12952
12995
  {
12953
- control: form.control,
12954
- name: "company",
12955
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12956
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
12957
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12958
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12959
- ] })
12996
+ width: "12",
12997
+ height: "12",
12998
+ fill: "white",
12999
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 148.75 80.6541)"
12960
13000
  }
12961
- ),
12962
- /* @__PURE__ */ jsxRuntime.jsx(
12963
- Form$2.Field,
13001
+ ) }),
13002
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip2_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13003
+ "rect",
12964
13004
  {
12965
- control: form.control,
12966
- name: "address_1",
12967
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12968
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
12969
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12970
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12971
- ] })
13005
+ width: "12",
13006
+ height: "12",
13007
+ fill: "white",
13008
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 159.141 86.6575)"
12972
13009
  }
12973
- ),
12974
- /* @__PURE__ */ jsxRuntime.jsx(
12975
- Form$2.Field,
13010
+ ) }),
13011
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip3_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13012
+ "rect",
12976
13013
  {
12977
- control: form.control,
12978
- name: "address_2",
12979
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12980
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
12981
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12982
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12983
- ] })
13014
+ width: "12",
13015
+ height: "12",
13016
+ fill: "white",
13017
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 120.928 84.4561)"
12984
13018
  }
12985
- ),
12986
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12987
- /* @__PURE__ */ jsxRuntime.jsx(
12988
- Form$2.Field,
12989
- {
12990
- control: form.control,
12991
- name: "postal_code",
12992
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
12993
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
12994
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
12995
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
12996
- ] })
12997
- }
12998
- ),
12999
- /* @__PURE__ */ jsxRuntime.jsx(
13000
- Form$2.Field,
13001
- {
13002
- control: form.control,
13003
- name: "city",
13004
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13005
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
13006
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13007
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13008
- ] })
13009
- }
13010
- )
13011
- ] }),
13012
- /* @__PURE__ */ jsxRuntime.jsx(
13013
- Form$2.Field,
13019
+ ) }),
13020
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip4_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13021
+ "rect",
13014
13022
  {
13015
- control: form.control,
13016
- name: "province",
13017
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13018
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
13019
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13020
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13021
- ] })
13023
+ width: "12",
13024
+ height: "12",
13025
+ fill: "white",
13026
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 131.318 90.4594)"
13022
13027
  }
13023
- ),
13024
- /* @__PURE__ */ jsxRuntime.jsx(
13025
- Form$2.Field,
13028
+ ) }),
13029
+ /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip5_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
13030
+ "rect",
13026
13031
  {
13027
- control: form.control,
13028
- name: "phone",
13029
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
13030
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
13031
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
13032
- /* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
13033
- ] })
13032
+ width: "12",
13033
+ height: "12",
13034
+ fill: "white",
13035
+ transform: "matrix(0.865865 0.500278 -0.871576 0.490261 141.709 96.4627)"
13034
13036
  }
13035
- )
13036
- ] }) }),
13037
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
13038
- /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
13039
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
13040
- ] }) })
13037
+ ) })
13038
+ ] })
13041
13039
  ]
13042
13040
  }
13043
- ) });
13041
+ );
13044
13042
  };
13045
- const schema = addressSchema;
13043
+ const schema = objectType({
13044
+ customer_id: stringType().min(1)
13045
+ });
13046
13046
  const widgetModule = { widgets: [] };
13047
13047
  const routeModule = {
13048
13048
  routes: [
@@ -13063,10 +13063,18 @@ const routeModule = {
13063
13063
  handle,
13064
13064
  loader,
13065
13065
  children: [
13066
+ {
13067
+ Component: BillingAddress,
13068
+ path: "/draft-orders/:id/billing-address"
13069
+ },
13066
13070
  {
13067
13071
  Component: CustomItems,
13068
13072
  path: "/draft-orders/:id/custom-items"
13069
13073
  },
13074
+ {
13075
+ Component: Email,
13076
+ path: "/draft-orders/:id/email"
13077
+ },
13070
13078
  {
13071
13079
  Component: Items,
13072
13080
  path: "/draft-orders/:id/items"
@@ -13083,25 +13091,17 @@ const routeModule = {
13083
13091
  Component: SalesChannel,
13084
13092
  path: "/draft-orders/:id/sales-channel"
13085
13093
  },
13086
- {
13087
- Component: ShippingAddress,
13088
- path: "/draft-orders/:id/shipping-address"
13089
- },
13090
13094
  {
13091
13095
  Component: Shipping,
13092
13096
  path: "/draft-orders/:id/shipping"
13093
13097
  },
13094
13098
  {
13095
- Component: TransferOwnership,
13096
- path: "/draft-orders/:id/transfer-ownership"
13097
- },
13098
- {
13099
- Component: Email,
13100
- path: "/draft-orders/:id/email"
13099
+ Component: ShippingAddress,
13100
+ path: "/draft-orders/:id/shipping-address"
13101
13101
  },
13102
13102
  {
13103
- Component: BillingAddress,
13104
- path: "/draft-orders/:id/billing-address"
13103
+ Component: TransferOwnership,
13104
+ path: "/draft-orders/:id/transfer-ownership"
13105
13105
  }
13106
13106
  ]
13107
13107
  }
@@ -13121,11 +13121,13 @@ const formModule = { customFields: {} };
13121
13121
  const displayModule = {
13122
13122
  displays: {}
13123
13123
  };
13124
+ const i18nModule = { resources: {} };
13124
13125
  const plugin = {
13125
13126
  widgetModule,
13126
13127
  routeModule,
13127
13128
  menuItemModule,
13128
13129
  formModule,
13129
- displayModule
13130
+ displayModule,
13131
+ i18nModule
13130
13132
  };
13131
13133
  module.exports = plugin;