@alphabite/medusa-wishlist 0.0.1 → 0.0.2
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.
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const adminSdk = require("@medusajs/admin-sdk");
|
|
4
|
+
const ui = require("@medusajs/ui");
|
|
5
|
+
const reactQuery = require("@tanstack/react-query");
|
|
6
|
+
const Medusa = require("@medusajs/js-sdk");
|
|
7
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
|
+
const Medusa__default = /* @__PURE__ */ _interopDefault(Medusa);
|
|
9
|
+
const sdk = new Medusa__default.default({
|
|
10
|
+
baseUrl: "http://localhost:9000",
|
|
11
|
+
debug: process.env.NODE_ENV === "development",
|
|
12
|
+
auth: {
|
|
13
|
+
type: "session"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const ProductWidget = ({ data: product }) => {
|
|
17
|
+
const { data, isLoading } = reactQuery.useQuery({
|
|
18
|
+
queryFn: () => sdk.client.fetch(`/admin/products/${product.id}/wishlist`),
|
|
19
|
+
queryKey: [["products", product.id, "wishlist"]]
|
|
20
|
+
});
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "divide-y p-0", children: [
|
|
22
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Wishlist" }) }),
|
|
23
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "px-6 py-4", children: isLoading ? "Loading..." : `This product is in ${(data == null ? void 0 : data.count) || 0} wishlist(s).` })
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
adminSdk.defineWidgetConfig({
|
|
27
|
+
zone: "product.details.before"
|
|
28
|
+
});
|
|
29
|
+
const widgetModule = { widgets: [
|
|
30
|
+
{
|
|
31
|
+
Component: ProductWidget,
|
|
32
|
+
zone: ["product.details.before"]
|
|
33
|
+
}
|
|
34
|
+
] };
|
|
35
|
+
const routeModule = {
|
|
36
|
+
routes: []
|
|
37
|
+
};
|
|
38
|
+
const menuItemModule = {
|
|
39
|
+
menuItems: []
|
|
40
|
+
};
|
|
41
|
+
const formModule = { customFields: {} };
|
|
42
|
+
const displayModule = {
|
|
43
|
+
displays: {}
|
|
44
|
+
};
|
|
45
|
+
const plugin = {
|
|
46
|
+
widgetModule,
|
|
47
|
+
routeModule,
|
|
48
|
+
menuItemModule,
|
|
49
|
+
formModule,
|
|
50
|
+
displayModule
|
|
51
|
+
};
|
|
52
|
+
module.exports = plugin;
|
|
@@ -2,23 +2,50 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { defineWidgetConfig } from "@medusajs/admin-sdk";
|
|
3
3
|
import { Container, Heading, Text } from "@medusajs/ui";
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import Medusa from "@medusajs/js-sdk";
|
|
6
|
+
const sdk = new Medusa({
|
|
7
|
+
baseUrl: "http://localhost:9000",
|
|
8
|
+
debug: process.env.NODE_ENV === "development",
|
|
9
|
+
auth: {
|
|
10
|
+
type: "session"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const ProductWidget = ({ data: product }) => {
|
|
9
14
|
const { data, isLoading } = useQuery({
|
|
10
15
|
queryFn: () => sdk.client.fetch(`/admin/products/${product.id}/wishlist`),
|
|
11
16
|
queryKey: [["products", product.id, "wishlist"]]
|
|
12
17
|
});
|
|
13
18
|
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
14
19
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-6 py-4", children: /* @__PURE__ */ jsx(Heading, { level: "h2", children: "Wishlist" }) }),
|
|
15
|
-
/* @__PURE__ */ jsx(Text, { className: "px-6 py-4", children: isLoading ? "Loading..." : `This product is in ${data == null ? void 0 : data.count} wishlist(s).` })
|
|
20
|
+
/* @__PURE__ */ jsx(Text, { className: "px-6 py-4", children: isLoading ? "Loading..." : `This product is in ${(data == null ? void 0 : data.count) || 0} wishlist(s).` })
|
|
16
21
|
] });
|
|
17
22
|
};
|
|
18
|
-
|
|
23
|
+
defineWidgetConfig({
|
|
19
24
|
zone: "product.details.before"
|
|
20
25
|
});
|
|
26
|
+
const widgetModule = { widgets: [
|
|
27
|
+
{
|
|
28
|
+
Component: ProductWidget,
|
|
29
|
+
zone: ["product.details.before"]
|
|
30
|
+
}
|
|
31
|
+
] };
|
|
32
|
+
const routeModule = {
|
|
33
|
+
routes: []
|
|
34
|
+
};
|
|
35
|
+
const menuItemModule = {
|
|
36
|
+
menuItems: []
|
|
37
|
+
};
|
|
38
|
+
const formModule = { customFields: {} };
|
|
39
|
+
const displayModule = {
|
|
40
|
+
displays: {}
|
|
41
|
+
};
|
|
42
|
+
const plugin = {
|
|
43
|
+
widgetModule,
|
|
44
|
+
routeModule,
|
|
45
|
+
menuItemModule,
|
|
46
|
+
formModule,
|
|
47
|
+
displayModule
|
|
48
|
+
};
|
|
21
49
|
export {
|
|
22
|
-
|
|
23
|
-
config
|
|
50
|
+
plugin as default
|
|
24
51
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphabite/medusa-wishlist",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"author": "
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Alphabite's Medusa Wishlist Plugin",
|
|
5
|
+
"author": "Alphabite (https://alphabite.io)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
".medusa/server"
|
|
@@ -13,19 +13,22 @@
|
|
|
13
13
|
"./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
|
|
14
14
|
"./modules/*": "./.medusa/server/src/modules/*/index.js",
|
|
15
15
|
"./providers/*": "./.medusa/server/src/providers/*/index.js",
|
|
16
|
-
"./*": "./.medusa/server/src/*.js",
|
|
17
16
|
"./admin": {
|
|
18
17
|
"import": "./.medusa/server/src/admin/index.mjs",
|
|
19
18
|
"require": "./.medusa/server/src/admin/index.js",
|
|
20
19
|
"default": "./.medusa/server/src/admin/index.js"
|
|
21
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./*": "./.medusa/server/src/*.js"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"medusa",
|
|
25
25
|
"plugin",
|
|
26
|
-
"medusa-plugin-other",
|
|
27
26
|
"medusa-plugin",
|
|
28
|
-
"medusa-
|
|
27
|
+
"medusa-plugin-other",
|
|
28
|
+
"medusa-v2",
|
|
29
|
+
"medusa-alphabite",
|
|
30
|
+
"medusa-alphabite-plugin",
|
|
31
|
+
"medusa-alphabite-wishlist-plugin"
|
|
29
32
|
],
|
|
30
33
|
"scripts": {
|
|
31
34
|
"build": "medusa plugin:build",
|
|
@@ -33,13 +36,13 @@
|
|
|
33
36
|
"prepublishOnly": "medusa plugin:build"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"@medusajs/admin-sdk": "2.
|
|
37
|
-
"@medusajs/cli": "2.
|
|
38
|
-
"@medusajs/framework": "2.
|
|
39
|
-
"@medusajs/medusa": "2.
|
|
40
|
-
"@medusajs/test-utils": "2.
|
|
39
|
+
"@medusajs/admin-sdk": "2.8.3",
|
|
40
|
+
"@medusajs/cli": "2.8.3",
|
|
41
|
+
"@medusajs/framework": "2.8.3",
|
|
42
|
+
"@medusajs/medusa": "2.8.3",
|
|
43
|
+
"@medusajs/test-utils": "2.8.3",
|
|
41
44
|
"@medusajs/ui": "4.0.4",
|
|
42
|
-
"@medusajs/icons": "2.
|
|
45
|
+
"@medusajs/icons": "2.8.3",
|
|
43
46
|
"@mikro-orm/cli": "6.4.3",
|
|
44
47
|
"@mikro-orm/core": "6.4.3",
|
|
45
48
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -60,13 +63,13 @@
|
|
|
60
63
|
"yalc": "^1.0.0-pre.53"
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|
|
63
|
-
"@medusajs/admin-sdk": "2.
|
|
64
|
-
"@medusajs/cli": "2.
|
|
65
|
-
"@medusajs/framework": "2.
|
|
66
|
-
"@medusajs/test-utils": "2.
|
|
67
|
-
"@medusajs/medusa": "2.
|
|
66
|
+
"@medusajs/admin-sdk": "2.8.3",
|
|
67
|
+
"@medusajs/cli": "2.8.3",
|
|
68
|
+
"@medusajs/framework": "2.8.3",
|
|
69
|
+
"@medusajs/test-utils": "2.8.3",
|
|
70
|
+
"@medusajs/medusa": "2.8.3",
|
|
68
71
|
"@medusajs/ui": "4.0.3",
|
|
69
|
-
"@medusajs/icons": "2.
|
|
72
|
+
"@medusajs/icons": "2.8.3",
|
|
70
73
|
"@mikro-orm/cli": "6.4.3",
|
|
71
74
|
"@mikro-orm/core": "6.4.3",
|
|
72
75
|
"@mikro-orm/knex": "6.4.3",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Medusa from "D:/Documents/GitHub/medusa-wishlist/node_modules/@medusajs/js-sdk/dist/esm/index.js";
|
|
2
|
-
const sdk = new Medusa({
|
|
3
|
-
baseUrl: "http://localhost:9000",
|
|
4
|
-
debug: process.env.NODE_ENV === "development",
|
|
5
|
-
auth: {
|
|
6
|
-
type: "session"
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
sdk
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|