@graphcommerce/ecommerce-ui 9.0.0-canary.100 → 9.0.0-canary.103
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/CHANGELOG.md +34 -1001
- package/Config.graphqls +6 -0
- package/components/ApolloError/ApolloErrorAlert.tsx +3 -3
- package/components/ApolloError/ApolloErrorFullPage.tsx +4 -3
- package/components/ApolloError/ApolloErrorSnackbar.tsx +3 -2
- package/components/ApolloError/maskNetworkError.tsx +1 -1
- package/components/ComposedSubmitButton/ComposedSubmitButton.tsx +3 -2
- package/components/ComposedSubmitButton/ComposedSubmitLinkOrButton.tsx +3 -2
- package/components/FormComponents/ActionCardListForm.tsx +24 -13
- package/components/FormComponents/AutoCompleteElement.tsx +8 -15
- package/components/FormComponents/CheckboxButtonGroup.tsx +11 -3
- package/components/FormComponents/CheckboxElement.tsx +4 -7
- package/components/FormComponents/EmailElement.tsx +4 -2
- package/components/FormComponents/MultiSelectElement.tsx +6 -3
- package/components/FormComponents/NumberFieldElement.tsx +7 -9
- package/components/FormComponents/PasswordElement.tsx +7 -4
- package/components/FormComponents/PasswordRepeatElement.tsx +4 -2
- package/components/FormComponents/RadioButtonGroup.tsx +6 -3
- package/components/FormComponents/SelectElement.tsx +5 -7
- package/components/FormComponents/SliderElement.tsx +4 -14
- package/components/FormComponents/SwitchElement.tsx +4 -2
- package/components/FormComponents/TelephoneElement.tsx +4 -2
- package/components/FormComponents/TextFieldElement.tsx +19 -7
- package/components/FormComponents/ToggleButtonGroup.tsx +6 -12
- package/components/PreviewMode/PreviewMode.tsx +11 -7
- package/components/PreviewMode/PreviewModeActions.tsx +2 -2
- package/components/PreviewMode/PreviewModeToolbar.tsx +1 -1
- package/components/PreviewMode/previewModeDefaults.ts +1 -1
- package/components/PreviewMode/usePreviewModeForm.ts +1 -1
- package/components/WaitForQueries/WaitForQueries.tsx +3 -6
- package/package.json +8 -8
- package/route/preview.ts +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { PreviewData } from '@graphcommerce/graphql'
|
|
1
|
+
import type { PreviewData } from '@graphcommerce/graphql'
|
|
2
2
|
import {
|
|
3
|
-
Button,
|
|
4
3
|
IconSvg,
|
|
5
4
|
MessageSnackbar,
|
|
6
5
|
iconChevronRight,
|
|
@@ -16,7 +15,6 @@ import { TextFieldElement } from '../FormComponents'
|
|
|
16
15
|
import { LightTooltip } from './LightTooltip'
|
|
17
16
|
import { PreviewModeActions } from './PreviewModeActions'
|
|
18
17
|
import { PreviewModeToolbar } from './PreviewModeToolbar'
|
|
19
|
-
import { previewModeDefaults } from './previewModeDefaults'
|
|
20
18
|
|
|
21
19
|
export function getPreviewUrl() {
|
|
22
20
|
const url = new URL(window.location.href)
|
|
@@ -26,9 +24,7 @@ export function getPreviewUrl() {
|
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
function PreviewModeEnabled() {
|
|
29
|
-
const form = useForm<{ secret: string; previewData: PreviewData }>({
|
|
30
|
-
defaultValues: { previewData: previewModeDefaults() },
|
|
31
|
-
})
|
|
27
|
+
const form = useForm<{ secret: string; previewData: PreviewData }>({})
|
|
32
28
|
|
|
33
29
|
const submit = form.handleSubmit((formValues) => {
|
|
34
30
|
const url = getPreviewUrl()
|
|
@@ -51,6 +47,7 @@ function PreviewModeEnabled() {
|
|
|
51
47
|
const revalidateHandler = form.handleSubmit((formValues) => {
|
|
52
48
|
const url = getPreviewUrl()
|
|
53
49
|
Object.entries(formValues).forEach(([key, value]) => {
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
54
51
|
url.searchParams.append(key, `${value}`)
|
|
55
52
|
})
|
|
56
53
|
url.searchParams.append('action', 'revalidate')
|
|
@@ -102,7 +99,14 @@ function PreviewModeEnabled() {
|
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
function PreviewModeDisabled() {
|
|
105
|
-
const form = useForm<{ secret: string }>({
|
|
102
|
+
const form = useForm<{ secret: string }>({
|
|
103
|
+
defaultValues: {
|
|
104
|
+
secret:
|
|
105
|
+
process.env.NODE_ENV === 'development'
|
|
106
|
+
? (import.meta.graphCommerce.previewSecret ?? '')
|
|
107
|
+
: '',
|
|
108
|
+
},
|
|
109
|
+
})
|
|
106
110
|
|
|
107
111
|
const submit = form.handleSubmit((formValues) => {
|
|
108
112
|
const url = getPreviewUrl()
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { QueryResult } from '@graphcommerce/graphql'
|
|
1
|
+
import type { QueryResult } from '@graphcommerce/graphql'
|
|
2
2
|
import { useIsSSR } from '@graphcommerce/next-ui'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
export type WaitForQueriesProps = {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
waitFor: QueryResult<any, any> | boolean | (QueryResult<any, any> | boolean)[] | undefined
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Will be automatically correct.
|
|
9
|
-
*/
|
|
10
|
-
noSsr?: boolean
|
|
11
8
|
children: React.ReactNode
|
|
12
9
|
fallback?: React.ReactNode
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
/** Shows the fallback during: SSR, Hydration and Query Loading. */
|
|
16
|
-
export
|
|
13
|
+
export function WaitForQueries(props: WaitForQueriesProps) {
|
|
17
14
|
const { waitFor, fallback, children } = props
|
|
18
15
|
|
|
19
16
|
const mounted = !useIsSSR()
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/ecommerce-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.103",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
16
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
17
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/react-hook-form": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.103",
|
|
16
|
+
"@graphcommerce/graphql": "^9.0.0-canary.103",
|
|
17
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.103",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.103",
|
|
19
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.103",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.103",
|
|
21
21
|
"@lingui/core": "^4.2.1",
|
|
22
22
|
"@lingui/macro": "^4.2.1",
|
|
23
23
|
"@lingui/react": "^4.2.1",
|
|
24
24
|
"@mui/material": "^5.10.16",
|
|
25
|
-
"framer-motion": "^
|
|
25
|
+
"framer-motion": "^11.0.0",
|
|
26
26
|
"next": "*",
|
|
27
27
|
"react": "^18.2.0",
|
|
28
28
|
"react-dom": "^18.2.0"
|
package/route/preview.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PreviewData } from '@graphcommerce/graphql'
|
|
2
|
-
import { NextApiRequest, NextApiResponse } from 'next'
|
|
1
|
+
import type { PreviewData } from '@graphcommerce/graphql'
|
|
2
|
+
import type { NextApiRequest, NextApiResponse } from 'next'
|
|
3
3
|
import { previewModeDefaults } from '../components/PreviewMode/previewModeDefaults'
|
|
4
4
|
|
|
5
5
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|