@medusajs/draft-order 2.10.4-preview-20250925090152 → 2.10.4-preview-20250925120212
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 +591 -591
- package/.medusa/server/src/admin/index.mjs +591 -591
- package/package.json +16 -16
|
@@ -9757,27 +9757,6 @@ const BillingAddressForm = ({ order }) => {
|
|
|
9757
9757
|
) });
|
|
9758
9758
|
};
|
|
9759
9759
|
const schema$5 = addressSchema;
|
|
9760
|
-
const CustomItems = () => {
|
|
9761
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
9762
|
-
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
9763
|
-
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
9764
|
-
] });
|
|
9765
|
-
};
|
|
9766
|
-
const CustomItemsForm = () => {
|
|
9767
|
-
const form = useForm({
|
|
9768
|
-
resolver: zodResolver(schema$4)
|
|
9769
|
-
});
|
|
9770
|
-
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
9771
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
9772
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
9773
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
9774
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
9775
|
-
] }) })
|
|
9776
|
-
] }) });
|
|
9777
|
-
};
|
|
9778
|
-
const schema$4 = objectType({
|
|
9779
|
-
email: stringType().email()
|
|
9780
|
-
});
|
|
9781
9760
|
const Email = () => {
|
|
9782
9761
|
const { id } = useParams();
|
|
9783
9762
|
const { order, isPending, isError, error } = useOrder(id, {
|
|
@@ -9800,7 +9779,7 @@ const EmailForm = ({ order }) => {
|
|
|
9800
9779
|
defaultValues: {
|
|
9801
9780
|
email: order.email ?? ""
|
|
9802
9781
|
},
|
|
9803
|
-
resolver: zodResolver(schema$
|
|
9782
|
+
resolver: zodResolver(schema$4)
|
|
9804
9783
|
});
|
|
9805
9784
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
9806
9785
|
const { handleSuccess } = useRouteModal();
|
|
@@ -9843,7 +9822,7 @@ const EmailForm = ({ order }) => {
|
|
|
9843
9822
|
}
|
|
9844
9823
|
) });
|
|
9845
9824
|
};
|
|
9846
|
-
const schema$
|
|
9825
|
+
const schema$4 = objectType({
|
|
9847
9826
|
email: stringType().email()
|
|
9848
9827
|
});
|
|
9849
9828
|
const NumberInput = forwardRef(
|
|
@@ -10820,392 +10799,115 @@ const customItemSchema = objectType({
|
|
|
10820
10799
|
quantity: numberType(),
|
|
10821
10800
|
unit_price: unionType([numberType(), stringType()])
|
|
10822
10801
|
});
|
|
10823
|
-
const
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
}
|
|
10843
|
-
|
|
10802
|
+
const InlineTip = forwardRef(
|
|
10803
|
+
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
10804
|
+
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
10805
|
+
return /* @__PURE__ */ jsxs(
|
|
10806
|
+
"div",
|
|
10807
|
+
{
|
|
10808
|
+
ref,
|
|
10809
|
+
className: clx(
|
|
10810
|
+
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
10811
|
+
className
|
|
10812
|
+
),
|
|
10813
|
+
...props,
|
|
10814
|
+
children: [
|
|
10815
|
+
/* @__PURE__ */ jsx(
|
|
10816
|
+
"div",
|
|
10817
|
+
{
|
|
10818
|
+
role: "presentation",
|
|
10819
|
+
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
10820
|
+
"bg-ui-tag-orange-icon": variant === "warning"
|
|
10821
|
+
})
|
|
10822
|
+
}
|
|
10823
|
+
),
|
|
10824
|
+
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
10825
|
+
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
10826
|
+
labelValue,
|
|
10827
|
+
":"
|
|
10828
|
+
] }),
|
|
10829
|
+
" ",
|
|
10830
|
+
children
|
|
10831
|
+
] })
|
|
10832
|
+
]
|
|
10833
|
+
}
|
|
10834
|
+
);
|
|
10835
|
+
}
|
|
10836
|
+
);
|
|
10837
|
+
InlineTip.displayName = "InlineTip";
|
|
10838
|
+
const MetadataFieldSchema = objectType({
|
|
10839
|
+
key: stringType(),
|
|
10840
|
+
disabled: booleanType().optional(),
|
|
10841
|
+
value: anyType()
|
|
10842
|
+
});
|
|
10843
|
+
const MetadataSchema = objectType({
|
|
10844
|
+
metadata: arrayType(MetadataFieldSchema)
|
|
10845
|
+
});
|
|
10846
|
+
const Metadata = () => {
|
|
10844
10847
|
const { id } = useParams();
|
|
10845
|
-
const {
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
useInitiateOrderEdit({ preview });
|
|
10851
|
-
const { onCancel } = useCancelOrderEdit({ preview });
|
|
10852
|
-
if (isPreviewError) {
|
|
10853
|
-
throw previewError;
|
|
10848
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
10849
|
+
fields: "metadata"
|
|
10850
|
+
});
|
|
10851
|
+
if (isError) {
|
|
10852
|
+
throw error;
|
|
10854
10853
|
}
|
|
10855
|
-
const isReady = !!
|
|
10856
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, {
|
|
10857
|
-
/* @__PURE__ */
|
|
10858
|
-
|
|
10854
|
+
const isReady = !isPending && !!order;
|
|
10855
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
10856
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
10857
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
10858
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
10859
|
+
] }),
|
|
10860
|
+
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
10859
10861
|
] });
|
|
10860
10862
|
};
|
|
10861
|
-
const
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
const [comboboxValue, setComboboxValue] = useState("");
|
|
10863
|
+
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
10864
|
+
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
10865
|
+
const MetadataForm = ({ orderId, metadata }) => {
|
|
10865
10866
|
const { handleSuccess } = useRouteModal();
|
|
10866
|
-
const
|
|
10867
|
-
const
|
|
10868
|
-
const
|
|
10869
|
-
{
|
|
10870
|
-
|
|
10871
|
-
},
|
|
10872
|
-
{
|
|
10873
|
-
enabled: !!promoIds.length
|
|
10874
|
-
}
|
|
10875
|
-
);
|
|
10876
|
-
const comboboxData = useComboboxData({
|
|
10877
|
-
queryKey: ["promotions", "combobox", promoIds],
|
|
10878
|
-
queryFn: async (params) => {
|
|
10879
|
-
return await sdk.admin.promotion.list({
|
|
10880
|
-
...params,
|
|
10881
|
-
id: {
|
|
10882
|
-
$nin: promoIds
|
|
10883
|
-
}
|
|
10884
|
-
});
|
|
10867
|
+
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
10868
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
10869
|
+
const form = useForm({
|
|
10870
|
+
defaultValues: {
|
|
10871
|
+
metadata: getDefaultValues(metadata)
|
|
10885
10872
|
},
|
|
10886
|
-
|
|
10887
|
-
return data.promotions.map((promotion) => ({
|
|
10888
|
-
label: promotion.code,
|
|
10889
|
-
value: promotion.code
|
|
10890
|
-
}));
|
|
10891
|
-
}
|
|
10873
|
+
resolver: zodResolver(MetadataSchema)
|
|
10892
10874
|
});
|
|
10893
|
-
const
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
}
|
|
10897
|
-
addPromotions(
|
|
10875
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
10876
|
+
const parsedData = parseValues(data);
|
|
10877
|
+
await mutateAsync(
|
|
10898
10878
|
{
|
|
10899
|
-
|
|
10879
|
+
metadata: parsedData
|
|
10900
10880
|
},
|
|
10901
10881
|
{
|
|
10902
|
-
onError: (e) => {
|
|
10903
|
-
toast.error(e.message);
|
|
10904
|
-
comboboxData.onSearchValueChange("");
|
|
10905
|
-
setComboboxValue("");
|
|
10906
|
-
},
|
|
10907
10882
|
onSuccess: () => {
|
|
10908
|
-
|
|
10909
|
-
|
|
10883
|
+
toast.success("Metadata updated");
|
|
10884
|
+
handleSuccess();
|
|
10885
|
+
},
|
|
10886
|
+
onError: (error) => {
|
|
10887
|
+
toast.error(error.message);
|
|
10910
10888
|
}
|
|
10911
10889
|
}
|
|
10912
10890
|
);
|
|
10913
|
-
};
|
|
10914
|
-
const {
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
}
|
|
10926
|
-
});
|
|
10927
|
-
if (!requestSucceeded) {
|
|
10928
|
-
setIsSubmitting(false);
|
|
10929
|
-
return;
|
|
10891
|
+
});
|
|
10892
|
+
const { fields, insert, remove } = useFieldArray({
|
|
10893
|
+
control: form.control,
|
|
10894
|
+
name: "metadata"
|
|
10895
|
+
});
|
|
10896
|
+
function deleteRow(index) {
|
|
10897
|
+
remove(index);
|
|
10898
|
+
if (fields.length === 1) {
|
|
10899
|
+
insert(0, {
|
|
10900
|
+
key: "",
|
|
10901
|
+
value: "",
|
|
10902
|
+
disabled: false
|
|
10903
|
+
});
|
|
10930
10904
|
}
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
},
|
|
10938
|
-
onSettled: () => {
|
|
10939
|
-
setIsSubmitting(false);
|
|
10940
|
-
}
|
|
10941
|
-
});
|
|
10942
|
-
};
|
|
10943
|
-
if (isError) {
|
|
10944
|
-
throw error;
|
|
10945
|
-
}
|
|
10946
|
-
return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
10947
|
-
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
10948
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
10949
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
10950
|
-
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
10951
|
-
/* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
10952
|
-
] }),
|
|
10953
|
-
/* @__PURE__ */ jsx(
|
|
10954
|
-
Combobox,
|
|
10955
|
-
{
|
|
10956
|
-
id: "promotion-combobox",
|
|
10957
|
-
"aria-describedby": "promotion-combobox-hint",
|
|
10958
|
-
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
10959
|
-
fetchNextPage: comboboxData.fetchNextPage,
|
|
10960
|
-
options: comboboxData.options,
|
|
10961
|
-
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
10962
|
-
searchValue: comboboxData.searchValue,
|
|
10963
|
-
disabled: comboboxData.disabled || isAddingPromotions,
|
|
10964
|
-
onChange: add,
|
|
10965
|
-
value: comboboxValue
|
|
10966
|
-
}
|
|
10967
|
-
)
|
|
10968
|
-
] }),
|
|
10969
|
-
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
10970
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
10971
|
-
PromotionItem,
|
|
10972
|
-
{
|
|
10973
|
-
promotion,
|
|
10974
|
-
orderId: preview.id,
|
|
10975
|
-
isLoading: isPending
|
|
10976
|
-
},
|
|
10977
|
-
promotion.id
|
|
10978
|
-
)) })
|
|
10979
|
-
] }) }),
|
|
10980
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
10981
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
10982
|
-
/* @__PURE__ */ jsx(
|
|
10983
|
-
Button,
|
|
10984
|
-
{
|
|
10985
|
-
size: "small",
|
|
10986
|
-
type: "submit",
|
|
10987
|
-
isLoading: isSubmitting || isAddingPromotions,
|
|
10988
|
-
children: "Save"
|
|
10989
|
-
}
|
|
10990
|
-
)
|
|
10991
|
-
] }) })
|
|
10992
|
-
] });
|
|
10993
|
-
};
|
|
10994
|
-
const PromotionItem = ({
|
|
10995
|
-
promotion,
|
|
10996
|
-
orderId,
|
|
10997
|
-
isLoading
|
|
10998
|
-
}) => {
|
|
10999
|
-
var _a;
|
|
11000
|
-
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
11001
|
-
const onRemove = async () => {
|
|
11002
|
-
removePromotions(
|
|
11003
|
-
{
|
|
11004
|
-
promo_codes: [promotion.code]
|
|
11005
|
-
},
|
|
11006
|
-
{
|
|
11007
|
-
onError: (e) => {
|
|
11008
|
-
toast.error(e.message);
|
|
11009
|
-
}
|
|
11010
|
-
}
|
|
11011
|
-
);
|
|
11012
|
-
};
|
|
11013
|
-
const displayValue = getDisplayValue(promotion);
|
|
11014
|
-
return /* @__PURE__ */ jsxs(
|
|
11015
|
-
"div",
|
|
11016
|
-
{
|
|
11017
|
-
className: clx(
|
|
11018
|
-
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
11019
|
-
{
|
|
11020
|
-
"animate-pulse": isLoading
|
|
11021
|
-
}
|
|
11022
|
-
),
|
|
11023
|
-
children: [
|
|
11024
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
11025
|
-
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
11026
|
-
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
11027
|
-
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
11028
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
11029
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
11030
|
-
] }),
|
|
11031
|
-
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
11032
|
-
] })
|
|
11033
|
-
] }),
|
|
11034
|
-
/* @__PURE__ */ jsx(
|
|
11035
|
-
IconButton,
|
|
11036
|
-
{
|
|
11037
|
-
size: "small",
|
|
11038
|
-
type: "button",
|
|
11039
|
-
variant: "transparent",
|
|
11040
|
-
onClick: onRemove,
|
|
11041
|
-
isLoading: isPending || isLoading,
|
|
11042
|
-
children: /* @__PURE__ */ jsx(XMark, {})
|
|
11043
|
-
}
|
|
11044
|
-
)
|
|
11045
|
-
]
|
|
11046
|
-
},
|
|
11047
|
-
promotion.id
|
|
11048
|
-
);
|
|
11049
|
-
};
|
|
11050
|
-
function getDisplayValue(promotion) {
|
|
11051
|
-
var _a, _b, _c, _d;
|
|
11052
|
-
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
11053
|
-
if (!value) {
|
|
11054
|
-
return null;
|
|
11055
|
-
}
|
|
11056
|
-
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
11057
|
-
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
11058
|
-
if (!currency) {
|
|
11059
|
-
return null;
|
|
11060
|
-
}
|
|
11061
|
-
return getLocaleAmount(value, currency);
|
|
11062
|
-
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
11063
|
-
return formatPercentage(value);
|
|
11064
|
-
}
|
|
11065
|
-
return null;
|
|
11066
|
-
}
|
|
11067
|
-
const formatter = new Intl.NumberFormat([], {
|
|
11068
|
-
style: "percent",
|
|
11069
|
-
minimumFractionDigits: 2
|
|
11070
|
-
});
|
|
11071
|
-
const formatPercentage = (value, isPercentageValue = false) => {
|
|
11072
|
-
let val = value || 0;
|
|
11073
|
-
if (!isPercentageValue) {
|
|
11074
|
-
val = val / 100;
|
|
11075
|
-
}
|
|
11076
|
-
return formatter.format(val);
|
|
11077
|
-
};
|
|
11078
|
-
function getPromotionIds(items, shippingMethods) {
|
|
11079
|
-
const promotionIds = /* @__PURE__ */ new Set();
|
|
11080
|
-
for (const item of items) {
|
|
11081
|
-
if (item.adjustments) {
|
|
11082
|
-
for (const adjustment of item.adjustments) {
|
|
11083
|
-
if (adjustment.promotion_id) {
|
|
11084
|
-
promotionIds.add(adjustment.promotion_id);
|
|
11085
|
-
}
|
|
11086
|
-
}
|
|
11087
|
-
}
|
|
11088
|
-
}
|
|
11089
|
-
for (const shippingMethod of shippingMethods) {
|
|
11090
|
-
if (shippingMethod.adjustments) {
|
|
11091
|
-
for (const adjustment of shippingMethod.adjustments) {
|
|
11092
|
-
if (adjustment.promotion_id) {
|
|
11093
|
-
promotionIds.add(adjustment.promotion_id);
|
|
11094
|
-
}
|
|
11095
|
-
}
|
|
11096
|
-
}
|
|
11097
|
-
}
|
|
11098
|
-
return Array.from(promotionIds);
|
|
11099
|
-
}
|
|
11100
|
-
const InlineTip = forwardRef(
|
|
11101
|
-
({ variant = "tip", label, className, children, ...props }, ref) => {
|
|
11102
|
-
const labelValue = label || (variant === "warning" ? "Warning" : "Tip");
|
|
11103
|
-
return /* @__PURE__ */ jsxs(
|
|
11104
|
-
"div",
|
|
11105
|
-
{
|
|
11106
|
-
ref,
|
|
11107
|
-
className: clx(
|
|
11108
|
-
"bg-ui-bg-component txt-small text-ui-fg-subtle grid grid-cols-[4px_1fr] items-start gap-3 rounded-lg border p-3",
|
|
11109
|
-
className
|
|
11110
|
-
),
|
|
11111
|
-
...props,
|
|
11112
|
-
children: [
|
|
11113
|
-
/* @__PURE__ */ jsx(
|
|
11114
|
-
"div",
|
|
11115
|
-
{
|
|
11116
|
-
role: "presentation",
|
|
11117
|
-
className: clx("w-4px bg-ui-tag-neutral-icon h-full rounded-full", {
|
|
11118
|
-
"bg-ui-tag-orange-icon": variant === "warning"
|
|
11119
|
-
})
|
|
11120
|
-
}
|
|
11121
|
-
),
|
|
11122
|
-
/* @__PURE__ */ jsxs("div", { className: "text-pretty", children: [
|
|
11123
|
-
/* @__PURE__ */ jsxs("strong", { className: "txt-small-plus text-ui-fg-base", children: [
|
|
11124
|
-
labelValue,
|
|
11125
|
-
":"
|
|
11126
|
-
] }),
|
|
11127
|
-
" ",
|
|
11128
|
-
children
|
|
11129
|
-
] })
|
|
11130
|
-
]
|
|
11131
|
-
}
|
|
11132
|
-
);
|
|
11133
|
-
}
|
|
11134
|
-
);
|
|
11135
|
-
InlineTip.displayName = "InlineTip";
|
|
11136
|
-
const MetadataFieldSchema = objectType({
|
|
11137
|
-
key: stringType(),
|
|
11138
|
-
disabled: booleanType().optional(),
|
|
11139
|
-
value: anyType()
|
|
11140
|
-
});
|
|
11141
|
-
const MetadataSchema = objectType({
|
|
11142
|
-
metadata: arrayType(MetadataFieldSchema)
|
|
11143
|
-
});
|
|
11144
|
-
const Metadata = () => {
|
|
11145
|
-
const { id } = useParams();
|
|
11146
|
-
const { order, isPending, isError, error } = useOrder(id, {
|
|
11147
|
-
fields: "metadata"
|
|
11148
|
-
});
|
|
11149
|
-
if (isError) {
|
|
11150
|
-
throw error;
|
|
11151
|
-
}
|
|
11152
|
-
const isReady = !isPending && !!order;
|
|
11153
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11154
|
-
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
11155
|
-
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Metadata" }) }),
|
|
11156
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Add metadata to the draft order." }) })
|
|
11157
|
-
] }),
|
|
11158
|
-
!isReady ? /* @__PURE__ */ jsx(PlaceholderInner, {}) : /* @__PURE__ */ jsx(MetadataForm, { orderId: id, metadata: order == null ? void 0 : order.metadata })
|
|
11159
|
-
] });
|
|
11160
|
-
};
|
|
11161
|
-
const METADATA_KEY_LABEL_ID = "metadata-form-key-label";
|
|
11162
|
-
const METADATA_VALUE_LABEL_ID = "metadata-form-value-label";
|
|
11163
|
-
const MetadataForm = ({ orderId, metadata }) => {
|
|
11164
|
-
const { handleSuccess } = useRouteModal();
|
|
11165
|
-
const hasUneditableRows = getHasUneditableRows(metadata);
|
|
11166
|
-
const { mutateAsync, isPending } = useUpdateDraftOrder(orderId);
|
|
11167
|
-
const form = useForm({
|
|
11168
|
-
defaultValues: {
|
|
11169
|
-
metadata: getDefaultValues(metadata)
|
|
11170
|
-
},
|
|
11171
|
-
resolver: zodResolver(MetadataSchema)
|
|
11172
|
-
});
|
|
11173
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
11174
|
-
const parsedData = parseValues(data);
|
|
11175
|
-
await mutateAsync(
|
|
11176
|
-
{
|
|
11177
|
-
metadata: parsedData
|
|
11178
|
-
},
|
|
11179
|
-
{
|
|
11180
|
-
onSuccess: () => {
|
|
11181
|
-
toast.success("Metadata updated");
|
|
11182
|
-
handleSuccess();
|
|
11183
|
-
},
|
|
11184
|
-
onError: (error) => {
|
|
11185
|
-
toast.error(error.message);
|
|
11186
|
-
}
|
|
11187
|
-
}
|
|
11188
|
-
);
|
|
11189
|
-
});
|
|
11190
|
-
const { fields, insert, remove } = useFieldArray({
|
|
11191
|
-
control: form.control,
|
|
11192
|
-
name: "metadata"
|
|
11193
|
-
});
|
|
11194
|
-
function deleteRow(index) {
|
|
11195
|
-
remove(index);
|
|
11196
|
-
if (fields.length === 1) {
|
|
11197
|
-
insert(0, {
|
|
11198
|
-
key: "",
|
|
11199
|
-
value: "",
|
|
11200
|
-
disabled: false
|
|
11201
|
-
});
|
|
11202
|
-
}
|
|
11203
|
-
}
|
|
11204
|
-
function insertRow(index, position) {
|
|
11205
|
-
insert(index + (position === "above" ? 0 : 1), {
|
|
11206
|
-
key: "",
|
|
11207
|
-
value: "",
|
|
11208
|
-
disabled: false
|
|
10905
|
+
}
|
|
10906
|
+
function insertRow(index, position) {
|
|
10907
|
+
insert(index + (position === "above" ? 0 : 1), {
|
|
10908
|
+
key: "",
|
|
10909
|
+
value: "",
|
|
10910
|
+
disabled: false
|
|
11209
10911
|
});
|
|
11210
10912
|
}
|
|
11211
10913
|
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
@@ -11447,6 +11149,27 @@ function getHasUneditableRows(metadata) {
|
|
|
11447
11149
|
(value) => !EDITABLE_TYPES.includes(typeof value)
|
|
11448
11150
|
);
|
|
11449
11151
|
}
|
|
11152
|
+
const CustomItems = () => {
|
|
11153
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
11154
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Custom Items" }) }) }),
|
|
11155
|
+
/* @__PURE__ */ jsx(CustomItemsForm, {})
|
|
11156
|
+
] });
|
|
11157
|
+
};
|
|
11158
|
+
const CustomItemsForm = () => {
|
|
11159
|
+
const form = useForm({
|
|
11160
|
+
resolver: zodResolver(schema$3)
|
|
11161
|
+
});
|
|
11162
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", children: [
|
|
11163
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, {}),
|
|
11164
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
11165
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
11166
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", children: "Save" })
|
|
11167
|
+
] }) })
|
|
11168
|
+
] }) });
|
|
11169
|
+
};
|
|
11170
|
+
const schema$3 = objectType({
|
|
11171
|
+
email: stringType().email()
|
|
11172
|
+
});
|
|
11450
11173
|
const SalesChannel = () => {
|
|
11451
11174
|
const { id } = useParams();
|
|
11452
11175
|
const { draft_order, isPending, isError, error } = useDraftOrder(
|
|
@@ -12360,7 +12083,210 @@ const CustomAmountField = ({
|
|
|
12360
12083
|
}
|
|
12361
12084
|
);
|
|
12362
12085
|
};
|
|
12363
|
-
const
|
|
12086
|
+
const ShippingAddress = () => {
|
|
12087
|
+
const { id } = useParams();
|
|
12088
|
+
const { order, isPending, isError, error } = useOrder(id, {
|
|
12089
|
+
fields: "+shipping_address"
|
|
12090
|
+
});
|
|
12091
|
+
if (isError) {
|
|
12092
|
+
throw error;
|
|
12093
|
+
}
|
|
12094
|
+
const isReady = !isPending && !!order;
|
|
12095
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12096
|
+
/* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
|
|
12097
|
+
/* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Shipping Address" }) }),
|
|
12098
|
+
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12099
|
+
] }),
|
|
12100
|
+
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12101
|
+
] });
|
|
12102
|
+
};
|
|
12103
|
+
const ShippingAddressForm = ({ order }) => {
|
|
12104
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12105
|
+
const form = useForm({
|
|
12106
|
+
defaultValues: {
|
|
12107
|
+
first_name: ((_a = order.shipping_address) == null ? void 0 : _a.first_name) ?? "",
|
|
12108
|
+
last_name: ((_b = order.shipping_address) == null ? void 0 : _b.last_name) ?? "",
|
|
12109
|
+
company: ((_c = order.shipping_address) == null ? void 0 : _c.company) ?? "",
|
|
12110
|
+
address_1: ((_d = order.shipping_address) == null ? void 0 : _d.address_1) ?? "",
|
|
12111
|
+
address_2: ((_e = order.shipping_address) == null ? void 0 : _e.address_2) ?? "",
|
|
12112
|
+
city: ((_f = order.shipping_address) == null ? void 0 : _f.city) ?? "",
|
|
12113
|
+
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12114
|
+
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12115
|
+
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12116
|
+
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12117
|
+
},
|
|
12118
|
+
resolver: zodResolver(schema$1)
|
|
12119
|
+
});
|
|
12120
|
+
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12121
|
+
const { handleSuccess } = useRouteModal();
|
|
12122
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
12123
|
+
await mutateAsync(
|
|
12124
|
+
{
|
|
12125
|
+
shipping_address: {
|
|
12126
|
+
first_name: data.first_name,
|
|
12127
|
+
last_name: data.last_name,
|
|
12128
|
+
company: data.company,
|
|
12129
|
+
address_1: data.address_1,
|
|
12130
|
+
address_2: data.address_2,
|
|
12131
|
+
city: data.city,
|
|
12132
|
+
province: data.province,
|
|
12133
|
+
country_code: data.country_code,
|
|
12134
|
+
postal_code: data.postal_code,
|
|
12135
|
+
phone: data.phone
|
|
12136
|
+
}
|
|
12137
|
+
},
|
|
12138
|
+
{
|
|
12139
|
+
onSuccess: () => {
|
|
12140
|
+
handleSuccess();
|
|
12141
|
+
},
|
|
12142
|
+
onError: (error) => {
|
|
12143
|
+
toast.error(error.message);
|
|
12144
|
+
}
|
|
12145
|
+
}
|
|
12146
|
+
);
|
|
12147
|
+
});
|
|
12148
|
+
return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
|
|
12149
|
+
KeyboundForm,
|
|
12150
|
+
{
|
|
12151
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
12152
|
+
onSubmit,
|
|
12153
|
+
children: [
|
|
12154
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
12155
|
+
/* @__PURE__ */ jsx(
|
|
12156
|
+
Form$2.Field,
|
|
12157
|
+
{
|
|
12158
|
+
control: form.control,
|
|
12159
|
+
name: "country_code",
|
|
12160
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12161
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Country" }),
|
|
12162
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(CountrySelect, { ...field }) }),
|
|
12163
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12164
|
+
] })
|
|
12165
|
+
}
|
|
12166
|
+
),
|
|
12167
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12168
|
+
/* @__PURE__ */ jsx(
|
|
12169
|
+
Form$2.Field,
|
|
12170
|
+
{
|
|
12171
|
+
control: form.control,
|
|
12172
|
+
name: "first_name",
|
|
12173
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12174
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "First name" }),
|
|
12175
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12176
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12177
|
+
] })
|
|
12178
|
+
}
|
|
12179
|
+
),
|
|
12180
|
+
/* @__PURE__ */ jsx(
|
|
12181
|
+
Form$2.Field,
|
|
12182
|
+
{
|
|
12183
|
+
control: form.control,
|
|
12184
|
+
name: "last_name",
|
|
12185
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12186
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12187
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12188
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12189
|
+
] })
|
|
12190
|
+
}
|
|
12191
|
+
)
|
|
12192
|
+
] }),
|
|
12193
|
+
/* @__PURE__ */ jsx(
|
|
12194
|
+
Form$2.Field,
|
|
12195
|
+
{
|
|
12196
|
+
control: form.control,
|
|
12197
|
+
name: "company",
|
|
12198
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12199
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12200
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12201
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12202
|
+
] })
|
|
12203
|
+
}
|
|
12204
|
+
),
|
|
12205
|
+
/* @__PURE__ */ jsx(
|
|
12206
|
+
Form$2.Field,
|
|
12207
|
+
{
|
|
12208
|
+
control: form.control,
|
|
12209
|
+
name: "address_1",
|
|
12210
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12211
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12212
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12213
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12214
|
+
] })
|
|
12215
|
+
}
|
|
12216
|
+
),
|
|
12217
|
+
/* @__PURE__ */ jsx(
|
|
12218
|
+
Form$2.Field,
|
|
12219
|
+
{
|
|
12220
|
+
control: form.control,
|
|
12221
|
+
name: "address_2",
|
|
12222
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12223
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12224
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12225
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12226
|
+
] })
|
|
12227
|
+
}
|
|
12228
|
+
),
|
|
12229
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12230
|
+
/* @__PURE__ */ jsx(
|
|
12231
|
+
Form$2.Field,
|
|
12232
|
+
{
|
|
12233
|
+
control: form.control,
|
|
12234
|
+
name: "postal_code",
|
|
12235
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12236
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12237
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12238
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12239
|
+
] })
|
|
12240
|
+
}
|
|
12241
|
+
),
|
|
12242
|
+
/* @__PURE__ */ jsx(
|
|
12243
|
+
Form$2.Field,
|
|
12244
|
+
{
|
|
12245
|
+
control: form.control,
|
|
12246
|
+
name: "city",
|
|
12247
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12248
|
+
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
12249
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12250
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12251
|
+
] })
|
|
12252
|
+
}
|
|
12253
|
+
)
|
|
12254
|
+
] }),
|
|
12255
|
+
/* @__PURE__ */ jsx(
|
|
12256
|
+
Form$2.Field,
|
|
12257
|
+
{
|
|
12258
|
+
control: form.control,
|
|
12259
|
+
name: "province",
|
|
12260
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12261
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
12262
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12263
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12264
|
+
] })
|
|
12265
|
+
}
|
|
12266
|
+
),
|
|
12267
|
+
/* @__PURE__ */ jsx(
|
|
12268
|
+
Form$2.Field,
|
|
12269
|
+
{
|
|
12270
|
+
control: form.control,
|
|
12271
|
+
name: "phone",
|
|
12272
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12273
|
+
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
12274
|
+
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12275
|
+
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12276
|
+
] })
|
|
12277
|
+
}
|
|
12278
|
+
)
|
|
12279
|
+
] }) }),
|
|
12280
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12281
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12282
|
+
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
12283
|
+
] }) })
|
|
12284
|
+
]
|
|
12285
|
+
}
|
|
12286
|
+
) });
|
|
12287
|
+
};
|
|
12288
|
+
const schema$1 = addressSchema;
|
|
12289
|
+
const TransferOwnership = () => {
|
|
12364
12290
|
const { id } = useParams();
|
|
12365
12291
|
const { draft_order, isPending, isError, error } = useDraftOrder(id, {
|
|
12366
12292
|
fields: "id,customer_id,customer.*"
|
|
@@ -12383,7 +12309,7 @@ const TransferOwnershipForm = ({ order }) => {
|
|
|
12383
12309
|
defaultValues: {
|
|
12384
12310
|
customer_id: order.customer_id || ""
|
|
12385
12311
|
},
|
|
12386
|
-
resolver: zodResolver(schema
|
|
12312
|
+
resolver: zodResolver(schema)
|
|
12387
12313
|
});
|
|
12388
12314
|
const { mutateAsync, isPending } = useUpdateDraftOrder(order.id);
|
|
12389
12315
|
const { handleSuccess } = useRouteModal();
|
|
@@ -12833,212 +12759,286 @@ const Illustration = () => {
|
|
|
12833
12759
|
}
|
|
12834
12760
|
);
|
|
12835
12761
|
};
|
|
12836
|
-
const schema
|
|
12762
|
+
const schema = objectType({
|
|
12837
12763
|
customer_id: stringType().min(1)
|
|
12838
12764
|
});
|
|
12839
|
-
const
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12765
|
+
const PROMOTION_QUERY_KEY = "promotions";
|
|
12766
|
+
const promotionsQueryKeys = {
|
|
12767
|
+
list: (query2) => [
|
|
12768
|
+
PROMOTION_QUERY_KEY,
|
|
12769
|
+
query2 ? query2 : void 0
|
|
12770
|
+
],
|
|
12771
|
+
detail: (id, query2) => [
|
|
12772
|
+
PROMOTION_QUERY_KEY,
|
|
12773
|
+
id,
|
|
12774
|
+
query2 ? query2 : void 0
|
|
12775
|
+
]
|
|
12776
|
+
};
|
|
12777
|
+
const usePromotions = (query2, options) => {
|
|
12778
|
+
const { data, ...rest } = useQuery({
|
|
12779
|
+
queryKey: promotionsQueryKeys.list(query2),
|
|
12780
|
+
queryFn: async () => sdk.admin.promotion.list(query2),
|
|
12781
|
+
...options
|
|
12843
12782
|
});
|
|
12844
|
-
|
|
12845
|
-
|
|
12783
|
+
return { ...data, ...rest };
|
|
12784
|
+
};
|
|
12785
|
+
const Promotions = () => {
|
|
12786
|
+
const { id } = useParams();
|
|
12787
|
+
const {
|
|
12788
|
+
order: preview,
|
|
12789
|
+
isError: isPreviewError,
|
|
12790
|
+
error: previewError
|
|
12791
|
+
} = useOrderPreview(id, void 0);
|
|
12792
|
+
useInitiateOrderEdit({ preview });
|
|
12793
|
+
const { onCancel } = useCancelOrderEdit({ preview });
|
|
12794
|
+
if (isPreviewError) {
|
|
12795
|
+
throw previewError;
|
|
12846
12796
|
}
|
|
12847
|
-
const isReady =
|
|
12848
|
-
return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
|
|
12849
|
-
/* @__PURE__ */
|
|
12850
|
-
|
|
12851
|
-
/* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the shipping address for the draft order" }) })
|
|
12852
|
-
] }),
|
|
12853
|
-
isReady && /* @__PURE__ */ jsx(ShippingAddressForm, { order })
|
|
12797
|
+
const isReady = !!preview;
|
|
12798
|
+
return /* @__PURE__ */ jsxs(RouteDrawer, { onClose: onCancel, children: [
|
|
12799
|
+
/* @__PURE__ */ jsx(RouteDrawer.Header, { children: /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit Promotions" }) }) }),
|
|
12800
|
+
isReady && /* @__PURE__ */ jsx(PromotionForm, { preview })
|
|
12854
12801
|
] });
|
|
12855
12802
|
};
|
|
12856
|
-
const
|
|
12857
|
-
|
|
12858
|
-
const
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
province: ((_g = order.shipping_address) == null ? void 0 : _g.province) ?? "",
|
|
12867
|
-
country_code: ((_h = order.shipping_address) == null ? void 0 : _h.country_code) ?? "",
|
|
12868
|
-
postal_code: ((_i = order.shipping_address) == null ? void 0 : _i.postal_code) ?? "",
|
|
12869
|
-
phone: ((_j = order.shipping_address) == null ? void 0 : _j.phone) ?? ""
|
|
12803
|
+
const PromotionForm = ({ preview }) => {
|
|
12804
|
+
const { items, shipping_methods } = preview;
|
|
12805
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
12806
|
+
const [comboboxValue, setComboboxValue] = useState("");
|
|
12807
|
+
const { handleSuccess } = useRouteModal();
|
|
12808
|
+
const { mutateAsync: addPromotions, isPending: isAddingPromotions } = useDraftOrderAddPromotions(preview.id);
|
|
12809
|
+
const promoIds = getPromotionIds(items, shipping_methods);
|
|
12810
|
+
const { promotions, isPending, isError, error } = usePromotions(
|
|
12811
|
+
{
|
|
12812
|
+
id: promoIds
|
|
12870
12813
|
},
|
|
12871
|
-
|
|
12814
|
+
{
|
|
12815
|
+
enabled: !!promoIds.length
|
|
12816
|
+
}
|
|
12817
|
+
);
|
|
12818
|
+
const comboboxData = useComboboxData({
|
|
12819
|
+
queryKey: ["promotions", "combobox", promoIds],
|
|
12820
|
+
queryFn: async (params) => {
|
|
12821
|
+
return await sdk.admin.promotion.list({
|
|
12822
|
+
...params,
|
|
12823
|
+
id: {
|
|
12824
|
+
$nin: promoIds
|
|
12825
|
+
}
|
|
12826
|
+
});
|
|
12827
|
+
},
|
|
12828
|
+
getOptions: (data) => {
|
|
12829
|
+
return data.promotions.map((promotion) => ({
|
|
12830
|
+
label: promotion.code,
|
|
12831
|
+
value: promotion.code
|
|
12832
|
+
}));
|
|
12833
|
+
}
|
|
12872
12834
|
});
|
|
12873
|
-
const
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12835
|
+
const add = async (value) => {
|
|
12836
|
+
if (!value) {
|
|
12837
|
+
return;
|
|
12838
|
+
}
|
|
12839
|
+
addPromotions(
|
|
12877
12840
|
{
|
|
12878
|
-
|
|
12879
|
-
first_name: data.first_name,
|
|
12880
|
-
last_name: data.last_name,
|
|
12881
|
-
company: data.company,
|
|
12882
|
-
address_1: data.address_1,
|
|
12883
|
-
address_2: data.address_2,
|
|
12884
|
-
city: data.city,
|
|
12885
|
-
province: data.province,
|
|
12886
|
-
country_code: data.country_code,
|
|
12887
|
-
postal_code: data.postal_code,
|
|
12888
|
-
phone: data.phone
|
|
12889
|
-
}
|
|
12841
|
+
promo_codes: [value]
|
|
12890
12842
|
},
|
|
12891
12843
|
{
|
|
12844
|
+
onError: (e) => {
|
|
12845
|
+
toast.error(e.message);
|
|
12846
|
+
comboboxData.onSearchValueChange("");
|
|
12847
|
+
setComboboxValue("");
|
|
12848
|
+
},
|
|
12892
12849
|
onSuccess: () => {
|
|
12893
|
-
|
|
12850
|
+
comboboxData.onSearchValueChange("");
|
|
12851
|
+
setComboboxValue("");
|
|
12852
|
+
}
|
|
12853
|
+
}
|
|
12854
|
+
);
|
|
12855
|
+
};
|
|
12856
|
+
const { mutateAsync: confirmOrderEdit } = useDraftOrderConfirmEdit(preview.id);
|
|
12857
|
+
const { mutateAsync: requestOrderEdit } = useOrderEditRequest(preview.id);
|
|
12858
|
+
const onSubmit = async () => {
|
|
12859
|
+
setIsSubmitting(true);
|
|
12860
|
+
let requestSucceeded = false;
|
|
12861
|
+
await requestOrderEdit(void 0, {
|
|
12862
|
+
onError: (e) => {
|
|
12863
|
+
toast.error(e.message);
|
|
12864
|
+
},
|
|
12865
|
+
onSuccess: () => {
|
|
12866
|
+
requestSucceeded = true;
|
|
12867
|
+
}
|
|
12868
|
+
});
|
|
12869
|
+
if (!requestSucceeded) {
|
|
12870
|
+
setIsSubmitting(false);
|
|
12871
|
+
return;
|
|
12872
|
+
}
|
|
12873
|
+
await confirmOrderEdit(void 0, {
|
|
12874
|
+
onError: (e) => {
|
|
12875
|
+
toast.error(e.message);
|
|
12876
|
+
},
|
|
12877
|
+
onSuccess: () => {
|
|
12878
|
+
handleSuccess();
|
|
12879
|
+
},
|
|
12880
|
+
onSettled: () => {
|
|
12881
|
+
setIsSubmitting(false);
|
|
12882
|
+
}
|
|
12883
|
+
});
|
|
12884
|
+
};
|
|
12885
|
+
if (isError) {
|
|
12886
|
+
throw error;
|
|
12887
|
+
}
|
|
12888
|
+
return /* @__PURE__ */ jsxs(KeyboundForm, { className: "flex flex-1 flex-col", onSubmit, children: [
|
|
12889
|
+
/* @__PURE__ */ jsx(RouteDrawer.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
12890
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
12891
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
12892
|
+
/* @__PURE__ */ jsx(Label$1, { size: "small", weight: "plus", htmlFor: "promotion-combobox", children: "Apply promotions" }),
|
|
12893
|
+
/* @__PURE__ */ jsx(Hint$1, { id: "promotion-combobox-hint", children: "Manage promotions that should be applied to the order." })
|
|
12894
|
+
] }),
|
|
12895
|
+
/* @__PURE__ */ jsx(
|
|
12896
|
+
Combobox,
|
|
12897
|
+
{
|
|
12898
|
+
id: "promotion-combobox",
|
|
12899
|
+
"aria-describedby": "promotion-combobox-hint",
|
|
12900
|
+
isFetchingNextPage: comboboxData.isFetchingNextPage,
|
|
12901
|
+
fetchNextPage: comboboxData.fetchNextPage,
|
|
12902
|
+
options: comboboxData.options,
|
|
12903
|
+
onSearchValueChange: comboboxData.onSearchValueChange,
|
|
12904
|
+
searchValue: comboboxData.searchValue,
|
|
12905
|
+
disabled: comboboxData.disabled || isAddingPromotions,
|
|
12906
|
+
onChange: add,
|
|
12907
|
+
value: comboboxValue
|
|
12908
|
+
}
|
|
12909
|
+
)
|
|
12910
|
+
] }),
|
|
12911
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
12912
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: promotions == null ? void 0 : promotions.map((promotion) => /* @__PURE__ */ jsx(
|
|
12913
|
+
PromotionItem,
|
|
12914
|
+
{
|
|
12915
|
+
promotion,
|
|
12916
|
+
orderId: preview.id,
|
|
12917
|
+
isLoading: isPending
|
|
12894
12918
|
},
|
|
12895
|
-
|
|
12896
|
-
|
|
12919
|
+
promotion.id
|
|
12920
|
+
)) })
|
|
12921
|
+
] }) }),
|
|
12922
|
+
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
12923
|
+
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
12924
|
+
/* @__PURE__ */ jsx(
|
|
12925
|
+
Button,
|
|
12926
|
+
{
|
|
12927
|
+
size: "small",
|
|
12928
|
+
type: "submit",
|
|
12929
|
+
isLoading: isSubmitting || isAddingPromotions,
|
|
12930
|
+
children: "Save"
|
|
12931
|
+
}
|
|
12932
|
+
)
|
|
12933
|
+
] }) })
|
|
12934
|
+
] });
|
|
12935
|
+
};
|
|
12936
|
+
const PromotionItem = ({
|
|
12937
|
+
promotion,
|
|
12938
|
+
orderId,
|
|
12939
|
+
isLoading
|
|
12940
|
+
}) => {
|
|
12941
|
+
var _a;
|
|
12942
|
+
const { mutateAsync: removePromotions, isPending } = useDraftOrderRemovePromotions(orderId);
|
|
12943
|
+
const onRemove = async () => {
|
|
12944
|
+
removePromotions(
|
|
12945
|
+
{
|
|
12946
|
+
promo_codes: [promotion.code]
|
|
12947
|
+
},
|
|
12948
|
+
{
|
|
12949
|
+
onError: (e) => {
|
|
12950
|
+
toast.error(e.message);
|
|
12897
12951
|
}
|
|
12898
12952
|
}
|
|
12899
12953
|
);
|
|
12900
|
-
}
|
|
12901
|
-
|
|
12902
|
-
|
|
12954
|
+
};
|
|
12955
|
+
const displayValue = getDisplayValue(promotion);
|
|
12956
|
+
return /* @__PURE__ */ jsxs(
|
|
12957
|
+
"div",
|
|
12903
12958
|
{
|
|
12904
|
-
className:
|
|
12905
|
-
|
|
12959
|
+
className: clx(
|
|
12960
|
+
"bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
|
|
12961
|
+
{
|
|
12962
|
+
"animate-pulse": isLoading
|
|
12963
|
+
}
|
|
12964
|
+
),
|
|
12906
12965
|
children: [
|
|
12907
|
-
/* @__PURE__ */
|
|
12908
|
-
/* @__PURE__ */ jsx(
|
|
12909
|
-
|
|
12910
|
-
{
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
|
|
12928
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12929
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12930
|
-
] })
|
|
12931
|
-
}
|
|
12932
|
-
),
|
|
12933
|
-
/* @__PURE__ */ jsx(
|
|
12934
|
-
Form$2.Field,
|
|
12935
|
-
{
|
|
12936
|
-
control: form.control,
|
|
12937
|
-
name: "last_name",
|
|
12938
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12939
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Last name" }),
|
|
12940
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12941
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12942
|
-
] })
|
|
12943
|
-
}
|
|
12944
|
-
)
|
|
12945
|
-
] }),
|
|
12946
|
-
/* @__PURE__ */ jsx(
|
|
12947
|
-
Form$2.Field,
|
|
12948
|
-
{
|
|
12949
|
-
control: form.control,
|
|
12950
|
-
name: "company",
|
|
12951
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12952
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Company" }),
|
|
12953
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12954
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12955
|
-
] })
|
|
12956
|
-
}
|
|
12957
|
-
),
|
|
12958
|
-
/* @__PURE__ */ jsx(
|
|
12959
|
-
Form$2.Field,
|
|
12960
|
-
{
|
|
12961
|
-
control: form.control,
|
|
12962
|
-
name: "address_1",
|
|
12963
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12964
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Address" }),
|
|
12965
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12966
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12967
|
-
] })
|
|
12968
|
-
}
|
|
12969
|
-
),
|
|
12970
|
-
/* @__PURE__ */ jsx(
|
|
12971
|
-
Form$2.Field,
|
|
12972
|
-
{
|
|
12973
|
-
control: form.control,
|
|
12974
|
-
name: "address_2",
|
|
12975
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12976
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Apartment, suite, etc." }),
|
|
12977
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12978
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12979
|
-
] })
|
|
12980
|
-
}
|
|
12981
|
-
),
|
|
12982
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
12983
|
-
/* @__PURE__ */ jsx(
|
|
12984
|
-
Form$2.Field,
|
|
12985
|
-
{
|
|
12986
|
-
control: form.control,
|
|
12987
|
-
name: "postal_code",
|
|
12988
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
12989
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "Postal code" }),
|
|
12990
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
12991
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
12992
|
-
] })
|
|
12993
|
-
}
|
|
12994
|
-
),
|
|
12995
|
-
/* @__PURE__ */ jsx(
|
|
12996
|
-
Form$2.Field,
|
|
12997
|
-
{
|
|
12998
|
-
control: form.control,
|
|
12999
|
-
name: "city",
|
|
13000
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13001
|
-
/* @__PURE__ */ jsx(Form$2.Label, { children: "City" }),
|
|
13002
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13003
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13004
|
-
] })
|
|
13005
|
-
}
|
|
13006
|
-
)
|
|
13007
|
-
] }),
|
|
13008
|
-
/* @__PURE__ */ jsx(
|
|
13009
|
-
Form$2.Field,
|
|
13010
|
-
{
|
|
13011
|
-
control: form.control,
|
|
13012
|
-
name: "province",
|
|
13013
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13014
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Province / State" }),
|
|
13015
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13016
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13017
|
-
] })
|
|
13018
|
-
}
|
|
13019
|
-
),
|
|
13020
|
-
/* @__PURE__ */ jsx(
|
|
13021
|
-
Form$2.Field,
|
|
13022
|
-
{
|
|
13023
|
-
control: form.control,
|
|
13024
|
-
name: "phone",
|
|
13025
|
-
render: ({ field }) => /* @__PURE__ */ jsxs(Form$2.Item, { children: [
|
|
13026
|
-
/* @__PURE__ */ jsx(Form$2.Label, { optional: true, children: "Phone" }),
|
|
13027
|
-
/* @__PURE__ */ jsx(Form$2.Control, { children: /* @__PURE__ */ jsx(Input, { ...field }) }),
|
|
13028
|
-
/* @__PURE__ */ jsx(Form$2.ErrorMessage, {})
|
|
13029
|
-
] })
|
|
13030
|
-
}
|
|
13031
|
-
)
|
|
13032
|
-
] }) }),
|
|
13033
|
-
/* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
13034
|
-
/* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
13035
|
-
/* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
13036
|
-
] }) })
|
|
12966
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
12967
|
+
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: promotion.code }),
|
|
12968
|
+
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-1.5", children: [
|
|
12969
|
+
displayValue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
12970
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: displayValue }),
|
|
12971
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "·" })
|
|
12972
|
+
] }),
|
|
12973
|
+
/* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", className: "capitalize", children: (_a = promotion.application_method) == null ? void 0 : _a.allocation })
|
|
12974
|
+
] })
|
|
12975
|
+
] }),
|
|
12976
|
+
/* @__PURE__ */ jsx(
|
|
12977
|
+
IconButton,
|
|
12978
|
+
{
|
|
12979
|
+
size: "small",
|
|
12980
|
+
type: "button",
|
|
12981
|
+
variant: "transparent",
|
|
12982
|
+
onClick: onRemove,
|
|
12983
|
+
isLoading: isPending || isLoading,
|
|
12984
|
+
children: /* @__PURE__ */ jsx(XMark, {})
|
|
12985
|
+
}
|
|
12986
|
+
)
|
|
13037
12987
|
]
|
|
12988
|
+
},
|
|
12989
|
+
promotion.id
|
|
12990
|
+
);
|
|
12991
|
+
};
|
|
12992
|
+
function getDisplayValue(promotion) {
|
|
12993
|
+
var _a, _b, _c, _d;
|
|
12994
|
+
const value = (_a = promotion.application_method) == null ? void 0 : _a.value;
|
|
12995
|
+
if (!value) {
|
|
12996
|
+
return null;
|
|
12997
|
+
}
|
|
12998
|
+
if (((_b = promotion.application_method) == null ? void 0 : _b.type) === "fixed") {
|
|
12999
|
+
const currency = (_c = promotion.application_method) == null ? void 0 : _c.currency_code;
|
|
13000
|
+
if (!currency) {
|
|
13001
|
+
return null;
|
|
13038
13002
|
}
|
|
13039
|
-
|
|
13003
|
+
return getLocaleAmount(value, currency);
|
|
13004
|
+
} else if (((_d = promotion.application_method) == null ? void 0 : _d.type) === "percentage") {
|
|
13005
|
+
return formatPercentage(value);
|
|
13006
|
+
}
|
|
13007
|
+
return null;
|
|
13008
|
+
}
|
|
13009
|
+
const formatter = new Intl.NumberFormat([], {
|
|
13010
|
+
style: "percent",
|
|
13011
|
+
minimumFractionDigits: 2
|
|
13012
|
+
});
|
|
13013
|
+
const formatPercentage = (value, isPercentageValue = false) => {
|
|
13014
|
+
let val = value || 0;
|
|
13015
|
+
if (!isPercentageValue) {
|
|
13016
|
+
val = val / 100;
|
|
13017
|
+
}
|
|
13018
|
+
return formatter.format(val);
|
|
13040
13019
|
};
|
|
13041
|
-
|
|
13020
|
+
function getPromotionIds(items, shippingMethods) {
|
|
13021
|
+
const promotionIds = /* @__PURE__ */ new Set();
|
|
13022
|
+
for (const item of items) {
|
|
13023
|
+
if (item.adjustments) {
|
|
13024
|
+
for (const adjustment of item.adjustments) {
|
|
13025
|
+
if (adjustment.promotion_id) {
|
|
13026
|
+
promotionIds.add(adjustment.promotion_id);
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13029
|
+
}
|
|
13030
|
+
}
|
|
13031
|
+
for (const shippingMethod of shippingMethods) {
|
|
13032
|
+
if (shippingMethod.adjustments) {
|
|
13033
|
+
for (const adjustment of shippingMethod.adjustments) {
|
|
13034
|
+
if (adjustment.promotion_id) {
|
|
13035
|
+
promotionIds.add(adjustment.promotion_id);
|
|
13036
|
+
}
|
|
13037
|
+
}
|
|
13038
|
+
}
|
|
13039
|
+
}
|
|
13040
|
+
return Array.from(promotionIds);
|
|
13041
|
+
}
|
|
13042
13042
|
const widgetModule = { widgets: [] };
|
|
13043
13043
|
const routeModule = {
|
|
13044
13044
|
routes: [
|
|
@@ -13063,10 +13063,6 @@ const routeModule = {
|
|
|
13063
13063
|
Component: BillingAddress,
|
|
13064
13064
|
path: "/draft-orders/:id/billing-address"
|
|
13065
13065
|
},
|
|
13066
|
-
{
|
|
13067
|
-
Component: CustomItems,
|
|
13068
|
-
path: "/draft-orders/:id/custom-items"
|
|
13069
|
-
},
|
|
13070
13066
|
{
|
|
13071
13067
|
Component: Email,
|
|
13072
13068
|
path: "/draft-orders/:id/email"
|
|
@@ -13075,14 +13071,14 @@ const routeModule = {
|
|
|
13075
13071
|
Component: Items,
|
|
13076
13072
|
path: "/draft-orders/:id/items"
|
|
13077
13073
|
},
|
|
13078
|
-
{
|
|
13079
|
-
Component: Promotions,
|
|
13080
|
-
path: "/draft-orders/:id/promotions"
|
|
13081
|
-
},
|
|
13082
13074
|
{
|
|
13083
13075
|
Component: Metadata,
|
|
13084
13076
|
path: "/draft-orders/:id/metadata"
|
|
13085
13077
|
},
|
|
13078
|
+
{
|
|
13079
|
+
Component: CustomItems,
|
|
13080
|
+
path: "/draft-orders/:id/custom-items"
|
|
13081
|
+
},
|
|
13086
13082
|
{
|
|
13087
13083
|
Component: SalesChannel,
|
|
13088
13084
|
path: "/draft-orders/:id/sales-channel"
|
|
@@ -13091,13 +13087,17 @@ const routeModule = {
|
|
|
13091
13087
|
Component: Shipping,
|
|
13092
13088
|
path: "/draft-orders/:id/shipping"
|
|
13093
13089
|
},
|
|
13090
|
+
{
|
|
13091
|
+
Component: ShippingAddress,
|
|
13092
|
+
path: "/draft-orders/:id/shipping-address"
|
|
13093
|
+
},
|
|
13094
13094
|
{
|
|
13095
13095
|
Component: TransferOwnership,
|
|
13096
13096
|
path: "/draft-orders/:id/transfer-ownership"
|
|
13097
13097
|
},
|
|
13098
13098
|
{
|
|
13099
|
-
Component:
|
|
13100
|
-
path: "/draft-orders/:id/
|
|
13099
|
+
Component: Promotions,
|
|
13100
|
+
path: "/draft-orders/:id/promotions"
|
|
13101
13101
|
}
|
|
13102
13102
|
]
|
|
13103
13103
|
}
|