@graphcommerce/magento-store 8.1.0-canary.8 → 9.0.0-canary.54

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 CHANGED
@@ -1,5 +1,102 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.54
4
+
5
+ ## 8.1.0-canary.53
6
+
7
+ ## 8.1.0-canary.52
8
+
9
+ ## 8.1.0-canary.51
10
+
11
+ ## 8.1.0-canary.50
12
+
13
+ ## 8.1.0-canary.49
14
+
15
+ ## 8.1.0-canary.48
16
+
17
+ ## 8.1.0-canary.47
18
+
19
+ ## 8.1.0-canary.46
20
+
21
+ ## 8.1.0-canary.45
22
+
23
+ ## 8.1.0-canary.44
24
+
25
+ ## 8.1.0-canary.43
26
+
27
+ ## 8.1.0-canary.42
28
+
29
+ ## 8.1.0-canary.41
30
+
31
+ ## 8.1.0-canary.40
32
+
33
+ ## 8.1.0-canary.39
34
+
35
+ ## 8.1.0-canary.38
36
+
37
+ ## 8.1.0-canary.37
38
+
39
+ ## 8.1.0-canary.36
40
+
41
+ ## 8.1.0-canary.35
42
+
43
+ ### Minor Changes
44
+
45
+ - [#2301](https://github.com/graphcommerce-org/graphcommerce/pull/2301) [`47bb47b`](https://github.com/graphcommerce-org/graphcommerce/commit/47bb47bac4b3689a6859afbc587274d813e0b072) - Implement confirm email functionality
46
+ ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
47
+
48
+ ## 8.1.0-canary.34
49
+
50
+ ## 8.1.0-canary.33
51
+
52
+ ## 8.1.0-canary.32
53
+
54
+ ## 8.1.0-canary.31
55
+
56
+ ## 8.1.0-canary.30
57
+
58
+ ## 8.1.0-canary.29
59
+
60
+ ## 8.1.0-canary.28
61
+
62
+ ## 8.1.0-canary.27
63
+
64
+ ## 8.1.0-canary.26
65
+
66
+ ## 8.1.0-canary.25
67
+
68
+ ## 8.1.0-canary.24
69
+
70
+ ## 8.1.0-canary.23
71
+
72
+ ## 8.1.0-canary.22
73
+
74
+ ## 8.1.0-canary.21
75
+
76
+ ## 8.1.0-canary.20
77
+
78
+ ## 8.1.0-canary.19
79
+
80
+ ## 8.1.0-canary.18
81
+
82
+ ## 8.1.0-canary.17
83
+
84
+ ## 8.1.0-canary.16
85
+
86
+ ## 8.1.0-canary.15
87
+
88
+ ## 8.1.0-canary.14
89
+
90
+ ## 8.1.0-canary.13
91
+
92
+ ## 8.1.0-canary.12
93
+
94
+ ## 8.1.0-canary.11
95
+
96
+ ## 8.1.0-canary.10
97
+
98
+ ## 8.1.0-canary.9
99
+
3
100
  ## 8.1.0-canary.8
4
101
 
5
102
  ## 8.1.0-canary.7
package/Money.tsx CHANGED
@@ -1,50 +1,29 @@
1
1
  import { useQuery } from '@graphcommerce/graphql'
2
- import { ExtendableComponent, useNumberFormat } from '@graphcommerce/next-ui'
3
- import { useThemeProps } from '@mui/material'
4
- import { useMemo } from 'react'
2
+ import { CurrencyFormat, CurrencyFormatProps } from '@graphcommerce/next-ui'
5
3
  import { MoneyFragment } from './Money.gql'
6
4
  import { StoreConfigDocument } from './StoreConfig.gql'
7
5
 
8
6
  type OverridableProps = {
9
- // eslint-disable-next-line react/no-unused-prop-types
10
7
  round?: boolean
11
- /** @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters */
12
- // eslint-disable-next-line react/no-unused-prop-types
13
- formatOptions?: Intl.NumberFormatOptions
8
+ formatOptions?: Omit<CurrencyFormatProps, 'currency'>
14
9
  }
15
10
 
16
11
  export type MoneyProps = MoneyFragment & OverridableProps
17
12
 
18
- const name = 'Money'
19
-
20
- /** Expose the component to be exendable in your theme.components */
21
- declare module '@mui/material/styles/components' {
22
- interface Components {
23
- Money?: Pick<ExtendableComponent<OverridableProps>, 'defaultProps'>
24
- }
25
- }
26
-
27
13
  export function Money(props: MoneyProps) {
28
- const { currency, value, round = false, formatOptions } = useThemeProps({ name, props })
29
-
14
+ const { currency, value, round = false, formatOptions } = props
30
15
  const { data: config } = useQuery(StoreConfigDocument)
31
-
32
16
  const digits = (value ?? 0) % 1 !== 0
33
17
 
34
- const options: Intl.NumberFormatOptions = useMemo(
35
- () => ({
36
- style: 'currency',
37
- currency: currency ?? config?.storeConfig?.base_currency_code ?? '',
38
- ...(round && !digits && { minimumFractionDigits: 0 }),
39
- ...(round && digits && { minimumFractionDigits: 2 }),
40
- ...(!round && { minimumFractionDigits: 2 }),
41
- ...formatOptions,
42
- }),
43
- [config?.storeConfig?.base_currency_code, currency, digits, formatOptions, round],
44
- )
45
- const numberFormatter = useNumberFormat(options)
46
-
47
18
  if (typeof value === 'undefined' || value === null) return null
48
19
 
49
- return <>{numberFormatter.format(value)}</>
20
+ return (
21
+ <CurrencyFormat
22
+ currency={currency ?? config?.storeConfig?.base_currency_code ?? ''}
23
+ maximumFractionDigits={round && !digits ? 0 : 2}
24
+ {...formatOptions}
25
+ >
26
+ {value}
27
+ </CurrencyFormat>
28
+ )
50
29
  }
@@ -1,4 +1,4 @@
1
- fragment StoreConfigFragment on StoreConfig @injectable {
1
+ fragment StoreConfigFragment on StoreConfig {
2
2
  website_name
3
3
  store_code
4
4
  store_name
@@ -30,4 +30,5 @@ fragment StoreConfigFragment on StoreConfig @injectable {
30
30
  grid_per_page
31
31
  grid_per_page_values
32
32
  list_per_page
33
+ create_account_confirmation
33
34
  }
package/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from './components/GlobalHead/GlobalHead'
2
2
  export * from './hooks/useFindCountry'
3
3
  export * from './hooks/useFindRegion'
4
- export * from './link/createStoreLink'
5
4
  export * from './localeToStore'
6
5
  export * from './Money'
7
6
  export * from './Money.gql'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-store",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.1.0-canary.8",
5
+ "version": "9.0.0-canary.54",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,13 +12,13 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.8",
16
- "@graphcommerce/graphql": "^8.1.0-canary.8",
17
- "@graphcommerce/graphql-mesh": "^8.1.0-canary.8",
18
- "@graphcommerce/image": "^8.1.0-canary.8",
19
- "@graphcommerce/next-ui": "^8.1.0-canary.8",
20
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.8",
21
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.8",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.54",
16
+ "@graphcommerce/graphql": "^9.0.0-canary.54",
17
+ "@graphcommerce/graphql-mesh": "^9.0.0-canary.54",
18
+ "@graphcommerce/image": "^9.0.0-canary.54",
19
+ "@graphcommerce/next-ui": "^9.0.0-canary.54",
20
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.54",
21
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.54",
22
22
  "@lingui/core": "^4.2.1",
23
23
  "@lingui/macro": "^4.2.1",
24
24
  "@lingui/react": "^4.2.1",
@@ -1,13 +1,39 @@
1
- import type { graphqlConfig as graphqlConfigType } from '@graphcommerce/graphql'
1
+ import { setContext, type graphqlConfig as graphqlConfigType } from '@graphcommerce/graphql'
2
2
  import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
3
- import { createStoreLink } from '../link/createStoreLink'
4
3
 
5
4
  export const config: PluginConfig = {
6
5
  type: 'function',
7
6
  module: '@graphcommerce/graphql',
8
7
  }
9
8
 
9
+ declare module '@graphcommerce/graphql/config' {
10
+ interface PreviewData {
11
+ magentoPreviewVersion?: string
12
+ }
13
+ }
14
+
10
15
  export const graphqlConfig: FunctionPlugin<typeof graphqlConfigType> = (prev, conf) => {
11
16
  const results = prev(conf)
12
- return { ...results, links: [...results.links, createStoreLink(conf.storefront.locale)] }
17
+
18
+ const previewVersion = conf.previewData?.magentoPreviewVersion
19
+
20
+ return {
21
+ ...results,
22
+ links: [
23
+ ...results.links,
24
+ setContext((_, context) => {
25
+ if (!context.headers) context.headers = {}
26
+ context.headers.store = conf.storefront.magentoStoreCode
27
+ if (conf.preview) {
28
+ // To disable caching from the backend, we provide a bogus cache ID.
29
+ context.headers['x-magento-cache-id'] =
30
+ `random-cache-id${Math.random().toString(36).slice(2)}`
31
+ if (previewVersion) {
32
+ context.headers['preview-version'] = previewVersion
33
+ }
34
+ }
35
+ return context
36
+ }),
37
+ ],
38
+ }
13
39
  }
@@ -1,10 +0,0 @@
1
- import { setContext } from '@graphcommerce/graphql'
2
- import { localeToStore } from '../localeToStore'
3
-
4
- /** Apollo link to set the store header in the context */
5
- export const createStoreLink = (locale?: string) =>
6
- setContext((_, context) => {
7
- if (!context.headers) context.headers = {}
8
- context.headers.store = localeToStore(locale)
9
- return context
10
- })