-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathroutes.tsx
More file actions
147 lines (140 loc) · 4.05 KB
/
routes.tsx
File metadata and controls
147 lines (140 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
/* istanbul ignore file */
// NOTE!
// This file is being ignored in the test coverage report for now. It reports `0%` functions
// tested, which brings down the overall coverage and blocks CI. There are tests still, but
// we don't want it to count toward coverage until we figure out how to cover the `functions`
// metric for this file in its test.
import React from 'react'
import loadable from '@loadable/component'
import {getConfig} from '@salesforce/pwa-kit-runtime/utils/ssr-config'
// Components
import {Skeleton} from '@chakra-ui/react'
import {configureRoutes} from '../src/utils/routes-utils'
const fallback = <Skeleton height="75vh" width="100%" />
const socialRedirectURI = getConfig()?.login?.social?.redirectURI
const resetPasswordLandingPath = getConfig()?.login?.resetPassword?.landingPath
const passwordlessLoginLandingPath = getConfig()?.login?.passwordless?.landingPath
// Pages
const Home = loadable(() => import('../src/pages/home'), {fallback})
const Login = loadable(() => import('../src/pages/login'), {fallback})
const Registration = loadable(() => import('../src/pages/registration'), {
fallback
})
const ResetPassword = loadable(() => import('../src/pages/reset-password'), {fallback})
const Account = loadable(() => import('../src/pages/account'), {fallback})
const Cart = loadable(() => import('../src/pages/cart'), {fallback})
const Checkout = loadable(() => import('../src/pages/checkout'), {
fallback
})
const CheckoutConfirmation = loadable(() => import('../src/pages/checkout/confirmation'), {
fallback
})
const SocialLoginRedirect = loadable(() => import('../src/pages/social-login-redirect'), {fallback})
const LoginRedirect = loadable(() => import('../src/pages/login-redirect'), {fallback})
const ProductDetail = loadable(() => import('../src/pages/product-detail'), {fallback})
const ProductList = loadable(() => import('../src/pages/product-list'), {
fallback
})
const StoreLocator = loadable(() => import('../src/pages/store-locator'), {
fallback
})
const Wishlist = loadable(() => import('../src/pages/account/wishlist'), {
fallback
})
const PageNotFound = loadable(() => import('../src/pages/page-not-found'))
export const routes = [
{
path: '/',
component: Home,
exact: true
},
{
path: '/login',
component: Login,
exact: true
},
{
path: '/registration',
component: Registration,
exact: true
},
{
path: '/reset-password',
component: ResetPassword,
exact: true
},
{
path: '/reset-password-landing',
component: ResetPassword,
exact: true
},
{
path: '/passwordless-login-landing',
component: Login,
exact: true
},
{
path: '/account',
component: Account
},
{
path: '/checkout',
component: Checkout,
exact: true
},
{
path: '/checkout/confirmation/:orderNo',
component: CheckoutConfirmation
},
{
path: '/callback',
component: LoginRedirect,
exact: true
},
{
path: '/social-callback',
component: SocialLoginRedirect,
exact: true
},
{
path: '/cart',
component: Cart,
exact: true
},
{
path: '/product/:productId',
component: ProductDetail
},
{
path: '/search',
component: ProductList
},
{
path: '/category/:categoryId',
component: ProductList
},
{
path: '/account/wishlist',
component: Wishlist
},
{
path: '/store-locator',
component: StoreLocator
},
{
path: '*',
component: PageNotFound
}
]
export default () => {
const config = getConfig()
return configureRoutes(routes, config, {
ignoredRoutes: ['/callback', '*']
})
}