const pathParams = {
// https://stackoverflow.com/questions/35604617/react-router-with-optional-path-parameter
homeAlone: `/homeAlone/:others?`,
// homeAlone: `/homeAlone`,
myaccount: `/myaccount/:accountTab?`,
catalog: `/category/:categoryId`,
merchCatalog: `/merchProductList/:categoryId`,
search: `/search/:searchTerm`,
product: `/product/:productId`,
storelocator: `/storelocator`,
signin: '/signin',
adminSignin: '/adminsignin',
adminRegister: '/adminRegister',
logout: '/logout',
resetpassword: '/resetpassword',
adminResetPassword: '/adminresetpassword',
register: '/register',
signin_success: '/signin_success',
signinRegister: '/signin?step=register',
checkout: '/checkout',
favorites: '/favorites',
orderlookup: '/orderlookup/:orderNumber?',
orderconfirmation: '/orderconfirmation',
// compare: '/compare/:identifiers?',
categoryLanding: '/categoryLanding/:categoryId',
brandLanding: '/brandLanding',
functionality: '/functionality',
// works for 404
// works for dynamic
fallback: '/:fallback',
// === account ===
myaccountLanding: `/myaccount/welcome`,
myaccountOrders: `/myaccount/orders`,
myaccountPreferences: `/myaccount/preference`,
myaccountAddressBook: `/myaccount/addressbook`,
myaccountShippingMethods: `/myaccount/shippingmethod`,
myaccountPrivacy: `/myaccount/privacy`,
myaccountGiftCards: `/myaccount/giftcards`,
myaccountPaymentMethods: `/myaccount/payment`,
myaccountDashboard: `/myaccount/dashboard`,
myaccountApprovals: `/myaccount/approvals`,
myaccountUserManagement: `/myaccount/usermanagement`,
status: `/status`,
myaccountOrderdetails: `/order/:orderid?/:itemid?`,
myaccountItemdetails: `/order/:orderid?/:itemid`,
myaccountListsManagement: `/myaccount/listsmanagement`,
};
// @@todo @@perf
// @note - this is kind of confusing because it has the route as the key
// and the value is the page title
// but that should be in a fixture instead...
// it would avoid ANOTHER loop in every route
const accountSectionTypes = {
// landing: 'MY-ACCOUNT',
welcome: 'MY-PROFILE',
orders: 'ORDER-HISTORY',
payment: 'PAYMENT-METHODS',
shippingmethod: 'SHIPPING-ADDRESS',
loyalty: 'LOYALTY-POINTS',
// giftcards: 'GIFT-CARDS',
// profile: 'ACCOUNT-PROFILE',
preference: 'PREFERENCE',
dashboard: 'DASHBOARD',
approvals: 'APPROVALS',
privacy: 'PRIVACY-SETTINGS',
usermanagement: 'USER-MANAGEMENT',
listsmanagement: 'LISTS',
};
const orderLookupTypes = {
items: 'ITEMS',
};
const orderHistoryTypes = {
orderdetails: 'ORDER-DETAIL',
itemdetails: 'ITEM-DETAIL',
};
// side-effect-free
const fromObjToLowerCaseValues = (obj) => {
const cloned = Object.assign({}, obj);
Object.keys(cloned).forEach(key => {
cloned[key] = key.toLowerCase();
});
return cloned;
};
const orderHistoryList = fromObjToLowerCaseValues(orderHistoryTypes);
const orderLookupSubRoutePathNameList = fromObjToLowerCaseValues(orderLookupTypes);
const accountSubRoutePathNameList = fromObjToLowerCaseValues(accountSectionTypes);
const orderListMenu = [
{
title: 'Order History',
name: 'ORDER-HISTORY',
link: pathParams.myaccountOrders,
},
{
title: 'Order Details',
name: 'ORDER-DETAIL',
link: pathParams.myaccountOrderdetails,
},
{
title: 'Item Details',
name: 'ITEM-DETAIL',
link: pathParams.myaccountItemdetails,
},
];
const AdminAccountMenu = [
{
title: 'Dashboard Overview',
name: 'DASHBOARD',
link: pathParams.myaccountDashboard,
dataQa: 'qa-dashboard-overview',
},
{
title: 'My Profile',
name: 'MY-PROFILE',
link: `${pathParams.myaccountLanding}`,
},
{
title: 'Order History',
name: 'ORDER-HISTORY',
link: pathParams.myaccountOrders,
},
// {
// title: 'Account Profile',
// name: 'ACCOUNT-PROFILE',
// link: `${pathParams.myaccountProfile}`,
// },
{
title: 'Payment Methods',
name: 'PAYMENT-METHODS',
link: pathParams.myaccountPaymentMethods,
},
{
title: 'Address Book',
name: 'SHIPPING-ADDRESS',
link: pathParams.myaccountShippingMethods,
},
// {
// title: 'Approvals',
// name: 'APPROVALS',
// link: pathParams.myaccountApprovals,
// },
{
title: 'User Management',
name: 'USER-MANAGEMENT',
link: pathParams.myaccountUserManagement,
},
];
const UserAccountMenu = [
{
title: process.env.BUSINESS_RELATIONSHIP === 'B2B' ? 'My Profile' : 'Account Overview',
name: 'MY-PROFILE',
link: `${pathParams.myaccountLanding}`,
},
{
title: 'Order History',
name: 'ORDER-HISTORY',
link: pathParams.myaccountOrders,
},
{
title: 'Payment Methods',
name: 'PAYMENT-METHODS',
link: pathParams.myaccountPaymentMethods,
},
{
title: 'Address Book',
name: 'SHIPPING-ADDRESS',
link: pathParams.myaccountShippingMethods,
},
];
if (process.env.BUSINESS_RELATIONSHIP === 'B2C') {
UserAccountMenu.push({
title: 'Lists',
name: 'LISTS',
link: pathParams.myaccountListsManagement,
});
UserAccountMenu.push({
title: 'Privacy Settings',
name: 'PRIVACY-SETTINGS',
link: pathParams.myaccountPrivacy,
});
}
const myaccountMenu = {
user: UserAccountMenu,
admin: AdminAccountMenu,
};
export { pathParams };
export { myaccountMenu, orderListMenu };
export { accountSectionTypes, orderHistoryTypes, orderLookupTypes };
export { accountSubRoutePathNameList, orderHistoryList, orderLookupSubRoutePathNameList };
export default pathParams;
//# sourceMappingURL=pathParams.js.map