@graphcommerce/framer-next-pages 3.0.0 → 3.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,72 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1281](https://github.com/ho-nl/m2-pwa/pull/1281)
8
+ [`4bb963d75`](https://github.com/ho-nl/m2-pwa/commit/4bb963d7595b5ce6e3a4924cc2e3e8b0210cdcd6)
9
+ Thanks [@paales](https://github.com/paales)! - Add an option the FramerNextPages component to
10
+ define a fallback and fallbackRoute.
11
+
12
+ ### Patch Changes
13
+
14
+ - [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
15
+ Thanks [@paales](https://github.com/paales)! - made packages public
16
+
17
+ - Updated dependencies
18
+ [[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)]:
19
+ - @graphcommerce/framer-utils@3.0.3
20
+
21
+ ## 3.0.2
22
+
23
+ ### Patch Changes
24
+
25
+ - [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
26
+ [`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7)
27
+ Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and
28
+ `ApolloErrorSnackbar` to the ecommerce-ui package.
29
+
30
+ Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from
31
+ `magento-graphcms` example.
32
+
33
+ Removed dependency an `@graphcommerce/react-hook-form` from `magento-graphcms` example.
34
+
35
+ Added dependency `@graphcommerce/ecommerce-ui` from `magento-graphcms` example.
36
+
37
+ * [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
38
+ [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
39
+ Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
40
+ `dependencies` to `peerDependencies`. The result of this is that there will be significantly less
41
+ duplicate packages in the node_modules folders.
42
+
43
+ - [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
44
+ [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
45
+ Thanks [@paales](https://github.com/paales)! - Upgraded to
46
+ [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
47
+ implementing
48
+ [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
49
+ soon.
50
+
51
+ This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
52
+ frontend to be able to revalidate pages manually.
53
+
54
+ - Updated dependencies
55
+ [[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
56
+ [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)]:
57
+ - @graphcommerce/framer-utils@3.0.2
58
+
59
+ ## 3.0.1
60
+
61
+ ### Patch Changes
62
+
63
+ - [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)
64
+ Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files,
65
+ so that the packages link to back to the website and repository
66
+ - Updated dependencies
67
+ [[`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)]:
68
+ - @graphcommerce/framer-utils@3.0.1
69
+
3
70
  ## 3.0.0
4
71
 
5
72
  ### Major Changes
@@ -15,6 +15,12 @@ function findPlainIdx(items: PageItem[]) {
15
15
  type PagesProps = Omit<AppPropsType<NextRouter>, 'pageProps' | 'Component'> & {
16
16
  Component: PageComponent
17
17
  pageProps?: { up?: UpPage | null }
18
+
19
+ /** Fallback URL that is loaded when there is no page available behind the current overlay */
20
+ fallback?: `/${string}`
21
+
22
+ /** The path to the route-file */
23
+ fallbackRoute?: `/${string}`
18
24
  }
19
25
 
20
26
  function getPageInfo(router: NextRouter) {
@@ -35,7 +41,7 @@ function getPageInfo(router: NextRouter) {
35
41
  // }
36
42
 
37
43
  export default function FramerNextPages(props: PagesProps) {
38
- const { router, Component, pageProps: incomingProps } = props
44
+ const { router, Component, pageProps: incomingProps, fallback = '/', fallbackRoute = '/' } = props
39
45
 
40
46
  const items = useRef<PageItem[]>([])
41
47
  const idx = Number(global.window?.history.state?.idx ?? 0)
@@ -94,7 +100,16 @@ export default function FramerNextPages(props: PagesProps) {
94
100
  // todo: implement fallback loading for up property
95
101
  // const up = items.current[0].PageComponent.pageOptions?.up?.href ?? '/'
96
102
  const up = '/'
97
- const info = await (router as Router).getRouteInfo(up, up, {}, up, up, { shallow: false })
103
+ const info = await (router as Router).getRouteInfo(
104
+ fallbackRoute,
105
+ fallback,
106
+ {},
107
+ fallback,
108
+ fallback,
109
+ { shallow: false },
110
+ undefined,
111
+ false,
112
+ )
98
113
 
99
114
  const pageInfo = { asPath: up, pathname: up, locale: router.locale, query: {} }
100
115
  const Fallback = info.Component as PageComponent
@@ -123,7 +138,7 @@ export default function FramerNextPages(props: PagesProps) {
123
138
  return () => {
124
139
  if (cancel) cancelIdleCallback(cancel)
125
140
  }
126
- }, [shouldLoadFb, router])
141
+ }, [shouldLoadFb, router, fallbackRoute, fallback])
127
142
 
128
143
  // Add the fallback if it is available
129
144
  if (fb && plainIdx === -1) renderItems = [fb, ...renderItems]
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@graphcommerce/framer-next-pages",
3
- "version": "3.0.0",
3
+ "homepage": "https://www.graphcommerce.org/",
4
+ "repository": "github:graphcommerce-org/graphcommerce",
5
+ "version": "3.1.0",
4
6
  "sideEffects": false,
5
- "scripts": {
6
- "dev": "tsc -W"
7
- },
8
7
  "prettier": "@graphcommerce/prettier-config-pwa",
9
8
  "eslintConfig": {
10
9
  "extends": "@graphcommerce/eslint-config-pwa",
@@ -13,17 +12,17 @@
13
12
  }
14
13
  },
15
14
  "dependencies": {
16
- "@graphcommerce/framer-utils": "^3.0.0"
15
+ "@graphcommerce/framer-utils": "^3.0.3"
17
16
  },
18
17
  "devDependencies": {
19
- "@graphcommerce/eslint-config-pwa": "^4.0.0",
20
- "@graphcommerce/prettier-config-pwa": "^4.0.0",
21
- "@graphcommerce/typescript-config-pwa": "^4.0.0",
22
- "@playwright/test": "^1.18.1"
18
+ "@graphcommerce/eslint-config-pwa": "^4.0.3",
19
+ "@graphcommerce/prettier-config-pwa": "^4.0.2",
20
+ "@graphcommerce/typescript-config-pwa": "^4.0.2",
21
+ "@playwright/test": "^1.19.1"
23
22
  },
24
23
  "peerDependencies": {
25
24
  "framer-motion": "^6.2.4",
26
- "next": "^12.0.10",
25
+ "next": "^12.1.0",
27
26
  "react": "^17.0.2",
28
27
  "react-dom": "^17.0.2"
29
28
  }