@lodashventure/medusa-campaign 1.5.9 → 1.5.10
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.
|
@@ -2101,41 +2101,6 @@ const FlashSaleForm = ({
|
|
|
2101
2101
|
] }) })
|
|
2102
2102
|
] });
|
|
2103
2103
|
};
|
|
2104
|
-
const FlashSaleCreate = () => {
|
|
2105
|
-
const navigate = reactRouterDom.useNavigate();
|
|
2106
|
-
async function handleSubmit(campaignData) {
|
|
2107
|
-
var _a;
|
|
2108
|
-
try {
|
|
2109
|
-
await axios__default.default.post("/admin/flash-sales", {
|
|
2110
|
-
...campaignData,
|
|
2111
|
-
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
2112
|
-
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
2113
|
-
});
|
|
2114
|
-
ui.toast.success("Flash sale created successfully");
|
|
2115
|
-
navigate("/flash-sales");
|
|
2116
|
-
} catch (error) {
|
|
2117
|
-
let message;
|
|
2118
|
-
if (axios__default.default.isAxiosError(error)) {
|
|
2119
|
-
console.log(error);
|
|
2120
|
-
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
2121
|
-
} else if (error instanceof Error) {
|
|
2122
|
-
message = error.message;
|
|
2123
|
-
} else {
|
|
2124
|
-
message = "Failed to create flash sale";
|
|
2125
|
-
}
|
|
2126
|
-
ui.toast.error("Failed to create flash sale", {
|
|
2127
|
-
description: message
|
|
2128
|
-
});
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2132
|
-
FlashSaleForm,
|
|
2133
|
-
{
|
|
2134
|
-
onSubmit: handleSubmit,
|
|
2135
|
-
onCancel: () => navigate("/flash-sales")
|
|
2136
|
-
}
|
|
2137
|
-
);
|
|
2138
|
-
};
|
|
2139
2104
|
const useFlashSaleById = (id) => {
|
|
2140
2105
|
const [data, setData] = react.useState(null);
|
|
2141
2106
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
@@ -2254,6 +2219,41 @@ const config = adminSdk.defineRouteConfig({
|
|
|
2254
2219
|
label: "Flash Sale Detail",
|
|
2255
2220
|
icon: icons.Sparkles
|
|
2256
2221
|
});
|
|
2222
|
+
const FlashSaleCreate = () => {
|
|
2223
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2224
|
+
async function handleSubmit(campaignData) {
|
|
2225
|
+
var _a;
|
|
2226
|
+
try {
|
|
2227
|
+
await axios__default.default.post("/admin/flash-sales", {
|
|
2228
|
+
...campaignData,
|
|
2229
|
+
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
2230
|
+
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
2231
|
+
});
|
|
2232
|
+
ui.toast.success("Flash sale created successfully");
|
|
2233
|
+
navigate("/flash-sales");
|
|
2234
|
+
} catch (error) {
|
|
2235
|
+
let message;
|
|
2236
|
+
if (axios__default.default.isAxiosError(error)) {
|
|
2237
|
+
console.log(error);
|
|
2238
|
+
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
2239
|
+
} else if (error instanceof Error) {
|
|
2240
|
+
message = error.message;
|
|
2241
|
+
} else {
|
|
2242
|
+
message = "Failed to create flash sale";
|
|
2243
|
+
}
|
|
2244
|
+
ui.toast.error("Failed to create flash sale", {
|
|
2245
|
+
description: message
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2250
|
+
FlashSaleForm,
|
|
2251
|
+
{
|
|
2252
|
+
onSubmit: handleSubmit,
|
|
2253
|
+
onCancel: () => navigate("/flash-sales")
|
|
2254
|
+
}
|
|
2255
|
+
);
|
|
2256
|
+
};
|
|
2257
2257
|
const widgetModule = { widgets: [
|
|
2258
2258
|
{
|
|
2259
2259
|
Component: CampaignDetailWidget,
|
|
@@ -2278,24 +2278,18 @@ const routeModule = {
|
|
|
2278
2278
|
Component: CouponCreate,
|
|
2279
2279
|
path: "/coupons/create"
|
|
2280
2280
|
},
|
|
2281
|
-
{
|
|
2282
|
-
Component: FlashSaleCreate,
|
|
2283
|
-
path: "/flash-sales/create"
|
|
2284
|
-
},
|
|
2285
2281
|
{
|
|
2286
2282
|
Component: FlashSaleDetail,
|
|
2287
2283
|
path: "/flash-sales/:id"
|
|
2284
|
+
},
|
|
2285
|
+
{
|
|
2286
|
+
Component: FlashSaleCreate,
|
|
2287
|
+
path: "/flash-sales/create"
|
|
2288
2288
|
}
|
|
2289
2289
|
]
|
|
2290
2290
|
};
|
|
2291
2291
|
const menuItemModule = {
|
|
2292
2292
|
menuItems: [
|
|
2293
|
-
{
|
|
2294
|
-
label: config$3.label,
|
|
2295
|
-
icon: config$3.icon,
|
|
2296
|
-
path: "/coupons",
|
|
2297
|
-
nested: void 0
|
|
2298
|
-
},
|
|
2299
2293
|
{
|
|
2300
2294
|
label: config$2.label,
|
|
2301
2295
|
icon: config$2.icon,
|
|
@@ -2303,9 +2297,9 @@ const menuItemModule = {
|
|
|
2303
2297
|
nested: void 0
|
|
2304
2298
|
},
|
|
2305
2299
|
{
|
|
2306
|
-
label: config$
|
|
2307
|
-
icon: config$
|
|
2308
|
-
path: "/coupons
|
|
2300
|
+
label: config$3.label,
|
|
2301
|
+
icon: config$3.icon,
|
|
2302
|
+
path: "/coupons",
|
|
2309
2303
|
nested: void 0
|
|
2310
2304
|
},
|
|
2311
2305
|
{
|
|
@@ -2313,6 +2307,12 @@ const menuItemModule = {
|
|
|
2313
2307
|
icon: config.icon,
|
|
2314
2308
|
path: "/flash-sales/:id",
|
|
2315
2309
|
nested: void 0
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
label: config$1.label,
|
|
2313
|
+
icon: config$1.icon,
|
|
2314
|
+
path: "/coupons/:id",
|
|
2315
|
+
nested: void 0
|
|
2316
2316
|
}
|
|
2317
2317
|
]
|
|
2318
2318
|
};
|
|
@@ -2095,41 +2095,6 @@ const FlashSaleForm = ({
|
|
|
2095
2095
|
] }) })
|
|
2096
2096
|
] });
|
|
2097
2097
|
};
|
|
2098
|
-
const FlashSaleCreate = () => {
|
|
2099
|
-
const navigate = useNavigate();
|
|
2100
|
-
async function handleSubmit(campaignData) {
|
|
2101
|
-
var _a;
|
|
2102
|
-
try {
|
|
2103
|
-
await axios.post("/admin/flash-sales", {
|
|
2104
|
-
...campaignData,
|
|
2105
|
-
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
2106
|
-
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
2107
|
-
});
|
|
2108
|
-
toast.success("Flash sale created successfully");
|
|
2109
|
-
navigate("/flash-sales");
|
|
2110
|
-
} catch (error) {
|
|
2111
|
-
let message;
|
|
2112
|
-
if (axios.isAxiosError(error)) {
|
|
2113
|
-
console.log(error);
|
|
2114
|
-
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
2115
|
-
} else if (error instanceof Error) {
|
|
2116
|
-
message = error.message;
|
|
2117
|
-
} else {
|
|
2118
|
-
message = "Failed to create flash sale";
|
|
2119
|
-
}
|
|
2120
|
-
toast.error("Failed to create flash sale", {
|
|
2121
|
-
description: message
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
return /* @__PURE__ */ jsx(
|
|
2126
|
-
FlashSaleForm,
|
|
2127
|
-
{
|
|
2128
|
-
onSubmit: handleSubmit,
|
|
2129
|
-
onCancel: () => navigate("/flash-sales")
|
|
2130
|
-
}
|
|
2131
|
-
);
|
|
2132
|
-
};
|
|
2133
2098
|
const useFlashSaleById = (id) => {
|
|
2134
2099
|
const [data, setData] = useState(null);
|
|
2135
2100
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -2248,6 +2213,41 @@ const config = defineRouteConfig({
|
|
|
2248
2213
|
label: "Flash Sale Detail",
|
|
2249
2214
|
icon: Sparkles
|
|
2250
2215
|
});
|
|
2216
|
+
const FlashSaleCreate = () => {
|
|
2217
|
+
const navigate = useNavigate();
|
|
2218
|
+
async function handleSubmit(campaignData) {
|
|
2219
|
+
var _a;
|
|
2220
|
+
try {
|
|
2221
|
+
await axios.post("/admin/flash-sales", {
|
|
2222
|
+
...campaignData,
|
|
2223
|
+
starts_at: new Date(campaignData.starts_at).toUTCString(),
|
|
2224
|
+
ends_at: new Date(campaignData.ends_at).toUTCString()
|
|
2225
|
+
});
|
|
2226
|
+
toast.success("Flash sale created successfully");
|
|
2227
|
+
navigate("/flash-sales");
|
|
2228
|
+
} catch (error) {
|
|
2229
|
+
let message;
|
|
2230
|
+
if (axios.isAxiosError(error)) {
|
|
2231
|
+
console.log(error);
|
|
2232
|
+
message = (_a = error.response) == null ? void 0 : _a.data.message;
|
|
2233
|
+
} else if (error instanceof Error) {
|
|
2234
|
+
message = error.message;
|
|
2235
|
+
} else {
|
|
2236
|
+
message = "Failed to create flash sale";
|
|
2237
|
+
}
|
|
2238
|
+
toast.error("Failed to create flash sale", {
|
|
2239
|
+
description: message
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
return /* @__PURE__ */ jsx(
|
|
2244
|
+
FlashSaleForm,
|
|
2245
|
+
{
|
|
2246
|
+
onSubmit: handleSubmit,
|
|
2247
|
+
onCancel: () => navigate("/flash-sales")
|
|
2248
|
+
}
|
|
2249
|
+
);
|
|
2250
|
+
};
|
|
2251
2251
|
const widgetModule = { widgets: [
|
|
2252
2252
|
{
|
|
2253
2253
|
Component: CampaignDetailWidget,
|
|
@@ -2272,24 +2272,18 @@ const routeModule = {
|
|
|
2272
2272
|
Component: CouponCreate,
|
|
2273
2273
|
path: "/coupons/create"
|
|
2274
2274
|
},
|
|
2275
|
-
{
|
|
2276
|
-
Component: FlashSaleCreate,
|
|
2277
|
-
path: "/flash-sales/create"
|
|
2278
|
-
},
|
|
2279
2275
|
{
|
|
2280
2276
|
Component: FlashSaleDetail,
|
|
2281
2277
|
path: "/flash-sales/:id"
|
|
2278
|
+
},
|
|
2279
|
+
{
|
|
2280
|
+
Component: FlashSaleCreate,
|
|
2281
|
+
path: "/flash-sales/create"
|
|
2282
2282
|
}
|
|
2283
2283
|
]
|
|
2284
2284
|
};
|
|
2285
2285
|
const menuItemModule = {
|
|
2286
2286
|
menuItems: [
|
|
2287
|
-
{
|
|
2288
|
-
label: config$3.label,
|
|
2289
|
-
icon: config$3.icon,
|
|
2290
|
-
path: "/coupons",
|
|
2291
|
-
nested: void 0
|
|
2292
|
-
},
|
|
2293
2287
|
{
|
|
2294
2288
|
label: config$2.label,
|
|
2295
2289
|
icon: config$2.icon,
|
|
@@ -2297,9 +2291,9 @@ const menuItemModule = {
|
|
|
2297
2291
|
nested: void 0
|
|
2298
2292
|
},
|
|
2299
2293
|
{
|
|
2300
|
-
label: config$
|
|
2301
|
-
icon: config$
|
|
2302
|
-
path: "/coupons
|
|
2294
|
+
label: config$3.label,
|
|
2295
|
+
icon: config$3.icon,
|
|
2296
|
+
path: "/coupons",
|
|
2303
2297
|
nested: void 0
|
|
2304
2298
|
},
|
|
2305
2299
|
{
|
|
@@ -2307,6 +2301,12 @@ const menuItemModule = {
|
|
|
2307
2301
|
icon: config.icon,
|
|
2308
2302
|
path: "/flash-sales/:id",
|
|
2309
2303
|
nested: void 0
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
label: config$1.label,
|
|
2307
|
+
icon: config$1.icon,
|
|
2308
|
+
path: "/coupons/:id",
|
|
2309
|
+
nested: void 0
|
|
2310
2310
|
}
|
|
2311
2311
|
]
|
|
2312
2312
|
};
|