quickbooks-medusa-plugin 0.0.5 → 0.0.6
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/package.json +8 -7
- package/src/admin/README.md +31 -0
- package/src/admin/i18n/README.md +58 -0
- package/src/admin/i18n/index.ts +1 -0
- package/src/admin/index.ts +6 -0
- package/src/admin/tsconfig.json +24 -0
- package/src/admin/vite-env.d.ts +1 -0
- /package/{.medusa/server/src → src}/admin/routes/settings/quickbooks/page.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quickbooks-medusa-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Medusa v2 plugin for QuickBooks Online bi-directional sync (Customers, Products, Orders, Inventory).",
|
|
5
5
|
"author": "bootssecurity",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
|
-
".medusa/server"
|
|
8
|
+
".medusa/server",
|
|
9
|
+
"src/admin"
|
|
9
10
|
],
|
|
10
11
|
"exports": {
|
|
11
12
|
"./package.json": "./package.json",
|
|
@@ -15,9 +16,9 @@
|
|
|
15
16
|
"./providers/*": "./.medusa/server/src/providers/*/index.js",
|
|
16
17
|
"./*": "./.medusa/server/src/*.js",
|
|
17
18
|
"./admin": {
|
|
18
|
-
"import": "
|
|
19
|
-
"require": "
|
|
20
|
-
"default": "
|
|
19
|
+
"import": "./src/admin/index.ts",
|
|
20
|
+
"require": "./src/admin/index.ts",
|
|
21
|
+
"default": "./src/admin/index.ts"
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
"keywords": [
|
|
@@ -30,9 +31,9 @@
|
|
|
30
31
|
"intuit"
|
|
31
32
|
],
|
|
32
33
|
"scripts": {
|
|
33
|
-
"build": "medusa plugin:build
|
|
34
|
+
"build": "medusa plugin:build",
|
|
34
35
|
"dev": "medusa plugin:develop",
|
|
35
|
-
"prepublishOnly": "
|
|
36
|
+
"prepublishOnly": "medusa plugin:build"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@medusajs/admin-sdk": "2.12.3",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Admin Customizations
|
|
2
|
+
|
|
3
|
+
You can extend the Medusa Admin to add widgets and new pages. Your customizations interact with API routes to provide merchants with custom functionalities.
|
|
4
|
+
|
|
5
|
+
## Example: Create a Widget
|
|
6
|
+
|
|
7
|
+
A widget is a React component that can be injected into an existing page in the admin dashboard.
|
|
8
|
+
|
|
9
|
+
For example, create the file `src/admin/widgets/product-widget.tsx` with the following content:
|
|
10
|
+
|
|
11
|
+
```tsx title="src/admin/widgets/product-widget.tsx"
|
|
12
|
+
import { defineWidgetConfig } from "@medusajs/admin-sdk"
|
|
13
|
+
|
|
14
|
+
// The widget
|
|
15
|
+
const ProductWidget = () => {
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<h2>Product Widget</h2>
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// The widget's configurations
|
|
24
|
+
export const config = defineWidgetConfig({
|
|
25
|
+
zone: "product.details.after",
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export default ProductWidget
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This inserts a widget with the text “Product Widget” at the end of a product’s details page.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Admin Customizations Translations
|
|
2
|
+
|
|
3
|
+
The Medusa Admin dashboard supports multiple languages for its interface. Medusa uses [react-i18next](https://react.i18next.com/) to manage translations in the admin dashboard.
|
|
4
|
+
|
|
5
|
+
To add translations, create JSON translation files for each language under the `src/admin/i18n/json` directory. For example, create the `src/admin/i18n/json/en.json` file with the following content:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"brands": {
|
|
10
|
+
"title": "Brands",
|
|
11
|
+
"description": "Manage your product brands"
|
|
12
|
+
},
|
|
13
|
+
"done": "Done"
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then, export the translations in `src/admin/i18n/index.ts`:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import en from "./json/en.json" with { type: "json" }
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
en: {
|
|
24
|
+
translation: en,
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Finally, use translations in your admin widgets and routes using the `useTranslation` hook:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { defineWidgetConfig } from "@medusajs/admin-sdk"
|
|
33
|
+
import { Button, Container, Heading } from "@medusajs/ui"
|
|
34
|
+
import { useTranslation } from "react-i18next"
|
|
35
|
+
|
|
36
|
+
const ProductWidget = () => {
|
|
37
|
+
const { t } = useTranslation()
|
|
38
|
+
return (
|
|
39
|
+
<Container className="p-0">
|
|
40
|
+
<div className="flex items-center justify-between px-6 py-4">
|
|
41
|
+
<Heading level="h2">{t("brands.title")}</Heading>
|
|
42
|
+
<p>{t("brands.description")}</p>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="flex justify-end px-6 py-4">
|
|
45
|
+
<Button variant="primary">{t("done")}</Button>
|
|
46
|
+
</div>
|
|
47
|
+
</Container>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const config = defineWidgetConfig({
|
|
52
|
+
zone: "product.details.before",
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export default ProductWidget
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Learn more about translating admin extensions in the [Translate Admin Customizations](https://docs.medusajs.com/learn/fundamentals/admin/translations) documentation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["."]
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
File without changes
|