@lodashventure/medusa-campaign 1.5.0 → 1.5.1

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.
@@ -2056,41 +2056,6 @@ const FlashSaleForm = ({
2056
2056
  ] }) })
2057
2057
  ] });
2058
2058
  };
2059
- const FlashSaleCreate = () => {
2060
- const navigate = reactRouterDom.useNavigate();
2061
- async function handleSubmit(campaignData) {
2062
- var _a;
2063
- try {
2064
- await axios__default.default.post("/admin/flash-sales", {
2065
- ...campaignData,
2066
- starts_at: new Date(campaignData.starts_at).toUTCString(),
2067
- ends_at: new Date(campaignData.ends_at).toUTCString()
2068
- });
2069
- ui.toast.success("Flash sale created successfully");
2070
- navigate("/flash-sales");
2071
- } catch (error) {
2072
- let message;
2073
- if (axios__default.default.isAxiosError(error)) {
2074
- console.log(error);
2075
- message = (_a = error.response) == null ? void 0 : _a.data.message;
2076
- } else if (error instanceof Error) {
2077
- message = error.message;
2078
- } else {
2079
- message = "Failed to create flash sale";
2080
- }
2081
- ui.toast.error("Failed to create flash sale", {
2082
- description: message
2083
- });
2084
- }
2085
- }
2086
- return /* @__PURE__ */ jsxRuntime.jsx(
2087
- FlashSaleForm,
2088
- {
2089
- onSubmit: handleSubmit,
2090
- onCancel: () => navigate("/flash-sales")
2091
- }
2092
- );
2093
- };
2094
2059
  const useFlashSaleById = (id) => {
2095
2060
  const [data, setData] = react.useState(null);
2096
2061
  const [isLoading, setIsLoading] = react.useState(true);
@@ -2209,6 +2174,41 @@ const config = adminSdk.defineRouteConfig({
2209
2174
  label: "Flash Sale Detail",
2210
2175
  icon: icons.Sparkles
2211
2176
  });
2177
+ const FlashSaleCreate = () => {
2178
+ const navigate = reactRouterDom.useNavigate();
2179
+ async function handleSubmit(campaignData) {
2180
+ var _a;
2181
+ try {
2182
+ await axios__default.default.post("/admin/flash-sales", {
2183
+ ...campaignData,
2184
+ starts_at: new Date(campaignData.starts_at).toUTCString(),
2185
+ ends_at: new Date(campaignData.ends_at).toUTCString()
2186
+ });
2187
+ ui.toast.success("Flash sale created successfully");
2188
+ navigate("/flash-sales");
2189
+ } catch (error) {
2190
+ let message;
2191
+ if (axios__default.default.isAxiosError(error)) {
2192
+ console.log(error);
2193
+ message = (_a = error.response) == null ? void 0 : _a.data.message;
2194
+ } else if (error instanceof Error) {
2195
+ message = error.message;
2196
+ } else {
2197
+ message = "Failed to create flash sale";
2198
+ }
2199
+ ui.toast.error("Failed to create flash sale", {
2200
+ description: message
2201
+ });
2202
+ }
2203
+ }
2204
+ return /* @__PURE__ */ jsxRuntime.jsx(
2205
+ FlashSaleForm,
2206
+ {
2207
+ onSubmit: handleSubmit,
2208
+ onCancel: () => navigate("/flash-sales")
2209
+ }
2210
+ );
2211
+ };
2212
2212
  const widgetModule = { widgets: [
2213
2213
  {
2214
2214
  Component: CampaignDetailWidget,
@@ -2233,13 +2233,13 @@ const routeModule = {
2233
2233
  Component: CouponCreate,
2234
2234
  path: "/coupons/create"
2235
2235
  },
2236
- {
2237
- Component: FlashSaleCreate,
2238
- path: "/flash-sales/create"
2239
- },
2240
2236
  {
2241
2237
  Component: FlashSaleDetail,
2242
2238
  path: "/flash-sales/:id"
2239
+ },
2240
+ {
2241
+ Component: FlashSaleCreate,
2242
+ path: "/flash-sales/create"
2243
2243
  }
2244
2244
  ]
2245
2245
  };
@@ -2050,41 +2050,6 @@ const FlashSaleForm = ({
2050
2050
  ] }) })
2051
2051
  ] });
2052
2052
  };
2053
- const FlashSaleCreate = () => {
2054
- const navigate = useNavigate();
2055
- async function handleSubmit(campaignData) {
2056
- var _a;
2057
- try {
2058
- await axios.post("/admin/flash-sales", {
2059
- ...campaignData,
2060
- starts_at: new Date(campaignData.starts_at).toUTCString(),
2061
- ends_at: new Date(campaignData.ends_at).toUTCString()
2062
- });
2063
- toast.success("Flash sale created successfully");
2064
- navigate("/flash-sales");
2065
- } catch (error) {
2066
- let message;
2067
- if (axios.isAxiosError(error)) {
2068
- console.log(error);
2069
- message = (_a = error.response) == null ? void 0 : _a.data.message;
2070
- } else if (error instanceof Error) {
2071
- message = error.message;
2072
- } else {
2073
- message = "Failed to create flash sale";
2074
- }
2075
- toast.error("Failed to create flash sale", {
2076
- description: message
2077
- });
2078
- }
2079
- }
2080
- return /* @__PURE__ */ jsx(
2081
- FlashSaleForm,
2082
- {
2083
- onSubmit: handleSubmit,
2084
- onCancel: () => navigate("/flash-sales")
2085
- }
2086
- );
2087
- };
2088
2053
  const useFlashSaleById = (id) => {
2089
2054
  const [data, setData] = useState(null);
2090
2055
  const [isLoading, setIsLoading] = useState(true);
@@ -2203,6 +2168,41 @@ const config = defineRouteConfig({
2203
2168
  label: "Flash Sale Detail",
2204
2169
  icon: Sparkles
2205
2170
  });
2171
+ const FlashSaleCreate = () => {
2172
+ const navigate = useNavigate();
2173
+ async function handleSubmit(campaignData) {
2174
+ var _a;
2175
+ try {
2176
+ await axios.post("/admin/flash-sales", {
2177
+ ...campaignData,
2178
+ starts_at: new Date(campaignData.starts_at).toUTCString(),
2179
+ ends_at: new Date(campaignData.ends_at).toUTCString()
2180
+ });
2181
+ toast.success("Flash sale created successfully");
2182
+ navigate("/flash-sales");
2183
+ } catch (error) {
2184
+ let message;
2185
+ if (axios.isAxiosError(error)) {
2186
+ console.log(error);
2187
+ message = (_a = error.response) == null ? void 0 : _a.data.message;
2188
+ } else if (error instanceof Error) {
2189
+ message = error.message;
2190
+ } else {
2191
+ message = "Failed to create flash sale";
2192
+ }
2193
+ toast.error("Failed to create flash sale", {
2194
+ description: message
2195
+ });
2196
+ }
2197
+ }
2198
+ return /* @__PURE__ */ jsx(
2199
+ FlashSaleForm,
2200
+ {
2201
+ onSubmit: handleSubmit,
2202
+ onCancel: () => navigate("/flash-sales")
2203
+ }
2204
+ );
2205
+ };
2206
2206
  const widgetModule = { widgets: [
2207
2207
  {
2208
2208
  Component: CampaignDetailWidget,
@@ -2227,13 +2227,13 @@ const routeModule = {
2227
2227
  Component: CouponCreate,
2228
2228
  path: "/coupons/create"
2229
2229
  },
2230
- {
2231
- Component: FlashSaleCreate,
2232
- path: "/flash-sales/create"
2233
- },
2234
2230
  {
2235
2231
  Component: FlashSaleDetail,
2236
2232
  path: "/flash-sales/:id"
2233
+ },
2234
+ {
2235
+ Component: FlashSaleCreate,
2236
+ path: "/flash-sales/create"
2237
2237
  }
2238
2238
  ]
2239
2239
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodashventure/medusa-campaign",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "A starter for Medusa plugins.",
5
5
  "author": "Medusa (https://medusajs.com)",
6
6
  "license": "MIT",