@medusajs/draft-order 2.12.0-preview-20251103150145 → 2.12.0
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 +744 -742
- package/.medusa/server/src/admin/index.mjs +745 -743
- package/package.json +16 -31
|
@@ -352,10 +352,14 @@ const DataTableAction = ({
|
|
|
352
352
|
}
|
|
353
353
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { ...buttonProps, onClick: props.onClick, children: label });
|
|
354
354
|
};
|
|
355
|
+
const backendUrl = __BACKEND_URL__ ?? "/";
|
|
356
|
+
const authType = __AUTH_TYPE__ ?? "session";
|
|
357
|
+
const jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || void 0;
|
|
355
358
|
const sdk = new Medusa__default.default({
|
|
356
|
-
baseUrl:
|
|
359
|
+
baseUrl: backendUrl,
|
|
357
360
|
auth: {
|
|
358
|
-
type:
|
|
361
|
+
type: authType,
|
|
362
|
+
jwtTokenStorageKey
|
|
359
363
|
}
|
|
360
364
|
});
|
|
361
365
|
const CUSTOMER_QUERY_KEY = "customers";
|
|
@@ -4654,9 +4658,6 @@ ZodReadonly.create = (type, params) => {
|
|
|
4654
4658
|
...processCreateParams(params)
|
|
4655
4659
|
});
|
|
4656
4660
|
};
|
|
4657
|
-
({
|
|
4658
|
-
object: ZodObject.lazycreate
|
|
4659
|
-
});
|
|
4660
4661
|
var ZodFirstPartyTypeKind;
|
|
4661
4662
|
(function(ZodFirstPartyTypeKind2) {
|
|
4662
4663
|
ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
|
|
@@ -4703,7 +4704,6 @@ const anyType = ZodAny.create;
|
|
|
4703
4704
|
ZodNever.create;
|
|
4704
4705
|
const arrayType = ZodArray.create;
|
|
4705
4706
|
const objectType = ZodObject.create;
|
|
4706
|
-
ZodObject.strictCreate;
|
|
4707
4707
|
const unionType = ZodUnion.create;
|
|
4708
4708
|
ZodIntersection.create;
|
|
4709
4709
|
ZodTuple.create;
|
|
@@ -8729,7 +8729,7 @@ const Contact = ({ order }) => {
|
|
|
8729
8729
|
children: phone
|
|
8730
8730
|
}
|
|
8731
8731
|
),
|
|
8732
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content:
|
|
8732
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content: phone, className: "text-ui-fg-muted" }) })
|
|
8733
8733
|
] })
|
|
8734
8734
|
] })
|
|
8735
8735
|
] });
|
|
@@ -9762,95 +9762,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9762
9762
|
) });
|
|
9763
9763
|
};
|
|
9764
9764
|
const schema$5 = addressSchema;
|
|
9765
|
-
const CustomItems = () => {
|
|
9766
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9767
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
9768
|
-
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
9769
|
-
] });
|
|
9770
|
-
};
|
|
9771
|
-
const CustomItemsForm = () => {
|
|
9772
|
-
const form = reactHookForm.useForm({
|
|
9773
|
-
resolver: zod.zodResolver(schema$4)
|
|
9774
|
-
});
|
|
9775
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9776
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
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", children: "Save" })
|
|
9780
|
-
] }) })
|
|
9781
|
-
] }) });
|
|
9782
|
-
};
|
|
9783
|
-
const schema$4 = objectType({
|
|
9784
|
-
email: stringType().email()
|
|
9785
|
-
});
|
|
9786
|
-
const Email = () => {
|
|
9787
|
-
const { id } = reactRouterDom.useParams();
|
|
9788
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
9789
|
-
fields: "+email"
|
|
9790
|
-
});
|
|
9791
|
-
if (isError) {
|
|
9792
|
-
throw error;
|
|
9793
|
-
}
|
|
9794
|
-
const isReady = !isPending && !!order;
|
|
9795
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
9796
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
9797
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
9798
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
9799
|
-
] }),
|
|
9800
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
9801
|
-
] });
|
|
9802
|
-
};
|
|
9803
|
-
const EmailForm = ({ order }) => {
|
|
9804
|
-
const form = reactHookForm.useForm({
|
|
9805
|
-
defaultValues: {
|
|
9806
|
-
email: order.email ?? ""
|
|
9807
|
-
},
|
|
9808
|
-
resolver: zod.zodResolver(schema$3)
|
|
9809
|
-
});
|
|
9810
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9811
|
-
const { handleSuccess } = useRouteModal();
|
|
9812
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
9813
|
-
await mutateAsync(
|
|
9814
|
-
{ email: data.email },
|
|
9815
|
-
{
|
|
9816
|
-
onSuccess: () => {
|
|
9817
|
-
handleSuccess();
|
|
9818
|
-
},
|
|
9819
|
-
onError: (error) => {
|
|
9820
|
-
ui.toast.error(error.message);
|
|
9821
|
-
}
|
|
9822
|
-
}
|
|
9823
|
-
);
|
|
9824
|
-
});
|
|
9825
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9826
|
-
KeyboundForm,
|
|
9827
|
-
{
|
|
9828
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
9829
|
-
onSubmit,
|
|
9830
|
-
children: [
|
|
9831
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
9832
|
-
Form$2.Field,
|
|
9833
|
-
{
|
|
9834
|
-
control: form.control,
|
|
9835
|
-
name: "email",
|
|
9836
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
9837
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
9838
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
9839
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
9840
|
-
] })
|
|
9841
|
-
}
|
|
9842
|
-
) }),
|
|
9843
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9844
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9845
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
9846
|
-
] }) })
|
|
9847
|
-
]
|
|
9848
|
-
}
|
|
9849
|
-
) });
|
|
9850
|
-
};
|
|
9851
|
-
const schema$3 = objectType({
|
|
9852
|
-
email: stringType().email()
|
|
9853
|
-
});
|
|
9854
9765
|
const NumberInput = React.forwardRef(
|
|
9855
9766
|
({
|
|
9856
9767
|
value,
|
|
@@ -10825,536 +10736,186 @@ const customItemSchema = objectType({
|
|
|
10825
10736
|
quantity: numberType(),
|
|
10826
10737
|
unit_price: unionType([numberType(), stringType()])
|
|
10827
10738
|
});
|
|
10828
|
-
const
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10846
|
-
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10847
|
-
})
|
|
10848
|
-
}
|
|
10849
|
-
),
|
|
10850
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
|
|
10851
|
-
/* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10852
|
-
labelValue,
|
|
10853
|
-
":"
|
|
10854
|
-
] }),
|
|
10855
|
-
" ",
|
|
10856
|
-
children
|
|
10857
|
-
] })
|
|
10858
|
-
]
|
|
10859
|
-
}
|
|
10860
|
-
);
|
|
10861
|
-
}
|
|
10862
|
-
);
|
|
10863
|
-
InlineTip.displayName = "InlineTip";
|
|
10864
|
-
const MetadataFieldSchema = objectType({
|
|
10865
|
-
key: stringType(),
|
|
10866
|
-
disabled: booleanType().optional(),
|
|
10867
|
-
value: anyType()
|
|
10868
|
-
});
|
|
10869
|
-
const MetadataSchema = objectType({
|
|
10870
|
-
metadata: arrayType(MetadataFieldSchema)
|
|
10871
|
-
});
|
|
10872
|
-
const Metadata = () => {
|
|
10873
|
-
const { id } = reactRouterDom.useParams();
|
|
10874
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
10875
|
-
fields: "metadata"
|
|
10739
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
10740
|
+
const promotionsQueryKeys = {
|
|
10741
|
+
list: (query2) => [
|
|
10742
|
+
PROMOTION_QUERY_KEY,
|
|
10743
|
+
query2 ? query2 : void 0
|
|
10744
|
+
],
|
|
10745
|
+
detail: (id, query2) => [
|
|
10746
|
+
PROMOTION_QUERY_KEY,
|
|
10747
|
+
id,
|
|
10748
|
+
query2 ? query2 : void 0
|
|
10749
|
+
]
|
|
10750
|
+
};
|
|
10751
|
+
const usePromotions = (query2, options) => {
|
|
10752
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
10753
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
10754
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
10755
|
+
...options
|
|
10876
10756
|
});
|
|
10877
|
-
|
|
10878
|
-
|
|
10757
|
+
return { ...data, ...rest };
|
|
10758
|
+
};
|
|
10759
|
+
const Promotions = () => {
|
|
10760
|
+
const { id } = reactRouterDom.useParams();
|
|
10761
|
+
const {
|
|
10762
|
+
order: preview,
|
|
10763
|
+
isError: isPreviewError,
|
|
10764
|
+
error: previewError
|
|
10765
|
+
} = useOrderPreview(id, void 0);
|
|
10766
|
+
useInitiateOrderEdit({ preview });
|
|
10767
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10768
|
+
if (isPreviewError) {
|
|
10769
|
+
throw previewError;
|
|
10879
10770
|
}
|
|
10880
|
-
const isReady =
|
|
10881
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
10882
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10883
|
-
|
|
10884
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
10885
|
-
] }),
|
|
10886
|
-
!isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
10771
|
+
const isReady = !!preview;
|
|
10772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
10773
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
|
|
10774
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
|
|
10887
10775
|
] });
|
|
10888
10776
|
};
|
|
10889
|
-
const
|
|
10890
|
-
const
|
|
10891
|
-
const
|
|
10777
|
+
const PromotionForm = ({ preview }) => {
|
|
10778
|
+
const { items, shipping_methods } = preview;
|
|
10779
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
10780
|
+
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
10892
10781
|
const { handleSuccess } = useRouteModal();
|
|
10893
|
-
const
|
|
10894
|
-
const
|
|
10895
|
-
const
|
|
10896
|
-
|
|
10897
|
-
|
|
10782
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
10783
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
10784
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
10785
|
+
{
|
|
10786
|
+
id: promoIds
|
|
10898
10787
|
},
|
|
10899
|
-
|
|
10788
|
+
{
|
|
10789
|
+
enabled: !!promoIds.length
|
|
10790
|
+
}
|
|
10791
|
+
);
|
|
10792
|
+
const comboboxData = useComboboxData({
|
|
10793
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
10794
|
+
queryFn: async (params) => {
|
|
10795
|
+
return await sdk.admin.promotion.list({
|
|
10796
|
+
...params,
|
|
10797
|
+
id: {
|
|
10798
|
+
$nin: promoIds
|
|
10799
|
+
}
|
|
10800
|
+
});
|
|
10801
|
+
},
|
|
10802
|
+
getOptions: (data) => {
|
|
10803
|
+
return data.promotions.map((promotion) => ({
|
|
10804
|
+
label: promotion.code,
|
|
10805
|
+
value: promotion.code
|
|
10806
|
+
}));
|
|
10807
|
+
}
|
|
10900
10808
|
});
|
|
10901
|
-
const
|
|
10902
|
-
|
|
10903
|
-
|
|
10809
|
+
const add = async (value) => {
|
|
10810
|
+
if (!value) {
|
|
10811
|
+
return;
|
|
10812
|
+
}
|
|
10813
|
+
addPromotions(
|
|
10904
10814
|
{
|
|
10905
|
-
|
|
10815
|
+
promo_codes: [value]
|
|
10906
10816
|
},
|
|
10907
10817
|
{
|
|
10908
|
-
|
|
10909
|
-
ui.toast.
|
|
10910
|
-
|
|
10818
|
+
onError: (e) => {
|
|
10819
|
+
ui.toast.error(e.message);
|
|
10820
|
+
comboboxData.onSearchValueChange("");
|
|
10821
|
+
setComboboxValue("");
|
|
10911
10822
|
},
|
|
10912
|
-
|
|
10913
|
-
|
|
10823
|
+
onSuccess: () => {
|
|
10824
|
+
comboboxData.onSearchValueChange("");
|
|
10825
|
+
setComboboxValue("");
|
|
10914
10826
|
}
|
|
10915
10827
|
}
|
|
10916
10828
|
);
|
|
10917
|
-
}
|
|
10918
|
-
const {
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
}
|
|
10930
|
-
}
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10829
|
+
};
|
|
10830
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
10831
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
10832
|
+
const onSubmit = async () => {
|
|
10833
|
+
setIsSubmitting(true);
|
|
10834
|
+
let requestSucceeded = false;
|
|
10835
|
+
await requestOrderEdit(void 0, {
|
|
10836
|
+
onError: (e) => {
|
|
10837
|
+
ui.toast.error(e.message);
|
|
10838
|
+
},
|
|
10839
|
+
onSuccess: () => {
|
|
10840
|
+
requestSucceeded = true;
|
|
10841
|
+
}
|
|
10842
|
+
});
|
|
10843
|
+
if (!requestSucceeded) {
|
|
10844
|
+
setIsSubmitting(false);
|
|
10845
|
+
return;
|
|
10846
|
+
}
|
|
10847
|
+
await confirmOrderEdit(void 0, {
|
|
10848
|
+
onError: (e) => {
|
|
10849
|
+
ui.toast.error(e.message);
|
|
10850
|
+
},
|
|
10851
|
+
onSuccess: () => {
|
|
10852
|
+
handleSuccess();
|
|
10853
|
+
},
|
|
10854
|
+
onSettled: () => {
|
|
10855
|
+
setIsSubmitting(false);
|
|
10856
|
+
}
|
|
10937
10857
|
});
|
|
10858
|
+
};
|
|
10859
|
+
if (isError) {
|
|
10860
|
+
throw error;
|
|
10938
10861
|
}
|
|
10939
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
10946
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
10947
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
10948
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
|
|
10949
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
|
|
10950
|
-
] }),
|
|
10951
|
-
fields.map((field, index) => {
|
|
10952
|
-
const isDisabled = field.disabled || false;
|
|
10953
|
-
let placeholder = "-";
|
|
10954
|
-
if (typeof field.value === "object") {
|
|
10955
|
-
placeholder = "{ ... }";
|
|
10956
|
-
}
|
|
10957
|
-
if (Array.isArray(field.value)) {
|
|
10958
|
-
placeholder = "[ ... ]";
|
|
10959
|
-
}
|
|
10960
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10961
|
-
ConditionalTooltip,
|
|
10962
|
-
{
|
|
10963
|
-
showTooltip: isDisabled,
|
|
10964
|
-
content: "This row is disabled because it contains non-primitive data.",
|
|
10965
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
|
|
10966
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10967
|
-
"div",
|
|
10968
|
-
{
|
|
10969
|
-
className: ui.clx("grid grid-cols-2 divide-x", {
|
|
10970
|
-
"overflow-hidden rounded-b-lg": index === fields.length - 1
|
|
10971
|
-
}),
|
|
10972
|
-
children: [
|
|
10973
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10974
|
-
Form$2.Field,
|
|
10975
|
-
{
|
|
10976
|
-
control: form.control,
|
|
10977
|
-
name: `metadata.${index}.key`,
|
|
10978
|
-
render: ({ field: field2 }) => {
|
|
10979
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10980
|
-
GridInput,
|
|
10981
|
-
{
|
|
10982
|
-
"aria-labelledby": METADATA_KEY_LABEL_ID,
|
|
10983
|
-
...field2,
|
|
10984
|
-
disabled: isDisabled,
|
|
10985
|
-
placeholder: "Key"
|
|
10986
|
-
}
|
|
10987
|
-
) }) });
|
|
10988
|
-
}
|
|
10989
|
-
}
|
|
10990
|
-
),
|
|
10991
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10992
|
-
Form$2.Field,
|
|
10993
|
-
{
|
|
10994
|
-
control: form.control,
|
|
10995
|
-
name: `metadata.${index}.value`,
|
|
10996
|
-
render: ({ field: { value, ...field2 } }) => {
|
|
10997
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10998
|
-
GridInput,
|
|
10999
|
-
{
|
|
11000
|
-
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
11001
|
-
...field2,
|
|
11002
|
-
value: isDisabled ? placeholder : value,
|
|
11003
|
-
disabled: isDisabled,
|
|
11004
|
-
placeholder: "Value"
|
|
11005
|
-
}
|
|
11006
|
-
) }) });
|
|
11007
|
-
}
|
|
11008
|
-
}
|
|
11009
|
-
)
|
|
11010
|
-
]
|
|
11011
|
-
}
|
|
11012
|
-
),
|
|
11013
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
11014
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11015
|
-
ui.DropdownMenu.Trigger,
|
|
11016
|
-
{
|
|
11017
|
-
className: ui.clx(
|
|
11018
|
-
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
11019
|
-
{
|
|
11020
|
-
hidden: isDisabled
|
|
11021
|
-
}
|
|
11022
|
-
),
|
|
11023
|
-
disabled: isDisabled,
|
|
11024
|
-
asChild: true,
|
|
11025
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
|
|
11026
|
-
}
|
|
11027
|
-
),
|
|
11028
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
|
|
11029
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11030
|
-
ui.DropdownMenu.Item,
|
|
11031
|
-
{
|
|
11032
|
-
className: "gap-x-2",
|
|
11033
|
-
onClick: () => insertRow(index, "above"),
|
|
11034
|
-
children: [
|
|
11035
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
11036
|
-
"Insert row above"
|
|
11037
|
-
]
|
|
11038
|
-
}
|
|
11039
|
-
),
|
|
11040
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11041
|
-
ui.DropdownMenu.Item,
|
|
11042
|
-
{
|
|
11043
|
-
className: "gap-x-2",
|
|
11044
|
-
onClick: () => insertRow(index, "below"),
|
|
11045
|
-
children: [
|
|
11046
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
11047
|
-
"Insert row below"
|
|
11048
|
-
]
|
|
11049
|
-
}
|
|
11050
|
-
),
|
|
11051
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
|
|
11052
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11053
|
-
ui.DropdownMenu.Item,
|
|
11054
|
-
{
|
|
11055
|
-
className: "gap-x-2",
|
|
11056
|
-
onClick: () => deleteRow(index),
|
|
11057
|
-
children: [
|
|
11058
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
|
|
11059
|
-
"Delete row"
|
|
11060
|
-
]
|
|
11061
|
-
}
|
|
11062
|
-
)
|
|
11063
|
-
] })
|
|
11064
|
-
] })
|
|
11065
|
-
] })
|
|
11066
|
-
},
|
|
11067
|
-
field.id
|
|
11068
|
-
);
|
|
11069
|
-
})
|
|
11070
|
-
] }),
|
|
11071
|
-
hasUneditableRows && /* @__PURE__ */ jsxRuntime.jsx(InlineTip, { variant: "warning", label: "Some rows are disabled", children: "This object contains non-primitive metadata, such as arrays or objects, that can't be edited here. To edit the disabled rows, use the API directly." })
|
|
10862
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
10863
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
10864
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
10865
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
10866
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
10867
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Hint, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
11072
10868
|
] }),
|
|
11073
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11074
|
-
|
|
11075
|
-
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
10869
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10870
|
+
Combobox,
|
|
10871
|
+
{
|
|
10872
|
+
id: "promotion-combobox",
|
|
10873
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
10874
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
10875
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
10876
|
+
options: comboboxData.options,
|
|
10877
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
10878
|
+
searchValue: comboboxData.searchValue,
|
|
10879
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
10880
|
+
onChange: add,
|
|
10881
|
+
value: comboboxValue
|
|
10882
|
+
}
|
|
10883
|
+
)
|
|
10884
|
+
] }),
|
|
10885
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
10886
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10887
|
+
PromotionItem,
|
|
10888
|
+
{
|
|
10889
|
+
promotion,
|
|
10890
|
+
orderId: preview.id,
|
|
10891
|
+
isLoading: isPending
|
|
10892
|
+
},
|
|
10893
|
+
promotion.id
|
|
10894
|
+
)) })
|
|
10895
|
+
] }) }),
|
|
10896
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10897
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10898
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10899
|
+
ui.Button,
|
|
10900
|
+
{
|
|
10901
|
+
size: "small",
|
|
10902
|
+
type: "submit",
|
|
10903
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
10904
|
+
children: "Save"
|
|
10905
|
+
}
|
|
11091
10906
|
)
|
|
11092
|
-
}
|
|
11093
|
-
);
|
|
11094
|
-
});
|
|
11095
|
-
GridInput.displayName = "MetadataForm.GridInput";
|
|
11096
|
-
const PlaceholderInner = () => {
|
|
11097
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
11098
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
11099
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
11100
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
11101
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
11102
10907
|
] }) })
|
|
11103
10908
|
] });
|
|
11104
10909
|
};
|
|
11105
|
-
const
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
];
|
|
11115
|
-
}
|
|
11116
|
-
return Object.entries(metadata).map(([key, value]) => {
|
|
11117
|
-
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
11118
|
-
return {
|
|
11119
|
-
key,
|
|
11120
|
-
value,
|
|
11121
|
-
disabled: true
|
|
11122
|
-
};
|
|
11123
|
-
}
|
|
11124
|
-
let stringValue = value;
|
|
11125
|
-
if (typeof value !== "string") {
|
|
11126
|
-
stringValue = JSON.stringify(value);
|
|
11127
|
-
}
|
|
11128
|
-
return {
|
|
11129
|
-
key,
|
|
11130
|
-
value: stringValue,
|
|
11131
|
-
original_key: key
|
|
11132
|
-
};
|
|
11133
|
-
});
|
|
11134
|
-
}
|
|
11135
|
-
function parseValues(values) {
|
|
11136
|
-
const metadata = values.metadata;
|
|
11137
|
-
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
11138
|
-
if (isEmpty) {
|
|
11139
|
-
return null;
|
|
11140
|
-
}
|
|
11141
|
-
const update = {};
|
|
11142
|
-
metadata.forEach((field) => {
|
|
11143
|
-
let key = field.key;
|
|
11144
|
-
let value = field.value;
|
|
11145
|
-
const disabled = field.disabled;
|
|
11146
|
-
if (!key || !value) {
|
|
11147
|
-
return;
|
|
11148
|
-
}
|
|
11149
|
-
if (disabled) {
|
|
11150
|
-
update[key] = value;
|
|
11151
|
-
return;
|
|
11152
|
-
}
|
|
11153
|
-
key = key.trim();
|
|
11154
|
-
value = value.trim();
|
|
11155
|
-
if (value === "true") {
|
|
11156
|
-
update[key] = true;
|
|
11157
|
-
} else if (value === "false") {
|
|
11158
|
-
update[key] = false;
|
|
11159
|
-
} else {
|
|
11160
|
-
const parsedNumber = parseFloat(value);
|
|
11161
|
-
if (!isNaN(parsedNumber)) {
|
|
11162
|
-
update[key] = parsedNumber;
|
|
11163
|
-
} else {
|
|
11164
|
-
update[key] = value;
|
|
11165
|
-
}
|
|
11166
|
-
}
|
|
11167
|
-
});
|
|
11168
|
-
return update;
|
|
11169
|
-
}
|
|
11170
|
-
function getHasUneditableRows(metadata) {
|
|
11171
|
-
if (!metadata) {
|
|
11172
|
-
return false;
|
|
11173
|
-
}
|
|
11174
|
-
return Object.values(metadata).some(
|
|
11175
|
-
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11176
|
-
);
|
|
11177
|
-
}
|
|
11178
|
-
const PROMOTION_QUERY_KEY = "promotions";
|
|
11179
|
-
const promotionsQueryKeys = {
|
|
11180
|
-
list: (query2) => [
|
|
11181
|
-
PROMOTION_QUERY_KEY,
|
|
11182
|
-
query2 ? query2 : void 0
|
|
11183
|
-
],
|
|
11184
|
-
detail: (id, query2) => [
|
|
11185
|
-
PROMOTION_QUERY_KEY,
|
|
11186
|
-
id,
|
|
11187
|
-
query2 ? query2 : void 0
|
|
11188
|
-
]
|
|
11189
|
-
};
|
|
11190
|
-
const usePromotions = (query2, options) => {
|
|
11191
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
11192
|
-
queryKey: promotionsQueryKeys.list(query2),
|
|
11193
|
-
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
11194
|
-
...options
|
|
11195
|
-
});
|
|
11196
|
-
return { ...data, ...rest };
|
|
11197
|
-
};
|
|
11198
|
-
const Promotions = () => {
|
|
11199
|
-
const { id } = reactRouterDom.useParams();
|
|
11200
|
-
const {
|
|
11201
|
-
order: preview,
|
|
11202
|
-
isError: isPreviewError,
|
|
11203
|
-
error: previewError
|
|
11204
|
-
} = useOrderPreview(id, void 0);
|
|
11205
|
-
useInitiateOrderEdit({ preview });
|
|
11206
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
11207
|
-
if (isPreviewError) {
|
|
11208
|
-
throw previewError;
|
|
11209
|
-
}
|
|
11210
|
-
const isReady = !!preview;
|
|
11211
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
11212
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Promotions" }) }) }),
|
|
11213
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(PromotionForm, { preview })
|
|
11214
|
-
] });
|
|
11215
|
-
};
|
|
11216
|
-
const PromotionForm = ({ preview }) => {
|
|
11217
|
-
const { items, shipping_methods } = preview;
|
|
11218
|
-
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
11219
|
-
const [comboboxValue, setComboboxValue] = React.useState("");
|
|
11220
|
-
const { handleSuccess } = useRouteModal();
|
|
11221
|
-
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
11222
|
-
const promoIds = getPromotionIds(items, shipping_methods);
|
|
11223
|
-
const { promotions, isPending, isError, error } = usePromotions(
|
|
11224
|
-
{
|
|
11225
|
-
id: promoIds
|
|
11226
|
-
},
|
|
11227
|
-
{
|
|
11228
|
-
enabled: !!promoIds.length
|
|
11229
|
-
}
|
|
11230
|
-
);
|
|
11231
|
-
const comboboxData = useComboboxData({
|
|
11232
|
-
queryKey: ["promotions", "combobox", promoIds],
|
|
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(
|
|
10910
|
+
const PromotionItem = ({
|
|
10911
|
+
promotion,
|
|
10912
|
+
orderId,
|
|
10913
|
+
isLoading
|
|
10914
|
+
}) => {
|
|
10915
|
+
var _a;
|
|
10916
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
10917
|
+
const onRemove = async () => {
|
|
10918
|
+
removePromotions(
|
|
11358
10919
|
{
|
|
11359
10920
|
promo_codes: [promotion.code]
|
|
11360
10921
|
},
|
|
@@ -11452,15 +11013,83 @@ function getPromotionIds(items, shippingMethods) {
|
|
|
11452
11013
|
}
|
|
11453
11014
|
return Array.from(promotionIds);
|
|
11454
11015
|
}
|
|
11455
|
-
const
|
|
11016
|
+
const Email = () => {
|
|
11456
11017
|
const { id } = reactRouterDom.useParams();
|
|
11457
|
-
const {
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11018
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
11019
|
+
fields: "+email"
|
|
11020
|
+
});
|
|
11021
|
+
if (isError) {
|
|
11022
|
+
throw error;
|
|
11023
|
+
}
|
|
11024
|
+
const isReady = !isPending && !!order;
|
|
11025
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
11026
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
11027
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Email" }) }),
|
|
11028
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the email for the draft order" }) })
|
|
11029
|
+
] }),
|
|
11030
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(EmailForm, { order })
|
|
11031
|
+
] });
|
|
11032
|
+
};
|
|
11033
|
+
const EmailForm = ({ order }) => {
|
|
11034
|
+
const form = reactHookForm.useForm({
|
|
11035
|
+
defaultValues: {
|
|
11036
|
+
email: order.email ?? ""
|
|
11037
|
+
},
|
|
11038
|
+
resolver: zod.zodResolver(schema$4)
|
|
11039
|
+
});
|
|
11040
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11041
|
+
const { handleSuccess } = useRouteModal();
|
|
11042
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
11043
|
+
await mutateAsync(
|
|
11044
|
+
{ email: data.email },
|
|
11045
|
+
{
|
|
11046
|
+
onSuccess: () => {
|
|
11047
|
+
handleSuccess();
|
|
11048
|
+
},
|
|
11049
|
+
onError: (error) => {
|
|
11050
|
+
ui.toast.error(error.message);
|
|
11051
|
+
}
|
|
11052
|
+
}
|
|
11053
|
+
);
|
|
11054
|
+
});
|
|
11055
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11056
|
+
KeyboundForm,
|
|
11057
|
+
{
|
|
11058
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
11059
|
+
onSubmit,
|
|
11060
|
+
children: [
|
|
11061
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11062
|
+
Form$2.Field,
|
|
11063
|
+
{
|
|
11064
|
+
control: form.control,
|
|
11065
|
+
name: "email",
|
|
11066
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
11067
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Email" }),
|
|
11068
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field }) }),
|
|
11069
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
11070
|
+
] })
|
|
11071
|
+
}
|
|
11072
|
+
) }),
|
|
11073
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11074
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11075
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
11076
|
+
] }) })
|
|
11077
|
+
]
|
|
11078
|
+
}
|
|
11079
|
+
) });
|
|
11080
|
+
};
|
|
11081
|
+
const schema$4 = objectType({
|
|
11082
|
+
email: stringType().email()
|
|
11083
|
+
});
|
|
11084
|
+
const SalesChannel = () => {
|
|
11085
|
+
const { id } = reactRouterDom.useParams();
|
|
11086
|
+
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
11087
|
+
id,
|
|
11088
|
+
{
|
|
11089
|
+
fields: "+sales_channel_id"
|
|
11090
|
+
},
|
|
11091
|
+
{
|
|
11092
|
+
enabled: !!id
|
|
11464
11093
|
}
|
|
11465
11094
|
);
|
|
11466
11095
|
if (isError) {
|
|
@@ -11480,7 +11109,7 @@ const SalesChannelForm = ({ order }) => {
|
|
|
11480
11109
|
defaultValues: {
|
|
11481
11110
|
sales_channel_id: order.sales_channel_id || ""
|
|
11482
11111
|
},
|
|
11483
|
-
resolver: zod.zodResolver(schema$
|
|
11112
|
+
resolver: zod.zodResolver(schema$3)
|
|
11484
11113
|
});
|
|
11485
11114
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11486
11115
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11555,7 +11184,7 @@ const SalesChannelField = ({ control, order }) => {
|
|
|
11555
11184
|
}
|
|
11556
11185
|
);
|
|
11557
11186
|
};
|
|
11558
|
-
const schema$
|
|
11187
|
+
const schema$3 = objectType({
|
|
11559
11188
|
sales_channel_id: stringType().min(1)
|
|
11560
11189
|
});
|
|
11561
11190
|
const ShippingAddress = () => {
|
|
@@ -11590,7 +11219,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11590
11219
|
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
11591
11220
|
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
11592
11221
|
},
|
|
11593
|
-
resolver: zod.zodResolver(schema$
|
|
11222
|
+
resolver: zod.zodResolver(schema$2)
|
|
11594
11223
|
});
|
|
11595
11224
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
11596
11225
|
const { handleSuccess } = useRouteModal();
|
|
@@ -11760,7 +11389,7 @@ const ShippingAddressForm = ({ order }) => {
|
|
|
11760
11389
|
}
|
|
11761
11390
|
) });
|
|
11762
11391
|
};
|
|
11763
|
-
const schema$
|
|
11392
|
+
const schema$2 = addressSchema;
|
|
11764
11393
|
const STACKED_FOCUS_MODAL_ID = "shipping-form";
|
|
11765
11394
|
const Shipping = () => {
|
|
11766
11395
|
var _a;
|
|
@@ -12445,129 +12074,500 @@ const LocationField = ({ control, setValue }) => {
|
|
|
12445
12074
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Location" }),
|
|
12446
12075
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Choose where you want to ship the items from." })
|
|
12447
12076
|
] }),
|
|
12448
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12449
|
-
Combobox,
|
|
12450
|
-
{
|
|
12451
|
-
options: locations.options,
|
|
12452
|
-
fetchNextPage: locations.fetchNextPage,
|
|
12453
|
-
isFetchingNextPage: locations.isFetchingNextPage,
|
|
12454
|
-
searchValue: locations.searchValue,
|
|
12455
|
-
onSearchValueChange: locations.onSearchValueChange,
|
|
12456
|
-
placeholder: "Select location",
|
|
12457
|
-
onChange: (value) => {
|
|
12458
|
-
setValue("shipping_option_id", "", {
|
|
12459
|
-
shouldDirty: true,
|
|
12460
|
-
shouldTouch: true
|
|
12461
|
-
});
|
|
12462
|
-
onChange(value);
|
|
12463
|
-
},
|
|
12464
|
-
...field
|
|
12465
|
-
}
|
|
12466
|
-
) })
|
|
12467
|
-
] }) });
|
|
12468
|
-
}
|
|
12077
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12078
|
+
Combobox,
|
|
12079
|
+
{
|
|
12080
|
+
options: locations.options,
|
|
12081
|
+
fetchNextPage: locations.fetchNextPage,
|
|
12082
|
+
isFetchingNextPage: locations.isFetchingNextPage,
|
|
12083
|
+
searchValue: locations.searchValue,
|
|
12084
|
+
onSearchValueChange: locations.onSearchValueChange,
|
|
12085
|
+
placeholder: "Select location",
|
|
12086
|
+
onChange: (value) => {
|
|
12087
|
+
setValue("shipping_option_id", "", {
|
|
12088
|
+
shouldDirty: true,
|
|
12089
|
+
shouldTouch: true
|
|
12090
|
+
});
|
|
12091
|
+
onChange(value);
|
|
12092
|
+
},
|
|
12093
|
+
...field
|
|
12094
|
+
}
|
|
12095
|
+
) })
|
|
12096
|
+
] }) });
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
);
|
|
12100
|
+
};
|
|
12101
|
+
const ShippingOptionField = ({
|
|
12102
|
+
shippingProfileId,
|
|
12103
|
+
preview,
|
|
12104
|
+
control
|
|
12105
|
+
}) => {
|
|
12106
|
+
var _a;
|
|
12107
|
+
const locationId = reactHookForm.useWatch({ control, name: "location_id" });
|
|
12108
|
+
const shippingOptions = useComboboxData({
|
|
12109
|
+
queryKey: ["shipping_options", locationId, shippingProfileId],
|
|
12110
|
+
queryFn: async (params) => {
|
|
12111
|
+
return await sdk.admin.shippingOption.list({
|
|
12112
|
+
...params,
|
|
12113
|
+
stock_location_id: locationId,
|
|
12114
|
+
shipping_profile_id: shippingProfileId
|
|
12115
|
+
});
|
|
12116
|
+
},
|
|
12117
|
+
getOptions: (data) => {
|
|
12118
|
+
return data.shipping_options.map((option) => {
|
|
12119
|
+
var _a2;
|
|
12120
|
+
if ((_a2 = option.rules) == null ? void 0 : _a2.find(
|
|
12121
|
+
(r) => r.attribute === "is_return" && r.value === "true"
|
|
12122
|
+
)) {
|
|
12123
|
+
return void 0;
|
|
12124
|
+
}
|
|
12125
|
+
return {
|
|
12126
|
+
label: option.name,
|
|
12127
|
+
value: option.id
|
|
12128
|
+
};
|
|
12129
|
+
}).filter(Boolean);
|
|
12130
|
+
},
|
|
12131
|
+
enabled: !!locationId && !!shippingProfileId,
|
|
12132
|
+
defaultValue: ((_a = preview.shipping_methods[0]) == null ? void 0 : _a.shipping_option_id) || void 0
|
|
12133
|
+
});
|
|
12134
|
+
const tooltipContent = !locationId && !shippingProfileId ? "Choose a location and shipping profile first." : !locationId ? "Choose a location first." : "Choose a shipping profile first.";
|
|
12135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12136
|
+
Form$2.Field,
|
|
12137
|
+
{
|
|
12138
|
+
control,
|
|
12139
|
+
name: "shipping_option_id",
|
|
12140
|
+
render: ({ field }) => {
|
|
12141
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
12142
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
12143
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Shipping option" }),
|
|
12144
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Choose the shipping option to use." })
|
|
12145
|
+
] }),
|
|
12146
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12147
|
+
ConditionalTooltip,
|
|
12148
|
+
{
|
|
12149
|
+
content: tooltipContent,
|
|
12150
|
+
showTooltip: !locationId || !shippingProfileId,
|
|
12151
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12152
|
+
Combobox,
|
|
12153
|
+
{
|
|
12154
|
+
options: shippingOptions.options,
|
|
12155
|
+
fetchNextPage: shippingOptions.fetchNextPage,
|
|
12156
|
+
isFetchingNextPage: shippingOptions.isFetchingNextPage,
|
|
12157
|
+
searchValue: shippingOptions.searchValue,
|
|
12158
|
+
onSearchValueChange: shippingOptions.onSearchValueChange,
|
|
12159
|
+
placeholder: "Select shipping option",
|
|
12160
|
+
...field,
|
|
12161
|
+
disabled: !locationId || !shippingProfileId
|
|
12162
|
+
}
|
|
12163
|
+
) }) })
|
|
12164
|
+
}
|
|
12165
|
+
)
|
|
12166
|
+
] }) });
|
|
12167
|
+
}
|
|
12168
|
+
}
|
|
12169
|
+
);
|
|
12170
|
+
};
|
|
12171
|
+
const CustomAmountField = ({
|
|
12172
|
+
control,
|
|
12173
|
+
currencyCode
|
|
12174
|
+
}) => {
|
|
12175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12176
|
+
Form$2.Field,
|
|
12177
|
+
{
|
|
12178
|
+
control,
|
|
12179
|
+
name: "custom_amount",
|
|
12180
|
+
render: ({ field: { onChange, ...field } }) => {
|
|
12181
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-x-3", children: [
|
|
12182
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
12183
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { optional: true, children: "Custom amount" }),
|
|
12184
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Hint, { children: "Set a custom amount for the shipping option." })
|
|
12185
|
+
] }),
|
|
12186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12187
|
+
ui.CurrencyInput,
|
|
12188
|
+
{
|
|
12189
|
+
...field,
|
|
12190
|
+
onValueChange: (value) => onChange(value),
|
|
12191
|
+
symbol: getNativeSymbol(currencyCode),
|
|
12192
|
+
code: currencyCode
|
|
12193
|
+
}
|
|
12194
|
+
) })
|
|
12195
|
+
] });
|
|
12196
|
+
}
|
|
12197
|
+
}
|
|
12198
|
+
);
|
|
12199
|
+
};
|
|
12200
|
+
const InlineTip = React.forwardRef(
|
|
12201
|
+
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
12202
|
+
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
12203
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12204
|
+
"div",
|
|
12205
|
+
{
|
|
12206
|
+
ref,
|
|
12207
|
+
className: ui.clx(
|
|
12208
|
+
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
12209
|
+
className
|
|
12210
|
+
),
|
|
12211
|
+
...props,
|
|
12212
|
+
children: [
|
|
12213
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12214
|
+
"div",
|
|
12215
|
+
{
|
|
12216
|
+
role: "presentation",
|
|
12217
|
+
className: ui.clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
12218
|
+
"bg-ui-tag-orange-icon": variant === "warning"
|
|
12219
|
+
})
|
|
12220
|
+
}
|
|
12221
|
+
),
|
|
12222
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-pretty", children: [
|
|
12223
|
+
/* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
12224
|
+
labelValue,
|
|
12225
|
+
":"
|
|
12226
|
+
] }),
|
|
12227
|
+
" ",
|
|
12228
|
+
children
|
|
12229
|
+
] })
|
|
12230
|
+
]
|
|
12231
|
+
}
|
|
12232
|
+
);
|
|
12233
|
+
}
|
|
12234
|
+
);
|
|
12235
|
+
InlineTip.displayName = "InlineTip";
|
|
12236
|
+
const MetadataFieldSchema = objectType({
|
|
12237
|
+
key: stringType(),
|
|
12238
|
+
disabled: booleanType().optional(),
|
|
12239
|
+
value: anyType()
|
|
12240
|
+
});
|
|
12241
|
+
const MetadataSchema = objectType({
|
|
12242
|
+
metadata: arrayType(MetadataFieldSchema)
|
|
12243
|
+
});
|
|
12244
|
+
const Metadata = () => {
|
|
12245
|
+
const { id } = reactRouterDom.useParams();
|
|
12246
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12247
|
+
fields: "metadata"
|
|
12248
|
+
});
|
|
12249
|
+
if (isError) {
|
|
12250
|
+
throw error;
|
|
12251
|
+
}
|
|
12252
|
+
const isReady = !isPending && !!order;
|
|
12253
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12254
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
12255
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Metadata" }) }),
|
|
12256
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
12257
|
+
] }),
|
|
12258
|
+
!isReady ? /* @__PURE__ */ jsxRuntime.jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsxRuntime.jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
12259
|
+
] });
|
|
12260
|
+
};
|
|
12261
|
+
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
12262
|
+
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
12263
|
+
const MetadataForm = ({ orderId, metadata }) => {
|
|
12264
|
+
const { handleSuccess } = useRouteModal();
|
|
12265
|
+
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
12266
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
12267
|
+
const form = reactHookForm.useForm({
|
|
12268
|
+
defaultValues: {
|
|
12269
|
+
metadata: getDefaultValues(metadata)
|
|
12270
|
+
},
|
|
12271
|
+
resolver: zod.zodResolver(MetadataSchema)
|
|
12272
|
+
});
|
|
12273
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
12274
|
+
const parsedData = parseValues(data);
|
|
12275
|
+
await mutateAsync(
|
|
12276
|
+
{
|
|
12277
|
+
metadata: parsedData
|
|
12278
|
+
},
|
|
12279
|
+
{
|
|
12280
|
+
onSuccess: () => {
|
|
12281
|
+
ui.toast.success("Metadata updated");
|
|
12282
|
+
handleSuccess();
|
|
12283
|
+
},
|
|
12284
|
+
onError: (error) => {
|
|
12285
|
+
ui.toast.error(error.message);
|
|
12286
|
+
}
|
|
12287
|
+
}
|
|
12288
|
+
);
|
|
12289
|
+
});
|
|
12290
|
+
const { fields, insert, remove } = reactHookForm.useFieldArray({
|
|
12291
|
+
control: form.control,
|
|
12292
|
+
name: "metadata"
|
|
12293
|
+
});
|
|
12294
|
+
function deleteRow(index) {
|
|
12295
|
+
remove(index);
|
|
12296
|
+
if (fields.length === 1) {
|
|
12297
|
+
insert(0, {
|
|
12298
|
+
key: "",
|
|
12299
|
+
value: "",
|
|
12300
|
+
disabled: false
|
|
12301
|
+
});
|
|
12302
|
+
}
|
|
12303
|
+
}
|
|
12304
|
+
function insertRow(index, position) {
|
|
12305
|
+
insert(index + (position === "above" ? 0 : 1), {
|
|
12306
|
+
key: "",
|
|
12307
|
+
value: "",
|
|
12308
|
+
disabled: false
|
|
12309
|
+
});
|
|
12310
|
+
}
|
|
12311
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12312
|
+
KeyboundForm,
|
|
12313
|
+
{
|
|
12314
|
+
onSubmit: handleSubmit,
|
|
12315
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12316
|
+
children: [
|
|
12317
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: [
|
|
12318
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-base shadow-elevation-card-rest grid grid-cols-1 divide-y rounded-lg", children: [
|
|
12319
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle grid grid-cols-2 divide-x rounded-t-lg", children: [
|
|
12320
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_KEY_LABEL_ID, children: "Key" }) }),
|
|
12321
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "txt-compact-small-plus text-ui-fg-subtle px-2 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsx("label", { id: METADATA_VALUE_LABEL_ID, children: "Value" }) })
|
|
12322
|
+
] }),
|
|
12323
|
+
fields.map((field, index) => {
|
|
12324
|
+
const isDisabled = field.disabled || false;
|
|
12325
|
+
let placeholder = "-";
|
|
12326
|
+
if (typeof field.value === "object") {
|
|
12327
|
+
placeholder = "{ ... }";
|
|
12328
|
+
}
|
|
12329
|
+
if (Array.isArray(field.value)) {
|
|
12330
|
+
placeholder = "[ ... ]";
|
|
12331
|
+
}
|
|
12332
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12333
|
+
ConditionalTooltip,
|
|
12334
|
+
{
|
|
12335
|
+
showTooltip: isDisabled,
|
|
12336
|
+
content: "This row is disabled because it contains non-primitive data.",
|
|
12337
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/table relative", children: [
|
|
12338
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12339
|
+
"div",
|
|
12340
|
+
{
|
|
12341
|
+
className: ui.clx("grid grid-cols-2 divide-x", {
|
|
12342
|
+
"overflow-hidden rounded-b-lg": index === fields.length - 1
|
|
12343
|
+
}),
|
|
12344
|
+
children: [
|
|
12345
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12346
|
+
Form$2.Field,
|
|
12347
|
+
{
|
|
12348
|
+
control: form.control,
|
|
12349
|
+
name: `metadata.${index}.key`,
|
|
12350
|
+
render: ({ field: field2 }) => {
|
|
12351
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12352
|
+
GridInput,
|
|
12353
|
+
{
|
|
12354
|
+
"aria-labelledby": METADATA_KEY_LABEL_ID,
|
|
12355
|
+
...field2,
|
|
12356
|
+
disabled: isDisabled,
|
|
12357
|
+
placeholder: "Key"
|
|
12358
|
+
}
|
|
12359
|
+
) }) });
|
|
12360
|
+
}
|
|
12361
|
+
}
|
|
12362
|
+
),
|
|
12363
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12364
|
+
Form$2.Field,
|
|
12365
|
+
{
|
|
12366
|
+
control: form.control,
|
|
12367
|
+
name: `metadata.${index}.value`,
|
|
12368
|
+
render: ({ field: { value, ...field2 } }) => {
|
|
12369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Form$2.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12370
|
+
GridInput,
|
|
12371
|
+
{
|
|
12372
|
+
"aria-labelledby": METADATA_VALUE_LABEL_ID,
|
|
12373
|
+
...field2,
|
|
12374
|
+
value: isDisabled ? placeholder : value,
|
|
12375
|
+
disabled: isDisabled,
|
|
12376
|
+
placeholder: "Value"
|
|
12377
|
+
}
|
|
12378
|
+
) }) });
|
|
12379
|
+
}
|
|
12380
|
+
}
|
|
12381
|
+
)
|
|
12382
|
+
]
|
|
12383
|
+
}
|
|
12384
|
+
),
|
|
12385
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
12386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12387
|
+
ui.DropdownMenu.Trigger,
|
|
12388
|
+
{
|
|
12389
|
+
className: ui.clx(
|
|
12390
|
+
"invisible absolute inset-y-0 -right-2.5 my-auto group-hover/table:visible data-[state='open']:visible",
|
|
12391
|
+
{
|
|
12392
|
+
hidden: isDisabled
|
|
12393
|
+
}
|
|
12394
|
+
),
|
|
12395
|
+
disabled: isDisabled,
|
|
12396
|
+
asChild: true,
|
|
12397
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "2xsmall", children: /* @__PURE__ */ jsxRuntime.jsx(icons.EllipsisVertical, {}) })
|
|
12398
|
+
}
|
|
12399
|
+
),
|
|
12400
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu.Content, { children: [
|
|
12401
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12402
|
+
ui.DropdownMenu.Item,
|
|
12403
|
+
{
|
|
12404
|
+
className: "gap-x-2",
|
|
12405
|
+
onClick: () => insertRow(index, "above"),
|
|
12406
|
+
children: [
|
|
12407
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowUpMini, { className: "text-ui-fg-subtle" }),
|
|
12408
|
+
"Insert row above"
|
|
12409
|
+
]
|
|
12410
|
+
}
|
|
12411
|
+
),
|
|
12412
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12413
|
+
ui.DropdownMenu.Item,
|
|
12414
|
+
{
|
|
12415
|
+
className: "gap-x-2",
|
|
12416
|
+
onClick: () => insertRow(index, "below"),
|
|
12417
|
+
children: [
|
|
12418
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownMini, { className: "text-ui-fg-subtle" }),
|
|
12419
|
+
"Insert row below"
|
|
12420
|
+
]
|
|
12421
|
+
}
|
|
12422
|
+
),
|
|
12423
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenu.Separator, {}),
|
|
12424
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12425
|
+
ui.DropdownMenu.Item,
|
|
12426
|
+
{
|
|
12427
|
+
className: "gap-x-2",
|
|
12428
|
+
onClick: () => deleteRow(index),
|
|
12429
|
+
children: [
|
|
12430
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "text-ui-fg-subtle" }),
|
|
12431
|
+
"Delete row"
|
|
12432
|
+
]
|
|
12433
|
+
}
|
|
12434
|
+
)
|
|
12435
|
+
] })
|
|
12436
|
+
] })
|
|
12437
|
+
] })
|
|
12438
|
+
},
|
|
12439
|
+
field.id
|
|
12440
|
+
);
|
|
12441
|
+
})
|
|
12442
|
+
] }),
|
|
12443
|
+
hasUneditableRows && /* @__PURE__ */ jsxRuntime.jsx(InlineTip, { variant: "warning", label: "Some rows are disabled", children: "This object contains non-primitive metadata, such as arrays or objects, that can't be edited here. To edit the disabled rows, use the API directly." })
|
|
12444
|
+
] }),
|
|
12445
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
12446
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
12447
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12448
|
+
] }) })
|
|
12449
|
+
]
|
|
12469
12450
|
}
|
|
12470
|
-
);
|
|
12451
|
+
) });
|
|
12471
12452
|
};
|
|
12472
|
-
const
|
|
12473
|
-
shippingProfileId,
|
|
12474
|
-
preview,
|
|
12475
|
-
control
|
|
12476
|
-
}) => {
|
|
12477
|
-
var _a;
|
|
12478
|
-
const locationId = reactHookForm.useWatch({ control, name: "location_id" });
|
|
12479
|
-
const shippingOptions = useComboboxData({
|
|
12480
|
-
queryKey: ["shipping_options", locationId, shippingProfileId],
|
|
12481
|
-
queryFn: async (params) => {
|
|
12482
|
-
return await sdk.admin.shippingOption.list({
|
|
12483
|
-
...params,
|
|
12484
|
-
stock_location_id: locationId,
|
|
12485
|
-
shipping_profile_id: shippingProfileId
|
|
12486
|
-
});
|
|
12487
|
-
},
|
|
12488
|
-
getOptions: (data) => {
|
|
12489
|
-
return data.shipping_options.map((option) => {
|
|
12490
|
-
var _a2;
|
|
12491
|
-
if ((_a2 = option.rules) == null ? void 0 : _a2.find(
|
|
12492
|
-
(r) => r.attribute === "is_return" && r.value === "true"
|
|
12493
|
-
)) {
|
|
12494
|
-
return void 0;
|
|
12495
|
-
}
|
|
12496
|
-
return {
|
|
12497
|
-
label: option.name,
|
|
12498
|
-
value: option.id
|
|
12499
|
-
};
|
|
12500
|
-
}).filter(Boolean);
|
|
12501
|
-
},
|
|
12502
|
-
enabled: !!locationId && !!shippingProfileId,
|
|
12503
|
-
defaultValue: ((_a = preview.shipping_methods[0]) == null ? void 0 : _a.shipping_option_id) || void 0
|
|
12504
|
-
});
|
|
12505
|
-
const tooltipContent = !locationId && !shippingProfileId ? "Choose a location and shipping profile first." : !locationId ? "Choose a location first." : "Choose a shipping profile first.";
|
|
12453
|
+
const GridInput = React.forwardRef(({ className, ...props }, ref) => {
|
|
12506
12454
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12507
|
-
|
|
12455
|
+
"input",
|
|
12508
12456
|
{
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
] }),
|
|
12517
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12518
|
-
ConditionalTooltip,
|
|
12519
|
-
{
|
|
12520
|
-
content: tooltipContent,
|
|
12521
|
-
showTooltip: !locationId || !shippingProfileId,
|
|
12522
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12523
|
-
Combobox,
|
|
12524
|
-
{
|
|
12525
|
-
options: shippingOptions.options,
|
|
12526
|
-
fetchNextPage: shippingOptions.fetchNextPage,
|
|
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
|
-
) }) })
|
|
12535
|
-
}
|
|
12536
|
-
)
|
|
12537
|
-
] }) });
|
|
12538
|
-
}
|
|
12457
|
+
ref,
|
|
12458
|
+
...props,
|
|
12459
|
+
autoComplete: "off",
|
|
12460
|
+
className: ui.clx(
|
|
12461
|
+
"txt-compact-small text-ui-fg-base placeholder:text-ui-fg-muted disabled:text-ui-fg-disabled disabled:bg-ui-bg-base bg-transparent px-2 py-1.5 outline-none",
|
|
12462
|
+
className
|
|
12463
|
+
)
|
|
12539
12464
|
}
|
|
12540
12465
|
);
|
|
12466
|
+
});
|
|
12467
|
+
GridInput.displayName = "MetadataForm.GridInput";
|
|
12468
|
+
const PlaceholderInner = () => {
|
|
12469
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
12470
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-[148ox] w-full rounded-lg" }) }),
|
|
12471
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
12472
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" }),
|
|
12473
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, { className: "h-7 w-12 rounded-md" })
|
|
12474
|
+
] }) })
|
|
12475
|
+
] });
|
|
12541
12476
|
};
|
|
12542
|
-
const
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
|
|
12477
|
+
const EDITABLE_TYPES = ["string", "number", "boolean"];
|
|
12478
|
+
function getDefaultValues(metadata) {
|
|
12479
|
+
if (!metadata || !Object.keys(metadata).length) {
|
|
12480
|
+
return [
|
|
12481
|
+
{
|
|
12482
|
+
key: "",
|
|
12483
|
+
value: "",
|
|
12484
|
+
disabled: false
|
|
12485
|
+
}
|
|
12486
|
+
];
|
|
12487
|
+
}
|
|
12488
|
+
return Object.entries(metadata).map(([key, value]) => {
|
|
12489
|
+
if (!EDITABLE_TYPES.includes(typeof value)) {
|
|
12490
|
+
return {
|
|
12491
|
+
key,
|
|
12492
|
+
value,
|
|
12493
|
+
disabled: true
|
|
12494
|
+
};
|
|
12495
|
+
}
|
|
12496
|
+
let stringValue = value;
|
|
12497
|
+
if (typeof value !== "string") {
|
|
12498
|
+
stringValue = JSON.stringify(value);
|
|
12499
|
+
}
|
|
12500
|
+
return {
|
|
12501
|
+
key,
|
|
12502
|
+
value: stringValue,
|
|
12503
|
+
original_key: key
|
|
12504
|
+
};
|
|
12505
|
+
});
|
|
12506
|
+
}
|
|
12507
|
+
function parseValues(values) {
|
|
12508
|
+
const metadata = values.metadata;
|
|
12509
|
+
const isEmpty = !metadata.length || metadata.length === 1 && !metadata[0].key && !metadata[0].value;
|
|
12510
|
+
if (isEmpty) {
|
|
12511
|
+
return null;
|
|
12512
|
+
}
|
|
12513
|
+
const update = {};
|
|
12514
|
+
metadata.forEach((field) => {
|
|
12515
|
+
let key = field.key;
|
|
12516
|
+
let value = field.value;
|
|
12517
|
+
const disabled = field.disabled;
|
|
12518
|
+
if (!key || !value) {
|
|
12519
|
+
return;
|
|
12520
|
+
}
|
|
12521
|
+
if (disabled) {
|
|
12522
|
+
update[key] = value;
|
|
12523
|
+
return;
|
|
12524
|
+
}
|
|
12525
|
+
key = key.trim();
|
|
12526
|
+
value = value.trim();
|
|
12527
|
+
if (value === "true") {
|
|
12528
|
+
update[key] = true;
|
|
12529
|
+
} else if (value === "false") {
|
|
12530
|
+
update[key] = false;
|
|
12531
|
+
} else {
|
|
12532
|
+
const parsedNumber = parseFloat(value);
|
|
12533
|
+
if (!isNaN(parsedNumber)) {
|
|
12534
|
+
update[key] = parsedNumber;
|
|
12535
|
+
} else {
|
|
12536
|
+
update[key] = value;
|
|
12567
12537
|
}
|
|
12568
12538
|
}
|
|
12539
|
+
});
|
|
12540
|
+
return update;
|
|
12541
|
+
}
|
|
12542
|
+
function getHasUneditableRows(metadata) {
|
|
12543
|
+
if (!metadata) {
|
|
12544
|
+
return false;
|
|
12545
|
+
}
|
|
12546
|
+
return Object.values(metadata).some(
|
|
12547
|
+
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
12569
12548
|
);
|
|
12549
|
+
}
|
|
12550
|
+
const CustomItems = () => {
|
|
12551
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
12552
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit Custom Items" }) }) }),
|
|
12553
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomItemsForm, {})
|
|
12554
|
+
] });
|
|
12555
|
+
};
|
|
12556
|
+
const CustomItemsForm = () => {
|
|
12557
|
+
const form = reactHookForm.useForm({
|
|
12558
|
+
resolver: zod.zodResolver(schema$1)
|
|
12559
|
+
});
|
|
12560
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
12561
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, {}),
|
|
12562
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12563
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12564
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", children: "Save" })
|
|
12565
|
+
] }) })
|
|
12566
|
+
] }) });
|
|
12570
12567
|
};
|
|
12568
|
+
const schema$1 = objectType({
|
|
12569
|
+
email: stringType().email()
|
|
12570
|
+
});
|
|
12571
12571
|
const TransferOwnership = () => {
|
|
12572
12572
|
const { id } = reactRouterDom.useParams();
|
|
12573
12573
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
@@ -13068,26 +13068,18 @@ const routeModule = {
|
|
|
13068
13068
|
Component: BillingAddress,
|
|
13069
13069
|
path: "/draft-orders/:id/billing-address"
|
|
13070
13070
|
},
|
|
13071
|
-
{
|
|
13072
|
-
Component: CustomItems,
|
|
13073
|
-
path: "/draft-orders/:id/custom-items"
|
|
13074
|
-
},
|
|
13075
|
-
{
|
|
13076
|
-
Component: Email,
|
|
13077
|
-
path: "/draft-orders/:id/email"
|
|
13078
|
-
},
|
|
13079
13071
|
{
|
|
13080
13072
|
Component: Items,
|
|
13081
13073
|
path: "/draft-orders/:id/items"
|
|
13082
13074
|
},
|
|
13083
|
-
{
|
|
13084
|
-
Component: Metadata,
|
|
13085
|
-
path: "/draft-orders/:id/metadata"
|
|
13086
|
-
},
|
|
13087
13075
|
{
|
|
13088
13076
|
Component: Promotions,
|
|
13089
13077
|
path: "/draft-orders/:id/promotions"
|
|
13090
13078
|
},
|
|
13079
|
+
{
|
|
13080
|
+
Component: Email,
|
|
13081
|
+
path: "/draft-orders/:id/email"
|
|
13082
|
+
},
|
|
13091
13083
|
{
|
|
13092
13084
|
Component: SalesChannel,
|
|
13093
13085
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -13100,6 +13092,14 @@ const routeModule = {
|
|
|
13100
13092
|
Component: Shipping,
|
|
13101
13093
|
path: "/draft-orders/:id/shipping"
|
|
13102
13094
|
},
|
|
13095
|
+
{
|
|
13096
|
+
Component: Metadata,
|
|
13097
|
+
path: "/draft-orders/:id/metadata"
|
|
13098
|
+
},
|
|
13099
|
+
{
|
|
13100
|
+
Component: CustomItems,
|
|
13101
|
+
path: "/draft-orders/:id/custom-items"
|
|
13102
|
+
},
|
|
13103
13103
|
{
|
|
13104
13104
|
Component: TransferOwnership,
|
|
13105
13105
|
path: "/draft-orders/:id/transfer-ownership"
|
|
@@ -13114,7 +13114,9 @@ const menuItemModule = {
|
|
|
13114
13114
|
label: config.label,
|
|
13115
13115
|
icon: void 0,
|
|
13116
13116
|
path: "/draft-orders",
|
|
13117
|
-
nested: "/orders"
|
|
13117
|
+
nested: "/orders",
|
|
13118
|
+
rank: void 0,
|
|
13119
|
+
translationNs: void 0
|
|
13118
13120
|
}
|
|
13119
13121
|
]
|
|
13120
13122
|
};
|