-
Notifications
You must be signed in to change notification settings - Fork 53
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
Feat: Add Auth Content feature #2282
Feat: Add Auth Content feature #2282
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
72f542c
to
2eb9339
Compare
2eb9339
to
ec9dc67
Compare
@@ -29,7 +29,8 @@ module.exports = { | |||
symbol: '$', | |||
}, | |||
locale: 'en-US', | |||
channel: '{"salesChannel":"1","regionId":""}', | |||
channel: | |||
'{"salesChannel":"1","regionId":"","hasOnlyDefaultSalesChannel":"true"}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the validateSession throws an error, the default channel is used. Because of this, the 'hasOnlyDefaultSalesChannel': 'true' property was added in faststore.config
suggestion: You created the |
Got it, we've decided not to use the B2B term because the idea is for this feature to be used to identify whether users are logged in or not, regardless of whether they are developing a B2B feature. The concept is to add features without necessarily having a "B2B" and "B2C" division. It's interesting to know that the My Account feature is being brought to FastStore. Could you elaborate more on why this SDK wouldn't work in this case? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What's the purpose of this pull request?
This PR aims to add the functionality of Auth Content, the first feature introduced as part of the Faststore B2B initiative. This feature allows the store to hide certain UI blocks and grant access only to authorized users. To learn more about Auth Content and the Faststore B2B initiative, please refer to the RFCs and Product Vision documentation.
B2B Faststore Product Vision
B2B Faststore RFC
Auth Content RFC
How it works?
useAuth and ProfileChallenge
To enable the auth content feature, the useAuth hook and the ProfileChallenge have been added to @faststore/core. The hook checks if the user is logged in and has a valid sales channel. The component renders the children only if the useAuth allows it.
hasOnlyDefaultSalesChannel
Faststore utilizes a default Sales Channel for various logic operations such as search and catalog access. To validate the Sales Channel without disrupting faststore logic, a new flag called "hasOnlyDefaultSalesChannel" has been introduced. As the name suggests, this flag indicates whether the logged-in user has a real Sales Channel or only the default Sales Channel. This flag is used by useAuth to control access to Auth Content.
Starters Deploy Preview
The Auth Content is be used in this Preview on b2bfaststoredev linked with this PR
How to test it?
The preview should hide the Hero content and only display it when a user with a Sales Channel logs in.
References
B2B Faststore Product Vision
B2B Faststore RFC
Auth Content RFC
b2bfaststoredev
PR
Related Tasks
B2BTEAM-1591
B2BTEAM-1592