+ )
+}
+
+export default Glossary
diff --git a/www/docs/src/components/LearningPath/index.tsx b/www/docs/src/components/LearningPath/index.tsx
index cb69920514..406330dbac 100644
--- a/www/docs/src/components/LearningPath/index.tsx
+++ b/www/docs/src/components/LearningPath/index.tsx
@@ -1,5 +1,5 @@
import { useLearningPath } from "@site/src/providers/LearningPath"
-import { useNotifications } from "@site/src/providers/NotificationProvider"
+import { useNotifications } from "@site/src/providers/Notification"
import { getLearningPath } from "@site/src/utils/learning-paths"
import clsx from "clsx"
import React from "react"
diff --git a/www/docs/src/components/Notification/Container/index.tsx b/www/docs/src/components/Notification/Container/index.tsx
index c2ec71e2fb..a2ced142a0 100644
--- a/www/docs/src/components/Notification/Container/index.tsx
+++ b/www/docs/src/components/Notification/Container/index.tsx
@@ -1,7 +1,7 @@
import {
NotificationItemType,
useNotifications,
-} from "@site/src/providers/NotificationProvider"
+} from "@site/src/providers/Notification"
import React from "react"
import NotificationItem from "../Item"
import { CSSTransition, TransitionGroup } from "react-transition-group"
diff --git a/www/docs/src/hooks/use-current-learning-path.tsx b/www/docs/src/hooks/use-current-learning-path.tsx
index 0022f00f64..c46aaf8f64 100644
--- a/www/docs/src/hooks/use-current-learning-path.tsx
+++ b/www/docs/src/hooks/use-current-learning-path.tsx
@@ -1,6 +1,6 @@
import React, { useEffect } from "react"
import { useLearningPath } from "../providers/LearningPath"
-import { useNotifications } from "../providers/NotificationProvider"
+import { useNotifications } from "../providers/Notification"
import LearningPathSteps from "../components/LearningPath/Steps"
import LearningPathFinish from "../components/LearningPath/Finish"
import LearningPathIcon from "../components/LearningPath/Icon"
diff --git a/www/docs/src/hooks/use-onboarding.tsx b/www/docs/src/hooks/use-onboarding.tsx
index 54b276dbdf..4557929fa2 100644
--- a/www/docs/src/hooks/use-onboarding.tsx
+++ b/www/docs/src/hooks/use-onboarding.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react"
import { useQueryStringValue } from "@docusaurus/theme-common/internal"
-import { useNotifications } from "../providers/NotificationProvider"
+import { useNotifications } from "../providers/Notification"
import Rating from "../components/Rating"
import { useUser } from "../providers/User"
diff --git a/www/docs/src/providers/NotificationProvider/index.tsx b/www/docs/src/providers/Notification/index.tsx
similarity index 100%
rename from www/docs/src/providers/NotificationProvider/index.tsx
rename to www/docs/src/providers/Notification/index.tsx
diff --git a/www/docs/src/theme/DocPage/index.tsx b/www/docs/src/theme/DocPage/index.tsx
index 1e26ecb1f3..33844596ab 100644
--- a/www/docs/src/theme/DocPage/index.tsx
+++ b/www/docs/src/theme/DocPage/index.tsx
@@ -17,7 +17,7 @@ import SearchMetadata from "@theme/SearchMetadata"
import type { Props } from "@theme/DocPage"
import LearningPathProvider from "@site/src/providers/LearningPath"
import SidebarProvider from "@site/src/providers/Sidebar"
-import NotificationProvider from "@site/src/providers/NotificationProvider"
+import NotificationProvider from "@site/src/providers/Notification"
import UserProvider from "@site/src/providers/User"
import ModalProvider from "../../providers/Modal"
diff --git a/www/docs/src/theme/MDXComponents/A.tsx b/www/docs/src/theme/MDXComponents/A.tsx
index 6676e2a05e..c5c76ea66f 100644
--- a/www/docs/src/theme/MDXComponents/A.tsx
+++ b/www/docs/src/theme/MDXComponents/A.tsx
@@ -1,4 +1,4 @@
-import React from "react"
+import React, { useMemo } from "react"
import type { Props } from "@theme/MDXComponents/A"
import { getGlossaryByPath } from "../../utils/glossary"
import useDocusaurusContext from "@docusaurus/useDocusaurusContext"
@@ -14,10 +14,12 @@ const MDXA = (props: Props) => {
} = useDocusaurusContext() as MedusaDocusaurusContext
// check if a glossary exists for href
- const glossary =
- (typeof children === "string" && href.startsWith("/")) || href.includes(url)
+ const glossary = useMemo(() => {
+ return (typeof children === "string" && href.startsWith("/")) ||
+ href.includes(url)
? getGlossaryByPath(children as string)
: null
+ }, [href, children])
if (!glossary) {
return
diff --git a/www/docs/src/utils/glossary.ts b/www/docs/src/utils/glossary.ts
index 8f6b3f0b27..c80b300b29 100644
--- a/www/docs/src/utils/glossary.ts
+++ b/www/docs/src/utils/glossary.ts
@@ -1,8 +1,9 @@
-type GlossaryType = {
+export type GlossaryType = {
matchTextRegex: RegExp
ignoreTextRegex?: RegExp
title: string
content: string
+ referenceLink: string
}
const glossary: GlossaryType[] = [
@@ -10,38 +11,45 @@ const glossary: GlossaryType[] = [
title: "Migration",
content: "A script that is used to reflect changes to the database schema.",
matchTextRegex: /migration/i,
+ referenceLink: "/development/entities/migrations/overview",
},
{
title: "Repository",
content:
"A class that provides generic methods to retrieve and manipulate entities.",
matchTextRegex: /(repository|repositories)/i,
+ referenceLink: "/development/entities/repositories",
},
{
title: "Entity",
content: "A class that represents a table in the database.",
matchTextRegex: /(entity|entities)/i,
+ referenceLink: "/development/entities/overview",
},
{
title: "Dependency Injection",
content: "The act of delivering the required resources to a class",
matchTextRegex: /(dependency injection|dependency-injection)/i,
+ referenceLink: "/development/fundamentals/dependency-injection",
},
{
title: "Middleware",
content:
"A function that can be executed before or after endpoint requests are handled.",
matchTextRegex: /middleware/i,
+ referenceLink: "/development/endpoints/add-middleware",
},
{
title: "Endpoint",
content: "REST API exposed to frontends or external systems.",
matchTextRegex: /endpoint/i,
+ referenceLink: "/development/endpoints/overview",
},
{
title: "Subscriber",
content: "A class that registers handler methods to an event.",
matchTextRegex: /subscriber/i,
+ referenceLink: "/development/events/subscribers",
},
{
title: "Module",
@@ -49,57 +57,67 @@ const glossary: GlossaryType[] = [
"Reusable pieces of code that provide specific functionality or feature.",
matchTextRegex: /module/,
ignoreTextRegex: /commerce module/i,
+ referenceLink: "/development/modules/overview",
},
{
title: "Loader",
content: "A script that runs when the Medusa backend starts.",
matchTextRegex: /loader/i,
+ referenceLink: "/development/loaders/overview",
},
{
title: "Scheduled Job",
content:
"A task that is performed at specific times during the Medusa backend's runtime.",
matchTextRegex: /scheduled job/i,
+ referenceLink: "/development/scheduled-jobs/overview",
},
{
title: "Batch Job",
content: "A task that is performed asynchronously and iteratively.",
matchTextRegex: /batch job/i,
+ referenceLink: "/development/batch-jobs",
},
{
title: "Strategy",
content:
"A class that contains an isolated piece of logic that can be overridden and customized",
matchTextRegex: /(strategy|strategies)/i,
+ referenceLink: "/development/strategies/overview",
},
{
title: "Feature Flag",
content: "Guards beta features in the Medusa backend.",
matchTextRegex: /(feature-flag|feature flag)/i,
+ referenceLink: "/development/feature-flags/overview",
},
{
title: "Idempotency Key",
content:
"A unique, randomly-generated key associated with a process, such as cart completion.",
matchTextRegex: /(idempotency-key|idempotency key)/i,
+ referenceLink: "/development/idempotency-key/overview",
},
{
title: "Search Service",
content:
"A class that implements an interface to provide search functionalities.",
matchTextRegex: /(search service|search-service)/i,
+ referenceLink: "/development/search/overview",
},
{
title: "File Service",
content:
"A class that implements an interface to provide storage functionalities.",
matchTextRegex: /(file service|file-service)/i,
+ referenceLink: "/development/file-service/overview",
},
{
title: "Notification Service",
content:
"A class that implements an interface to provide notification functionalities.",
matchTextRegex: /(notification service|notification-service)/i,
+ referenceLink: "/development/notification/overview",
},
{
title: "Plugin",
@@ -108,6 +126,7 @@ const glossary: GlossaryType[] = [
matchTextRegex: /plugin/i,
ignoreTextRegex:
/(file-service plugin|file service plugin|notification service plugin|notification-service plugin|search service plugin|search-service plugin)/i,
+ referenceLink: "/development/plugins/overview",
},
{
title: "Service",
@@ -115,42 +134,49 @@ const glossary: GlossaryType[] = [
matchTextRegex: /service/i,
ignoreTextRegex:
/(file-service|file service|notification service|notification-service|search service|search-service)/i,
+ referenceLink: "/development/services/overview",
},
{
title: "Publishable API Key",
content:
"An API key that is associated with a set of resources and used on the client (storefront) side.",
matchTextRegex: /(publishable-api-key|publishable api key)/i,
+ referenceLink: "/development/publishable-api-keys",
},
{
title: "JavaScript Client",
content:
"An NPM package that provides methods to interact with the Medusa backend's REST APIs.",
matchTextRegex: /(js-client|js client|medusa javascript client)/i,
+ referenceLink: "/js-client/overview",
},
{
title: "Medusa React",
content:
"An NPM package that provides React hooks and utility methods to interact with the Medusa backend's REST APIs.",
matchTextRegex: /(medusa-react|medusa react)/i,
+ referenceLink: "/medusa-react/overview",
},
{
title: "Admin Widget",
content:
"Custom React components that can be injected into different locations in the Medusa admin dashboard",
matchTextRegex: /admin widget/i,
+ referenceLink: "/admin/widgets",
},
{
title: "Admin UI Route",
content:
"A React component that is used to create a new page in the Medusa admin dashboard.",
matchTextRegex: /(admin route|admin UI route)/i,
+ referenceLink: "/admin/routes",
},
{
title: "Admin Setting Page",
content:
"A React component that is used to create a new setting page in the Medusa admin dashboard",
matchTextRegex: /admin setting page/i,
+ referenceLink: "/admin/setting-pages",
},
]