@lodashventure/medusa-campaign 1.4.7 → 1.4.9
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.
|
@@ -3933,41 +3933,6 @@ const FlashSaleForm = ({
|
|
|
3933
3933
|
] }) })
|
|
3934
3934
|
] });
|
|
3935
3935
|
};
|
|
3936
|
-
const FlashSaleCreate = () => {
|
|
3937
|
-
const navigate = reactRouterDom.useNavigate();
|
|
3938
|
-
async function handleSubmit(campaignData) {
|
|
3939
|
-
var _a;
|
|
3940
|
-
try {
|
|
3941
|
-
await axios__default.default.post("/admin/flash-sales", {
|
|
3942
|
-
...campaignData,
|
|
3943
|
-
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
3944
|
-
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
3945
|
-
});
|
|
3946
|
-
ui.toast.success("Flash sale created successfully");
|
|
3947
|
-
navigate("/flash-sales");
|
|
3948
|
-
} catch (error) {
|
|
3949
|
-
let message;
|
|
3950
|
-
if (axios__default.default.isAxiosError(error)) {
|
|
3951
|
-
console.log(error);
|
|
3952
|
-
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
3953
|
-
} else if (error instanceof Error) {
|
|
3954
|
-
message = error.message;
|
|
3955
|
-
} else {
|
|
3956
|
-
message = "Failed to create flash sale";
|
|
3957
|
-
}
|
|
3958
|
-
ui.toast.error("Failed to create flash sale", {
|
|
3959
|
-
description: message
|
|
3960
|
-
});
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3964
|
-
FlashSaleForm,
|
|
3965
|
-
{
|
|
3966
|
-
onSubmit: handleSubmit,
|
|
3967
|
-
onCancel: () => navigate("/flash-sales")
|
|
3968
|
-
}
|
|
3969
|
-
);
|
|
3970
|
-
};
|
|
3971
3936
|
const useFlashSaleById = (id) => {
|
|
3972
3937
|
const [data, setData] = React.useState(null);
|
|
3973
3938
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
@@ -4086,6 +4051,41 @@ const config = adminSdk.defineRouteConfig({
|
|
|
4086
4051
|
label: "Flash Sale Detail",
|
|
4087
4052
|
icon: icons.Sparkles
|
|
4088
4053
|
});
|
|
4054
|
+
const FlashSaleCreate = () => {
|
|
4055
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4056
|
+
async function handleSubmit(campaignData) {
|
|
4057
|
+
var _a;
|
|
4058
|
+
try {
|
|
4059
|
+
await axios__default.default.post("/admin/flash-sales", {
|
|
4060
|
+
...campaignData,
|
|
4061
|
+
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
4062
|
+
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
4063
|
+
});
|
|
4064
|
+
ui.toast.success("Flash sale created successfully");
|
|
4065
|
+
navigate("/flash-sales");
|
|
4066
|
+
} catch (error) {
|
|
4067
|
+
let message;
|
|
4068
|
+
if (axios__default.default.isAxiosError(error)) {
|
|
4069
|
+
console.log(error);
|
|
4070
|
+
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
4071
|
+
} else if (error instanceof Error) {
|
|
4072
|
+
message = error.message;
|
|
4073
|
+
} else {
|
|
4074
|
+
message = "Failed to create flash sale";
|
|
4075
|
+
}
|
|
4076
|
+
ui.toast.error("Failed to create flash sale", {
|
|
4077
|
+
description: message
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4082
|
+
FlashSaleForm,
|
|
4083
|
+
{
|
|
4084
|
+
onSubmit: handleSubmit,
|
|
4085
|
+
onCancel: () => navigate("/flash-sales")
|
|
4086
|
+
}
|
|
4087
|
+
);
|
|
4088
|
+
};
|
|
4089
4089
|
const widgetModule = { widgets: [
|
|
4090
4090
|
{
|
|
4091
4091
|
Component: CampaignDetailWidget,
|
|
@@ -4110,13 +4110,13 @@ const routeModule = {
|
|
|
4110
4110
|
Component: CouponCreate,
|
|
4111
4111
|
path: "/coupons/create"
|
|
4112
4112
|
},
|
|
4113
|
-
{
|
|
4114
|
-
Component: FlashSaleCreate,
|
|
4115
|
-
path: "/flash-sales/create"
|
|
4116
|
-
},
|
|
4117
4113
|
{
|
|
4118
4114
|
Component: FlashSaleDetail,
|
|
4119
4115
|
path: "/flash-sales/:id"
|
|
4116
|
+
},
|
|
4117
|
+
{
|
|
4118
|
+
Component: FlashSaleCreate,
|
|
4119
|
+
path: "/flash-sales/create"
|
|
4120
4120
|
}
|
|
4121
4121
|
]
|
|
4122
4122
|
};
|
|
@@ -3926,41 +3926,6 @@ const FlashSaleForm = ({
|
|
|
3926
3926
|
] }) })
|
|
3927
3927
|
] });
|
|
3928
3928
|
};
|
|
3929
|
-
const FlashSaleCreate = () => {
|
|
3930
|
-
const navigate = useNavigate();
|
|
3931
|
-
async function handleSubmit(campaignData) {
|
|
3932
|
-
var _a;
|
|
3933
|
-
try {
|
|
3934
|
-
await axios.post("/admin/flash-sales", {
|
|
3935
|
-
...campaignData,
|
|
3936
|
-
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
3937
|
-
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
3938
|
-
});
|
|
3939
|
-
toast.success("Flash sale created successfully");
|
|
3940
|
-
navigate("/flash-sales");
|
|
3941
|
-
} catch (error) {
|
|
3942
|
-
let message;
|
|
3943
|
-
if (axios.isAxiosError(error)) {
|
|
3944
|
-
console.log(error);
|
|
3945
|
-
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
3946
|
-
} else if (error instanceof Error) {
|
|
3947
|
-
message = error.message;
|
|
3948
|
-
} else {
|
|
3949
|
-
message = "Failed to create flash sale";
|
|
3950
|
-
}
|
|
3951
|
-
toast.error("Failed to create flash sale", {
|
|
3952
|
-
description: message
|
|
3953
|
-
});
|
|
3954
|
-
}
|
|
3955
|
-
}
|
|
3956
|
-
return /* @__PURE__ */ jsx(
|
|
3957
|
-
FlashSaleForm,
|
|
3958
|
-
{
|
|
3959
|
-
onSubmit: handleSubmit,
|
|
3960
|
-
onCancel: () => navigate("/flash-sales")
|
|
3961
|
-
}
|
|
3962
|
-
);
|
|
3963
|
-
};
|
|
3964
3929
|
const useFlashSaleById = (id) => {
|
|
3965
3930
|
const [data, setData] = useState(null);
|
|
3966
3931
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -4079,6 +4044,41 @@ const config = defineRouteConfig({
|
|
|
4079
4044
|
label: "Flash Sale Detail",
|
|
4080
4045
|
icon: Sparkles
|
|
4081
4046
|
});
|
|
4047
|
+
const FlashSaleCreate = () => {
|
|
4048
|
+
const navigate = useNavigate();
|
|
4049
|
+
async function handleSubmit(campaignData) {
|
|
4050
|
+
var _a;
|
|
4051
|
+
try {
|
|
4052
|
+
await axios.post("/admin/flash-sales", {
|
|
4053
|
+
...campaignData,
|
|
4054
|
+
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
4055
|
+
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
4056
|
+
});
|
|
4057
|
+
toast.success("Flash sale created successfully");
|
|
4058
|
+
navigate("/flash-sales");
|
|
4059
|
+
} catch (error) {
|
|
4060
|
+
let message;
|
|
4061
|
+
if (axios.isAxiosError(error)) {
|
|
4062
|
+
console.log(error);
|
|
4063
|
+
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
4064
|
+
} else if (error instanceof Error) {
|
|
4065
|
+
message = error.message;
|
|
4066
|
+
} else {
|
|
4067
|
+
message = "Failed to create flash sale";
|
|
4068
|
+
}
|
|
4069
|
+
toast.error("Failed to create flash sale", {
|
|
4070
|
+
description: message
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
return /* @__PURE__ */ jsx(
|
|
4075
|
+
FlashSaleForm,
|
|
4076
|
+
{
|
|
4077
|
+
onSubmit: handleSubmit,
|
|
4078
|
+
onCancel: () => navigate("/flash-sales")
|
|
4079
|
+
}
|
|
4080
|
+
);
|
|
4081
|
+
};
|
|
4082
4082
|
const widgetModule = { widgets: [
|
|
4083
4083
|
{
|
|
4084
4084
|
Component: CampaignDetailWidget,
|
|
@@ -4103,13 +4103,13 @@ const routeModule = {
|
|
|
4103
4103
|
Component: CouponCreate,
|
|
4104
4104
|
path: "/coupons/create"
|
|
4105
4105
|
},
|
|
4106
|
-
{
|
|
4107
|
-
Component: FlashSaleCreate,
|
|
4108
|
-
path: "/flash-sales/create"
|
|
4109
|
-
},
|
|
4110
4106
|
{
|
|
4111
4107
|
Component: FlashSaleDetail,
|
|
4112
4108
|
path: "/flash-sales/:id"
|
|
4109
|
+
},
|
|
4110
|
+
{
|
|
4111
|
+
Component: FlashSaleCreate,
|
|
4112
|
+
path: "/flash-sales/create"
|
|
4113
4113
|
}
|
|
4114
4114
|
]
|
|
4115
4115
|
};
|