@graphcommerce/framer-next-pages 8.1.0-canary.9 → 9.0.0-canary.100

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,195 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.100
4
+
5
+ ## 9.0.0-canary.99
6
+
7
+ ## 9.0.0-canary.98
8
+
9
+ ## 9.0.0-canary.97
10
+
11
+ ## 9.0.0-canary.96
12
+
13
+ ## 9.0.0-canary.95
14
+
15
+ ## 9.0.0-canary.94
16
+
17
+ ## 9.0.0-canary.93
18
+
19
+ ## 9.0.0-canary.92
20
+
21
+ ## 9.0.0-canary.91
22
+
23
+ ## 9.0.0-canary.90
24
+
25
+ ## 9.0.0-canary.89
26
+
27
+ ## 9.0.0-canary.88
28
+
29
+ ## 9.0.0-canary.87
30
+
31
+ ## 9.0.0-canary.86
32
+
33
+ ## 9.0.0-canary.85
34
+
35
+ ## 9.0.0-canary.84
36
+
37
+ ## 9.0.0-canary.83
38
+
39
+ ## 9.0.0-canary.82
40
+
41
+ ## 9.0.0-canary.81
42
+
43
+ ## 9.0.0-canary.80
44
+
45
+ ## 9.0.0-canary.79
46
+
47
+ ### Patch Changes
48
+
49
+ - [#2356](https://github.com/graphcommerce-org/graphcommerce/pull/2356) [`d283901`](https://github.com/graphcommerce-org/graphcommerce/commit/d283901cb537c3e7bf6f5500e9f52f47f452cf10) - Loading an overlay page directly would animate in the overlay instead of directly showing it. ([@paales](https://github.com/paales))
50
+
51
+ ## 9.0.0-canary.78
52
+
53
+ ## 9.0.0-canary.77
54
+
55
+ ## 9.0.0-canary.76
56
+
57
+ ## 9.0.0-canary.75
58
+
59
+ ## 9.0.0-canary.74
60
+
61
+ ## 9.0.0-canary.73
62
+
63
+ ## 9.0.0-canary.72
64
+
65
+ ## 9.0.0-canary.71
66
+
67
+ ## 9.0.0-canary.70
68
+
69
+ ## 9.0.0-canary.69
70
+
71
+ ## 9.0.0-canary.68
72
+
73
+ ## 9.0.0-canary.67
74
+
75
+ ## 9.0.0-canary.66
76
+
77
+ ## 9.0.0-canary.65
78
+
79
+ ## 9.0.0-canary.64
80
+
81
+ ## 9.0.0-canary.63
82
+
83
+ ## 9.0.0-canary.62
84
+
85
+ ## 9.0.0-canary.61
86
+
87
+ ## 9.0.0-canary.60
88
+
89
+ ## 9.0.0-canary.59
90
+
91
+ ## 9.0.0-canary.58
92
+
93
+ ## 9.0.0-canary.57
94
+
95
+ ## 9.0.0-canary.56
96
+
97
+ ## 9.0.0-canary.55
98
+
99
+ ## 9.0.0-canary.54
100
+
101
+ ## 8.1.0-canary.53
102
+
103
+ ## 8.1.0-canary.52
104
+
105
+ ## 8.1.0-canary.51
106
+
107
+ ## 8.1.0-canary.50
108
+
109
+ ## 8.1.0-canary.49
110
+
111
+ ## 8.1.0-canary.48
112
+
113
+ ## 8.1.0-canary.47
114
+
115
+ ## 8.1.0-canary.46
116
+
117
+ ## 8.1.0-canary.45
118
+
119
+ ## 8.1.0-canary.44
120
+
121
+ ## 8.1.0-canary.43
122
+
123
+ ## 8.1.0-canary.42
124
+
125
+ ## 8.1.0-canary.41
126
+
127
+ ## 8.1.0-canary.40
128
+
129
+ ## 8.1.0-canary.39
130
+
131
+ ## 8.1.0-canary.38
132
+
133
+ ## 8.1.0-canary.37
134
+
135
+ ## 8.1.0-canary.36
136
+
137
+ ### Minor Changes
138
+
139
+ - [#2284](https://github.com/graphcommerce-org/graphcommerce/pull/2284) [`5ee712c`](https://github.com/graphcommerce-org/graphcommerce/commit/5ee712c962c6b0dda903172660d70cf433321b7e) - Prevent checkout on looping back and forth with the cart overlay when navigating directly to the checkout. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
140
+
141
+ ## 8.1.0-canary.35
142
+
143
+ ## 8.1.0-canary.34
144
+
145
+ ## 8.1.0-canary.33
146
+
147
+ ## 8.1.0-canary.32
148
+
149
+ ## 8.1.0-canary.31
150
+
151
+ ## 8.1.0-canary.30
152
+
153
+ ## 8.1.0-canary.29
154
+
155
+ ## 8.1.0-canary.28
156
+
157
+ ## 8.1.0-canary.27
158
+
159
+ ## 8.1.0-canary.26
160
+
161
+ ## 8.1.0-canary.25
162
+
163
+ ## 8.1.0-canary.24
164
+
165
+ ## 8.1.0-canary.23
166
+
167
+ ## 8.1.0-canary.22
168
+
169
+ ## 8.1.0-canary.21
170
+
171
+ ## 8.1.0-canary.20
172
+
173
+ ## 8.1.0-canary.19
174
+
175
+ ## 8.1.0-canary.18
176
+
177
+ ## 8.1.0-canary.17
178
+
179
+ ## 8.1.0-canary.16
180
+
181
+ ## 8.1.0-canary.15
182
+
183
+ ## 8.1.0-canary.14
184
+
185
+ ## 8.1.0-canary.13
186
+
187
+ ## 8.1.0-canary.12
188
+
189
+ ## 8.1.0-canary.11
190
+
191
+ ## 8.1.0-canary.10
192
+
3
193
  ## 8.1.0-canary.9
4
194
 
5
195
  ## 8.1.0-canary.8
@@ -24,8 +214,7 @@
24
214
 
25
215
  ### Patch Changes
26
216
 
27
- - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded
28
- ([@paales](https://github.com/paales))
217
+ - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded ([@paales](https://github.com/paales))
29
218
 
30
219
  ## 8.0.5-canary.10
31
220
 
@@ -45,8 +234,7 @@
45
234
 
46
235
  ### Patch Changes
47
236
 
48
- - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded
49
- ([@paales](https://github.com/paales))
237
+ - [#2236](https://github.com/graphcommerce-org/graphcommerce/pull/2236) [`85fb916`](https://github.com/graphcommerce-org/graphcommerce/commit/85fb916e5ec2a1456a93a59bf92a5f414fee8595) - Solve issue where the inert prop wouldnt be properly forwarded ([@paales](https://github.com/paales))
50
238
 
51
239
  ## 8.0.5-canary.2
52
240
 
@@ -58,8 +246,7 @@
58
246
 
59
247
  ### Patch Changes
60
248
 
61
- - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property
62
- ([@carlocarels90](https://github.com/carlocarels90))
249
+ - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property ([@carlocarels90](https://github.com/carlocarels90))
63
250
 
64
251
  ## 8.0.4-canary.1
65
252
 
@@ -67,8 +254,7 @@
67
254
 
68
255
  ### Patch Changes
69
256
 
70
- - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property
71
- ([@carlocarels90](https://github.com/carlocarels90))
257
+ - [#2228](https://github.com/graphcommerce-org/graphcommerce/pull/2228) [`0c0cacb`](https://github.com/graphcommerce-org/graphcommerce/commit/0c0cacb8725f0a626ea5d3acf154d83c433c3eb7) - apply correct type for the inert property ([@carlocarels90](https://github.com/carlocarels90))
72
258
 
73
259
  ## 8.0.3
74
260
 
package/README.md CHANGED
@@ -87,7 +87,7 @@ Example routes:
87
87
 
88
88
  - `pages/account.tsx`
89
89
  - `pages/account/orders.tsx`
90
- - `pages/account/orders/[orderId].tsx`
90
+ - `pages/account/orders/[orderNumber].tsx`
91
91
 
92
92
  ```tsx
93
93
  import { PageOptions } from '@graphcommerce/framer-next-pages'
@@ -5,7 +5,7 @@ import { PrivateRouteInfo } from 'next/dist/shared/lib/router/router'
5
5
  import { AppPropsType } from 'next/dist/shared/lib/utils'
6
6
  import { NextRouter, Router } from 'next/router'
7
7
  import { useEffect, useRef, useState } from 'react'
8
- import { pageContext } from '../context/pageContext'
8
+ import { Direction, pageContext } from '../context/pageContext'
9
9
  import type { PageComponent, PageItem, UpPage } from '../types'
10
10
  import { Page } from './Page'
11
11
  import { PageRenderer } from './PageRenderer'
@@ -56,7 +56,8 @@ export function FramerNextPages(props: PagesProps) {
56
56
  const idx = routerKeys.indexOf(key)
57
57
 
58
58
  const prevHistory = useRef<number>(-1)
59
- const direction = idx >= prevHistory.current ? 1 : -1
59
+ let direction: Direction = idx >= prevHistory.current ? 1 : -1
60
+ if (prevHistory.current === -1) direction = 0
60
61
 
61
62
  prevHistory.current = idx
62
63
 
@@ -102,8 +103,21 @@ export function FramerNextPages(props: PagesProps) {
102
103
 
103
104
  let renderItems = [...items.current]
104
105
 
106
+ /** Removes the page if the up path equls the path of a overlay and there is no history present **/
107
+ const upPath = (renderItems.at(0)?.pageProps?.up as { href: string; title: string })?.href
108
+ const overlayPath = renderItems.at(-1)?.routerContext.pageInfo.asPath
109
+ if (
110
+ renderItems.length === 2 &&
111
+ upPath &&
112
+ overlayPath &&
113
+ upPath === overlayPath &&
114
+ renderItems.at(-1)?.overlayGroup
115
+ ) {
116
+ renderItems = renderItems.slice(1)
117
+ }
118
+
105
119
  /** We need to render back to the last item that isn't an overlay. */
106
- const plainIdx = findPlainIdx(items.current)
120
+ const plainIdx = findPlainIdx(renderItems)
107
121
 
108
122
  const shouldLoadFb = plainIdx === -1 && typeof window !== 'undefined' && !fb
109
123
 
@@ -1,9 +1,17 @@
1
1
  import { createContext } from 'react'
2
2
 
3
- export type Direction = 1 | -1
3
+ /**
4
+ * - `-1` -> Navigated back
5
+ * - `0` -> Loaded the page
6
+ * - `1` -> Navigated forward
7
+ */
8
+ export type Direction = -1 | 0 | 1
4
9
 
5
10
  export type PageContext = {
6
- /** Number of steps we need to navigate back to go to the last non-overlay page and thus close the overlay */
11
+ /**
12
+ * Number of steps we need to navigate back to go to the last non-overlay page and thus close the
13
+ * overlay
14
+ */
7
15
  closeSteps: number
8
16
 
9
17
  /** Number of steps we can go back inside the the current overlay */
@@ -10,24 +10,17 @@ export function useHistoryLink(options: UseHistoryLink) {
10
10
  const prevRouter = usePrevPageRouter()
11
11
  const router = useRouter()
12
12
 
13
- const onClick =
14
- href === prevRouter?.asPath
15
- ? (e: ClickEvent) => {
16
- e.preventDefault()
17
- router.back()
18
- }
19
- : undefined
13
+ const onClick = (e: ClickEvent) => {
14
+ e.preventDefault()
15
+
16
+ if (href === prevRouter?.asPath) return router.back()
17
+ return router.replace(href)
18
+ }
20
19
 
21
20
  return { onClick, href }
22
21
  }
23
22
 
24
23
  export function useHistoryGo(options: UseHistoryLink) {
25
- const { onClick, href } = useHistoryLink(options)
26
- const router = useRouter()
27
-
28
- return () => {
29
- if (onClick) onClick({ preventDefault: () => {} })
30
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
31
- else router.push(href)
32
- }
24
+ const { onClick } = useHistoryLink(options)
25
+ return () => onClick({ preventDefault: () => {} })
33
26
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/framer-next-pages",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.1.0-canary.9",
5
+ "version": "9.0.0-canary.100",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,10 +12,10 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.9",
16
- "@graphcommerce/framer-utils": "^8.1.0-canary.9",
17
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.9",
18
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.9",
15
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.100",
16
+ "@graphcommerce/framer-utils": "^9.0.0-canary.100",
17
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.100",
18
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.100",
19
19
  "framer-motion": "^10.0.0",
20
20
  "next": "*",
21
21
  "react": "^18.2.0",