@medusajs/draft-order 2.11.2-snapshot-20251031090242 → 2.11.3-preview-20251031120214
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.
- package/.medusa/server/src/admin/index.js +951 -952
- package/.medusa/server/src/admin/index.mjs +950 -950
- package/package.json +23 -54
|
@@ -14,15 +14,14 @@ const reactHookForm = require("react-hook-form");
|
|
|
14
14
|
const radixUi = require("radix-ui");
|
|
15
15
|
const react = require("@ariakit/react");
|
|
16
16
|
const matchSorter = require("match-sorter");
|
|
17
|
-
const debounce = require("lodash
|
|
17
|
+
const debounce = require("lodash/debounce");
|
|
18
18
|
const Primitive = require("@uiw/react-json-view");
|
|
19
|
-
const
|
|
19
|
+
const lodash = require("lodash");
|
|
20
20
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
21
21
|
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
22
22
|
const Medusa__default = /* @__PURE__ */ _interopDefault(Medusa);
|
|
23
23
|
const debounce__default = /* @__PURE__ */ _interopDefault(debounce);
|
|
24
24
|
const Primitive__default = /* @__PURE__ */ _interopDefault(Primitive);
|
|
25
|
-
const isEqual__default = /* @__PURE__ */ _interopDefault(isEqual);
|
|
26
25
|
function useQueryParams(keys, prefix) {
|
|
27
26
|
const [params] = reactRouterDom.useSearchParams();
|
|
28
27
|
const result = {};
|
|
@@ -9593,196 +9592,6 @@ const CustomItemsForm = () => {
|
|
|
9593
9592
|
const schema$5 = objectType({
|
|
9594
9593
|
email: stringType().email()
|
|
9595
9594
|
});
|
|
9596
|
-
const BillingAddress = () => {
|
|
9597
|
-
const { id } = reactRouterDom.useParams();
|
|
9598
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9599
|
-
fields: "+billing_address"
|
|
9600
|
-
});
|
|
9601
|
-
if (isError) {
|
|
9602
|
-
throw error;
|
|
9603
|
-
}
|
|
9604
|
-
const isReady = !isPending && !!order;
|
|
9605
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9606
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9607
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Billing Address" }) }),
|
|
9608
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the billing address for the draft order" }) })
|
|
9609
|
-
] }),
|
|
9610
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(BillingAddressForm, { order })
|
|
9611
|
-
] });
|
|
9612
|
-
};
|
|
9613
|
-
const BillingAddressForm = ({ order }) => {
|
|
9614
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9615
|
-
const form = reactHookForm.useForm({
|
|
9616
|
-
defaultValues: {
|
|
9617
|
-
first_name: ((_a = order.billing_address) == null ? void 0 : _a.first_name) ?? "",
|
|
9618
|
-
last_name: ((_b = order.billing_address) == null ? void 0 : _b.last_name) ?? "",
|
|
9619
|
-
company: ((_c = order.billing_address) == null ? void 0 : _c.company) ?? "",
|
|
9620
|
-
address_1: ((_d = order.billing_address) == null ? void 0 : _d.address_1) ?? "",
|
|
9621
|
-
address_2: ((_e = order.billing_address) == null ? void 0 : _e.address_2) ?? "",
|
|
9622
|
-
city: ((_f = order.billing_address) == null ? void 0 : _f.city) ?? "",
|
|
9623
|
-
province: ((_g = order.billing_address) == null ? void 0 : _g.province) ?? "",
|
|
9624
|
-
country_code: ((_h = order.billing_address) == null ? void 0 : _h.country_code) ?? "",
|
|
9625
|
-
postal_code: ((_i = order.billing_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
9626
|
-
phone: ((_j = order.billing_address) == null ? void 0 : _j.phone) ?? ""
|
|
9627
|
-
},
|
|
9628
|
-
resolver: zod.zodResolver(schema$4)
|
|
9629
|
-
});
|
|
9630
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9631
|
-
const { handleSuccess } = useRouteModal();
|
|
9632
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9633
|
-
await mutateAsync(
|
|
9634
|
-
{ billing_address: data },
|
|
9635
|
-
{
|
|
9636
|
-
onSuccess: () => {
|
|
9637
|
-
handleSuccess();
|
|
9638
|
-
},
|
|
9639
|
-
onError: (error) => {
|
|
9640
|
-
ui.toast.error(error.message);
|
|
9641
|
-
}
|
|
9642
|
-
}
|
|
9643
|
-
);
|
|
9644
|
-
});
|
|
9645
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9646
|
-
KeyboundForm,
|
|
9647
|
-
{
|
|
9648
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9649
|
-
onSubmit,
|
|
9650
|
-
children: [
|
|
9651
|
-
/* @__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: [
|
|
9652
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9653
|
-
Form$2.Field,
|
|
9654
|
-
{
|
|
9655
|
-
control: form.control,
|
|
9656
|
-
name: "country_code",
|
|
9657
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9658
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
9659
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
9660
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9661
|
-
] })
|
|
9662
|
-
}
|
|
9663
|
-
),
|
|
9664
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9665
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9666
|
-
Form$2.Field,
|
|
9667
|
-
{
|
|
9668
|
-
control: form.control,
|
|
9669
|
-
name: "first_name",
|
|
9670
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9671
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
9672
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9673
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9674
|
-
] })
|
|
9675
|
-
}
|
|
9676
|
-
),
|
|
9677
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9678
|
-
Form$2.Field,
|
|
9679
|
-
{
|
|
9680
|
-
control: form.control,
|
|
9681
|
-
name: "last_name",
|
|
9682
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9683
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
9684
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9685
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9686
|
-
] })
|
|
9687
|
-
}
|
|
9688
|
-
)
|
|
9689
|
-
] }),
|
|
9690
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9691
|
-
Form$2.Field,
|
|
9692
|
-
{
|
|
9693
|
-
control: form.control,
|
|
9694
|
-
name: "company",
|
|
9695
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9696
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
9697
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9698
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9699
|
-
] })
|
|
9700
|
-
}
|
|
9701
|
-
),
|
|
9702
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9703
|
-
Form$2.Field,
|
|
9704
|
-
{
|
|
9705
|
-
control: form.control,
|
|
9706
|
-
name: "address_1",
|
|
9707
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9708
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
9709
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9710
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9711
|
-
] })
|
|
9712
|
-
}
|
|
9713
|
-
),
|
|
9714
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9715
|
-
Form$2.Field,
|
|
9716
|
-
{
|
|
9717
|
-
control: form.control,
|
|
9718
|
-
name: "address_2",
|
|
9719
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9720
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
9721
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9722
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9723
|
-
] })
|
|
9724
|
-
}
|
|
9725
|
-
),
|
|
9726
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
9727
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9728
|
-
Form$2.Field,
|
|
9729
|
-
{
|
|
9730
|
-
control: form.control,
|
|
9731
|
-
name: "postal_code",
|
|
9732
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9733
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
9734
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9735
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9736
|
-
] })
|
|
9737
|
-
}
|
|
9738
|
-
),
|
|
9739
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9740
|
-
Form$2.Field,
|
|
9741
|
-
{
|
|
9742
|
-
control: form.control,
|
|
9743
|
-
name: "city",
|
|
9744
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9745
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
9746
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9747
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9748
|
-
] })
|
|
9749
|
-
}
|
|
9750
|
-
)
|
|
9751
|
-
] }),
|
|
9752
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9753
|
-
Form$2.Field,
|
|
9754
|
-
{
|
|
9755
|
-
control: form.control,
|
|
9756
|
-
name: "province",
|
|
9757
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9758
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
9759
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9760
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9761
|
-
] })
|
|
9762
|
-
}
|
|
9763
|
-
),
|
|
9764
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9765
|
-
Form$2.Field,
|
|
9766
|
-
{
|
|
9767
|
-
control: form.control,
|
|
9768
|
-
name: "phone",
|
|
9769
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9770
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
9771
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9772
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9773
|
-
] })
|
|
9774
|
-
}
|
|
9775
|
-
)
|
|
9776
|
-
] }) }),
|
|
9777
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9778
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9779
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9780
|
-
] }) })
|
|
9781
|
-
]
|
|
9782
|
-
}
|
|
9783
|
-
) });
|
|
9784
|
-
};
|
|
9785
|
-
const schema$4 = addressSchema;
|
|
9786
9595
|
const NumberInput = React.forwardRef(
|
|
9787
9596
|
({
|
|
9788
9597
|
value,
|
|
@@ -10757,74 +10566,283 @@ const customItemSchema = objectType({
|
|
|
10757
10566
|
quantity: numberType(),
|
|
10758
10567
|
unit_price: unionType([numberType(), stringType()])
|
|
10759
10568
|
});
|
|
10760
|
-
const
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10569
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
10570
|
+
const promotionsQueryKeys = {
|
|
10571
|
+
list: (query2) => [
|
|
10572
|
+
PROMOTION_QUERY_KEY,
|
|
10573
|
+
query2 ? query2 : void 0
|
|
10574
|
+
],
|
|
10575
|
+
detail: (id, query2) => [
|
|
10576
|
+
PROMOTION_QUERY_KEY,
|
|
10577
|
+
id,
|
|
10578
|
+
query2 ? query2 : void 0
|
|
10579
|
+
]
|
|
10580
|
+
};
|
|
10581
|
+
const usePromotions = (query2, options) => {
|
|
10582
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
10583
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
10584
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
10585
|
+
...options
|
|
10764
10586
|
});
|
|
10765
|
-
|
|
10766
|
-
|
|
10587
|
+
return { ...data, ...rest };
|
|
10588
|
+
};
|
|
10589
|
+
const Promotions = () => {
|
|
10590
|
+
const { id } = reactRouterDom.useParams();
|
|
10591
|
+
const {
|
|
10592
|
+
order: preview,
|
|
10593
|
+
isError: isPreviewError,
|
|
10594
|
+
error: previewError
|
|
10595
|
+
} = useOrderPreview(id, void 0);
|
|
10596
|
+
useInitiateOrderEdit({ preview });
|
|
10597
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10598
|
+
if (isPreviewError) {
|
|
10599
|
+
throw previewError;
|
|
10767
10600
|
}
|
|
10768
|
-
const isReady =
|
|
10769
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10770
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10771
|
-
|
|
10772
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
10773
|
-
] }),
|
|
10774
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
10601
|
+
const isReady = !!preview;
|
|
10602
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
10603
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
|
|
10604
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
|
|
10775
10605
|
] });
|
|
10776
10606
|
};
|
|
10777
|
-
const
|
|
10778
|
-
const
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
},
|
|
10782
|
-
resolver: zod.zodResolver(schema$3)
|
|
10783
|
-
});
|
|
10784
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
10607
|
+
const PromotionForm = ({ preview }) => {
|
|
10608
|
+
const { items, shipping_methods } = preview;
|
|
10609
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
10610
|
+
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
10785
10611
|
const { handleSuccess } = useRouteModal();
|
|
10786
|
-
const
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10612
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
10613
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
10614
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
10615
|
+
{
|
|
10616
|
+
id: promoIds
|
|
10617
|
+
},
|
|
10618
|
+
{
|
|
10619
|
+
enabled: !!promoIds.length
|
|
10620
|
+
}
|
|
10621
|
+
);
|
|
10622
|
+
const comboboxData = useComboboxData({
|
|
10623
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
10624
|
+
queryFn: async (params) => {
|
|
10625
|
+
return await sdk.admin.promotion.list({
|
|
10626
|
+
...params,
|
|
10627
|
+
id: {
|
|
10628
|
+
$nin: promoIds
|
|
10629
|
+
}
|
|
10630
|
+
});
|
|
10631
|
+
},
|
|
10632
|
+
getOptions: (data) => {
|
|
10633
|
+
return data.promotions.map((promotion) => ({
|
|
10634
|
+
label: promotion.code,
|
|
10635
|
+
value: promotion.code
|
|
10636
|
+
}));
|
|
10637
|
+
}
|
|
10638
|
+
});
|
|
10639
|
+
const add = async (value) => {
|
|
10640
|
+
if (!value) {
|
|
10641
|
+
return;
|
|
10642
|
+
}
|
|
10643
|
+
addPromotions(
|
|
10644
|
+
{
|
|
10645
|
+
promo_codes: [value]
|
|
10646
|
+
},
|
|
10647
|
+
{
|
|
10648
|
+
onError: (e) => {
|
|
10649
|
+
ui.toast.error(e.message);
|
|
10650
|
+
comboboxData.onSearchValueChange("");
|
|
10651
|
+
setComboboxValue("");
|
|
10652
|
+
},
|
|
10653
|
+
onSuccess: () => {
|
|
10654
|
+
comboboxData.onSearchValueChange("");
|
|
10655
|
+
setComboboxValue("");
|
|
10795
10656
|
}
|
|
10796
10657
|
}
|
|
10797
10658
|
);
|
|
10798
|
-
}
|
|
10799
|
-
|
|
10800
|
-
|
|
10659
|
+
};
|
|
10660
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
10661
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
10662
|
+
const onSubmit = async () => {
|
|
10663
|
+
setIsSubmitting(true);
|
|
10664
|
+
let requestSucceeded = false;
|
|
10665
|
+
await requestOrderEdit(void 0, {
|
|
10666
|
+
onError: (e) => {
|
|
10667
|
+
ui.toast.error(e.message);
|
|
10668
|
+
},
|
|
10669
|
+
onSuccess: () => {
|
|
10670
|
+
requestSucceeded = true;
|
|
10671
|
+
}
|
|
10672
|
+
});
|
|
10673
|
+
if (!requestSucceeded) {
|
|
10674
|
+
setIsSubmitting(false);
|
|
10675
|
+
return;
|
|
10676
|
+
}
|
|
10677
|
+
await confirmOrderEdit(void 0, {
|
|
10678
|
+
onError: (e) => {
|
|
10679
|
+
ui.toast.error(e.message);
|
|
10680
|
+
},
|
|
10681
|
+
onSuccess: () => {
|
|
10682
|
+
handleSuccess();
|
|
10683
|
+
},
|
|
10684
|
+
onSettled: () => {
|
|
10685
|
+
setIsSubmitting(false);
|
|
10686
|
+
}
|
|
10687
|
+
});
|
|
10688
|
+
};
|
|
10689
|
+
if (isError) {
|
|
10690
|
+
throw error;
|
|
10691
|
+
}
|
|
10692
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
10693
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
10694
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
10695
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
10696
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
10697
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
10698
|
+
] }),
|
|
10699
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10700
|
+
Combobox,
|
|
10701
|
+
{
|
|
10702
|
+
id: "promotion-combobox",
|
|
10703
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
10704
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
10705
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
10706
|
+
options: comboboxData.options,
|
|
10707
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
10708
|
+
searchValue: comboboxData.searchValue,
|
|
10709
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
10710
|
+
onChange: add,
|
|
10711
|
+
value: comboboxValue
|
|
10712
|
+
}
|
|
10713
|
+
)
|
|
10714
|
+
] }),
|
|
10715
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
10716
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10717
|
+
PromotionItem,
|
|
10718
|
+
{
|
|
10719
|
+
promotion,
|
|
10720
|
+
orderId: preview.id,
|
|
10721
|
+
isLoading: isPending
|
|
10722
|
+
},
|
|
10723
|
+
promotion.id
|
|
10724
|
+
)) })
|
|
10725
|
+
] }) }),
|
|
10726
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10727
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10728
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10729
|
+
ui.Button,
|
|
10730
|
+
{
|
|
10731
|
+
size: "small",
|
|
10732
|
+
type: "submit",
|
|
10733
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
10734
|
+
children: "Save"
|
|
10735
|
+
}
|
|
10736
|
+
)
|
|
10737
|
+
] }) })
|
|
10738
|
+
] });
|
|
10739
|
+
};
|
|
10740
|
+
const PromotionItem = ({
|
|
10741
|
+
promotion,
|
|
10742
|
+
orderId,
|
|
10743
|
+
isLoading
|
|
10744
|
+
}) => {
|
|
10745
|
+
var _a;
|
|
10746
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
10747
|
+
const onRemove = async () => {
|
|
10748
|
+
removePromotions(
|
|
10749
|
+
{
|
|
10750
|
+
promo_codes: [promotion.code]
|
|
10751
|
+
},
|
|
10752
|
+
{
|
|
10753
|
+
onError: (e) => {
|
|
10754
|
+
ui.toast.error(e.message);
|
|
10755
|
+
}
|
|
10756
|
+
}
|
|
10757
|
+
);
|
|
10758
|
+
};
|
|
10759
|
+
const displayValue = getDisplayValue(promotion);
|
|
10760
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10761
|
+
"div",
|
|
10801
10762
|
{
|
|
10802
|
-
className:
|
|
10803
|
-
|
|
10763
|
+
className: ui.clx(
|
|
10764
|
+
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
10765
|
+
{
|
|
10766
|
+
"animate-pulse": isLoading
|
|
10767
|
+
}
|
|
10768
|
+
),
|
|
10804
10769
|
children: [
|
|
10805
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10806
|
-
|
|
10770
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
10771
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
10772
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
10773
|
+
displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
10774
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
|
|
10775
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
|
|
10776
|
+
] }),
|
|
10777
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
10778
|
+
] })
|
|
10779
|
+
] }),
|
|
10780
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10781
|
+
ui.IconButton,
|
|
10807
10782
|
{
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
] })
|
|
10783
|
+
size: "small",
|
|
10784
|
+
type: "button",
|
|
10785
|
+
variant: "transparent",
|
|
10786
|
+
onClick: onRemove,
|
|
10787
|
+
isLoading: isPending || isLoading,
|
|
10788
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMark, {})
|
|
10815
10789
|
}
|
|
10816
|
-
)
|
|
10817
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10818
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10819
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
10820
|
-
] }) })
|
|
10790
|
+
)
|
|
10821
10791
|
]
|
|
10822
|
-
}
|
|
10823
|
-
|
|
10792
|
+
},
|
|
10793
|
+
promotion.id
|
|
10794
|
+
);
|
|
10824
10795
|
};
|
|
10825
|
-
|
|
10826
|
-
|
|
10796
|
+
function getDisplayValue(promotion) {
|
|
10797
|
+
var _a, _b, _c, _d;
|
|
10798
|
+
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
10799
|
+
if (!value) {
|
|
10800
|
+
return null;
|
|
10801
|
+
}
|
|
10802
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
10803
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
10804
|
+
if (!currency) {
|
|
10805
|
+
return null;
|
|
10806
|
+
}
|
|
10807
|
+
return getLocaleAmount(value, currency);
|
|
10808
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
10809
|
+
return formatPercentage(value);
|
|
10810
|
+
}
|
|
10811
|
+
return null;
|
|
10812
|
+
}
|
|
10813
|
+
const formatter = new Intl.NumberFormat([], {
|
|
10814
|
+
style: "percent",
|
|
10815
|
+
minimumFractionDigits: 2
|
|
10827
10816
|
});
|
|
10817
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
10818
|
+
let val = value || 0;
|
|
10819
|
+
if (!isPercentageValue) {
|
|
10820
|
+
val = val / 100;
|
|
10821
|
+
}
|
|
10822
|
+
return formatter.format(val);
|
|
10823
|
+
};
|
|
10824
|
+
function getPromotionIds(items, shippingMethods) {
|
|
10825
|
+
const promotionIds = /* @__PURE__ */ new Set();
|
|
10826
|
+
for (const item of items) {
|
|
10827
|
+
if (item.adjustments) {
|
|
10828
|
+
for (const adjustment of item.adjustments) {
|
|
10829
|
+
if (adjustment.promotion_id) {
|
|
10830
|
+
promotionIds.add(adjustment.promotion_id);
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
}
|
|
10834
|
+
}
|
|
10835
|
+
for (const shippingMethod of shippingMethods) {
|
|
10836
|
+
if (shippingMethod.adjustments) {
|
|
10837
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
10838
|
+
if (adjustment.promotion_id) {
|
|
10839
|
+
promotionIds.add(adjustment.promotion_id);
|
|
10840
|
+
}
|
|
10841
|
+
}
|
|
10842
|
+
}
|
|
10843
|
+
}
|
|
10844
|
+
return Array.from(promotionIds);
|
|
10845
|
+
}
|
|
10828
10846
|
const InlineTip = React.forwardRef(
|
|
10829
10847
|
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10830
10848
|
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
@@ -11175,583 +11193,61 @@ function getHasUneditableRows(metadata) {
|
|
|
11175
11193
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11176
11194
|
);
|
|
11177
11195
|
}
|
|
11178
|
-
const
|
|
11179
|
-
const
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
}
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
}
|
|
11210
|
-
const
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
queryFn: async (params) => {
|
|
11234
|
-
return await sdk.admin.promotion.list({
|
|
11235
|
-
...params,
|
|
11236
|
-
id: {
|
|
11237
|
-
$nin: promoIds
|
|
11238
|
-
}
|
|
11239
|
-
});
|
|
11240
|
-
},
|
|
11241
|
-
getOptions: (data) => {
|
|
11242
|
-
return data.promotions.map((promotion) => ({
|
|
11243
|
-
label: promotion.code,
|
|
11244
|
-
value: promotion.code
|
|
11245
|
-
}));
|
|
11246
|
-
}
|
|
11247
|
-
});
|
|
11248
|
-
const add = async (value) => {
|
|
11249
|
-
if (!value) {
|
|
11250
|
-
return;
|
|
11251
|
-
}
|
|
11252
|
-
addPromotions(
|
|
11253
|
-
{
|
|
11254
|
-
promo_codes: [value]
|
|
11255
|
-
},
|
|
11256
|
-
{
|
|
11257
|
-
onError: (e) => {
|
|
11258
|
-
ui.toast.error(e.message);
|
|
11259
|
-
comboboxData.onSearchValueChange("");
|
|
11260
|
-
setComboboxValue("");
|
|
11261
|
-
},
|
|
11262
|
-
onSuccess: () => {
|
|
11263
|
-
comboboxData.onSearchValueChange("");
|
|
11264
|
-
setComboboxValue("");
|
|
11265
|
-
}
|
|
11266
|
-
}
|
|
11267
|
-
);
|
|
11268
|
-
};
|
|
11269
|
-
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
11270
|
-
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
11271
|
-
const onSubmit = async () => {
|
|
11272
|
-
setIsSubmitting(true);
|
|
11273
|
-
let requestSucceeded = false;
|
|
11274
|
-
await requestOrderEdit(void 0, {
|
|
11275
|
-
onError: (e) => {
|
|
11276
|
-
ui.toast.error(e.message);
|
|
11277
|
-
},
|
|
11278
|
-
onSuccess: () => {
|
|
11279
|
-
requestSucceeded = true;
|
|
11280
|
-
}
|
|
11281
|
-
});
|
|
11282
|
-
if (!requestSucceeded) {
|
|
11283
|
-
setIsSubmitting(false);
|
|
11284
|
-
return;
|
|
11285
|
-
}
|
|
11286
|
-
await confirmOrderEdit(void 0, {
|
|
11287
|
-
onError: (e) => {
|
|
11288
|
-
ui.toast.error(e.message);
|
|
11289
|
-
},
|
|
11290
|
-
onSuccess: () => {
|
|
11291
|
-
handleSuccess();
|
|
11292
|
-
},
|
|
11293
|
-
onSettled: () => {
|
|
11294
|
-
setIsSubmitting(false);
|
|
11295
|
-
}
|
|
11296
|
-
});
|
|
11297
|
-
};
|
|
11298
|
-
if (isError) {
|
|
11299
|
-
throw error;
|
|
11300
|
-
}
|
|
11301
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
11302
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
11303
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
11304
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
11305
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
11306
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
11307
|
-
] }),
|
|
11308
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11309
|
-
Combobox,
|
|
11310
|
-
{
|
|
11311
|
-
id: "promotion-combobox",
|
|
11312
|
-
"aria-describedby": "promotion-combobox-hint",
|
|
11313
|
-
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
11314
|
-
fetchNextPage: comboboxData.fetchNextPage,
|
|
11315
|
-
options: comboboxData.options,
|
|
11316
|
-
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
11317
|
-
searchValue: comboboxData.searchValue,
|
|
11318
|
-
disabled: comboboxData.disabled || isAddingPromotions,
|
|
11319
|
-
onChange: add,
|
|
11320
|
-
value: comboboxValue
|
|
11321
|
-
}
|
|
11322
|
-
)
|
|
11323
|
-
] }),
|
|
11324
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
11325
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11326
|
-
PromotionItem,
|
|
11327
|
-
{
|
|
11328
|
-
promotion,
|
|
11329
|
-
orderId: preview.id,
|
|
11330
|
-
isLoading: isPending
|
|
11331
|
-
},
|
|
11332
|
-
promotion.id
|
|
11333
|
-
)) })
|
|
11334
|
-
] }) }),
|
|
11335
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11336
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11337
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11338
|
-
ui.Button,
|
|
11339
|
-
{
|
|
11340
|
-
size: "small",
|
|
11341
|
-
type: "submit",
|
|
11342
|
-
isLoading: isSubmitting || isAddingPromotions,
|
|
11343
|
-
children: "Save"
|
|
11344
|
-
}
|
|
11345
|
-
)
|
|
11346
|
-
] }) })
|
|
11347
|
-
] });
|
|
11348
|
-
};
|
|
11349
|
-
const PromotionItem = ({
|
|
11350
|
-
promotion,
|
|
11351
|
-
orderId,
|
|
11352
|
-
isLoading
|
|
11353
|
-
}) => {
|
|
11354
|
-
var _a;
|
|
11355
|
-
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
11356
|
-
const onRemove = async () => {
|
|
11357
|
-
removePromotions(
|
|
11358
|
-
{
|
|
11359
|
-
promo_codes: [promotion.code]
|
|
11360
|
-
},
|
|
11361
|
-
{
|
|
11362
|
-
onError: (e) => {
|
|
11363
|
-
ui.toast.error(e.message);
|
|
11364
|
-
}
|
|
11365
|
-
}
|
|
11366
|
-
);
|
|
11367
|
-
};
|
|
11368
|
-
const displayValue = getDisplayValue(promotion);
|
|
11369
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11370
|
-
"div",
|
|
11371
|
-
{
|
|
11372
|
-
className: ui.clx(
|
|
11373
|
-
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
11374
|
-
{
|
|
11375
|
-
"animate-pulse": isLoading
|
|
11376
|
-
}
|
|
11377
|
-
),
|
|
11378
|
-
children: [
|
|
11379
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11380
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11381
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
11382
|
-
displayValue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11383
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11384
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", children: "·" })
|
|
11385
|
-
] }),
|
|
11386
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
11387
|
-
] })
|
|
11388
|
-
] }),
|
|
11389
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11390
|
-
ui.IconButton,
|
|
11391
|
-
{
|
|
11392
|
-
size: "small",
|
|
11393
|
-
type: "button",
|
|
11394
|
-
variant: "transparent",
|
|
11395
|
-
onClick: onRemove,
|
|
11396
|
-
isLoading: isPending || isLoading,
|
|
11397
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XMark, {})
|
|
11398
|
-
}
|
|
11399
|
-
)
|
|
11400
|
-
]
|
|
11401
|
-
},
|
|
11402
|
-
promotion.id
|
|
11403
|
-
);
|
|
11404
|
-
};
|
|
11405
|
-
function getDisplayValue(promotion) {
|
|
11406
|
-
var _a, _b, _c, _d;
|
|
11407
|
-
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11408
|
-
if (!value) {
|
|
11409
|
-
return null;
|
|
11410
|
-
}
|
|
11411
|
-
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11412
|
-
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11413
|
-
if (!currency) {
|
|
11414
|
-
return null;
|
|
11415
|
-
}
|
|
11416
|
-
return getLocaleAmount(value, currency);
|
|
11417
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11418
|
-
return formatPercentage(value);
|
|
11419
|
-
}
|
|
11420
|
-
return null;
|
|
11421
|
-
}
|
|
11422
|
-
const formatter = new Intl.NumberFormat([], {
|
|
11423
|
-
style: "percent",
|
|
11424
|
-
minimumFractionDigits: 2
|
|
11425
|
-
});
|
|
11426
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11427
|
-
let val = value || 0;
|
|
11428
|
-
if (!isPercentageValue) {
|
|
11429
|
-
val = val / 100;
|
|
11430
|
-
}
|
|
11431
|
-
return formatter.format(val);
|
|
11432
|
-
};
|
|
11433
|
-
function getPromotionIds(items, shippingMethods) {
|
|
11434
|
-
const promotionIds = /* @__PURE__ */ new Set();
|
|
11435
|
-
for (const item of items) {
|
|
11436
|
-
if (item.adjustments) {
|
|
11437
|
-
for (const adjustment of item.adjustments) {
|
|
11438
|
-
if (adjustment.promotion_id) {
|
|
11439
|
-
promotionIds.add(adjustment.promotion_id);
|
|
11440
|
-
}
|
|
11441
|
-
}
|
|
11442
|
-
}
|
|
11443
|
-
}
|
|
11444
|
-
for (const shippingMethod of shippingMethods) {
|
|
11445
|
-
if (shippingMethod.adjustments) {
|
|
11446
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
11447
|
-
if (adjustment.promotion_id) {
|
|
11448
|
-
promotionIds.add(adjustment.promotion_id);
|
|
11449
|
-
}
|
|
11450
|
-
}
|
|
11451
|
-
}
|
|
11452
|
-
}
|
|
11453
|
-
return Array.from(promotionIds);
|
|
11454
|
-
}
|
|
11455
|
-
const SalesChannel = () => {
|
|
11456
|
-
const { id } = reactRouterDom.useParams();
|
|
11457
|
-
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11458
|
-
id,
|
|
11459
|
-
{
|
|
11460
|
-
fields: "+sales_channel_id"
|
|
11461
|
-
},
|
|
11462
|
-
{
|
|
11463
|
-
enabled: !!id
|
|
11464
|
-
}
|
|
11465
|
-
);
|
|
11466
|
-
if (isError) {
|
|
11467
|
-
throw error;
|
|
11468
|
-
}
|
|
11469
|
-
const ISrEADY = !!draft_order && !isPending;
|
|
11470
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11471
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11472
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Sales Channel" }) }),
|
|
11473
|
-
/* @__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" }) })
|
|
11474
|
-
] }),
|
|
11475
|
-
ISrEADY && /* @__PURE__ */ jsxRuntime.jsx(SalesChannelForm, { order: draft_order })
|
|
11476
|
-
] });
|
|
11477
|
-
};
|
|
11478
|
-
const SalesChannelForm = ({ order }) => {
|
|
11479
|
-
const form = reactHookForm.useForm({
|
|
11480
|
-
defaultValues: {
|
|
11481
|
-
sales_channel_id: order.sales_channel_id || ""
|
|
11482
|
-
},
|
|
11483
|
-
resolver: zod.zodResolver(schema$2)
|
|
11484
|
-
});
|
|
11485
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11486
|
-
const { handleSuccess } = useRouteModal();
|
|
11487
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11488
|
-
await mutateAsync(
|
|
11489
|
-
{
|
|
11490
|
-
sales_channel_id: data.sales_channel_id
|
|
11491
|
-
},
|
|
11492
|
-
{
|
|
11493
|
-
onSuccess: () => {
|
|
11494
|
-
ui.toast.success("Sales channel updated");
|
|
11495
|
-
handleSuccess();
|
|
11496
|
-
},
|
|
11497
|
-
onError: (error) => {
|
|
11498
|
-
ui.toast.error(error.message);
|
|
11499
|
-
}
|
|
11500
|
-
}
|
|
11501
|
-
);
|
|
11502
|
-
});
|
|
11503
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11504
|
-
KeyboundForm,
|
|
11505
|
-
{
|
|
11506
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11507
|
-
onSubmit,
|
|
11508
|
-
children: [
|
|
11509
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(SalesChannelField, { control: form.control, order }) }),
|
|
11510
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11511
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11512
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11513
|
-
] }) })
|
|
11514
|
-
]
|
|
11515
|
-
}
|
|
11516
|
-
) });
|
|
11517
|
-
};
|
|
11518
|
-
const SalesChannelField = ({ control, order }) => {
|
|
11519
|
-
const salesChannels = useComboboxData({
|
|
11520
|
-
queryFn: async (params) => {
|
|
11521
|
-
return await sdk.admin.salesChannel.list(params);
|
|
11522
|
-
},
|
|
11523
|
-
queryKey: ["sales-channels"],
|
|
11524
|
-
getOptions: (data) => {
|
|
11525
|
-
return data.sales_channels.map((salesChannel) => ({
|
|
11526
|
-
label: salesChannel.name,
|
|
11527
|
-
value: salesChannel.id
|
|
11528
|
-
}));
|
|
11529
|
-
},
|
|
11530
|
-
defaultValue: order.sales_channel_id || void 0
|
|
11531
|
-
});
|
|
11532
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11533
|
-
Form$2.Field,
|
|
11534
|
-
{
|
|
11535
|
-
control,
|
|
11536
|
-
name: "sales_channel_id",
|
|
11537
|
-
render: ({ field }) => {
|
|
11538
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11539
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Sales Channel" }),
|
|
11540
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11541
|
-
Combobox,
|
|
11542
|
-
{
|
|
11543
|
-
options: salesChannels.options,
|
|
11544
|
-
fetchNextPage: salesChannels.fetchNextPage,
|
|
11545
|
-
isFetchingNextPage: salesChannels.isFetchingNextPage,
|
|
11546
|
-
searchValue: salesChannels.searchValue,
|
|
11547
|
-
onSearchValueChange: salesChannels.onSearchValueChange,
|
|
11548
|
-
placeholder: "Select sales channel",
|
|
11549
|
-
...field
|
|
11550
|
-
}
|
|
11551
|
-
) }),
|
|
11552
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11553
|
-
] });
|
|
11554
|
-
}
|
|
11555
|
-
}
|
|
11556
|
-
);
|
|
11557
|
-
};
|
|
11558
|
-
const schema$2 = objectType({
|
|
11559
|
-
sales_channel_id: stringType().min(1)
|
|
11560
|
-
});
|
|
11561
|
-
const ShippingAddress = () => {
|
|
11562
|
-
const { id } = reactRouterDom.useParams();
|
|
11563
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11564
|
-
fields: "+shipping_address"
|
|
11565
|
-
});
|
|
11566
|
-
if (isError) {
|
|
11567
|
-
throw error;
|
|
11568
|
-
}
|
|
11569
|
-
const isReady = !isPending && !!order;
|
|
11570
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11571
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11572
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
11573
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
11574
|
-
] }),
|
|
11575
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
11576
|
-
] });
|
|
11577
|
-
};
|
|
11578
|
-
const ShippingAddressForm = ({ order }) => {
|
|
11579
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
11580
|
-
const form = reactHookForm.useForm({
|
|
11581
|
-
defaultValues: {
|
|
11582
|
-
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
11583
|
-
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
11584
|
-
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
11585
|
-
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
11586
|
-
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
11587
|
-
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
11588
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
11589
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
11590
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11591
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11592
|
-
},
|
|
11593
|
-
resolver: zod.zodResolver(schema$1)
|
|
11594
|
-
});
|
|
11595
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11596
|
-
const { handleSuccess } = useRouteModal();
|
|
11597
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
11598
|
-
await mutateAsync(
|
|
11599
|
-
{
|
|
11600
|
-
shipping_address: {
|
|
11601
|
-
first_name: data.first_name,
|
|
11602
|
-
last_name: data.last_name,
|
|
11603
|
-
company: data.company,
|
|
11604
|
-
address_1: data.address_1,
|
|
11605
|
-
address_2: data.address_2,
|
|
11606
|
-
city: data.city,
|
|
11607
|
-
province: data.province,
|
|
11608
|
-
country_code: data.country_code,
|
|
11609
|
-
postal_code: data.postal_code,
|
|
11610
|
-
phone: data.phone
|
|
11611
|
-
}
|
|
11612
|
-
},
|
|
11613
|
-
{
|
|
11614
|
-
onSuccess: () => {
|
|
11615
|
-
handleSuccess();
|
|
11616
|
-
},
|
|
11617
|
-
onError: (error) => {
|
|
11618
|
-
ui.toast.error(error.message);
|
|
11619
|
-
}
|
|
11620
|
-
}
|
|
11621
|
-
);
|
|
11622
|
-
});
|
|
11623
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11624
|
-
KeyboundForm,
|
|
11625
|
-
{
|
|
11626
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
11627
|
-
onSubmit,
|
|
11628
|
-
children: [
|
|
11629
|
-
/* @__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: [
|
|
11630
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11631
|
-
Form$2.Field,
|
|
11632
|
-
{
|
|
11633
|
-
control: form.control,
|
|
11634
|
-
name: "country_code",
|
|
11635
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11636
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
11637
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
11638
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11639
|
-
] })
|
|
11640
|
-
}
|
|
11641
|
-
),
|
|
11642
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11643
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11644
|
-
Form$2.Field,
|
|
11645
|
-
{
|
|
11646
|
-
control: form.control,
|
|
11647
|
-
name: "first_name",
|
|
11648
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11649
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
11650
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11651
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11652
|
-
] })
|
|
11653
|
-
}
|
|
11654
|
-
),
|
|
11655
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11656
|
-
Form$2.Field,
|
|
11657
|
-
{
|
|
11658
|
-
control: form.control,
|
|
11659
|
-
name: "last_name",
|
|
11660
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11661
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
11662
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11663
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11664
|
-
] })
|
|
11665
|
-
}
|
|
11666
|
-
)
|
|
11667
|
-
] }),
|
|
11668
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11669
|
-
Form$2.Field,
|
|
11670
|
-
{
|
|
11671
|
-
control: form.control,
|
|
11672
|
-
name: "company",
|
|
11673
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11674
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
11675
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11676
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11677
|
-
] })
|
|
11678
|
-
}
|
|
11679
|
-
),
|
|
11680
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11681
|
-
Form$2.Field,
|
|
11682
|
-
{
|
|
11683
|
-
control: form.control,
|
|
11684
|
-
name: "address_1",
|
|
11685
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11686
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
11687
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11688
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11689
|
-
] })
|
|
11690
|
-
}
|
|
11691
|
-
),
|
|
11692
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11693
|
-
Form$2.Field,
|
|
11694
|
-
{
|
|
11695
|
-
control: form.control,
|
|
11696
|
-
name: "address_2",
|
|
11697
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11698
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
11699
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11700
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11701
|
-
] })
|
|
11702
|
-
}
|
|
11703
|
-
),
|
|
11704
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
11705
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11706
|
-
Form$2.Field,
|
|
11707
|
-
{
|
|
11708
|
-
control: form.control,
|
|
11709
|
-
name: "postal_code",
|
|
11710
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11711
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
11712
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11714
|
-
] })
|
|
11715
|
-
}
|
|
11716
|
-
),
|
|
11717
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11718
|
-
Form$2.Field,
|
|
11719
|
-
{
|
|
11720
|
-
control: form.control,
|
|
11721
|
-
name: "city",
|
|
11722
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11723
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
11724
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11725
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11726
|
-
] })
|
|
11727
|
-
}
|
|
11728
|
-
)
|
|
11729
|
-
] }),
|
|
11730
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11731
|
-
Form$2.Field,
|
|
11732
|
-
{
|
|
11733
|
-
control: form.control,
|
|
11734
|
-
name: "province",
|
|
11735
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11736
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
11737
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11738
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11739
|
-
] })
|
|
11740
|
-
}
|
|
11741
|
-
),
|
|
11742
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11743
|
-
Form$2.Field,
|
|
11744
|
-
{
|
|
11745
|
-
control: form.control,
|
|
11746
|
-
name: "phone",
|
|
11747
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11748
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
11749
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11750
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11751
|
-
] })
|
|
11752
|
-
}
|
|
11753
|
-
)
|
|
11754
|
-
] }) }),
|
|
11196
|
+
const SalesChannel = () => {
|
|
11197
|
+
const { id } = reactRouterDom.useParams();
|
|
11198
|
+
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 }) }),
|
|
11755
11251
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11756
11252
|
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11757
11253
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
@@ -11760,7 +11256,49 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11760
11256
|
}
|
|
11761
11257
|
) });
|
|
11762
11258
|
};
|
|
11763
|
-
const
|
|
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
|
+
});
|
|
11764
11302
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11765
11303
|
const Shipping = () => {
|
|
11766
11304
|
var _a;
|
|
@@ -11786,7 +11324,7 @@ const Shipping = () => {
|
|
|
11786
11324
|
const isReady = preview && !isPreviewPending && order && !isPending;
|
|
11787
11325
|
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal, { onClose: onCancel, children: !orderHasItems ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden ", children: [
|
|
11788
11326
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11789
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__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
|
|
11327
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__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 py-16 px-6", children: [
|
|
11790
11328
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11791
11329
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This draft order currently has no items. Add items to the order before adding shipping." }) })
|
|
11792
11330
|
] }) }) }),
|
|
@@ -11873,14 +11411,14 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11873
11411
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
11874
11412
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, {}),
|
|
11875
11413
|
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11876
|
-
/* @__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
|
|
11414
|
+
/* @__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 py-16 px-6", children: [
|
|
11877
11415
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11878
11416
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
11879
11417
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Choose which shipping method(s) to use for the items in the order." }) })
|
|
11880
11418
|
] }),
|
|
11881
11419
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
11882
|
-
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest
|
|
11883
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between
|
|
11420
|
+
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Root, { type: "multiple", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle rounded-xl shadow-elevation-card-rest", children: [
|
|
11421
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-2 flex items-center justify-between", children: [
|
|
11884
11422
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11885
11423
|
ui.Text,
|
|
11886
11424
|
{
|
|
@@ -11922,8 +11460,8 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11922
11460
|
value: profile.id,
|
|
11923
11461
|
className: "bg-ui-bg-base shadow-elevation-card-rest rounded-lg",
|
|
11924
11462
|
children: [
|
|
11925
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3
|
|
11926
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
11463
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 flex items-center justify-between gap-3", children: [
|
|
11464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3 w-full overflow-hidden", children: [
|
|
11927
11465
|
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11928
11466
|
ui.IconButton,
|
|
11929
11467
|
{
|
|
@@ -11931,12 +11469,12 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11931
11469
|
variant: "transparent",
|
|
11932
11470
|
className: "group/trigger",
|
|
11933
11471
|
disabled: !hasItems,
|
|
11934
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.TriangleRightMini, { className: "
|
|
11472
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.TriangleRightMini, { className: "group-data-[state=open]/trigger:rotate-90 transition-transform" })
|
|
11935
11473
|
}
|
|
11936
11474
|
) }),
|
|
11937
11475
|
!shippingOption ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
11938
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shadow-borders-base flex
|
|
11939
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-
|
|
11476
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-7 rounded-md shadow-borders-base flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 rounded bg-ui-bg-component-hover flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Shopping, { className: "text-ui-fg-subtle" }) }) }),
|
|
11477
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col flex-1", children: [
|
|
11940
11478
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11941
11479
|
ui.Text,
|
|
11942
11480
|
{
|
|
@@ -11960,7 +11498,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11960
11498
|
}
|
|
11961
11499
|
)
|
|
11962
11500
|
] })
|
|
11963
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
11501
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-[5px] max-sm:flex-col max-sm:items-start flex-1 w-full overflow-hidden", children: [
|
|
11964
11502
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11965
11503
|
ui.Tooltip,
|
|
11966
11504
|
{
|
|
@@ -11977,7 +11515,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
11977
11515
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11978
11516
|
ui.Badge,
|
|
11979
11517
|
{
|
|
11980
|
-
className: "flex
|
|
11518
|
+
className: "flex items-center gap-x-[3px] overflow-hidden cursor-default",
|
|
11981
11519
|
size: "xsmall",
|
|
11982
11520
|
children: [
|
|
11983
11521
|
/* @__PURE__ */ jsxRuntime.jsx(icons.Shopping, { className: "shrink-0" }),
|
|
@@ -12002,7 +11540,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
12002
11540
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12003
11541
|
ui.Badge,
|
|
12004
11542
|
{
|
|
12005
|
-
className: "flex
|
|
11543
|
+
className: "flex items-center gap-x-[3px] overflow-hidden cursor-default",
|
|
12006
11544
|
size: "xsmall",
|
|
12007
11545
|
children: [
|
|
12008
11546
|
/* @__PURE__ */ jsxRuntime.jsx(icons.Buildings, { className: "shrink-0" }),
|
|
@@ -12015,7 +11553,7 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
12015
11553
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { content: shippingOption.name, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12016
11554
|
ui.Badge,
|
|
12017
11555
|
{
|
|
12018
|
-
className: "flex
|
|
11556
|
+
className: "flex items-center gap-x-[3px] overflow-hidden cursor-default",
|
|
12019
11557
|
size: "xsmall",
|
|
12020
11558
|
children: [
|
|
12021
11559
|
/* @__PURE__ */ jsxRuntime.jsx(icons.TruckFast, { className: "shrink-0" }),
|
|
@@ -12086,17 +11624,17 @@ const ShippingForm = ({ preview, order }) => {
|
|
|
12086
11624
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12087
11625
|
"div",
|
|
12088
11626
|
{
|
|
12089
|
-
className: "flex items-center gap-x-3
|
|
11627
|
+
className: "px-3 flex items-center gap-x-3",
|
|
12090
11628
|
children: [
|
|
12091
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
11629
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-5 h-[56px] flex flex-col justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12092
11630
|
ui.Divider,
|
|
12093
11631
|
{
|
|
12094
11632
|
variant: "dashed",
|
|
12095
11633
|
orientation: "vertical"
|
|
12096
11634
|
}
|
|
12097
11635
|
) }),
|
|
12098
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3
|
|
12099
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
11636
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-2 flex items-center gap-x-3", children: [
|
|
11637
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-7 flex items-center justify-center tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12100
11638
|
ui.Text,
|
|
12101
11639
|
{
|
|
12102
11640
|
size: "small",
|
|
@@ -12233,7 +11771,7 @@ const ShippingProfileForm = ({
|
|
|
12233
11771
|
isPending: isUpdatingShippingMethod
|
|
12234
11772
|
} = useDraftOrderUpdateShippingMethod(order.id);
|
|
12235
11773
|
const onSubmit = form.handleSubmit(async (values) => {
|
|
12236
|
-
if (
|
|
11774
|
+
if (lodash.isEqual(values, form.formState.defaultValues)) {
|
|
12237
11775
|
setIsOpen(STACKED_FOCUS_MODAL_ID, false);
|
|
12238
11776
|
return;
|
|
12239
11777
|
}
|
|
@@ -12277,7 +11815,7 @@ const ShippingProfileForm = ({
|
|
|
12277
11815
|
onSubmit,
|
|
12278
11816
|
children: [
|
|
12279
11817
|
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Header, {}),
|
|
12280
|
-
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__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
|
|
11818
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Body, { className: "flex flex-1 flex-col overflow-hidden", children: /* @__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 py-16 px-6", children: [
|
|
12281
11819
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
12282
11820
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Shipping" }) }),
|
|
12283
11821
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Add a shipping method for the selected shipping profile. You can see the items that will be shipped using this method in the preview below." }) })
|
|
@@ -12350,14 +11888,14 @@ const ItemsPreview = ({ order, shippingProfileId }) => {
|
|
|
12350
11888
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Items with the selected shipping profile." })
|
|
12351
11889
|
] }) }),
|
|
12352
11890
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle shadow-elevation-card-rest rounded-xl", children: [
|
|
12353
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
11891
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-3 px-4 py-2 text-ui-fg-muted", children: [
|
|
12354
11892
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Item" }) }),
|
|
12355
11893
|
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Quantity" }) })
|
|
12356
11894
|
] }),
|
|
12357
11895
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-1.5 px-[5px] pb-[5px]", children: matches.length > 0 ? matches == null ? void 0 : matches.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12358
11896
|
"div",
|
|
12359
11897
|
{
|
|
12360
|
-
className: "bg-ui-bg-base shadow-elevation-card-rest
|
|
11898
|
+
className: "grid grid-cols-2 gap-3 px-4 py-2 bg-ui-bg-base shadow-elevation-card-rest rounded-lg items-center",
|
|
12361
11899
|
children: [
|
|
12362
11900
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
12363
11901
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12410,7 +11948,7 @@ const ItemsPreview = ({ order, shippingProfileId }) => {
|
|
|
12410
11948
|
]
|
|
12411
11949
|
},
|
|
12412
11950
|
item.id
|
|
12413
|
-
)) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest flex
|
|
11951
|
+
)) : /* @__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: [
|
|
12414
11952
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", leading: "compact", children: "No items found" }),
|
|
12415
11953
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
12416
11954
|
'No items found for "',
|
|
@@ -12515,59 +12053,262 @@ const ShippingOptionField = ({
|
|
|
12515
12053
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Choose the shipping option to use." })
|
|
12516
12054
|
] }),
|
|
12517
12055
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12518
|
-
ConditionalTooltip,
|
|
12056
|
+
ConditionalTooltip,
|
|
12057
|
+
{
|
|
12058
|
+
content: tooltipContent,
|
|
12059
|
+
showTooltip: !locationId || !shippingProfileId,
|
|
12060
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12061
|
+
Combobox,
|
|
12062
|
+
{
|
|
12063
|
+
options: shippingOptions.options,
|
|
12064
|
+
fetchNextPage: shippingOptions.fetchNextPage,
|
|
12065
|
+
isFetchingNextPage: shippingOptions.isFetchingNextPage,
|
|
12066
|
+
searchValue: shippingOptions.searchValue,
|
|
12067
|
+
onSearchValueChange: shippingOptions.onSearchValueChange,
|
|
12068
|
+
placeholder: "Select shipping option",
|
|
12069
|
+
...field,
|
|
12070
|
+
disabled: !locationId || !shippingProfileId
|
|
12071
|
+
}
|
|
12072
|
+
) }) })
|
|
12073
|
+
}
|
|
12074
|
+
)
|
|
12075
|
+
] }) });
|
|
12076
|
+
}
|
|
12077
|
+
}
|
|
12078
|
+
);
|
|
12079
|
+
};
|
|
12080
|
+
const CustomAmountField = ({
|
|
12081
|
+
control,
|
|
12082
|
+
currencyCode
|
|
12083
|
+
}) => {
|
|
12084
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12085
|
+
Form$2.Field,
|
|
12086
|
+
{
|
|
12087
|
+
control,
|
|
12088
|
+
name: "custom_amount",
|
|
12089
|
+
render: ({ field: { onChange, ...field } }) => {
|
|
12090
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
12091
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
12092
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
|
|
12093
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
|
|
12094
|
+
] }),
|
|
12095
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12096
|
+
ui.CurrencyInput,
|
|
12097
|
+
{
|
|
12098
|
+
...field,
|
|
12099
|
+
onValueChange: (value) => onChange(value),
|
|
12100
|
+
symbol: getNativeSymbol(currencyCode),
|
|
12101
|
+
code: currencyCode
|
|
12102
|
+
}
|
|
12103
|
+
) })
|
|
12104
|
+
] });
|
|
12105
|
+
}
|
|
12106
|
+
}
|
|
12107
|
+
);
|
|
12108
|
+
};
|
|
12109
|
+
const ShippingAddress = () => {
|
|
12110
|
+
const { id } = reactRouterDom.useParams();
|
|
12111
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12112
|
+
fields: "+shipping_address"
|
|
12113
|
+
});
|
|
12114
|
+
if (isError) {
|
|
12115
|
+
throw error;
|
|
12116
|
+
}
|
|
12117
|
+
const isReady = !isPending && !!order;
|
|
12118
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12119
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12120
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Shipping Address" }) }),
|
|
12121
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12122
|
+
] }),
|
|
12123
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(ShippingAddressForm, { order })
|
|
12124
|
+
] });
|
|
12125
|
+
};
|
|
12126
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12127
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12128
|
+
const form = reactHookForm.useForm({
|
|
12129
|
+
defaultValues: {
|
|
12130
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12131
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12132
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12133
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12134
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12135
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12136
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12137
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12138
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12139
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12140
|
+
},
|
|
12141
|
+
resolver: zod.zodResolver(schema$3)
|
|
12142
|
+
});
|
|
12143
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12144
|
+
const { handleSuccess } = useRouteModal();
|
|
12145
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12146
|
+
await mutateAsync(
|
|
12147
|
+
{
|
|
12148
|
+
shipping_address: {
|
|
12149
|
+
first_name: data.first_name,
|
|
12150
|
+
last_name: data.last_name,
|
|
12151
|
+
company: data.company,
|
|
12152
|
+
address_1: data.address_1,
|
|
12153
|
+
address_2: data.address_2,
|
|
12154
|
+
city: data.city,
|
|
12155
|
+
province: data.province,
|
|
12156
|
+
country_code: data.country_code,
|
|
12157
|
+
postal_code: data.postal_code,
|
|
12158
|
+
phone: data.phone
|
|
12159
|
+
}
|
|
12160
|
+
},
|
|
12161
|
+
{
|
|
12162
|
+
onSuccess: () => {
|
|
12163
|
+
handleSuccess();
|
|
12164
|
+
},
|
|
12165
|
+
onError: (error) => {
|
|
12166
|
+
ui.toast.error(error.message);
|
|
12167
|
+
}
|
|
12168
|
+
}
|
|
12169
|
+
);
|
|
12170
|
+
});
|
|
12171
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12172
|
+
KeyboundForm,
|
|
12173
|
+
{
|
|
12174
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12175
|
+
onSubmit,
|
|
12176
|
+
children: [
|
|
12177
|
+
/* @__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: [
|
|
12178
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12179
|
+
Form$2.Field,
|
|
12180
|
+
{
|
|
12181
|
+
control: form.control,
|
|
12182
|
+
name: "country_code",
|
|
12183
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12184
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Country" }),
|
|
12185
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(CountrySelect, { ...field }) }),
|
|
12186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12187
|
+
] })
|
|
12188
|
+
}
|
|
12189
|
+
),
|
|
12190
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12191
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12192
|
+
Form$2.Field,
|
|
12193
|
+
{
|
|
12194
|
+
control: form.control,
|
|
12195
|
+
name: "first_name",
|
|
12196
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12197
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "First name" }),
|
|
12198
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12199
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12200
|
+
] })
|
|
12201
|
+
}
|
|
12202
|
+
),
|
|
12203
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12204
|
+
Form$2.Field,
|
|
12205
|
+
{
|
|
12206
|
+
control: form.control,
|
|
12207
|
+
name: "last_name",
|
|
12208
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12209
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Last name" }),
|
|
12210
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12211
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12212
|
+
] })
|
|
12213
|
+
}
|
|
12214
|
+
)
|
|
12215
|
+
] }),
|
|
12216
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12217
|
+
Form$2.Field,
|
|
12519
12218
|
{
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
{
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
isFetchingNextPage: shippingOptions.isFetchingNextPage,
|
|
12528
|
-
searchValue: shippingOptions.searchValue,
|
|
12529
|
-
onSearchValueChange: shippingOptions.onSearchValueChange,
|
|
12530
|
-
placeholder: "Select shipping option",
|
|
12531
|
-
...field,
|
|
12532
|
-
disabled: !locationId || !shippingProfileId
|
|
12533
|
-
}
|
|
12534
|
-
) }) })
|
|
12219
|
+
control: form.control,
|
|
12220
|
+
name: "company",
|
|
12221
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12222
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12223
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12224
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12225
|
+
] })
|
|
12535
12226
|
}
|
|
12536
|
-
)
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12227
|
+
),
|
|
12228
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12229
|
+
Form$2.Field,
|
|
12230
|
+
{
|
|
12231
|
+
control: form.control,
|
|
12232
|
+
name: "address_1",
|
|
12233
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12234
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Address" }),
|
|
12235
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12236
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12237
|
+
] })
|
|
12238
|
+
}
|
|
12239
|
+
),
|
|
12240
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12241
|
+
Form$2.Field,
|
|
12242
|
+
{
|
|
12243
|
+
control: form.control,
|
|
12244
|
+
name: "address_2",
|
|
12245
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12246
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12247
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12248
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12249
|
+
] })
|
|
12250
|
+
}
|
|
12251
|
+
),
|
|
12252
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12253
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12254
|
+
Form$2.Field,
|
|
12255
|
+
{
|
|
12256
|
+
control: form.control,
|
|
12257
|
+
name: "postal_code",
|
|
12258
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12259
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Postal code" }),
|
|
12260
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12261
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12262
|
+
] })
|
|
12263
|
+
}
|
|
12264
|
+
),
|
|
12265
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12266
|
+
Form$2.Field,
|
|
12267
|
+
{
|
|
12268
|
+
control: form.control,
|
|
12269
|
+
name: "city",
|
|
12270
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12271
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "City" }),
|
|
12272
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12273
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12274
|
+
] })
|
|
12275
|
+
}
|
|
12276
|
+
)
|
|
12556
12277
|
] }),
|
|
12557
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12558
|
-
|
|
12278
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12279
|
+
Form$2.Field,
|
|
12559
12280
|
{
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12281
|
+
control: form.control,
|
|
12282
|
+
name: "province",
|
|
12283
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12284
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12285
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12286
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12287
|
+
] })
|
|
12564
12288
|
}
|
|
12565
|
-
)
|
|
12566
|
-
|
|
12567
|
-
|
|
12289
|
+
),
|
|
12290
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12291
|
+
Form$2.Field,
|
|
12292
|
+
{
|
|
12293
|
+
control: form.control,
|
|
12294
|
+
name: "phone",
|
|
12295
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
12296
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12297
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
12298
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
12299
|
+
] })
|
|
12300
|
+
}
|
|
12301
|
+
)
|
|
12302
|
+
] }) }),
|
|
12303
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12304
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12305
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12306
|
+
] }) })
|
|
12307
|
+
]
|
|
12568
12308
|
}
|
|
12569
|
-
);
|
|
12309
|
+
) });
|
|
12570
12310
|
};
|
|
12311
|
+
const schema$3 = addressSchema;
|
|
12571
12312
|
const TransferOwnership = () => {
|
|
12572
12313
|
const { id } = reactRouterDom.useParams();
|
|
12573
12314
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -12591,7 +12332,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12591
12332
|
defaultValues: {
|
|
12592
12333
|
customer_id: order.customer_id || ""
|
|
12593
12334
|
},
|
|
12594
|
-
resolver: zod.zodResolver(schema)
|
|
12335
|
+
resolver: zod.zodResolver(schema$2)
|
|
12595
12336
|
});
|
|
12596
12337
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12597
12338
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12985,65 +12726,323 @@ const Illustration = () => {
|
|
|
12985
12726
|
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_20915_38670", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12986
12727
|
"rect",
|
|
12987
12728
|
{
|
|
12988
|
-
width: "12",
|
|
12989
|
-
height: "12",
|
|
12990
|
-
fill: "white",
|
|
12991
|
-
transform: "matrix(0.865865 0.500278 -0.871576 0.490261 138.36 74.6508)"
|
|
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
|
+
] })
|
|
12843
|
+
}
|
|
12844
|
+
) }),
|
|
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,
|
|
12914
|
+
{
|
|
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
|
+
] })
|
|
12992
12922
|
}
|
|
12993
|
-
)
|
|
12994
|
-
/* @__PURE__ */ jsxRuntime.
|
|
12995
|
-
|
|
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,
|
|
12996
12952
|
{
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
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
|
+
] })
|
|
13001
12960
|
}
|
|
13002
|
-
)
|
|
13003
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13004
|
-
|
|
12961
|
+
),
|
|
12962
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12963
|
+
Form$2.Field,
|
|
13005
12964
|
{
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
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
|
+
] })
|
|
13010
12972
|
}
|
|
13011
|
-
)
|
|
13012
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13013
|
-
|
|
12973
|
+
),
|
|
12974
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12975
|
+
Form$2.Field,
|
|
13014
12976
|
{
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
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
|
+
] })
|
|
13019
12984
|
}
|
|
13020
|
-
)
|
|
13021
|
-
/* @__PURE__ */ jsxRuntime.
|
|
13022
|
-
|
|
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,
|
|
13023
13014
|
{
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
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
|
+
] })
|
|
13028
13022
|
}
|
|
13029
|
-
)
|
|
13030
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13031
|
-
|
|
13023
|
+
),
|
|
13024
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13025
|
+
Form$2.Field,
|
|
13032
13026
|
{
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
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
|
+
] })
|
|
13037
13034
|
}
|
|
13038
|
-
)
|
|
13039
|
-
] })
|
|
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
|
+
] }) })
|
|
13040
13041
|
]
|
|
13041
13042
|
}
|
|
13042
|
-
);
|
|
13043
|
+
) });
|
|
13043
13044
|
};
|
|
13044
|
-
const schema =
|
|
13045
|
-
customer_id: stringType().min(1)
|
|
13046
|
-
});
|
|
13045
|
+
const schema = addressSchema;
|
|
13047
13046
|
const widgetModule = { widgets: [] };
|
|
13048
13047
|
const routeModule = {
|
|
13049
13048
|
routes: [
|
|
@@ -13068,41 +13067,41 @@ const routeModule = {
|
|
|
13068
13067
|
Component: CustomItems,
|
|
13069
13068
|
path: "/draft-orders/:id/custom-items"
|
|
13070
13069
|
},
|
|
13071
|
-
{
|
|
13072
|
-
Component: BillingAddress,
|
|
13073
|
-
path: "/draft-orders/:id/billing-address"
|
|
13074
|
-
},
|
|
13075
13070
|
{
|
|
13076
13071
|
Component: Items,
|
|
13077
13072
|
path: "/draft-orders/:id/items"
|
|
13078
13073
|
},
|
|
13079
13074
|
{
|
|
13080
|
-
Component:
|
|
13081
|
-
path: "/draft-orders/:id/
|
|
13075
|
+
Component: Promotions,
|
|
13076
|
+
path: "/draft-orders/:id/promotions"
|
|
13082
13077
|
},
|
|
13083
13078
|
{
|
|
13084
13079
|
Component: Metadata,
|
|
13085
13080
|
path: "/draft-orders/:id/metadata"
|
|
13086
13081
|
},
|
|
13087
|
-
{
|
|
13088
|
-
Component: Promotions,
|
|
13089
|
-
path: "/draft-orders/:id/promotions"
|
|
13090
|
-
},
|
|
13091
13082
|
{
|
|
13092
13083
|
Component: SalesChannel,
|
|
13093
13084
|
path: "/draft-orders/:id/sales-channel"
|
|
13094
13085
|
},
|
|
13095
|
-
{
|
|
13096
|
-
Component: ShippingAddress,
|
|
13097
|
-
path: "/draft-orders/:id/shipping-address"
|
|
13098
|
-
},
|
|
13099
13086
|
{
|
|
13100
13087
|
Component: Shipping,
|
|
13101
13088
|
path: "/draft-orders/:id/shipping"
|
|
13102
13089
|
},
|
|
13090
|
+
{
|
|
13091
|
+
Component: ShippingAddress,
|
|
13092
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13093
|
+
},
|
|
13103
13094
|
{
|
|
13104
13095
|
Component: TransferOwnership,
|
|
13105
13096
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
|
+
},
|
|
13098
|
+
{
|
|
13099
|
+
Component: Email,
|
|
13100
|
+
path: "/draft-orders/:id/email"
|
|
13101
|
+
},
|
|
13102
|
+
{
|
|
13103
|
+
Component: BillingAddress,
|
|
13104
|
+
path: "/draft-orders/:id/billing-address"
|
|
13106
13105
|
}
|
|
13107
13106
|
]
|
|
13108
13107
|
}
|