Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing and Instantiating MenuItemImpl #35

Open
linkhat29 opened this issue May 1, 2024 · 0 comments
Open

Importing and Instantiating MenuItemImpl #35

linkhat29 opened this issue May 1, 2024 · 0 comments
Assignees

Comments

@linkhat29
Copy link

Hello,

I'm currently working on a react project with @bloomreach/react-sdk": "14.5.0" and "@bloomreach/spa-sdk": "14.6.0". I'm in the process of updating the code to work with Delivery API 1.0.

I'm trying to instantiate a new MenuItemImpl object to push onto a Menu object's items[] but I'm having some issues doing so.

When I try to import LinkFactory, MenuItemFactory, MenuItemImpl, MenuItemModel from the SPA SDK I get the following message

Module '"@bloomreach/spa-sdk"' has no exported member '

I'm currently on @bloomreach/react-sdk": "14.5.0" so I know it's really behind but I also can see the MenuItem interface coming from the package and it has the new getter methods for Delivery API 1.0:

interface MenuItem {
/**
* @return The child items.
/
getChildren(): MenuItem[];
/
*
* @return The menu item depth level.
/
getDepth(): number;
/
*
* @return The menu item link.
/
getLink(): Link | undefined;
/
*
* @return The menu item name.
/
getName(): string;
/
*
* @return The menu item parameters.
/
getParameters(): object;
/
*
* @return The menu item url.
/
getUrl(): string | undefined;
/
*
* @return Whether the menu item is expanded.
/
isExpanded(): boolean;
/
*
* @return Whether the menu item is repository based.
/
isRepositoryBased(): boolean;
/
*
* @return Whether the menu item is selected.
*/
isSelected(): boolean;
}

Is there a reason the other members aren't exported?

Also, when I look at the React example code I see that the parameters for MenuItemImpl include a menuItemModel, LinkFactory, and MenuItemFactory. However I don't see any examples on how to instantiate LinkFactory and MenuItemFactory. I just see mocking in the spec files. Is there any example on that?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants