Merge branch 'master' into docs/segment-integration
This commit is contained in:
@@ -3,6 +3,7 @@ module.exports = {
|
||||
title: "Medusa",
|
||||
description: "Open-source headless commerce engine",
|
||||
author: "Medusa core team",
|
||||
siteUrl: "https://docs.medusajs.com/api"
|
||||
},
|
||||
plugins: [
|
||||
`gatsby-plugin-react-helmet`,
|
||||
@@ -73,6 +74,12 @@ module.exports = {
|
||||
trackPage: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
resolve: `gatsby-plugin-sitemap`,
|
||||
options: {
|
||||
output: '/api/sitemap'
|
||||
}
|
||||
},
|
||||
// `gatsby-plugin-preact`,
|
||||
// {
|
||||
// resolve: `gatsby-source-openapi-aggregate`,
|
||||
@@ -81,7 +88,7 @@ module.exports = {
|
||||
// {
|
||||
// name: "admin-spec",
|
||||
// resolve: () =>
|
||||
// fromJson(
|
||||
// fromJson(``
|
||||
// path.resolve(__dirname, "../../docs/api/admin-spec3.json")
|
||||
// ),
|
||||
// },
|
||||
|
||||
@@ -20,8 +20,9 @@ const createCustomNode = ({ name, node, createNode }) => {
|
||||
let requestBodyValues = undefined
|
||||
|
||||
if (values.requestBody && values.requestBody.content) {
|
||||
requestBodyValues =
|
||||
values.requestBody.content["application/json"].schema
|
||||
requestBodyValues = values.requestBody.content.hasOwnProperty("application/json") ?
|
||||
values.requestBody.content["application/json"].schema :
|
||||
values.requestBody.content["multipart/form-data"].schema
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"gatsby-plugin-preact": "^5.9.0",
|
||||
"gatsby-plugin-react-helmet": "^3.3.12",
|
||||
"gatsby-plugin-segment-js": "^3.7.1",
|
||||
"gatsby-plugin-sitemap": "^5.15.0",
|
||||
"gatsby-plugin-theme-ui": "^0.10.1",
|
||||
"gatsby-remark-autolink-headers": "^4.6.0",
|
||||
"gatsby-source-filesystem": "^3.9.0",
|
||||
|
||||
@@ -6,21 +6,47 @@ import React from 'react'
|
||||
import { ThemeToggler } from 'gatsby-plugin-dark-mode'
|
||||
import { useColorMode } from 'theme-ui'
|
||||
|
||||
const isBrowser = typeof window !== "undefined"
|
||||
|
||||
export default function ColorModeToggler () {
|
||||
const [, setColorMode] = useColorMode()
|
||||
|
||||
function checkLocalStorage (currentTheme, toggleTheme) {
|
||||
//check that theme local storage values are set correctly
|
||||
if (!isBrowser) {
|
||||
return currentTheme;
|
||||
}
|
||||
let themeUiColorMode = window.localStorage.getItem('theme-ui-color-mode');
|
||||
let theme = window.localStorage.getItem('theme')
|
||||
if (!themeUiColorMode) {
|
||||
themeUiColorMode = theme || currentTheme
|
||||
window.localStorage.setItem('theme-ui-color-mode', themeUiColorMode);
|
||||
setColorMode(themeUiColorMode);
|
||||
}
|
||||
if (!theme) {
|
||||
theme = themeUiColorMode || currentTheme
|
||||
window.localStorage.setItem('theme', theme);
|
||||
toggleTheme(theme)
|
||||
}
|
||||
|
||||
return theme || themeUiColorMode || currentTheme;
|
||||
}
|
||||
|
||||
return (
|
||||
<ThemeToggler>
|
||||
{({ theme, toggleTheme }) => (
|
||||
<button onClick={() => {
|
||||
const mode = theme === 'dark' ? 'light' : 'dark';
|
||||
toggleTheme(mode);
|
||||
setColorMode(mode);
|
||||
}} className="dark-mode-toggler">
|
||||
{theme === "light" && <LightMode />}
|
||||
{theme === "dark" && <DarkMode />}
|
||||
</button>
|
||||
)}
|
||||
{({ theme, toggleTheme }) => {
|
||||
const currentTheme = checkLocalStorage(theme, toggleTheme);
|
||||
return (
|
||||
<button onClick={() => {
|
||||
const mode = currentTheme === 'dark' ? 'light' : 'dark';
|
||||
toggleTheme(mode);
|
||||
setColorMode(mode);
|
||||
}} className="dark-mode-toggler">
|
||||
{currentTheme === "light" && <LightMode />}
|
||||
{currentTheme === "dark" && <DarkMode />}
|
||||
</button>
|
||||
);
|
||||
}}
|
||||
</ThemeToggler>
|
||||
)
|
||||
}
|
||||
+50
-1
@@ -2225,6 +2225,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.34.tgz#fe4b38b3f07617c0fa31ae923fca9249641038f0"
|
||||
integrity sha512-USUftMYpmuMzeWobskoPfzDi+vkpe0dvcOBRNOscFrGxVp4jomnRxWuVohgqBow2xyIPC0S3gjxV/5079jhmDg==
|
||||
|
||||
"@types/node@^17.0.5":
|
||||
version "17.0.35"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.35.tgz#635b7586086d51fb40de0a2ec9d1014a5283ba4a"
|
||||
integrity sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==
|
||||
|
||||
"@types/node@^8.5.7":
|
||||
version "8.10.66"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3"
|
||||
@@ -2276,6 +2281,13 @@
|
||||
"@types/glob" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/sax@^1.2.1":
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/sax/-/sax-1.2.4.tgz#8221affa7f4f3cb21abd22f244cfabfa63e6a69e"
|
||||
integrity sha512-pSAff4IAxJjfAXUG6tFkO7dsSbTmf8CtUpfhhZ5VhkRpC4628tJhh3+V6H1E+/Gs9piSzYKT5yzHO5M4GG9jkw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/scheduler@*":
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
|
||||
@@ -2717,6 +2729,11 @@ arg@^4.1.0:
|
||||
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
|
||||
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
|
||||
|
||||
arg@^5.0.0:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.1.tgz#eb0c9a8f77786cad2af8ff2b862899842d7b6adb"
|
||||
integrity sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==
|
||||
|
||||
argparse@^1.0.7:
|
||||
version "1.0.10"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
|
||||
@@ -3572,7 +3589,7 @@ commander@^7.2.0:
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
|
||||
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
|
||||
|
||||
common-tags@^1.8.0:
|
||||
common-tags@^1.8.0, common-tags@^1.8.2:
|
||||
version "1.8.2"
|
||||
resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6"
|
||||
integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==
|
||||
@@ -5430,6 +5447,16 @@ gatsby-plugin-segment-js@^3.7.1:
|
||||
resolved "https://registry.yarnpkg.com/gatsby-plugin-segment-js/-/gatsby-plugin-segment-js-3.7.1.tgz#3432d59be0e45ee82f36a42cff060af220a0dd68"
|
||||
integrity sha512-zAsjRrF77Kih7YRUJVp84thnODbzjDE44H6ePtdQfLVyPWiJj3IpS/WAwyRg9Cu3+FciFAT8WEjfJ2I02V0sUw==
|
||||
|
||||
gatsby-plugin-sitemap@^5.15.0:
|
||||
version "5.15.0"
|
||||
resolved "https://registry.yarnpkg.com/gatsby-plugin-sitemap/-/gatsby-plugin-sitemap-5.15.0.tgz#6035eb3a80de90dda3356deea083653e483fef5f"
|
||||
integrity sha512-2G7ooRqwOHe3zItd2WoOVEbqnFBXaQSQ2whxug3LAJr7PbZa33kukRQQcjK6v5IO5HidWAFpP9t1a5LOIeDpCw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.15.4"
|
||||
common-tags "^1.8.2"
|
||||
minimatch "^3.1.2"
|
||||
sitemap "^7.0.0"
|
||||
|
||||
gatsby-plugin-theme-ui@^0.10.1:
|
||||
version "0.10.1"
|
||||
resolved "https://registry.yarnpkg.com/gatsby-plugin-theme-ui/-/gatsby-plugin-theme-ui-0.10.1.tgz#d1ac7f4f1c4bf187694110a8670f0bb3ff470ad2"
|
||||
@@ -8255,6 +8282,13 @@ minimatch@3.0.4, minimatch@^3.0.4:
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimatch@^3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
|
||||
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
|
||||
dependencies:
|
||||
brace-expansion "^1.1.7"
|
||||
|
||||
minimist@^1.1.0, minimist@^1.2.0, minimist@^1.2.5:
|
||||
version "1.2.5"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
|
||||
@@ -10159,6 +10193,11 @@ sanitize-html@^1.27.5:
|
||||
parse-srcset "^1.0.2"
|
||||
postcss "^7.0.27"
|
||||
|
||||
sax@^1.2.4:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
|
||||
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
|
||||
|
||||
scheduler@^0.19.1:
|
||||
version "0.19.1"
|
||||
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
|
||||
@@ -10364,6 +10403,16 @@ sisteransi@^1.0.5:
|
||||
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
|
||||
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==
|
||||
|
||||
sitemap@^7.0.0:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/sitemap/-/sitemap-7.1.1.tgz#eeed9ad6d95499161a3eadc60f8c6dce4bea2bef"
|
||||
integrity sha512-mK3aFtjz4VdJN0igpIJrinf3EO8U8mxOPsTBzSsy06UtjZQJ3YY3o3Xa7zSc5nMqcMrRwlChHZ18Kxg0caiPBg==
|
||||
dependencies:
|
||||
"@types/node" "^17.0.5"
|
||||
"@types/sax" "^1.2.1"
|
||||
arg "^5.0.0"
|
||||
sax "^1.2.4"
|
||||
|
||||
slash@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
||||
|
||||
Reference in New Issue
Block a user