@graphcommerce/magento-store 4.0.1 → 4.1.0

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,89 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1285](https://github.com/ho-nl/m2-pwa/pull/1285)
8
+ [`ed9703b06`](https://github.com/ho-nl/m2-pwa/commit/ed9703b062d23ee01b1605ff9917c0ac3247fc25)
9
+ Thanks [@paales](https://github.com/paales)! - Added the ability to configure `defaultProps` for
10
+ the <Money/> component.
11
+
12
+ ```ts
13
+ // For example in examples/magento-graphcms/theme.ts
14
+
15
+ const createOverrides = (theme: Theme): Components => ({
16
+ Money: {
17
+ defaultProps: {
18
+ round: true,
19
+ formatOptions: {
20
+ style: 'decimal',
21
+ },
22
+ },
23
+ },
24
+ })
25
+ ```
26
+
27
+ ### Patch Changes
28
+
29
+ - [#1285](https://github.com/ho-nl/m2-pwa/pull/1285)
30
+ [`c85294ba6`](https://github.com/ho-nl/m2-pwa/commit/c85294ba6d742ce78c074559a1e95409b25a5017)
31
+ Thanks [@paales](https://github.com/paales)! - upgraded dependencies
32
+
33
+ - Updated dependencies
34
+ [[`c85294ba6`](https://github.com/ho-nl/m2-pwa/commit/c85294ba6d742ce78c074559a1e95409b25a5017)]:
35
+ - @graphcommerce/next-ui@4.1.3
36
+
37
+ ## 4.0.3
38
+
39
+ ### Patch Changes
40
+
41
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
42
+ Thanks [@paales](https://github.com/paales)! - made packages public
43
+
44
+ * [#1278](https://github.com/ho-nl/m2-pwa/pull/1278)
45
+ [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20)
46
+ Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
47
+
48
+ * Updated dependencies
49
+ [[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96),
50
+ [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20),
51
+ [`3a719c88c`](https://github.com/ho-nl/m2-pwa/commit/3a719c88cad1eab58602de28c41adc0fc4827e1d),
52
+ [`5ffcb56bf`](https://github.com/ho-nl/m2-pwa/commit/5ffcb56bfcbe49ebeaf24f9341e819a145ab9a14)]:
53
+ - @graphcommerce/graphql@3.0.3
54
+ - @graphcommerce/image@3.1.0
55
+ - @graphcommerce/next-ui@4.1.2
56
+
57
+ ## 4.0.2
58
+
59
+ ### Patch Changes
60
+
61
+ - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
62
+ [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
63
+ Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
64
+ `dependencies` to `peerDependencies`. The result of this is that there will be significantly less
65
+ duplicate packages in the node_modules folders.
66
+
67
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
68
+ [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
69
+ Thanks [@paales](https://github.com/paales)! - Upgraded to
70
+ [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
71
+ implementing
72
+ [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
73
+ soon.
74
+
75
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
76
+ frontend to be able to revalidate pages manually.
77
+
78
+ * Updated dependencies
79
+ [[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7),
80
+ [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
81
+ [`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b),
82
+ [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)]:
83
+ - @graphcommerce/next-ui@4.1.1
84
+ - @graphcommerce/graphql@3.0.2
85
+ - @graphcommerce/image@3.0.2
86
+
3
87
  ## 4.0.1
4
88
 
5
89
  ### Patch Changes
package/Money.tsx CHANGED
@@ -1,11 +1,30 @@
1
1
  import { useQuery } from '@graphcommerce/graphql'
2
- import React, { useMemo } from 'react'
2
+ import { ExtendableComponent } from '@graphcommerce/next-ui'
3
+ import { useThemeProps } from '@mui/material'
4
+ import { useMemo } from 'react'
3
5
  import { MoneyFragment } from './Money.gql'
4
6
  import { StoreConfigDocument } from './StoreConfig.gql'
5
7
 
6
- export type MoneyProps = MoneyFragment & { round?: boolean }
8
+ type OverridableProps = {
9
+ round?: boolean
10
+ /** @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters */
11
+ formatOptions?: Intl.NumberFormatOptions
12
+ }
13
+
14
+ export type MoneyProps = MoneyFragment & OverridableProps
15
+
16
+ const name = 'Money'
17
+
18
+ /** Expose the component to be exendable in your theme.components */
19
+ declare module '@mui/material/styles/components' {
20
+ interface Components {
21
+ Money?: Pick<ExtendableComponent<OverridableProps>, 'defaultProps'>
22
+ }
23
+ }
24
+
25
+ export function Money(props: MoneyProps) {
26
+ const { currency, value, round = false, formatOptions } = useThemeProps({ name, props })
7
27
 
8
- export function Money({ currency, value, round = false }: MoneyProps) {
9
28
  const { data: config } = useQuery(StoreConfigDocument)
10
29
  const locale = config?.storeConfig?.locale
11
30
 
@@ -18,8 +37,9 @@ export function Money({ currency, value, round = false }: MoneyProps) {
18
37
  style: 'currency',
19
38
  currency: currency ?? config?.storeConfig?.base_currency_code ?? '',
20
39
  ...(digits && { minimumFractionDigits: 0 }),
40
+ ...formatOptions,
21
41
  })
22
- }, [config?.storeConfig?.base_currency_code, currency, digits, locale])
42
+ }, [config?.storeConfig?.base_currency_code, currency, digits, formatOptions, locale])
23
43
 
24
44
  if (!numberFormatter || !value) return null
25
45
 
@@ -19,6 +19,7 @@ query StoreConfig {
19
19
  category_url_suffix
20
20
  product_url_suffix
21
21
  secure_base_link_url
22
+ secure_base_url
22
23
 
23
24
  root_category_uid
24
25
 
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": "4.0.1",
5
+ "version": "4.1.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,20 +12,22 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.0.1",
16
- "@graphcommerce/prettier-config-pwa": "^4.0.1",
17
- "@graphcommerce/typescript-config-pwa": "^4.0.1",
18
- "@playwright/test": "^1.18.1"
15
+ "@graphcommerce/eslint-config-pwa": "^4.0.4",
16
+ "@graphcommerce/prettier-config-pwa": "^4.0.2",
17
+ "@graphcommerce/typescript-config-pwa": "^4.0.2",
18
+ "@playwright/test": "^1.19.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/graphql": "^3.0.1",
22
- "@graphcommerce/image": "^3.0.1",
23
- "@graphcommerce/next-ui": "^4.0.1",
21
+ "@graphcommerce/graphql": "^3.0.3",
22
+ "@graphcommerce/image": "^3.1.0",
23
+ "@graphcommerce/next-ui": "^4.1.3",
24
+ "type-fest": "^2.12.0"
25
+ },
26
+ "peerDependencies": {
24
27
  "@lingui/macro": "^3.13.2",
25
28
  "@mui/material": "^5.4.1",
26
29
  "next": "^12.0.10",
27
30
  "react": "^17.0.2",
28
- "react-dom": "^17.0.2",
29
- "type-fest": "^2.11.2"
31
+ "react-dom": "^17.0.2"
30
32
  }
31
33
  }